mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-30 11:07:29 +09:00
1320408 - Part 9: Change JSObject::setFlags and depending methods to static method.
This commit is contained in:
parent
7e0b20a7bf
commit
7f856ff769
14 changed files with 61 additions and 55 deletions
|
|
@ -3489,7 +3489,7 @@ CreateNonSyntacticEnvironmentChain(JSContext* cx, AutoObjectVector& envChain,
|
||||||
// declaration was qualified by "var". There is only sadness.
|
// declaration was qualified by "var". There is only sadness.
|
||||||
//
|
//
|
||||||
// See JSObject::isQualifiedVarObj.
|
// See JSObject::isQualifiedVarObj.
|
||||||
if (!env->setQualifiedVarObj(cx))
|
if (!JSObject::setQualifiedVarObj(cx, env))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Also get a non-syntactic lexical environment to capture 'let' and
|
// Also get a non-syntactic lexical environment to capture 'let' and
|
||||||
|
|
|
||||||
|
|
@ -3266,7 +3266,7 @@ CreateArrayPrototype(JSContext* cx, JSProtoKey key)
|
||||||
metadata));
|
metadata));
|
||||||
if (!arrayProto ||
|
if (!arrayProto ||
|
||||||
!JSObject::setSingleton(cx, arrayProto) ||
|
!JSObject::setSingleton(cx, arrayProto) ||
|
||||||
!arrayProto->setDelegate(cx) ||
|
!JSObject::setDelegate(cx, arrayProto) ||
|
||||||
!AddLengthProperty(cx, arrayProto))
|
!AddLengthProperty(cx, arrayProto))
|
||||||
{
|
{
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
|
||||||
|
|
@ -654,7 +654,7 @@ VectorToKeyIterator(JSContext* cx, HandleObject obj, unsigned flags, AutoIdVecto
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(!(flags & JSITER_FOREACH));
|
MOZ_ASSERT(!(flags & JSITER_FOREACH));
|
||||||
|
|
||||||
if (obj->isSingleton() && !obj->setIteratedSingleton(cx))
|
if (obj->isSingleton() && !JSObject::setIteratedSingleton(cx, obj))
|
||||||
return false;
|
return false;
|
||||||
MarkObjectGroupFlags(cx, obj, OBJECT_FLAG_ITERATED);
|
MarkObjectGroupFlags(cx, obj, OBJECT_FLAG_ITERATED);
|
||||||
|
|
||||||
|
|
@ -698,7 +698,7 @@ VectorToValueIterator(JSContext* cx, HandleObject obj, unsigned flags, AutoIdVec
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(flags & JSITER_FOREACH);
|
MOZ_ASSERT(flags & JSITER_FOREACH);
|
||||||
|
|
||||||
if (obj->isSingleton() && !obj->setIteratedSingleton(cx))
|
if (obj->isSingleton() && !JSObject::setIteratedSingleton(cx, obj))
|
||||||
return false;
|
return false;
|
||||||
MarkObjectGroupFlags(cx, obj, OBJECT_FLAG_ITERATED);
|
MarkObjectGroupFlags(cx, obj, OBJECT_FLAG_ITERATED);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1842,7 +1842,7 @@ js::SetClassAndProto(JSContext* cx, HandleObject obj,
|
||||||
if (!oldproto->as<NativeObject>().generateOwnShape(cx))
|
if (!oldproto->as<NativeObject>().generateOwnShape(cx))
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
if (!oldproto->setUncacheableProto(cx))
|
if (!JSObject::setUncacheableProto(cx, oldproto))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!obj->isDelegate()) {
|
if (!obj->isDelegate()) {
|
||||||
|
|
@ -1854,8 +1854,11 @@ js::SetClassAndProto(JSContext* cx, HandleObject obj,
|
||||||
oldproto = oldproto->staticPrototype();
|
oldproto = oldproto->staticPrototype();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (proto.isObject() && !proto.toObject()->setDelegate(cx))
|
if (proto.isObject()) {
|
||||||
return false;
|
RootedObject protoObj(cx, proto.toObject());
|
||||||
|
if (!JSObject::setDelegate(cx, protoObj))
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (obj->isSingleton()) {
|
if (obj->isSingleton()) {
|
||||||
/*
|
/*
|
||||||
|
|
@ -2611,7 +2614,7 @@ js::PreventExtensions(JSContext* cx, HandleObject obj, ObjectOpResult& result, I
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!obj->setFlags(cx, BaseShape::NOT_EXTENSIBLE, JSObject::GENERATE_SHAPE)) {
|
if (!JSObject::setFlags(cx, obj, BaseShape::NOT_EXTENSIBLE, JSObject::GENERATE_SHAPE)) {
|
||||||
// We failed to mark the object non-extensible, so reset the frozen
|
// We failed to mark the object non-extensible, so reset the frozen
|
||||||
// flag on the elements.
|
// flag on the elements.
|
||||||
MOZ_ASSERT(obj->nonProxyIsExtensible());
|
MOZ_ASSERT(obj->nonProxyIsExtensible());
|
||||||
|
|
@ -2751,7 +2754,7 @@ js::SetImmutablePrototype(ExclusiveContext* cx, HandleObject obj, bool* succeede
|
||||||
return Proxy::setImmutablePrototype(cx->asJSContext(), obj, succeeded);
|
return Proxy::setImmutablePrototype(cx->asJSContext(), obj, succeeded);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!obj->setFlags(cx, BaseShape::IMMUTABLE_PROTOTYPE))
|
if (!JSObject::setFlags(cx, obj, BaseShape::IMMUTABLE_PROTOTYPE))
|
||||||
return false;
|
return false;
|
||||||
*succeeded = true;
|
*succeeded = true;
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -200,8 +200,8 @@ class JSObject : public js::gc::Cell
|
||||||
GENERATE_SHAPE
|
GENERATE_SHAPE
|
||||||
};
|
};
|
||||||
|
|
||||||
bool setFlags(js::ExclusiveContext* cx, js::BaseShape::Flag flags,
|
static bool setFlags(js::ExclusiveContext* cx, JS::HandleObject obj, js::BaseShape::Flag flags,
|
||||||
GenerateShape generateShape = GENERATE_NONE);
|
GenerateShape generateShape = GENERATE_NONE);
|
||||||
inline bool hasAllFlags(js::BaseShape::Flag flags) const;
|
inline bool hasAllFlags(js::BaseShape::Flag flags) const;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -214,16 +214,16 @@ class JSObject : public js::gc::Cell
|
||||||
* (see Purge{Scope,Proto}Chain in jsobj.cpp).
|
* (see Purge{Scope,Proto}Chain in jsobj.cpp).
|
||||||
*/
|
*/
|
||||||
inline bool isDelegate() const;
|
inline bool isDelegate() const;
|
||||||
bool setDelegate(js::ExclusiveContext* cx) {
|
static bool setDelegate(js::ExclusiveContext* cx, JS::HandleObject obj) {
|
||||||
return setFlags(cx, js::BaseShape::DELEGATE, GENERATE_SHAPE);
|
return setFlags(cx, obj, js::BaseShape::DELEGATE, GENERATE_SHAPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool isBoundFunction() const;
|
inline bool isBoundFunction() const;
|
||||||
inline bool hasSpecialEquality() const;
|
inline bool hasSpecialEquality() const;
|
||||||
|
|
||||||
inline bool watched() const;
|
inline bool watched() const;
|
||||||
bool setWatched(js::ExclusiveContext* cx) {
|
static bool setWatched(js::ExclusiveContext* cx, JS::HandleObject obj) {
|
||||||
return setFlags(cx, js::BaseShape::WATCHED, GENERATE_SHAPE);
|
return setFlags(cx, obj, js::BaseShape::WATCHED, GENERATE_SHAPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
// A "qualified" varobj is the object on which "qualified" variable
|
// A "qualified" varobj is the object on which "qualified" variable
|
||||||
|
|
@ -247,8 +247,8 @@ class JSObject : public js::gc::Cell
|
||||||
// (e.g., Gecko and XPConnect), as they often wish to run scripts under a
|
// (e.g., Gecko and XPConnect), as they often wish to run scripts under a
|
||||||
// scope that captures var bindings.
|
// scope that captures var bindings.
|
||||||
inline bool isQualifiedVarObj() const;
|
inline bool isQualifiedVarObj() const;
|
||||||
bool setQualifiedVarObj(js::ExclusiveContext* cx) {
|
static bool setQualifiedVarObj(js::ExclusiveContext* cx, JS::HandleObject obj) {
|
||||||
return setFlags(cx, js::BaseShape::QUALIFIED_VAROBJ);
|
return setFlags(cx, obj, js::BaseShape::QUALIFIED_VAROBJ);
|
||||||
}
|
}
|
||||||
|
|
||||||
// An "unqualified" varobj is the object on which "unqualified"
|
// An "unqualified" varobj is the object on which "unqualified"
|
||||||
|
|
@ -262,11 +262,11 @@ class JSObject : public js::gc::Cell
|
||||||
// generate a new shape when their prototype changes, regardless of this
|
// generate a new shape when their prototype changes, regardless of this
|
||||||
// hasUncacheableProto flag.
|
// hasUncacheableProto flag.
|
||||||
inline bool hasUncacheableProto() const;
|
inline bool hasUncacheableProto() const;
|
||||||
bool setUncacheableProto(js::ExclusiveContext* cx) {
|
static bool setUncacheableProto(js::ExclusiveContext* cx, JS::HandleObject obj) {
|
||||||
MOZ_ASSERT(hasStaticPrototype(),
|
MOZ_ASSERT(obj->hasStaticPrototype(),
|
||||||
"uncacheability as a concept is only applicable to static "
|
"uncacheability as a concept is only applicable to static "
|
||||||
"(not dynamically-computed) prototypes");
|
"(not dynamically-computed) prototypes");
|
||||||
return setFlags(cx, js::BaseShape::UNCACHEABLE_PROTO, GENERATE_SHAPE);
|
return setFlags(cx, obj, js::BaseShape::UNCACHEABLE_PROTO, GENERATE_SHAPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -274,8 +274,8 @@ class JSObject : public js::gc::Cell
|
||||||
* PropertyTree::MAX_HEIGHT.
|
* PropertyTree::MAX_HEIGHT.
|
||||||
*/
|
*/
|
||||||
inline bool hadElementsAccess() const;
|
inline bool hadElementsAccess() const;
|
||||||
bool setHadElementsAccess(js::ExclusiveContext* cx) {
|
static bool setHadElementsAccess(js::ExclusiveContext* cx, JS::HandleObject obj) {
|
||||||
return setFlags(cx, js::BaseShape::HAD_ELEMENTS_ACCESS);
|
return setFlags(cx, obj, js::BaseShape::HAD_ELEMENTS_ACCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -421,8 +421,8 @@ class JSObject : public js::gc::Cell
|
||||||
* is purged on GC.
|
* is purged on GC.
|
||||||
*/
|
*/
|
||||||
inline bool isIteratedSingleton() const;
|
inline bool isIteratedSingleton() const;
|
||||||
bool setIteratedSingleton(js::ExclusiveContext* cx) {
|
static bool setIteratedSingleton(js::ExclusiveContext* cx, JS::HandleObject obj) {
|
||||||
return setFlags(cx, js::BaseShape::ITERATED_SINGLETON);
|
return setFlags(cx, obj, js::BaseShape::ITERATED_SINGLETON);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -434,8 +434,8 @@ class JSObject : public js::gc::Cell
|
||||||
|
|
||||||
// Mark an object as having its 'new' script information cleared.
|
// Mark an object as having its 'new' script information cleared.
|
||||||
inline bool wasNewScriptCleared() const;
|
inline bool wasNewScriptCleared() const;
|
||||||
bool setNewScriptCleared(js::ExclusiveContext* cx) {
|
static bool setNewScriptCleared(js::ExclusiveContext* cx, JS::HandleObject obj) {
|
||||||
return setFlags(cx, js::BaseShape::NEW_SCRIPT_CLEARED);
|
return setFlags(cx, obj, js::BaseShape::NEW_SCRIPT_CLEARED);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set a new prototype for an object with a singleton type. */
|
/* Set a new prototype for an object with a singleton type. */
|
||||||
|
|
|
||||||
|
|
@ -64,7 +64,7 @@ WatchpointMap::watch(JSContext* cx, HandleObject obj, HandleId id,
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(JSID_IS_STRING(id) || JSID_IS_INT(id) || JSID_IS_SYMBOL(id));
|
MOZ_ASSERT(JSID_IS_STRING(id) || JSID_IS_INT(id) || JSID_IS_SYMBOL(id));
|
||||||
|
|
||||||
if (!obj->setWatched(cx))
|
if (!JSObject::setWatched(cx, obj))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
Watchpoint w(handler, closure, false);
|
Watchpoint w(handler, closure, false);
|
||||||
|
|
|
||||||
|
|
@ -89,7 +89,7 @@ CrossCompartmentWrapper::getPrototype(JSContext* cx, HandleObject wrapper,
|
||||||
if (!GetPrototype(cx, wrapped, protop))
|
if (!GetPrototype(cx, wrapped, protop))
|
||||||
return false;
|
return false;
|
||||||
if (protop) {
|
if (protop) {
|
||||||
if (!protop->setDelegate(cx))
|
if (!JSObject::setDelegate(cx, protop))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -122,7 +122,7 @@ CrossCompartmentWrapper::getPrototypeIfOrdinary(JSContext* cx, HandleObject wrap
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (protop) {
|
if (protop) {
|
||||||
if (!protop->setDelegate(cx))
|
if (!JSObject::setDelegate(cx, protop))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -816,7 +816,7 @@ NonSyntacticVariablesObject::create(JSContext* cx)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
MOZ_ASSERT(obj->isUnqualifiedVarObj());
|
MOZ_ASSERT(obj->isUnqualifiedVarObj());
|
||||||
if (!obj->setQualifiedVarObj(cx))
|
if (!JSObject::setQualifiedVarObj(cx, obj))
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
obj->initEnclosingEnvironment(&cx->global()->lexicalEnvironment());
|
obj->initEnclosingEnvironment(&cx->global()->lexicalEnvironment());
|
||||||
|
|
@ -957,7 +957,7 @@ LexicalEnvironmentObject::createHollowForDebug(JSContext* cx, Handle<LexicalScop
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!env->setFlags(cx, BaseShape::NOT_EXTENSIBLE, JSObject::GENERATE_SHAPE))
|
if (!JSObject::setFlags(cx, env, BaseShape::NOT_EXTENSIBLE, JSObject::GENERATE_SHAPE))
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
env->initScopeUnchecked(scope);
|
env->initScopeUnchecked(scope);
|
||||||
|
|
|
||||||
|
|
@ -278,7 +278,7 @@ GlobalObject::initLegacyGeneratorProto(JSContext* cx, Handle<GlobalObject*> glob
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
RootedObject proto(cx, NewSingletonObjectWithObjectPrototype(cx, global));
|
RootedObject proto(cx, NewSingletonObjectWithObjectPrototype(cx, global));
|
||||||
if (!proto || !proto->setDelegate(cx))
|
if (!proto || !JSObject::setDelegate(cx, proto))
|
||||||
return false;
|
return false;
|
||||||
if (!DefinePropertiesAndFunctions(cx, proto, nullptr, legacy_generator_methods))
|
if (!DefinePropertiesAndFunctions(cx, proto, nullptr, legacy_generator_methods))
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -309,7 +309,7 @@ GlobalObject::initStarGenerators(JSContext* cx, Handle<GlobalObject*> global)
|
||||||
}
|
}
|
||||||
|
|
||||||
RootedObject genFunctionProto(cx, NewSingletonObjectWithFunctionPrototype(cx, global));
|
RootedObject genFunctionProto(cx, NewSingletonObjectWithFunctionPrototype(cx, global));
|
||||||
if (!genFunctionProto || !genFunctionProto->setDelegate(cx))
|
if (!genFunctionProto || !JSObject::setDelegate(cx, genFunctionProto))
|
||||||
return false;
|
return false;
|
||||||
if (!LinkConstructorAndPrototype(cx, genFunctionProto, genObjectProto) ||
|
if (!LinkConstructorAndPrototype(cx, genFunctionProto, genObjectProto) ||
|
||||||
!DefineToStringTag(cx, genFunctionProto, cx->names().GeneratorFunction))
|
!DefineToStringTag(cx, genFunctionProto, cx->names().GeneratorFunction))
|
||||||
|
|
|
||||||
|
|
@ -329,9 +329,9 @@ GlobalObject::createInternal(JSContext* cx, const Class* clasp)
|
||||||
|
|
||||||
cx->compartment()->initGlobal(*global);
|
cx->compartment()->initGlobal(*global);
|
||||||
|
|
||||||
if (!global->setQualifiedVarObj(cx))
|
if (!JSObject::setQualifiedVarObj(cx, global))
|
||||||
return nullptr;
|
return nullptr;
|
||||||
if (!global->setDelegate(cx))
|
if (!JSObject::setDelegate(cx, global))
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
return global;
|
return global;
|
||||||
|
|
@ -595,7 +595,7 @@ CreateBlankProto(JSContext* cx, const Class* clasp, HandleObject proto, HandleOb
|
||||||
|
|
||||||
RootedNativeObject blankProto(cx, NewNativeObjectWithGivenProto(cx, clasp, proto,
|
RootedNativeObject blankProto(cx, NewNativeObjectWithGivenProto(cx, clasp, proto,
|
||||||
SingletonObject));
|
SingletonObject));
|
||||||
if (!blankProto || !blankProto->setDelegate(cx))
|
if (!blankProto || !JSObject::setDelegate(cx, blankProto))
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
return blankProto;
|
return blankProto;
|
||||||
|
|
|
||||||
|
|
@ -1543,7 +1543,7 @@ SetObjectElementOperation(JSContext* cx, HandleObject obj, HandleId id, HandleVa
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (obj->isNative() && !JSID_IS_INT(id) && !obj->setHadElementsAccess(cx))
|
if (obj->isNative() && !JSID_IS_INT(id) && !JSObject::setHadElementsAccess(cx, obj))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
ObjectOpResult result;
|
ObjectOpResult result;
|
||||||
|
|
|
||||||
|
|
@ -278,8 +278,11 @@ JSObject::splicePrototype(JSContext* cx, HandleObject obj, const Class* clasp,
|
||||||
// Windows may not appear on prototype chains.
|
// Windows may not appear on prototype chains.
|
||||||
MOZ_ASSERT_IF(proto.isObject(), !IsWindow(proto.toObject()));
|
MOZ_ASSERT_IF(proto.isObject(), !IsWindow(proto.toObject()));
|
||||||
|
|
||||||
if (proto.isObject() && !proto.toObject()->setDelegate(cx))
|
if (proto.isObject()) {
|
||||||
return false;
|
RootedObject protoObj(cx, proto.toObject());
|
||||||
|
if (!JSObject::setDelegate(cx, protoObj))
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// Force type instantiation when splicing lazy group.
|
// Force type instantiation when splicing lazy group.
|
||||||
RootedObjectGroup group(cx, JSObject::getGroup(cx, obj));
|
RootedObjectGroup group(cx, JSObject::getGroup(cx, obj));
|
||||||
|
|
@ -346,7 +349,7 @@ JSObject::makeLazyGroup(JSContext* cx, HandleObject obj)
|
||||||
JSObject::setNewGroupUnknown(JSContext* cx, const js::Class* clasp, JS::HandleObject obj)
|
JSObject::setNewGroupUnknown(JSContext* cx, const js::Class* clasp, JS::HandleObject obj)
|
||||||
{
|
{
|
||||||
ObjectGroup::setDefaultNewGroupUnknown(cx, clasp, obj);
|
ObjectGroup::setDefaultNewGroupUnknown(cx, clasp, obj);
|
||||||
return obj->setFlags(cx, BaseShape::NEW_GROUP_UNKNOWN);
|
return JSObject::setFlags(cx, obj, BaseShape::NEW_GROUP_UNKNOWN);
|
||||||
}
|
}
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////
|
||||||
|
|
@ -508,7 +511,7 @@ ObjectGroup::defaultNewGroup(ExclusiveContext* cx, const Class* clasp,
|
||||||
|
|
||||||
if (proto.isObject() && !proto.toObject()->isDelegate()) {
|
if (proto.isObject() && !proto.toObject()->isDelegate()) {
|
||||||
RootedObject protoObj(cx, proto.toObject());
|
RootedObject protoObj(cx, proto.toObject());
|
||||||
if (!protoObj->setDelegate(cx))
|
if (!JSObject::setDelegate(cx, protoObj))
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
// Objects which are prototypes of one another should be singletons, so
|
// Objects which are prototypes of one another should be singletons, so
|
||||||
|
|
|
||||||
|
|
@ -1206,38 +1206,37 @@ NativeObject::shadowingShapeChange(ExclusiveContext* cx, const Shape& shape)
|
||||||
return generateOwnShape(cx);
|
return generateOwnShape(cx);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
/* static */ bool
|
||||||
JSObject::setFlags(ExclusiveContext* cx, BaseShape::Flag flags, GenerateShape generateShape)
|
JSObject::setFlags(ExclusiveContext* cx, HandleObject obj, BaseShape::Flag flags,
|
||||||
|
GenerateShape generateShape)
|
||||||
{
|
{
|
||||||
if (hasAllFlags(flags))
|
if (obj->hasAllFlags(flags))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
RootedObject self(cx, this);
|
Shape* existingShape = obj->ensureShape(cx);
|
||||||
|
|
||||||
Shape* existingShape = self->ensureShape(cx);
|
|
||||||
if (!existingShape)
|
if (!existingShape)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (isNative() && as<NativeObject>().inDictionaryMode()) {
|
if (obj->isNative() && obj->as<NativeObject>().inDictionaryMode()) {
|
||||||
if (generateShape == GENERATE_SHAPE && !as<NativeObject>().generateOwnShape(cx))
|
if (generateShape == GENERATE_SHAPE && !obj->as<NativeObject>().generateOwnShape(cx))
|
||||||
return false;
|
return false;
|
||||||
StackBaseShape base(self->as<NativeObject>().lastProperty());
|
StackBaseShape base(obj->as<NativeObject>().lastProperty());
|
||||||
base.flags |= flags;
|
base.flags |= flags;
|
||||||
UnownedBaseShape* nbase = BaseShape::getUnowned(cx, base);
|
UnownedBaseShape* nbase = BaseShape::getUnowned(cx, base);
|
||||||
if (!nbase)
|
if (!nbase)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
self->as<NativeObject>().lastProperty()->base()->adoptUnowned(nbase);
|
obj->as<NativeObject>().lastProperty()->base()->adoptUnowned(nbase);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Shape* newShape = Shape::setObjectFlags(cx, flags, self->taggedProto(), existingShape);
|
Shape* newShape = Shape::setObjectFlags(cx, flags, obj->taggedProto(), existingShape);
|
||||||
if (!newShape)
|
if (!newShape)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// The success of the |JSObject::ensureShape| call above means that |self|
|
// The success of the |JSObject::ensureShape| call above means that |obj|
|
||||||
// can be assumed to have a shape.
|
// can be assumed to have a shape.
|
||||||
self->as<ShapedObject>().setShape(newShape);
|
obj->as<ShapedObject>().setShape(newShape);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2945,7 +2945,8 @@ ObjectGroup::clearNewScript(ExclusiveContext* cx, ObjectGroup* replacement /* =
|
||||||
|
|
||||||
// Mark the constructing function as having its 'new' script cleared, so we
|
// Mark the constructing function as having its 'new' script cleared, so we
|
||||||
// will not try to construct another one later.
|
// will not try to construct another one later.
|
||||||
if (!newScript->function()->setNewScriptCleared(cx))
|
RootedFunction fun(cx, newScript->function());
|
||||||
|
if (!JSObject::setNewScriptCleared(cx, fun))
|
||||||
cx->recoverFromOutOfMemory();
|
cx->recoverFromOutOfMemory();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue