Improve tab data bookkeeping with webNavigation #2454
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #2423, fixes #2335, fixes #1144.
Use cases:
Navigate to a special browser or extension page (New Tab page, Privacy Badger's options, ...) from a website. Before, the popup on the special page would show you tracker findings for the site you were previously on. You should now see the "Nothing to do on this page" popup.
Navigate to a website that uses Service Workers (to initialize the SW). Navigate somewhere else within the same tab. Navigate back to the website with Service Workers. (For example:
slate.com
→example.com
→slate.com
.) Before, the popup would show you all resources for the SW site as if they loaded on the site you went to previously. This means all first-party resources would show up as third-party if your previous site's domain is different from the SW site's domain.Navigate to a SW site to get first party cookies set. Then navigate to the same SW site while on a different site. Privacy Badger attributes tracking by the SW site domain to the previous site you were on. This is due to separate, not-yet-corrected tab bookkeeping (
tabOrigins
) inheuristicblocking.js
: thetabOrigins
entry for the tab never gets updated for active SW sites.Set a SW site domain to be blocked. Initialize the SW. Visit the SW site from a different site. The initial request for the site's Service Worker comes in before the
webNavigation.onCommitted()
callback gets to updatetabData
, and so the SW gets blocked and the user sees some version of the "you are offline" message on the site.Update: Listening to
webNavigation.onBeforeNavigate()
events instead ofonCommitted()
fixes this case asonBeforeNavigate
callbacks seem to come before the initial Service Worker.Does not do anything about #1997.