diff --git a/src/assets/javascripts/general.js b/src/assets/javascripts/general.js index 7adb043..588c67d 100644 --- a/src/assets/javascripts/general.js +++ b/src/assets/javascripts/general.js @@ -7,9 +7,9 @@ window.browser = window.browser || window.chrome let exceptions function isException(url) { - if (url !== undefined) { - for (const item of exceptions.url) if (item == url.href) return true - for (const item of exceptions.regex) if (new RegExp(item).test(url.href)) return true + if (exceptions && url) { + if (exceptions.url) for (const item of exceptions.url) if (item == url.href) return true + if (exceptions.regex) for (const item of exceptions.regex) if (new RegExp(item).test(url.href)) return true } return false } diff --git a/src/pages/background/background.js b/src/pages/background/background.js index 08f4fe9..8fed559 100644 --- a/src/pages/background/background.js +++ b/src/pages/background/background.js @@ -176,8 +176,12 @@ browser.contextMenus.onClicked.addListener(async (info) => { return } case 'copyReverseTab': { - const url = new URL(info.pageUrl) - servicesHelper.copyRaw(url) + browser.tabs.query({ active: true, currentWindow: true }, async tabs => { + if (tabs[0].url) { + const url = new URL(tabs[0].url) + servicesHelper.copyRaw(url) + } + }) return } case 'reverseTab': {