зеркало из https://github.com/mozilla/gecko-dev.git
Bug 784739 - Switch from NULL to nullptr in js/src/jsapi-tests/; r=ehsan
--HG-- extra : rebase_source : 49d8f804825f98f39bf08aa06a4408d8a32538ad
This commit is contained in:
Родитель
db2e1e5ed1
Коммит
be5cb5eee9
|
@ -21,7 +21,7 @@ END_TEST(selfTest_NaNsAreSame)
|
|||
|
||||
BEGIN_TEST(selfTest_globalHasNoParent)
|
||||
{
|
||||
CHECK(JS_GetParent(global) == NULL);
|
||||
CHECK(JS_GetParent(global) == nullptr);
|
||||
return true;
|
||||
}
|
||||
END_TEST(selfTest_globalHasNoParent)
|
||||
|
|
|
@ -33,13 +33,13 @@ const JSClass addPropertyClass = {
|
|||
|
||||
BEGIN_TEST(testAddPropertyHook)
|
||||
{
|
||||
JS::RootedObject obj(cx, JS_NewObject(cx, NULL, NULL, NULL));
|
||||
JS::RootedObject obj(cx, JS_NewObject(cx, nullptr, nullptr, nullptr));
|
||||
CHECK(obj);
|
||||
JS::RootedValue proto(cx, OBJECT_TO_JSVAL(obj));
|
||||
JS_InitClass(cx, global, obj, &addPropertyClass, NULL, 0, NULL, NULL, NULL,
|
||||
NULL);
|
||||
JS_InitClass(cx, global, obj, &addPropertyClass, nullptr, 0, nullptr, nullptr, nullptr,
|
||||
nullptr);
|
||||
|
||||
obj = JS_NewArrayObject(cx, 0, NULL);
|
||||
obj = JS_NewArrayObject(cx, 0, nullptr);
|
||||
CHECK(obj);
|
||||
JS::RootedValue arr(cx, OBJECT_TO_JSVAL(obj));
|
||||
|
||||
|
@ -48,7 +48,7 @@ BEGIN_TEST(testAddPropertyHook)
|
|||
JSPROP_ENUMERATE));
|
||||
|
||||
for (int i = 0; i < expectedCount; ++i) {
|
||||
obj = JS_NewObject(cx, &addPropertyClass, NULL, NULL);
|
||||
obj = JS_NewObject(cx, &addPropertyClass, nullptr, nullptr);
|
||||
CHECK(obj);
|
||||
JS::RootedValue vobj(cx, OBJECT_TO_JSVAL(obj));
|
||||
JS::RootedObject arrObj(cx, JSVAL_TO_OBJECT(arr));
|
||||
|
|
|
@ -46,7 +46,7 @@ BEGIN_TEST(testArrayBuffer_bug720949_steal)
|
|||
|
||||
// Modifying the underlying data should update the value returned through the view
|
||||
uint8_t *data = JS_GetArrayBufferData(obj);
|
||||
CHECK(data != NULL);
|
||||
CHECK(data != nullptr);
|
||||
*reinterpret_cast<uint32_t*>(data) = MAGIC_VALUE_2;
|
||||
CHECK(JS_GetElement(cx, view, 0, &v));
|
||||
CHECK_SAME(v, INT_TO_JSVAL(MAGIC_VALUE_2));
|
||||
|
@ -54,8 +54,8 @@ BEGIN_TEST(testArrayBuffer_bug720949_steal)
|
|||
// Steal the contents
|
||||
void *contents;
|
||||
CHECK(JS_StealArrayBufferContents(cx, obj, &contents, &data));
|
||||
CHECK(contents != NULL);
|
||||
CHECK(data != NULL);
|
||||
CHECK(contents != nullptr);
|
||||
CHECK(data != nullptr);
|
||||
|
||||
// Check that the original ArrayBuffer is neutered
|
||||
CHECK_EQUAL(JS_GetArrayBufferByteLength(obj), 0);
|
||||
|
@ -78,11 +78,11 @@ BEGIN_TEST(testArrayBuffer_bug720949_steal)
|
|||
data = JS_GetArrayBufferData(obj);
|
||||
|
||||
JS::RootedObject dstview(cx, JS_NewInt32ArrayWithBuffer(cx, dst, 0, -1));
|
||||
CHECK(dstview != NULL);
|
||||
CHECK(dstview != nullptr);
|
||||
|
||||
CHECK_EQUAL(JS_GetArrayBufferByteLength(dst), size);
|
||||
data = JS_GetArrayBufferData(dst);
|
||||
CHECK(data != NULL);
|
||||
CHECK(data != nullptr);
|
||||
CHECK_EQUAL(*reinterpret_cast<uint32_t*>(data), MAGIC_VALUE_2);
|
||||
CHECK(JS_GetElement(cx, dstview, 0, &v));
|
||||
CHECK_SAME(v, INT_TO_JSVAL(MAGIC_VALUE_2));
|
||||
|
@ -105,7 +105,7 @@ BEGIN_TEST(testArrayBuffer_bug720949_viewList)
|
|||
|
||||
// No views
|
||||
buffer = JS_NewArrayBuffer(cx, 2000);
|
||||
buffer = NULL;
|
||||
buffer = nullptr;
|
||||
GC(cx);
|
||||
|
||||
// One view.
|
||||
|
@ -115,15 +115,15 @@ BEGIN_TEST(testArrayBuffer_bug720949_viewList)
|
|||
void *contents;
|
||||
uint8_t *data;
|
||||
CHECK(JS_StealArrayBufferContents(cx, buffer, &contents, &data));
|
||||
CHECK(contents != NULL);
|
||||
CHECK(data != NULL);
|
||||
JS_free(NULL, contents);
|
||||
CHECK(contents != nullptr);
|
||||
CHECK(data != nullptr);
|
||||
JS_free(nullptr, contents);
|
||||
GC(cx);
|
||||
CHECK(isNeutered(view));
|
||||
CHECK(isNeutered(buffer));
|
||||
view = NULL;
|
||||
view = nullptr;
|
||||
GC(cx);
|
||||
buffer = NULL;
|
||||
buffer = nullptr;
|
||||
GC(cx);
|
||||
}
|
||||
|
||||
|
@ -135,7 +135,7 @@ BEGIN_TEST(testArrayBuffer_bug720949_viewList)
|
|||
JS::RootedObject view2(cx, JS_NewUint8ArrayWithBuffer(cx, buffer, 1, 200));
|
||||
|
||||
// Remove, re-add a view
|
||||
view2 = NULL;
|
||||
view2 = nullptr;
|
||||
GC(cx);
|
||||
view2 = JS_NewUint8ArrayWithBuffer(cx, buffer, 1, 200);
|
||||
|
||||
|
@ -143,19 +143,19 @@ BEGIN_TEST(testArrayBuffer_bug720949_viewList)
|
|||
void *contents;
|
||||
uint8_t *data;
|
||||
CHECK(JS_StealArrayBufferContents(cx, buffer, &contents, &data));
|
||||
CHECK(contents != NULL);
|
||||
CHECK(data != NULL);
|
||||
JS_free(NULL, contents);
|
||||
CHECK(contents != nullptr);
|
||||
CHECK(data != nullptr);
|
||||
JS_free(nullptr, contents);
|
||||
|
||||
CHECK(isNeutered(view1));
|
||||
CHECK(isNeutered(view2));
|
||||
CHECK(isNeutered(buffer));
|
||||
|
||||
view1 = NULL;
|
||||
view1 = nullptr;
|
||||
GC(cx);
|
||||
view2 = NULL;
|
||||
view2 = nullptr;
|
||||
GC(cx);
|
||||
buffer = NULL;
|
||||
buffer = nullptr;
|
||||
GC(cx);
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,8 @@ BEGIN_TEST(test_BindCallable)
|
|||
CHECK(newCallable);
|
||||
|
||||
JS::RootedValue retval(cx);
|
||||
bool called = JS_CallFunctionValue(cx, NULL, OBJECT_TO_JSVAL(newCallable), 0, NULL, retval.address());
|
||||
bool called = JS_CallFunctionValue(cx, nullptr, OBJECT_TO_JSVAL(newCallable), 0, nullptr,
|
||||
retval.address());
|
||||
CHECK(called);
|
||||
|
||||
CHECK(JSVAL_IS_INT(retval));
|
||||
|
|
|
@ -38,7 +38,7 @@ wrap(JSContext *cx, JS::HandleObject toWrap, JS::HandleObject target)
|
|||
JSAutoCompartment ac(cx, target);
|
||||
JS::RootedObject wrapper(cx, toWrap);
|
||||
if (!JS_WrapObject(cx, wrapper.address()))
|
||||
return NULL;
|
||||
return nullptr;
|
||||
return wrapper;
|
||||
}
|
||||
|
||||
|
@ -67,9 +67,9 @@ BEGIN_TEST(testBug604087)
|
|||
{
|
||||
JS::RootedObject outerObj(cx, js::Wrapper::New(cx, global, global->getProto(), global,
|
||||
&OuterWrapper::singleton));
|
||||
JS::RootedObject compartment2(cx, JS_NewGlobalObject(cx, getGlobalClass(), NULL, JS::FireOnNewGlobalHook));
|
||||
JS::RootedObject compartment3(cx, JS_NewGlobalObject(cx, getGlobalClass(), NULL, JS::FireOnNewGlobalHook));
|
||||
JS::RootedObject compartment4(cx, JS_NewGlobalObject(cx, getGlobalClass(), NULL, JS::FireOnNewGlobalHook));
|
||||
JS::RootedObject compartment2(cx, JS_NewGlobalObject(cx, getGlobalClass(), nullptr, JS::FireOnNewGlobalHook));
|
||||
JS::RootedObject compartment3(cx, JS_NewGlobalObject(cx, getGlobalClass(), nullptr, JS::FireOnNewGlobalHook));
|
||||
JS::RootedObject compartment4(cx, JS_NewGlobalObject(cx, getGlobalClass(), nullptr, JS::FireOnNewGlobalHook));
|
||||
|
||||
JS::RootedObject c2wrapper(cx, wrap(cx, outerObj, compartment2));
|
||||
CHECK(c2wrapper);
|
||||
|
@ -82,7 +82,7 @@ BEGIN_TEST(testBug604087)
|
|||
JS::RootedObject c4wrapper(cx, wrap(cx, outerObj, compartment4));
|
||||
CHECK(c4wrapper);
|
||||
c4wrapper->as<js::ProxyObject>().setExtra(0, js::Int32Value(4));
|
||||
compartment4 = c4wrapper = NULL;
|
||||
compartment4 = c4wrapper = nullptr;
|
||||
|
||||
JS::RootedObject next(cx);
|
||||
{
|
||||
|
|
|
@ -44,10 +44,10 @@ CustomMethod(JSContext *cx, unsigned argc, Value *vp)
|
|||
BEGIN_TEST(test_CallNonGenericMethodOnProxy)
|
||||
{
|
||||
// Create the first global object and compartment
|
||||
JS::RootedObject globalA(cx, JS_NewGlobalObject(cx, getGlobalClass(), NULL, JS::FireOnNewGlobalHook));
|
||||
JS::RootedObject globalA(cx, JS_NewGlobalObject(cx, getGlobalClass(), nullptr, JS::FireOnNewGlobalHook));
|
||||
CHECK(globalA);
|
||||
|
||||
JS::RootedObject customA(cx, JS_NewObject(cx, &CustomClass, NULL, NULL));
|
||||
JS::RootedObject customA(cx, JS_NewObject(cx, &CustomClass, nullptr, nullptr));
|
||||
CHECK(customA);
|
||||
JS_SetReservedSlot(customA, CUSTOM_SLOT, Int32Value(17));
|
||||
|
||||
|
@ -55,17 +55,17 @@ BEGIN_TEST(test_CallNonGenericMethodOnProxy)
|
|||
CHECK(customMethodA);
|
||||
|
||||
JS::RootedValue rval(cx);
|
||||
CHECK(JS_CallFunction(cx, customA, customMethodA, 0, NULL, rval.address()));
|
||||
CHECK(JS_CallFunction(cx, customA, customMethodA, 0, nullptr, rval.address()));
|
||||
CHECK_SAME(rval, Int32Value(17));
|
||||
|
||||
// Now create the second global object and compartment...
|
||||
{
|
||||
JS::RootedObject globalB(cx, JS_NewGlobalObject(cx, getGlobalClass(), NULL, JS::FireOnNewGlobalHook));
|
||||
JS::RootedObject globalB(cx, JS_NewGlobalObject(cx, getGlobalClass(), nullptr, JS::FireOnNewGlobalHook));
|
||||
CHECK(globalB);
|
||||
|
||||
// ...and enter it.
|
||||
JSAutoCompartment enter(cx, globalB);
|
||||
JS::RootedObject customB(cx, JS_NewObject(cx, &CustomClass, NULL, NULL));
|
||||
JS::RootedObject customB(cx, JS_NewObject(cx, &CustomClass, nullptr, nullptr));
|
||||
CHECK(customB);
|
||||
JS_SetReservedSlot(customB, CUSTOM_SLOT, Int32Value(42));
|
||||
|
||||
|
@ -73,14 +73,14 @@ BEGIN_TEST(test_CallNonGenericMethodOnProxy)
|
|||
CHECK(customMethodB);
|
||||
|
||||
JS::RootedValue rval(cx);
|
||||
CHECK(JS_CallFunction(cx, customB, customMethodB, 0, NULL, rval.address()));
|
||||
CHECK(JS_CallFunction(cx, customB, customMethodB, 0, nullptr, rval.address()));
|
||||
CHECK_SAME(rval, Int32Value(42));
|
||||
|
||||
JS::RootedObject wrappedCustomA(cx, customA);
|
||||
CHECK(JS_WrapObject(cx, wrappedCustomA.address()));
|
||||
|
||||
JS::RootedValue rval2(cx);
|
||||
CHECK(JS_CallFunction(cx, wrappedCustomA, customMethodB, 0, NULL, rval2.address()));
|
||||
CHECK(JS_CallFunction(cx, wrappedCustomA, customMethodB, 0, nullptr, rval2.address()));
|
||||
CHECK_SAME(rval, Int32Value(42));
|
||||
}
|
||||
|
||||
|
|
|
@ -22,8 +22,8 @@ const JSClass global_class = {
|
|||
JS_ConvertStub
|
||||
};
|
||||
|
||||
JSObject *trusted_glob = NULL;
|
||||
JSObject *trusted_fun = NULL;
|
||||
JSObject *trusted_glob = nullptr;
|
||||
JSObject *trusted_fun = nullptr;
|
||||
|
||||
bool
|
||||
CallTrusted(JSContext *cx, unsigned argc, jsval *vp)
|
||||
|
@ -34,8 +34,8 @@ CallTrusted(JSContext *cx, unsigned argc, jsval *vp)
|
|||
bool ok = false;
|
||||
{
|
||||
JSAutoCompartment ac(cx, trusted_glob);
|
||||
ok = JS_CallFunctionValue(cx, NULL, JS::ObjectValue(*trusted_fun),
|
||||
0, NULL, vp);
|
||||
ok = JS_CallFunctionValue(cx, nullptr, JS::ObjectValue(*trusted_fun),
|
||||
0, nullptr, vp);
|
||||
}
|
||||
JS_RestoreFrameChain(cx);
|
||||
return ok;
|
||||
|
@ -89,7 +89,7 @@ BEGIN_TEST(testChromeBuffer)
|
|||
bytes, strlen(bytes), "", 0));
|
||||
|
||||
JS::RootedValue rval(cx);
|
||||
CHECK(JS_CallFunction(cx, NULL, fun, 1, v.address(), rval.address()));
|
||||
CHECK(JS_CallFunction(cx, nullptr, fun, 1, v.address(), rval.address()));
|
||||
CHECK(JSVAL_TO_INT(rval) == 100);
|
||||
}
|
||||
|
||||
|
@ -126,7 +126,7 @@ BEGIN_TEST(testChromeBuffer)
|
|||
bytes, strlen(bytes), "", 0));
|
||||
|
||||
JS::RootedValue rval(cx);
|
||||
CHECK(JS_CallFunction(cx, NULL, fun, 1, v.address(), rval.address()));
|
||||
CHECK(JS_CallFunction(cx, nullptr, fun, 1, v.address(), rval.address()));
|
||||
bool match;
|
||||
CHECK(JS_StringEqualsAscii(cx, JSVAL_TO_STRING(rval), "From trusted: InternalError: too much recursion", &match));
|
||||
CHECK(match);
|
||||
|
@ -142,8 +142,8 @@ BEGIN_TEST(testChromeBuffer)
|
|||
const char *bytes = "return 42";
|
||||
JS::HandleObject global = JS::HandleObject::fromMarkedLocation(&trusted_glob);
|
||||
CHECK(fun = JS_CompileFunctionForPrincipals(cx, global, &system_principals,
|
||||
"trusted", 0, NULL, bytes, strlen(bytes),
|
||||
"", 0));
|
||||
"trusted", 0, nullptr,
|
||||
bytes, strlen(bytes), "", 0));
|
||||
trusted_fun = JS_GetFunctionObject(fun);
|
||||
}
|
||||
|
||||
|
@ -161,7 +161,7 @@ BEGIN_TEST(testChromeBuffer)
|
|||
|
||||
JS::RootedValue arg(cx, JS::ObjectValue(*callTrusted));
|
||||
JS::RootedValue rval(cx);
|
||||
CHECK(JS_CallFunction(cx, NULL, fun, 1, arg.address(), rval.address()));
|
||||
CHECK(JS_CallFunction(cx, nullptr, fun, 1, arg.address(), rval.address()));
|
||||
CHECK(JSVAL_TO_INT(rval) == 42);
|
||||
}
|
||||
|
||||
|
|
|
@ -56,14 +56,14 @@ static const JSFunctionSpec ptestFunctions[] = {
|
|||
|
||||
BEGIN_TEST(testClassGetter_isCalled)
|
||||
{
|
||||
CHECK(JS_InitClass(cx, global, NULL, &ptestClass, PTest, 0,
|
||||
NULL, ptestFunctions, NULL, NULL));
|
||||
CHECK(JS_InitClass(cx, global, nullptr, &ptestClass, PTest, 0,
|
||||
nullptr, ptestFunctions, nullptr, nullptr));
|
||||
|
||||
EXEC("function check() { var o = new PTest(); o.test_fn(); o.test_value1; o.test_value2; o.test_value1; }");
|
||||
|
||||
for (int i = 1; i < 9; i++) {
|
||||
JS::RootedValue rval(cx);
|
||||
CHECK(JS_CallFunctionName(cx, global, "check", 0, NULL, rval.address()));
|
||||
CHECK(JS_CallFunctionName(cx, global, "check", 0, nullptr, rval.address()));
|
||||
CHECK_SAME(INT_TO_JSVAL(called_test_fn), INT_TO_JSVAL(i));
|
||||
CHECK_SAME(INT_TO_JSVAL(called_test_prop_get), INT_TO_JSVAL(4 * i));
|
||||
}
|
||||
|
|
|
@ -33,7 +33,8 @@ BEGIN_TEST(test_cloneScript)
|
|||
{
|
||||
JSAutoCompartment a(cx, A);
|
||||
JSFunction *fun;
|
||||
CHECK(fun = JS_CompileFunction(cx, A, "f", 0, NULL, source, strlen(source), __FILE__, 1));
|
||||
CHECK(fun = JS_CompileFunction(cx, A, "f", 0, nullptr, source, strlen(source),
|
||||
__FILE__, 1));
|
||||
CHECK(obj = JS_GetFunctionObject(fun));
|
||||
}
|
||||
|
||||
|
|
|
@ -72,7 +72,7 @@ BEGIN_TEST(testDerivedValues)
|
|||
JS::Anchor<JSString *> str_anchor(str);
|
||||
static const jschar expected[] = { 'o', 'n', 'c', 'e' };
|
||||
const jschar *ch = JS_GetStringCharsZ(cx, str);
|
||||
str = NULL;
|
||||
str = nullptr;
|
||||
|
||||
/* Do a lot of allocation and collection. */
|
||||
for (int i = 0; i < 3; i++) {
|
||||
|
|
|
@ -19,11 +19,11 @@ IterNext(JSContext *cx, unsigned argc, jsval *vp)
|
|||
static JSObject *
|
||||
IterHook(JSContext *cx, JS::HandleObject obj, bool keysonly)
|
||||
{
|
||||
JS::RootedObject iterObj(cx, JS_NewObject(cx, NULL, NULL, NULL));
|
||||
JS::RootedObject iterObj(cx, JS_NewObject(cx, nullptr, nullptr, nullptr));
|
||||
if (!iterObj)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
if (!JS_DefineFunction(cx, iterObj, "next", IterNext, 0, 0))
|
||||
return NULL;
|
||||
return nullptr;
|
||||
return iterObj;
|
||||
}
|
||||
|
||||
|
@ -37,15 +37,15 @@ const js::Class HasCustomIterClass = {
|
|||
JS_EnumerateStub,
|
||||
JS_ResolveStub,
|
||||
JS_ConvertStub,
|
||||
NULL,
|
||||
NULL, /* checkAccess */
|
||||
NULL, /* call */
|
||||
NULL, /* hasInstance */
|
||||
NULL, /* construct */
|
||||
NULL, /* mark */
|
||||
nullptr,
|
||||
nullptr, /* checkAccess */
|
||||
nullptr, /* call */
|
||||
nullptr, /* hasInstance */
|
||||
nullptr, /* construct */
|
||||
nullptr, /* mark */
|
||||
{
|
||||
NULL, /* outerObject */
|
||||
NULL, /* innerObject */
|
||||
nullptr, /* outerObject */
|
||||
nullptr, /* innerObject */
|
||||
IterHook,
|
||||
false /* isWrappedNative */
|
||||
}
|
||||
|
@ -63,8 +63,8 @@ IterClassConstructor(JSContext *cx, unsigned argc, jsval *vp)
|
|||
|
||||
BEGIN_TEST(testCustomIterator_bug612523)
|
||||
{
|
||||
CHECK(JS_InitClass(cx, global, NULL, Jsvalify(&HasCustomIterClass),
|
||||
IterClassConstructor, 0, NULL, NULL, NULL, NULL));
|
||||
CHECK(JS_InitClass(cx, global, nullptr, Jsvalify(&HasCustomIterClass),
|
||||
IterClassConstructor, 0, nullptr, nullptr, nullptr, nullptr));
|
||||
|
||||
JS::RootedValue result(cx);
|
||||
EVAL("var o = new HasCustomIter(); \n"
|
||||
|
|
|
@ -27,7 +27,7 @@ callCountHook(JSContext *cx, JSAbstractFramePtr frame, bool isConstructing, bool
|
|||
BEGIN_TEST(testDebugger_bug519719)
|
||||
{
|
||||
CHECK(JS_SetDebugMode(cx, true));
|
||||
JS_SetCallHook(rt, callCountHook, NULL);
|
||||
JS_SetCallHook(rt, callCountHook, nullptr);
|
||||
EXEC("function call(fn) { fn(0); }\n"
|
||||
"function f(g) { for (var i = 0; i < 9; i++) call(g); }\n"
|
||||
"f(Math.sin);\n" // record loop, starting in f
|
||||
|
@ -48,7 +48,7 @@ nonStrictThisHook(JSContext *cx, JSAbstractFramePtr frame, bool isConstructing,
|
|||
frame.getThisValue(cx, &thisv);
|
||||
*allWrapped = *allWrapped && !JSVAL_IS_PRIMITIVE(thisv);
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
BEGIN_TEST(testDebugger_getThisNonStrict)
|
||||
|
@ -87,7 +87,7 @@ strictThisHook(JSContext *cx, JSAbstractFramePtr frame, bool isConstructing, boo
|
|||
frame.getThisValue(cx, &thisv);
|
||||
*anyWrapped = *anyWrapped || !JSVAL_IS_PRIMITIVE(thisv);
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
BEGIN_TEST(testDebugger_getThisStrict)
|
||||
|
@ -132,7 +132,7 @@ ThrowHook(JSContext *cx, JSScript *, jsbytecode *, jsval *rval, void *closure)
|
|||
BEGIN_TEST(testDebugger_throwHook)
|
||||
{
|
||||
CHECK(JS_SetDebugMode(cx, true));
|
||||
CHECK(JS_SetThrowHook(rt, ThrowHook, NULL));
|
||||
CHECK(JS_SetThrowHook(rt, ThrowHook, nullptr));
|
||||
EXEC("function foo() { throw 3 };\n"
|
||||
"for (var i = 0; i < 10; ++i) { \n"
|
||||
" var x = {}\n"
|
||||
|
@ -141,7 +141,7 @@ BEGIN_TEST(testDebugger_throwHook)
|
|||
" } catch(e) {}\n"
|
||||
"}\n");
|
||||
CHECK(called);
|
||||
CHECK(JS_SetThrowHook(rt, NULL, NULL));
|
||||
CHECK(JS_SetThrowHook(rt, nullptr, nullptr));
|
||||
return true;
|
||||
}
|
||||
END_TEST(testDebugger_throwHook)
|
||||
|
@ -149,7 +149,7 @@ END_TEST(testDebugger_throwHook)
|
|||
BEGIN_TEST(testDebugger_debuggerObjectVsDebugMode)
|
||||
{
|
||||
CHECK(JS_DefineDebuggerObject(cx, global));
|
||||
JS::RootedObject debuggee(cx, JS_NewGlobalObject(cx, getGlobalClass(), NULL, JS::FireOnNewGlobalHook));
|
||||
JS::RootedObject debuggee(cx, JS_NewGlobalObject(cx, getGlobalClass(), nullptr, JS::FireOnNewGlobalHook));
|
||||
CHECK(debuggee);
|
||||
|
||||
{
|
||||
|
@ -189,7 +189,7 @@ BEGIN_TEST(testDebugger_newScriptHook)
|
|||
{
|
||||
// Test that top-level indirect eval fires the newScript hook.
|
||||
CHECK(JS_DefineDebuggerObject(cx, global));
|
||||
JS::RootedObject g(cx, JS_NewGlobalObject(cx, getGlobalClass(), NULL, JS::FireOnNewGlobalHook));
|
||||
JS::RootedObject g(cx, JS_NewGlobalObject(cx, getGlobalClass(), nullptr, JS::FireOnNewGlobalHook));
|
||||
CHECK(g);
|
||||
{
|
||||
JSAutoCompartment ae(cx, g);
|
||||
|
@ -240,7 +240,7 @@ END_TEST(testDebugger_newScriptHook)
|
|||
BEGIN_TEST(testDebugger_singleStepThrow)
|
||||
{
|
||||
CHECK(JS_SetDebugModeForCompartment(cx, cx->compartment(), true));
|
||||
CHECK(JS_SetInterrupt(rt, onStep, NULL));
|
||||
CHECK(JS_SetInterrupt(rt, onStep, nullptr));
|
||||
|
||||
CHECK(JS_DefineFunction(cx, global, "setStepMode", setStepMode, 0, 0));
|
||||
EXEC("var e;\n"
|
||||
|
@ -255,7 +255,7 @@ BEGIN_TEST(testDebugger_singleStepThrow)
|
|||
setStepMode(JSContext *cx, unsigned argc, jsval *vp)
|
||||
{
|
||||
JS::RootedScript script(cx);
|
||||
JS_DescribeScriptedCaller(cx, &script, NULL);
|
||||
JS_DescribeScriptedCaller(cx, &script, nullptr);
|
||||
JS_ASSERT(script);
|
||||
|
||||
if (!JS_SetSingleStepMode(cx, script, true))
|
||||
|
|
|
@ -18,16 +18,16 @@ static const char PROPERTY_NAME[] = "foo";
|
|||
BEGIN_TEST(testDefineGetterSetterNonEnumerable)
|
||||
{
|
||||
JS::RootedValue vobj(cx);
|
||||
JS::RootedObject obj(cx, JS_NewObject(cx, NULL, NULL, NULL));
|
||||
JS::RootedObject obj(cx, JS_NewObject(cx, nullptr, nullptr, nullptr));
|
||||
CHECK(obj);
|
||||
vobj = OBJECT_TO_JSVAL(obj);
|
||||
|
||||
JSFunction *funGet = JS_NewFunction(cx, native, 0, 0, NULL, "get");
|
||||
JSFunction *funGet = JS_NewFunction(cx, native, 0, 0, nullptr, "get");
|
||||
CHECK(funGet);
|
||||
JS::RootedObject funGetObj(cx, JS_GetFunctionObject(funGet));
|
||||
JS::RootedValue vget(cx, OBJECT_TO_JSVAL(funGetObj));
|
||||
|
||||
JSFunction *funSet = JS_NewFunction(cx, native, 1, 0, NULL, "set");
|
||||
JSFunction *funSet = JS_NewFunction(cx, native, 1, 0, nullptr, "set");
|
||||
CHECK(funSet);
|
||||
JS::RootedObject funSetObj(cx, JS_GetFunctionObject(funSet));
|
||||
JS::RootedValue vset(cx, OBJECT_TO_JSVAL(funSetObj));
|
||||
|
|
|
@ -17,7 +17,7 @@ BEGIN_TEST(testDefineProperty_bug564344)
|
|||
|
||||
JS::RootedObject obj(cx, JSVAL_TO_OBJECT(x));
|
||||
for (int i = 0; i < 2; i++)
|
||||
CHECK(JS_DefineProperty(cx, obj, "q", JSVAL_VOID, NULL, NULL, JSPROP_SHARED));
|
||||
CHECK(JS_DefineProperty(cx, obj, "q", JSVAL_VOID, nullptr, nullptr, JSPROP_SHARED));
|
||||
return true;
|
||||
}
|
||||
END_TEST(testDefineProperty_bug564344)
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
using namespace js;
|
||||
|
||||
JSScript *found = NULL;
|
||||
JSScript *found = nullptr;
|
||||
|
||||
bool
|
||||
CheckEnclosing(JSContext *cx, unsigned argc, Value *vp)
|
||||
|
@ -32,24 +32,27 @@ BEGIN_TEST(test_enclosingFunction)
|
|||
CHECK(JS_DefineFunction(cx, global, "checkEnclosing", CheckEnclosing, 0, 0));
|
||||
|
||||
EXEC("checkEnclosing()");
|
||||
CHECK(found == NULL);
|
||||
CHECK(found == nullptr);
|
||||
|
||||
RootedFunction fun(cx);
|
||||
|
||||
const char s1chars[] = "checkEnclosing()";
|
||||
fun = JS_CompileFunction(cx, global, "s1", 0, NULL, s1chars, strlen(s1chars), __FILE__, __LINE__);
|
||||
fun = JS_CompileFunction(cx, global, "s1", 0, nullptr, s1chars, strlen(s1chars),
|
||||
__FILE__, __LINE__);
|
||||
CHECK(fun);
|
||||
EXEC("s1()");
|
||||
CHECK(found == JS_GetFunctionScript(cx, fun));
|
||||
|
||||
const char s2chars[] = "return function() { checkEnclosing() }";
|
||||
fun = JS_CompileFunction(cx, global, "s2", 0, NULL, s2chars, strlen(s2chars), __FILE__, __LINE__);
|
||||
fun = JS_CompileFunction(cx, global, "s2", 0, nullptr, s2chars, strlen(s2chars),
|
||||
__FILE__, __LINE__);
|
||||
CHECK(fun);
|
||||
EXEC("s2()()");
|
||||
CHECK(found == JS_GetFunctionScript(cx, fun));
|
||||
|
||||
const char s3chars[] = "return function() { let (x) { function g() { checkEnclosing() } return g() } }";
|
||||
fun = JS_CompileFunction(cx, global, "s3", 0, NULL, s3chars, strlen(s3chars), __FILE__, __LINE__);
|
||||
fun = JS_CompileFunction(cx, global, "s3", 0, nullptr, s3chars, strlen(s3chars),
|
||||
__FILE__, __LINE__);
|
||||
CHECK(fun);
|
||||
EXEC("s3()()");
|
||||
CHECK(found == JS_GetFunctionScript(cx, fun));
|
||||
|
|
|
@ -26,7 +26,7 @@ BEGIN_TEST(testErrorCopying_columnCopied)
|
|||
|
||||
JS::RootedValue rval(cx);
|
||||
JS_SetErrorReporter(cx, my_ErrorReporter);
|
||||
CHECK(!JS_CallFunctionName(cx, global, "check", 0, NULL, rval.address()));
|
||||
CHECK(!JS_CallFunctionName(cx, global, "check", 0, nullptr, rval.address()));
|
||||
CHECK(column == 27);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -135,7 +135,7 @@ void setup(unsigned count)
|
|||
vertex_count = count;
|
||||
for (unsigned i = 0; i < MaxVertices; ++i) {
|
||||
TestNode &v = Vertex[i];
|
||||
v.gcNextGraphNode = NULL;
|
||||
v.gcNextGraphNode = nullptr;
|
||||
v.index = i;
|
||||
memset(&v.hasEdge, 0, sizeof(v.hasEdge));
|
||||
}
|
||||
|
@ -161,14 +161,14 @@ bool group(int vertex, ...)
|
|||
va_list ap;
|
||||
va_start(ap, vertex);
|
||||
while (vertex != -1) {
|
||||
CHECK(v != NULL);
|
||||
CHECK(v != nullptr);
|
||||
CHECK(v->index == unsigned(vertex));
|
||||
v = v->nextNodeInGroup();
|
||||
vertex = va_arg(ap, int);
|
||||
}
|
||||
va_end(ap);
|
||||
|
||||
CHECK(v == NULL);
|
||||
CHECK(v == nullptr);
|
||||
resultsList = resultsList->nextGroup();
|
||||
return true;
|
||||
}
|
||||
|
@ -180,24 +180,24 @@ bool remaining(int vertex, ...)
|
|||
va_list ap;
|
||||
va_start(ap, vertex);
|
||||
while (vertex != -1) {
|
||||
CHECK(v != NULL);
|
||||
CHECK(v != nullptr);
|
||||
CHECK(v->index == unsigned(vertex));
|
||||
v = (TestNode *)v->gcNextGraphNode;
|
||||
vertex = va_arg(ap, int);
|
||||
}
|
||||
va_end(ap);
|
||||
|
||||
CHECK(v == NULL);
|
||||
resultsList = NULL;
|
||||
CHECK(v == nullptr);
|
||||
resultsList = nullptr;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool end()
|
||||
{
|
||||
CHECK(resultsList == NULL);
|
||||
CHECK(resultsList == nullptr);
|
||||
|
||||
delete finder;
|
||||
finder = NULL;
|
||||
finder = nullptr;
|
||||
return true;
|
||||
}
|
||||
END_TEST(testFindSCCs)
|
||||
|
@ -207,7 +207,7 @@ struct TestNode2 : public GraphNodeBase<TestNode2>
|
|||
TestNode2 *edge;
|
||||
|
||||
TestNode2() :
|
||||
edge(NULL)
|
||||
edge(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ funcTransition2(const JSFunction *, const JSScript*, const JSContext*, int)
|
|||
}
|
||||
|
||||
static int overlays = 0;
|
||||
static JSFunctionCallback innerCallback = NULL;
|
||||
static JSFunctionCallback innerCallback = nullptr;
|
||||
static void
|
||||
funcTransitionOverlay(const JSFunction *fun,
|
||||
const JSScript *script,
|
||||
|
@ -78,7 +78,7 @@ BEGIN_TEST(testFuncCallback_bug507012)
|
|||
CHECK_EQUAL(enters, 777);
|
||||
|
||||
// Check whether we can turn off function tracing
|
||||
JS_SetFunctionCallback(cx, NULL);
|
||||
JS_SetFunctionCallback(cx, nullptr);
|
||||
EXEC("f(1)");
|
||||
CHECK_EQUAL(enters, 777);
|
||||
interpreted = enters = leaves = depth = 0;
|
||||
|
|
|
@ -9,14 +9,14 @@
|
|||
|
||||
BEGIN_TEST(testGCExactRooting)
|
||||
{
|
||||
JS::RootedObject rootCx(cx, JS_NewObject(cx, NULL, NULL, NULL));
|
||||
JS::RootedObject rootRt(cx->runtime(), JS_NewObject(cx, NULL, NULL, NULL));
|
||||
JS::RootedObject rootCx(cx, JS_NewObject(cx, nullptr, nullptr, nullptr));
|
||||
JS::RootedObject rootRt(cx->runtime(), JS_NewObject(cx, nullptr, nullptr, nullptr));
|
||||
|
||||
JS_GC(cx->runtime());
|
||||
|
||||
/* Use the objects we just created to ensure that they are still alive. */
|
||||
JS_DefineProperty(cx, rootCx, "foo", JS::DoubleValue(0), NULL, NULL, 0);
|
||||
JS_DefineProperty(cx, rootRt, "foo", JS::DoubleValue(0), NULL, NULL, 0);
|
||||
JS_DefineProperty(cx, rootCx, "foo", JS::DoubleValue(0), nullptr, nullptr, 0);
|
||||
JS_DefineProperty(cx, rootRt, "foo", JS::DoubleValue(0), nullptr, nullptr, 0);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -126,7 +126,7 @@ BEGIN_TEST(testGCFinalizeCallback)
|
|||
CHECK(JS_IsGlobalObject(global2));
|
||||
CHECK(JS_IsGlobalObject(global3));
|
||||
|
||||
JS_SetFinalizeCallback(rt, NULL);
|
||||
JS_SetFinalizeCallback(rt, nullptr);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ BEGIN_TEST(testGCOutOfMemory)
|
|||
virtual JSRuntime * createRuntime() {
|
||||
JSRuntime *rt = JS_NewRuntime(768 * 1024, JS_USE_HELPER_THREADS);
|
||||
if (!rt)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
setNativeStackQuota(rt);
|
||||
return rt;
|
||||
}
|
||||
|
|
|
@ -97,7 +97,7 @@ BEGIN_TEST(testStringToPropertyName)
|
|||
JSFlatString *hiStr = NewString(cx, hiChars);
|
||||
CHECK(hiStr);
|
||||
CHECK(!hiStr->isIndex(&index));
|
||||
CHECK(hiStr->toPropertyName(cx) != NULL);
|
||||
CHECK(hiStr->toPropertyName(cx) != nullptr);
|
||||
|
||||
static const jschar maxChars[] = { '4', '2', '9', '4', '9', '6', '7', '2', '9', '5' };
|
||||
JSFlatString *maxStr = NewString(cx, maxChars);
|
||||
|
@ -109,7 +109,7 @@ BEGIN_TEST(testStringToPropertyName)
|
|||
JSFlatString *maxPlusOneStr = NewString(cx, maxPlusOneChars);
|
||||
CHECK(maxPlusOneStr);
|
||||
CHECK(!maxPlusOneStr->isIndex(&index));
|
||||
CHECK(maxPlusOneStr->toPropertyName(cx) != NULL);
|
||||
CHECK(maxPlusOneStr->toPropertyName(cx) != nullptr);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
BEGIN_TEST(testJSEvaluateScript)
|
||||
{
|
||||
JS::RootedObject obj(cx, JS_NewObject(cx, NULL, NULL, global));
|
||||
JS::RootedObject obj(cx, JS_NewObject(cx, nullptr, nullptr, global));
|
||||
CHECK(obj);
|
||||
|
||||
uint32_t options = JS_GetOptions(cx);
|
||||
|
|
|
@ -63,16 +63,17 @@ document_resolve(JSContext *cx, JS::HandleObject obj, JS::HandleId id, unsigned
|
|||
if (!flatStr)
|
||||
return false;
|
||||
if (JS_FlatStringEqualsAscii(flatStr, "all")) {
|
||||
JS::Rooted<JSObject*> docAll(cx, JS_NewObject(cx, &DocumentAllClass, NULL, NULL));
|
||||
JS::Rooted<JSObject*> docAll(cx,
|
||||
JS_NewObject(cx, &DocumentAllClass, nullptr, nullptr));
|
||||
if (!docAll)
|
||||
return false;
|
||||
JS::Rooted<JS::Value> allValue(cx, ObjectValue(*docAll));
|
||||
bool ok = JS_DefinePropertyById(cx, obj, id, allValue, NULL, NULL, 0);
|
||||
objp.set(ok ? obj.get() : NULL);
|
||||
bool ok = JS_DefinePropertyById(cx, obj, id, allValue, nullptr, nullptr, 0);
|
||||
objp.set(ok ? obj.get() : nullptr);
|
||||
return ok;
|
||||
}
|
||||
}
|
||||
objp.set(NULL);
|
||||
objp.set(nullptr);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -84,9 +85,9 @@ static const JSClass document_class = {
|
|||
|
||||
BEGIN_TEST(testLookup_bug570195)
|
||||
{
|
||||
JS::RootedObject obj(cx, JS_NewObject(cx, &document_class, NULL, NULL));
|
||||
JS::RootedObject obj(cx, JS_NewObject(cx, &document_class, nullptr, nullptr));
|
||||
CHECK(obj);
|
||||
CHECK(JS_DefineProperty(cx, global, "document", OBJECT_TO_JSVAL(obj), NULL, NULL, 0));
|
||||
CHECK(JS_DefineProperty(cx, global, "document", OBJECT_TO_JSVAL(obj), nullptr, nullptr, 0));
|
||||
JS::RootedValue v(cx);
|
||||
EVAL("document.all ? true : false", v.address());
|
||||
CHECK_SAME(v, JSVAL_FALSE);
|
||||
|
|
|
@ -17,7 +17,7 @@ constructHook(JSContext *cx, unsigned argc, jsval *vp)
|
|||
|
||||
// Check that arguments were passed properly from JS_New.
|
||||
|
||||
JS::RootedObject obj(cx, JS_NewObject(cx, js::Jsvalify(&JSObject::class_), NULL, NULL));
|
||||
JS::RootedObject obj(cx, JS_NewObject(cx, js::Jsvalify(&JSObject::class_), nullptr, nullptr));
|
||||
if (!obj) {
|
||||
JS_ReportError(cx, "test failed, could not construct object");
|
||||
return false;
|
||||
|
@ -66,7 +66,7 @@ BEGIN_TEST(testNewObject_1)
|
|||
JS::RootedObject Array(cx, JSVAL_TO_OBJECT(v));
|
||||
|
||||
// With no arguments.
|
||||
JS::RootedObject obj(cx, JS_New(cx, Array, 0, NULL));
|
||||
JS::RootedObject obj(cx, JS_New(cx, Array, 0, nullptr));
|
||||
CHECK(obj);
|
||||
JS::RootedValue rt(cx, OBJECT_TO_JSVAL(obj));
|
||||
CHECK(JS_IsArrayObject(cx, obj));
|
||||
|
@ -100,10 +100,10 @@ BEGIN_TEST(testNewObject_1)
|
|||
"testNewObject_1",
|
||||
0,
|
||||
JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
|
||||
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, NULL,
|
||||
NULL, NULL, NULL, constructHook
|
||||
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, nullptr,
|
||||
nullptr, nullptr, nullptr, constructHook
|
||||
};
|
||||
JS::RootedObject ctor(cx, JS_NewObject(cx, &cls, NULL, NULL));
|
||||
JS::RootedObject ctor(cx, JS_NewObject(cx, &cls, nullptr, nullptr));
|
||||
CHECK(ctor);
|
||||
JS::RootedValue rt2(cx, OBJECT_TO_JSVAL(ctor));
|
||||
obj = JS_New(cx, ctor, 3, argv);
|
||||
|
|
|
@ -18,7 +18,7 @@ virtual JSRuntime * createRuntime()
|
|||
{
|
||||
JSRuntime *rt = JS_NewRuntime(0, JS_USE_HELPER_THREADS);
|
||||
if (!rt)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
JS_SetGCParameter(rt, JSGC_MAX_BYTES, (uint32_t)-1);
|
||||
setNativeStackQuota(rt);
|
||||
return rt;
|
||||
|
|
|
@ -28,8 +28,9 @@ ObjectEmulatingUndefinedConstructor(JSContext *cx, unsigned argc, jsval *vp)
|
|||
|
||||
BEGIN_TEST(testObjectEmulatingUndefined_truthy)
|
||||
{
|
||||
CHECK(JS_InitClass(cx, global, NULL, &ObjectEmulatingUndefinedClass,
|
||||
ObjectEmulatingUndefinedConstructor, 0, NULL, NULL, NULL, NULL));
|
||||
CHECK(JS_InitClass(cx, global, nullptr, &ObjectEmulatingUndefinedClass,
|
||||
ObjectEmulatingUndefinedConstructor, 0,
|
||||
nullptr, nullptr, nullptr, nullptr));
|
||||
|
||||
JS::RootedValue result(cx);
|
||||
|
||||
|
@ -53,8 +54,9 @@ END_TEST(testObjectEmulatingUndefined_truthy)
|
|||
|
||||
BEGIN_TEST(testObjectEmulatingUndefined_equal)
|
||||
{
|
||||
CHECK(JS_InitClass(cx, global, NULL, &ObjectEmulatingUndefinedClass,
|
||||
ObjectEmulatingUndefinedConstructor, 0, NULL, NULL, NULL, NULL));
|
||||
CHECK(JS_InitClass(cx, global, nullptr, &ObjectEmulatingUndefinedClass,
|
||||
ObjectEmulatingUndefinedConstructor, 0,
|
||||
nullptr, nullptr, nullptr, nullptr));
|
||||
|
||||
JS::RootedValue result(cx);
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ createMyObject(JSContext* context, unsigned argc, jsval *vp)
|
|||
|
||||
//JS_GC(context); //<- if we make GC here, all is ok
|
||||
|
||||
JSObject* myObject = JS_NewObject(context, &myClass, NULL, NULL);
|
||||
JSObject* myObject = JS_NewObject(context, &myClass, nullptr, nullptr);
|
||||
*vp = OBJECT_TO_JSVAL(myObject);
|
||||
|
||||
JS_EndRequest(context);
|
||||
|
@ -55,7 +55,7 @@ BEGIN_TEST(testOps_bug559006)
|
|||
|
||||
for (int i = 0; i < 9; i++) {
|
||||
JS::RootedValue rval(cx);
|
||||
CHECK(JS_CallFunctionName(cx, global, "main", 0, NULL, rval.address()));
|
||||
CHECK(JS_CallFunctionName(cx, global, "main", 0, nullptr, rval.address()));
|
||||
CHECK_SAME(rval, INT_TO_JSVAL(123));
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
#include "js/OldDebugAPI.h"
|
||||
#include "jsapi-tests/tests.h"
|
||||
|
||||
JSPrincipals *sOriginPrincipalsInErrorReporter = NULL;
|
||||
JSPrincipals *sOriginPrincipalsInErrorReporter = nullptr;
|
||||
|
||||
static void
|
||||
ErrorReporter(JSContext *cx, const char *message, JSErrorReport *report)
|
||||
|
|
|
@ -19,7 +19,7 @@ class AutoInflatedString {
|
|||
size_t length_;
|
||||
|
||||
public:
|
||||
AutoInflatedString(JSContext *cx) : cx(cx), chars_(NULL), length_(0) { }
|
||||
AutoInflatedString(JSContext *cx) : cx(cx), chars_(nullptr), length_(0) { }
|
||||
~AutoInflatedString() {
|
||||
JS_free(cx, chars_);
|
||||
}
|
||||
|
@ -190,7 +190,7 @@ Error(JSContext *cx, const char (&input)[N])
|
|||
JSErrorReporter old = JS_SetErrorReporter(cx, reportJSONEror);
|
||||
bool ok = JS_ParseJSON(cx, str.chars(), str.length(), &dummy);
|
||||
JS_SetErrorReporter(cx, old);
|
||||
JS_SetContextPrivate(cx, NULL);
|
||||
JS_SetContextPrivate(cx, nullptr);
|
||||
|
||||
CHECK(!ok);
|
||||
CHECK(!p.unexpectedErrorCount);
|
||||
|
|
|
@ -42,7 +42,7 @@ test_fn2(JSContext *cx, unsigned argc, jsval *vp)
|
|||
{
|
||||
jsval r;
|
||||
JS::RootedObject global(cx, JS::CurrentGlobalOrNull(cx));
|
||||
return JS_CallFunctionName(cx, global, "d", 0, NULL, &r);
|
||||
return JS_CallFunctionName(cx, global, "d", 0, nullptr, &r);
|
||||
}
|
||||
|
||||
static bool
|
||||
|
@ -82,8 +82,8 @@ initialize(JSContext *cx)
|
|||
{
|
||||
js::SetRuntimeProfilingStack(cx->runtime(), pstack, &psize, 10);
|
||||
JS::RootedObject global(cx, JS::CurrentGlobalOrNull(cx));
|
||||
return JS_InitClass(cx, global, NULL, &ptestClass, Prof, 0,
|
||||
NULL, ptestFunctions, NULL, NULL);
|
||||
return JS_InitClass(cx, global, nullptr, &ptestClass, Prof, 0,
|
||||
nullptr, ptestFunctions, nullptr, nullptr);
|
||||
}
|
||||
|
||||
BEGIN_TEST(testProfileStrings_isCalledWithInterpreter)
|
||||
|
@ -104,13 +104,13 @@ BEGIN_TEST(testProfileStrings_isCalledWithInterpreter)
|
|||
{
|
||||
JS::RootedValue rval(cx);
|
||||
/* Make sure the stack resets and we have an entry for each stack */
|
||||
CHECK(JS_CallFunctionName(cx, global, "check", 0, NULL, rval.address()));
|
||||
CHECK(JS_CallFunctionName(cx, global, "check", 0, nullptr, rval.address()));
|
||||
CHECK(psize == 0);
|
||||
CHECK(max_stack >= 8);
|
||||
CHECK(cx->runtime()->spsProfiler.stringsCount() == 8);
|
||||
/* Make sure the stack resets and we added no new entries */
|
||||
max_stack = 0;
|
||||
CHECK(JS_CallFunctionName(cx, global, "check", 0, NULL, rval.address()));
|
||||
CHECK(JS_CallFunctionName(cx, global, "check", 0, nullptr, rval.address()));
|
||||
CHECK(psize == 0);
|
||||
CHECK(max_stack >= 8);
|
||||
CHECK(cx->runtime()->spsProfiler.stringsCount() == 8);
|
||||
|
@ -118,7 +118,7 @@ BEGIN_TEST(testProfileStrings_isCalledWithInterpreter)
|
|||
reset(cx);
|
||||
{
|
||||
JS::RootedValue rval(cx);
|
||||
CHECK(JS_CallFunctionName(cx, global, "check2", 0, NULL, rval.address()));
|
||||
CHECK(JS_CallFunctionName(cx, global, "check2", 0, nullptr, rval.address()));
|
||||
CHECK(cx->runtime()->spsProfiler.stringsCount() == 5);
|
||||
CHECK(max_stack >= 6);
|
||||
CHECK(psize == 0);
|
||||
|
@ -129,7 +129,7 @@ BEGIN_TEST(testProfileStrings_isCalledWithInterpreter)
|
|||
{
|
||||
JS::RootedValue rval(cx);
|
||||
pstack[3].setLabel((char*) 1234);
|
||||
CHECK(JS_CallFunctionName(cx, global, "check", 0, NULL, rval.address()));
|
||||
CHECK(JS_CallFunctionName(cx, global, "check", 0, nullptr, rval.address()));
|
||||
CHECK((size_t) pstack[3].label() == 1234);
|
||||
CHECK(max_stack >= 8);
|
||||
CHECK(psize == 0);
|
||||
|
@ -157,14 +157,14 @@ BEGIN_TEST(testProfileStrings_isCalledWithJIT)
|
|||
{
|
||||
JS::RootedValue rval(cx);
|
||||
/* Make sure the stack resets and we have an entry for each stack */
|
||||
CHECK(JS_CallFunctionName(cx, global, "check", 0, NULL, rval.address()));
|
||||
CHECK(JS_CallFunctionName(cx, global, "check", 0, nullptr, rval.address()));
|
||||
CHECK(psize == 0);
|
||||
CHECK(max_stack >= 8);
|
||||
|
||||
/* Make sure the stack resets and we added no new entries */
|
||||
uint32_t cnt = cx->runtime()->spsProfiler.stringsCount();
|
||||
max_stack = 0;
|
||||
CHECK(JS_CallFunctionName(cx, global, "check", 0, NULL, rval.address()));
|
||||
CHECK(JS_CallFunctionName(cx, global, "check", 0, nullptr, rval.address()));
|
||||
CHECK(psize == 0);
|
||||
CHECK(cx->runtime()->spsProfiler.stringsCount() == cnt);
|
||||
CHECK(max_stack >= 8);
|
||||
|
@ -177,7 +177,7 @@ BEGIN_TEST(testProfileStrings_isCalledWithJIT)
|
|||
/* Limit the size of the stack and make sure we don't overflow */
|
||||
JS::RootedValue rval(cx);
|
||||
pstack[3].setLabel((char*) 1234);
|
||||
CHECK(JS_CallFunctionName(cx, global, "check", 0, NULL, rval.address()));
|
||||
CHECK(JS_CallFunctionName(cx, global, "check", 0, nullptr, rval.address()));
|
||||
CHECK(psize == 0);
|
||||
CHECK(max_stack >= 8);
|
||||
CHECK((size_t) pstack[3].label() == 1234);
|
||||
|
@ -198,7 +198,7 @@ BEGIN_TEST(testProfileStrings_isCalledWhenError)
|
|||
{
|
||||
JS::RootedValue rval(cx);
|
||||
/* Make sure the stack resets and we have an entry for each stack */
|
||||
bool ok = JS_CallFunctionName(cx, global, "check2", 0, NULL, rval.address());
|
||||
bool ok = JS_CallFunctionName(cx, global, "check2", 0, nullptr, rval.address());
|
||||
CHECK(!ok);
|
||||
CHECK(psize == 0);
|
||||
CHECK(cx->runtime()->spsProfiler.stringsCount() == 1);
|
||||
|
@ -221,7 +221,7 @@ BEGIN_TEST(testProfileStrings_worksWhenEnabledOnTheFly)
|
|||
{
|
||||
/* enable it in the middle of JS and make sure things check out */
|
||||
JS::RootedValue rval(cx);
|
||||
JS_CallFunctionName(cx, global, "a", 0, NULL, rval.address());
|
||||
JS_CallFunctionName(cx, global, "a", 0, nullptr, rval.address());
|
||||
CHECK(psize == 0);
|
||||
CHECK(max_stack >= 1);
|
||||
CHECK(cx->runtime()->spsProfiler.stringsCount() == 1);
|
||||
|
@ -233,7 +233,7 @@ BEGIN_TEST(testProfileStrings_worksWhenEnabledOnTheFly)
|
|||
{
|
||||
/* now disable in the middle of js */
|
||||
JS::RootedValue rval(cx);
|
||||
JS_CallFunctionName(cx, global, "c", 0, NULL, rval.address());
|
||||
JS_CallFunctionName(cx, global, "c", 0, nullptr, rval.address());
|
||||
CHECK(psize == 0);
|
||||
}
|
||||
|
||||
|
@ -242,7 +242,7 @@ BEGIN_TEST(testProfileStrings_worksWhenEnabledOnTheFly)
|
|||
{
|
||||
/* now disable in the middle of js, but re-enable before final exit */
|
||||
JS::RootedValue rval(cx);
|
||||
JS_CallFunctionName(cx, global, "e", 0, NULL, rval.address());
|
||||
JS_CallFunctionName(cx, global, "e", 0, nullptr, rval.address());
|
||||
CHECK(psize == 0);
|
||||
CHECK(max_stack >= 3);
|
||||
}
|
||||
|
@ -256,7 +256,7 @@ BEGIN_TEST(testProfileStrings_worksWhenEnabledOnTheFly)
|
|||
JS::RootedValue rval(cx);
|
||||
/* disable, and make sure that if we try to re-enter the JIT the pop
|
||||
* will still happen */
|
||||
JS_CallFunctionName(cx, global, "f", 0, NULL, rval.address());
|
||||
JS_CallFunctionName(cx, global, "f", 0, nullptr, rval.address());
|
||||
CHECK(psize == 0);
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -27,7 +27,7 @@ BEGIN_TEST(testPropCache_bug505798)
|
|||
{
|
||||
g_counter = 0;
|
||||
EXEC("var x = {};");
|
||||
CHECK(JS_DefineObject(cx, global, "y", &CounterClass, NULL, JSPROP_ENUMERATE));
|
||||
CHECK(JS_DefineObject(cx, global, "y", &CounterClass, nullptr, JSPROP_ENUMERATE));
|
||||
EXEC("var arr = [x, y];\n"
|
||||
"for (var i = 0; i < arr.length; i++)\n"
|
||||
" arr[i].p = 1;\n");
|
||||
|
|
|
@ -23,7 +23,7 @@ BEGIN_TEST(testRegExpInstanceProperties)
|
|||
|
||||
JS_GC(cx);
|
||||
|
||||
CHECK_EQUAL(regexpProto->compartment()->initialRegExpShape, NULL);
|
||||
CHECK_EQUAL(regexpProto->compartment()->initialRegExpShape, nullptr);
|
||||
|
||||
jsval regexp;
|
||||
EVAL("/foopy/", ®exp);
|
||||
|
|
|
@ -27,19 +27,19 @@ BEGIN_TEST(testResolveRecursion)
|
|||
JS_ConvertStub
|
||||
};
|
||||
|
||||
obj1 = obj2 = NULL;
|
||||
obj1 = obj2 = nullptr;
|
||||
JS_AddObjectRoot(cx, &obj1);
|
||||
JS_AddObjectRoot(cx, &obj2);
|
||||
|
||||
obj1 = JS_NewObject(cx, &my_resolve_class, NULL, NULL);
|
||||
obj1 = JS_NewObject(cx, &my_resolve_class, nullptr, nullptr);
|
||||
CHECK(obj1);
|
||||
obj2 = JS_NewObject(cx, &my_resolve_class, NULL, NULL);
|
||||
obj2 = JS_NewObject(cx, &my_resolve_class, nullptr, nullptr);
|
||||
CHECK(obj2);
|
||||
JS_SetPrivate(obj1, this);
|
||||
JS_SetPrivate(obj2, this);
|
||||
|
||||
CHECK(JS_DefineProperty(cx, global, "obj1", OBJECT_TO_JSVAL(obj1), NULL, NULL, 0));
|
||||
CHECK(JS_DefineProperty(cx, global, "obj2", OBJECT_TO_JSVAL(obj2), NULL, NULL, 0));
|
||||
CHECK(JS_DefineProperty(cx, global, "obj1", OBJECT_TO_JSVAL(obj1), nullptr, nullptr, 0));
|
||||
CHECK(JS_DefineProperty(cx, global, "obj2", OBJECT_TO_JSVAL(obj2), nullptr, nullptr, 0));
|
||||
|
||||
resolveEntryCount = 0;
|
||||
resolveExitCount = 0;
|
||||
|
@ -92,19 +92,19 @@ doResolve(JS::HandleObject obj, JS::HandleId id, unsigned flags, JS::MutableHand
|
|||
CHECK_EQUAL(resolveEntryCount, 1);
|
||||
EVAL("obj2.y = true", v.address());
|
||||
CHECK_SAME(v, JSVAL_TRUE);
|
||||
CHECK(JS_DefinePropertyById(cx, obj, id, JSVAL_FALSE, NULL, NULL, 0));
|
||||
CHECK(JS_DefinePropertyById(cx, obj, id, JSVAL_FALSE, nullptr, nullptr, 0));
|
||||
objp.set(obj);
|
||||
return true;
|
||||
}
|
||||
if (obj == obj2) {
|
||||
CHECK_EQUAL(resolveEntryCount, 4);
|
||||
objp.set(NULL);
|
||||
objp.set(nullptr);
|
||||
return true;
|
||||
}
|
||||
} else if (JS_FlatStringEqualsAscii(str, "y")) {
|
||||
if (obj == obj2) {
|
||||
CHECK_EQUAL(resolveEntryCount, 2);
|
||||
CHECK(JS_DefinePropertyById(cx, obj, id, JSVAL_NULL, NULL, NULL, 0));
|
||||
CHECK(JS_DefinePropertyById(cx, obj, id, JSVAL_NULL, nullptr, nullptr, 0));
|
||||
EVAL("obj1.x", v.address());
|
||||
CHECK(JSVAL_IS_VOID(v));
|
||||
EVAL("obj1.y", v.address());
|
||||
|
|
|
@ -54,7 +54,7 @@ END_FIXTURE_TEST(ScriptObjectFixture, bug438633_CompileScript_empty)
|
|||
|
||||
BEGIN_FIXTURE_TEST(ScriptObjectFixture, bug438633_CompileScriptForPrincipals)
|
||||
{
|
||||
return tryScript(global, JS_CompileScriptForPrincipals(cx, global, NULL,
|
||||
return tryScript(global, JS_CompileScriptForPrincipals(cx, global, nullptr,
|
||||
code, code_size,
|
||||
__FILE__, __LINE__));
|
||||
}
|
||||
|
@ -78,7 +78,7 @@ END_FIXTURE_TEST(ScriptObjectFixture, bug438633_JS_CompileUCScript_empty)
|
|||
|
||||
BEGIN_FIXTURE_TEST(ScriptObjectFixture, bug438633_JS_CompileUCScriptForPrincipals)
|
||||
{
|
||||
return tryScript(global, JS_CompileUCScriptForPrincipals(cx, global, NULL,
|
||||
return tryScript(global, JS_CompileUCScriptForPrincipals(cx, global, nullptr,
|
||||
uc_code, code_size,
|
||||
__FILE__, __LINE__));
|
||||
}
|
||||
|
@ -145,7 +145,7 @@ BEGIN_FIXTURE_TEST(ScriptObjectFixture, bug438633_JS_CompileFileHandleForPrincip
|
|||
CHECK(fseek(script_stream, 0, SEEK_SET) != EOF);
|
||||
JS::CompileOptions options(cx);
|
||||
options.setFileAndLine("temporary file", 1)
|
||||
.setPrincipals(NULL);
|
||||
.setPrincipals(nullptr);
|
||||
return tryScript(global, JS::Compile(cx, global, options, script_stream));
|
||||
}
|
||||
END_FIXTURE_TEST(ScriptObjectFixture, bug438633_JS_CompileFileHandleForPrincipals)
|
||||
|
|
|
@ -16,7 +16,7 @@ nativeGet(JSContext *cx, JS::HandleObject obj, JS::HandleId id, JS::MutableHandl
|
|||
|
||||
BEGIN_TEST(testSetProperty_NativeGetterStubSetter)
|
||||
{
|
||||
JS::RootedObject obj(cx, JS_NewObject(cx, NULL, NULL, NULL));
|
||||
JS::RootedObject obj(cx, JS_NewObject(cx, nullptr, nullptr, nullptr));
|
||||
CHECK(obj);
|
||||
JS::RootedValue vobj(cx, OBJECT_TO_JSVAL(obj));
|
||||
|
||||
|
@ -73,7 +73,7 @@ BEGIN_TEST(testSetProperty_InheritedGlobalSetter)
|
|||
// shell can't.
|
||||
JS_ASSERT(JS_GetClass(global)->resolve == &JS_ResolveStub);
|
||||
|
||||
CHECK(JS_DefineProperty(cx, global, "HOTLOOP", INT_TO_JSVAL(8), NULL, NULL, 0));
|
||||
CHECK(JS_DefineProperty(cx, global, "HOTLOOP", INT_TO_JSVAL(8), nullptr, nullptr, 0));
|
||||
EXEC("var n = 0;\n"
|
||||
"var global = this;\n"
|
||||
"function f() { n++; }\n"
|
||||
|
|
|
@ -16,8 +16,8 @@ BEGIN_TEST(testBug795104)
|
|||
s[0] = '"';
|
||||
memset(s + 1, 'x', strLen - 2);
|
||||
s[strLen - 1] = '"';
|
||||
CHECK(JS::Evaluate(cx, global, opts, s, strLen, NULL));
|
||||
CHECK(JS::CompileFunction(cx, global, opts, "f", 0, NULL, s, strLen));
|
||||
CHECK(JS::Evaluate(cx, global, opts, s, strLen, nullptr));
|
||||
CHECK(JS::CompileFunction(cx, global, opts, "f", 0, nullptr, s, strLen));
|
||||
JS_free(cx, s);
|
||||
|
||||
return true;
|
||||
|
@ -39,9 +39,9 @@ BEGIN_TEST(testScriptSourceReentrant)
|
|||
JS::CompileOptions opts(cx);
|
||||
bool match = false;
|
||||
JS_SetNewScriptHook(rt, newScriptHook, &match);
|
||||
CHECK(JS::Evaluate(cx, global, opts, simpleSource, strlen(simpleSource), NULL));
|
||||
CHECK(JS::Evaluate(cx, global, opts, simpleSource, strlen(simpleSource), nullptr));
|
||||
CHECK(match);
|
||||
JS_SetNewScriptHook(rt, NULL, NULL);
|
||||
JS_SetNewScriptHook(rt, nullptr, nullptr);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ BEGIN_TEST(testStructuredClone_object)
|
|||
JSAutoCompartment ac(cx, g1);
|
||||
JS::RootedValue prop(cx, JS::Int32Value(1337));
|
||||
|
||||
v1 = JS::ObjectOrNullValue(JS_NewObject(cx, NULL, NULL, NULL));
|
||||
v1 = JS::ObjectOrNullValue(JS_NewObject(cx, nullptr, nullptr, nullptr));
|
||||
CHECK(v1.isObject());
|
||||
CHECK(JS_SetProperty(cx, &v1.toObject(), "prop", prop));
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ BEGIN_TEST(testStructuredClone_object)
|
|||
JSAutoCompartment ac(cx, g2);
|
||||
JS::RootedValue v2(cx);
|
||||
|
||||
CHECK(JS_StructuredClone(cx, v1, v2.address(), NULL, NULL));
|
||||
CHECK(JS_StructuredClone(cx, v1, v2.address(), nullptr, nullptr));
|
||||
CHECK(v2.isObject());
|
||||
|
||||
JS::RootedValue prop(cx);
|
||||
|
@ -64,7 +64,7 @@ BEGIN_TEST(testStructuredClone_string)
|
|||
JSAutoCompartment ac(cx, g2);
|
||||
JS::RootedValue v2(cx);
|
||||
|
||||
CHECK(JS_StructuredClone(cx, v1, v2.address(), NULL, NULL));
|
||||
CHECK(JS_StructuredClone(cx, v1, v2.address(), nullptr, nullptr));
|
||||
CHECK(v2.isString());
|
||||
CHECK(v2.toString());
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ BEGIN_TEST(testValueABI_retparam)
|
|||
{
|
||||
JS::RootedObject obj(cx, JS::CurrentGlobalOrNull(cx));
|
||||
jsval v = OBJECT_TO_JSVAL(obj);
|
||||
obj = NULL;
|
||||
obj = nullptr;
|
||||
CHECK(C_ValueToObject(cx, v, obj.address()));
|
||||
bool equal;
|
||||
CHECK(JS_StrictlyEqual(cx, v, OBJECT_TO_JSVAL(obj), &equal));
|
||||
|
|
|
@ -20,11 +20,11 @@ CompileScriptForPrincipalsVersionOrigin(JSContext *cx, JS::HandleObject obj,
|
|||
JSVersion version)
|
||||
{
|
||||
size_t nchars;
|
||||
if (!JS_DecodeBytes(cx, bytes, nbytes, NULL, &nchars))
|
||||
return NULL;
|
||||
if (!JS_DecodeBytes(cx, bytes, nbytes, nullptr, &nchars))
|
||||
return nullptr;
|
||||
jschar *chars = static_cast<jschar *>(JS_malloc(cx, nchars * sizeof(jschar)));
|
||||
if (!chars)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
JS_ALWAYS_TRUE(JS_DecodeBytes(cx, bytes, nbytes, chars, &nchars));
|
||||
JS::CompileOptions options(cx);
|
||||
options.setPrincipals(principals)
|
||||
|
@ -43,7 +43,7 @@ FreezeThaw(JSContext *cx, JS::HandleScript script)
|
|||
uint32_t nbytes;
|
||||
void *memory = JS_EncodeScript(cx, script, &nbytes);
|
||||
if (!memory)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
// thaw
|
||||
JSScript *script2 = JS_DecodeScript(cx, memory, nbytes,
|
||||
|
@ -65,7 +65,7 @@ FreezeThaw(JSContext *cx, JS::HandleObject funobj)
|
|||
uint32_t nbytes;
|
||||
void *memory = JS_EncodeInterpretedFunction(cx, funobj, &nbytes);
|
||||
if (!memory)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
// thaw
|
||||
JSScript *script = GetScript(cx, funobj);
|
||||
|
@ -89,7 +89,7 @@ BEGIN_TEST(testXDR_principals)
|
|||
// Appease the new JSAPI assertions. The stuff being tested here is
|
||||
// going away anyway.
|
||||
JS_SetCompartmentPrincipals(compartment, &testPrincipals[0]);
|
||||
script = createScriptViaXDR(&testPrincipals[0], NULL, i);
|
||||
script = createScriptViaXDR(&testPrincipals[0], nullptr, i);
|
||||
CHECK(script);
|
||||
CHECK(JS_GetScriptPrincipals(script) == &testPrincipals[0]);
|
||||
CHECK(JS_GetScriptOriginPrincipals(script) == &testPrincipals[0]);
|
||||
|
@ -127,12 +127,12 @@ JSScript *createScriptViaXDR(JSPrincipals *prin, JSPrincipals *orig, int testCas
|
|||
src, strlen(src), "test", 1,
|
||||
JSVERSION_DEFAULT));
|
||||
if (!script)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
if (testCase == TEST_SCRIPT || testCase == TEST_SERIALIZED_FUNCTION) {
|
||||
script = FreezeThaw(cx, script);
|
||||
if (!script)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
if (testCase == TEST_SCRIPT)
|
||||
return script;
|
||||
}
|
||||
|
@ -140,12 +140,12 @@ JSScript *createScriptViaXDR(JSPrincipals *prin, JSPrincipals *orig, int testCas
|
|||
JS::RootedValue v(cx);
|
||||
bool ok = JS_ExecuteScript(cx, global, script, v.address());
|
||||
if (!ok || !v.isObject())
|
||||
return NULL;
|
||||
return nullptr;
|
||||
JS::RootedObject funobj(cx, &v.toObject());
|
||||
if (testCase == TEST_FUNCTION) {
|
||||
funobj = FreezeThaw(cx, funobj);
|
||||
if (!funobj)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
return GetScript(cx, funobj);
|
||||
}
|
||||
|
@ -194,7 +194,7 @@ BEGIN_TEST(testXDR_bug516827)
|
|||
CHECK(script);
|
||||
|
||||
// execute with null result meaning no result wanted
|
||||
CHECK(JS_ExecuteScript(cx, global, script, NULL));
|
||||
CHECK(JS_ExecuteScript(cx, global, script, nullptr));
|
||||
return true;
|
||||
}
|
||||
END_TEST(testXDR_bug516827)
|
||||
|
@ -205,7 +205,7 @@ BEGIN_TEST(testXDR_source)
|
|||
// This can't possibly fail to compress well, can it?
|
||||
"function f(x) { return x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x }",
|
||||
"short",
|
||||
NULL
|
||||
nullptr
|
||||
};
|
||||
for (const char **s = samples; *s; s++) {
|
||||
JS::RootedScript script(cx, JS_CompileScript(cx, global, *s, strlen(*s), __FILE__, __LINE__));
|
||||
|
@ -227,7 +227,7 @@ BEGIN_TEST(testXDR_sourceMap)
|
|||
const char *sourceMaps[] = {
|
||||
"http://example.com/source-map.json",
|
||||
"file:///var/source-map.json",
|
||||
NULL
|
||||
nullptr
|
||||
};
|
||||
JS::RootedScript script(cx);
|
||||
for (const char **sm = sourceMaps; *sm; sm++) {
|
||||
|
|
|
@ -56,7 +56,7 @@ JSObject * JSAPITest::createGlobal(JSPrincipals *principals)
|
|||
options.setVersion(JSVERSION_LATEST);
|
||||
global = JS_NewGlobalObject(cx, getGlobalClass(), principals, JS::FireOnNewGlobalHook, options);
|
||||
if (!global)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
JS_AddNamedObjectRoot(cx, &global, "test-global");
|
||||
JS::HandleObject globalHandle = JS::HandleObject::fromMarkedLocation(&global);
|
||||
|
||||
|
@ -65,7 +65,7 @@ JSObject * JSAPITest::createGlobal(JSPrincipals *principals)
|
|||
/* Populate the global object with the standard globals, like Object and
|
||||
Array. */
|
||||
if (!JS_InitStandardClasses(cx, globalHandle))
|
||||
return NULL;
|
||||
return nullptr;
|
||||
return global;
|
||||
}
|
||||
|
||||
|
@ -73,7 +73,7 @@ int main(int argc, char *argv[])
|
|||
{
|
||||
int total = 0;
|
||||
int failures = 0;
|
||||
const char *filter = (argc == 2) ? argv[1] : NULL;
|
||||
const char *filter = (argc == 2) ? argv[1] : nullptr;
|
||||
|
||||
if (!JS_Init()) {
|
||||
printf("TEST-UNEXPECTED-FAIL | jsapi-tests | JS_Init() failed.\n");
|
||||
|
@ -82,7 +82,7 @@ int main(int argc, char *argv[])
|
|||
|
||||
for (JSAPITest *test = JSAPITest::list; test; test = test->next) {
|
||||
const char *name = test->name();
|
||||
if (filter && strstr(name, filter) == NULL)
|
||||
if (filter && strstr(name, filter) == nullptr)
|
||||
continue;
|
||||
|
||||
total += 1;
|
||||
|
|
|
@ -59,7 +59,8 @@ class JSAPITest
|
|||
JSAPITestString msgs;
|
||||
JSCompartment *oldCompartment;
|
||||
|
||||
JSAPITest() : rt(NULL), cx(NULL), global(NULL), knownFail(false), oldCompartment(NULL) {
|
||||
JSAPITest() : rt(nullptr), cx(nullptr), global(nullptr),
|
||||
knownFail(false), oldCompartment(nullptr) {
|
||||
next = list;
|
||||
list = this;
|
||||
}
|
||||
|
@ -71,18 +72,18 @@ class JSAPITest
|
|||
virtual void uninit() {
|
||||
if (oldCompartment) {
|
||||
JS_LeaveCompartment(cx, oldCompartment);
|
||||
oldCompartment = NULL;
|
||||
oldCompartment = nullptr;
|
||||
}
|
||||
if (cx) {
|
||||
JS_RemoveObjectRoot(cx, &global);
|
||||
JS_LeaveCompartment(cx, NULL);
|
||||
JS_LeaveCompartment(cx, nullptr);
|
||||
JS_EndRequest(cx);
|
||||
JS_DestroyContext(cx);
|
||||
cx = NULL;
|
||||
cx = nullptr;
|
||||
}
|
||||
if (rt) {
|
||||
destroyRuntime();
|
||||
rt = NULL;
|
||||
rt = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -277,7 +278,7 @@ class JSAPITest
|
|||
virtual JSRuntime * createRuntime() {
|
||||
JSRuntime *rt = JS_NewRuntime(8L * 1024 * 1024, JS_USE_HELPER_THREADS);
|
||||
if (!rt)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
setNativeStackQuota(rt);
|
||||
return rt;
|
||||
}
|
||||
|
@ -298,7 +299,7 @@ class JSAPITest
|
|||
virtual JSContext * createContext() {
|
||||
JSContext *cx = JS_NewContext(rt, 8192);
|
||||
if (!cx)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
JS_SetOptions(cx, JSOPTION_VAROBJFIX);
|
||||
JS_SetErrorReporter(cx, &reportError);
|
||||
return cx;
|
||||
|
@ -308,7 +309,7 @@ class JSAPITest
|
|||
return basicGlobalClass();
|
||||
}
|
||||
|
||||
virtual JSObject * createGlobal(JSPrincipals *principals = NULL);
|
||||
virtual JSObject * createGlobal(JSPrincipals *principals = nullptr);
|
||||
};
|
||||
|
||||
#define BEGIN_TEST(testname) \
|
||||
|
@ -384,7 +385,7 @@ class TempFile {
|
|||
name, strerror(errno));
|
||||
exit(1);
|
||||
}
|
||||
stream = NULL;
|
||||
stream = nullptr;
|
||||
}
|
||||
|
||||
/* Delete the temporary file. */
|
||||
|
@ -394,7 +395,7 @@ class TempFile {
|
|||
name, strerror(errno));
|
||||
exit(1);
|
||||
}
|
||||
name = NULL;
|
||||
name = nullptr;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче