Having nw.Window.get().evalNWBin inside a compiled js file (bin) crashes the app (only on normal flavor)
Issue Type
- [x] Bug Report
- [ ] Feature Request
- [x] Successfully reproduced against the latest version of NW.js?
Please use our mailing list or Gitter chatroom to ask questions. The issue tracker is only for bugs and feature requests, in English only. Please note that issues without a repro or code snippet are less likely to be resolved.
File structure:
Current Behavior
App crashes the moment nw.exe is opened. debug log only shows one line. (see crash report below)
Expected Behavior
<div id="tester1">REPLACE</div> and <div id="tester2">REPLACE</div> gets replaced by the text "TEXT HAS BEEN REPLACED" and "TEXT HAS BEEN REPLACED TWICE" respectively and stays open.
Keep in mind that this only happens in the normal flavor, sdk flavor works fine as is and runs fine, the expected screenshot above was taken in sdk flavor. I also tried changing it from test2.bin to ./test2.bin, and this time, both sdk and normal flavors crashed.
Additional Info
- Operating System: Windows 10
- NW.js Version: 0.77.0
- Repro Link: N/A
- Code snippet:
test.js
'use strict';
nw.Window.open('test.html', {
width: 720,
height: 388,
show: false,
}, function(win) {
win.show()
})
test.html
<HTML>
<head><title>TEST</title></head>
<body>
<div id="tester1">REPLACE</div>
<div id="tester2">REPLACE</div>
<script>
nw.Window.get().evalNWBin(null, 'test1.bin')
</script>
</body>
</HTML>
test1.bin(.js) - compiled by nwjc test1.bin.js test1.bin
document.querySelector('#tester1').innerHTML = 'TEXT HAS BEEN REPLACED';
nw.Window.get().evalNWBin(null, 'test2.bin')
test2.bin(.js) - compiled by nwjc test2.bin.js test2.bin
document.querySelector('#tester2').innerHTML = 'TEXT HAS BEEN REPLACED TWICE';
- Crash report:
[0616/181530.488:ERROR:registration_protocol_win.cc(107)] CreateFile: The system cannot find the file specified. (0x2)
I've had the same issue. To resolve it was enough to install from archive https://dl.nwjs.io/ the same architecture "sdk" and "normal" folders of the same version. For my case i installed "nwjs-sdk-v0.67.1-win-ia32" and "nwjs-v0.67.1-win-ia32". Finally generating code binary with nwjc in sdk and then moving it to normal folder make everything work.