]> khamidou — GitHub mirrors - electron.git/commitdiff
Return null in window.open if failed to open new window, fixes #1067
authorCheng Zhao <zcbenz@gmail.com>
Thu, 29 Jan 2015 05:07:57 +0000 (21:07 -0800)
committerCheng Zhao <zcbenz@gmail.com>
Thu, 29 Jan 2015 05:07:57 +0000 (21:07 -0800)
atom/renderer/lib/override.coffee

index e2ada9f5ff5fb1753f89a99377f149e5d6cc56d2..43ae271fb1d0c7d387145adc4a1af34126f0e540 100644 (file)
@@ -42,7 +42,11 @@ window.open = (url, frameName='', features='') ->
   options.height ?= 600
 
   guestId = ipc.sendSync 'ATOM_SHELL_GUEST_WINDOW_MANAGER_WINDOW_OPEN', url, frameName, options
-  new FakeWindow(guestId)
+  if guestId
+    new FakeWindow(guestId)
+  else
+    console.error 'It is not allowed to open new window from this WebContents'
+    null
 
 # Use the dialog API to implement alert().
 window.alert = (message, title='') ->