Update forward to be synchronous and ignore the reply
This commit is contained in:
parent
038e43d19d
commit
96566b8581
@ -94,7 +94,7 @@ class Backend {
|
|||||||
['commandExec', {handler: this._onApiCommandExec.bind(this), async: false}],
|
['commandExec', {handler: this._onApiCommandExec.bind(this), async: false}],
|
||||||
['audioGetUri', {handler: this._onApiAudioGetUri.bind(this), async: true}],
|
['audioGetUri', {handler: this._onApiAudioGetUri.bind(this), async: true}],
|
||||||
['screenshotGet', {handler: this._onApiScreenshotGet.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}],
|
['frameInformationGet', {handler: this._onApiFrameInformationGet.bind(this), async: true}],
|
||||||
['injectStylesheet', {handler: this._onApiInjectStylesheet.bind(this), async: true}],
|
['injectStylesheet', {handler: this._onApiInjectStylesheet.bind(this), async: true}],
|
||||||
['getEnvironmentInfo', {handler: this._onApiGetEnvironmentInfo.bind(this), async: true}],
|
['getEnvironmentInfo', {handler: this._onApiGetEnvironmentInfo.bind(this), async: true}],
|
||||||
@ -569,13 +569,13 @@ class Backend {
|
|||||||
|
|
||||||
_onApiForward({action, params}, sender) {
|
_onApiForward({action, params}, sender) {
|
||||||
if (!(sender && sender.tab)) {
|
if (!(sender && sender.tab)) {
|
||||||
return Promise.resolve();
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const tabId = sender.tab.id;
|
const tabId = sender.tab.id;
|
||||||
return new Promise((resolve) => {
|
const callback = () => this.checkLastError(chrome.runtime.lastError);
|
||||||
chrome.tabs.sendMessage(tabId, {action, params}, (response) => resolve(response));
|
chrome.tabs.sendMessage(tabId, {action, params}, callback);
|
||||||
});
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
_onApiFrameInformationGet(params, sender) {
|
_onApiFrameInformationGet(params, sender) {
|
||||||
|
Loading…
Reference in New Issue
Block a user