Conversation
| sed -i 's/webNavigation/tabs/' test/demo-extension/mv${{ matrix.version }}/manifest.json | ||
| - run: xvfb-run --auto-servernum npm run jest:core | ||
| env: | ||
| TARGET: ${{ matrix.version }} |
There was a problem hiding this comment.
| "these-are-just-mocks-for-parcel-tests": "yolo", | ||
| "webext-permissions": "./test/demo-extension/webext-permissions.js", | ||
| "webext-dynamic-content-scripts": "./source/" | ||
| }, |
There was a problem hiding this comment.
Related:
In this case I was able to move these to sub-folders so they don't get published.
| "allFrames": undefined, | ||
| "css": undefined, | ||
| "excludeMatches": [ | ||
| "https://content-script.example.com/*", |
There was a problem hiding this comment.
Upgrade. However not really useful because Chrome natively deduplicates scripts now.
There was a problem hiding this comment.
Files can be registered multiple times; Chrome only injects them once (just like native content scripts)
| if (origins.includes(origin)) { | ||
| // eslint-disable-next-line no-await-in-loop | ||
| const script = await scriptPromise; | ||
| void script.unregister(); |
There was a problem hiding this comment.
Pretty sure this did not work in event pages and service workers. Nothing happened then, they'd just be left behind but never injected.
| } | ||
|
|
||
| // Registration successful, now inject into existing tabs | ||
| await injectToExistingTabs([origin], [config]); |
There was a problem hiding this comment.
Ideally the browser still remembers scripts registered in past sessions, so this this now only runs when the scripts were not previously registered.
| @@ -1,38 +0,0 @@ | |||
| import registerContentScriptPonyfill from 'content-scripts-register-polyfill/ponyfill.js'; | |||
test/demo-extension/manifest.json
Outdated
| "version": "0.0.0", | ||
| "manifest_version": 3, | ||
| "permissions": ["webNavigation", "scripting", "contextMenus", "activeTab", "storage"], |
There was a problem hiding this comment.
Mistake. webNavigation is still needed for including-active-tab
There was a problem hiding this comment.
Extracted to dedicated module:
MV2 Firefox presumably still works, but no more official support in v11+
Need MV2? Use v10