From 89984a7d96cce7bda480c4893e22f1e7493c335d Mon Sep 17 00:00:00 2001 From: zadam Date: Fri, 9 Oct 2020 23:08:57 +0200 Subject: [PATCH] use correct active tab URL --- background.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/background.js b/background.js index 367bb30ee..060d8db75 100644 --- a/background.js +++ b/background.js @@ -1,16 +1,16 @@ // Keyboard shortcuts chrome.commands.onCommand.addListener(async function (command) { - if(command=="saveSelection") { + if (command == "saveSelection") { await saveSelection(); } else if (command == "saveWholePage") { await saveWholePage(); } else if (command == "saveScreenshot") { const activeTab = await getActiveTab(); - await saveScreenshot(activeTab); + + await saveScreenshot(activeTab.url); } else { console.log("Unrecognized command", command); } - }); function cropImage(newArea, dataUrl) { @@ -323,7 +323,9 @@ browser.runtime.onMessage.addListener(async request => { return await browser.tabs.executeScript({file: request.file}); } else if (request.name === 'save-screenshot') { - return await saveScreenshot(); + const activeTab = await getActiveTab(); + + return await saveScreenshot(activeTab.url); } else if (request.name === 'save-whole-page') { return await saveWholePage();