summaryrefslogtreecommitdiff
path: root/ext/bg
diff options
context:
space:
mode:
Diffstat (limited to 'ext/bg')
-rw-r--r--ext/bg/js/api.js2
-rw-r--r--ext/bg/js/backend.js7
2 files changed, 7 insertions, 2 deletions
diff --git a/ext/bg/js/api.js b/ext/bg/js/api.js
index c33ba709..4b2bacd7 100644
--- a/ext/bg/js/api.js
+++ b/ext/bg/js/api.js
@@ -64,7 +64,7 @@ async function apiDefinitionAdd(definition, mode, context) {
);
}
- if (context.screenshot) {
+ if (context && context.screenshot) {
await apiInjectScreenshot(
definition,
options.anki.terms.fields,
diff --git a/ext/bg/js/backend.js b/ext/bg/js/backend.js
index d49286d0..d95cb82d 100644
--- a/ext/bg/js/backend.js
+++ b/ext/bg/js/backend.js
@@ -57,9 +57,10 @@ class Backend {
this.anki = new AnkiNull();
}
+ const callback = () => this.checkLastError(chrome.runtime.lastError);
chrome.tabs.query({}, tabs => {
for (const tab of tabs) {
- chrome.tabs.sendMessage(tab.id, {action: 'optionsSet', params: options}, () => null);
+ chrome.tabs.sendMessage(tab.id, {action: 'optionsSet', params: options}, callback);
}
});
}
@@ -147,6 +148,10 @@ class Backend {
chrome.browserAction.setBadgeText({text});
}
}
+
+ checkLastError(e) {
+ // NOP
+ }
}
window.yomichan_backend = new Backend();