diff options
| author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2020-03-07 17:41:37 -0500 | 
|---|---|---|
| committer | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2020-03-07 17:41:57 -0500 | 
| commit | eea9dc68b9f6c95ad2b98a5410a0340ba2151640 (patch) | |
| tree | bb96b25eea6a4b596370100d6872cde5c5136e7a /ext/bg/js/backend.js | |
| parent | 24d9001b1449a318113f5ecc5441113cabe7248f (diff) | |
Fix runtime.lastError error on startup in Firefox
Diffstat (limited to 'ext/bg/js/backend.js')
| -rw-r--r-- | ext/bg/js/backend.js | 6 | 
1 files changed, 4 insertions, 2 deletions
| diff --git a/ext/bg/js/backend.js b/ext/bg/js/backend.js index 5b7ab084..4595dbb3 100644 --- a/ext/bg/js/backend.js +++ b/ext/bg/js/backend.js @@ -120,7 +120,8 @@ class Backend {          this.clipboardMonitor.onClipboardText = this._onClipboardText.bind(this);          this._sendMessageAllTabs('backendPrepared'); -        chrome.runtime.sendMessage({action: 'backendPrepared'}); +        const callback = () => this.checkLastError(chrome.runtime.lastError); +        chrome.runtime.sendMessage({action: 'backendPrepared'}, callback);      }      _sendMessageAllTabs(action, params={}) { @@ -281,7 +282,8 @@ class Backend {      _onApiYomichanCoreReady(_params, sender) {          // tab ID isn't set in background (e.g. browser_action)          if (typeof sender.tab === 'undefined') { -            chrome.runtime.sendMessage({action: 'backendPrepared'}); +            const callback = () => this.checkLastError(chrome.runtime.lastError); +            chrome.runtime.sendMessage({action: 'backendPrepared'}, callback);              return Promise.resolve();          } |