In my manifest file I have both tabs and activeTab permssion. I'm trying to obtain the current tab id from my content script, here is what I'm doing:
console.log("here");
browser.tabs.getCurrent()
.then(getTab)
.catch(reportTabError);
function reportTabError(error) {
console.error(`Could not process: ${error}`);
}
function getTab(tabInfo){
console.log("here 2"); //this never fires
window.currentTabId = tabInfo.id;
}
I also did a different version, same result:
console.log("here");
browser.tabs.query({currentWindow: true, active: true})
.then(getTab)
.catch(reportTabError);
function reportTabError(error) {
console.error(`Could not process: ${error}`);
}
function getTab(tabInfo){
console.log(tabInfo.id); //this never fires
//window.currentTabId = tabInfo.id;
}
The overall idea is to store the active tab IDs for a possible future update. What I want to achieve is to eventually notify all open tabs that the user changed the settings in the option page, and to update the interface loaded in the tabs accordingly.