aboutsummaryrefslogtreecommitdiff
path: root/ext/bg/js/backend.js
diff options
context:
space:
mode:
Diffstat (limited to 'ext/bg/js/backend.js')
-rw-r--r--ext/bg/js/backend.js16
1 files changed, 9 insertions, 7 deletions
diff --git a/ext/bg/js/backend.js b/ext/bg/js/backend.js
index f1983cb3..fd90a220 100644
--- a/ext/bg/js/backend.js
+++ b/ext/bg/js/backend.js
@@ -525,8 +525,10 @@ class Backend {
}
_onApiFrameInformationGet(params, sender) {
+ const tab = sender.tab;
+ const tabId = tab ? tab.id : void 0;
const frameId = sender.frameId;
- return Promise.resolve({frameId});
+ return Promise.resolve({tabId, frameId});
}
_onApiInjectStylesheet({type, value}, sender) {
@@ -1505,17 +1507,17 @@ class Backend {
return isValidTab ? tab : null;
}
- async _getScreenshot(windowId, tabId, ownerFrameId, format, quality) {
+ async _getScreenshot(windowId, tabId, frameId, format, quality) {
if (typeof windowId !== 'number') {
throw new Error('Invalid window ID');
}
let token = null;
try {
- if (typeof tabId === 'number' && typeof ownerFrameId === 'number') {
+ if (typeof tabId === 'number' && typeof frameId === 'number') {
const action = 'setAllVisibleOverride';
const params = {value: false, priority: 0, awaitFrame: true};
- token = await this._sendMessageTabPromise(tabId, {action, params}, {frameId: ownerFrameId});
+ token = await this._sendMessageTabPromise(tabId, {action, params}, {frameId});
}
return await new Promise((resolve, reject) => {
@@ -1533,7 +1535,7 @@ class Backend {
const action = 'clearAllVisibleOverride';
const params = {token};
try {
- await this._sendMessageTabPromise(tabId, {action, params}, {frameId: ownerFrameId});
+ await this._sendMessageTabPromise(tabId, {action, params}, {frameId});
} catch (e) {
// NOP
}
@@ -1634,8 +1636,8 @@ class Backend {
}
async _injectAnkNoteScreenshot(ankiConnect, timestamp, definitionDetails, details) {
- const {windowId, tabId, ownerFrameId, format, quality} = details;
- const dataUrl = await this._getScreenshot(windowId, tabId, ownerFrameId, format, quality);
+ const {windowId, tabId, frameId, format, quality} = details;
+ const dataUrl = await this._getScreenshot(windowId, tabId, frameId, format, quality);
const {mediaType, data} = this._getDataUrlInfo(dataUrl);
const extension = this._mediaUtility.getFileExtensionFromImageMediaType(mediaType);