mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-09-21 20:06:40 +00:00
Explicitly make ScriptInterface a Compartment wrapper.
ScriptInterface is now a wrapper around a JSCompartment, and thus always has a well-defined global. The error reporter is moved to ScriptRuntime in anticipation of that handling JSContext in a later diff. Part of the SM52 migration, stage: SM45 compatible. Patch by: Itms Tested By: Freagarach Refs #4893 Differential Revision: https://code.wildfiregames.com/D3090 This was SVN commit r24180.
This commit is contained in:
@@ -43,7 +43,7 @@ class TestScriptConversions : public CxxTest::TestSuite
|
||||
// We want to convert values to strings, but can't just call toSource() on them
|
||||
// since they might not be objects. So just use uneval.
|
||||
std::string source;
|
||||
JS::RootedValue global(rq.cx, script.GetGlobalObject());
|
||||
JS::RootedValue global(rq.cx, rq.globalValue());
|
||||
TS_ASSERT(script.CallFunction(global, "uneval", source, v1));
|
||||
|
||||
TS_ASSERT_STR_EQUALS(source, expected);
|
||||
@@ -60,7 +60,7 @@ class TestScriptConversions : public CxxTest::TestSuite
|
||||
ScriptInterface::ToJSVal(rq, &v1, value);
|
||||
|
||||
std::string source;
|
||||
JS::RootedValue global(rq.cx, script.GetGlobalObject());
|
||||
JS::RootedValue global(rq.cx, rq.globalValue());
|
||||
TS_ASSERT(script.CallFunction(global, "uneval", source, v1));
|
||||
|
||||
if (expected)
|
||||
@@ -90,7 +90,7 @@ class TestScriptConversions : public CxxTest::TestSuite
|
||||
ScriptInterface::ToJSVal(rq, &r1, r);
|
||||
|
||||
std::string source;
|
||||
JS::RootedValue global(rq.cx, script.GetGlobalObject());
|
||||
JS::RootedValue global(rq.cx, rq.globalValue());
|
||||
TS_ASSERT(script.CallFunction(global, "uneval", source, r1));
|
||||
|
||||
TS_ASSERT_STR_EQUALS(source, expected);
|
||||
|
||||
@@ -72,7 +72,7 @@ public:
|
||||
{
|
||||
ScriptInterface::Request rq2(script2);
|
||||
|
||||
JS::RootedValue obj2(rq2.cx, script2.CloneValueFromOtherContext(script1, obj1));
|
||||
JS::RootedValue obj2(rq2.cx, script2.CloneValueFromOtherCompartment(script1, obj1));
|
||||
|
||||
std::string source;
|
||||
TS_ASSERT(script2.CallFunction(obj2, "toSource", source));
|
||||
@@ -94,7 +94,7 @@ public:
|
||||
{
|
||||
ScriptInterface::Request rq2(script2);
|
||||
|
||||
JS::RootedValue obj2(rq2.cx, script2.CloneValueFromOtherContext(script1, obj1));
|
||||
JS::RootedValue obj2(rq2.cx, script2.CloneValueFromOtherCompartment(script1, obj1));
|
||||
|
||||
std::string source;
|
||||
TS_ASSERT(script2.CallFunction(obj2, "toSource", source));
|
||||
@@ -114,7 +114,7 @@ public:
|
||||
|
||||
{
|
||||
ScriptInterface::Request rq2(script2);
|
||||
JS::RootedValue obj2(rq2.cx, script2.CloneValueFromOtherContext(script1, obj1));
|
||||
JS::RootedValue obj2(rq2.cx, script2.CloneValueFromOtherCompartment(script1, obj1));
|
||||
|
||||
// Use JSAPI function to check if the values of the properties "a", "b" are equals a.x[0]
|
||||
JS::RootedValue prop_a(rq2.cx);
|
||||
|
||||
Reference in New Issue
Block a user