mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-07-27 10:32:55 +00:00
Improve JS Exception handling.
- Check for pending exceptions after function calls and script executions. - Call LOGERROR instead of JS_ReportError when there is a conversion error in FromJSVal, since that can only be called from C++ (where JS errors don't really make sense). Instead, C++ callers of FromJSVal should handle the failure and, themselves, either report an error or simply do something else. - Wrap JS_ReportError since that makes updating it later easier. This isn't a systematical fix since ToJSVal also ought return a boolean for failures, and we probably should trigger errors instead of warnings on 'implicit' conversions, rather a preparation diff. Part of the SM52 migration, stage: SM45 compatible (actually SM52 incompatible, too). Based on a patch by: Itms Comments by: Vladislavbelov, Stan` Refs #742, #4893 Differential Revision: https://code.wildfiregames.com/D3093 This was SVN commit r24187.
This commit is contained in:
@@ -56,6 +56,7 @@ public:
|
||||
int contextSize = DEFAULT_CONTEXT_SIZE,
|
||||
int heapGrowthBytesGCTrigger = DEFAULT_HEAP_GROWTH_BYTES_GCTRIGGER);
|
||||
|
||||
|
||||
/**
|
||||
* MaybeIncrementalGC tries to determine whether a context-wide garbage collection would free up enough memory to
|
||||
* be worth the amount of time it would take. It does this with our own logic and NOT some predefined JSAPI logic because
|
||||
@@ -82,7 +83,7 @@ public:
|
||||
* entering any compartment. It should only be used in specific situations, such as
|
||||
* creating a new compartment, or as an unsafe alternative to GetJSRuntime.
|
||||
* If you need the compartmented context of a ScriptInterface, you should create a
|
||||
* ScriptInterface::Request and use the context from that.
|
||||
* ScriptRequest and use the context from that.
|
||||
*/
|
||||
JSContext* GetGeneralJSContext() const { return m_cx; }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user