Based on the information provided here, the method browser.pageAction.getTitle()
functions asynchronously and returns a Promise.
In my code, I am attempting to use it within a function in the following manner:
function title(t){
if(t===undefined){
try{
let t=await browser.pageAction.getTitle({tabId:c.id});
}
catch(err){
try{
let t=await browser.browserAction.getTitle({tabId:c.id});
}
catch(err){
console.log("Failed to get title. This add-on relies on the button's title.");
}
}
return t;
}
else{
try{
browser.pageAction.setTitle({tabId:c.id,title:t});
}
catch(err){
try{
browser.browserAction.setTitle({tabId:c.id,title:t});
}
catch(err){
console.log("Failed to set title. This add-on relies on the button's title.");
}
}
}
console.log("Setting button title: "+t);
}
Do you think this discrepancy is due to an oversight on my part or does it appear that the documentation may be outdated?