SpiderMonkey-related changes in preparation for the upgrade to SpiderMonkey 45, refs #4893.

- Remove JSVAL_ZERO and JSVAL_NULL
https://bugzilla.mozilla.org/show_bug.cgi?id=1177825
- Remove *_TO_JSVAL https://bugzilla.mozilla.org/show_bug.cgi?id=1177892
- Drop support for parent object in the deserializer
https://bugzilla.mozilla.org/show_bug.cgi?id=1136345,
https://bugzilla.mozilla.org/show_bug.cgi?id=805052
- Correctly use boolean values in JS::RuntimeOptionsRef
- Use JS_FN instead of JS_FS: in future versions, JS_FS is not public
because it isn't supposed to be used in JSAPI code
- Allow to select flags for global objects, and correctly mark progress
bars in the loading screen as not readonly+permanent
- Remove empty JSI_props in IGUIObject

Reviewed By: wraitii, elexis
Differential Revision: https://code.wildfiregames.com/D1716
This was SVN commit r22052.
This commit is contained in:
Itms
2019-01-13 16:37:41 +00:00
parent 651cf8b364
commit db5d4bb5f1
10 changed files with 53 additions and 60 deletions
@@ -1,4 +1,4 @@
/* Copyright (C) 2018 Wildfire Games.
/* Copyright (C) 2019 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@@ -33,7 +33,7 @@ JSClass JSI_GUISize::JSI_class = {
JSFunctionSpec JSI_GUISize::JSI_methods[] =
{
JS_FS("toString", JSI_GUISize::toString, 0, 0),
JS_FN("toString", JSI_GUISize::toString, 0, 0),
JS_FS_END
};
@@ -57,7 +57,7 @@ bool JSI_GUISize::construct(JSContext* cx, uint argc, JS::Value* vp)
}
else if (args.length() == 4)
{
JS::RootedValue zero(cx, JSVAL_ZERO);
JS::RootedValue zero(cx, JS::NumberValue(0));
JS_SetProperty(cx, obj, "left", args[0]);
JS_SetProperty(cx, obj, "top", args[1]);
JS_SetProperty(cx, obj, "right", args[2]);
@@ -69,7 +69,7 @@ bool JSI_GUISize::construct(JSContext* cx, uint argc, JS::Value* vp)
}
else
{
JS::RootedValue zero(cx, JSVAL_ZERO);
JS::RootedValue zero(cx, JS::NumberValue(0));
JS_SetProperty(cx, obj, "left", zero);
JS_SetProperty(cx, obj, "top", zero);
JS_SetProperty(cx, obj, "right", zero);
@@ -141,7 +141,7 @@ JSClass JSI_GUIColor::JSI_class = {
JSFunctionSpec JSI_GUIColor::JSI_methods[] =
{
JS_FS("toString", JSI_GUIColor::toString, 0, 0),
JS_FN("toString", JSI_GUIColor::toString, 0, 0),
JS_FS_END
};
@@ -210,7 +210,7 @@ JSClass JSI_GUIMouse::JSI_class = {
JSFunctionSpec JSI_GUIMouse::JSI_methods[] =
{
JS_FS("toString", JSI_GUIMouse::toString, 0, 0),
JS_FN("toString", JSI_GUIMouse::toString, 0, 0),
JS_FS_END
};
@@ -1,4 +1,4 @@
/* Copyright (C) 2017 Wildfire Games.
/* Copyright (C) 2019 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@@ -39,17 +39,12 @@ JSClass JSI_IGUIObject::JSI_class = {
nullptr, nullptr, JSI_IGUIObject::construct, nullptr
};
JSPropertySpec JSI_IGUIObject::JSI_props[] =
{
{ 0 }
};
JSFunctionSpec JSI_IGUIObject::JSI_methods[] =
{
JS_FS("toString", JSI_IGUIObject::toString, 0, 0),
JS_FS("focus", JSI_IGUIObject::focus, 0, 0),
JS_FS("blur", JSI_IGUIObject::blur, 0, 0),
JS_FS("getComputedSize", JSI_IGUIObject::getComputedSize, 0, 0),
JS_FN("toString", JSI_IGUIObject::toString, 0, 0),
JS_FN("focus", JSI_IGUIObject::focus, 0, 0),
JS_FN("blur", JSI_IGUIObject::blur, 0, 0),
JS_FN("getComputedSize", JSI_IGUIObject::getComputedSize, 0, 0),
JS_FS_END
};
@@ -635,7 +630,7 @@ bool JSI_IGUIObject::construct(JSContext* cx, uint argc, JS::Value* vp)
void JSI_IGUIObject::init(ScriptInterface& scriptInterface)
{
scriptInterface.DefineCustomObjectType(&JSI_class, construct, 1, JSI_props, JSI_methods, NULL, NULL);
scriptInterface.DefineCustomObjectType(&JSI_class, construct, 1, nullptr, JSI_methods, nullptr, nullptr);
}
bool JSI_IGUIObject::toString(JSContext* cx, uint UNUSED(argc), JS::Value* vp)
@@ -1,4 +1,4 @@
/* Copyright (C) 2018 Wildfire Games.
/* Copyright (C) 2019 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@@ -23,7 +23,6 @@
namespace JSI_IGUIObject
{
extern JSClass JSI_class;
extern JSPropertySpec JSI_props[];
extern JSFunctionSpec JSI_methods[];
bool getProperty(JSContext* cx, JS::HandleObject obj, JS::HandleId id, JS::MutableHandleValue vp);
bool setProperty(JSContext* cx, JS::HandleObject obj, JS::HandleId id, bool UNUSED(strict), JS::MutableHandleValue vp);