fix opening own pages from an incognito window popup in Chrome
This commit is contained in:
parent
8976bd58b8
commit
243da0b0d1
|
@ -178,12 +178,15 @@ function openURL({url, currentWindow = true}) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
getActiveTab().then(tab => {
|
getActiveTab().then(tab => {
|
||||||
if (tab && tab.url === 'chrome://newtab/'
|
const chromeInIncognito = tab && tab.incognito && url.startsWith('chrome');
|
||||||
// prevent redirecting incognito NTP to a chrome URL as it crashes Chrome
|
if (tab && tab.url === 'chrome://newtab/' && !chromeInIncognito) {
|
||||||
&& (!url.startsWith('chrome') || !tab.incognito)) {
|
// update current NTP, except for chrome:// or chrome-extension:// in incognito
|
||||||
chrome.tabs.update({url}, resolve);
|
chrome.tabs.update({url}, resolve);
|
||||||
} else {
|
} else {
|
||||||
chrome.tabs.create(tab && !FIREFOX ? {url, openerTabId: tab.id} : {url}, resolve);
|
// create a new tab
|
||||||
|
const openerSupported = !FIREFOX && tab && !chromeInIncognito;
|
||||||
|
const options = openerSupported ? {url, openerTabId: tab.id} : {url};
|
||||||
|
chrome.tabs.create(options, resolve);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue
Block a user