Crash fix in WSH runtime#1536
Conversation
|
For now, I’ve only addressed the app crash issue. I’ll update the code shortly with improvements that more closely align with the intended purpose of |
Refactor NullProtoObjectViaActiveX and add error handling for 32-bit MSScriptControl.
|
On 32-bit systems only (64-bit is not supported), there is a way to obtain a fresh If we cannot give up null-prototype objects, using the |
|
I have added a fallback for 64-bit systems. |
Modify error handling to return an empty object if ScriptControl is unavailable.
Throw an error when unable to create an object with a null prototype.
|
@zloirock Since people have asked about 3 tickets about this, can we try to accept this PR? ActiveX ScriptControl in WSH 32-bit ships out-of-the-box, 64-bit can be installed by a third-party, and this also catches any exceptions and adds a better error message. @gnh1201 This looks pretty good. Excited to see people dig this deep to get foriegn objects in JavaScript |
The existing code forces the invocation of the
htmlfilemodule even in the WSH environment, which can cause crashes on machines where calling thehtmlfilemodule is restricted (e.g., due to unknown changes in IE-related settings).In the case of WSH (or
non-browser ES3 environment), its usage differs significantly from that of IE (as it is a standalone runtime rather than a web browser), so there is no real need to invoke thehtmlfilemodule. The issue can be resolved by not callinghtmlfileat all in the WSH environment.The related issue is as follows: