From 96566b8581549adba7cd24f37537fd7910eb8d37 Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Tue, 7 Apr 2020 19:49:54 -0400 Subject: Update forward to be synchronous and ignore the reply --- ext/bg/js/backend.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'ext/bg') diff --git a/ext/bg/js/backend.js b/ext/bg/js/backend.js index 8f494166..31d29a20 100644 --- a/ext/bg/js/backend.js +++ b/ext/bg/js/backend.js @@ -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) { -- cgit v1.2.3