Update forward to be synchronous and ignore the reply

This commit is contained in:
toasted-nutbread 2020-04-07 19:49:54 -04:00
parent 038e43d19d
commit 96566b8581

View File

@ -94,7 +94,7 @@ class Backend {
['commandExec', {handler: this._onApiCommandExec.bind(this), async: false}],
['audioGetUri', {handler: this._onApiAudioGetUri.bind(this), async: true}],
['screenshotGet', {handler: this._onApiScreenshotGet.bind(this), async: true}],
['forward', {handler: this._onApiForward.bind(this), async: true}],
['forward', {handler: this._onApiForward.bind(this), async: false}],
['frameInformationGet', {handler: this._onApiFrameInformationGet.bind(this), async: true}],
['injectStylesheet', {handler: this._onApiInjectStylesheet.bind(this), async: true}],
['getEnvironmentInfo', {handler: this._onApiGetEnvironmentInfo.bind(this), async: true}],
@ -569,13 +569,13 @@ class Backend {
_onApiForward({action, params}, sender) {
if (!(sender && sender.tab)) {
return Promise.resolve();
return false;
}
const tabId = sender.tab.id;
return new Promise((resolve) => {
chrome.tabs.sendMessage(tabId, {action, params}, (response) => resolve(response));
});
const callback = () => this.checkLastError(chrome.runtime.lastError);
chrome.tabs.sendMessage(tabId, {action, params}, callback);
return true;
}
_onApiFrameInformationGet(params, sender) {