From: Cheng Zhao Date: Mon, 7 Dec 2015 13:25:19 +0000 (+0800) Subject: Fix the failing sendSync X-Git-Tag: v0.36.0~30^2~7 X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=647f151906dc46bc3be4b188294ccc389617b7e2;p=electron.git Fix the failing sendSync --- diff --git a/atom/renderer/api/lib/remote.coffee b/atom/renderer/api/lib/remote.coffee index 48cdd937..357b8840 100644 --- a/atom/renderer/api/lib/remote.coffee +++ b/atom/renderer/api/lib/remote.coffee @@ -119,7 +119,11 @@ metaToPlainObject = (meta) -> # Browser calls a callback in renderer. ipcRenderer.on 'ATOM_RENDERER_CALLBACK', (event, id, args) -> - callbacksRegistry.apply id, metaToValue(args) + # Delay the callback to next tick in case the browser is still in the middle + # of sending this message while the callback sends a sync message to browser, + # which can fail sometimes. + setImmediate -> + callbacksRegistry.apply id, metaToValue(args) # A callback in browser is released. ipcRenderer.on 'ATOM_RENDERER_RELEASE_CALLBACK', (event, id) ->