Merge pull request #309 from VishwasShashidhar/ELECTRON-274

ELECTRON-274: fix issue for diagnostics link
This commit is contained in:
Vishwas Shashidhar 2018-03-01 21:44:15 +05:30 committed by GitHub
commit d7dbaf051f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -311,7 +311,7 @@ function doCreateMainWindow(initialUrl, initialBounds) {
// open external links in default browser - a tag with href='_blank' or window.open
mainWindow.webContents.on('new-window', function (event, newWinUrl,
frameName, disposition, newWinOptions) {
let newWinParsedUrl = getParsedUrl(newWinUrl);
let mainWinParsedUrl = getParsedUrl(url);
@ -319,10 +319,11 @@ function doCreateMainWindow(initialUrl, initialBounds) {
let mainWinHost = mainWinParsedUrl && mainWinParsedUrl.host;
let emptyUrlString = 'about:blank';
let dispositionWhitelist = ['new-window', 'foreground-tab'];
// only allow window.open to succeed is if coming from same hsot,
// otherwise open in default browser.
if (disposition === 'new-window' && ((newWinHost === mainWinHost) || newWinUrl === emptyUrlString)) {
if ((newWinHost === mainWinHost || newWinUrl === emptyUrlString) && dispositionWhitelist.includes(disposition)) {
// handle: window.open
if (!frameName) {