Bug 822858. r=billm

This commit is contained in:
Brian Hackett 2013-01-08 16:51:43 -08:00
parent 0ce684b6ee
commit 17e72bfe5a
3 changed files with 12 additions and 17 deletions

View File

@ -533,17 +533,6 @@ js_InitRegExpClass(JSContext *cx, HandleObject obj)
if (!JS_DefineProperties(cx, ctor, regexp_static_props))
return NULL;
/* Capture normal data properties pregenerated for RegExp objects. */
TypeObject *type = proto->getNewType(cx);
if (!type)
return NULL;
AddTypeProperty(cx, type, "source", Type::StringType());
AddTypeProperty(cx, type, "global", Type::BooleanType());
AddTypeProperty(cx, type, "ignoreCase", Type::BooleanType());
AddTypeProperty(cx, type, "multiline", Type::BooleanType());
AddTypeProperty(cx, type, "sticky", Type::BooleanType());
AddTypeProperty(cx, type, "lastIndex", Type::Int32Type());
if (!DefineConstructorAndPrototype(cx, global, JSProto_RegExp, ctor, proto))
return NULL;

View File

@ -5943,6 +5943,18 @@ JSCompartment::getNewType(JSContext *cx, TaggedProto proto_, JSFunction *fun_, b
if (obj->isXML() && !type->unknownProperties())
type->flags |= OBJECT_FLAG_UNKNOWN_MASK;
#endif
if (obj->isRegExp()) {
AddTypeProperty(cx, type, "source", types::Type::StringType());
AddTypeProperty(cx, type, "global", types::Type::BooleanType());
AddTypeProperty(cx, type, "ignoreCase", types::Type::BooleanType());
AddTypeProperty(cx, type, "multiline", types::Type::BooleanType());
AddTypeProperty(cx, type, "sticky", types::Type::BooleanType());
AddTypeProperty(cx, type, "lastIndex", types::Type::Int32Type());
}
if (obj->isString())
AddTypeProperty(cx, type, "length", Type::Int32Type());
}
/*

View File

@ -3346,12 +3346,6 @@ js_InitStringClass(JSContext *cx, HandleObject obj)
return NULL;
}
/* Capture normal data properties pregenerated for String objects. */
TypeObject *type = proto->getNewType(cx);
if (!type)
return NULL;
AddTypeProperty(cx, type, "length", Type::Int32Type());
if (!DefineConstructorAndPrototype(cx, global, JSProto_String, ctor, proto))
return NULL;