openURL fix for opera:// URLs

This commit is contained in:
tophf 2017-03-29 13:00:19 +03:00
parent a2ea1bb1d9
commit 1166fd9d3b

View File

@ -150,6 +150,8 @@ function openURL({url, currentWindow = true}) {
url = chrome.runtime.getURL(url);
}
return new Promise(resolve => {
// [some] chromium forks don't handle their fake branded protocols
url = url.replace(/^(opera|vivaldi)/, 'chrome');
// API doesn't handle the hash-fragment part
chrome.tabs.query({url: url.replace(/#.*/, ''), currentWindow}, tabs => {
for (const tab of tabs) {