Merge pull request #187 from toasted-nutbread/suppress-runtime-lasterror-messages
Suppress messages about unchecked runtime.lastError
This commit is contained in:
commit
7bf215617c
@ -57,9 +57,10 @@ class Backend {
|
|||||||
this.anki = new AnkiNull();
|
this.anki = new AnkiNull();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const callback = () => this.checkLastError(chrome.runtime.lastError);
|
||||||
chrome.tabs.query({}, tabs => {
|
chrome.tabs.query({}, tabs => {
|
||||||
for (const tab of 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});
|
chrome.browserAction.setBadgeText({text});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
checkLastError(e) {
|
||||||
|
// NOP
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
window.yomichan_backend = new Backend();
|
window.yomichan_backend = new Backend();
|
||||||
|
@ -27,6 +27,7 @@ function utilInvoke(action, params={}) {
|
|||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
try {
|
try {
|
||||||
chrome.runtime.sendMessage({action, params}, (response) => {
|
chrome.runtime.sendMessage({action, params}, (response) => {
|
||||||
|
utilCheckLastError(chrome.runtime.lastError);
|
||||||
if (response !== null && typeof response === 'object') {
|
if (response !== null && typeof response === 'object') {
|
||||||
if (response.error) {
|
if (response.error) {
|
||||||
reject(response.error);
|
reject(response.error);
|
||||||
@ -43,3 +44,7 @@ function utilInvoke(action, params={}) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function utilCheckLastError(e) {
|
||||||
|
// NOP
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user