Bug 784739 - Switch from NULL to nullptr in js/src/ (1/9); r=ehsan

--HG--
extra : rebase_source : 358fd557136a4c12a3a374657050279d1bdeedfa
This commit is contained in:
Birunthan Mohanathas 2013-10-07 12:42:55 -04:00
Родитель 37f8167fb8
Коммит 075a3ea1b6
13 изменённых файлов: 199 добавлений и 198 удалений

Просмотреть файл

@ -90,17 +90,17 @@ const char* const TraceLogging::typeName[] = {
"e,b", // engine baseline "e,b", // engine baseline
"e,o" // engine ionmonkey "e,o" // engine ionmonkey
}; };
TraceLogging* TraceLogging::loggers[] = {NULL, NULL, NULL}; TraceLogging* TraceLogging::loggers[] = {nullptr, nullptr, nullptr};
bool TraceLogging::atexitSet = false; bool TraceLogging::atexitSet = false;
uint64_t TraceLogging::startupTime = 0; uint64_t TraceLogging::startupTime = 0;
TraceLogging::TraceLogging(Logger id) TraceLogging::TraceLogging(Logger id)
: nextTextId(1), : nextTextId(1),
entries(NULL), entries(nullptr),
curEntry(0), curEntry(0),
numEntries(1000000), numEntries(1000000),
fileno(0), fileno(0),
out(NULL), out(nullptr),
id(id) id(id)
{ {
textMap.init(); textMap.init();
@ -111,12 +111,12 @@ TraceLogging::~TraceLogging()
if (entries) { if (entries) {
flush(); flush();
free(entries); free(entries);
entries = NULL; entries = nullptr;
} }
if (out) { if (out) {
fclose(out); fclose(out);
out = NULL; out = nullptr;
} }
} }
@ -137,7 +137,7 @@ TraceLogging::grow()
} }
void void
TraceLogging::log(Type type, const char* text /* = NULL */, unsigned int number /* = 0 */) TraceLogging::log(Type type, const char* text /* = nullptr */, unsigned int number /* = 0 */)
{ {
uint64_t now = rdtsc() - startupTime; uint64_t now = rdtsc() - startupTime;
@ -149,7 +149,7 @@ TraceLogging::log(Type type, const char* text /* = NULL */, unsigned int number
} }
uint32_t textId = 0; uint32_t textId = 0;
char *text_ = NULL; char *text_ = nullptr;
if (text) { if (text) {
TextHashMap::AddPtr p = textMap.lookupForAdd(text); TextHashMap::AddPtr p = textMap.lookupForAdd(text);
@ -248,9 +248,9 @@ TraceLogging::flush()
exit(-1); exit(-1);
} }
if (entries[i].text() != NULL) { if (entries[i].text() != nullptr) {
free(entries[i].text()); free(entries[i].text());
entries[i].text_ = NULL; entries[i].text_ = nullptr;
} }
} }
curEntry = 0; curEntry = 0;
@ -279,7 +279,7 @@ TraceLogging::releaseLoggers()
continue; continue;
delete loggers[i]; delete loggers[i];
loggers[i] = NULL; loggers[i] = nullptr;
} }
} }

Просмотреть файл

@ -102,7 +102,7 @@ class TraceLogging
TraceLogging(Logger id); TraceLogging(Logger id);
~TraceLogging(); ~TraceLogging();
void log(Type type, const char* text = NULL, unsigned int number = 0); void log(Type type, const char* text = nullptr, unsigned int number = 0);
void log(Type type, const JS::CompileOptions &options); void log(Type type, const JS::CompileOptions &options);
void log(Type type, JSScript* script); void log(Type type, JSScript* script);
void log(const char* log); void log(const char* log);

Просмотреть файл

@ -830,7 +830,7 @@ DumpHeapComplete(JSContext *cx, unsigned argc, jsval *vp)
CallArgs args = CallArgsFromVp(argc, vp); CallArgs args = CallArgsFromVp(argc, vp);
DumpHeapNurseryBehaviour nurseryBehaviour = js::IgnoreNurseryObjects; DumpHeapNurseryBehaviour nurseryBehaviour = js::IgnoreNurseryObjects;
FILE *dumpFile = NULL; FILE *dumpFile = nullptr;
unsigned i = 0; unsigned i = 0;
if (argc > i) { if (argc > i) {

Просмотреть файл

@ -5081,7 +5081,7 @@ class ParallelCompilationGuard
{ {
WorkerThreadState *parallelState_; WorkerThreadState *parallelState_;
public: public:
ParallelCompilationGuard() : parallelState_(NULL) {} ParallelCompilationGuard() : parallelState_(nullptr) {}
~ParallelCompilationGuard() { ~ParallelCompilationGuard() {
if (parallelState_) { if (parallelState_) {
JS_ASSERT(parallelState_->asmJSCompilationInProgress == true); JS_ASSERT(parallelState_->asmJSCompilationInProgress == true);

Просмотреть файл

@ -7777,7 +7777,7 @@ IonBuilder::freezePropTypeSets(types::TemporaryTypeSet *types,
continue; continue;
// Walk the prototype chain. Everyone has to have the property, since we // Walk the prototype chain. Everyone has to have the property, since we
// just checked, so propSet cannot be NULL. // just checked, so propSet cannot be nullptr.
while (true) { while (true) {
types::HeapTypeSetKey property = type->property(NameToId(name)); types::HeapTypeSetKey property = type->property(NameToId(name));
JS_ALWAYS_TRUE(!property.notEmpty(constraints())); JS_ALWAYS_TRUE(!property.notEmpty(constraints()));

Просмотреть файл

@ -687,7 +687,7 @@ class IonBuilder : public MIRGenerator
} }
bool isInlineBuilder() const { bool isInlineBuilder() const {
return callerBuilder_ != NULL; return callerBuilder_ != nullptr;
} }
private: private:

Просмотреть файл

@ -273,8 +273,8 @@ class Range : public TempObject {
// Construct a range from the given raw values. // Construct a range from the given raw values.
Range(int32_t l, bool lb, int32_t h, bool hb, bool f, uint16_t e) Range(int32_t l, bool lb, int32_t h, bool hb, bool f, uint16_t e)
: symbolicLower_(NULL), : symbolicLower_(nullptr),
symbolicUpper_(NULL) symbolicUpper_(nullptr)
{ {
rawInitialize(l, lb, h, hb, f, e); rawInitialize(l, lb, h, hb, f, e);
} }

Просмотреть файл

@ -53,14 +53,14 @@ class TempAllocPolicy
void *malloc_(size_t bytes) { void *malloc_(size_t bytes) {
void *p = js_malloc(bytes); void *p = js_malloc(bytes);
if (JS_UNLIKELY(!p)) if (JS_UNLIKELY(!p))
p = onOutOfMemory(NULL, bytes); p = onOutOfMemory(nullptr, bytes);
return p; return p;
} }
void *calloc_(size_t bytes) { void *calloc_(size_t bytes) {
void *p = js_calloc(bytes); void *p = js_calloc(bytes);
if (JS_UNLIKELY(!p)) if (JS_UNLIKELY(!p))
p = onOutOfMemory(NULL, bytes); p = onOutOfMemory(nullptr, bytes);
return p; return p;
} }

Просмотреть файл

@ -440,7 +440,7 @@ ScriptAnalysis::analyzeLifetimes(JSContext *cx)
} }
unsigned savedCount = 0; unsigned savedCount = 0;
LoopAnalysis *loop = NULL; LoopAnalysis *loop = nullptr;
uint32_t offset = script_->length - 1; uint32_t offset = script_->length - 1;
while (offset < script_->length) { while (offset < script_->length) {
@ -525,7 +525,7 @@ ScriptAnalysis::analyzeLifetimes(JSContext *cx)
setOOM(cx); setOOM(cx);
return; return;
} }
var.saved = NULL; var.saved = nullptr;
saved[i--] = saved[--savedCount]; saved[i--] = saved[--savedCount];
} }
savedCount = 0; savedCount = 0;
@ -617,7 +617,7 @@ ScriptAnalysis::analyzeLifetimes(JSContext *cx)
setOOM(cx); setOOM(cx);
return; return;
} }
var.saved = NULL; var.saved = nullptr;
saved[i--] = saved[--savedCount]; saved[i--] = saved[--savedCount];
} else if (loop && !var.savedEnd) { } else if (loop && !var.savedEnd) {
/* /*
@ -680,7 +680,7 @@ ScriptAnalysis::addVariable(JSContext *cx, LifetimeVariable &var, unsigned offse
setOOM(cx); setOOM(cx);
return; return;
} }
var.saved = NULL; var.saved = nullptr;
} }
} }
@ -730,7 +730,7 @@ ScriptAnalysis::killVariable(JSContext *cx, LifetimeVariable &var, unsigned offs
} else { } else {
var.saved = var.lifetime; var.saved = var.lifetime;
var.savedEnd = 0; var.savedEnd = 0;
var.lifetime = NULL; var.lifetime = nullptr;
saved[savedCount++] = &var; saved[savedCount++] = &var;
} }
@ -1510,7 +1510,7 @@ ScriptAnalysis::freezeNewValues(JSContext *cx, uint32_t offset)
Bytecode &code = getCode(offset); Bytecode &code = getCode(offset);
Vector<SlotValue> *pending = code.pendingValues; Vector<SlotValue> *pending = code.pendingValues;
code.pendingValues = NULL; code.pendingValues = nullptr;
unsigned count = pending->length(); unsigned count = pending->length();
if (count == 0) { if (count == 0) {

Просмотреть файл

@ -336,7 +336,7 @@ struct LifetimeVariable
return segment; return segment;
segment = segment->next; segment = segment->next;
} }
return NULL; return nullptr;
} }
/* /*

Просмотреть файл

@ -230,7 +230,8 @@ JS_ConvertArgumentsVA(JSContext *cx, unsigned argc, jsval *argv, const char *for
JS_snprintf(numBuf, sizeof numBuf, "%u", argc); JS_snprintf(numBuf, sizeof numBuf, "%u", argc);
JSAutoByteString funNameBytes; JSAutoByteString funNameBytes;
if (const char *name = GetFunctionNameBytes(cx, fun, &funNameBytes)) { if (const char *name = GetFunctionNameBytes(cx, fun, &funNameBytes)) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_MORE_ARGS_NEEDED, JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr,
JSMSG_MORE_ARGS_NEEDED,
name, numBuf, (argc == 1) ? "" : "s"); name, numBuf, (argc == 1) ? "" : "s");
} }
} }
@ -309,7 +310,7 @@ JS_ConvertArgumentsVA(JSContext *cx, unsigned argc, jsval *argv, const char *for
case '*': case '*':
break; break;
default: default:
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_BAD_CHAR, format); JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_BAD_CHAR, format);
return false; return false;
} }
sp++; sp++;
@ -346,11 +347,11 @@ JS_ConvertValue(JSContext *cx, HandleValue value, JSType type, MutableHandleValu
case JSTYPE_FUNCTION: case JSTYPE_FUNCTION:
vp.set(value); vp.set(value);
obj = ReportIfNotFunction(cx, vp); obj = ReportIfNotFunction(cx, vp);
ok = (obj != NULL); ok = (obj != nullptr);
break; break;
case JSTYPE_STRING: case JSTYPE_STRING:
str = ToString<CanGC>(cx, value); str = ToString<CanGC>(cx, value);
ok = (str != NULL); ok = (str != nullptr);
if (ok) if (ok)
vp.setString(str); vp.setString(str);
break; break;
@ -365,7 +366,7 @@ JS_ConvertValue(JSContext *cx, HandleValue value, JSType type, MutableHandleValu
default: { default: {
char numBuf[12]; char numBuf[12];
JS_snprintf(numBuf, sizeof numBuf, "%d", (int)type); JS_snprintf(numBuf, sizeof numBuf, "%d", (int)type);
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_BAD_TYPE, numBuf); JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_BAD_TYPE, numBuf);
ok = false; ok = false;
break; break;
} }
@ -537,7 +538,7 @@ JS_PUBLIC_API(const char *)
JS_GetTypeName(JSContext *cx, JSType type) JS_GetTypeName(JSContext *cx, JSType type)
{ {
if ((unsigned)type >= (unsigned)JSTYPE_LIMIT) if ((unsigned)type >= (unsigned)JSTYPE_LIMIT)
return NULL; return nullptr;
return TypeStrings[type]; return TypeStrings[type];
} }
@ -714,11 +715,11 @@ JS_NewRuntime(uint32_t maxbytes, JSUseHelperThreads useHelperThreads)
JSRuntime *rt = js_new<JSRuntime>(useHelperThreads); JSRuntime *rt = js_new<JSRuntime>(useHelperThreads);
if (!rt) if (!rt)
return NULL; return nullptr;
if (!rt->init(maxbytes)) { if (!rt->init(maxbytes)) {
JS_DestroyRuntime(rt); JS_DestroyRuntime(rt);
return NULL; return nullptr;
} }
return rt; return rt;
@ -739,7 +740,7 @@ JS_SetICUMemoryFunctions(JS_ICUAllocFn allocFn, JS_ICUReallocFn reallocFn, JS_IC
#if EXPOSE_INTL_API #if EXPOSE_INTL_API
UErrorCode status = U_ZERO_ERROR; UErrorCode status = U_ZERO_ERROR;
u_setMemoryFunctions(/* context = */ NULL, allocFn, reallocFn, freeFn, &status); u_setMemoryFunctions(/* context = */ nullptr, allocFn, reallocFn, freeFn, &status);
return U_SUCCESS(status); return U_SUCCESS(status);
#else #else
return true; return true;
@ -919,7 +920,7 @@ static const struct v2smap {
{JSVERSION_DEFAULT, "1.3"}, {JSVERSION_DEFAULT, "1.3"},
{JSVERSION_DEFAULT, "1.4"}, {JSVERSION_DEFAULT, "1.4"},
{JSVERSION_DEFAULT, "1.5"}, {JSVERSION_DEFAULT, "1.5"},
{JSVERSION_UNKNOWN, NULL}, /* must be last, NULL is sentinel */ {JSVERSION_UNKNOWN, nullptr}, /* must be last, nullptr is sentinel */
}; };
JS_PUBLIC_API(const char *) JS_PUBLIC_API(const char *)
@ -1382,7 +1383,7 @@ static const JSStdName standard_class_atoms[] = {
#ifdef ENABLE_BINARYDATA #ifdef ENABLE_BINARYDATA
{js_InitTypedObjectClasses, EAGER_ATOM_AND_CLASP(Type)}, {js_InitTypedObjectClasses, EAGER_ATOM_AND_CLASP(Type)},
#endif #endif
{NULL, 0, NULL} {nullptr, 0, nullptr}
}; };
/* /*
@ -1449,7 +1450,7 @@ static const JSStdName standard_class_names[] = {
{js_InitTypedObjectClasses, EAGER_CLASS_ATOM(ArrayType), &js::ArrayType::class_}, {js_InitTypedObjectClasses, EAGER_CLASS_ATOM(ArrayType), &js::ArrayType::class_},
{js_InitTypedObjectClasses, EAGER_CLASS_ATOM(StructType), &js::StructType::class_}, {js_InitTypedObjectClasses, EAGER_CLASS_ATOM(StructType), &js::StructType::class_},
#endif #endif
{NULL, 0, NULL} {nullptr, 0, nullptr}
}; };
static const JSStdName object_prototype_names[] = { static const JSStdName object_prototype_names[] = {
@ -1475,7 +1476,7 @@ static const JSStdName object_prototype_names[] = {
{js_InitObjectClass, EAGER_ATOM(lookupSetter), &JSObject::class_}, {js_InitObjectClass, EAGER_ATOM(lookupSetter), &JSObject::class_},
#endif #endif
{NULL, 0, NULL} {nullptr, 0, nullptr}
}; };
#undef CLASP #undef CLASP
@ -1515,7 +1516,7 @@ JS_ResolveStandardClass(JSContext *cx, HandleObject obj, HandleId id, bool *reso
} }
/* Try for class constructors/prototypes named by well-known atoms. */ /* Try for class constructors/prototypes named by well-known atoms. */
stdnm = NULL; stdnm = nullptr;
for (i = 0; standard_class_atoms[i].init; i++) { for (i = 0; standard_class_atoms[i].init; i++) {
JS_ASSERT(standard_class_atoms[i].clasp); JS_ASSERT(standard_class_atoms[i].clasp);
atom = OFFSET_TO_NAME(rt, standard_class_atoms[i].atomOffset); atom = OFFSET_TO_NAME(rt, standard_class_atoms[i].atomOffset);
@ -1699,7 +1700,7 @@ JS::CurrentGlobalOrNull(JSContext *cx)
AssertHeapIsIdleOrIterating(cx); AssertHeapIsIdleOrIterating(cx);
CHECK_REQUEST(cx); CHECK_REQUEST(cx);
if (!cx->compartment()) if (!cx->compartment())
return NULL; return nullptr;
return cx->global(); return cx->global();
} }
@ -1768,7 +1769,7 @@ JS_strdup(JSRuntime *rt, const char *s)
size_t n = strlen(s) + 1; size_t n = strlen(s) + 1;
void *p = rt->malloc_(n); void *p = rt->malloc_(n);
if (!p) if (!p)
return NULL; return nullptr;
return static_cast<char*>(js_memcpy(p, s, n)); return static_cast<char*>(js_memcpy(p, s, n));
} }
@ -1779,7 +1780,7 @@ JS_AddValueRoot(JSContext *cx, jsval *vp)
{ {
AssertHeapIsIdle(cx); AssertHeapIsIdle(cx);
CHECK_REQUEST(cx); CHECK_REQUEST(cx);
return AddValueRoot(cx, vp, NULL); return AddValueRoot(cx, vp, nullptr);
} }
JS_PUBLIC_API(bool) JS_PUBLIC_API(bool)
@ -1787,7 +1788,7 @@ JS_AddStringRoot(JSContext *cx, JSString **rp)
{ {
AssertHeapIsIdle(cx); AssertHeapIsIdle(cx);
CHECK_REQUEST(cx); CHECK_REQUEST(cx);
return AddStringRoot(cx, rp, NULL); return AddStringRoot(cx, rp, nullptr);
} }
JS_PUBLIC_API(bool) JS_PUBLIC_API(bool)
@ -1795,7 +1796,7 @@ JS_AddObjectRoot(JSContext *cx, JSObject **rp)
{ {
AssertHeapIsIdle(cx); AssertHeapIsIdle(cx);
CHECK_REQUEST(cx); CHECK_REQUEST(cx);
return AddObjectRoot(cx, rp, NULL); return AddObjectRoot(cx, rp, nullptr);
} }
JS_PUBLIC_API(bool) JS_PUBLIC_API(bool)
@ -1991,7 +1992,7 @@ DumpNotify(JSTracer *trc, void **thingp, JSGCTraceKind kind)
node->thing = thing; node->thing = thing;
node->kind = kind; node->kind = kind;
node->next = NULL; node->next = nullptr;
node->parent = dtrc->parentNode; node->parent = dtrc->parentNode;
js_memcpy(node->edgeName, edgeName, edgeNameSize); js_memcpy(node->edgeName, edgeName, edgeNameSize);
@ -2020,7 +2021,7 @@ DumpNode(JSDumpingTracer *dtrc, FILE* fp, JSHeapDumpNode *node)
* chain order. * chain order.
*/ */
chainLimit = MAX_PARENTS_TO_PRINT; chainLimit = MAX_PARENTS_TO_PRINT;
prev = NULL; prev = nullptr;
for (;;) { for (;;) {
following = node->parent; following = node->parent;
node->parent = prev; node->parent = prev;
@ -2080,8 +2081,8 @@ JS_DumpHeap(JSRuntime *rt, FILE *fp, void* startThing, JSGCTraceKind startKind,
dtrc.startThing = startThing; dtrc.startThing = startThing;
dtrc.thingToFind = thingToFind; dtrc.thingToFind = thingToFind;
dtrc.thingToIgnore = thingToIgnore; dtrc.thingToIgnore = thingToIgnore;
dtrc.parentNode = NULL; dtrc.parentNode = nullptr;
JSHeapDumpNode *node = NULL; JSHeapDumpNode *node = nullptr;
dtrc.lastNodep = &node; dtrc.lastNodep = &node;
if (!startThing) { if (!startThing) {
JS_ASSERT(startKind == JSTRACE_OBJECT); JS_ASSERT(startKind == JSTRACE_OBJECT);
@ -2102,7 +2103,7 @@ JS_DumpHeap(JSRuntime *rt, FILE *fp, void* startThing, JSGCTraceKind startKind,
* so far. * so far.
*/ */
if (dtrc.ok) { if (dtrc.ok) {
if (thingToFind == NULL || thingToFind == node->thing) if (thingToFind == nullptr || thingToFind == node->thing)
dtrc.ok = DumpNode(&dtrc, fp, node); dtrc.ok = DumpNode(&dtrc, fp, node);
/* Descend into children. */ /* Descend into children. */
@ -2110,12 +2111,12 @@ JS_DumpHeap(JSRuntime *rt, FILE *fp, void* startThing, JSGCTraceKind startKind,
depth < maxDepth && depth < maxDepth &&
(thingToFind != node->thing || !thingToFindWasTraced)) { (thingToFind != node->thing || !thingToFindWasTraced)) {
dtrc.parentNode = node; dtrc.parentNode = node;
children = NULL; children = nullptr;
dtrc.lastNodep = &children; dtrc.lastNodep = &children;
JS_TraceChildren(&dtrc.base, node->thing, node->kind); JS_TraceChildren(&dtrc.base, node->thing, node->kind);
if (thingToFind == node->thing) if (thingToFind == node->thing)
thingToFindWasTraced = true; thingToFindWasTraced = true;
if (children != NULL) { if (children != nullptr) {
++depth; ++depth;
node = children; node = children;
continue; continue;
@ -2454,7 +2455,7 @@ JS_DefaultValue(JSContext *cx, JSObject *objArg, JSType hint, jsval *vp)
RootedObject obj(cx, objArg); RootedObject obj(cx, objArg);
AssertHeapIsIdle(cx); AssertHeapIsIdle(cx);
CHECK_REQUEST(cx); CHECK_REQUEST(cx);
JS_ASSERT(obj != NULL); JS_ASSERT(obj != nullptr);
JS_ASSERT(hint == JSTYPE_VOID || hint == JSTYPE_STRING || hint == JSTYPE_NUMBER); JS_ASSERT(hint == JSTYPE_VOID || hint == JSTYPE_STRING || hint == JSTYPE_NUMBER);
RootedValue value(cx); RootedValue value(cx);
@ -2583,7 +2584,7 @@ JS_GetInstancePrivate(JSContext *cx, JSObject *objArg, const JSClass *clasp, jsv
{ {
RootedObject obj(cx, objArg); RootedObject obj(cx, objArg);
if (!JS_InstanceOf(cx, obj, clasp, argv)) if (!JS_InstanceOf(cx, obj, clasp, argv))
return NULL; return nullptr;
return obj->getPrivate(); return obj->getPrivate();
} }
@ -2637,12 +2638,12 @@ JS_GetConstructor(JSContext *cx, JSObject *protoArg)
JSAutoResolveFlags rf(cx, 0); JSAutoResolveFlags rf(cx, 0);
if (!JSObject::getProperty(cx, proto, proto, cx->names().constructor, &cval)) if (!JSObject::getProperty(cx, proto, proto, cx->names().constructor, &cval))
return NULL; return nullptr;
} }
if (!IsFunctionObject(cval)) { if (!IsFunctionObject(cval)) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_NO_CONSTRUCTOR, JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_NO_CONSTRUCTOR,
proto->getClass()->name); proto->getClass()->name);
return NULL; return nullptr;
} }
return &cval.toObject(); return &cval.toObject();
} }
@ -2710,13 +2711,13 @@ JS_NewGlobalObject(JSContext *cx, const JSClass *clasp, JSPrincipals *principals
if (options.zoneSpecifier() == JS::SystemZone) if (options.zoneSpecifier() == JS::SystemZone)
zone = rt->systemZone; zone = rt->systemZone;
else if (options.zoneSpecifier() == JS::FreshZone) else if (options.zoneSpecifier() == JS::FreshZone)
zone = NULL; zone = nullptr;
else else
zone = static_cast<Zone *>(options.zonePointer()); zone = static_cast<Zone *>(options.zonePointer());
JSCompartment *compartment = NewCompartment(cx, zone, principals, options); JSCompartment *compartment = NewCompartment(cx, zone, principals, options);
if (!compartment) if (!compartment)
return NULL; return nullptr;
// Lazily create the system zone. // Lazily create the system zone.
if (!rt->systemZone && options.zoneSpecifier() == JS::SystemZone) { if (!rt->systemZone && options.zoneSpecifier() == JS::SystemZone) {
@ -2733,7 +2734,7 @@ JS_NewGlobalObject(JSContext *cx, const JSClass *clasp, JSPrincipals *principals
} }
if (!global) if (!global)
return NULL; return nullptr;
if (hookOption == JS::FireOnNewGlobalHook) if (hookOption == JS::FireOnNewGlobalHook)
JS_FireOnNewGlobalObject(cx, global); JS_FireOnNewGlobalObject(cx, global);
@ -3004,7 +3005,7 @@ JS_HasPropertyById(JSContext *cx, JSObject *objArg, jsid idArg, bool *foundp)
RootedObject obj2(cx); RootedObject obj2(cx);
RootedShape prop(cx); RootedShape prop(cx);
bool ok = LookupPropertyById(cx, obj, id, 0, &obj2, &prop); bool ok = LookupPropertyById(cx, obj, id, 0, &obj2, &prop);
*foundp = (prop != NULL); *foundp = (prop != nullptr);
return ok; return ok;
} }
@ -3101,7 +3102,7 @@ GetterWrapper(JSPropertyOp getter)
{ {
JSPropertyOpWrapper ret; JSPropertyOpWrapper ret;
ret.op = getter; ret.op = getter;
ret.info = NULL; ret.info = nullptr;
return ret; return ret;
} }
@ -3110,7 +3111,7 @@ SetterWrapper(JSStrictPropertyOp setter)
{ {
JSStrictPropertyOpWrapper ret; JSStrictPropertyOpWrapper ret;
ret.op = setter; ret.op = setter;
ret.info = NULL; ret.info = nullptr;
return ret; return ret;
} }
@ -3158,7 +3159,7 @@ DefinePropertyById(JSContext *cx, HandleObject obj, HandleId id, HandleValue val
} }
if (setter) { if (setter) {
// Root just the getter, since the setter is not yet a JSObject. // Root just the getter, since the setter is not yet a JSObject.
AutoRooterGetterSetter getRoot(cx, JSPROP_GETTER, &getter, NULL); AutoRooterGetterSetter getRoot(cx, JSPROP_GETTER, &getter, nullptr);
RootedObject global(cx, (JSObject*) &obj->global()); RootedObject global(cx, (JSObject*) &obj->global());
JSFunction *setobj = NewFunction(cx, NullPtr(), (Native) setter, 1, JSFunction *setobj = NewFunction(cx, NullPtr(), (Native) setter, 1,
zeroFlags, global, atom); zeroFlags, global, atom);
@ -3179,10 +3180,10 @@ DefinePropertyById(JSContext *cx, HandleObject obj, HandleId id, HandleValue val
assertSameCompartment(cx, obj, id, value, assertSameCompartment(cx, obj, id, value,
(attrs & JSPROP_GETTER) (attrs & JSPROP_GETTER)
? JS_FUNC_TO_DATA_PTR(JSObject *, getter) ? JS_FUNC_TO_DATA_PTR(JSObject *, getter)
: NULL, : nullptr,
(attrs & JSPROP_SETTER) (attrs & JSPROP_SETTER)
? JS_FUNC_TO_DATA_PTR(JSObject *, setter) ? JS_FUNC_TO_DATA_PTR(JSObject *, setter)
: NULL); : nullptr);
JSAutoResolveFlags rf(cx, 0); JSAutoResolveFlags rf(cx, 0);
if (flags != 0 && obj->isNative()) { if (flags != 0 && obj->isNative()) {
@ -3326,12 +3327,12 @@ JS_DefineObject(JSContext *cx, JSObject *objArg, const char *name, const JSClass
RootedObject nobj(cx, NewObjectWithClassProto(cx, clasp, proto, obj)); RootedObject nobj(cx, NewObjectWithClassProto(cx, clasp, proto, obj));
if (!nobj) if (!nobj)
return NULL; return nullptr;
if (!DefineProperty(cx, obj, name, ObjectValue(*nobj), GetterWrapper(NULL), if (!DefineProperty(cx, obj, name, ObjectValue(*nobj), GetterWrapper(nullptr),
SetterWrapper(NULL), attrs, 0, 0)) SetterWrapper(nullptr), attrs, 0, 0))
{ {
return NULL; return nullptr;
} }
return nobj; return nobj;
@ -3346,8 +3347,8 @@ JS_DefineConstDoubles(JSContext *cx, JSObject *objArg, const JSConstDoubleSpec *
AssertHeapIsIdle(cx); AssertHeapIsIdle(cx);
CHECK_REQUEST(cx); CHECK_REQUEST(cx);
JSPropertyOpWrapper noget = GetterWrapper(NULL); JSPropertyOpWrapper noget = GetterWrapper(nullptr);
JSStrictPropertyOpWrapper noset = SetterWrapper(NULL); JSStrictPropertyOpWrapper noset = SetterWrapper(nullptr);
for (ok = true; cds->name; cds++) { for (ok = true; cds->name; cds++) {
Value value = DoubleValue(cds->dval); Value value = DoubleValue(cds->dval);
attrs = cds->flags; attrs = cds->flags;
@ -3410,8 +3411,8 @@ GetPropertyDescriptorById(JSContext *cx, HandleObject obj, HandleId id, unsigned
} }
if (!JSObject::getGenericAttributes(cx, obj2, id, &desc.attributesRef())) if (!JSObject::getGenericAttributes(cx, obj2, id, &desc.attributesRef()))
return false; return false;
JS_ASSERT(desc.getter() == NULL); JS_ASSERT(desc.getter() == nullptr);
JS_ASSERT(desc.setter() == NULL); JS_ASSERT(desc.setter() == nullptr);
JS_ASSERT(desc.value().isUndefined()); JS_ASSERT(desc.value().isUndefined());
} }
return true; return true;
@ -3690,7 +3691,7 @@ LastConfigurableShape(JSObject *obj)
if (shape->configurable()) if (shape->configurable())
return shape; return shape;
} }
return NULL; return nullptr;
} }
JS_PUBLIC_API(void) JS_PUBLIC_API(void)
@ -3755,7 +3756,7 @@ JS_Enumerate(JSContext *cx, JSObject *objArg)
AutoIdVector props(cx); AutoIdVector props(cx);
JSIdArray *ida; JSIdArray *ida;
if (!GetPropertyNames(cx, obj, JSITER_OWNONLY, &props) || !VectorToIdArray(cx, props, &ida)) if (!GetPropertyNames(cx, obj, JSITER_OWNONLY, &props) || !VectorToIdArray(cx, props, &ida))
return NULL; return nullptr;
return ida; return ida;
} }
@ -3816,10 +3817,10 @@ static const Class prop_iter_class = {
JS_ResolveStub, JS_ResolveStub,
JS_ConvertStub, JS_ConvertStub,
prop_iter_finalize, prop_iter_finalize,
NULL, /* checkAccess */ nullptr, /* checkAccess */
NULL, /* call */ nullptr, /* call */
NULL, /* hasInstance */ nullptr, /* hasInstance */
NULL, /* construct */ nullptr, /* construct */
prop_iter_trace prop_iter_trace
}; };
@ -3832,9 +3833,9 @@ JS_NewPropertyIterator(JSContext *cx, JSObject *objArg)
CHECK_REQUEST(cx); CHECK_REQUEST(cx);
assertSameCompartment(cx, obj); assertSameCompartment(cx, obj);
RootedObject iterobj(cx, NewObjectWithClassProto(cx, &prop_iter_class, NULL, obj)); RootedObject iterobj(cx, NewObjectWithClassProto(cx, &prop_iter_class, nullptr, obj));
if (!iterobj) if (!iterobj)
return NULL; return nullptr;
int index; int index;
if (obj->isNative()) { if (obj->isNative()) {
@ -3845,7 +3846,7 @@ JS_NewPropertyIterator(JSContext *cx, JSObject *objArg)
/* Non-native case: enumerate a JSIdArray and keep it via private. */ /* Non-native case: enumerate a JSIdArray and keep it via private. */
JSIdArray *ida = JS_Enumerate(cx, obj); JSIdArray *ida = JS_Enumerate(cx, obj);
if (!ida) if (!ida)
return NULL; return nullptr;
iterobj->setPrivate((void *)ida); iterobj->setPrivate((void *)ida);
index = ida->length; index = ida->length;
} }
@ -4003,7 +4004,7 @@ JS_SetSecurityCallbacks(JSRuntime *rt, const JSSecurityCallbacks *scb)
JS_PUBLIC_API(const JSSecurityCallbacks *) JS_PUBLIC_API(const JSSecurityCallbacks *)
JS_GetSecurityCallbacks(JSRuntime *rt) JS_GetSecurityCallbacks(JSRuntime *rt)
{ {
return (rt->securityCallbacks != &NullSecurityCallbacks) ? rt->securityCallbacks : NULL; return (rt->securityCallbacks != &NullSecurityCallbacks) ? rt->securityCallbacks : nullptr;
} }
JS_PUBLIC_API(void) JS_PUBLIC_API(void)
@ -4035,7 +4036,7 @@ JS_NewFunction(JSContext *cx, JSNative native, unsigned nargs, unsigned flags,
if (name) { if (name) {
atom = Atomize(cx, name, strlen(name)); atom = Atomize(cx, name, strlen(name));
if (!atom) if (!atom)
return NULL; return nullptr;
} }
JSFunction::Flags funFlags = JSAPIToJSFunctionFlags(flags); JSFunction::Flags funFlags = JSAPIToJSFunctionFlags(flags);
@ -4093,7 +4094,7 @@ JS_CloneFunctionObject(JSContext *cx, JSObject *funobjArg, JSObject *parentArg)
if (!funobj->is<JSFunction>()) { if (!funobj->is<JSFunction>()) {
AutoCompartment ac(cx, funobj); AutoCompartment ac(cx, funobj);
ReportIsNotFunction(cx, ObjectValue(*funobj)); ReportIsNotFunction(cx, ObjectValue(*funobj));
return NULL; return nullptr;
} }
/* /*
@ -4104,23 +4105,23 @@ JS_CloneFunctionObject(JSContext *cx, JSObject *funobjArg, JSObject *parentArg)
if (fun->isInterpretedLazy()) { if (fun->isInterpretedLazy()) {
AutoCompartment ac(cx, funobj); AutoCompartment ac(cx, funobj);
if (!fun->getOrCreateScript(cx)) if (!fun->getOrCreateScript(cx))
return NULL; return nullptr;
} }
if (fun->isInterpreted() && (fun->nonLazyScript()->enclosingStaticScope() || if (fun->isInterpreted() && (fun->nonLazyScript()->enclosingStaticScope() ||
(fun->nonLazyScript()->compileAndGo && !parent->is<GlobalObject>()))) (fun->nonLazyScript()->compileAndGo && !parent->is<GlobalObject>())))
{ {
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_BAD_CLONE_FUNOBJ_SCOPE); JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_BAD_CLONE_FUNOBJ_SCOPE);
return NULL; return nullptr;
} }
if (fun->isBoundFunction()) { if (fun->isBoundFunction()) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_CANT_CLONE_OBJECT); JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_CANT_CLONE_OBJECT);
return NULL; return nullptr;
} }
if (fun->isNative() && IsAsmJSModuleNative(fun->native())) { if (fun->isNative() && IsAsmJSModuleNative(fun->native())) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_CANT_CLONE_OBJECT); JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_CANT_CLONE_OBJECT);
return NULL; return nullptr;
} }
return CloneFunctionObject(cx, fun, parent, fun->getAllocKind()); return CloneFunctionObject(cx, fun, parent, fun->getAllocKind());
@ -4182,7 +4183,7 @@ JS_BindCallable(JSContext *cx, JSObject *targetArg, JSObject *newThis)
{ {
RootedObject target(cx, targetArg); RootedObject target(cx, targetArg);
RootedValue thisArg(cx, ObjectValue(*newThis)); RootedValue thisArg(cx, ObjectValue(*newThis));
return js_fun_bind(cx, target, thisArg, NULL, 0); return js_fun_bind(cx, target, thisArg, nullptr, 0);
} }
static bool static bool
@ -4268,7 +4269,7 @@ JS_DefineFunctions(JSContext *cx, JSObject *objArg, const JSFunctionSpec *fs)
/* /*
* Delay cloning self-hosted functions until they are called. This is * Delay cloning self-hosted functions until they are called. This is
* achieved by passing DefineFunction a NULL JSNative which * achieved by passing DefineFunction a nullptr JSNative which
* produces an interpreted JSFunction where !hasScript. Interpreted * produces an interpreted JSFunction where !hasScript. Interpreted
* call paths then call InitializeLazyFunctionScript if !hasScript. * call paths then call InitializeLazyFunctionScript if !hasScript.
*/ */
@ -4291,7 +4292,7 @@ JS_DefineFunctions(JSContext *cx, JSObject *objArg, const JSFunctionSpec *fs)
RootedValue funVal(cx); RootedValue funVal(cx);
if (!cx->global()->getSelfHostedFunction(cx, shName, atom, fs->nargs, &funVal)) if (!cx->global()->getSelfHostedFunction(cx, shName, atom, fs->nargs, &funVal))
return false; return false;
if (!JSObject::defineGeneric(cx, obj, id, funVal, NULL, NULL, flags)) if (!JSObject::defineGeneric(cx, obj, id, funVal, nullptr, nullptr, flags))
return false; return false;
} else { } else {
JSFunction *fun = DefineFunction(cx, obj, id, fs->call.op, fs->nargs, flags); JSFunction *fun = DefineFunction(cx, obj, id, fs->call.op, fs->nargs, flags);
@ -4315,7 +4316,7 @@ JS_DefineFunction(JSContext *cx, JSObject *objArg, const char *name, JSNative ca
assertSameCompartment(cx, obj); assertSameCompartment(cx, obj);
JSAtom *atom = Atomize(cx, name, strlen(name)); JSAtom *atom = Atomize(cx, name, strlen(name));
if (!atom) if (!atom)
return NULL; return nullptr;
Rooted<jsid> id(cx, AtomToId(atom)); Rooted<jsid> id(cx, AtomToId(atom));
return DefineFunction(cx, obj, id, call, nargs, attrs); return DefineFunction(cx, obj, id, call, nargs, attrs);
} }
@ -4332,7 +4333,7 @@ JS_DefineUCFunction(JSContext *cx, JSObject *objArg,
assertSameCompartment(cx, obj); assertSameCompartment(cx, obj);
JSAtom *atom = AtomizeChars<CanGC>(cx, name, AUTO_NAMELEN(name, namelen)); JSAtom *atom = AtomizeChars<CanGC>(cx, name, AUTO_NAMELEN(name, namelen));
if (!atom) if (!atom)
return NULL; return nullptr;
Rooted<jsid> id(cx, AtomToId(atom)); Rooted<jsid> id(cx, AtomToId(atom));
return DefineFunction(cx, obj, id, call, nargs, attrs); return DefineFunction(cx, obj, id, call, nargs, attrs);
} }
@ -4419,7 +4420,7 @@ class AutoFile
FILE *fp_; FILE *fp_;
public: public:
AutoFile() AutoFile()
: fp_(NULL) : fp_(nullptr)
{} {}
~AutoFile() ~AutoFile()
{ {
@ -4438,7 +4439,7 @@ class AutoFile
} /* anonymous namespace */ } /* anonymous namespace */
/* /*
* Open a source file for reading. Supports "-" and NULL to mean stdin. The * Open a source file for reading. Supports "-" and nullptr to mean stdin. The
* return value must be fclosed unless it is stdin. * return value must be fclosed unless it is stdin.
*/ */
bool bool
@ -4449,7 +4450,7 @@ AutoFile::open(JSContext *cx, const char *filename)
} else { } else {
fp_ = fopen(filename, "r"); fp_ = fopen(filename, "r");
if (!fp_) { if (!fp_) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_CANT_OPEN, JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_CANT_OPEN,
filename, "No such file or directory"); filename, "No such file or directory");
return false; return false;
} }
@ -4459,13 +4460,13 @@ AutoFile::open(JSContext *cx, const char *filename)
JS::CompileOptions::CompileOptions(JSContext *cx, JSVersion version) JS::CompileOptions::CompileOptions(JSContext *cx, JSVersion version)
: principals_(NULL), : principals_(nullptr),
originPrincipals_(NULL), originPrincipals_(nullptr),
version(version != JSVERSION_UNKNOWN ? version : cx->findVersion()), version(version != JSVERSION_UNKNOWN ? version : cx->findVersion()),
versionSet(false), versionSet(false),
utf8(false), utf8(false),
filename(NULL), filename(nullptr),
sourceMapURL(NULL), sourceMapURL(nullptr),
lineno(1), lineno(1),
column(0), column(0),
element(NullPtr()), element(NullPtr()),
@ -4512,7 +4513,7 @@ JS::Compile(JSContext *cx, HandleObject obj, CompileOptions options,
else else
chars = InflateString(cx, bytes, &length); chars = InflateString(cx, bytes, &length);
if (!chars) if (!chars)
return NULL; return nullptr;
JSScript *script = Compile(cx, obj, options, chars, length); JSScript *script = Compile(cx, obj, options, chars, length);
js_free(chars); js_free(chars);
@ -4524,7 +4525,7 @@ JS::Compile(JSContext *cx, HandleObject obj, CompileOptions options, FILE *fp)
{ {
FileContents buffer(cx); FileContents buffer(cx);
if (!ReadCompleteFile(cx, fp, buffer)) if (!ReadCompleteFile(cx, fp, buffer))
return NULL; return nullptr;
JSScript *script = Compile(cx, obj, options, buffer.begin(), buffer.length()); JSScript *script = Compile(cx, obj, options, buffer.begin(), buffer.length());
return script; return script;
@ -4535,7 +4536,7 @@ JS::Compile(JSContext *cx, HandleObject obj, CompileOptions options, const char
{ {
AutoFile file; AutoFile file;
if (!file.open(cx, filename)) if (!file.open(cx, filename))
return NULL; return nullptr;
options = options.setFileAndLine(filename, 1); options = options.setFileAndLine(filename, 1);
JSScript *script = Compile(cx, obj, options, file.fp()); JSScript *script = Compile(cx, obj, options, file.fp());
return script; return script;
@ -4568,7 +4569,7 @@ JS::CanCompileOffThread(JSContext *cx, const CompileOptions &options)
"chrome://browser/content/newtab/newTab.js", "chrome://browser/content/newtab/newTab.js",
"chrome://browser/content/places/browserPlacesViews.js", "chrome://browser/content/places/browserPlacesViews.js",
#endif #endif
NULL nullptr
}; };
const char *filename = options.filename; const char *filename = options.filename;
@ -4682,8 +4683,8 @@ JS_BufferIsCompilableUnit(JSContext *cx, JSObject *objArg, const char *utf8, siz
options.setCompileAndGo(false); options.setCompileAndGo(false);
Parser<frontend::FullParseHandler> parser(cx, &cx->tempLifoAlloc(), Parser<frontend::FullParseHandler> parser(cx, &cx->tempLifoAlloc(),
options, chars, length, options, chars, length,
/* foldConstants = */ true, NULL, NULL); /* foldConstants = */ true, nullptr, nullptr);
older = JS_SetErrorReporter(cx, NULL); older = JS_SetErrorReporter(cx, nullptr);
if (!parser.parse(obj) && parser.isUnexpectedEOF()) { if (!parser.parse(obj) && parser.isUnexpectedEOF()) {
/* /*
* We ran into an error. If it was because we ran out of * We ran into an error. If it was because we ran out of
@ -4722,29 +4723,29 @@ JS::CompileFunction(JSContext *cx, HandleObject obj, CompileOptions options,
if (name) { if (name) {
funAtom = Atomize(cx, name, strlen(name)); funAtom = Atomize(cx, name, strlen(name));
if (!funAtom) if (!funAtom)
return NULL; return nullptr;
} }
AutoNameVector formals(cx); AutoNameVector formals(cx);
for (unsigned i = 0; i < nargs; i++) { for (unsigned i = 0; i < nargs; i++) {
RootedAtom argAtom(cx, Atomize(cx, argnames[i], strlen(argnames[i]))); RootedAtom argAtom(cx, Atomize(cx, argnames[i], strlen(argnames[i])));
if (!argAtom || !formals.append(argAtom->asPropertyName())) if (!argAtom || !formals.append(argAtom->asPropertyName()))
return NULL; return nullptr;
} }
RootedFunction fun(cx, NewFunction(cx, NullPtr(), NULL, 0, JSFunction::INTERPRETED, obj, RootedFunction fun(cx, NewFunction(cx, NullPtr(), nullptr, 0, JSFunction::INTERPRETED, obj,
funAtom, JSFunction::FinalizeKind, TenuredObject)); funAtom, JSFunction::FinalizeKind, TenuredObject));
if (!fun) if (!fun)
return NULL; return nullptr;
if (!frontend::CompileFunctionBody(cx, &fun, options, formals, chars, length)) if (!frontend::CompileFunctionBody(cx, &fun, options, formals, chars, length))
return NULL; return nullptr;
if (obj && funAtom) { if (obj && funAtom) {
Rooted<jsid> id(cx, AtomToId(funAtom)); Rooted<jsid> id(cx, AtomToId(funAtom));
RootedValue value(cx, ObjectValue(*fun)); RootedValue value(cx, ObjectValue(*fun));
if (!JSObject::defineGeneric(cx, obj, id, value, NULL, NULL, JSPROP_ENUMERATE)) if (!JSObject::defineGeneric(cx, obj, id, value, nullptr, nullptr, JSPROP_ENUMERATE))
return NULL; return nullptr;
} }
return fun; return fun;
@ -4761,7 +4762,7 @@ JS::CompileFunction(JSContext *cx, HandleObject obj, CompileOptions options,
else else
chars = InflateString(cx, bytes, &length); chars = InflateString(cx, bytes, &length);
if (!chars) if (!chars)
return NULL; return nullptr;
JSFunction *fun = CompileFunction(cx, obj, options, name, nargs, argnames, chars, length); JSFunction *fun = CompileFunction(cx, obj, options, name, nargs, argnames, chars, length);
js_free(chars); js_free(chars);
@ -4822,7 +4823,7 @@ JS_DecompileScript(JSContext *cx, JSScript *scriptArg, const char *name, unsigne
return JS_DecompileFunction(cx, fun, indent); return JS_DecompileFunction(cx, fun, indent);
bool haveSource = script->scriptSource()->hasSourceData(); bool haveSource = script->scriptSource()->hasSourceData();
if (!haveSource && !JSScript::loadSource(cx, script->scriptSource(), &haveSource)) if (!haveSource && !JSScript::loadSource(cx, script->scriptSource(), &haveSource))
return NULL; return nullptr;
return haveSource ? script->sourceData(cx) : js_NewStringCopyZ<CanGC>(cx, "[no source]"); return haveSource ? script->sourceData(cx) : js_NewStringCopyZ<CanGC>(cx, "[no source]");
} }
@ -4908,7 +4909,7 @@ JS::Evaluate(JSContext *cx, HandleObject obj, CompileOptions options,
SourceCompressionTask sct(cx); SourceCompressionTask sct(cx);
RootedScript script(cx, frontend::CompileScript(cx, &cx->tempLifoAlloc(), RootedScript script(cx, frontend::CompileScript(cx, &cx->tempLifoAlloc(),
obj, NullPtr(), options, obj, NullPtr(), options,
chars, length, NULL, 0, &sct)); chars, length, nullptr, 0, &sct));
if (!script) if (!script)
return false; return false;
@ -4924,7 +4925,7 @@ JS::Evaluate(JSContext *cx, HandleObject obj, CompileOptions options,
// to clear out this analysis data before anything happens to inhibit the // to clear out this analysis data before anything happens to inhibit the
// flushing of this memory (such as setting requestAnimationFrame). // flushing of this memory (such as setting requestAnimationFrame).
if (script->length > LARGE_SCRIPT_LENGTH) { if (script->length > LARGE_SCRIPT_LENGTH) {
script = NULL; script = nullptr;
PrepareZoneForGC(cx->zone()); PrepareZoneForGC(cx->zone());
GC(cx->runtime(), GC_NORMAL, gcreason::FINISH_LARGE_EVALUTE); GC(cx->runtime(), GC_NORMAL, gcreason::FINISH_LARGE_EVALUTE);
} }
@ -5154,14 +5155,14 @@ JS_New(JSContext *cx, JSObject *ctorArg, unsigned argc, jsval *argv)
// among other details. InvokeConstructor does the hard work. // among other details. InvokeConstructor does the hard work.
InvokeArgs args(cx); InvokeArgs args(cx);
if (!args.init(argc)) if (!args.init(argc))
return NULL; return nullptr;
args.setCallee(ObjectValue(*ctor)); args.setCallee(ObjectValue(*ctor));
args.setThis(NullValue()); args.setThis(NullValue());
PodCopy(args.array(), argv, argc); PodCopy(args.array(), argv, argc);
if (!InvokeConstructor(cx, args)) if (!InvokeConstructor(cx, args))
return NULL; return nullptr;
if (!args.rval().isObject()) { if (!args.rval().isObject()) {
/* /*
@ -5170,10 +5171,10 @@ JS_New(JSContext *cx, JSObject *ctorArg, unsigned argc, jsval *argv)
*/ */
JSAutoByteString bytes; JSAutoByteString bytes;
if (js_ValueToPrintable(cx, args.rval(), &bytes)) { if (js_ValueToPrintable(cx, args.rval(), &bytes)) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_BAD_NEW_RESULT, JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_BAD_NEW_RESULT,
bytes.ptr()); bytes.ptr());
} }
return NULL; return nullptr;
} }
return &args.rval().toObject(); return &args.rval().toObject();
@ -5258,7 +5259,7 @@ JS_NewStringCopyZ(JSContext *cx, const char *s)
n = strlen(s); n = strlen(s);
js = InflateString(cx, s, &n); js = InflateString(cx, s, &n);
if (!js) if (!js)
return NULL; return nullptr;
str = js_NewString<CanGC>(cx, js, n); str = js_NewString<CanGC>(cx, js, n);
if (!str) if (!str)
js_free(js); js_free(js);
@ -5379,7 +5380,7 @@ JS_GetStringCharsZAndLength(JSContext *cx, JSString *str, size_t *plength)
CHECK_REQUEST(cx); CHECK_REQUEST(cx);
JSFlatString *flat = str->ensureFlat(cx); JSFlatString *flat = str->ensureFlat(cx);
if (!flat) if (!flat)
return NULL; return nullptr;
*plength = flat->length(); *plength = flat->length();
return flat->chars(); return flat->chars();
} }
@ -5393,7 +5394,7 @@ JS_GetStringCharsAndLength(JSContext *cx, JSString *str, size_t *plength)
assertSameCompartment(cx, str); assertSameCompartment(cx, str);
JSLinearString *linear = str->ensureLinear(cx); JSLinearString *linear = str->ensureLinear(cx);
if (!linear) if (!linear)
return NULL; return nullptr;
*plength = linear->length(); *plength = linear->length();
return linear->chars(); return linear->chars();
} }
@ -5402,9 +5403,9 @@ JS_PUBLIC_API(const jschar *)
JS_GetInternedStringChars(JSString *str) JS_GetInternedStringChars(JSString *str)
{ {
JS_ASSERT(str->isAtom()); JS_ASSERT(str->isAtom());
JSFlatString *flat = str->ensureFlat(NULL); JSFlatString *flat = str->ensureFlat(nullptr);
if (!flat) if (!flat)
return NULL; return nullptr;
return flat->chars(); return flat->chars();
} }
@ -5413,9 +5414,9 @@ JS_GetInternedStringCharsAndLength(JSString *str, size_t *plength)
{ {
JS_ASSERT(str->isAtom()); JS_ASSERT(str->isAtom());
JS_ASSERT(plength); JS_ASSERT(plength);
JSFlatString *flat = str->ensureFlat(NULL); JSFlatString *flat = str->ensureFlat(nullptr);
if (!flat) if (!flat)
return NULL; return nullptr;
*plength = flat->length(); *plength = flat->length();
return flat->chars(); return flat->chars();
} }
@ -5428,7 +5429,7 @@ JS_FlattenString(JSContext *cx, JSString *str)
assertSameCompartment(cx, str); assertSameCompartment(cx, str);
JSFlatString *flat = str->ensureFlat(cx); JSFlatString *flat = str->ensureFlat(cx);
if (!flat) if (!flat)
return NULL; return nullptr;
return flat; return flat;
} }
@ -5485,7 +5486,7 @@ JS_PutEscapedString(JSContext *cx, char *buffer, size_t size, JSString *str, cha
JS_PUBLIC_API(bool) JS_PUBLIC_API(bool)
JS_FileEscapedString(FILE *fp, JSString *str, char quote) JS_FileEscapedString(FILE *fp, JSString *str, char quote)
{ {
JSLinearString *linearStr = str->ensureLinear(NULL); JSLinearString *linearStr = str->ensureLinear(nullptr);
return linearStr && FileEscapedString(fp, linearStr, quote); return linearStr && FileEscapedString(fp, linearStr, quote);
} }
@ -5522,7 +5523,7 @@ JS_DecodeBytes(JSContext *cx, const char *src, size_t srclen, jschar *dst, size_
InflateStringToBuffer(src, dstlen, dst); InflateStringToBuffer(src, dstlen, dst);
AutoSuppressGC suppress(cx); AutoSuppressGC suppress(cx);
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_BUFFER_TOO_SMALL); JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_BUFFER_TOO_SMALL);
return false; return false;
} }
@ -5539,7 +5540,7 @@ JS_EncodeString(JSContext *cx, JSString *str)
JSLinearString *linear = str->ensureLinear(cx); JSLinearString *linear = str->ensureLinear(cx);
if (!linear) if (!linear)
return NULL; return nullptr;
return LossyTwoByteCharsToNewLatin1CharsZ(cx, linear->range()).c_str(); return LossyTwoByteCharsToNewLatin1CharsZ(cx, linear->range()).c_str();
} }
@ -5552,7 +5553,7 @@ JS_EncodeStringToUTF8(JSContext *cx, JSString *str)
JSLinearString *linear = str->ensureLinear(cx); JSLinearString *linear = str->ensureLinear(cx);
if (!linear) if (!linear)
return NULL; return nullptr;
return TwoByteCharsToNewUTF8CharsZ(cx, linear->range()).c_str(); return TwoByteCharsToNewUTF8CharsZ(cx, linear->range()).c_str();
} }
@ -5581,10 +5582,10 @@ JS_EncodeStringToBuffer(JSContext *cx, JSString *str, char *buffer, size_t lengt
* error. * error.
*/ */
size_t writtenLength = length; size_t writtenLength = length;
const jschar *chars = str->getChars(NULL); const jschar *chars = str->getChars(nullptr);
if (!chars) if (!chars)
return size_t(-1); return size_t(-1);
if (DeflateStringToBuffer(NULL, chars, str->length(), buffer, &writtenLength)) { if (DeflateStringToBuffer(nullptr, chars, str->length(), buffer, &writtenLength)) {
JS_ASSERT(writtenLength <= length); JS_ASSERT(writtenLength <= length);
return writtenLength; return writtenLength;
} }
@ -5808,11 +5809,11 @@ JS_NewRegExpObject(JSContext *cx, HandleObject obj, char *bytes, size_t length,
CHECK_REQUEST(cx); CHECK_REQUEST(cx);
jschar *chars = InflateString(cx, bytes, &length); jschar *chars = InflateString(cx, bytes, &length);
if (!chars) if (!chars)
return NULL; return nullptr;
RegExpStatics *res = obj->as<GlobalObject>().getRegExpStatics(); RegExpStatics *res = obj->as<GlobalObject>().getRegExpStatics();
RegExpObject *reobj = RegExpObject::create(cx, res, chars, length, RegExpObject *reobj = RegExpObject::create(cx, res, chars, length,
RegExpFlag(flags), NULL); RegExpFlag(flags), nullptr);
js_free(chars); js_free(chars);
return reobj; return reobj;
} }
@ -5825,7 +5826,7 @@ JS_NewUCRegExpObject(JSContext *cx, HandleObject obj, jschar *chars, size_t leng
CHECK_REQUEST(cx); CHECK_REQUEST(cx);
RegExpStatics *res = obj->as<GlobalObject>().getRegExpStatics(); RegExpStatics *res = obj->as<GlobalObject>().getRegExpStatics();
return RegExpObject::create(cx, res, chars, length, return RegExpObject::create(cx, res, chars, length,
RegExpFlag(flags), NULL); RegExpFlag(flags), nullptr);
} }
JS_PUBLIC_API(void) JS_PUBLIC_API(void)
@ -5868,9 +5869,9 @@ JS_NewRegExpObjectNoStatics(JSContext *cx, char *bytes, size_t length, unsigned
CHECK_REQUEST(cx); CHECK_REQUEST(cx);
jschar *chars = InflateString(cx, bytes, &length); jschar *chars = InflateString(cx, bytes, &length);
if (!chars) if (!chars)
return NULL; return nullptr;
RegExpObject *reobj = RegExpObject::createNoStatics(cx, chars, length, RegExpObject *reobj = RegExpObject::createNoStatics(cx, chars, length,
RegExpFlag(flags), NULL); RegExpFlag(flags), nullptr);
js_free(chars); js_free(chars);
return reobj; return reobj;
} }
@ -5881,7 +5882,7 @@ JS_NewUCRegExpObjectNoStatics(JSContext *cx, jschar *chars, size_t length, unsig
AssertHeapIsIdle(cx); AssertHeapIsIdle(cx);
CHECK_REQUEST(cx); CHECK_REQUEST(cx);
return RegExpObject::createNoStatics(cx, chars, length, return RegExpObject::createNoStatics(cx, chars, length,
RegExpFlag(flags), NULL); RegExpFlag(flags), nullptr);
} }
JS_PUBLIC_API(bool) JS_PUBLIC_API(bool)
@ -5891,8 +5892,8 @@ JS_ExecuteRegExpNoStatics(JSContext *cx, HandleObject obj, jschar *chars, size_t
AssertHeapIsIdle(cx); AssertHeapIsIdle(cx);
CHECK_REQUEST(cx); CHECK_REQUEST(cx);
return ExecuteRegExpLegacy(cx, NULL, obj->as<RegExpObject>(), NullPtr(), chars, length, indexp, return ExecuteRegExpLegacy(cx, nullptr, obj->as<RegExpObject>(), NullPtr(), chars, length,
test, rval); indexp, test, rval);
} }
JS_PUBLIC_API(bool) JS_PUBLIC_API(bool)
@ -6064,7 +6065,7 @@ JS_ThrowReportedError(JSContext *cx, const char *message,
{ {
AssertHeapIsIdle(cx); AssertHeapIsIdle(cx);
return JS_IsRunning(cx) && return JS_IsRunning(cx) &&
js_ErrorToException(cx, message, reportp, NULL, NULL); js_ErrorToException(cx, message, reportp, nullptr, nullptr);
} }
JS_PUBLIC_API(bool) JS_PUBLIC_API(bool)
@ -6207,7 +6208,7 @@ JS_IsIdentifier(JSContext *cx, HandleString str, bool *isIdentifier)
JS_PUBLIC_API(bool) JS_PUBLIC_API(bool)
JS_DescribeScriptedCaller(JSContext *cx, MutableHandleScript script, unsigned *lineno) JS_DescribeScriptedCaller(JSContext *cx, MutableHandleScript script, unsigned *lineno)
{ {
script.set(NULL); script.set(nullptr);
if (lineno) if (lineno)
*lineno = 0; *lineno = 0;
@ -6279,7 +6280,7 @@ JS_EncodeScript(JSContext *cx, HandleScript scriptArg, uint32_t *lengthp)
XDREncoder encoder(cx); XDREncoder encoder(cx);
RootedScript script(cx, scriptArg); RootedScript script(cx, scriptArg);
if (!encoder.codeScript(&script)) if (!encoder.codeScript(&script))
return NULL; return nullptr;
return encoder.forgetData(lengthp); return encoder.forgetData(lengthp);
} }
@ -6289,7 +6290,7 @@ JS_EncodeInterpretedFunction(JSContext *cx, HandleObject funobjArg, uint32_t *le
XDREncoder encoder(cx); XDREncoder encoder(cx);
RootedObject funobj(cx, funobjArg); RootedObject funobj(cx, funobjArg);
if (!encoder.codeFunction(&funobj)) if (!encoder.codeFunction(&funobj))
return NULL; return nullptr;
return encoder.forgetData(lengthp); return encoder.forgetData(lengthp);
} }
@ -6300,7 +6301,7 @@ JS_DecodeScript(JSContext *cx, const void *data, uint32_t length,
XDRDecoder decoder(cx, data, length, principals, originPrincipals); XDRDecoder decoder(cx, data, length, principals, originPrincipals);
RootedScript script(cx); RootedScript script(cx);
if (!decoder.codeScript(&script)) if (!decoder.codeScript(&script))
return NULL; return nullptr;
return script; return script;
} }
@ -6311,7 +6312,7 @@ JS_DecodeInterpretedFunction(JSContext *cx, const void *data, uint32_t length,
XDRDecoder decoder(cx, data, length, principals, originPrincipals); XDRDecoder decoder(cx, data, length, principals, originPrincipals);
RootedObject funobj(cx); RootedObject funobj(cx);
if (!decoder.codeFunction(&funobj)) if (!decoder.codeFunction(&funobj))
return NULL; return nullptr;
return funobj; return funobj;
} }
@ -6340,7 +6341,7 @@ JSAutoByteString::encodeLatin1(ExclusiveContext *cx, JSString *str)
{ {
JSLinearString *linear = str->ensureLinear(cx); JSLinearString *linear = str->ensureLinear(cx);
if (!linear) if (!linear)
return NULL; return nullptr;
mBytes = LossyTwoByteCharsToNewLatin1CharsZ(cx, linear->range()).c_str(); mBytes = LossyTwoByteCharsToNewLatin1CharsZ(cx, linear->range()).c_str();
return mBytes; return mBytes;

Просмотреть файл

@ -150,7 +150,7 @@ class JS_PUBLIC_API(AutoGCRooter) {
class AutoStringRooter : private AutoGCRooter { class AutoStringRooter : private AutoGCRooter {
public: public:
AutoStringRooter(JSContext *cx, JSString *str = NULL AutoStringRooter(JSContext *cx, JSString *str = nullptr
MOZ_GUARD_OBJECT_NOTIFIER_PARAM) MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: AutoGCRooter(cx, STRING), str_(str) : AutoGCRooter(cx, STRING), str_(str)
{ {
@ -802,10 +802,10 @@ typedef bool
* Callback used to ask the embedding for the cross compartment wrapper handler * Callback used to ask the embedding for the cross compartment wrapper handler
* that implements the desired prolicy for this kind of object in the * that implements the desired prolicy for this kind of object in the
* destination compartment. |obj| is the object to be wrapped. If |existing| is * destination compartment. |obj| is the object to be wrapped. If |existing| is
* non-NULL, it will point to an existing wrapper object that should be re-used * non-nullptr, it will point to an existing wrapper object that should be
* if possible. |existing| is guaranteed to be a cross-compartment wrapper with * re-used if possible. |existing| is guaranteed to be a cross-compartment
* a lazily-defined prototype and the correct global. It is guaranteed not to * wrapper with a lazily-defined prototype and the correct global. It is
* wrap a function. * guaranteed not to wrap a function.
*/ */
typedef JSObject * typedef JSObject *
(* JSWrapObjectCallback)(JSContext *cx, JS::Handle<JSObject*> existing, JS::Handle<JSObject*> obj, (* JSWrapObjectCallback)(JSContext *cx, JS::Handle<JSObject*> existing, JS::Handle<JSObject*> obj,
@ -1329,7 +1329,7 @@ JS_DestroyRuntime(JSRuntime *rt);
// These are equivalent to ICU's |UMemAllocFn|, |UMemReallocFn|, and // These are equivalent to ICU's |UMemAllocFn|, |UMemReallocFn|, and
// |UMemFreeFn| types. The first argument (called |context| in the ICU docs) // |UMemFreeFn| types. The first argument (called |context| in the ICU docs)
// will always be NULL, and should be ignored. // will always be nullptr, and should be ignored.
typedef void *(*JS_ICUAllocFn)(const void *, size_t size); typedef void *(*JS_ICUAllocFn)(const void *, size_t size);
typedef void *(*JS_ICUReallocFn)(const void *, void *p, size_t size); typedef void *(*JS_ICUReallocFn)(const void *, void *p, size_t size);
typedef void (*JS_ICUFreeFn)(const void *, void *p); typedef void (*JS_ICUFreeFn)(const void *, void *p);
@ -1589,7 +1589,7 @@ extern JS_PUBLIC_API(bool)
JS_RefreshCrossCompartmentWrappers(JSContext *cx, JSObject *ob); JS_RefreshCrossCompartmentWrappers(JSContext *cx, JSObject *ob);
/* /*
* At any time, a JSContext has a current (possibly-NULL) compartment. * At any time, a JSContext has a current (possibly-nullptr) compartment.
* Compartments are described in: * Compartments are described in:
* *
* developer.mozilla.org/en-US/docs/SpiderMonkey/SpiderMonkey_compartments * developer.mozilla.org/en-US/docs/SpiderMonkey/SpiderMonkey_compartments
@ -1633,7 +1633,7 @@ class JS_PUBLIC_API(JSAutoCompartment)
~JSAutoCompartment(); ~JSAutoCompartment();
}; };
/* NB: This API is infallible; a NULL return value does not indicate error. */ /* NB: This API is infallible; a nullptr return value does not indicate error. */
extern JS_PUBLIC_API(JSCompartment *) extern JS_PUBLIC_API(JSCompartment *)
JS_EnterCompartment(JSContext *cx, JSObject *target); JS_EnterCompartment(JSContext *cx, JSObject *target);
@ -1718,8 +1718,8 @@ extern JS_PUBLIC_API(bool)
JS_IsGlobalObject(JSObject *obj); JS_IsGlobalObject(JSObject *obj);
/* /*
* May return NULL, if |c| never had a global (e.g. the atoms compartment), or * May return nullptr, if |c| never had a global (e.g. the atoms compartment),
* if |c|'s global has been collected. * or if |c|'s global has been collected.
*/ */
extern JS_PUBLIC_API(JSObject *) extern JS_PUBLIC_API(JSObject *)
JS_GetGlobalForCompartmentOrNull(JSContext *cx, JSCompartment *c); JS_GetGlobalForCompartmentOrNull(JSContext *cx, JSCompartment *c);
@ -1767,7 +1767,7 @@ typedef char *
/* /*
* Set of function pointers that ctypes can use for various internal functions. * Set of function pointers that ctypes can use for various internal functions.
* See JS_SetCTypesCallbacks below. Providing NULL for a function is safe, * See JS_SetCTypesCallbacks below. Providing nullptr for a function is safe,
* and will result in the applicable ctypes functionality not being available. * and will result in the applicable ctypes functionality not being available.
*/ */
struct JSCTypesCallbacks { struct JSCTypesCallbacks {
@ -1805,7 +1805,7 @@ JS_realloc(JSContext *cx, void *p, size_t nbytes);
/* /*
* A wrapper for js_free(p) that may delay js_free(p) invocation as a * A wrapper for js_free(p) that may delay js_free(p) invocation as a
* performance optimization. * performance optimization.
* cx may be NULL. * cx may be nullptr.
*/ */
extern JS_PUBLIC_API(void) extern JS_PUBLIC_API(void)
JS_free(JSContext *cx, void *p); JS_free(JSContext *cx, void *p);
@ -2153,8 +2153,8 @@ extern JS_PUBLIC_API(bool)
JS_IsExternalString(JSString *str); JS_IsExternalString(JSString *str);
/* /*
* Return the 'closure' arg passed to JS_NewExternalStringWithClosure or NULL * Return the 'closure' arg passed to JS_NewExternalStringWithClosure or
* if the external string was created via JS_NewExternalString. * nullptr if the external string was created via JS_NewExternalString.
*/ */
extern JS_PUBLIC_API(const JSStringFinalizer *) extern JS_PUBLIC_API(const JSStringFinalizer *)
JS_GetExternalStringFinalizer(JSString *str); JS_GetExternalStringFinalizer(JSString *str);
@ -2221,7 +2221,7 @@ class AutoIdArray : private AutoGCRooter
JSIdArray *steal() { JSIdArray *steal() {
JSIdArray *copy = idArray; JSIdArray *copy = idArray;
idArray = NULL; idArray = nullptr;
return copy; return copy;
} }
@ -2318,8 +2318,8 @@ typedef struct JSNativeWrapper {
* Macro static initializers which make it easy to pass no JSJitInfo as part of a * Macro static initializers which make it easy to pass no JSJitInfo as part of a
* JSPropertySpec or JSFunctionSpec. * JSPropertySpec or JSFunctionSpec.
*/ */
#define JSOP_WRAPPER(op) {op, NULL} #define JSOP_WRAPPER(op) {op, nullptr}
#define JSOP_NULLWRAPPER JSOP_WRAPPER(NULL) #define JSOP_NULLWRAPPER JSOP_WRAPPER(nullptr)
/* /*
* To define an array element rather than a named property member, cast the * To define an array element rather than a named property member, cast the
@ -2387,7 +2387,7 @@ struct JSFunctionSpec {
* Terminating sentinel initializer to put at the end of a JSFunctionSpec array * Terminating sentinel initializer to put at the end of a JSFunctionSpec array
* that's passed to JS_DefineFunctions or JS_InitClass. * that's passed to JS_DefineFunctions or JS_InitClass.
*/ */
#define JS_FS_END JS_FS(NULL,NULL,0,0) #define JS_FS_END JS_FS(nullptr,nullptr,0,0)
/* /*
* Initializer macros for a JSFunctionSpec array element. JS_FN (whose name pays * Initializer macros for a JSFunctionSpec array element. JS_FN (whose name pays
@ -2655,8 +2655,8 @@ struct JSPropertyDescriptor {
JSStrictPropertyOp setter; JSStrictPropertyOp setter;
JS::Value value; JS::Value value;
JSPropertyDescriptor() : obj(NULL), attrs(0), shortid(0), getter(NULL), JSPropertyDescriptor() : obj(nullptr), attrs(0), shortid(0), getter(nullptr),
setter(NULL), value(JSVAL_VOID) setter(nullptr), value(JSVAL_VOID)
{} {}
void trace(JSTracer *trc); void trace(JSTracer *trc);
@ -2712,11 +2712,11 @@ class MutablePropertyDescriptorOperations : public PropertyDescriptorOperations<
public: public:
void clear() { void clear() {
object().set(NULL); object().set(nullptr);
setAttributes(0); setAttributes(0);
setShortId(0); setShortId(0);
setGetter(NULL); setGetter(nullptr);
setSetter(NULL); setSetter(nullptr);
value().setUndefined(); value().setUndefined();
} }
@ -2985,9 +2985,9 @@ extern JS_PUBLIC_API(bool)
JS_AllocateArrayBufferContents(JSContext *cx, uint32_t nbytes, void **contents, uint8_t **data); JS_AllocateArrayBufferContents(JSContext *cx, uint32_t nbytes, void **contents, uint8_t **data);
/* /*
* Reallocate memory allocated by JS_AllocateArrayBufferContents, growing or shrinking it * Reallocate memory allocated by JS_AllocateArrayBufferContents, growing or
* as appropriate. The new data pointer will be returned in data. If *contents is NULL, * shrinking it as appropriate. The new data pointer will be returned in data.
* behaves like JS_AllocateArrayBufferContents. * If *contents is nullptr, behaves like JS_AllocateArrayBufferContents.
*/ */
extern JS_PUBLIC_API(bool) extern JS_PUBLIC_API(bool)
JS_ReallocateArrayBufferContents(JSContext *cx, uint32_t nbytes, void **contents, uint8_t **data); JS_ReallocateArrayBufferContents(JSContext *cx, uint32_t nbytes, void **contents, uint8_t **data);
@ -3084,7 +3084,7 @@ JS_GetSecurityCallbacks(JSRuntime *rt);
* there is no available JSContext. Instead, the caller must ensure that the * there is no available JSContext. Instead, the caller must ensure that the
* given principals stays valid for as long as 'rt' may point to it. If the * given principals stays valid for as long as 'rt' may point to it. If the
* principals would be destroyed before 'rt', JS_SetTrustedPrincipals must be * principals would be destroyed before 'rt', JS_SetTrustedPrincipals must be
* called again, passing NULL for 'prin'. * called again, passing nullptr for 'prin'.
*/ */
extern JS_PUBLIC_API(void) extern JS_PUBLIC_API(void)
JS_SetTrustedPrincipals(JSRuntime *rt, const JSPrincipals *prin); JS_SetTrustedPrincipals(JSRuntime *rt, const JSPrincipals *prin);
@ -3137,8 +3137,8 @@ JS_GetFunctionId(JSFunction *fun);
* Return a function's display name. This is the defined name if one was given * Return a function's display name. This is the defined name if one was given
* where the function was defined, or it could be an inferred name by the JS * where the function was defined, or it could be an inferred name by the JS
* engine in the case that the function was defined to be anonymous. This can * engine in the case that the function was defined to be anonymous. This can
* still return NULL if a useful display name could not be inferred. The same * still return nullptr if a useful display name could not be inferred. The
* restrictions on rooting as those in JS_GetFunctionId apply. * same restrictions on rooting as those in JS_GetFunctionId apply.
*/ */
extern JS_PUBLIC_API(JSString *) extern JS_PUBLIC_API(JSString *)
JS_GetFunctionDisplayId(JSFunction *fun); JS_GetFunctionDisplayId(JSFunction *fun);
@ -3171,7 +3171,7 @@ JS_IsConstructor(JSFunction *fun);
/* /*
* Bind the given callable to use the given object as "this". * Bind the given callable to use the given object as "this".
* *
* If |callable| is not callable, will throw and return NULL. * If |callable| is not callable, will throw and return nullptr.
*/ */
extern JS_PUBLIC_API(JSObject*) extern JS_PUBLIC_API(JSObject*)
JS_BindCallable(JSContext *cx, JSObject *callable, JSObject *newThis); JS_BindCallable(JSContext *cx, JSObject *callable, JSObject *newThis);
@ -3332,8 +3332,8 @@ CanCompileOffThread(JSContext *cx, const CompileOptions &options);
* for the compilation. The callback will be invoked while off the main thread, * for the compilation. The callback will be invoked while off the main thread,
* so must ensure that its operations are thread safe. Afterwards, * so must ensure that its operations are thread safe. Afterwards,
* FinishOffThreadScript must be invoked on the main thread to get the result * FinishOffThreadScript must be invoked on the main thread to get the result
* script or NULL. If maybecx is specified, this method will also report any * script or nullptr. If maybecx is specified, this method will also report
* error or warnings generated during the parse. * any error or warnings generated during the parse.
* *
* The characters passed in to CompileOffThread must remain live until the * The characters passed in to CompileOffThread must remain live until the
* callback is invoked, and the resulting script will be rooted until the call * callback is invoked, and the resulting script will be rooted until the call
@ -3763,10 +3763,10 @@ JS_ConcatStrings(JSContext *cx, JS::HandleString left, JS::HandleString right);
* For JS_DecodeBytes, set *dstlenp to the size of the destination buffer before * For JS_DecodeBytes, set *dstlenp to the size of the destination buffer before
* the call; on return, *dstlenp contains the number of jschars actually stored. * the call; on return, *dstlenp contains the number of jschars actually stored.
* To determine the necessary destination buffer size, make a sizing call that * To determine the necessary destination buffer size, make a sizing call that
* passes NULL for dst. * passes nullptr for dst.
* *
* On errors, the functions report the error. In that case, *dstlenp contains * On errors, the functions report the error. In that case, *dstlenp contains
* the number of characters or bytes transferred so far. If cx is NULL, no * the number of characters or bytes transferred so far. If cx is nullptr, no
* error is reported on failure, and the functions simply return false. * error is reported on failure, and the functions simply return false.
* *
* NB: This function does not store an additional zero byte or jschar after the * NB: This function does not store an additional zero byte or jschar after the
@ -3820,7 +3820,7 @@ class JSAutoByteString
} }
JSAutoByteString(MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM) JSAutoByteString(MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM)
: mBytes(NULL) : mBytes(nullptr)
{ {
MOZ_GUARD_OBJECT_NOTIFIER_INIT; MOZ_GUARD_OBJECT_NOTIFIER_INIT;
} }
@ -3853,7 +3853,7 @@ class JSAutoByteString
void clear() { void clear() {
js_free(mBytes); js_free(mBytes);
mBytes = NULL; mBytes = nullptr;
} }
char *ptr() const { char *ptr() const {
@ -3933,14 +3933,14 @@ struct JSLocaleCallbacks {
/* /*
* Establish locale callbacks. The pointer must persist as long as the * Establish locale callbacks. The pointer must persist as long as the
* JSRuntime. Passing NULL restores the default behaviour. * JSRuntime. Passing nullptr restores the default behaviour.
*/ */
extern JS_PUBLIC_API(void) extern JS_PUBLIC_API(void)
JS_SetLocaleCallbacks(JSRuntime *rt, JSLocaleCallbacks *callbacks); JS_SetLocaleCallbacks(JSRuntime *rt, JSLocaleCallbacks *callbacks);
/* /*
* Return the address of the current locale callbacks struct, which may * Return the address of the current locale callbacks struct, which may
* be NULL. * be nullptr.
*/ */
extern JS_PUBLIC_API(JSLocaleCallbacks *) extern JS_PUBLIC_API(JSLocaleCallbacks *)
JS_GetLocaleCallbacks(JSRuntime *rt); JS_GetLocaleCallbacks(JSRuntime *rt);
@ -4182,9 +4182,9 @@ JS_DropExceptionState(JSContext *cx, JSExceptionState *state);
/* /*
* If the given value is an exception object that originated from an error, * If the given value is an exception object that originated from an error,
* the exception will contain an error report struct, and this API will return * the exception will contain an error report struct, and this API will return
* the address of that struct. Otherwise, it returns NULL. The lifetime of * the address of that struct. Otherwise, it returns nullptr. The lifetime
* the error report struct that might be returned is the same as the lifetime * of the error report struct that might be returned is the same as the
* of the exception object. * lifetime of the exception object.
*/ */
extern JS_PUBLIC_API(JSErrorReport *) extern JS_PUBLIC_API(JSErrorReport *)
JS_ErrorFromException(JSContext *cx, JS::HandleValue v); JS_ErrorFromException(JSContext *cx, JS::HandleValue v);

Просмотреть файл

@ -37,7 +37,7 @@ ProxyObject::New(JSContext *cx, BaseProxyHandler *handler, HandleValue priv, Tag
if (proto.isObject() && !options.singleton()) { if (proto.isObject() && !options.singleton()) {
RootedObject protoObj(cx, proto.toObject()); RootedObject protoObj(cx, proto.toObject());
if (!JSObject::setNewTypeUnknown(cx, clasp, protoObj)) if (!JSObject::setNewTypeUnknown(cx, clasp, protoObj))
return NULL; return nullptr;
} }
NewObjectKind newKind = NewObjectKind newKind =
@ -47,7 +47,7 @@ ProxyObject::New(JSContext *cx, BaseProxyHandler *handler, HandleValue priv, Tag
allocKind = GetBackgroundAllocKind(allocKind); allocKind = GetBackgroundAllocKind(allocKind);
RootedObject obj(cx, NewObjectWithGivenProto(cx, clasp, proto, parent, allocKind, newKind)); RootedObject obj(cx, NewObjectWithGivenProto(cx, clasp, proto, parent, allocKind, newKind));
if (!obj) if (!obj)
return NULL; return nullptr;
Rooted<ProxyObject*> proxy(cx, &obj->as<ProxyObject>()); Rooted<ProxyObject*> proxy(cx, &obj->as<ProxyObject>());
proxy->initHandler(handler); proxy->initHandler(handler);