0ad/source/gui/ObjectTypes
wraitii ee0d204bf6 Wrap JSAutoRequest and replace usage of JSContext* with the wrapper.
JSAutoRequest is required before calling into most JSAPI methods, for GC
reasons.
Calling it is required and fragile as one must not forget.
Further, SM52 and later make manipulating JSContext* dangerous as that
can cross Compartment(Realm in SM68) barriers (and ScriptInterface now
matches a Compartment).

The solution to both problems is to avoid using JSContext* in 0 A.D.
itself. To achieve this, a Request class is introduced, and must be used
to access a JSContext* from a scriptInterface. Further, Request is
passed to other ScriptInterface functions isntead of JSContext*, making
it obvious that the caller has already called it, reducing errors and
redundant JSAutoRequest calls.
Only JSNative functions now get a naked JSContext* without protection,
but the likelihood of forgetting a request is lower since many
ScriptInterface functions now expect it.

JSContext* is directly passed to JSAPI functions only.

Part of the SM52 migration, stage: SM45 compatible

Based on a patch by: Itms
Tested By: Freagarach
Refs #4893

Differential Revision: https://code.wildfiregames.com/D3088
This was SVN commit r24176.
2020-11-13 13:18:22 +00:00
..
CButton.cpp Sort GUI Object types, GUI Object bases and GUI Setting value types into three new folders. 2019-10-02 09:44:00 +00:00
CButton.h Sort GUI Object types, GUI Object bases and GUI Setting value types into three new folders. 2019-10-02 09:44:00 +00:00
CChart.cpp Fixes GLES mode builds on Mesa and running on Intel Iris drivers. 2020-01-17 21:13:51 +00:00
CChart.h Sort GUI Object types, GUI Object bases and GUI Setting value types into three new folders. 2019-10-02 09:44:00 +00:00
CCheckBox.cpp Sort GUI Object types, GUI Object bases and GUI Setting value types into three new folders. 2019-10-02 09:44:00 +00:00
CCheckBox.h Sort GUI Object types, GUI Object bases and GUI Setting value types into three new folders. 2019-10-02 09:44:00 +00:00
CDropDown.cpp Sort GUI Object types, GUI Object bases and GUI Setting value types into three new folders. 2019-10-02 09:44:00 +00:00
CDropDown.h Sort GUI Object types, GUI Object bases and GUI Setting value types into three new folders. 2019-10-02 09:44:00 +00:00
CGUIDummyObject.h Sort GUI Object types, GUI Object bases and GUI Setting value types into three new folders. 2019-10-02 09:44:00 +00:00
CImage.cpp Sort GUI Object types, GUI Object bases and GUI Setting value types into three new folders. 2019-10-02 09:44:00 +00:00
CImage.h Sort GUI Object types, GUI Object bases and GUI Setting value types into three new folders. 2019-10-02 09:44:00 +00:00
CInput.cpp Remove useless SDL debug message introduced in 5593f573f4. 2020-10-27 21:19:33 +00:00
CInput.h Remove counterproductive lowercasing of GUI ScriptEvent names, refs #127. 2020-01-15 16:00:37 +00:00
CList.cpp Remove counterproductive lowercasing of GUI ScriptEvent names, refs #127. 2020-01-15 16:00:37 +00:00
CList.h Remove counterproductive lowercasing of GUI ScriptEvent names, refs #127. 2020-01-15 16:00:37 +00:00
CMiniMap.cpp Wrap JSAutoRequest and replace usage of JSContext* with the wrapper. 2020-11-13 13:18:22 +00:00
CMiniMap.h Adds a LOS mask to Minimap. 2020-11-08 08:51:54 +00:00
COList.cpp Remove counterproductive lowercasing of GUI ScriptEvent names, refs #127. 2020-01-15 16:00:37 +00:00
COList.h Remove counterproductive lowercasing of GUI ScriptEvent names, refs #127. 2020-01-15 16:00:37 +00:00
CProgressBar.cpp Rename CProgressBar numeric "caption" setting to "progress" to distinguish it from the Button, Input, Text and Tooltip "caption" setting values that are tag-formatted texts. 2019-11-12 16:53:19 +00:00
CProgressBar.h Rename CProgressBar numeric "caption" setting to "progress" to distinguish it from the Button, Input, Text and Tooltip "caption" setting values that are tag-formatted texts. 2019-11-12 16:53:19 +00:00
CRadioButton.cpp Sort GUI Object types, GUI Object bases and GUI Setting value types into three new folders. 2019-10-02 09:44:00 +00:00
CRadioButton.h Sort GUI Object types, GUI Object bases and GUI Setting value types into three new folders. 2019-10-02 09:44:00 +00:00
CSlider.cpp CSlider inherits IGUIButtonBehavior to gains button sounds, press/release events, duplication removal, continuation of sliding if the object is not hovered while the button is still pressed, refs #2593, c016a74309/D325, 359df88f1a/D1622. 2020-01-24 00:56:51 +00:00
CSlider.h CSlider inherits IGUIButtonBehavior to gains button sounds, press/release events, duplication removal, continuation of sliding if the object is not hovered while the button is still pressed, refs #2593, c016a74309/D325, 359df88f1a/D1622. 2020-01-24 00:56:51 +00:00
CText.cpp Wrap JSAutoRequest and replace usage of JSContext* with the wrapper. 2020-11-13 13:18:22 +00:00
CText.h Sort GUI Object types, GUI Object bases and GUI Setting value types into three new folders. 2019-10-02 09:44:00 +00:00
CTooltip.cpp Sort GUI Object types, GUI Object bases and GUI Setting value types into three new folders. 2019-10-02 09:44:00 +00:00
CTooltip.h Sort GUI Object types, GUI Object bases and GUI Setting value types into three new folders. 2019-10-02 09:44:00 +00:00