From 4217b7033173b166179b36549f1b06cde271719f Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Wed, 28 Jan 2015 21:07:57 -0800 Subject: [PATCH] Return null in window.open if failed to open new window, fixes #1067 --- atom/renderer/lib/override.coffee | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/atom/renderer/lib/override.coffee b/atom/renderer/lib/override.coffee index e2ada9f5ff..43ae271fb1 100644 --- a/atom/renderer/lib/override.coffee +++ b/atom/renderer/lib/override.coffee @@ -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='') ->