Do not enumerate windows in remote.getCurrentWindow
This commit is contained in:
parent
f2c7943d42
commit
1045bbc861
2 changed files with 3 additions and 10 deletions
|
@ -106,16 +106,9 @@ ipc.on 'ATOM_BROWSER_GLOBAL', (event, name) ->
|
||||||
catch e
|
catch e
|
||||||
event.returnValue = errorToMeta e
|
event.returnValue = errorToMeta e
|
||||||
|
|
||||||
ipc.on 'ATOM_BROWSER_CURRENT_WINDOW', (event, guestInstanceId) ->
|
ipc.on 'ATOM_BROWSER_CURRENT_WINDOW', (event) ->
|
||||||
try
|
try
|
||||||
BrowserWindow = require 'browser-window'
|
event.returnValue = valueToMeta event.sender, event.sender.getOwnerBrowserWindow()
|
||||||
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
|
|
||||||
catch e
|
catch e
|
||||||
event.returnValue = errorToMeta e
|
event.returnValue = errorToMeta e
|
||||||
|
|
||||||
|
|
|
@ -130,7 +130,7 @@ exports.require = (module) ->
|
||||||
windowCache = null
|
windowCache = null
|
||||||
exports.getCurrentWindow = ->
|
exports.getCurrentWindow = ->
|
||||||
return windowCache if windowCache?
|
return windowCache if windowCache?
|
||||||
meta = ipc.sendSync 'ATOM_BROWSER_CURRENT_WINDOW', process.guestInstanceId
|
meta = ipc.sendSync 'ATOM_BROWSER_CURRENT_WINDOW'
|
||||||
windowCache = metaToValue meta
|
windowCache = metaToValue meta
|
||||||
|
|
||||||
# Get current WebContents object.
|
# Get current WebContents object.
|
||||||
|
|
Loading…
Reference in a new issue