-
Notifications
You must be signed in to change notification settings - Fork 473
Pass redirect source and target flags to history tracking delegates #4268
Conversation
This isn't complete yet—I think we'll also need a way to filter out hidden URLs in views. But we'll need to change a-s to pass the |
After thinking more about this, let's do the filtering in a-s for now (mozilla/application-services#1715). We can always change a-c or Fenix to exclude hidden on a per-view basis as we need, and that minimizes the changes that Fenix will need to make (just bump the a-c and a-s versions). See also mozilla/application-services#1492. |
56f5bbb
to
ed61507
Compare
ed61507
to
7d77ceb
Compare
@grigoryk Please review at your convenience! |
7d77ceb
to
588152d
Compare
Will this fix this? mozilla-mobile/fenix#2542 |
Nope, that's different; we intentionally don't filter out hidden visits from the awesomebar. I'd be curious to hear if they persist once a profile accumulates more history, like @thomcc mentioned in #3027 (comment). I see the same thing in a fresh Desktop profile: visiting https://www.mozilla.org/firefox/new (which redirects to https://www.mozilla.org/en-US/firefox/new/), then typing "mozilla firefox" into the awesomebar shows this: Doing the same in my regular profile doesn't, because I've visited and bookmarked waaay more Mozilla and Firefox sites. But Desktop's suggestion algorithm probably wasn't written with mobile in mind. It sounds like it's worth diverging, because suggestions for redirects are much lower value here. |
A little nudge here: @linacambridge does this need more work, or @grigoryk does this need more review? |
@@ -14,7 +14,7 @@ interface HistoryStorage : Storage { | |||
* @param uri of the page which was visited. | |||
* @param visitType type of the visit, see [VisitType]. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update comments with updated param. But please see comment below first.
components/concept/storage/src/main/java/mozilla/components/concept/storage/HistoryStorage.kt
Show resolved
Hide resolved
docs/changelog.md
Outdated
@@ -14,6 +14,8 @@ permalink: /changelog/ | |||
|
|||
* **feature-pwa** | |||
* Adds `WebAppUseCases.isInstallable` to check if the current session can be installed as a Progressive Web App. | |||
* **browser-engine-gecko-nightly**, **browser-engine-gecko-beta** and **browser-engine-gecko** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extra empty line needed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@linacambridge Please move this to the latest version.
Thanks, @rocketsroger! 🎊 Would you like me to go ahead and flatten |
I'm good with keeping it as is. Since there's a good reason for it. Please update the kdoc parameters and also move the change in changlog.md to the latest version. I think this is is good to go except the small changes. |
588152d
to
d5a0da7
Compare
Codecov Report
@@ Coverage Diff @@
## master #4268 +/- ##
============================================
- Coverage 81.95% 81.02% -0.93%
- Complexity 4190 4203 +13
============================================
Files 538 540 +2
Lines 18074 18454 +380
Branches 2697 2746 +49
============================================
+ Hits 14812 14952 +140
- Misses 2181 2384 +203
- Partials 1081 1118 +37
Continue to review full report at Codecov.
|
@rocketsroger Done! |
There's some confusion in `GeckoEngineSession` about redirect flags. The `VISIT_REDIRECT_SOURCE` and `VISIT_REDIRECT_SOURCE_PERMANENT` flags that we get from GeckoView's history delegate are for the redirect _source_, not the visit type. They indicate if the URL passed to `onVisited` is redirecting _to_ another URL, most likely because the server returned an HTTP 3xy status code with a `Location` header. Rust Places decides whether to mark the URL as hidden based on these flags. `VISIT_REDIRECT_{PERMANENT, TEMPORARY}`, however, indicate if the URL passed to `onVisited` is the _target_ of a redirect (in other words, the page that's _in_ the `Location` header). These get translated into `VisitType` flags, which Rust Places stores as the visit transition type. These two flags don't affect whether a URL is hidden. Note that, in a redirect chain, the middle links are both sources and targets. For example, in "mozilla.org" -> "www.mozilla.org" -> "www.mozilla.org/en-US", "www.mozilla.org" is both a redirect target (since "mozilla.org" redirected to it), and a source (it redirected to "www.mozilla.org/en-US"). See mozilla-mobile/fenix#3526.
d5a0da7
to
15b873f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. 🚢
bors r+ |
4268: Pass redirect source and target flags to history tracking delegates r=rocketsroger a=linacambridge There's some confusion in `GeckoEngineSession` about redirect flags. The `VISIT_REDIRECT_SOURCE` and `VISIT_REDIRECT_SOURCE_PERMANENT` flags that we get from GeckoView's history delegate are for the redirect _source_, not the visit type. They indicate if the URL passed to `onVisited` is redirecting _to_ another URL, most likely because the server returned an HTTP 3xy status code with a `Location` header. Rust Places decides whether to mark the URL as hidden based on these flags. `VISIT_REDIRECT_{PERMANENT, TEMPORARY}`, however, indicate if the URL passed to `onVisited` is the _target_ of a redirect (in other words, the page that's _in_ the `Location` header). These get translated into `VisitType` flags, which Rust Places stores as the visit transition type. These two flags don't affect whether a URL is hidden. Note that, in a redirect chain, the middle links are both sources and targets. For example, in "mozilla.org" -> "www.mozilla.org" -> "www.mozilla.org/en-US", "www.mozilla.org" is both a redirect target (since "mozilla.org" redirected to it), and a source (it redirected to "www.mozilla.org/en-US"). See mozilla-mobile/fenix#3526. Co-authored-by: Lina Cambridge <lina@yakshaving.ninja>
Build succeeded
|
There's some confusion in
GeckoEngineSession
about redirect flags.The
VISIT_REDIRECT_SOURCE
andVISIT_REDIRECT_SOURCE_PERMANENT
flagsthat we get from GeckoView's history delegate are for the redirect
source, not the visit type. They indicate if the URL passed to
onVisited
is redirecting to another URL, most likely because theserver returned an HTTP 3xy status code with a
Location
header.Rust Places decides whether to mark the URL as hidden based on
these flags.
VISIT_REDIRECT_{PERMANENT, TEMPORARY}
, however, indicate if theURL passed to
onVisited
is the target of a redirect (in otherwords, the page that's in the
Location
header). These gettranslated into
VisitType
flags, which Rust Places stores as thevisit transition type. These two flags don't affect whether a URL
is hidden.
Note that, in a redirect chain, the middle links are both sources and
targets. For example, in "mozilla.org" -> "www.mozilla.org" ->
"www.mozilla.org/en-US", "www.mozilla.org" is both a redirect target
(since "mozilla.org" redirected to it), and a source (it redirected
to "www.mozilla.org/en-US").
See mozilla-mobile/fenix#3526.
Pull Request checklist
After merge