Bug 1522465 - Part 3: Remove remaining users of JSCLASS_IS_ANONYMOUS. r=jorendorff

This commit is contained in:
André Bargull 2019-01-24 05:46:03 -08:00
parent d1c55f2478
commit 6b7d6152d7
4 changed files with 5 additions and 16 deletions

View File

@ -801,8 +801,8 @@ static const uint32_t JSCLASS_RESERVED_SLOTS_MASK =
#define JSCLASS_HIGH_FLAGS_SHIFT \
(JSCLASS_RESERVED_SLOTS_SHIFT + JSCLASS_RESERVED_SLOTS_WIDTH)
static const uint32_t JSCLASS_IS_ANONYMOUS = 1
<< (JSCLASS_HIGH_FLAGS_SHIFT + 0);
static const uint32_t JSCLASS_INTERNAL_FLAG1 =
1 << (JSCLASS_HIGH_FLAGS_SHIFT + 0);
static const uint32_t JSCLASS_IS_GLOBAL = 1 << (JSCLASS_HIGH_FLAGS_SHIFT + 1);
static const uint32_t JSCLASS_INTERNAL_FLAG2 =
1 << (JSCLASS_HIGH_FLAGS_SHIFT + 2);

View File

@ -872,8 +872,7 @@ JS_PUBLIC_API bool JS_ResolveStandardClass(JSContext* cx, HandleObject obj,
JSProtoKey key = stdnm ? stdnm->key : JSProto_Null;
if (key != JSProto_Null) {
const Class* clasp = ProtoKeyToClass(key);
if (!clasp || (!(clasp->flags & JSCLASS_IS_ANONYMOUS) &&
clasp->specShouldDefineConstructor())) {
if (!clasp || clasp->specShouldDefineConstructor()) {
if (!GlobalObject::ensureConstructor(cx, global, key)) {
return false;
}
@ -948,9 +947,6 @@ static bool EnumerateStandardClassesInTable(JSContext* cx,
}
if (const Class* clasp = ProtoKeyToClass(key)) {
if (clasp->flags & JSCLASS_IS_ANONYMOUS) {
continue;
}
if (!clasp->specShouldDefineConstructor()) {
continue;
}

View File

@ -2011,15 +2011,8 @@ static NativeObject* DefineConstructorAndPrototype(
return nullptr;
}
// Attributes used when installing the constructor on |obj|.
uint32_t propertyAttrs = 0;
RootedNativeObject ctor(cx);
if (!constructor) {
if (clasp->flags & JSCLASS_IS_ANONYMOUS) {
propertyAttrs = JSPROP_READONLY | JSPROP_PERMANENT;
}
ctor = proto;
} else {
ctor = NewNativeConstructor(cx, constructor, nargs, atom);
@ -2040,7 +2033,7 @@ static NativeObject* DefineConstructorAndPrototype(
RootedId id(cx, AtomToId(atom));
RootedValue value(cx, ObjectValue(*ctor));
if (!DefineDataProperty(cx, obj, id, value, propertyAttrs)) {
if (!DefineDataProperty(cx, obj, id, value, 0)) {
return nullptr;
}

View File

@ -352,7 +352,7 @@ const ClassSpec SavedFrame::classSpec_ = {
/* static */ const Class SavedFrame::class_ = {
"SavedFrame",
JSCLASS_HAS_PRIVATE | JSCLASS_HAS_RESERVED_SLOTS(SavedFrame::JSSLOT_COUNT) |
JSCLASS_HAS_CACHED_PROTO(JSProto_SavedFrame) | JSCLASS_IS_ANONYMOUS |
JSCLASS_HAS_CACHED_PROTO(JSProto_SavedFrame) |
JSCLASS_FOREGROUND_FINALIZE,
&SavedFrameClassOps, &SavedFrame::classSpec_};