mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-06-21 14:24:43 +00:00
[SM52 2/2] Update to Spidermonkey 52 APIs.
No particularly noteworthy changes, as most complex API changes were already supported in SM45 and done. The addition of JSStructuredCloneData allows to remove our custom class. Changes: - InformalValueTypeName is back in the API, so remove our implementation. - Stop using JSRuntime entirely in favour of JSContext* - JSPropertyDescriptor is renamed. - CompartmentOptions are tweaked slightly (no functional changes) - JS::Construct - API update. - JSClass split - API update. - A js.msg error message was removed, so we had to use a different one. - Tests fix: fix comparison of union instances - Disable warning in spidermonkey Vector.h - Update error reporting to SM52 (minor API updates) - Ignore warnings about unused return values (would come from OOM, which isn't recoverable) Most of the patching was done by Itms. Tested by: Stan, Freagarach Fixes #4893 Differential Revision: https://code.wildfiregames.com/D3095 This was SVN commit r24203.
This commit is contained in:
@@ -28,28 +28,7 @@
|
||||
#define FAIL(msg) STMT(LOGERROR(msg); return false)
|
||||
|
||||
// Implicit type conversions often hide bugs, so warn about them
|
||||
#define WARN_IF_NOT(c, v) STMT(if (!(c)) { JS_ReportWarning(rq.cx, "Script value conversion check failed: %s (got type %s)", #c, InformalValueTypeName(v)); })
|
||||
|
||||
// TODO: SpiderMonkey: Follow upstream progresses about JS_InformalValueTypeName in the API
|
||||
// https://bugzilla.mozilla.org/show_bug.cgi?id=1285917
|
||||
static const char* InformalValueTypeName(const JS::Value& v)
|
||||
{
|
||||
if (v.isObject())
|
||||
return "object";
|
||||
if (v.isString())
|
||||
return "string";
|
||||
if (v.isSymbol())
|
||||
return "symbol";
|
||||
if (v.isNumber())
|
||||
return "number";
|
||||
if (v.isBoolean())
|
||||
return "boolean";
|
||||
if (v.isNull())
|
||||
return "null";
|
||||
if (v.isUndefined())
|
||||
return "undefined";
|
||||
return "value";
|
||||
}
|
||||
#define WARN_IF_NOT(c, v) STMT(if (!(c)) { JS_ReportWarningUTF8(rq.cx, "Script value conversion check failed: %s (got type %s)", #c, JS::InformalValueTypeName(v)); })
|
||||
|
||||
template<> bool ScriptInterface::FromJSVal<bool>(const ScriptRequest& rq, JS::HandleValue v, bool& out)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user