Removes g_ScriptingHost and implements global to compartment 1 to 1 relation.
Each GUI Page gets its own compartment and all ScriptInterfaces in the same thread should now use the same JS Runtime.
This is required for the SpiderMonkey upgrade.
Check the ticket for details.
Description
Description
Details
Details
- Committed
Yves Jan 4 2014, 11:14 AM - Parents
- rP14495: Roman tower remake
- Branches
- Unknown
- Tags
Event Timeline
/ps/trunk/binaries/data/mods/public/gui/common/functions_global_object.js | ||
---|---|---|
16 |
I can confirm is a pain to implement the callback function properly, because the JS function has to be stored as a JS::Value in a C++ struct, but the function doesn't have to be passed between compartment boundaries, the callback function is still performed in the same context. | |
33 | all of this ugly/hack example ^ | |
56 | ugly/hack example ^ | |
/ps/trunk/binaries/data/mods/public/gui/msgbox/msgbox.xml | ||
85 | ugliness example ^ | |
/ps/trunk/source/gui/GUIManager.cpp | ||
131 | Passing a function name instead of a function is a really uncomfortable solution that leaves much uglier JS code than the alternative that passes a function. It for example means that the AI config dialog in gamesetup.js requires a global function that is 1000+ lines away from it's PushGuiPageCB call and prevents that from confining the AI behavior logic to one hunk. Secondly it's easier for the JS dev if there is only one Push and one Pop function where the callback function and the return value are optional. |
Comment Actions
The hwdetect concern was addressed in rP22549 (and I guess the patch isn't scheduled to be audited completely).