diff options
author | siikamiika <siikamiika@users.noreply.github.com> | 2020-03-02 23:26:55 +0200 |
---|---|---|
committer | siikamiika <siikamiika@users.noreply.github.com> | 2020-03-02 23:26:55 +0200 |
commit | e6347a94e7ff0b7a5c1db7e6f83f50d93c2d4545 (patch) | |
tree | c4d58c3d9f8dbc3f46fbe50bde837755197a3109 /ext/bg/js/backend.js | |
parent | a05a05c4f49d97f44dc3e1599906047c4a346512 (diff) |
prepare Backend for browser_action
Diffstat (limited to 'ext/bg/js/backend.js')
-rw-r--r-- | ext/bg/js/backend.js | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/ext/bg/js/backend.js b/ext/bg/js/backend.js index be43ecf6..14b0aff1 100644 --- a/ext/bg/js/backend.js +++ b/ext/bg/js/backend.js @@ -278,6 +278,11 @@ class Backend { // Message handlers async _onApiYomichanCoreReady(_params, sender) { + // tab ID isn't set in background (e.g. browser_action) + if (typeof sender.tab === 'undefined') { + return chrome.runtime.sendMessage({action: 'backendPrepared'}); + } + const tabId = sender.tab.id; return new Promise((resolve) => { chrome.tabs.sendMessage(tabId, {action: 'backendPrepared'}, resolve); |