-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
setTimeout not run in webview's Node vm #5622
Comments
The timeout callback was fired, but the function call is blocked by Blink because it was defined with the previous window context before navigation thus invalid. The fix will be available in the next nightly build. |
From his comments, it looks like the final setTimeout isn't working, which will only come into the picture after navigation. |
@RohitSharma27 It's the Node context which is initialized in the previous window. Then when vm.runInNewContext() is called after navigation, it's executed in the Node context. |
So, when we say that webview runs in a separate process, does it mean that it will have it's own node process or will it have it's own separate node context running in the background process or will it share the node context with already created one inside the background page? |
Node always runs in the same (renderer) process with DOM. So as webview runs in an additional separate process, there is a Node running inside of it. In OP's sample, the webview is loaded with 'about:blank' first, then it was navigated to the remote url. Before the fix, Node was initialized within the previous context (about:blank), after the navigation, it's still there and reused. |
@rogerwang This totally makes sense now. Thanks for the efforts. |
- Add test for issue nwjs#5622 - This test is failed on v0.19.5, passed on v0.30.0
- Add test for issue nwjs#5622 - This test is failed on v0.19.5, passed on v0.30.0
- Add test for issue nwjs#5622 - This test is failed on v0.19.5, passed on v0.30.0
nw ver
0.19.5
It doesn't work when i use setTimeout in a sandbox with node
vm
module, inwebview
.But it works in the normal page.
here is the key code
The text was updated successfully, but these errors were encountered: