From 6df239213252872f7909d7bcdf0e756fd741f777 Mon Sep 17 00:00:00 2001 From: tophf Date: Tue, 6 Jun 2017 10:33:45 +0300 Subject: [PATCH] FF bug workaround for tabs.query with moz-extension:// --- messaging.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/messaging.js b/messaging.js index 72a0fa0a..5cf66013 100644 --- a/messaging.js +++ b/messaging.js @@ -133,8 +133,10 @@ function openURL({url, currentWindow = true}) { return new Promise(resolve => { // [some] chromium forks don't handle their fake branded protocols url = url.replace(/^(opera|vivaldi)/, 'chrome'); + // FF doesn't handle moz-extension:// URLs (bug) // 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) { if (tab.url == url) { activateTab(tab).then(resolve);