   event.initEvent 'message', false, false
   event.data = message
   event.origin = sourceOrigin
-  event.source = new BrowserWindowProxy(guestId)
+  event.source = BrowserWindowProxy.getOrCreate(guestId)
   window.dispatchEvent event
 
 # Forward history operations to browser.


# 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: ->


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

