Hi, I am building s chrome extension that should inject a .js into every frame.
for that I have this manifest.json:
{
"name": "Test3",
"description": "blabla",
"version": "1.0",
"manifest_version": 3,
"background": {"service_worker": "bg.js"},
"permissions": ["scripting","webRequest"],
"host_permissions": ["<all_urls>"]
}
bg.js looks like this:
chrome.runtime.onInstalled.addListener(async () => {
const old = await chrome.scripting.getRegisteredContentScripts();
if (old[0]) await chrome.scripting.unregisterContentScripts({ids: old.map(s =>
s.id)});
await chrome.scripting.registerContentScripts([{
id: 'write',
js: ['write.js'],
matches: ['<all_urls>'],
all_frames: true,
runAt: 'document_end',
world: 'MAIN',
}]);
});
posting write.js here would be pointless a it is logn code and basically jsut is a fucntion (and it's execution) that for each XMLHTTPRequest, read's out it's data like response body and such and draws colored boxes based on it. all that code in the write.js shouldnt matter here).
anyways manifest.json and bg.js are as above.
Before I didnt have the all_frames:true, line in it and it worked in the sense that it injected the content script once at the very beginning. but since the used site changes depedning on user interaction (roulette site), the injected content script jsut stops working.
googling stuff, it was recommended to insert all_frames:true since that would inject the content script into all iframes and that jmight solve stuff.
however loading/installing the whole thing, it directly shows me the error
Uncaught (in promise) TypeError: Error in invocation of scripting.registerContentScripts(array scripts, optional function callback): Error at parameter 'scripts': Error at index 0: Unexpected property: 'all_frames'.
so he somehow has a big issue with all_frame being placed there but I dont get why.
the official contentscript documentation of chrome literally shows examples looking exactly as I have it. but it jsut doesnt work :-/
Anyone can offer help?