[MM-50410] Allow any unhandled target=_blank links to open in the browser (#2548)
This commit is contained in:
@@ -250,5 +250,11 @@ describe('main/views/webContentsEvents', () => {
|
||||
expect(newWindow({url: 'http://server-1.com/trusted/login'})).toStrictEqual({action: 'deny'});
|
||||
expect(webContentsEventManager.popupWindow).toBeTruthy();
|
||||
});
|
||||
|
||||
it('should open external URIs in browser', () => {
|
||||
urlUtils.isValidURI.mockReturnValue(false);
|
||||
expect(newWindow({url: 'https://google.com'})).toStrictEqual({action: 'deny'});
|
||||
expect(shell.openExternal).toBeCalledWith('https://google.com');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@@ -133,7 +133,6 @@ export class WebContentsEventManager {
|
||||
}
|
||||
|
||||
const serverURL = WindowManager.getServerURLFromWebContentsId(webContentsId);
|
||||
|
||||
if (!serverURL) {
|
||||
shell.openExternal(details.url);
|
||||
return {action: 'deny'};
|
||||
@@ -206,8 +205,12 @@ export class WebContentsEventManager {
|
||||
|
||||
const contextMenu = new ContextMenu({}, this.popupWindow);
|
||||
contextMenu.reload();
|
||||
|
||||
return {action: 'deny'};
|
||||
}
|
||||
|
||||
// If all else fails, just open externally
|
||||
shell.openExternal(details.url);
|
||||
return {action: 'deny'};
|
||||
};
|
||||
};
|
||||
|
Reference in New Issue
Block a user