]> khamidou — GitHub mirrors - electron.git/commitdiff
Inherit current window's node-integration in window.open by default
authorCheng Zhao <zcbenz@gmail.com>
Mon, 6 Jul 2015 08:21:08 +0000 (16:21 +0800)
committerCheng Zhao <zcbenz@gmail.com>
Mon, 6 Jul 2015 08:21:08 +0000 (16:21 +0800)
Fix #2100.

atom/renderer/lib/override.coffee

index 7c32727cdb04064e66ebc603f5b479ac54c43a2c..f87c66037bd478aaa3cf81657e581316938cb136 100644 (file)
@@ -51,6 +51,12 @@ window.open = (url, frameName='', features='') ->
 
   (options[name] = parseInt(options[name], 10) if options[name]?) for name in ints
 
+  # Inherit the node-integration option of current window.
+  unless options['node-integration']
+    for arg in process.argv when arg.indexOf('--node-integration=') is 0
+      options['node-integration'] = arg.substr(-4) is 'true'
+      break
+
   guestId = ipc.sendSync 'ATOM_SHELL_GUEST_WINDOW_MANAGER_WINDOW_OPEN', url, frameName, options
   if guestId
     new BrowserWindowProxy(guestId)