Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement cross-browser compatibility #114

Open
2 of 7 tasks
jonathanmayer opened this issue Jun 23, 2021 · 1 comment
Open
2 of 7 tasks

Implement cross-browser compatibility #114

jonathanmayer opened this issue Jun 23, 2021 · 1 comment
Assignees

Comments

@jonathanmayer
Copy link
Contributor

jonathanmayer commented Jun 23, 2021

@rhelmer and I discussed what's needed for implementing cross-browser compatibility with Chrome (and Edge). A few items...

  • Polyfill the browser.* APIs. This should be trivial with Mozilla's WebExtensions polyfill: https://github.com/mozilla/webextension-polyfill
  • Replace our use of extraParameters for the tabs.onUpdated event, since that isn't supported in Chrome and isn't (yet) polyfilled. This should also be trivial.
  • Add indirection to our use of contentScripts.register in Firefox and use the new scripting.registerContentScript when it lands in Chrome. This should also be trivial, once the Chrome changes land. See: https://bugs.chromium.org/p/chromium/issues/detail?id=1054624
  • Add support for pages that load from the back/forward cache. We currently use unload listeners on all pages, which blocks the bfcache in Firefox—but not in Chrome or Safari. This probably just requires listening for the pageshow event in the pageManager content script and firing a pageVisitStart event if there isn't an active page visit, and listening for the pagehide event instead of the unload event.
  • Conduct our own webpage readability check, rather than relying on the Firefox-specific isArticle tab property. This should be straightforward.
  • Persist WebScience state in the background environment. This is currently trivial with Manifest v2, but could become a pain in Manifest v3.
  • Lots of testing, especially for components that might interact with browser-specific race conditions (e.g., pageManager and pageTransition). This will be difficult, but we have to do it anyway.
@rhelmer
Copy link
Contributor

rhelmer commented Apr 15, 2022

* [ ]  Add support for pages that load from the back/forward cache. We currently use `unload` listeners on all pages, which blocks the bfcache in Firefox—but not in Chrome or Safari. This probably just requires listening for the `pageshow` event in the `pageManager` content script and firing a `pageVisitStart` event if there isn't an active page visit, and listening for the `pagehide` event instead of the `unload` event.

From my testing so far and discussion and discussion in #addons on matrix, there isn't a reliable way to do this from the content script. I tested with unload which fired unreliably, also with pagehide and visibilitychange which didn't fire at all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants