Comments (2)
I think this can be solved by adding preexisting origins (of each content_script) in the exclude_matches
prop
webext-dynamic-content-scripts/index.ts
Lines 23 to 29 in 251bf0c
Would become:
const registeredScript = chrome.contentScripts.register({
js: (config.js || []).map(convertPath),
css: (config.css || []).map(convertPath),
allFrames: config.all_frames,
matches: [origin],
+ exclude_matches: config.matches,
runAt: config.run_at as browser.extensionTypes.RunAt
});
from webext-dynamic-content-scripts.
Additionally this should ignore whole scripts that are already enabled on <all_urls>
or *://*/*
.
The implementation is different since register
doesn't need to be called at all, but the concept is the same.
If every script is enabled everywhere, it could use console.warn
because this module is useless in that case. A warning rather than an error would be useful for cross-browser extensions. Example: refined-github/refined-github#3766
from webext-dynamic-content-scripts.
Related Issues (20)
- Build error: Property 'contentScripts' does not exist on type 'typeof chrome' HOT 4
- `all_frames` isn't supported in Chrome HOT 12
- Support Safari
- Manifest v3 compatibility HOT 8
- Regression: content scripts being injected twice since version 7.1.0 HOT 5
- `match_about_blank` isn't supported in Chrome
- Content scripts are not unregistered in Firefox until a browser/extension restart
- Add tests
- v.8.0.0 causes build error HOT 1
- Silence `Uncaught (in promise) Error: No tab with id: 182.` HOT 2
- Use `dropOverlappingPermissions` to avoid duplicate injections
- Add `isContentScriptRegistered`
- Automatically listen to activetab (optionally?)
- Exclude URLs that already overlap with defaults (on first launch too)
- Add unit testing
- Update puppeteer to v18+ for the tests HOT 1
- Update `content-scripts-register-polyfill` to v4
- Run tests in Firefox HOT 1
- Add support for `world` in MV3
- v10 doesn't fully support complex conditions in MV2 Chrome
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from webext-dynamic-content-scripts.