 
   guestId = ipcRenderer.sendSync 'ATOM_SHELL_GUEST_WINDOW_MANAGER_WINDOW_OPEN', url, frameName, options
   if guestId
-    new BrowserWindowProxy(guestId)
+    BrowserWindowProxy.getOrCreate(guestId)
   else
     null
 


# Window object returned by "window.open".
class BrowserWindowProxy
  constructor: (@guestId) ->
    @closed = false
    ipcRenderer.once "ATOM_SHELL_GUEST_WINDOW_MANAGER_WINDOW_CLOSED_#{@guestId}", =>
      @closed = true

  close: ->

  event.initEvent 'message', false, false
  event.data = message
  event.origin = sourceOrigin
  event.source = BrowserWindowProxy.getOrCreate(guestId)
  window.dispatchEvent event

# Forward history operations to browser.
