зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1142282 part 1. Remove the parent argument of NewNativeObjectWithGivenProto. r=waldo
This commit is contained in:
Родитель
d0524b1a9e
Коммит
2fd882441b
|
@ -1806,8 +1806,7 @@ js::DeepCloneObjectLiteral(JSContext *cx, HandleNativeObject obj, NewObjectKind
|
||||||
RootedObject proto(cx, group->proto().toObject());
|
RootedObject proto(cx, group->proto().toObject());
|
||||||
obj->assertParentIs(cx->global());
|
obj->assertParentIs(cx->global());
|
||||||
clone = NewNativeObjectWithGivenProto(cx, &PlainObject::class_, proto,
|
clone = NewNativeObjectWithGivenProto(cx, &PlainObject::class_, proto,
|
||||||
NullPtr(), kind,
|
kind, newKind);
|
||||||
newKind);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Allocate the same number of slots.
|
// Allocate the same number of slots.
|
||||||
|
|
|
@ -452,7 +452,7 @@ Debugger::getScriptFrameWithIter(JSContext *cx, AbstractFramePtr frame,
|
||||||
/* Create and populate the Debugger.Frame object. */
|
/* Create and populate the Debugger.Frame object. */
|
||||||
RootedObject proto(cx, &object->getReservedSlot(JSSLOT_DEBUG_FRAME_PROTO).toObject());
|
RootedObject proto(cx, &object->getReservedSlot(JSSLOT_DEBUG_FRAME_PROTO).toObject());
|
||||||
RootedNativeObject frameobj(cx, NewNativeObjectWithGivenProto(cx, &DebuggerFrame_class,
|
RootedNativeObject frameobj(cx, NewNativeObjectWithGivenProto(cx, &DebuggerFrame_class,
|
||||||
proto, NullPtr()));
|
proto));
|
||||||
if (!frameobj)
|
if (!frameobj)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -771,7 +771,7 @@ Debugger::wrapEnvironment(JSContext *cx, Handle<Env*> env, MutableHandleValue rv
|
||||||
} else {
|
} else {
|
||||||
/* Create a new Debugger.Environment for env. */
|
/* Create a new Debugger.Environment for env. */
|
||||||
RootedObject proto(cx, &object->getReservedSlot(JSSLOT_DEBUG_ENV_PROTO).toObject());
|
RootedObject proto(cx, &object->getReservedSlot(JSSLOT_DEBUG_ENV_PROTO).toObject());
|
||||||
envobj = NewNativeObjectWithGivenProto(cx, &DebuggerEnv_class, proto, NullPtr(),
|
envobj = NewNativeObjectWithGivenProto(cx, &DebuggerEnv_class, proto,
|
||||||
TenuredObject);
|
TenuredObject);
|
||||||
if (!envobj)
|
if (!envobj)
|
||||||
return false;
|
return false;
|
||||||
|
@ -814,7 +814,7 @@ Debugger::wrapDebuggeeValue(JSContext *cx, MutableHandleValue vp)
|
||||||
/* Create a new Debugger.Object for obj. */
|
/* Create a new Debugger.Object for obj. */
|
||||||
RootedObject proto(cx, &object->getReservedSlot(JSSLOT_DEBUG_OBJECT_PROTO).toObject());
|
RootedObject proto(cx, &object->getReservedSlot(JSSLOT_DEBUG_OBJECT_PROTO).toObject());
|
||||||
NativeObject *dobj =
|
NativeObject *dobj =
|
||||||
NewNativeObjectWithGivenProto(cx, &DebuggerObject_class, proto, NullPtr(),
|
NewNativeObjectWithGivenProto(cx, &DebuggerObject_class, proto,
|
||||||
TenuredObject);
|
TenuredObject);
|
||||||
if (!dobj)
|
if (!dobj)
|
||||||
return false;
|
return false;
|
||||||
|
@ -2917,8 +2917,7 @@ Debugger::construct(JSContext *cx, unsigned argc, Value *vp)
|
||||||
* Debugger.{Frame,Object,Script,Memory}.prototype in reserved slots. The
|
* Debugger.{Frame,Object,Script,Memory}.prototype in reserved slots. The
|
||||||
* rest of the reserved slots are for hooks; they default to undefined.
|
* rest of the reserved slots are for hooks; they default to undefined.
|
||||||
*/
|
*/
|
||||||
RootedNativeObject obj(cx, NewNativeObjectWithGivenProto(cx, &Debugger::jsclass, proto,
|
RootedNativeObject obj(cx, NewNativeObjectWithGivenProto(cx, &Debugger::jsclass, proto));
|
||||||
NullPtr()));
|
|
||||||
if (!obj)
|
if (!obj)
|
||||||
return false;
|
return false;
|
||||||
for (unsigned slot = JSSLOT_DEBUG_PROTO_START; slot < JSSLOT_DEBUG_PROTO_STOP; slot++)
|
for (unsigned slot = JSSLOT_DEBUG_PROTO_START; slot < JSSLOT_DEBUG_PROTO_STOP; slot++)
|
||||||
|
@ -4160,7 +4159,7 @@ Debugger::newDebuggerScript(JSContext *cx, HandleScript script)
|
||||||
RootedObject proto(cx, &object->getReservedSlot(JSSLOT_DEBUG_SCRIPT_PROTO).toObject());
|
RootedObject proto(cx, &object->getReservedSlot(JSSLOT_DEBUG_SCRIPT_PROTO).toObject());
|
||||||
MOZ_ASSERT(proto);
|
MOZ_ASSERT(proto);
|
||||||
NativeObject *scriptobj = NewNativeObjectWithGivenProto(cx, &DebuggerScript_class,
|
NativeObject *scriptobj = NewNativeObjectWithGivenProto(cx, &DebuggerScript_class,
|
||||||
proto, NullPtr(), TenuredObject);
|
proto, TenuredObject);
|
||||||
if (!scriptobj)
|
if (!scriptobj)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
scriptobj->setReservedSlot(JSSLOT_DEBUGSCRIPT_OWNER, ObjectValue(*object));
|
scriptobj->setReservedSlot(JSSLOT_DEBUGSCRIPT_OWNER, ObjectValue(*object));
|
||||||
|
@ -5182,7 +5181,7 @@ Debugger::newDebuggerSource(JSContext *cx, HandleScriptSource source)
|
||||||
RootedObject proto(cx, &object->getReservedSlot(JSSLOT_DEBUG_SOURCE_PROTO).toObject());
|
RootedObject proto(cx, &object->getReservedSlot(JSSLOT_DEBUG_SOURCE_PROTO).toObject());
|
||||||
MOZ_ASSERT(proto);
|
MOZ_ASSERT(proto);
|
||||||
NativeObject *sourceobj = NewNativeObjectWithGivenProto(cx, &DebuggerSource_class,
|
NativeObject *sourceobj = NewNativeObjectWithGivenProto(cx, &DebuggerSource_class,
|
||||||
proto, NullPtr(), TenuredObject);
|
proto, TenuredObject);
|
||||||
if (!sourceobj)
|
if (!sourceobj)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
sourceobj->setReservedSlot(JSSLOT_DEBUGSOURCE_OWNER, ObjectValue(*object));
|
sourceobj->setReservedSlot(JSSLOT_DEBUGSOURCE_OWNER, ObjectValue(*object));
|
||||||
|
@ -5822,8 +5821,7 @@ DebuggerFrame_getArguments(JSContext *cx, unsigned argc, Value *vp)
|
||||||
RootedObject proto(cx, GlobalObject::getOrCreateArrayPrototype(cx, global));
|
RootedObject proto(cx, GlobalObject::getOrCreateArrayPrototype(cx, global));
|
||||||
if (!proto)
|
if (!proto)
|
||||||
return false;
|
return false;
|
||||||
argsobj = NewNativeObjectWithGivenProto(cx, &DebuggerArguments_class, proto,
|
argsobj = NewNativeObjectWithGivenProto(cx, &DebuggerArguments_class, proto);
|
||||||
GlobalObject::upcast(global));
|
|
||||||
if (!argsobj)
|
if (!argsobj)
|
||||||
return false;
|
return false;
|
||||||
SetReservedSlot(argsobj, JSSLOT_DEBUGARGUMENTS_FRAME, ObjectValue(*thisobj));
|
SetReservedSlot(argsobj, JSSLOT_DEBUGARGUMENTS_FRAME, ObjectValue(*thisobj));
|
||||||
|
|
|
@ -41,8 +41,7 @@ DebuggerMemory::create(JSContext *cx, Debugger *dbg)
|
||||||
{
|
{
|
||||||
Value memoryProtoValue = dbg->object->getReservedSlot(Debugger::JSSLOT_DEBUG_MEMORY_PROTO);
|
Value memoryProtoValue = dbg->object->getReservedSlot(Debugger::JSSLOT_DEBUG_MEMORY_PROTO);
|
||||||
RootedObject memoryProto(cx, &memoryProtoValue.toObject());
|
RootedObject memoryProto(cx, &memoryProtoValue.toObject());
|
||||||
RootedNativeObject memory(cx, NewNativeObjectWithGivenProto(cx, &class_, memoryProto,
|
RootedNativeObject memory(cx, NewNativeObjectWithGivenProto(cx, &class_, memoryProto));
|
||||||
NullPtr()));
|
|
||||||
if (!memory)
|
if (!memory)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
|
|
|
@ -35,13 +35,13 @@ GeneratorObject::create(JSContext *cx, AbstractFramePtr frame)
|
||||||
if (!proto)
|
if (!proto)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
obj = NewNativeObjectWithGivenProto(cx, &StarGeneratorObject::class_, proto, global);
|
obj = NewNativeObjectWithGivenProto(cx, &StarGeneratorObject::class_, proto);
|
||||||
} else {
|
} else {
|
||||||
MOZ_ASSERT(frame.script()->isLegacyGenerator());
|
MOZ_ASSERT(frame.script()->isLegacyGenerator());
|
||||||
RootedObject proto(cx, GlobalObject::getOrCreateLegacyGeneratorObjectPrototype(cx, global));
|
RootedObject proto(cx, GlobalObject::getOrCreateLegacyGeneratorObjectPrototype(cx, global));
|
||||||
if (!proto)
|
if (!proto)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
obj = NewNativeObjectWithGivenProto(cx, &LegacyGeneratorObject::class_, proto, global);
|
obj = NewNativeObjectWithGivenProto(cx, &LegacyGeneratorObject::class_, proto);
|
||||||
}
|
}
|
||||||
if (!obj)
|
if (!obj)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
|
@ -442,7 +442,7 @@ CreateBlankProto(JSContext *cx, const Class *clasp, HandleObject proto, HandleOb
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(clasp != &JSFunction::class_);
|
MOZ_ASSERT(clasp != &JSFunction::class_);
|
||||||
|
|
||||||
RootedNativeObject blankProto(cx, NewNativeObjectWithGivenProto(cx, clasp, proto, global,
|
RootedNativeObject blankProto(cx, NewNativeObjectWithGivenProto(cx, clasp, proto,
|
||||||
SingletonObject));
|
SingletonObject));
|
||||||
if (!blankProto || !blankProto->setDelegate(cx))
|
if (!blankProto || !blankProto->setDelegate(cx))
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
@ -524,8 +524,7 @@ GlobalObject::getOrCreateDebuggers(JSContext *cx, Handle<GlobalObject*> global)
|
||||||
if (debuggers)
|
if (debuggers)
|
||||||
return debuggers;
|
return debuggers;
|
||||||
|
|
||||||
NativeObject *obj = NewNativeObjectWithGivenProto(cx, &GlobalDebuggees_class, NullPtr(),
|
NativeObject *obj = NewNativeObjectWithGivenProto(cx, &GlobalDebuggees_class, NullPtr());
|
||||||
global);
|
|
||||||
if (!obj)
|
if (!obj)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
debuggers = cx->new_<DebuggerVector>();
|
debuggers = cx->new_<DebuggerVector>();
|
||||||
|
|
|
@ -360,18 +360,18 @@ NewNativeObjectWithGivenTaggedProto(ExclusiveContext *cx, const Class *clasp,
|
||||||
|
|
||||||
inline NativeObject *
|
inline NativeObject *
|
||||||
NewNativeObjectWithGivenProto(ExclusiveContext *cx, const Class *clasp,
|
NewNativeObjectWithGivenProto(ExclusiveContext *cx, const Class *clasp,
|
||||||
HandleObject proto, HandleObject parent,
|
HandleObject proto,
|
||||||
gc::AllocKind allocKind, NewObjectKind newKind)
|
gc::AllocKind allocKind, NewObjectKind newKind)
|
||||||
{
|
{
|
||||||
return MaybeNativeObject(NewObjectWithGivenProto(cx, clasp, proto, parent, allocKind, newKind));
|
return MaybeNativeObject(NewObjectWithGivenProto(cx, clasp, proto, NullPtr(), allocKind, newKind));
|
||||||
}
|
}
|
||||||
|
|
||||||
inline NativeObject *
|
inline NativeObject *
|
||||||
NewNativeObjectWithGivenProto(ExclusiveContext *cx, const Class *clasp,
|
NewNativeObjectWithGivenProto(ExclusiveContext *cx, const Class *clasp,
|
||||||
HandleObject proto, HandleObject parent,
|
HandleObject proto,
|
||||||
NewObjectKind newKind = GenericObject)
|
NewObjectKind newKind = GenericObject)
|
||||||
{
|
{
|
||||||
return MaybeNativeObject(NewObjectWithGivenProto(cx, clasp, proto, parent, newKind));
|
return MaybeNativeObject(NewObjectWithGivenProto(cx, clasp, proto, NullPtr(), newKind));
|
||||||
}
|
}
|
||||||
|
|
||||||
inline NativeObject *
|
inline NativeObject *
|
||||||
|
|
|
@ -308,7 +308,7 @@ const Class ForOfPIC::jsclass = {
|
||||||
js::ForOfPIC::createForOfPICObject(JSContext *cx, Handle<GlobalObject*> global)
|
js::ForOfPIC::createForOfPICObject(JSContext *cx, Handle<GlobalObject*> global)
|
||||||
{
|
{
|
||||||
assertSameCompartment(cx, global);
|
assertSameCompartment(cx, global);
|
||||||
NativeObject *obj = NewNativeObjectWithGivenProto(cx, &ForOfPIC::jsclass, NullPtr(), global);
|
NativeObject *obj = NewNativeObjectWithGivenProto(cx, &ForOfPIC::jsclass, NullPtr());
|
||||||
if (!obj)
|
if (!obj)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
ForOfPIC::Chain *chain = cx->new_<ForOfPIC::Chain>();
|
ForOfPIC::Chain *chain = cx->new_<ForOfPIC::Chain>();
|
||||||
|
|
Загрузка…
Ссылка в новой задаче