As the title, I always get this error in console when I debug my extension in firefox, I'm using polyfill and vuejs to have a cross browser compatible extension. This is the code:
functions.js
const discardInactiveTabs = () => {
browser.tabs.query({active: false, highlighted: false}).then( (tabs) => {
tabs.forEach( (tab) => {
if( !tab.active && !tab.discarded ){
browser.tabs.discard(tab.id);
}
});
});
}
And this is how I call the discard fuction in my background.js file:
browser.tabs.onCreated.addListener( (tab) => {
discardInactiveTabs();
initTab();
});
browser.tabs.onUpdated.addListener( (tabId, changeInfo, tab) => {
if( tab.url === 'chrome://newtab/' && changeInfo.status === 'complete'){
discardInactiveTabs();
initTab();
}
});
Any suggestion?