Assuming adequate permissions in the manifest file, why does the following notification code work when stepped through the debugger, but fails when running up to speed? I’m doing something wrong with promises, but I don’t know what.
// S: Promise to show string in notification box
function S(Msg,Title)
{
var p=browser.notifications.create({
“type”: “basic”,
“iconUrl”: browser.extension.getURL(“icons/link-48.png”),
“title”: Title,
“message”: Msg});
return p;
} // S
S(‘bg running 0’,‘Direct from bg’).then(s1).then(s2).catch(err);
function s1(val)
{
S(‘bg 1’,’’);
} // s1
function s2(val)
{
S(‘bg 2’,’’);
} // s2
function err(Msg)
{
console.log(’*** '+Msg);
throw Error;
} // err
// End