HomeWildfire Games

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

Description

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.Thu, Aug 8, 1:23 PM

broke a SM assertion

What did it break?

Stan added a subscriber: Stan.Thu, Aug 8, 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.Thu, Aug 8, 3:28 PM
elexis added a comment.Thu, Aug 8, 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?