Send sync message to get list of modules

This commit is contained in:
Cheng Zhao 2015-11-13 22:15:16 +08:00
parent 099278855c
commit b925ac0056
2 changed files with 4 additions and 7 deletions

View file

@ -206,3 +206,6 @@ ipcMain.on 'ATOM_BROWSER_GUEST_WEB_CONTENTS', (event, guestInstanceId) ->
event.returnValue = valueToMeta event.sender, guestViewManager.getGuest(guestInstanceId)
catch e
event.returnValue = exceptionToMeta e
ipcMain.on 'ATOM_BROWSER_LIST_MODULES', (event) ->
event.returnValue = (name for name of electron)

View file

@ -126,13 +126,7 @@ ipcRenderer.on 'ATOM_RENDERER_RELEASE_CALLBACK', (event, id) ->
callbacksRegistry.remove id
# List all built-in modules in browser process.
# NB(zcbenz): We should probably send an sync message to browser process to get
# them, but that would slow down the startup speed.
browserModules =
['app', 'autoUpdater', 'BrowserWindow', 'contentTracing', 'dialog',
'globalShortcut', 'ipcMain', 'Menu', 'MenuItem', 'powerMonitor',
'powerSaveBlocker', 'protocol', 'Tray', 'clipboard', 'crashReporter',
'nativeImage', 'screen', 'shell']
browserModules = ipcRenderer.sendSync 'ATOM_BROWSER_LIST_MODULES'
# And add a helper receiver for each one.
for name in browserModules
do (name) ->