Closed sidvishnoi closed 2 months ago
Name | Link |
---|---|
Latest commit | 5196937ab20512250e45d0522bca57394bd1d2c3 |
Latest job logs | Run #10904420369 |
Download | |
Download |
The timing issue for Firefox < 128 still exists right?
Yes, but it'll at least continue to work like before. We just won't need to set min supported version to 128 this way.
Context
Fixes https://github.com/interledger/web-monetization-extension/issues/590 Without needing to sacrifice Firefox support!
Changes proposed in this pull request
If browser supports
world: MAIN
for content script, we inject directly usingscripting.registerContentScripts
API (can detect WM support immediately on page load). If not, we inject like before from contentScript (slow, requires timeout for WM support detection).We inject via
scripting.registerContentScripts
API and not directly viamanifest.json
, as we can catch the lack of support ofworld: MAIN
via this API. With this detection, we can still support Firefox versions older than 128.Update polyfill to support injecting twice - only the first injection works - as we detect if already injected.
Note: In content script, we inject polyfill from contentScript and not using
scripting.executeScript
in background as we'd otherwise need to inject it manually to each tab.What next?
When Firefox 128 is old enough, we can remove
injectPolyfill
from background.ts as well ascontentScript.ts
and register it directly in manifest.json withworld: MAIN
. When we do that, we'd updatebrowser_specific_settings.gecko.strict_min_version
in manifest.json from 110 to 128, and also removepolyfill/*
fromweb_accessible_resources
. (https://github.com/interledger/web-monetization-extension/issues/607)Test results:
https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/scripting/ExecutionWorld#browser_compatibility