Merge pull request #284 from VishwasShashidhar/electron-258

electron-258: fixes the pop out issue for meetings and supports undefined urls in case of new window events as per the html dom specs
This commit is contained in:
Vikas Shashidhar 2018-01-08 12:03:16 +05:30 committed by GitHub
commit 1638cfc36c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -311,16 +311,18 @@ 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);
let newWinHost = newWinParsedUrl && newWinParsedUrl.host;
let mainWinHost = mainWinParsedUrl && mainWinParsedUrl.host;
let emptyUrlString = 'about:blank';
// only allow window.open to succeed is if coming from same hsot,
// otherwise open in default browser.
if (disposition === 'new-window' && newWinHost === mainWinHost) {
if (disposition === 'new-window' && ((newWinHost === mainWinHost) || newWinUrl === emptyUrlString)) {
// handle: window.open
if (!frameName) {