Skip to content

Commit 10b4fd9

Browse files
committed
Fixed reverse tab for context menu for chromium
1 parent c5cd80d commit 10b4fd9

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

src/assets/javascripts/general.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ window.browser = window.browser || window.chrome
77
let exceptions
88

99
function isException(url) {
10-
if (url !== undefined) {
11-
for (const item of exceptions.url) if (item == url.href) return true
12-
for (const item of exceptions.regex) if (new RegExp(item).test(url.href)) return true
10+
if (exceptions && url) {
11+
if (exceptions.url) for (const item of exceptions.url) if (item == url.href) return true
12+
if (exceptions.regex) for (const item of exceptions.regex) if (new RegExp(item).test(url.href)) return true
1313
}
1414
return false
1515
}

src/pages/background/background.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,8 +176,12 @@ browser.contextMenus.onClicked.addListener(async (info) => {
176176
return
177177
}
178178
case 'copyReverseTab': {
179-
const url = new URL(info.pageUrl)
180-
servicesHelper.copyRaw(url)
179+
browser.tabs.query({ active: true, currentWindow: true }, async tabs => {
180+
if (tabs[0].url) {
181+
const url = new URL(tabs[0].url)
182+
servicesHelper.copyRaw(url)
183+
}
184+
})
181185
return
182186
}
183187
case 'reverseTab': {

0 commit comments

Comments
 (0)