HomeWildfire Games

Revert use of the `isRunOnce` flag after removal in rP22627 of compile'n go…


Revert use of the isRunOnce flag after removal in rP22627 of compile'n go, refs #4893.

This breaked a SM assertion, which was only caught in debug mode. It could have led to subtle bugs during the compilation of JS scripts.
Still set the flag to its default value, because SM devs wanted to change the default in the future.

Event Timeline

elexis added a subscriber: elexis.Aug 8 2019, 1:23 PM

broke a SM assertion

What did it break?

Stan added a subscriber: Stan.Aug 8 2019, 3:28 PM

Thanks for the fix ! I was about to report it
For the record, when running tests in debug (maybe release too) it triggered the following error.

Assertion failure: !options.isRunOnce, at ./libraries/source/spidermonkey/mozjs-45.0.2/js/src/frontend/BytecodeCompiler.cpp:846

(I removed the path with strangely linked to Itm's folders)

Stan awarded a token.Aug 8 2019, 3:28 PM
elexis added a comment.Aug 8 2019, 4:00 PM

Why does the code count as !runOnce?

Beause if it's intentional, it should be made clear, if it is unintentional it should be fixed (instead of disabling the flag)

For the previous compileAndGo it says https://developer.mozilla.org/en-US/docs/Mozilla/Projects/SpiderMonkey/JSAPI_reference/JS::CompileOptions

compileAndGo bool true if the code is going to be evaluated soon after the compile (e.g., false for Function constructor and event handler).

The GUI ScriptHandlers are called much later after the compile, but LoadScript is only run soon after the compile.

jsapi.h // isRunOnce only applies to non-function scripts.

That's it?