FF bug workaround for tabs.query with moz-extension://
This commit is contained in:
parent
ac5e9b965a
commit
6df2392132
|
@ -133,8 +133,10 @@ function openURL({url, currentWindow = true}) {
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
// [some] chromium forks don't handle their fake branded protocols
|
// [some] chromium forks don't handle their fake branded protocols
|
||||||
url = url.replace(/^(opera|vivaldi)/, 'chrome');
|
url = url.replace(/^(opera|vivaldi)/, 'chrome');
|
||||||
|
// FF doesn't handle moz-extension:// URLs (bug)
|
||||||
// API doesn't handle the hash-fragment part
|
// API doesn't handle the hash-fragment part
|
||||||
chrome.tabs.query({url: url.replace(/#.*/, ''), currentWindow}, tabs => {
|
const urlQuery = url.startsWith('moz-extension') ? undefined : url.replace(/#.*/, '');
|
||||||
|
chrome.tabs.query({url: urlQuery, currentWindow}, tabs => {
|
||||||
for (const tab of tabs) {
|
for (const tab of tabs) {
|
||||||
if (tab.url == url) {
|
if (tab.url == url) {
|
||||||
activateTab(tab).then(resolve);
|
activateTab(tab).then(resolve);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user