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

--HG--
extra : rebase_source : f72b1ba625e9d30d42e3ab656a3558964c680106
This commit is contained in:
Birunthan Mohanathas 2013-10-07 12:44:15 -04:00
Родитель 0231f0d841
Коммит 1824b36e43
4 изменённых файлов: 165 добавлений и 164 удалений

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

@ -34,12 +34,12 @@ js::AutoEnterPolicy::reportErrorIfExceptionIsNotPending(JSContext *cx, jsid id)
return;
if (JSID_IS_VOID(id)) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL,
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr,
JSMSG_OBJECT_ACCESS_DENIED);
} else {
JSString *str = IdToString(cx, id);
const jschar *prop = str ? str->getCharsZ(cx) : NULL;
JS_ReportErrorNumberUC(cx, js_GetErrorMessage, NULL,
const jschar *prop = str ? str->getCharsZ(cx) : nullptr;
JS_ReportErrorNumberUC(cx, js_GetErrorMessage, nullptr,
JSMSG_PROPERTY_ACCESS_DENIED, prop);
}
}
@ -137,7 +137,8 @@ BaseProxyHandler::get(JSContext *cx, HandleObject proxy, HandleObject receiver,
return true;
}
if (desc.hasGetterObject())
return InvokeGetterOrSetter(cx, receiver, ObjectValue(*desc.getterObject()), 0, NULL, vp);
return InvokeGetterOrSetter(cx, receiver, ObjectValue(*desc.getterObject()),
0, nullptr, vp);
if (!desc.isShared())
vp.set(desc.value());
else
@ -238,8 +239,8 @@ BaseProxyHandler::set(JSContext *cx, HandleObject proxy, HandleObject receiver,
desc.value().set(vp.get());
desc.setAttributes(JSPROP_ENUMERATE);
desc.setShortId(0);
desc.setGetter(NULL);
desc.setSetter(NULL); // Pick up the class getter/setter.
desc.setGetter(nullptr);
desc.setSetter(nullptr); // Pick up the class getter/setter.
return defineProperty(cx, receiver, id, &desc);
}
@ -311,7 +312,7 @@ BaseProxyHandler::fun_toString(JSContext *cx, HandleObject proxy, unsigned inden
if (proxy->isCallable())
return JS_NewStringCopyZ(cx, "function () {\n [native code]\n}");
ReportIsNotFunction(cx, ObjectValue(*proxy));
return NULL;
return nullptr;
}
bool
@ -359,7 +360,7 @@ BaseProxyHandler::finalize(JSFreeOp *fop, JSObject *proxy)
JSObject *
BaseProxyHandler::weakmapKeyDelegate(JSObject *proxy)
{
return NULL;
return nullptr;
}
bool
@ -393,7 +394,7 @@ GetOwnPropertyDescriptor(JSContext *cx, HandleObject obj, HandleId id, unsigned
if (!JS_GetPropertyDescriptorById(cx, obj, id, flags, desc))
return false;
if (desc.object() != obj)
desc.object().set(NULL);
desc.object().set(nullptr);
return true;
}
@ -686,7 +687,7 @@ ParsePropertyDescriptorObject(JSContext *cx, HandleObject obj, const Value &v,
static bool
IndicatePropertyNotFound(MutableHandle<PropertyDescriptor> desc)
{
desc.object().set(NULL);
desc.object().set(nullptr);
return true;
}
@ -812,7 +813,7 @@ bool
ScriptedIndirectProxyHandler::preventExtensions(JSContext *cx, HandleObject proxy)
{
// See above.
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_CANT_CHANGE_EXTENSIBILITY);
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_CANT_CHANGE_EXTENSIBILITY);
return false;
}
@ -883,7 +884,7 @@ ScriptedIndirectProxyHandler::getOwnPropertyNames(JSContext *cx, HandleObject pr
RootedObject handler(cx, GetIndirectProxyHandlerObject(proxy));
RootedValue fval(cx), value(cx);
return GetFundamentalTrap(cx, handler, cx->names().getOwnPropertyNames, &fval) &&
Trap(cx, handler, fval, 0, NULL, &value) &&
Trap(cx, handler, fval, 0, nullptr, &value) &&
ArrayToIdVector(cx, value, props);
}
@ -903,7 +904,7 @@ ScriptedIndirectProxyHandler::enumerate(JSContext *cx, HandleObject proxy, AutoI
RootedObject handler(cx, GetIndirectProxyHandlerObject(proxy));
RootedValue fval(cx), value(cx);
return GetFundamentalTrap(cx, handler, cx->names().enumerate, &fval) &&
Trap(cx, handler, fval, 0, NULL, &value) &&
Trap(cx, handler, fval, 0, nullptr, &value) &&
ArrayToIdVector(cx, value, props);
}
@ -982,7 +983,7 @@ ScriptedIndirectProxyHandler::keys(JSContext *cx, HandleObject proxy, AutoIdVect
return false;
if (!js_IsCallable(value))
return BaseProxyHandler::keys(cx, proxy, props);
return Trap(cx, handler, value, 0, NULL, &value) &&
return Trap(cx, handler, value, 0, nullptr, &value) &&
ArrayToIdVector(cx, value, props);
}
@ -996,7 +997,7 @@ ScriptedIndirectProxyHandler::iterate(JSContext *cx, HandleObject proxy, unsigne
return false;
if (!js_IsCallable(value))
return BaseProxyHandler::iterate(cx, proxy, flags, vp);
return Trap(cx, handler, value, 0, NULL, vp) &&
return Trap(cx, handler, value, 0, nullptr, vp) &&
ReturnedValueMustNotBePrimitive(cx, proxy, cx->names().iterate, vp);
}
@ -1035,11 +1036,11 @@ ScriptedIndirectProxyHandler::fun_toString(JSContext *cx, HandleObject proxy, un
{
assertEnteredPolicy(cx, proxy, JSID_VOID);
if (!proxy->isCallable()) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL,
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr,
JSMSG_INCOMPATIBLE_PROTO,
js_Function_str, js_toString_str,
"object");
return NULL;
return nullptr;
}
RootedObject obj(cx, &proxy->as<ProxyObject>().extra(0).toObject().getReservedSlot(0).toObject());
return fun_toStringHelper(cx, obj, indent);
@ -1171,7 +1172,7 @@ NormalizePropertyDescriptor(JSContext *cx, MutableHandleValue vp, bool complete
RootedValue v(cx);
if (!JSObject::getGeneric(cx, descObj, attributes, id, &v))
return false;
if (!JSObject::defineGeneric(cx, descObj, id, v, NULL, NULL, JSPROP_ENUMERATE))
if (!JSObject::defineGeneric(cx, descObj, id, v, nullptr, nullptr, JSPROP_ENUMERATE))
return false;
}
return true;
@ -1379,7 +1380,7 @@ TrapGetOwnProperty(JSContext *cx, HandleObject proxy, HandleId id, MutableHandle
if (!IsSealed(cx, target, id, &sealed))
return false;
if (sealed) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_CANT_REPORT_NC_AS_NE);
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_CANT_REPORT_NC_AS_NE);
return false;
}
@ -1391,7 +1392,7 @@ TrapGetOwnProperty(JSContext *cx, HandleObject proxy, HandleId id, MutableHandle
if (!HasOwn(cx, target, id, &found))
return false;
if (found) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_CANT_REPORT_E_AS_NE);
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_CANT_REPORT_E_AS_NE);
return false;
}
}
@ -1410,7 +1411,7 @@ TrapGetOwnProperty(JSContext *cx, HandleObject proxy, HandleId id, MutableHandle
if (!JSObject::isExtensible(cx, target, &extensible))
return false;
if (extensible && !isFixed) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_CANT_REPORT_NEW);
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_CANT_REPORT_NEW);
return false;
}
@ -1426,14 +1427,14 @@ TrapGetOwnProperty(JSContext *cx, HandleObject proxy, HandleId id, MutableHandle
return false;
if (!valid) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_CANT_REPORT_INVALID);
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_CANT_REPORT_INVALID);
return false;
}
}
// step 11
if (!desc->configurable() && !isFixed) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_CANT_REPORT_NE_AS_NC);
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_CANT_REPORT_NE_AS_NC);
return false;
}
@ -1494,7 +1495,7 @@ TrapDefineOwnProperty(JSContext *cx, HandleObject proxy, HandleId id, MutableHan
if (!JSObject::isExtensible(cx, target, &extensible))
return false;
if (!extensible && !isFixed) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_CANT_DEFINE_NEW);
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_CANT_DEFINE_NEW);
return false;
}
@ -1508,13 +1509,13 @@ TrapDefineOwnProperty(JSContext *cx, HandleObject proxy, HandleId id, MutableHan
if (!ValidateProperty(cx, target, id, desc, &valid))
return false;
if (!valid) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_CANT_DEFINE_INVALID);
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_CANT_DEFINE_INVALID);
return false;
}
}
if (!desc->configurable() && !isFixed) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_CANT_DEFINE_NE_AS_NC);
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_CANT_DEFINE_NE_AS_NC);
return false;
}
@ -1583,7 +1584,7 @@ ArrayToIdVector(JSContext *cx, HandleObject proxy, HandleObject target, HandleVa
if (!JSObject::isExtensible(cx, target, &extensible))
return false;
if (!extensible && !isFixed) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_CANT_REPORT_NEW);
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_CANT_REPORT_NEW);
return false;
}
@ -1616,7 +1617,7 @@ ArrayToIdVector(JSContext *cx, HandleObject proxy, HandleObject target, HandleVa
if (!IsSealed(cx, target, id, &sealed))
return false;
if (sealed) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_CANT_SKIP_NC);
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_CANT_SKIP_NC);
return false;
}
@ -1630,7 +1631,7 @@ ArrayToIdVector(JSContext *cx, HandleObject proxy, HandleObject target, HandleVa
if (!JSObject::isExtensible(cx, target, &extensible))
return false;
if (!extensible && isFixed) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_CANT_REPORT_E_AS_NE);
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_CANT_REPORT_E_AS_NE);
return false;
}
}
@ -1682,14 +1683,14 @@ ScriptedDirectProxyHandler::preventExtensions(JSContext *cx, HandleObject proxy)
if (!JSObject::isExtensible(cx, target, &extensible))
return false;
if (extensible) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_CANT_REPORT_AS_NON_EXTENSIBLE);
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_CANT_REPORT_AS_NON_EXTENSIBLE);
return false;
}
return true;
}
// step h
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_CANT_CHANGE_EXTENSIBILITY);
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_CANT_CHANGE_EXTENSIBILITY);
return false;
}
@ -1727,7 +1728,7 @@ ScriptedDirectProxyHandler::getOwnPropertyDescriptor(JSContext *cx, HandleObject
// step 2
if (v.isUndefined()) {
desc.object().set(NULL);
desc.object().set(nullptr);
return true;
}
@ -1924,7 +1925,7 @@ ScriptedDirectProxyHandler::has(JSContext *cx, HandleObject proxy, HandleId id,
if (!IsSealed(cx, target, id, &sealed))
return false;
if (sealed) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_CANT_REPORT_NC_AS_NE);
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_CANT_REPORT_NC_AS_NE);
return false;
}
@ -1936,7 +1937,7 @@ ScriptedDirectProxyHandler::has(JSContext *cx, HandleObject proxy, HandleId id,
if (!HasOwn(cx, target, id, &isFixed))
return false;
if (isFixed) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_CANT_REPORT_E_AS_NE);
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_CANT_REPORT_E_AS_NE);
return false;
}
}
@ -1987,7 +1988,7 @@ ScriptedDirectProxyHandler::hasOwn(JSContext *cx, HandleObject proxy, HandleId i
if (!IsSealed(cx, target, id, &sealed))
return false;
if (sealed) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_CANT_REPORT_NC_AS_NE);
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_CANT_REPORT_NC_AS_NE);
return false;
}
@ -1999,7 +2000,7 @@ ScriptedDirectProxyHandler::hasOwn(JSContext *cx, HandleObject proxy, HandleId i
if (!HasOwn(cx, target, id, &isFixed))
return false;
if (isFixed) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_CANT_REPORT_E_AS_NE);
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_CANT_REPORT_E_AS_NE);
return false;
}
}
@ -2012,7 +2013,7 @@ ScriptedDirectProxyHandler::hasOwn(JSContext *cx, HandleObject proxy, HandleId i
if (!HasOwn(cx, target, id, &isFixed))
return false;
if (!isFixed) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_CANT_REPORT_NEW);
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_CANT_REPORT_NEW);
return false;
}
}
@ -2068,14 +2069,14 @@ ScriptedDirectProxyHandler::get(JSContext *cx, HandleObject proxy, HandleObject
if (!SameValue(cx, vp, desc.value(), &same))
return false;
if (!same) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_MUST_REPORT_SAME_VALUE);
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_MUST_REPORT_SAME_VALUE);
return false;
}
}
if (IsAccessorDescriptor(desc) && desc.isPermanent() && !desc.hasGetterObject()) {
if (!trapResult.isUndefined()) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_MUST_REPORT_UNDEFINED);
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_MUST_REPORT_UNDEFINED);
return false;
}
}
@ -2135,13 +2136,13 @@ ScriptedDirectProxyHandler::set(JSContext *cx, HandleObject proxy, HandleObject
if (!SameValue(cx, vp, desc.value(), &same))
return false;
if (!same) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_CANT_SET_NW_NC);
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_CANT_SET_NW_NC);
return false;
}
}
if (IsAccessorDescriptor(desc) && desc.isPermanent() && !desc.hasSetterObject()) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_CANT_SET_WO_SETTER);
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_CANT_SET_WO_SETTER);
return false;
}
}
@ -2296,7 +2297,7 @@ Proxy::getPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id,
{
JS_CHECK_RECURSION(cx, return false);
BaseProxyHandler *handler = proxy->as<ProxyObject>().handler();
desc.object().set(NULL); // default result if we refuse to perform this action
desc.object().set(nullptr); // default result if we refuse to perform this action
AutoEnterPolicy policy(cx, handler, proxy, id, BaseProxyHandler::GET, true);
if (!policy.allowed())
return policy.returnValue();
@ -2328,7 +2329,7 @@ Proxy::getOwnPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id,
JS_CHECK_RECURSION(cx, return false);
BaseProxyHandler *handler = proxy->as<ProxyObject>().handler();
desc.object().set(NULL); // default result if we refuse to perform this action
desc.object().set(nullptr); // default result if we refuse to perform this action
AutoEnterPolicy policy(cx, handler, proxy, id, BaseProxyHandler::GET, true);
if (!policy.allowed())
return policy.returnValue();
@ -2693,7 +2694,7 @@ Proxy::className(JSContext *cx, HandleObject proxy)
JSString *
Proxy::fun_toString(JSContext *cx, HandleObject proxy, unsigned indent)
{
JS_CHECK_RECURSION(cx, return NULL);
JS_CHECK_RECURSION(cx, return nullptr);
BaseProxyHandler *handler = proxy->as<ProxyObject>().handler();
AutoEnterPolicy policy(cx, handler, proxy, JSID_VOIDHANDLE,
BaseProxyHandler::GET, /* mayThrow = */ false);
@ -2744,8 +2745,8 @@ proxy_LookupGeneric(JSContext *cx, HandleObject obj, HandleId id,
MarkNonNativePropertyFound(propp);
objp.set(obj);
} else {
objp.set(NULL);
propp.set(NULL);
objp.set(nullptr);
propp.set(nullptr);
}
return true;
}
@ -3027,9 +3028,9 @@ proxy_Construct(JSContext *cx, unsigned argc, Value *vp)
#define PROXY_CLASS_EXT \
{ \
NULL, /* outerObject */ \
NULL, /* innerObject */ \
NULL, /* iteratorObject */ \
nullptr, /* outerObject */ \
nullptr, /* innerObject */ \
nullptr, /* iteratorObject */ \
false, /* isWrappedNative */ \
proxy_WeakmapKeyDelegate \
}
@ -3048,7 +3049,7 @@ proxy_Construct(JSContext *cx, unsigned argc, Value *vp)
JS_ResolveStub, \
proxy_Convert, \
proxy_Finalize, /* finalize */ \
NULL, /* checkAccess */ \
nullptr, /* checkAccess */ \
callOp, /* call */ \
proxy_HasInstance, /* hasInstance */ \
constructOp, /* construct */ \
@ -3077,12 +3078,12 @@ proxy_Construct(JSContext *cx, unsigned argc, Value *vp)
proxy_DeleteProperty, \
proxy_DeleteElement, \
proxy_DeleteSpecial, \
NULL, /* enumerate */ \
NULL, /* thisObject */ \
nullptr, /* enumerate */ \
nullptr, /* thisObject */ \
} \
}
const Class js::ProxyObject::uncallableClass_ = PROXY_CLASS(NULL, NULL);
const Class js::ProxyObject::uncallableClass_ = PROXY_CLASS(nullptr, nullptr);
const Class js::ProxyObject::callableClass_ = PROXY_CLASS(proxy_Call, proxy_Construct);
const Class* const js::CallableProxyClassPtr = &ProxyObject::callableClass_;
@ -3099,15 +3100,15 @@ const Class js::OuterWindowProxyObject::class_ = {
JS_ResolveStub,
JS_ConvertStub,
proxy_Finalize, /* finalize */
NULL, /* checkAccess */
NULL, /* call */
NULL, /* hasInstance */
NULL, /* construct */
nullptr, /* checkAccess */
nullptr, /* call */
nullptr, /* hasInstance */
nullptr, /* construct */
ProxyObject::trace, /* trace */
{
NULL, /* outerObject */
nullptr, /* outerObject */
proxy_innerObject,
NULL, /* iteratorObject */
nullptr, /* iteratorObject */
false, /* isWrappedNative */
proxy_WeakmapKeyDelegate
},
@ -3134,8 +3135,8 @@ const Class js::OuterWindowProxyObject::class_ = {
proxy_DeleteProperty,
proxy_DeleteElement,
proxy_DeleteSpecial,
NULL, /* enumerate */
NULL, /* thisObject */
nullptr, /* enumerate */
nullptr, /* thisObject */
}
};
@ -3172,7 +3173,7 @@ proxy(JSContext *cx, unsigned argc, jsval *vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
if (args.length() < 2) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_MORE_ARGS_NEEDED,
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_MORE_ARGS_NEEDED,
"Proxy", "1", "s");
return false;
}
@ -3203,20 +3204,20 @@ static bool
proxy_create(JSContext *cx, unsigned argc, Value *vp)
{
if (argc < 1) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_MORE_ARGS_NEEDED,
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_MORE_ARGS_NEEDED,
"create", "0", "s");
return false;
}
JSObject *handler = NonNullObject(cx, vp[2]);
if (!handler)
return false;
JSObject *proto, *parent = NULL;
JSObject *proto, *parent = nullptr;
if (argc > 1 && vp[3].isObject()) {
proto = &vp[3].toObject();
parent = proto->getParent();
} else {
JS_ASSERT(IsFunctionObject(vp[0]));
proto = NULL;
proto = nullptr;
}
if (!parent)
parent = vp[0].toObject().getParent();
@ -3234,7 +3235,7 @@ static bool
proxy_createFunction(JSContext *cx, unsigned argc, Value *vp)
{
if (argc < 2) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_MORE_ARGS_NEEDED,
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_MORE_ARGS_NEEDED,
"createFunction", "1", "");
return false;
}
@ -3251,7 +3252,7 @@ proxy_createFunction(JSContext *cx, unsigned argc, Value *vp)
RootedObject call(cx, ValueToCallable(cx, vp[3], argc - 2));
if (!call)
return false;
JSObject *construct = NULL;
JSObject *construct = nullptr;
if (argc > 2) {
construct = ValueToCallable(cx, vp[4], argc - 3);
if (!construct)
@ -3263,7 +3264,7 @@ proxy_createFunction(JSContext *cx, unsigned argc, Value *vp)
// Stash the call and construct traps on a holder object that we can stick
// in a slot on the proxy.
RootedObject ccHolder(cx, JS_NewObjectWithGivenProto(cx, Jsvalify(&CallConstructHolder),
NULL, cx->global()));
nullptr, cx->global()));
if (!ccHolder)
return false;
ccHolder->setReservedSlot(0, ObjectValue(*call));
@ -3296,13 +3297,13 @@ js_InitProxyClass(JSContext *cx, HandleObject obj)
RootedFunction ctor(cx);
ctor = global->createConstructor(cx, proxy, cx->names().Proxy, 2);
if (!ctor)
return NULL;
return nullptr;
if (!JS_DefineFunctions(cx, ctor, static_methods))
return NULL;
return nullptr;
if (!JS_DefineProperty(cx, obj, "Proxy", OBJECT_TO_JSVAL(ctor),
JS_PropertyStub, JS_StrictPropertyStub, 0)) {
return NULL;
return nullptr;
}
MarkStandardClassInitializedNoProto(obj, &ProxyObject::uncallableClass_);

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

@ -397,7 +397,7 @@ class JS_FRIEND_API(AutoEnterPolicy)
AutoEnterPolicy(JSContext *cx, BaseProxyHandler *handler,
HandleObject wrapper, HandleId id, Action act, bool mayThrow)
#ifdef DEBUG
: context(NULL)
: context(nullptr)
#endif
{
allow = handler->hasPolicy() ? handler->enter(cx, wrapper, id, act, &rv)
@ -420,7 +420,7 @@ class JS_FRIEND_API(AutoEnterPolicy)
// no-op constructor for subclass
AutoEnterPolicy()
#ifdef DEBUG
: context(NULL)
: context(nullptr)
#endif
{};
void reportErrorIfExceptionIsNotPending(JSContext *cx, jsid id);

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

@ -72,7 +72,7 @@ Bindings::initWithTemporaryStorage(ExclusiveContext *cx, InternalBindingsHandle
if (numArgs > UINT16_MAX || numVars > UINT16_MAX) {
if (cx->isJSContext()) {
JS_ReportErrorNumber(cx->asJSContext(), js_GetErrorMessage, NULL,
JS_ReportErrorNumber(cx->asJSContext(), js_GetErrorMessage, nullptr,
self->numArgs_ > self->numVars_ ?
JSMSG_TOO_MANY_FUN_ARGS :
JSMSG_TOO_MANY_LOCALS);
@ -98,7 +98,7 @@ Bindings::initWithTemporaryStorage(ExclusiveContext *cx, InternalBindingsHandle
gc::AllocKind allocKind = gc::FINALIZE_OBJECT2_BACKGROUND;
JS_ASSERT(gc::GetGCKindSlots(allocKind) == CallObject::RESERVED_SLOTS);
RootedShape initial(cx,
EmptyShape::getInitialShape(cx, &CallObject::class_, NULL, cx->global(), NULL,
EmptyShape::getInitialShape(cx, &CallObject::class_, nullptr, cx->global(), nullptr,
allocKind, BaseShape::VAROBJ | BaseShape::DELEGATE));
if (!initial)
return false;
@ -123,7 +123,7 @@ Bindings::initWithTemporaryStorage(ExclusiveContext *cx, InternalBindingsHandle
return false;
#endif
StackBaseShape base(cx, &CallObject::class_, cx->global(), NULL,
StackBaseShape base(cx, &CallObject::class_, cx->global(), nullptr,
BaseShape::VAROBJ | BaseShape::DELEGATE);
UnownedBaseShape *nbase = BaseShape::getUnowned(cx, base);
@ -939,7 +939,7 @@ void
ScriptSourceObject::finalize(FreeOp *fop, JSObject *obj)
{
// ScriptSource::setSource automatically takes care of the refcount
obj->as<ScriptSourceObject>().setSource(NULL);
obj->as<ScriptSourceObject>().setSource(nullptr);
}
const Class ScriptSourceObject::class_ = {
@ -958,9 +958,9 @@ const Class ScriptSourceObject::class_ = {
ScriptSourceObject *
ScriptSourceObject::create(ExclusiveContext *cx, ScriptSource *source)
{
RootedObject object(cx, NewObjectWithGivenProto(cx, &class_, NULL, cx->global()));
RootedObject object(cx, NewObjectWithGivenProto(cx, &class_, nullptr, cx->global()));
if (!object)
return NULL;
return nullptr;
RootedScriptSource sourceObject(cx, &object->as<ScriptSourceObject>());
sourceObject->setSlot(SOURCE_SLOT, PrivateValue(source));
source->incref();
@ -982,7 +982,7 @@ ScriptSource::adjustDataSize(size_t nbytes)
return true;
}
// |data.compressed| can be NULL.
// |data.compressed| can be nullptr.
void *buf = js_realloc(data.compressed, nbytes);
if (!buf && data.compressed != emptySource)
js_free(data.compressed);
@ -997,7 +997,7 @@ JSScript::loadSource(JSContext *cx, ScriptSource *ss, bool *worked)
*worked = false;
if (!cx->runtime()->sourceHook || !ss->sourceRetrievable())
return true;
jschar *src = NULL;
jschar *src = nullptr;
size_t length;
if (!cx->runtime()->sourceHook->load(cx, ss->filename(), &src, &length))
return false;
@ -1019,10 +1019,10 @@ JSStableString *
SourceDataCache::lookup(ScriptSource *ss)
{
if (!map_)
return NULL;
return nullptr;
if (Map::Ptr p = map_->lookup(ss))
return p->value;
return NULL;
return nullptr;
}
void
@ -1045,7 +1045,7 @@ void
SourceDataCache::purge()
{
js_delete(map_);
map_ = NULL;
map_ = nullptr;
}
const jschar *
@ -1062,18 +1062,18 @@ ScriptSource::chars(JSContext *cx)
const size_t nbytes = sizeof(jschar) * (length_ + 1);
jschar *decompressed = static_cast<jschar *>(js_malloc(nbytes));
if (!decompressed)
return NULL;
return nullptr;
if (!DecompressString(data.compressed, compressedLength_,
reinterpret_cast<unsigned char *>(decompressed), nbytes)) {
JS_ReportOutOfMemory(cx);
js_free(decompressed);
return NULL;
return nullptr;
}
decompressed[length_] = 0;
cached = js_NewString<CanGC>(cx, decompressed, length_);
if (!cached) {
js_free(decompressed);
return NULL;
return nullptr;
}
cx->runtime()->sourceDataCache.put(this, cached);
}
@ -1089,10 +1089,10 @@ ScriptSource::substring(JSContext *cx, uint32_t start, uint32_t stop)
JS_ASSERT(start <= stop);
const jschar *chars = this->chars(cx);
if (!chars)
return NULL;
return nullptr;
JSFlatString *flatStr = js_NewStringCopyN<CanGC>(cx, chars + start, stop - start);
if (!flatStr)
return NULL;
return nullptr;
return flatStr->ensureStable(cx);
}
@ -1220,7 +1220,7 @@ size_t
ScriptSource::sizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf)
{
// |data| is a union, but both members are pointers to allocated memory,
// |emptySource|, or NULL, so just using |data.compressed| will work.
// |emptySource|, or nullptr, so just using |data.compressed| will work.
size_t n = mallocSizeOf(this);
n += (ready() && data.compressed != emptySource)
? mallocSizeOf(data.compressed)
@ -1265,7 +1265,7 @@ ScriptSource::performXDR(XDRState<mode> *xdr)
if (!xdr->codeBytes(data.compressed, byteLen)) {
if (mode == XDR_DECODE) {
js_free(data.compressed);
data.compressed = NULL;
data.compressed = nullptr;
}
return false;
}
@ -1292,7 +1292,7 @@ ScriptSource::performXDR(XDRState<mode> *xdr)
if (!xdr->codeChars(sourceMapURL_, sourceMapURLLen)) {
if (mode == XDR_DECODE) {
js_free(sourceMapURL_);
sourceMapURL_ = NULL;
sourceMapURL_ = nullptr;
}
return false;
}
@ -1317,7 +1317,7 @@ ScriptSource::performXDR(XDRState<mode> *xdr)
if (!xdr->codeChars(sourceURL_, sourceURLLen)) {
if (mode == XDR_DECODE) {
js_free(sourceURL_);
sourceURL_ = NULL;
sourceURL_ = nullptr;
}
return false;
}
@ -1363,7 +1363,7 @@ ScriptSource::setSourceURL(ExclusiveContext *cx, const jschar *sourceURL)
if (hasSourceURL()) {
if (cx->isJSContext() &&
!JS_ReportErrorFlagsAndNumber(cx->asJSContext(), JSREPORT_WARNING,
js_GetErrorMessage, NULL,
js_GetErrorMessage, nullptr,
JSMSG_ALREADY_HAS_PRAGMA, filename_,
"//# sourceURL"))
{
@ -1393,7 +1393,7 @@ ScriptSource::setSourceMapURL(ExclusiveContext *cx, const jschar *sourceMapURL)
if (hasSourceMapURL()) {
if (cx->isJSContext() &&
!JS_ReportErrorFlagsAndNumber(cx->asJSContext(), JSREPORT_WARNING,
js_GetErrorMessage, NULL,
js_GetErrorMessage, nullptr,
JSMSG_ALREADY_HAS_PRAGMA, filename_,
"//# sourceMappingURL"))
{
@ -1438,7 +1438,7 @@ js::SharedScriptData::new_(ExclusiveContext *cx, uint32_t codeLength,
SharedScriptData *entry = (SharedScriptData *)cx->malloc_(length + dataOffset);
if (!entry)
return NULL;
return nullptr;
entry->length = length;
entry->natoms = natoms;
@ -1467,8 +1467,8 @@ static bool
SaveSharedScriptData(ExclusiveContext *cx, Handle<JSScript *> script, SharedScriptData *ssd,
uint32_t nsrcnotes)
{
ASSERT(script != NULL);
ASSERT(ssd != NULL);
ASSERT(script != nullptr);
ASSERT(ssd != nullptr);
AutoLockForExclusiveAccess lock(cx);
@ -1480,8 +1480,8 @@ SaveSharedScriptData(ExclusiveContext *cx, Handle<JSScript *> script, SharedScri
ssd = *p;
} else {
if (!cx->scriptDataTable().add(p, ssd)) {
script->code = NULL;
script->atoms = NULL;
script->code = nullptr;
script->atoms = nullptr;
js_free(ssd);
js_ReportOutOfMemory(cx);
return false;
@ -1677,7 +1677,7 @@ JSScript::Create(ExclusiveContext *cx, HandleObject enclosingScope, bool savedCa
RootedScript script(cx, js_NewGCScript(cx));
if (!script)
return NULL;
return nullptr;
PodZero(script.get());
new (&script->bindings) Bindings;
@ -1700,9 +1700,9 @@ JSScript::Create(ExclusiveContext *cx, HandleObject enclosingScope, bool savedCa
if (staticLevel > UINT16_MAX) {
if (cx->isJSContext()) {
JS_ReportErrorNumber(cx->asJSContext(),
js_GetErrorMessage, NULL, JSMSG_TOO_DEEP, js_function_str);
js_GetErrorMessage, nullptr, JSMSG_TOO_DEEP, js_function_str);
}
return NULL;
return nullptr;
}
script->staticLevel = uint16_t(staticLevel);
@ -1718,7 +1718,7 @@ AllocScriptData(ExclusiveContext *cx, size_t size)
{
uint8_t *data = static_cast<uint8_t *>(cx->calloc_(JS_ROUNDUP(size, sizeof(Value))));
if (!data)
return NULL;
return nullptr;
// All script data is optional, so size might be 0. In that case, we don't care about alignment.
JS_ASSERT(size == 0 || size_t(data) % sizeof(Value) == 0);
@ -1856,12 +1856,12 @@ JSScript::fullyInitFromEmitter(ExclusiveContext *cx, HandleScript script, Byteco
JS_ASSERT(nfixed < SLOTNO_LIMIT);
script->nfixed = uint16_t(nfixed);
if (script->nfixed + bce->maxStackDepth >= JS_BIT(16)) {
bce->reportError(NULL, JSMSG_NEED_DIET, "script");
bce->reportError(nullptr, JSMSG_NEED_DIET, "script");
return false;
}
script->nslots = script->nfixed + bce->maxStackDepth;
FunctionBox *funbox = bce->sc->isFunctionBox() ? bce->sc->asFunctionBox() : NULL;
FunctionBox *funbox = bce->sc->isFunctionBox() ? bce->sc->asFunctionBox() : nullptr;
if (bce->tryNoteList.length() != 0)
bce->tryNoteList.finish(script->trynotes());
@ -1891,7 +1891,7 @@ JSScript::fullyInitFromEmitter(ExclusiveContext *cx, HandleScript script, Byteco
script->funLength = funbox->length;
}
RootedFunction fun(cx, NULL);
RootedFunction fun(cx, nullptr);
if (funbox) {
JS_ASSERT(!bce->script->noScriptRval);
script->isGeneratorExp = funbox->inGenexpLambda;
@ -1953,7 +1953,7 @@ JSScript::enclosingScriptsCompiledSuccessfully() const
/*
* When a nested script is succesfully compiled, it is eagerly given the
* static JSFunction of its enclosing script. The enclosing function's
* 'script' field will be NULL until the enclosing script successfully
* 'script' field will be nullptr until the enclosing script successfully
* compiles. Thus, we can detect failed compilation by looking for
* JSFunctions in the enclosingScope chain without scripts.
*/
@ -2031,7 +2031,7 @@ static const uint32_t GSN_CACHE_THRESHOLD = 100;
void
GSNCache::purge()
{
code = NULL;
code = nullptr;
if (map.initialized())
map.finish();
}
@ -2041,19 +2041,19 @@ js::GetSrcNote(GSNCache &cache, JSScript *script, jsbytecode *pc)
{
size_t target = pc - script->code;
if (target >= size_t(script->length))
return NULL;
return nullptr;
if (cache.code == script->code) {
JS_ASSERT(cache.map.initialized());
GSNCache::Map::Ptr p = cache.map.lookup(pc);
return p ? p->value : NULL;
return p ? p->value : nullptr;
}
size_t offset = 0;
jssrcnote *result;
for (jssrcnote *sn = script->notes(); ; sn = SN_NEXT(sn)) {
if (SN_IS_TERMINATOR(sn)) {
result = NULL;
result = nullptr;
break;
}
offset += SN_DELTA(sn);
@ -2073,7 +2073,7 @@ js::GetSrcNote(GSNCache &cache, JSScript *script, jsbytecode *pc)
if (cache.code) {
JS_ASSERT(cache.map.initialized());
cache.map.finish();
cache.code = NULL;
cache.code = nullptr;
}
if (cache.map.init(nsrcnotes)) {
pc = script->code;
@ -2224,7 +2224,7 @@ js::CurrentScriptFileLineOrigin(JSContext *cx, const char **file, unsigned *line
JSPrincipals **origin, LineOption opt)
{
if (opt == CALLED_FROM_JSOP_EVAL) {
jsbytecode *pc = NULL;
jsbytecode *pc = nullptr;
JSScript *script = cx->currentScript(&pc);
JS_ASSERT(JSOp(*pc) == JSOP_EVAL || JSOp(*pc) == JSOP_SPREADEVAL);
JS_ASSERT(*(pc + (JSOp(*pc) == JSOP_EVAL ? JSOP_EVAL_LENGTH
@ -2239,7 +2239,7 @@ js::CurrentScriptFileLineOrigin(JSContext *cx, const char **file, unsigned *line
NonBuiltinScriptFrameIter iter(cx);
if (iter.done()) {
*file = NULL;
*file = nullptr;
*linenop = 0;
*origin = cx->compartment()->principals;
return;
@ -2275,7 +2275,7 @@ js::CloneScript(JSContext *cx, HandleObject enclosingScope, HandleFunction fun,
size_t size = src->dataSize;
uint8_t *data = AllocScriptData(cx, size);
if (!data)
return NULL;
return nullptr;
/* Bindings */
@ -2283,7 +2283,7 @@ js::CloneScript(JSContext *cx, HandleObject enclosingScope, HandleFunction fun,
InternalHandle<Bindings*> bindingsHandle =
InternalHandle<Bindings*>::fromMarkedLocation(bindings.address());
if (!Bindings::clone(cx, bindingsHandle, data, src))
return NULL;
return nullptr;
/* Objects */
@ -2312,7 +2312,7 @@ js::CloneScript(JSContext *cx, HandleObject enclosingScope, HandleFunction fun,
if (innerFun->isInterpretedLazy()) {
AutoCompartment ac(cx, innerFun);
if (!innerFun->getOrCreateScript(cx))
return NULL;
return nullptr;
}
RootedObject staticScope(cx, innerFun->nonLazyScript()->enclosingStaticScope());
StaticScopeIter ssi(cx, staticScope);
@ -2334,7 +2334,7 @@ js::CloneScript(JSContext *cx, HandleObject enclosingScope, HandleFunction fun,
clone = CloneObjectLiteral(cx, cx->global(), obj);
}
if (!clone || !objects.append(clone))
return NULL;
return nullptr;
}
}
@ -2346,7 +2346,7 @@ js::CloneScript(JSContext *cx, HandleObject enclosingScope, HandleFunction fun,
for (unsigned i = 0; i < nregexps; i++) {
JSObject *clone = CloneScriptRegExpObject(cx, vector[i]->as<RegExpObject>());
if (!clone || !regexps.append(clone))
return NULL;
return nullptr;
}
}
@ -2363,14 +2363,14 @@ js::CloneScript(JSContext *cx, HandleObject enclosingScope, HandleFunction fun,
/* Make sure we clone the script source object with the script */
RootedScriptSource sourceObject(cx, ScriptSourceObject::create(cx, src->scriptSource()));
if (!sourceObject)
return NULL;
return nullptr;
RootedScript dst(cx, JSScript::Create(cx, enclosingScope, src->savedCallerFun,
options, src->staticLevel,
sourceObject, src->sourceStart, src->sourceEnd));
if (!dst) {
js_free(data);
return NULL;
return nullptr;
}
dst->bindings = bindings;
@ -2452,7 +2452,7 @@ js::CloneFunctionScript(JSContext *cx, HandleFunction original, HandleFunction c
RootedObject scope(cx, script->enclosingStaticScope());
clone->mutableScript().init(NULL);
clone->mutableScript().init(nullptr);
JSScript *cscript = CloneScript(cx, scope, clone, script, newKind);
if (!cscript)
@ -2463,7 +2463,7 @@ js::CloneFunctionScript(JSContext *cx, HandleFunction original, HandleFunction c
script = clone->nonLazyScript();
CallNewScriptHook(cx, script, clone);
RootedGlobalObject global(cx, script->compileAndGo ? &script->global() : NULL);
RootedGlobalObject global(cx, script->compileAndGo ? &script->global() : nullptr);
Debugger::onNewScript(cx, script, global);
return true;
@ -2502,9 +2502,9 @@ JSScript::destroyDebugScript(FreeOp *fop)
for (jsbytecode *pc = code; pc < end; pc++) {
if (BreakpointSite *site = getBreakpointSite(pc)) {
/* Breakpoints are swept before finalization. */
JS_ASSERT(site->firstBreakpoint() == NULL);
site->clearTrap(fop, NULL, NULL);
JS_ASSERT(getBreakpointSite(pc) == NULL);
JS_ASSERT(site->firstBreakpoint() == nullptr);
site->clearTrap(fop, nullptr, nullptr);
JS_ASSERT(getBreakpointSite(pc) == nullptr);
}
}
fop->free_(releaseDebugScript());
@ -2558,7 +2558,7 @@ JSScript::recompileForStepMode(FreeOp *fop)
{
#ifdef JS_ION
if (hasBaselineScript())
baseline->toggleDebugTraps(this, NULL);
baseline->toggleDebugTraps(this, nullptr);
#endif
}
@ -2615,7 +2615,7 @@ JSScript::getOrCreateBreakpointSite(JSContext *cx, jsbytecode *pc)
JS_ASSERT(size_t(pc - code) < length);
if (!ensureHasDebugScript(cx))
return NULL;
return nullptr;
DebugScript *debug = debugScript();
BreakpointSite *&site = debug->breakpoints[pc - code];
@ -2624,7 +2624,7 @@ JSScript::getOrCreateBreakpointSite(JSContext *cx, jsbytecode *pc)
site = cx->runtime()->new_<BreakpointSite>(this, pc);
if (!site) {
js_ReportOutOfMemory(cx);
return NULL;
return nullptr;
}
debug->numSites++;
}
@ -2642,7 +2642,7 @@ JSScript::destroyBreakpointSite(FreeOp *fop, jsbytecode *pc)
JS_ASSERT(site);
fop->delete_(site);
site = NULL;
site = nullptr;
if (--debug->numSites == 0 && !stepModeEnabled())
fop->free_(releaseDebugScript());
@ -2927,10 +2927,10 @@ JSScript::formalLivesInArgumentsObject(unsigned argSlot)
LazyScript::LazyScript(JSFunction *fun, void *table, uint32_t numFreeVariables, uint32_t numInnerFunctions,
JSVersion version, uint32_t begin, uint32_t end, uint32_t lineno, uint32_t column)
: script_(NULL),
: script_(nullptr),
function_(fun),
enclosingScope_(NULL),
sourceObject_(NULL),
enclosingScope_(nullptr),
sourceObject_(nullptr),
table_(table),
version_(version),
numFreeVariables_(numFreeVariables),
@ -2969,7 +2969,7 @@ LazyScript::setParent(JSObject *enclosingScope, ScriptSourceObject *sourceObject
ScriptSourceObject *
LazyScript::sourceObject() const
{
return sourceObject_ ? &sourceObject_->as<ScriptSourceObject>() : NULL;
return sourceObject_ ? &sourceObject_->as<ScriptSourceObject>() : nullptr;
}
/* static */ LazyScript *
@ -2982,16 +2982,16 @@ LazyScript::Create(ExclusiveContext *cx, HandleFunction fun,
size_t bytes = (numFreeVariables * sizeof(HeapPtrAtom))
+ (numInnerFunctions * sizeof(HeapPtrFunction));
void *table = NULL;
void *table = nullptr;
if (bytes) {
table = cx->malloc_(bytes);
if (!table)
return NULL;
return nullptr;
}
LazyScript *res = js_NewGCLazyScript(cx);
if (!res)
return NULL;
return nullptr;
return new (res) LazyScript(fun, table, numFreeVariables, numInnerFunctions, version,
begin, end, lineno, column);
@ -3018,8 +3018,8 @@ JSScript::updateBaselineOrIonRaw()
baselineOrIonRaw = baseline->method()->raw();
baselineOrIonSkipArgCheck = baseline->method()->raw();
} else {
baselineOrIonRaw = NULL;
baselineOrIonSkipArgCheck = NULL;
baselineOrIonRaw = nullptr;
baselineOrIonSkipArgCheck = nullptr;
}
#endif
}

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

@ -241,7 +241,7 @@ class ScriptCounts
jit::IonScriptCounts *ionCounts;
public:
ScriptCounts() : pcCountsVector(NULL), ionCounts(NULL) { }
ScriptCounts() : pcCountsVector(nullptr), ionCounts(nullptr) { }
inline void destroy(FreeOp *fop);
@ -290,7 +290,7 @@ class ScriptSource
union {
// Before setSourceCopy or setSource are successfully called, this union
// has a NULL pointer. When the script source is ready,
// has a nullptr pointer. When the script source is ready,
// compressedLength_ != 0 implies compressed holds the compressed data;
// otherwise, source holds the uncompressed source. There is a special
// pointer |emptySource| for source code for length 0.
@ -320,15 +320,15 @@ class ScriptSource
: refs(0),
length_(0),
compressedLength_(0),
filename_(NULL),
sourceURL_(NULL),
sourceMapURL_(NULL),
filename_(nullptr),
sourceURL_(nullptr),
sourceMapURL_(nullptr),
originPrincipals_(originPrincipals),
sourceRetrievable_(false),
argumentsNotIncluded_(false),
ready_(true)
{
data.source = NULL;
data.source = nullptr;
if (originPrincipals_)
JS_HoldPrincipals(originPrincipals_);
}
@ -372,12 +372,12 @@ class ScriptSource
// Source URLs
bool setSourceURL(ExclusiveContext *cx, const jschar *sourceURL);
const jschar *sourceURL();
bool hasSourceURL() const { return sourceURL_ != NULL; }
bool hasSourceURL() const { return sourceURL_ != nullptr; }
// Source maps
bool setSourceMapURL(ExclusiveContext *cx, const jschar *sourceMapURL);
const jschar *sourceMapURL();
bool hasSourceMapURL() const { return sourceMapURL_ != NULL; }
bool hasSourceMapURL() const { return sourceMapURL_ != nullptr; }
JSPrincipals *originPrincipals() const { return originPrincipals_; }
@ -486,8 +486,8 @@ class JSScript : public js::gc::BarrieredCell<JSScript>
js::jit::IonScript *parallelIon;
/*
* Pointer to either baseline->method()->raw() or ion->method()->raw(), or NULL
* if there's no Baseline or Ion script.
* Pointer to either baseline->method()->raw() or ion->method()->raw(), or
* nullptr if there's no Baseline or Ion script.
*/
uint8_t *baselineOrIonRaw;
uint8_t *baselineOrIonSkipArgCheck;
@ -797,7 +797,7 @@ class JSScript : public js::gc::BarrieredCell<JSScript>
/*
* Original compiled function for the script, if it has a function.
* NULL for global and eval scripts.
* nullptr for global and eval scripts.
*/
JSFunction *function() const { return function_; }
inline void setFunction(JSFunction *fun);
@ -851,7 +851,7 @@ class JSScript : public js::gc::BarrieredCell<JSScript>
/* See StaticScopeIter comment. */
JSObject *enclosingStaticScope() const {
if (isCallsiteClone)
return NULL;
return nullptr;
return enclosingScopeOrOriginalFunction_;
}
@ -1035,7 +1035,7 @@ class JSScript : public js::gc::BarrieredCell<JSScript>
js::BreakpointSite *getBreakpointSite(jsbytecode *pc)
{
JS_ASSERT(size_t(pc - code) < length);
return hasDebugScript ? debugScript()->breakpoints[pc - code] : NULL;
return hasDebugScript ? debugScript()->breakpoints[pc - code] : nullptr;
}
js::BreakpointSite *getOrCreateBreakpointSite(JSContext *cx, jsbytecode *pc);
@ -1157,18 +1157,18 @@ class AliasedFormalIter
// bytecode from its source.
class LazyScript : public gc::BarrieredCell<LazyScript>
{
// If non-NULL, the script has been compiled and this is a forwarding
// If non-nullptr, the script has been compiled and this is a forwarding
// pointer to the result.
HeapPtrScript script_;
// Original function with which the lazy script is associated.
HeapPtrFunction function_;
// Function or block chain in which the script is nested, or NULL.
// Function or block chain in which the script is nested, or nullptr.
HeapPtrObject enclosingScope_;
// Source code object, or NULL if the script in which this is nested has
// not been compiled yet.
// Source code object, or nullptr if the script in which this is nested
// has not been compiled yet.
HeapPtrObject sourceObject_;
// Heap allocated table with any free variables or inner functions.
@ -1364,7 +1364,7 @@ struct SharedScriptData
HeapPtrAtom *atoms() {
if (!natoms)
return NULL;
return nullptr;
return reinterpret_cast<HeapPtrAtom *>(data + length - sizeof(JSAtom *) * natoms);
}
@ -1439,18 +1439,18 @@ js_GetScriptLineExtent(JSScript *script);
namespace js {
extern unsigned
PCToLineNumber(JSScript *script, jsbytecode *pc, unsigned *columnp = NULL);
PCToLineNumber(JSScript *script, jsbytecode *pc, unsigned *columnp = nullptr);
extern unsigned
PCToLineNumber(unsigned startLine, jssrcnote *notes, jsbytecode *code, jsbytecode *pc,
unsigned *columnp = NULL);
unsigned *columnp = nullptr);
/*
* This function returns the file and line number of the script currently
* executing on cx. If there is no current script executing on cx (e.g., a
* native called directly through JSAPI (e.g., by setTimeout)), NULL and 0 are
* returned as the file and line. Additionally, this function avoids the full
* linear scan to compute line number when the caller guarantees that the
* native called directly through JSAPI (e.g., by setTimeout)), nullptr and 0
* are returned as the file and line. Additionally, this function avoids the
* full linear scan to compute line number when the caller guarantees that the
* script compilation occurs at a JSOP_EVAL/JSOP_SPREADEVAL.
*/
@ -1472,7 +1472,7 @@ CloneFunctionScript(JSContext *cx, HandleFunction original, HandleFunction clone
NewObjectKind newKind = GenericObject);
/*
* JSAPI clients are allowed to leave CompileOptions.originPrincipals NULL in
* JSAPI clients are allowed to leave CompileOptions.originPrincipals nullptr in
* which case the JS engine sets options.originPrincipals = origin.principals.
* This normalization step must occur before the originPrincipals get stored in
* the JSScript/ScriptSource.