content-scripts-register-polyfill icon indicating copy to clipboard operation
content-scripts-register-polyfill copied to clipboard

`includeGlobs` is not supported

Open ryankashi opened this issue 3 years ago • 3 comments

Hi there! I am using your polyfill to register my content script via:

var content_script_registration_dict = { "matches":["*://*.twitch.tv/*"], "includeGlobs":['*player.twitch.tv*'], "js":[{file:"my_javascript.js"}], "css":[{file:"my_css.css"}] }

chrome.contentScripts.register(content_script_registration_dict);

However I am noticing that my includeGlobs segment is being ignored. Instead, it ignores the includeGlobs match pattern, and injects my_javascript.js into all pages under matches regardless of whether it matches includeGlobs or not.

When I instead place my JavaScript code inside the manifest.json file, everything works as expected, thus it appears to be an issue with this package.

I think that this is an important fix for this package since includeGlobs is currently not behaving as expected.

Thanks!

ryankashi avatar Oct 08 '21 22:10 ryankashi

Update, it appears that the excludeMatches pattern as well excludeGlobs are not working either

ryankashi avatar Oct 08 '21 23:10 ryankashi

Yes, you can see which properties are supported here:

https://github.com/fregante/content-scripts-register-polyfill/blob/0263492fc6fffb2433a9594d79f624f0f0da0aa9/ponyfill.ts#L89-L92

PR welcome to add what's missing

fregante avatar Oct 09 '21 10:10 fregante

Support for exclude_matches added in v3.1

The globs depend on:

  • https://github.com/fregante/webext-patterns/pull/9

fregante avatar Oct 27 '21 16:10 fregante