swap global proxies before initializing the windows proxies
Electron's Context Isolation implementation has a side-effect of initializing the isolated worlds WindowProxy during the initialization of the main world WindowProxy as a result of creating the isolated world inside the DidCreateScriptContext hook. This results in an assertion failing in Chromium during a frame swap where it expects to be able to set a new global_proxy in the WindowProxy of the isolated world BEFORE it is initialized. To meet this assumption this patch splits SetGlobalProxy into two calls, SetGlobalProxyWithoutInitializing and InitializeIfNeeded which has the same resultant effect but means that all of the global_proxy objects are set BEFORE any WindowProxy's are initialized. To further clarify, if an embedder creates and initializes new script context as a result of a call to DidCreateScriptContext the "global_proxy_.IsEmpty()" CHECK fails as it doesn't expect that context to have been initialized yet. Change-Id: I0efa579a4ec2d93369f3e1fc7a922a459a2300cf Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2503397Reviewed-by:Daniel Cheng <dcheng@chromium.org> Reviewed-by:
Yuki Shiino <yukishiino@chromium.org> Commit-Queue: Yuki Shiino <yukishiino@chromium.org> Cr-Commit-Position: refs/heads/master@{#822052}
Showing
Please register or sign in to comment