diff --git a/atom/browser/lib/rpc-server.coffee b/atom/browser/lib/rpc-server.coffee index 0a28d350e8a..149b208b409 100644 --- a/atom/browser/lib/rpc-server.coffee +++ b/atom/browser/lib/rpc-server.coffee @@ -106,16 +106,9 @@ ipc.on 'ATOM_BROWSER_GLOBAL', (event, name) -> catch e event.returnValue = errorToMeta e -ipc.on 'ATOM_BROWSER_CURRENT_WINDOW', (event, guestInstanceId) -> +ipc.on 'ATOM_BROWSER_CURRENT_WINDOW', (event) -> try - BrowserWindow = require 'browser-window' - if guestInstanceId? - guestViewManager = require './guest-view-manager' - window = BrowserWindow.fromWebContents guestViewManager.getEmbedder(guestInstanceId) - else - window = BrowserWindow.fromWebContents event.sender - window = BrowserWindow.fromDevToolsWebContents event.sender unless window? - event.returnValue = valueToMeta event.sender, window + event.returnValue = valueToMeta event.sender, event.sender.getOwnerBrowserWindow() catch e event.returnValue = errorToMeta e diff --git a/atom/renderer/api/lib/remote.coffee b/atom/renderer/api/lib/remote.coffee index 00d22ab8cf6..1f17cf34002 100644 --- a/atom/renderer/api/lib/remote.coffee +++ b/atom/renderer/api/lib/remote.coffee @@ -130,7 +130,7 @@ exports.require = (module) -> windowCache = null exports.getCurrentWindow = -> return windowCache if windowCache? - meta = ipc.sendSync 'ATOM_BROWSER_CURRENT_WINDOW', process.guestInstanceId + meta = ipc.sendSync 'ATOM_BROWSER_CURRENT_WINDOW' windowCache = metaToValue meta # Get current WebContents object.