Bug 1598516 - Make Quitter extension retry sending the quit message in case the background script wasn't ready yet. r=mixedpuppy

Differential Revision: https://phabricator.services.mozilla.com/D55604

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Matt Woodrow 2019-12-03 20:44:13 +00:00
parent c10f854a76
commit cd8f1a4e6c
2 changed files with 6 additions and 2 deletions

View File

@ -7,8 +7,12 @@
/* eslint-env webextensions */ /* eslint-env webextensions */
const Quitter = { const Quitter = {
quit() { async quit() {
browser.runtime.sendMessage("quit"); // This can be called before the background page has loaded,
// so we need to wait for it.
browser.runtime.sendMessage("quit").catch(() => {
setTimeout(this.quit, 100);
});
}, },
}; };