unregisterContentScripts seems that does not support callback function

278 views
Skip to first unread message

Robbi

unread,
Jul 10, 2022, 8:35:34 AM7/10/22
to Chromium Extensions
Hi folk
if I inspect a MV3 extension of mine (which has the scripting permission)
and I run in console:

chrome.scripting.registerContentScripts(
    [{
        "id": "ciao",
        "matches": ["https://stackoverflow.com/*"],
        "css": ["css/cs.css"],
        "js": ["script/cs.js"],
        "runAt": "document_idle"  
        }],
        _ => { console.log('DONE') }
)
I see the console.log message
but if i run later:
chrome.scripting.unregisterContentScripts("ciao", _ => { console.log('DONE') })
I get this eror:
Error in invocation of scripting.unregisterContentScripts(optional scripting.ContentScriptFilter filter, optional function callback): No matching signature.

Is it a bug or am I drunk?

Erek Speed

unread,
Jul 10, 2022, 9:41:11 AM7/10/22
to Robbi, Chromium Extensions
Isn't it because you passed a string as the first argument? It looks like it expects an object...

2022年7月10日(日) 21:35 Robbi <rob...@gmail.com>:
--
You received this message because you are subscribed to the Google Groups "Chromium Extensions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-extens...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-extensions/2e9a40a5-9994-42e8-a034-342aa35514d6n%40chromium.org.

Robbi

unread,
Jul 10, 2022, 9:58:19 AM7/10/22
to Chromium Extensions, Erek Speed, Chromium Extensions, Robbi
I also tried with:  chrome.scripting.unregisterContentScripts(["ciao"], _ => { console.log('DONE') })
but it doesn't work.

chrome.scripting.unregisterContentScripts("ciao")
without callback function works though

Robbi

unread,
Jul 10, 2022, 10:01:33 AM7/10/22
to Chromium Extensions, Robbi, Erek Speed, Chromium Extensions
ok
i found the right form.
chrome.scripting.unregisterContentScripts({'ids':["ciao"]}, _ => {console.log('ciao')})
it works
Reply all
Reply to author
Forward
0 new messages