diff options
author | wolfbeast <mcwerewolf@gmail.com> | 2018-03-20 10:05:23 +0100 |
---|---|---|
committer | wolfbeast <mcwerewolf@gmail.com> | 2018-03-20 10:07:06 +0100 |
commit | 7197b308fb97cd8ab7a972df6a3a17a7a265b594 (patch) | |
tree | e6a36f10a28710bac1b901915a643ce398580cdf /js/src/vm/RegExpObject.cpp | |
parent | 173a526ec0bedec17f35cc838b9c7d47a5ce13b7 (diff) | |
parent | a413cf72888dcb5197ba44aba547b8d496231cff (diff) | |
download | UXP-7197b308fb97cd8ab7a972df6a3a17a7a265b594.tar UXP-7197b308fb97cd8ab7a972df6a3a17a7a265b594.tar.gz UXP-7197b308fb97cd8ab7a972df6a3a17a7a265b594.tar.lz UXP-7197b308fb97cd8ab7a972df6a3a17a7a265b594.tar.xz UXP-7197b308fb97cd8ab7a972df6a3a17a7a265b594.zip |
Make RegExp.prototype return a regular object instead of an instance.
This resolves #77.
Merged remote-tracking branch 'janek/js_regexp_ordinary-object_1'
Diffstat (limited to 'js/src/vm/RegExpObject.cpp')
-rw-r--r-- | js/src/vm/RegExpObject.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/js/src/vm/RegExpObject.cpp b/js/src/vm/RegExpObject.cpp index 97f1163aa..e0b44e1eb 100644 --- a/js/src/vm/RegExpObject.cpp +++ b/js/src/vm/RegExpObject.cpp @@ -196,6 +196,12 @@ RegExpObject::trace(JSTracer* trc, JSObject* obj) } } +static JSObject* +CreateRegExpPrototype(JSContext* cx, JSProtoKey key) +{ + return cx->global()->createBlankPrototype(cx, &RegExpObject::protoClass_); +} + static const ClassOps RegExpObjectClassOps = { nullptr, /* addProperty */ nullptr, /* delProperty */ @@ -229,6 +235,13 @@ const Class RegExpObject::class_ = { &RegExpObjectClassSpec }; +const Class RegExpObject::protoClass_ = { + js_Object_str, + JSCLASS_HAS_CACHED_PROTO(JSProto_RegExp), + JS_NULL_CLASS_OPS, + &RegExpObjectClassSpec +}; + RegExpObject* RegExpObject::create(ExclusiveContext* cx, const char16_t* chars, size_t length, RegExpFlag flags, TokenStream* tokenStream, LifoAlloc& alloc) |