[MM-50948] Prevent popup windows from navigating outside of the plugin/managed resource URLs (#2580)
This commit is contained in:
parent
55529a9ff2
commit
3225076426
|
@ -187,6 +187,17 @@ export class WebContentsEventManager {
|
|||
spellcheck: (typeof spellcheck === 'undefined' ? true : spellcheck),
|
||||
},
|
||||
});
|
||||
this.popupWindow.webContents.on('will-redirect', (event, url) => {
|
||||
const parsedURL = urlUtils.parseURL(url);
|
||||
if (!parsedURL) {
|
||||
event.preventDefault();
|
||||
return;
|
||||
}
|
||||
|
||||
if (urlUtils.isInternalURL(serverURL, parsedURL) && !urlUtils.isPluginUrl(serverURL, parsedURL) && !urlUtils.isManagedResource(serverURL, parsedURL)) {
|
||||
event.preventDefault();
|
||||
}
|
||||
});
|
||||
this.popupWindow.webContents.setWindowOpenHandler(this.denyNewWindow);
|
||||
this.popupWindow.once('ready-to-show', () => {
|
||||
this.popupWindow!.show();
|
||||
|
|
Loading…
Reference in a new issue