Skip to content

Conversation

@fregante
Copy link
Owner

@fregante fregante commented Jan 8, 2025

MV2 Firefox presumably still works, but no more official support in v11+

Need MV2? Use v10

@fregante fregante marked this pull request as ready for review January 8, 2025 22:31
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 }}
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No MV2, no Firefox tests:

So I'm dropping MV2 tests altogether

"these-are-just-mocks-for-parcel-tests": "yolo",
"webext-permissions": "./test/demo-extension/webext-permissions.js",
"webext-dynamic-content-scripts": "./source/"
},
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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/*",
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Upgrade. However not really useful because Chrome natively deduplicates scripts now.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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();
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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]);
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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';
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bye ponyfill 🙏

"version": "0.0.0",
"manifest_version": 3,
"permissions": ["webNavigation", "scripting", "contextMenus", "activeTab", "storage"],
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mistake. webNavigation is still needed for including-active-tab

Copy link
Owner Author

@fregante fregante Jan 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extracted to dedicated module:

https://github.com/fregante/webext-active-tab

@fregante fregante marked this pull request as draft January 8, 2025 23:30
This was referenced Feb 1, 2025
@fregante fregante marked this pull request as ready for review February 1, 2025 20:13
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

Successfully merging this pull request may close these issues.

2 participants