fix: do not double-declare webPreferences (#23223)

This commit is contained in:
Samuel Attard 2020-04-22 11:06:30 -07:00 committed by GitHub
parent c798a6e5d1
commit 9d60cfa6fc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -220,8 +220,8 @@ const canAccessWindow = function (sender, target) {
// Routed window.open messages with raw options
ipcMainInternal.on('ELECTRON_GUEST_WINDOW_MANAGER_WINDOW_OPEN', (event, url, frameName, features) => {
// This should only be allowed for senders that have nativeWindowOpen: false
const webPreferences = event.sender.getLastWebPreferences();
if (webPreferences.nativeWindowOpen || webPreferences.sandbox) {
const lastWebPreferences = event.sender.getLastWebPreferences();
if (lastWebPreferences.nativeWindowOpen || lastWebPreferences.sandbox) {
event.returnValue = null;
throw new Error('GUEST_WINDOW_MANAGER_WINDOW_OPEN denied: expected native window.open');
}