зеркало из https://github.com/mozilla/gecko-dev.git
Bug 784739 - Switch from NULL to nullptr in js/src/ (2/9); r=ehsan
--HG-- extra : rebase_source : 7592571554a847499941ea8c5b86c0af1cbedb3f
This commit is contained in:
Родитель
075a3ea1b6
Коммит
7eed164102
|
@ -277,7 +277,7 @@ SetArrayElement(JSContext *cx, HandleObject obj, double index, HandleValue v)
|
|||
break;
|
||||
uint32_t idx = uint32_t(index);
|
||||
if (idx >= arr->length() && !arr->lengthIsWritable()) {
|
||||
JS_ReportErrorFlagsAndNumber(cx, JSREPORT_ERROR, js_GetErrorMessage, NULL,
|
||||
JS_ReportErrorFlagsAndNumber(cx, JSREPORT_ERROR, js_GetErrorMessage, nullptr,
|
||||
JSMSG_CANT_REDEFINE_ARRAY_LENGTH);
|
||||
return false;
|
||||
}
|
||||
|
@ -393,7 +393,7 @@ array_length_setter(JSContext *cx, HandleObject obj, HandleId id, bool strict, M
|
|||
{
|
||||
if (!obj->is<ArrayObject>()) {
|
||||
return JSObject::defineProperty(cx, obj, cx->names().length, vp,
|
||||
NULL, NULL, JSPROP_ENUMERATE);
|
||||
nullptr, nullptr, JSPROP_ENUMERATE);
|
||||
}
|
||||
|
||||
Rooted<ArrayObject*> arr(cx, &obj->as<ArrayObject>());
|
||||
|
@ -424,7 +424,8 @@ js::CanonicalizeArrayLengthValue(JSContext *cx, HandleValue v, uint32_t *newLen)
|
|||
return true;
|
||||
|
||||
if (cx->isJSContext())
|
||||
JS_ReportErrorNumber(cx->asJSContext(), js_GetErrorMessage, NULL, JSMSG_BAD_ARRAY_LENGTH);
|
||||
JS_ReportErrorNumber(cx->asJSContext(), js_GetErrorMessage, nullptr,
|
||||
JSMSG_BAD_ARRAY_LENGTH);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -479,7 +480,7 @@ js::ArraySetLength(JSContext *cx, Handle<ArrayObject*> arr, HandleId id, unsigne
|
|||
|
||||
if (setterIsStrict) {
|
||||
return JS_ReportErrorFlagsAndNumber(cx->asJSContext(),
|
||||
JSREPORT_ERROR, js_GetErrorMessage, NULL,
|
||||
JSREPORT_ERROR, js_GetErrorMessage, nullptr,
|
||||
JSMSG_CANT_REDEFINE_ARRAY_LENGTH);
|
||||
}
|
||||
|
||||
|
@ -708,7 +709,7 @@ js::WouldDefinePastNonwritableLength(ExclusiveContext *cx,
|
|||
// Error in strict mode code or warn with strict option.
|
||||
// XXX include the index and maybe array length in the error message
|
||||
unsigned flags = strict ? JSREPORT_ERROR : (JSREPORT_STRICT | JSREPORT_WARNING);
|
||||
return JS_ReportErrorFlagsAndNumber(ncx, flags, js_GetErrorMessage, NULL,
|
||||
return JS_ReportErrorFlagsAndNumber(ncx, flags, js_GetErrorMessage, nullptr,
|
||||
JSMSG_CANT_DEFINE_PAST_ARRAY_LENGTH);
|
||||
}
|
||||
|
||||
|
@ -750,7 +751,7 @@ js::ObjectMayHaveExtraIndexedProperties(JSObject *obj)
|
|||
* exists. If we hit the end of the prototype chain, it's safe to set the
|
||||
* element on the original object.
|
||||
*/
|
||||
while ((obj = obj->getProto()) != NULL) {
|
||||
while ((obj = obj->getProto()) != nullptr) {
|
||||
/*
|
||||
* If the prototype is a non-native object (possibly a dense array), or
|
||||
* a native object (possibly a slow array) that has indexed properties,
|
||||
|
@ -777,16 +778,16 @@ const Class ArrayObject::class_ = {
|
|||
JS_EnumerateStub,
|
||||
JS_ResolveStub,
|
||||
JS_ConvertStub,
|
||||
NULL,
|
||||
NULL, /* checkAccess */
|
||||
NULL, /* call */
|
||||
NULL, /* hasInstance */
|
||||
NULL, /* construct */
|
||||
NULL, /* trace */
|
||||
nullptr,
|
||||
nullptr, /* checkAccess */
|
||||
nullptr, /* call */
|
||||
nullptr, /* hasInstance */
|
||||
nullptr, /* construct */
|
||||
nullptr, /* trace */
|
||||
{
|
||||
NULL, /* outerObject */
|
||||
NULL, /* innerObject */
|
||||
NULL, /* iteratorObject */
|
||||
nullptr, /* outerObject */
|
||||
nullptr, /* innerObject */
|
||||
nullptr, /* iteratorObject */
|
||||
false, /* isWrappedNative */
|
||||
}
|
||||
};
|
||||
|
@ -977,7 +978,7 @@ ArrayJoinKernel(JSContext *cx, SeparatorOp sepOp, HandleObject obj, uint32_t len
|
|||
if (!robj)
|
||||
return false;
|
||||
RootedId id(cx, NameToId(cx->names().toLocaleString));
|
||||
if (!robj->callMethod(cx, id, 0, NULL, &v))
|
||||
if (!robj->callMethod(cx, id, 0, nullptr, &v))
|
||||
return false;
|
||||
}
|
||||
if (!ValueToStringBuffer(cx, v, sb))
|
||||
|
@ -1020,7 +1021,7 @@ ArrayJoin(JSContext *cx, CallArgs &args)
|
|||
return false;
|
||||
|
||||
// Steps 4 and 5
|
||||
RootedString sepstr(cx, NULL);
|
||||
RootedString sepstr(cx, nullptr);
|
||||
if (!Locale && args.hasDefined(0)) {
|
||||
sepstr = ToString<CanGC>(cx, args[0]);
|
||||
if (!sepstr)
|
||||
|
@ -1557,8 +1558,8 @@ typedef bool (*ComparatorNumeric)(const NumericElement &a, const NumericElement
|
|||
bool *lessOrEqualp);
|
||||
|
||||
ComparatorNumeric SortComparatorNumerics[] = {
|
||||
NULL,
|
||||
NULL,
|
||||
nullptr,
|
||||
nullptr,
|
||||
ComparatorNumericLeftMinusRight,
|
||||
ComparatorNumericRightMinusLeft
|
||||
};
|
||||
|
@ -1580,8 +1581,8 @@ ComparatorInt32RightMinusLeft(const Value &a, const Value &b, bool *lessOrEqualp
|
|||
typedef bool (*ComparatorInt32)(const Value &a, const Value &b, bool *lessOrEqualp);
|
||||
|
||||
ComparatorInt32 SortComparatorInt32s[] = {
|
||||
NULL,
|
||||
NULL,
|
||||
nullptr,
|
||||
nullptr,
|
||||
ComparatorInt32LeftMinusRight,
|
||||
ComparatorInt32RightMinusLeft
|
||||
};
|
||||
|
@ -1781,7 +1782,7 @@ js::array_sort(JSContext *cx, unsigned argc, Value *vp)
|
|||
|
||||
if (args.hasDefined(0)) {
|
||||
if (args[0].isPrimitive()) {
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_BAD_SORT_ARG);
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_BAD_SORT_ARG);
|
||||
return false;
|
||||
}
|
||||
fval = args[0]; /* non-default compare function */
|
||||
|
@ -2934,7 +2935,7 @@ js_Array(JSContext *cx, unsigned argc, Value *vp)
|
|||
if (args[0].isInt32()) {
|
||||
int32_t i = args[0].toInt32();
|
||||
if (i < 0) {
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_BAD_ARRAY_LENGTH);
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_BAD_ARRAY_LENGTH);
|
||||
return false;
|
||||
}
|
||||
length = uint32_t(i);
|
||||
|
@ -2942,7 +2943,7 @@ js_Array(JSContext *cx, unsigned argc, Value *vp)
|
|||
double d = args[0].toDouble();
|
||||
length = ToUint32(d);
|
||||
if (d != double(length)) {
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_BAD_ARRAY_LENGTH);
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_BAD_ARRAY_LENGTH);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -2980,15 +2981,15 @@ js_InitArrayClass(JSContext *cx, HandleObject obj)
|
|||
|
||||
RootedObject proto(cx, global->getOrCreateObjectPrototype(cx));
|
||||
if (!proto)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
RootedTypeObject type(cx, cx->getNewType(&ArrayObject::class_, proto.get()));
|
||||
if (!type)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
JSObject *metadata = NULL;
|
||||
JSObject *metadata = nullptr;
|
||||
if (!NewObjectMetadata(cx, &metadata))
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
RootedShape shape(cx, EmptyShape::getInitialShape(cx, &ArrayObject::class_, TaggedProto(proto),
|
||||
proto->getParent(), metadata,
|
||||
|
@ -2996,12 +2997,12 @@ js_InitArrayClass(JSContext *cx, HandleObject obj)
|
|||
|
||||
RootedObject arrayProto(cx, JSObject::createArray(cx, gc::FINALIZE_OBJECT4, gc::TenuredHeap, shape, type, 0));
|
||||
if (!arrayProto || !JSObject::setSingletonType(cx, arrayProto) || !AddLengthProperty(cx, arrayProto))
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
RootedFunction ctor(cx);
|
||||
ctor = global->createConstructor(cx, js_Array, cx->names().Array, 1);
|
||||
if (!ctor)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
/*
|
||||
* The default 'new' type of Array.prototype is required by type inference
|
||||
|
@ -3010,19 +3011,19 @@ js_InitArrayClass(JSContext *cx, HandleObject obj)
|
|||
* be used without updating the indexed type set for such default arrays.
|
||||
*/
|
||||
if (!JSObject::setNewTypeUnknown(cx, &ArrayObject::class_, arrayProto))
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
if (!LinkConstructorAndPrototype(cx, ctor, arrayProto))
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
if (!DefinePropertiesAndBrand(cx, arrayProto, NULL, array_methods) ||
|
||||
!DefinePropertiesAndBrand(cx, ctor, NULL, array_static_methods))
|
||||
if (!DefinePropertiesAndBrand(cx, arrayProto, nullptr, array_methods) ||
|
||||
!DefinePropertiesAndBrand(cx, ctor, nullptr, array_static_methods))
|
||||
{
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (!DefineConstructorAndPrototype(cx, global, JSProto_Array, ctor, arrayProto))
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
return arrayProto;
|
||||
}
|
||||
|
@ -3072,7 +3073,7 @@ NewArray(ExclusiveContext *cxArg, uint32_t length,
|
|||
arr->setFixedElements();
|
||||
ArrayObject::setLength(cx, arr, length);
|
||||
if (allocateCapacity && !EnsureNewArrayElements(cx, arr, length))
|
||||
return NULL;
|
||||
return nullptr;
|
||||
return arr;
|
||||
}
|
||||
}
|
||||
|
@ -3083,15 +3084,15 @@ NewArray(ExclusiveContext *cxArg, uint32_t length,
|
|||
JS::PoisonPtr(&protoArg);
|
||||
|
||||
if (!proto && !FindProto(cxArg, &ArrayObject::class_, &proto))
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
RootedTypeObject type(cxArg, cxArg->getNewType(&ArrayObject::class_, proto.get()));
|
||||
if (!type)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
JSObject *metadata = NULL;
|
||||
JSObject *metadata = nullptr;
|
||||
if (!NewObjectMetadata(cxArg, &metadata))
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
/*
|
||||
* Get a shape with zero fixed slots, regardless of the size class.
|
||||
|
@ -3101,23 +3102,23 @@ NewArray(ExclusiveContext *cxArg, uint32_t length,
|
|||
TaggedProto(proto), cxArg->global(),
|
||||
metadata, gc::FINALIZE_OBJECT0));
|
||||
if (!shape)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
Rooted<ArrayObject*> arr(cxArg, JSObject::createArray(cxArg, allocKind,
|
||||
GetInitialHeap(newKind, &ArrayObject::class_),
|
||||
shape, type, length));
|
||||
if (!arr)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
if (shape->isEmptyShape()) {
|
||||
if (!AddLengthProperty(cxArg, arr))
|
||||
return NULL;
|
||||
return nullptr;
|
||||
shape = arr->lastProperty();
|
||||
EmptyShape::insertInitialShape(cxArg, shape, proto);
|
||||
}
|
||||
|
||||
if (newKind == SingletonObject && !JSObject::setSingletonType(cxArg, arr))
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
if (entry != -1) {
|
||||
cxArg->asJSContext()->runtime()->newObjectCache.fillGlobal(entry, &ArrayObject::class_,
|
||||
|
@ -3125,28 +3126,28 @@ NewArray(ExclusiveContext *cxArg, uint32_t length,
|
|||
}
|
||||
|
||||
if (allocateCapacity && !EnsureNewArrayElements(cxArg, arr, length))
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
Probes::createObject(cxArg, arr);
|
||||
return arr;
|
||||
}
|
||||
|
||||
ArrayObject * JS_FASTCALL
|
||||
js::NewDenseEmptyArray(JSContext *cx, JSObject *proto /* = NULL */,
|
||||
js::NewDenseEmptyArray(JSContext *cx, JSObject *proto /* = nullptr */,
|
||||
NewObjectKind newKind /* = GenericObject */)
|
||||
{
|
||||
return NewArray<false>(cx, 0, proto, newKind);
|
||||
}
|
||||
|
||||
ArrayObject * JS_FASTCALL
|
||||
js::NewDenseAllocatedArray(ExclusiveContext *cx, uint32_t length, JSObject *proto /* = NULL */,
|
||||
js::NewDenseAllocatedArray(ExclusiveContext *cx, uint32_t length, JSObject *proto /* = nullptr */,
|
||||
NewObjectKind newKind /* = GenericObject */)
|
||||
{
|
||||
return NewArray<true>(cx, length, proto, newKind);
|
||||
}
|
||||
|
||||
ArrayObject * JS_FASTCALL
|
||||
js::NewDenseUnallocatedArray(ExclusiveContext *cx, uint32_t length, JSObject *proto /* = NULL */,
|
||||
js::NewDenseUnallocatedArray(ExclusiveContext *cx, uint32_t length, JSObject *proto /* = nullptr */,
|
||||
NewObjectKind newKind /* = GenericObject */)
|
||||
{
|
||||
return NewArray<false>(cx, length, proto, newKind);
|
||||
|
@ -3154,13 +3155,13 @@ js::NewDenseUnallocatedArray(ExclusiveContext *cx, uint32_t length, JSObject *pr
|
|||
|
||||
ArrayObject *
|
||||
js::NewDenseCopiedArray(JSContext *cx, uint32_t length, HandleObject src, uint32_t elementOffset,
|
||||
JSObject *proto /* = NULL */)
|
||||
JSObject *proto /* = nullptr */)
|
||||
{
|
||||
JS_ASSERT(!src->isIndexed());
|
||||
|
||||
ArrayObject* arr = NewArray<true>(cx, length, proto);
|
||||
if (!arr)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
JS_ASSERT(arr->getDenseCapacity() >= length);
|
||||
|
||||
|
@ -3176,11 +3177,11 @@ js::NewDenseCopiedArray(JSContext *cx, uint32_t length, HandleObject src, uint32
|
|||
// values must point at already-rooted Value objects
|
||||
ArrayObject *
|
||||
js::NewDenseCopiedArray(JSContext *cx, uint32_t length, const Value *values,
|
||||
JSObject *proto /* = NULL */, NewObjectKind newKind /* = GenericObject */)
|
||||
JSObject *proto /* = nullptr */, NewObjectKind newKind /* = GenericObject */)
|
||||
{
|
||||
ArrayObject* arr = NewArray<true>(cx, length, proto);
|
||||
if (!arr)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
JS_ASSERT(arr->getDenseCapacity() >= length);
|
||||
|
||||
|
|
|
@ -45,12 +45,12 @@ class ArrayObject;
|
|||
|
||||
/* Create a dense array with no capacity allocated, length set to 0. */
|
||||
extern ArrayObject * JS_FASTCALL
|
||||
NewDenseEmptyArray(JSContext *cx, JSObject *proto = NULL,
|
||||
NewDenseEmptyArray(JSContext *cx, JSObject *proto = nullptr,
|
||||
NewObjectKind newKind = GenericObject);
|
||||
|
||||
/* Create a dense array with length and capacity == 'length', initialized length set to 0. */
|
||||
extern ArrayObject * JS_FASTCALL
|
||||
NewDenseAllocatedArray(ExclusiveContext *cx, uint32_t length, JSObject *proto = NULL,
|
||||
NewDenseAllocatedArray(ExclusiveContext *cx, uint32_t length, JSObject *proto = nullptr,
|
||||
NewObjectKind newKind = GenericObject);
|
||||
|
||||
/*
|
||||
|
@ -58,16 +58,16 @@ NewDenseAllocatedArray(ExclusiveContext *cx, uint32_t length, JSObject *proto =
|
|||
* contents. This is useful, e.g., when accepting length from the user.
|
||||
*/
|
||||
extern ArrayObject * JS_FASTCALL
|
||||
NewDenseUnallocatedArray(ExclusiveContext *cx, uint32_t length, JSObject *proto = NULL,
|
||||
NewDenseUnallocatedArray(ExclusiveContext *cx, uint32_t length, JSObject *proto = nullptr,
|
||||
NewObjectKind newKind = GenericObject);
|
||||
|
||||
/* Create a dense array with a copy of the dense array elements in src. */
|
||||
extern ArrayObject *
|
||||
NewDenseCopiedArray(JSContext *cx, uint32_t length, HandleObject src, uint32_t elementOffset, JSObject *proto = NULL);
|
||||
NewDenseCopiedArray(JSContext *cx, uint32_t length, HandleObject src, uint32_t elementOffset, JSObject *proto = nullptr);
|
||||
|
||||
/* Create a dense array from the given array values, which must be rooted */
|
||||
extern ArrayObject *
|
||||
NewDenseCopiedArray(JSContext *cx, uint32_t length, const Value *values, JSObject *proto = NULL,
|
||||
NewDenseCopiedArray(JSContext *cx, uint32_t length, const Value *values, JSObject *proto = nullptr,
|
||||
NewObjectKind newKind = GenericObject);
|
||||
|
||||
/*
|
||||
|
|
|
@ -40,7 +40,7 @@ js::AtomToPrintableString(ExclusiveContext *cx, JSAtom *atom, JSAutoByteString *
|
|||
{
|
||||
JSString *str = js_QuoteString(cx, atom, 0);
|
||||
if (!str)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
return bytes->encodeLatin1(cx, str);
|
||||
}
|
||||
|
||||
|
@ -170,7 +170,7 @@ js::InitCommonNames(JSContext *cx)
|
|||
void
|
||||
js::FinishCommonNames(JSRuntime *rt)
|
||||
{
|
||||
rt->emptyString = NULL;
|
||||
rt->emptyString = nullptr;
|
||||
#ifdef DEBUG
|
||||
memset(&rt->atomState, JS_FREE_PATTERN, sizeof(JSAtomState));
|
||||
#endif
|
||||
|
@ -265,7 +265,7 @@ AtomizeAndTakeOwnership(ExclusiveContext *cx, jschar *tbchars, size_t length, In
|
|||
JSFlatString *flat = js_NewString<allowGC>(cx, tbchars, length);
|
||||
if (!flat) {
|
||||
js_free(tbchars);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
JSAtom *atom = flat->morphAtomizedStringIntoAtom();
|
||||
|
@ -273,7 +273,7 @@ AtomizeAndTakeOwnership(ExclusiveContext *cx, jschar *tbchars, size_t length, In
|
|||
if (!atoms.relookupOrAdd(p, AtomHasher::Lookup(tbchars, length),
|
||||
AtomStateEntry(atom, bool(ib)))) {
|
||||
js_ReportOutOfMemory(cx); /* SystemAllocPolicy does not report OOM. */
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return atom;
|
||||
|
@ -310,7 +310,7 @@ AtomizeAndCopyChars(ExclusiveContext *cx, const jschar *tbchars, size_t length,
|
|||
|
||||
JSFlatString *flat = js_NewStringCopyN<allowGC>(cx, tbchars, length);
|
||||
if (!flat)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
JSAtom *atom = flat->morphAtomizedStringIntoAtom();
|
||||
|
||||
|
@ -318,7 +318,7 @@ AtomizeAndCopyChars(ExclusiveContext *cx, const jschar *tbchars, size_t length,
|
|||
AtomStateEntry(atom, bool(ib)))) {
|
||||
if (allowGC)
|
||||
js_ReportOutOfMemory(cx); /* SystemAllocPolicy does not report OOM. */
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return atom;
|
||||
|
@ -347,17 +347,17 @@ js::AtomizeString(ExclusiveContext *cx, JSString *str,
|
|||
|
||||
const jschar *chars = str->getChars(cx);
|
||||
if (!chars)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
if (JSAtom *atom = AtomizeAndCopyChars<NoGC>(cx, chars, str->length(), ib))
|
||||
return atom;
|
||||
|
||||
if (!cx->isJSContext() || !allowGC)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
JSLinearString *linear = str->ensureLinear(cx->asJSContext());
|
||||
if (!linear)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
JS_ASSERT(linear->length() <= JSString::MAX_LENGTH);
|
||||
return AtomizeAndCopyChars<CanGC>(cx, linear->chars(), linear->length(), ib);
|
||||
|
@ -376,7 +376,7 @@ js::AtomizeMaybeGC(ExclusiveContext *cx, const char *bytes, size_t length, Inter
|
|||
CHECK_REQUEST(cx);
|
||||
|
||||
if (!JSString::validateLength(cx, length))
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
static const unsigned ATOMIZE_BUF_MAX = 32;
|
||||
if (length < ATOMIZE_BUF_MAX) {
|
||||
|
@ -394,7 +394,7 @@ js::AtomizeMaybeGC(ExclusiveContext *cx, const char *bytes, size_t length, Inter
|
|||
|
||||
jschar *tbcharsZ = InflateString(cx, bytes, &length);
|
||||
if (!tbcharsZ)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
return AtomizeAndTakeOwnership<allowGC>(cx, tbcharsZ, length, ib);
|
||||
}
|
||||
|
||||
|
@ -419,7 +419,7 @@ js::AtomizeChars(ExclusiveContext *cx, const jschar *chars, size_t length, Inter
|
|||
CHECK_REQUEST(cx);
|
||||
|
||||
if (!JSString::validateLength(cx, length))
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
return AtomizeAndCopyChars<allowGC>(cx, chars, length, ib);
|
||||
}
|
||||
|
@ -466,10 +466,10 @@ ToAtomSlow(ExclusiveContext *cx, typename MaybeRooted<Value, allowGC>::HandleTyp
|
|||
Value v = arg;
|
||||
if (!v.isPrimitive()) {
|
||||
if (!cx->shouldBeJSContext() || !allowGC)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
RootedValue v2(cx, v);
|
||||
if (!ToPrimitive(cx->asJSContext(), JSTYPE_STRING, &v2))
|
||||
return NULL;
|
||||
return nullptr;
|
||||
v = v2;
|
||||
}
|
||||
|
||||
|
|
|
@ -89,7 +89,7 @@ struct AtomHasher
|
|||
size_t length;
|
||||
const JSAtom *atom; /* Optional. */
|
||||
|
||||
Lookup(const jschar *chars, size_t length) : chars(chars), length(length), atom(NULL) {}
|
||||
Lookup(const jschar *chars, size_t length) : chars(chars), length(length), atom(nullptr) {}
|
||||
inline Lookup(const JSAtom *atom);
|
||||
};
|
||||
|
||||
|
|
|
@ -154,7 +154,7 @@ IdToString(JSContext *cx, jsid id)
|
|||
RootedValue idv(cx, IdToValue(id));
|
||||
JSString *str = ToStringSlow<CanGC>(cx, idv);
|
||||
if (!str)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
return str->ensureFlat(cx);
|
||||
}
|
||||
|
|
|
@ -142,35 +142,35 @@ js_InitBooleanClass(JSContext *cx, HandleObject obj)
|
|||
|
||||
RootedObject booleanProto (cx, global->createBlankPrototype(cx, &BooleanObject::class_));
|
||||
if (!booleanProto)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
booleanProto->setFixedSlot(BooleanObject::PRIMITIVE_VALUE_SLOT, BooleanValue(false));
|
||||
|
||||
RootedFunction ctor(cx, global->createConstructor(cx, Boolean, cx->names().Boolean, 1));
|
||||
if (!ctor)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
if (!LinkConstructorAndPrototype(cx, ctor, booleanProto))
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
if (!DefinePropertiesAndBrand(cx, booleanProto, NULL, boolean_methods))
|
||||
return NULL;
|
||||
if (!DefinePropertiesAndBrand(cx, booleanProto, nullptr, boolean_methods))
|
||||
return nullptr;
|
||||
|
||||
Handle<PropertyName*> valueOfName = cx->names().valueOf;
|
||||
RootedFunction
|
||||
valueOf(cx, NewFunction(cx, NullPtr(), bool_valueOf, 0, JSFunction::NATIVE_FUN,
|
||||
global, valueOfName));
|
||||
if (!valueOf)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
RootedValue value(cx, ObjectValue(*valueOf));
|
||||
if (!JSObject::defineProperty(cx, booleanProto, valueOfName, value,
|
||||
JS_PropertyStub, JS_StrictPropertyStub, 0))
|
||||
{
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (!DefineConstructorAndPrototype(cx, global, JSProto_Boolean, ctor, booleanProto))
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
return booleanProto;
|
||||
}
|
||||
|
|
|
@ -122,7 +122,7 @@ js::CloneFunctionAtCallsite(JSContext *cx, HandleFunction fun, HandleScript scri
|
|||
|
||||
Table &table = cx->compartment()->callsiteClones;
|
||||
if (!table.initialized() && !table.init())
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
uint32_t offset = pc - script->code;
|
||||
void* originalScript = script;
|
||||
|
@ -138,7 +138,7 @@ js::CloneFunctionAtCallsite(JSContext *cx, HandleFunction fun, HandleScript scri
|
|||
RootedObject parent(cx, fun->environment());
|
||||
RootedFunction clone(cx, CloneFunctionObject(cx, fun, parent));
|
||||
if (!clone)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
/*
|
||||
* Store a link back to the original for function.caller and avoid cloning
|
||||
|
@ -157,7 +157,7 @@ js::CloneFunctionAtCallsite(JSContext *cx, HandleFunction fun, HandleScript scri
|
|||
}
|
||||
|
||||
if (!table.relookupOrAdd(p, key, clone.get()))
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
return clone;
|
||||
}
|
||||
|
@ -169,11 +169,11 @@ js::NewContext(JSRuntime *rt, size_t stackChunkSize)
|
|||
|
||||
JSContext *cx = js_new<JSContext>(rt);
|
||||
if (!cx)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
if (!cx->cycleDetectorSet.init()) {
|
||||
js_delete(cx);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -204,7 +204,7 @@ js::NewContext(JSRuntime *rt, size_t stackChunkSize)
|
|||
#endif
|
||||
if (!ok) {
|
||||
DestroyContext(cx, DCM_NEW_FAILED);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
rt->haveCreatedContext = true;
|
||||
}
|
||||
|
@ -212,7 +212,7 @@ js::NewContext(JSRuntime *rt, size_t stackChunkSize)
|
|||
JSContextCallback cxCallback = rt->cxCallback;
|
||||
if (cxCallback && !cxCallback(cx, JSCONTEXT_NEW, rt->cxCallbackData)) {
|
||||
DestroyContext(cx, DCM_NEW_FAILED);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return cx;
|
||||
|
@ -231,7 +231,7 @@ js::DestroyContext(JSContext *cx, DestroyContextMode mode)
|
|||
|
||||
#if (defined(JSGC_ROOT_ANALYSIS) || defined(JSGC_USE_EXACT_ROOTING)) && defined(DEBUG)
|
||||
for (int i = 0; i < THING_ROOT_LIMIT; ++i)
|
||||
JS_ASSERT(cx->thingGCRooters[i] == NULL);
|
||||
JS_ASSERT(cx->thingGCRooters[i] == nullptr);
|
||||
#endif
|
||||
|
||||
if (mode != DCM_NEW_FAILED) {
|
||||
|
@ -362,7 +362,7 @@ js_ReportOutOfMemory(ThreadSafeContext *cxArg)
|
|||
|
||||
/* Get the message for this error, but we don't expand any arguments. */
|
||||
const JSErrorFormatString *efs =
|
||||
js_GetLocalizedErrorMessage(cx, NULL, NULL, JSMSG_OUT_OF_MEMORY);
|
||||
js_GetLocalizedErrorMessage(cx, nullptr, nullptr, JSMSG_OUT_OF_MEMORY);
|
||||
const char *msg = efs ? efs->format : "Out of memory";
|
||||
|
||||
/* Fill out the report, but don't do anything that requires allocation. */
|
||||
|
@ -406,7 +406,7 @@ js_ReportOverRecursed(JSContext *maybecx)
|
|||
fprintf(stderr, "js_ReportOverRecursed called\n");
|
||||
#endif
|
||||
if (maybecx)
|
||||
JS_ReportErrorNumber(maybecx, js_GetErrorMessage, NULL, JSMSG_OVER_RECURSED);
|
||||
JS_ReportErrorNumber(maybecx, js_GetErrorMessage, nullptr, JSMSG_OVER_RECURSED);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -423,7 +423,7 @@ js_ReportAllocationOverflow(ThreadSafeContext *cxArg)
|
|||
JSContext *cx = cxArg->asJSContext();
|
||||
|
||||
AutoSuppressGC suppressGC(cx);
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_ALLOC_OVERFLOW);
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_ALLOC_OVERFLOW);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -486,7 +486,7 @@ js_ReportErrorVA(JSContext *cx, unsigned flags, const char *format, va_list ap)
|
|||
|
||||
warning = JSREPORT_IS_WARNING(report.flags);
|
||||
|
||||
ReportError(cx, message, &report, NULL, NULL);
|
||||
ReportError(cx, message, &report, nullptr, nullptr);
|
||||
js_free(message);
|
||||
js_free(ucmessage);
|
||||
return warning;
|
||||
|
@ -534,7 +534,7 @@ js::PrintError(JSContext *cx, FILE *file, const char *message, JSErrorReport *re
|
|||
if (JSREPORT_IS_WARNING(report->flags) && !reportWarnings)
|
||||
return false;
|
||||
|
||||
char *prefix = NULL;
|
||||
char *prefix = nullptr;
|
||||
if (report->filename)
|
||||
prefix = JS_smprintf("%s:", report->filename);
|
||||
if (report->lineno) {
|
||||
|
@ -598,7 +598,7 @@ js_strdup(ExclusiveContext *cx, const char *s)
|
|||
size_t n = strlen(s) + 1;
|
||||
void *p = cx->malloc_(n);
|
||||
if (!p)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
return (char *)js_memcpy(p, s, n);
|
||||
}
|
||||
|
||||
|
@ -624,13 +624,13 @@ js_ExpandErrorArguments(ExclusiveContext *cx, JSErrorCallback callback,
|
|||
int argCount;
|
||||
bool messageArgsPassed = !!reportp->messageArgs;
|
||||
|
||||
*messagep = NULL;
|
||||
*messagep = nullptr;
|
||||
|
||||
/* Most calls supply js_GetErrorMessage; if this is so, assume NULL. */
|
||||
/* Most calls supply js_GetErrorMessage; if this is so, assume nullptr. */
|
||||
if (!callback || callback == js_GetErrorMessage)
|
||||
efs = js_GetLocalizedErrorMessage(cx, userRef, NULL, errorNumber);
|
||||
efs = js_GetLocalizedErrorMessage(cx, userRef, nullptr, errorNumber);
|
||||
else
|
||||
efs = callback(userRef, NULL, errorNumber);
|
||||
efs = callback(userRef, nullptr, errorNumber);
|
||||
if (efs) {
|
||||
reportp->exnType = efs->exnType;
|
||||
|
||||
|
@ -651,8 +651,8 @@ js_ExpandErrorArguments(ExclusiveContext *cx, JSErrorCallback callback,
|
|||
reportp->messageArgs = cx->pod_malloc<const jschar*>(argCount + 1);
|
||||
if (!reportp->messageArgs)
|
||||
return false;
|
||||
/* NULL-terminate for easy copying. */
|
||||
reportp->messageArgs[argCount] = NULL;
|
||||
/* nullptr-terminate for easy copying. */
|
||||
reportp->messageArgs[argCount] = nullptr;
|
||||
}
|
||||
for (i = 0; i < argCount; i++) {
|
||||
if (messageArgsPassed) {
|
||||
|
@ -741,7 +741,7 @@ js_ExpandErrorArguments(ExclusiveContext *cx, JSErrorCallback callback,
|
|||
}
|
||||
}
|
||||
}
|
||||
if (*messagep == NULL) {
|
||||
if (*messagep == nullptr) {
|
||||
/* where's the right place for this ??? */
|
||||
const char *defaultErrorMessage
|
||||
= "No error message available for error number %d";
|
||||
|
@ -762,15 +762,15 @@ error:
|
|||
js_free((void *)reportp->messageArgs[i++]);
|
||||
}
|
||||
js_free((void *)reportp->messageArgs);
|
||||
reportp->messageArgs = NULL;
|
||||
reportp->messageArgs = nullptr;
|
||||
}
|
||||
if (reportp->ucmessage) {
|
||||
js_free((void *)reportp->ucmessage);
|
||||
reportp->ucmessage = NULL;
|
||||
reportp->ucmessage = nullptr;
|
||||
}
|
||||
if (*messagep) {
|
||||
js_free((void *)*messagep);
|
||||
*messagep = NULL;
|
||||
*messagep = nullptr;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -866,7 +866,7 @@ js_ReportErrorAgain(JSContext *cx, const char *message, JSErrorReport *reportp)
|
|||
if (onError) {
|
||||
JSDebugErrorHook hook = cx->runtime()->debugHooks.debugErrorHook;
|
||||
if (hook && !hook(cx, message, reportp, cx->runtime()->debugHooks.debugErrorHookData))
|
||||
onError = NULL;
|
||||
onError = nullptr;
|
||||
}
|
||||
if (onError)
|
||||
onError(cx, message, reportp);
|
||||
|
@ -875,7 +875,7 @@ js_ReportErrorAgain(JSContext *cx, const char *message, JSErrorReport *reportp)
|
|||
void
|
||||
js_ReportIsNotDefined(JSContext *cx, const char *name)
|
||||
{
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_NOT_DEFINED, name);
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_NOT_DEFINED, name);
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -892,20 +892,20 @@ js_ReportIsNullOrUndefined(JSContext *cx, int spindex, HandleValue v,
|
|||
if (strcmp(bytes, js_undefined_str) == 0 ||
|
||||
strcmp(bytes, js_null_str) == 0) {
|
||||
ok = JS_ReportErrorFlagsAndNumber(cx, JSREPORT_ERROR,
|
||||
js_GetErrorMessage, NULL,
|
||||
js_GetErrorMessage, nullptr,
|
||||
JSMSG_NO_PROPERTIES, bytes,
|
||||
NULL, NULL);
|
||||
nullptr, nullptr);
|
||||
} else if (v.isUndefined()) {
|
||||
ok = JS_ReportErrorFlagsAndNumber(cx, JSREPORT_ERROR,
|
||||
js_GetErrorMessage, NULL,
|
||||
js_GetErrorMessage, nullptr,
|
||||
JSMSG_UNEXPECTED_TYPE, bytes,
|
||||
js_undefined_str, NULL);
|
||||
js_undefined_str, nullptr);
|
||||
} else {
|
||||
JS_ASSERT(v.isNull());
|
||||
ok = JS_ReportErrorFlagsAndNumber(cx, JSREPORT_ERROR,
|
||||
js_GetErrorMessage, NULL,
|
||||
js_GetErrorMessage, nullptr,
|
||||
JSMSG_UNEXPECTED_TYPE, bytes,
|
||||
js_null_str, NULL);
|
||||
js_null_str, nullptr);
|
||||
}
|
||||
|
||||
js_free(bytes);
|
||||
|
@ -920,7 +920,7 @@ js_ReportMissingArg(JSContext *cx, HandleValue v, unsigned arg)
|
|||
RootedAtom atom(cx);
|
||||
|
||||
JS_snprintf(argbuf, sizeof argbuf, "%u", arg);
|
||||
bytes = NULL;
|
||||
bytes = nullptr;
|
||||
if (IsFunctionObject(v)) {
|
||||
atom = v.toObject().as<JSFunction>().atom();
|
||||
bytes = DecompileValueGenerator(cx, JSDVG_SEARCH_STACK,
|
||||
|
@ -928,7 +928,7 @@ js_ReportMissingArg(JSContext *cx, HandleValue v, unsigned arg)
|
|||
if (!bytes)
|
||||
return;
|
||||
}
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL,
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr,
|
||||
JSMSG_MISSING_FUN_ARG, argbuf,
|
||||
bytes ? bytes : "");
|
||||
js_free(bytes);
|
||||
|
@ -949,7 +949,7 @@ js_ReportValueErrorFlags(JSContext *cx, unsigned flags, const unsigned errorNumb
|
|||
return false;
|
||||
|
||||
ok = JS_ReportErrorFlagsAndNumber(cx, flags, js_GetErrorMessage,
|
||||
NULL, errorNumber, bytes, arg1, arg2);
|
||||
nullptr, errorNumber, bytes, arg1, arg2);
|
||||
js_free(bytes);
|
||||
return ok;
|
||||
}
|
||||
|
@ -966,7 +966,7 @@ js_GetErrorMessage(void *userRef, const char *locale, const unsigned errorNumber
|
|||
{
|
||||
if ((errorNumber > 0) && (errorNumber < JSErr_Limit))
|
||||
return &js_ErrorFormatString[errorNumber];
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -1024,7 +1024,7 @@ js::ThreadSafeContext::ThreadSafeContext(JSRuntime *rt, PerThreadData *pt, Conte
|
|||
: ContextFriendFields(rt),
|
||||
contextKind_(kind),
|
||||
perThreadData(pt),
|
||||
allocator_(NULL)
|
||||
allocator_(nullptr)
|
||||
{ }
|
||||
|
||||
bool
|
||||
|
@ -1046,14 +1046,14 @@ JSContext::JSContext(JSRuntime *rt)
|
|||
exception(UndefinedValue()),
|
||||
options_(0),
|
||||
reportGranularity(JS_DEFAULT_JITREPORT_GRANULARITY),
|
||||
resolvingList(NULL),
|
||||
resolvingList(nullptr),
|
||||
generatingError(false),
|
||||
savedFrameChains_(),
|
||||
defaultCompartmentObject_(NULL),
|
||||
defaultCompartmentObject_(nullptr),
|
||||
cycleDetectorSet(MOZ_THIS_IN_INITIALIZER_LIST()),
|
||||
errorReporter(NULL),
|
||||
data(NULL),
|
||||
data2(NULL),
|
||||
errorReporter(nullptr),
|
||||
data(nullptr),
|
||||
data2(nullptr),
|
||||
#ifdef JS_THREADSAFE
|
||||
outstandingRequests(0),
|
||||
#endif
|
||||
|
@ -1061,9 +1061,9 @@ JSContext::JSContext(JSRuntime *rt)
|
|||
iterValue(MagicValue(JS_NO_ITER_VALUE)),
|
||||
jitIsBroken(false),
|
||||
#ifdef MOZ_TRACE_JSCALLS
|
||||
functionCallback(NULL),
|
||||
functionCallback(nullptr),
|
||||
#endif
|
||||
innermostGenerator_(NULL)
|
||||
innermostGenerator_(nullptr)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
stackIterAssertionEnabled = true;
|
||||
|
@ -1107,7 +1107,7 @@ JSContext::leaveGenerator(JSGenerator *gen)
|
|||
{
|
||||
JS_ASSERT(innermostGenerator_ == gen);
|
||||
innermostGenerator_ = innermostGenerator_->prevGenerator;
|
||||
gen->prevGenerator = NULL;
|
||||
gen->prevGenerator = nullptr;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1126,7 +1126,7 @@ JSContext::saveFrameChain()
|
|||
if (Activation *act = mainThread().activation())
|
||||
act->saveFrameChain();
|
||||
|
||||
setCompartment(NULL);
|
||||
setCompartment(nullptr);
|
||||
enterCompartmentDepth_ = 0;
|
||||
|
||||
return true;
|
||||
|
@ -1197,7 +1197,7 @@ ComputeIsJITBroken()
|
|||
"SCH-I500", // Samsung i9000, Fascinate device
|
||||
"SPH-D700", // Samsung i9000, Epic device
|
||||
"GT-I9000", // Samsung i9000, UK/Europe device
|
||||
NULL
|
||||
nullptr
|
||||
};
|
||||
for (const char* const* hw = &blacklist[0]; *hw; ++hw) {
|
||||
if (line.npos != line.find(*hw)) {
|
||||
|
@ -1267,7 +1267,7 @@ JSContext::mark(JSTracer *trc)
|
|||
JSVersion
|
||||
JSContext::findVersion() const
|
||||
{
|
||||
if (JSScript *script = currentScript(NULL, ALLOW_CROSS_COMPARTMENT))
|
||||
if (JSScript *script = currentScript(nullptr, ALLOW_CROSS_COMPARTMENT))
|
||||
return script->getVersion();
|
||||
|
||||
if (compartment() && compartment()->options().version() != JSVERSION_UNKNOWN)
|
||||
|
|
|
@ -162,13 +162,13 @@ struct ThreadSafeContext : ContextFriendFields,
|
|||
JSContext *maybeJSContext() const {
|
||||
if (isJSContext())
|
||||
return (JSContext *) this;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
JSContext *asJSContext() const {
|
||||
// Note: there is no way to perform an unchecked coercion from a
|
||||
// ThreadSafeContext to a JSContext. This ensures that trying to use
|
||||
// the context as a JSContext off the main thread will NULL crash
|
||||
// the context as a JSContext off the main thread will nullptr crash
|
||||
// rather than race.
|
||||
JS_ASSERT(isJSContext());
|
||||
return maybeJSContext();
|
||||
|
@ -193,7 +193,7 @@ struct ThreadSafeContext : ContextFriendFields,
|
|||
ExclusiveContext *maybeExclusiveContext() const {
|
||||
if (isExclusiveContext())
|
||||
return (ExclusiveContext *) this;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
ExclusiveContext *asExclusiveContext() const {
|
||||
|
@ -302,7 +302,7 @@ class ExclusiveContext : public ThreadSafeContext
|
|||
|
||||
ExclusiveContext(JSRuntime *rt, PerThreadData *pt, ContextKind kind)
|
||||
: ThreadSafeContext(rt, pt, kind),
|
||||
workerThread_(NULL),
|
||||
workerThread_(nullptr),
|
||||
enterCompartmentDepth_(0)
|
||||
{}
|
||||
|
||||
|
@ -358,7 +358,7 @@ class ExclusiveContext : public ThreadSafeContext
|
|||
|
||||
// Zone local methods that can be used freely from an ExclusiveContext.
|
||||
inline bool typeInferenceEnabled() const;
|
||||
types::TypeObject *getNewType(const Class *clasp, TaggedProto proto, JSFunction *fun = NULL);
|
||||
types::TypeObject *getNewType(const Class *clasp, TaggedProto proto, JSFunction *fun = nullptr);
|
||||
types::TypeObject *getLazyType(const Class *clasp, TaggedProto proto);
|
||||
inline js::LifoAlloc &typeLifoAlloc();
|
||||
|
||||
|
@ -534,14 +534,14 @@ struct JSContext : public js::ExclusiveContext,
|
|||
/*
|
||||
* Get the topmost script and optional pc on the stack. By default, this
|
||||
* function only returns a JSScript in the current compartment, returning
|
||||
* NULL if the current script is in a different compartment. This behavior
|
||||
* can be overridden by passing ALLOW_CROSS_COMPARTMENT.
|
||||
* nullptr if the current script is in a different compartment. This
|
||||
* behavior can be overridden by passing ALLOW_CROSS_COMPARTMENT.
|
||||
*/
|
||||
enum MaybeAllowCrossCompartment {
|
||||
DONT_ALLOW_CROSS_COMPARTMENT = false,
|
||||
ALLOW_CROSS_COMPARTMENT = true
|
||||
};
|
||||
inline JSScript *currentScript(jsbytecode **pc = NULL,
|
||||
inline JSScript *currentScript(jsbytecode **pc = nullptr,
|
||||
MaybeAllowCrossCompartment = DONT_ALLOW_CROSS_COMPARTMENT) const;
|
||||
|
||||
#ifdef MOZ_TRACE_JSCALLS
|
||||
|
@ -765,10 +765,10 @@ extern void
|
|||
ReportUsageError(JSContext *cx, HandleObject callee, const char *msg);
|
||||
|
||||
/*
|
||||
* Prints a full report and returns true if the given report is non-NULL and
|
||||
* the report doesn't have the JSREPORT_WARNING flag set or reportWarnings is
|
||||
* true.
|
||||
* Returns false otherwise, printing just the message if the report is NULL.
|
||||
* Prints a full report and returns true if the given report is non-nullptr
|
||||
* and the report doesn't have the JSREPORT_WARNING flag set or reportWarnings
|
||||
* is true.
|
||||
* Returns false otherwise, printing just the message if the report is nullptr.
|
||||
*/
|
||||
extern bool
|
||||
PrintError(JSContext *cx, FILE *file, const char *message, JSErrorReport *report,
|
||||
|
@ -807,11 +807,11 @@ js_ReportValueErrorFlags(JSContext *cx, unsigned flags, const unsigned errorNumb
|
|||
|
||||
#define js_ReportValueError(cx,errorNumber,spindex,v,fallback) \
|
||||
((void)js_ReportValueErrorFlags(cx, JSREPORT_ERROR, errorNumber, \
|
||||
spindex, v, fallback, NULL, NULL))
|
||||
spindex, v, fallback, nullptr, nullptr))
|
||||
|
||||
#define js_ReportValueError2(cx,errorNumber,spindex,v,fallback,arg1) \
|
||||
((void)js_ReportValueErrorFlags(cx, JSREPORT_ERROR, errorNumber, \
|
||||
spindex, v, fallback, arg1, NULL))
|
||||
spindex, v, fallback, arg1, nullptr))
|
||||
|
||||
#define js_ReportValueError3(cx,errorNumber,spindex,v,fallback,arg1,arg2) \
|
||||
((void)js_ReportValueErrorFlags(cx, JSREPORT_ERROR, errorNumber, \
|
||||
|
|
|
@ -387,7 +387,7 @@ class AutoLockForExclusiveAccess
|
|||
if (runtime->numExclusiveThreads) {
|
||||
JS_ASSERT(runtime->exclusiveAccessOwner == PR_GetCurrentThread());
|
||||
#ifdef DEBUG
|
||||
runtime->exclusiveAccessOwner = NULL;
|
||||
runtime->exclusiveAccessOwner = nullptr;
|
||||
#endif
|
||||
PR_Unlock(runtime->exclusiveAccessLock);
|
||||
} else {
|
||||
|
@ -501,8 +501,8 @@ js::ExclusiveContext::setCompartment(JSCompartment *comp)
|
|||
JS_ASSERT_IF(comp, comp->hasBeenEntered());
|
||||
|
||||
compartment_ = comp;
|
||||
zone_ = comp ? comp->zone() : NULL;
|
||||
allocator_ = zone_ ? &zone_->allocator : NULL;
|
||||
zone_ = comp ? comp->zone() : nullptr;
|
||||
allocator_ = zone_ ? &zone_->allocator : nullptr;
|
||||
}
|
||||
|
||||
inline JSScript *
|
||||
|
@ -510,23 +510,23 @@ JSContext::currentScript(jsbytecode **ppc,
|
|||
MaybeAllowCrossCompartment allowCrossCompartment) const
|
||||
{
|
||||
if (ppc)
|
||||
*ppc = NULL;
|
||||
*ppc = nullptr;
|
||||
|
||||
js::Activation *act = mainThread().activation();
|
||||
while (act && (act->cx() != this || (act->isJit() && !act->asJit()->isActive())))
|
||||
act = act->prev();
|
||||
|
||||
if (!act)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
JS_ASSERT(act->cx() == this);
|
||||
|
||||
#ifdef JS_ION
|
||||
if (act->isJit()) {
|
||||
JSScript *script = NULL;
|
||||
JSScript *script = nullptr;
|
||||
js::jit::GetPcScript(const_cast<JSContext *>(this), &script, ppc);
|
||||
if (!allowCrossCompartment && script->compartment() != compartment())
|
||||
return NULL;
|
||||
return nullptr;
|
||||
return script;
|
||||
}
|
||||
#endif
|
||||
|
@ -538,7 +538,7 @@ JSContext::currentScript(jsbytecode **ppc,
|
|||
|
||||
JSScript *script = fp->script();
|
||||
if (!allowCrossCompartment && script->compartment() != compartment())
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
if (ppc) {
|
||||
*ppc = act->asInterpreter()->regs().pc;
|
||||
|
|
|
@ -38,35 +38,35 @@ JSCompartment::JSCompartment(Zone *zone, const JS::CompartmentOptions &options =
|
|||
: options_(options),
|
||||
zone_(zone),
|
||||
runtime_(zone->runtimeFromMainThread()),
|
||||
principals(NULL),
|
||||
principals(nullptr),
|
||||
isSystem(false),
|
||||
marked(true),
|
||||
#ifdef DEBUG
|
||||
firedOnNewGlobalObject(false),
|
||||
#endif
|
||||
global_(NULL),
|
||||
global_(nullptr),
|
||||
enterCompartmentDepth(0),
|
||||
lastCodeRelease(0),
|
||||
data(NULL),
|
||||
objectMetadataCallback(NULL),
|
||||
data(nullptr),
|
||||
objectMetadataCallback(nullptr),
|
||||
lastAnimationTime(0),
|
||||
regExps(runtime_),
|
||||
typeReprs(runtime_),
|
||||
globalWriteBarriered(false),
|
||||
propertyTree(thisForCtor()),
|
||||
gcIncomingGrayPointers(NULL),
|
||||
gcLiveArrayBuffers(NULL),
|
||||
gcWeakMapList(NULL),
|
||||
gcIncomingGrayPointers(nullptr),
|
||||
gcLiveArrayBuffers(nullptr),
|
||||
gcWeakMapList(nullptr),
|
||||
debugModeBits(runtime_->debugMode ? DebugFromC : 0),
|
||||
rngState(0),
|
||||
watchpointMap(NULL),
|
||||
scriptCountsMap(NULL),
|
||||
debugScriptMap(NULL),
|
||||
debugScopes(NULL),
|
||||
enumerators(NULL),
|
||||
compartmentStats(NULL)
|
||||
watchpointMap(nullptr),
|
||||
scriptCountsMap(nullptr),
|
||||
debugScriptMap(nullptr),
|
||||
debugScopes(nullptr),
|
||||
enumerators(nullptr),
|
||||
compartmentStats(nullptr)
|
||||
#ifdef JS_ION
|
||||
, ionCompartment_(NULL)
|
||||
, ionCompartment_(nullptr)
|
||||
#endif
|
||||
{
|
||||
runtime_->numCompartments++;
|
||||
|
@ -131,19 +131,19 @@ JSRuntime::createIonRuntime(JSContext *cx)
|
|||
ionRuntime_ = cx->new_<jit::IonRuntime>();
|
||||
|
||||
if (!ionRuntime_)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
if (!ionRuntime_->initialize(cx)) {
|
||||
js_delete(ionRuntime_);
|
||||
ionRuntime_ = NULL;
|
||||
ionRuntime_ = nullptr;
|
||||
|
||||
JSCompartment *comp = cx->runtime()->atomsCompartment();
|
||||
if (comp->ionCompartment_) {
|
||||
js_delete(comp->ionCompartment_);
|
||||
comp->ionCompartment_ = NULL;
|
||||
comp->ionCompartment_ = nullptr;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return ionRuntime_;
|
||||
|
@ -168,7 +168,7 @@ JSCompartment::ensureIonCompartmentExists(JSContext *cx)
|
|||
|
||||
if (!ionCompartment_->initialize(cx)) {
|
||||
js_delete(ionCompartment_);
|
||||
ionCompartment_ = NULL;
|
||||
ionCompartment_ = nullptr;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -278,7 +278,7 @@ JSCompartment::wrap(JSContext *cx, MutableHandleObject obj, HandleObject existin
|
|||
|
||||
/*
|
||||
* Wrappers should really be parented to the wrapped parent of the wrapped
|
||||
* object, but in that case a wrapped global object would have a NULL
|
||||
* object, but in that case a wrapped global object would have a nullptr
|
||||
* parent without being a proper global object (JSCLASS_IS_GLOBAL). Instead,
|
||||
* we parent all wrappers to the global object in their home compartment.
|
||||
* This loses us some transparency, and is generally very cheesy.
|
||||
|
@ -343,7 +343,7 @@ JSCompartment::wrap(JSContext *cx, MutableHandleObject obj, HandleObject existin
|
|||
existing->getParent() != global ||
|
||||
obj->isCallable())
|
||||
{
|
||||
existing = NULL;
|
||||
existing = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -518,7 +518,7 @@ JSCompartment::sweep(FreeOp *fop, bool releaseTypes)
|
|||
sweepCallsiteClones();
|
||||
|
||||
if (global_ && IsObjectAboutToBeFinalized(global_.unsafeGet()))
|
||||
global_ = NULL;
|
||||
global_ = nullptr;
|
||||
|
||||
#ifdef JS_ION
|
||||
if (ionCompartment_)
|
||||
|
@ -593,7 +593,7 @@ JSCompartment::purge()
|
|||
void
|
||||
JSCompartment::clearTables()
|
||||
{
|
||||
global_ = NULL;
|
||||
global_ = nullptr;
|
||||
|
||||
regExps.clearTables();
|
||||
|
||||
|
@ -722,7 +722,7 @@ JSCompartment::setDebugModeFromC(JSContext *cx, bool b, AutoDebugModeGC &dmgc)
|
|||
if (enabledBefore != enabledAfter) {
|
||||
onStack = hasScriptsOnStack();
|
||||
if (b && onStack) {
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_DEBUG_NOT_IDLE);
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_DEBUG_NOT_IDLE);
|
||||
return false;
|
||||
}
|
||||
if (enabledAfter && !CreateLazyScriptsForCompartment(cx))
|
||||
|
|
|
@ -35,14 +35,14 @@ struct NativeIterator;
|
|||
class DtoaCache {
|
||||
double d;
|
||||
int base;
|
||||
JSFlatString *s; // if s==NULL, d and base are not valid
|
||||
JSFlatString *s; // if s==nullptr, d and base are not valid
|
||||
|
||||
public:
|
||||
DtoaCache() : s(NULL) {}
|
||||
void purge() { s = NULL; }
|
||||
DtoaCache() : s(nullptr) {}
|
||||
void purge() { s = nullptr; }
|
||||
|
||||
JSFlatString *lookup(int base, double d) {
|
||||
return this->s && base == this->base && d == this->d ? this->s : NULL;
|
||||
return this->s && base == this->base && d == this->d ? this->s : nullptr;
|
||||
}
|
||||
|
||||
void cache(int base, double d, JSFlatString *s) {
|
||||
|
@ -71,18 +71,18 @@ struct CrossCompartmentKey
|
|||
js::gc::Cell *wrapped;
|
||||
|
||||
CrossCompartmentKey()
|
||||
: kind(ObjectWrapper), debugger(NULL), wrapped(NULL) {}
|
||||
: kind(ObjectWrapper), debugger(nullptr), wrapped(nullptr) {}
|
||||
CrossCompartmentKey(JSObject *wrapped)
|
||||
: kind(ObjectWrapper), debugger(NULL), wrapped(wrapped) {}
|
||||
: kind(ObjectWrapper), debugger(nullptr), wrapped(wrapped) {}
|
||||
CrossCompartmentKey(JSString *wrapped)
|
||||
: kind(StringWrapper), debugger(NULL), wrapped(wrapped) {}
|
||||
: kind(StringWrapper), debugger(nullptr), wrapped(wrapped) {}
|
||||
CrossCompartmentKey(Value wrapped)
|
||||
: kind(wrapped.isString() ? StringWrapper : ObjectWrapper),
|
||||
debugger(NULL),
|
||||
debugger(nullptr),
|
||||
wrapped((js::gc::Cell *)wrapped.toGCThing()) {}
|
||||
CrossCompartmentKey(const RootedValue &wrapped)
|
||||
: kind(wrapped.get().isString() ? StringWrapper : ObjectWrapper),
|
||||
debugger(NULL),
|
||||
debugger(nullptr),
|
||||
wrapped((js::gc::Cell *)wrapped.get().toGCThing()) {}
|
||||
CrossCompartmentKey(Kind kind, JSObject *dbg, js::gc::Cell *wrapped)
|
||||
: kind(kind), debugger(dbg), wrapped(wrapped) {}
|
||||
|
@ -165,11 +165,11 @@ struct JSCompartment
|
|||
}
|
||||
|
||||
/*
|
||||
* Nb: global_ might be NULL, if (a) it's the atoms compartment, or (b) the
|
||||
* compartment's global has been collected. The latter can happen if e.g.
|
||||
* a string in a compartment is rooted but no object is, and thus the global
|
||||
* isn't rooted, and thus the global can be finalized while the compartment
|
||||
* lives on.
|
||||
* Nb: global_ might be nullptr, if (a) it's the atoms compartment, or
|
||||
* (b) the compartment's global has been collected. The latter can happen
|
||||
* if e.g. a string in a compartment is rooted but no object is, and thus
|
||||
* the global isn't rooted, and thus the global can be finalized while the
|
||||
* compartment lives on.
|
||||
*
|
||||
* In contrast, JSObject::global() is infallible because marking a JSObject
|
||||
* always marks its global as well.
|
||||
|
@ -366,10 +366,10 @@ struct JSCompartment
|
|||
bool addDebuggee(JSContext *cx, js::GlobalObject *global,
|
||||
js::AutoDebugModeGC &dmgc);
|
||||
void removeDebuggee(js::FreeOp *fop, js::GlobalObject *global,
|
||||
js::GlobalObjectSet::Enum *debuggeesEnum = NULL);
|
||||
js::GlobalObjectSet::Enum *debuggeesEnum = nullptr);
|
||||
void removeDebuggee(js::FreeOp *fop, js::GlobalObject *global,
|
||||
js::AutoDebugModeGC &dmgc,
|
||||
js::GlobalObjectSet::Enum *debuggeesEnum = NULL);
|
||||
js::GlobalObjectSet::Enum *debuggeesEnum = nullptr);
|
||||
bool setDebugModeFromC(JSContext *cx, bool b, js::AutoDebugModeGC &dmgc);
|
||||
|
||||
void clearBreakpointsIn(js::FreeOp *fop, js::Debugger *dbg, JSObject *handler);
|
||||
|
|
|
@ -158,7 +158,7 @@ Stack::Stack(uint64_t id)
|
|||
bool
|
||||
Stack::snapshot()
|
||||
{
|
||||
snaptime = time(NULL);
|
||||
snaptime = time(nullptr);
|
||||
return GetStack(&stack_base, &stack_len, ®s, stack, sizeof(stack));
|
||||
}
|
||||
|
||||
|
@ -182,7 +182,7 @@ Ring::Ring(uint64_t id)
|
|||
void
|
||||
Ring::push(uint64_t tag, void *data, size_t size)
|
||||
{
|
||||
uint64_t t = time(NULL);
|
||||
uint64_t t = time(nullptr);
|
||||
|
||||
copyBytes(&tag, sizeof(uint64_t));
|
||||
copyBytes(&t, sizeof(uint64_t));
|
||||
|
|
|
@ -2445,7 +2445,7 @@ date_toISOString_impl(JSContext *cx, CallArgs args)
|
|||
{
|
||||
double utctime = args.thisv().toObject().as<DateObject>().UTCTime().toNumber();
|
||||
if (!IsFinite(utctime)) {
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_INVALID_DATE);
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_INVALID_DATE);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -2496,7 +2496,7 @@ date_toJSON(JSContext *cx, unsigned argc, Value *vp)
|
|||
|
||||
/* Step 5. */
|
||||
if (!js_IsCallable(toISO)) {
|
||||
JS_ReportErrorFlagsAndNumber(cx, JSREPORT_ERROR, js_GetErrorMessage, NULL,
|
||||
JS_ReportErrorFlagsAndNumber(cx, JSREPORT_ERROR, js_GetErrorMessage, nullptr,
|
||||
JSMSG_BAD_TOISOSTRING_PROP);
|
||||
return false;
|
||||
}
|
||||
|
@ -3036,19 +3036,19 @@ js_InitDateClass(JSContext *cx, HandleObject obj)
|
|||
|
||||
RootedObject dateProto(cx, global->createBlankPrototype(cx, &DateObject::class_));
|
||||
if (!dateProto)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
dateProto->as<DateObject>().setUTCTime(GenericNaN());
|
||||
|
||||
RootedFunction ctor(cx);
|
||||
ctor = global->createConstructor(cx, js_Date, cx->names().Date, MAXARGS);
|
||||
if (!ctor)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
if (!LinkConstructorAndPrototype(cx, ctor, dateProto))
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
if (!DefinePropertiesAndBrand(cx, ctor, NULL, date_static_methods))
|
||||
return NULL;
|
||||
if (!DefinePropertiesAndBrand(cx, ctor, nullptr, date_static_methods))
|
||||
return nullptr;
|
||||
|
||||
/*
|
||||
* Define all Date.prototype.* functions, then brand for trace-jitted code.
|
||||
|
@ -3056,7 +3056,7 @@ js_InitDateClass(JSContext *cx, HandleObject obj)
|
|||
* Date.prototype.toUTCString.
|
||||
*/
|
||||
if (!JS_DefineFunctions(cx, dateProto, date_methods))
|
||||
return NULL;
|
||||
return nullptr;
|
||||
RootedValue toUTCStringFun(cx);
|
||||
RootedId toUTCStringId(cx, NameToId(cx->names().toUTCString));
|
||||
RootedId toGMTStringId(cx, NameToId(cx->names().toGMTString));
|
||||
|
@ -3064,11 +3064,11 @@ js_InitDateClass(JSContext *cx, HandleObject obj)
|
|||
!baseops::DefineGeneric(cx, dateProto, toGMTStringId, toUTCStringFun,
|
||||
JS_PropertyStub, JS_StrictPropertyStub, 0))
|
||||
{
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (!DefineConstructorAndPrototype(cx, global, JSProto_Date, ctor, dateProto))
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
return dateProto;
|
||||
}
|
||||
|
@ -3078,7 +3078,7 @@ js_NewDateObjectMsec(JSContext *cx, double msec_time)
|
|||
{
|
||||
JSObject *obj = NewBuiltinClassInstance(cx, &DateObject::class_);
|
||||
if (!obj)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
obj->as<DateObject>().setUTCTime(msec_time);
|
||||
return obj;
|
||||
}
|
||||
|
|
|
@ -96,13 +96,13 @@ js_dtostr(DtoaState *state, char *buffer, size_t bufferSize, JSDToStrMode mode,
|
|||
dval(d) = dinput;
|
||||
numBegin = dtoa(PASS_STATE d, dtoaModes[mode], precision, &decPt, &sign, &numEnd);
|
||||
if (!numBegin) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
nDigits = numEnd - numBegin;
|
||||
JS_ASSERT((size_t) nDigits <= bufferSize - 2);
|
||||
if ((size_t) nDigits > bufferSize - 2) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
js_memcpy(buffer + 2, numBegin, nDigits);
|
||||
|
@ -300,7 +300,7 @@ js_dtobasestr(DtoaState *state, int base, double dinput)
|
|||
dval(d) = dinput;
|
||||
buffer = (char*) js_malloc(DTOBASESTR_BUFFER_SIZE);
|
||||
if (!buffer)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
p = buffer;
|
||||
|
||||
if (dval(d) < 0.0
|
||||
|
@ -343,7 +343,7 @@ js_dtobasestr(DtoaState *state, int base, double dinput)
|
|||
nomem1:
|
||||
Bfree(PASS_STATE b);
|
||||
js_free(buffer);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
do {
|
||||
digit = divrem(b, base);
|
||||
|
@ -367,7 +367,7 @@ js_dtobasestr(DtoaState *state, int base, double dinput)
|
|||
int32_t s2, done;
|
||||
Bigint *b, *s, *mlo, *mhi;
|
||||
|
||||
b = s = mlo = mhi = NULL;
|
||||
b = s = mlo = mhi = nullptr;
|
||||
|
||||
*p++ = '.';
|
||||
b = d2b(PASS_STATE df, &e, &bbits);
|
||||
|
@ -379,7 +379,7 @@ js_dtobasestr(DtoaState *state, int base, double dinput)
|
|||
Bfree(PASS_STATE mlo);
|
||||
Bfree(PASS_STATE mhi);
|
||||
js_free(buffer);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
JS_ASSERT(e < 0);
|
||||
/* At this point df = b * 2^e. e must be less than zero because 0 < df < 1. */
|
||||
|
|
|
@ -27,8 +27,8 @@ js_DestroyDtoaState(DtoaState *state);
|
|||
* value represented by the character string pointed to by s00. The string is
|
||||
* scanned up to the first unrecognized character.
|
||||
*
|
||||
* If se is not NULL, *se receives a pointer to the character terminating the
|
||||
* scan. If no number can be formed, *se receives a pointer to the first
|
||||
* If se is not nullptr, *se receives a pointer to the character terminating
|
||||
* the scan. If no number can be formed, *se receives a pointer to the first
|
||||
* unparseable character in s00, and zero is returned.
|
||||
*
|
||||
* On overflow, this function returns infinity and does not indicate an error.
|
||||
|
@ -82,7 +82,7 @@ typedef enum JSDToStrMode {
|
|||
* beginning. The size of buffer is given in bufferSize, and must be at least
|
||||
* as large as given by the above macros.
|
||||
*
|
||||
* Return NULL if out of memory.
|
||||
* Return nullptr if out of memory.
|
||||
*/
|
||||
char *
|
||||
js_dtostr(DtoaState *state, char *buffer, size_t bufferSize, JSDToStrMode mode, int precision,
|
||||
|
@ -103,7 +103,7 @@ js_dtostr(DtoaState *state, char *buffer, size_t bufferSize, JSDToStrMode mode,
|
|||
* would equal d (except for -0.0, which converts to "0", and NaN, which is
|
||||
* not equal to itself).
|
||||
*
|
||||
* Return NULL if out of memory. If the result is not NULL, it must be
|
||||
* Return nullptr if out of memory. If the result is not nullptr, it must be
|
||||
* released via js_free().
|
||||
*/
|
||||
char *
|
||||
|
|
Загрузка…
Ссылка в новой задаче