You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
WebView frequently fails to load the node-related globals when there are multiple instance in a browser window #1038
I have created webview "load test" use case[https://gist.github.com/christoth/d11e03c70a144ba02caa], creating and deleting multiple webviews at a time.
Please click the "Start Test" button, which will created 5 "tabs"/webviews at a time and then it will start deleting them 5 at a time (always keeping at least 5 tabs open at all times - delayed close timer)
Frequently, but not all the time, the webview fails to load the node-related globals (e.g. require()) which causes a ReferenceError in content.html. This happens both with a preload defined and without.
I have tested this on Win7 x64, with atom-shell versions 20.6 & 20.7 (and it has occurred with my larger application with prior versions as well.
@zcbenz I still get the intermittent issue of require, process & module not being defined in the webview javascript env when then nodeintegration is defined using 0.20.8
Can you re-open this issue? The gist I created should reproduce this issue.
I updated my gist [https://gist.github.com/christoth/d11e03c70a144ba02caa] to log to the console when it starts the preload.js and when the webview content.html JavaScript starts.
I discovered that with Atom-Shell v0.21 (Win7 x64) the preload.js does not execute when the node-related globals (e.g. require, remote, process, etc...) are not defined in content.html that is loaded in the webview.
@zcbenz After some further investigation it looks like the command line arguments are not being appended in AtomBrowserClient::AppendExtraCommandLineSwitches() when atom-shell spawns a new child process. Specifically, WebViewRendererState::GetInstance()->GetInfo(child_process_id, &info) is not being evaluated to true when the error occurs (webview does not load the preload JS and add the nodeintegration objects to global).
Activity
CharlieHess commentedon Jan 21, 2015
This sounds similar to the issues @paulcbetts and I are seeing with both
processandrequire./cc #1039, #1028
zcbenz commentedon Jan 26, 2015
Fixed by #1044.
christoth commentedon Jan 27, 2015
@zcbenz I still get the intermittent issue of require, process & module not being defined in the webview javascript env when then nodeintegration is defined using 0.20.8
Can you re-open this issue? The gist I created should reproduce this issue.
Thanks
christoth commentedon Jan 29, 2015
I updated my gist [https://gist.github.com/christoth/d11e03c70a144ba02caa] to log to the console when it starts the preload.js and when the webview content.html JavaScript starts.
I discovered that with Atom-Shell v0.21 (Win7 x64) the preload.js does not execute when the node-related globals (e.g. require, remote, process, etc...) are not defined in content.html that is loaded in the webview.
christoth commentedon Jan 31, 2015
@zcbenz After some further investigation it looks like the command line arguments are not being appended in AtomBrowserClient::AppendExtraCommandLineSwitches() when atom-shell spawns a new child process. Specifically, WebViewRendererState::GetInstance()->GetInfo(child_process_id, &info) is not being evaluated to true when the error occurs (webview does not load the preload JS and add the nodeintegration objects to global).
I will try to investigate further...
anaisbetts commentedon Feb 4, 2015
We hit this pretty frequently, it appears that the preload script doesn't run at all sometimes. Anything we can capture to help debug this?
zcbenz commentedon Feb 4, 2015
I just looked into this and as @christoth said it should be caused by the race condition when updating/reading WebViewRendererState.
christoth commentedon Feb 5, 2015
@zcbenz This fixed it, thanks!
yjfdl123 commentedon Feb 24, 2016
i have the same question,that require and process and global can't be used in webview tag.
I'm wait'ing the question to be resolved