-
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
snapshot not load after refresh [$5] #3388
Comments
The refresh probelem is not reproducble on nwjs-v0.12.1-linux-x64. nwjc uses code cache to write binary.bin, As v8 preserve code compiled in one context to use it in another context, the code has to be context-independent. |
+1 reproducible on windows 8.1, nwjs 12.1 32bit with latest SSL fix @rogerwang did. To reproduce: After launching your app reload - It will not call / load snapshot again. A big problem if you have code which initializes your app on page load. This basic app will not work as expected. It will not run a second time when refreshed. Using var nw=require("nw.gui");
nw.Window.get().evalNWBin(null,"i/main.bin"); main.bin before compiled console.log("Hello"); |
I've reproduced this on Windows 7. |
@mscreenie @liyingzh thanks for reply. This issue also happened on OS X. |
Noticed that the file is not loaded inside dev tools network tab, don't think it would show up in dev tools perhaps its loaded by io.js perhaps @rogerwang has fixed this in nwjs 13 , ill check, but would be good to get a fix for 12.1 as its the preferred version of release right now. |
will fix this in next 0.12 version. |
Thanks @rogerwang ! A bit off topic - glad to see your decision on refracting code into sdk and distribution builds for nw13. Good decision. Any idea on an eta for 12.2? Cheers. Would appreciate a release. |
It's expected to be released in this week. |
Thanks @rogerwang |
Excellent @rogerwang . Thanks for the update. |
I found that when you keep devtools closed the code reloads well. Change snapshot.js to something like: document.write(Date.now()) to workaround the windows console issue. The reason is that v8 won't load the serialized code blob when debugger is attached: https://github.com/nwjs/v8/blob/nw12/src/compiler.cc#L1291 |
I'll test this, but if I remember correctly it would not be called, ill see if having devtools closed makes a difference. |
When dev tools is closed snapshot is loaded runs ok, Makes debugging a little harder but then again I only compiled a snapshot when distributing the package. Thanks roger, do you think its worth waiting around for 12.2 ? I'm going to push an update from 12 to latest soon. |
this is still happening. i Thought it was a problem of loading pages via Javascript but is definitely this the problem. |
Tested, that was exactly the problem. without devtools bin code runs perfectly. |
Demanding that the issue should be fixed for the next version isn't going to make it fix faster and it's not the right way to request bug-fixes. Considering roger is the sole maintainer of this project and likely has other commitments. I would use a softer approach and maybe attach a bounty to this bug. |
Any progress on this? |
The 'snapshot', which is the compiled binary code of JS, is now supported by a more flexible method: http://docs.nwjs.io/en/latest/References/Window/#winevalnwbinframe-path It allows you load the compiled binary after reload. |
Refresh page in nwjs 0.12.1 will Cause the snapshot to fail.
Here is the code to reproduce the Scenario:
package.json:
index.html:
app.js:
lib.js:
snapshot.js:
Compile the snapshot.js using the command:
Start the nw.app, the log from app.js is collect, but if I hit the refresh(or refreshDev) button, there will be a
RefrenceError
saysechoInSnapshot is not defined
.Also, calling snapshot functions from node context(like the code in lib.js above) will cause a
RefrenceError echoInSnapshot is not defined
. But in previous version(0.11.x), the functions in snapshot can be called Directly from a node context.Did you help close this issue? Go claim the $5 bounty on Bountysource.
The text was updated successfully, but these errors were encountered: