I am currently working on developing a straightforward webExtension for Firefox and I would like to implement tabs.onUpdated with a filter. I found an example on the Mozilla website that I decided to use:
const pattern1 = "https://developer.mozilla.org/*";
const pattern2 = "https://twitter.com/mozdevnet";
const filter = {
urls: [pattern1, pattern2]
}
function handleUpdated(tabId, changeInfo, tabInfo) {
console.log(`Updated tab: ${tabId}`);
console.log("Changed attributes: ", changeInfo);
console.log("New tab Info: ", tabInfo);
}
browser.tabs.onUpdated.addListener(handleUpdated, filter);
However, upon reloading my extension, I encountered an error in the console:
Error: Incorrect argument types for tabs.onUpdated. background-script.js:14:1
makeError resource://gre/modules/Schemas.jsm:446:14
throwError resource://gre/modules/Schemas.jsm:2138:11
checkParameters resource://gre/modules/Schemas.jsm:2195:7
addStub resource://gre/modules/Schemas.jsm:2381:21
<anonymous> moz-extension://78d98d27-294e-4774-9461-dfb3dda97871/background-script.js:14:1
It is unclear whether there have been recent changes to this API that have not yet been documented or if there are other issues, such as permissions.
Below are the permissions listed in my manifest.json
:
"permissions": ["activeTab", "notifications", "tabs"]