Browse Source

Revert "fix: better window hierarchy checks"

This reverts commit bdd19d9b28587b5ff8d8cb4881437542d17904c6.
Samuel Attard 5 years ago
parent
commit
bc6cc1a1f9
1 changed files with 3 additions and 9 deletions
  1. 3 9
      lib/browser/guest-window-manager.js

+ 3 - 9
lib/browser/guest-window-manager.js

@@ -1,7 +1,6 @@
 'use strict'
 
 const electron = require('electron')
-const nodeUrl = require('url')
 const { BrowserWindow } = electron
 const { isSameOrigin } = process.electronBinding('v8_util')
 const { ipcMainInternal } = require('@electron/internal/browser/ipc-main-internal')
@@ -178,8 +177,9 @@ const isNodeIntegrationEnabled = function (sender) {
 
 // Checks whether |sender| can access the |target|:
 const canAccessWindow = function (sender, target) {
-  return isScriptableWindow(sender, target) ||
-         (isChildWindow(sender, target) && isNodeIntegrationEnabled(sender))
+  return isChildWindow(sender, target) ||
+         isScriptableWindow(sender, target) ||
+         isNodeIntegrationEnabled(sender)
 }
 
 // Routed window.open messages with raw options
@@ -187,12 +187,6 @@ ipcMainInternal.on('ELECTRON_GUEST_WINDOW_MANAGER_WINDOW_OPEN', (event, url, fra
   if (url == null || url === '') url = 'about:blank'
   if (frameName == null) frameName = ''
   if (features == null) features = ''
-  const parsedSourceURL = nodeUrl.parse(event.sender.getURL())
-  const parsedTargetURL = nodeUrl.parse(url)
-  if (parsedTargetURL.protocol === 'file:' && parsedSourceURL.protocol !== 'file:') {
-    event.returnValue = null
-    return
-  }
 
   const options = {}