mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 831386 - GC: ChromeBuffer jsapi test fails under rooting analysis r=terrence
This commit is contained in:
parent
4a25f0379a
commit
ebb1a78cb9
@ -32,7 +32,7 @@ CallTrusted(JSContext *cx, unsigned argc, jsval *vp)
|
||||
JSBool ok = JS_FALSE;
|
||||
{
|
||||
JSAutoCompartment ac(cx, trusted_glob);
|
||||
ok = JS_CallFunctionValue(cx, NULL, OBJECT_TO_JSVAL(trusted_fun),
|
||||
ok = JS_CallFunctionValue(cx, NULL, JS::ObjectValue(*trusted_fun),
|
||||
0, NULL, vp);
|
||||
}
|
||||
JS_RestoreFrameChain(cx);
|
||||
@ -70,8 +70,8 @@ BEGIN_TEST(testChromeBuffer)
|
||||
trusted_fun = JS_GetFunctionObject(fun);
|
||||
}
|
||||
|
||||
jsval v = OBJECT_TO_JSVAL(trusted_fun);
|
||||
CHECK(JS_WrapValue(cx, &v));
|
||||
js::RootedValue v(cx, JS::ObjectValue(*trusted_fun));
|
||||
CHECK(JS_WrapValue(cx, v.address()));
|
||||
|
||||
const char *paramName = "trusted";
|
||||
const char *bytes = "try { "
|
||||
@ -83,7 +83,7 @@ BEGIN_TEST(testChromeBuffer)
|
||||
bytes, strlen(bytes), "", 0));
|
||||
|
||||
jsval rval;
|
||||
CHECK(JS_CallFunction(cx, NULL, fun, 1, &v, &rval));
|
||||
CHECK(JS_CallFunction(cx, NULL, fun, 1, v.address(), &rval));
|
||||
CHECK(JSVAL_TO_INT(rval) == 100);
|
||||
}
|
||||
|
||||
@ -107,8 +107,8 @@ BEGIN_TEST(testChromeBuffer)
|
||||
trusted_fun = JS_GetFunctionObject(fun);
|
||||
}
|
||||
|
||||
jsval v = OBJECT_TO_JSVAL(trusted_fun);
|
||||
CHECK(JS_WrapValue(cx, &v));
|
||||
js::RootedValue v(cx, JS::ObjectValue(*trusted_fun));
|
||||
CHECK(JS_WrapValue(cx, v.address()));
|
||||
|
||||
const char *paramName = "trusted";
|
||||
const char *bytes = "try { "
|
||||
@ -120,7 +120,7 @@ BEGIN_TEST(testChromeBuffer)
|
||||
bytes, strlen(bytes), "", 0));
|
||||
|
||||
jsval rval;
|
||||
CHECK(JS_CallFunction(cx, NULL, fun, 1, &v, &rval));
|
||||
CHECK(JS_CallFunction(cx, NULL, fun, 1, v.address(), &rval));
|
||||
JSBool match;
|
||||
CHECK(JS_StringEqualsAscii(cx, JSVAL_TO_STRING(rval), "From trusted: InternalError: too much recursion", &match));
|
||||
CHECK(match);
|
||||
@ -142,7 +142,7 @@ BEGIN_TEST(testChromeBuffer)
|
||||
}
|
||||
|
||||
JSFunction *fun = JS_NewFunction(cx, CallTrusted, 0, 0, global, "callTrusted");
|
||||
JS::Anchor<JSObject *> callTrusted(JS_GetFunctionObject(fun));
|
||||
js::RootedObject callTrusted(cx, JS_GetFunctionObject(fun));
|
||||
|
||||
const char *paramName = "f";
|
||||
const char *bytes = "try { "
|
||||
@ -153,9 +153,9 @@ BEGIN_TEST(testChromeBuffer)
|
||||
CHECK(fun = JS_CompileFunction(cx, global, "untrusted", 1, ¶mName,
|
||||
bytes, strlen(bytes), "", 0));
|
||||
|
||||
jsval arg = OBJECT_TO_JSVAL(callTrusted.get());
|
||||
js::RootedValue arg(cx, JS::ObjectValue(*callTrusted));
|
||||
jsval rval;
|
||||
CHECK(JS_CallFunction(cx, NULL, fun, 1, &arg, &rval));
|
||||
CHECK(JS_CallFunction(cx, NULL, fun, 1, arg.address(), &rval));
|
||||
CHECK(JSVAL_TO_INT(rval) == 42);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user