diff options
-rw-r--r-- | ext/bg/js/api.js | 9 | ||||
-rw-r--r-- | ext/bg/js/backend.js | 9 |
2 files changed, 9 insertions, 9 deletions
diff --git a/ext/bg/js/api.js b/ext/bg/js/api.js index db849cc5..3b9af593 100644 --- a/ext/bg/js/api.js +++ b/ext/bg/js/api.js @@ -74,14 +74,7 @@ function apiAudioGetUrl(definition, source, optionsContext) { } function apiScreenshotGet(options, sender) { - if (!(sender && sender.tab)) { - return Promise.resolve(); - } - - const windowId = sender.tab.windowId; - return new Promise((resolve) => { - chrome.tabs.captureVisibleTab(windowId, options, (dataUrl) => resolve(dataUrl)); - }); + return utilBackend()._onApiScreenshotGet({options}, sender); } function apiForward(action, params, sender) { diff --git a/ext/bg/js/backend.js b/ext/bg/js/backend.js index 96f28925..5c5da2dd 100644 --- a/ext/bg/js/backend.js +++ b/ext/bg/js/backend.js @@ -409,7 +409,14 @@ class Backend { } _onApiScreenshotGet({options}, sender) { - return apiScreenshotGet(options, sender); + if (!(sender && sender.tab)) { + return Promise.resolve(); + } + + const windowId = sender.tab.windowId; + return new Promise((resolve) => { + chrome.tabs.captureVisibleTab(windowId, options, (dataUrl) => resolve(dataUrl)); + }); } _onApiForward({action, params}, sender) { |