summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2019-12-09 21:54:45 -0500
committertoasted-nutbread <toasted-nutbread@users.noreply.github.com>2019-12-13 23:11:56 -0500
commitdaff44a010b3b926004f6888d62fe408da90966d (patch)
treedb790f305a56aac73a796973ef796ab9cc2774da
parentd8b21606ba0f8878b718aef332c6616931e99dd0 (diff)
Move apiForward implementation into Backend
-rw-r--r--ext/bg/js/api.js9
-rw-r--r--ext/bg/js/backend.js9
2 files changed, 9 insertions, 9 deletions
diff --git a/ext/bg/js/api.js b/ext/bg/js/api.js
index 3b9af593..bafbdf39 100644
--- a/ext/bg/js/api.js
+++ b/ext/bg/js/api.js
@@ -78,14 +78,7 @@ function apiScreenshotGet(options, sender) {
}
function apiForward(action, params, sender) {
- if (!(sender && sender.tab)) {
- return Promise.resolve();
- }
-
- const tabId = sender.tab.id;
- return new Promise((resolve) => {
- chrome.tabs.sendMessage(tabId, {action, params}, (response) => resolve(response));
- });
+ return utilBackend()._onApiForward({action, params}, sender);
}
function apiFrameInformationGet(sender) {
diff --git a/ext/bg/js/backend.js b/ext/bg/js/backend.js
index 5c5da2dd..e9b50789 100644
--- a/ext/bg/js/backend.js
+++ b/ext/bg/js/backend.js
@@ -420,7 +420,14 @@ class Backend {
}
_onApiForward({action, params}, sender) {
- return apiForward(action, params, sender);
+ if (!(sender && sender.tab)) {
+ return Promise.resolve();
+ }
+
+ const tabId = sender.tab.id;
+ return new Promise((resolve) => {
+ chrome.tabs.sendMessage(tabId, {action, params}, (response) => resolve(response));
+ });
}
_onApiFrameInformationGet(params, sender) {