Bug 1132295 - Remove support for RegExp.prototype.unicode until Unicode regular expressions are supported, so that the property's presence is usable to feature-test for support for Unicode regular expressions. r=till

This commit is contained in:
Jeff Walden 2015-02-11 17:09:01 -08:00
parent 9a09dabe73
commit ee3ac69a1f
3 changed files with 8 additions and 25 deletions

View File

@ -479,26 +479,6 @@ regexp_sticky(JSContext *cx, unsigned argc, JS::Value *vp)
return CallNonGenericMethod<IsRegExp, regexp_sticky_impl>(cx, args);
}
/* ES6 draft rev32 21.2.5.15. */
MOZ_ALWAYS_INLINE bool
regexp_unicode_impl(JSContext *cx, CallArgs args)
{
MOZ_ASSERT(IsRegExp(args.thisv()));
/* Steps 4-6. */
/* FIXME: When the /u flags is supported, return correct value. */
args.rval().setBoolean(false);
return true;
}
static bool
regexp_unicode(JSContext *cx, unsigned argc, JS::Value *vp)
{
/* Steps 1-3. */
CallArgs args = CallArgsFromVp(argc, vp);
return CallNonGenericMethod<IsRegExp, regexp_unicode_impl>(cx, args);
}
static const JSPropertySpec regexp_properties[] = {
JS_PSG("flags", regexp_flags, 0),
JS_PSG("global", regexp_global, 0),
@ -506,7 +486,6 @@ static const JSPropertySpec regexp_properties[] = {
JS_PSG("multiline", regexp_multiline, 0),
JS_PSG("source", regexp_source, 0),
JS_PSG("sticky", regexp_sticky, 0),
JS_PSG("unicode", regexp_unicode, 0),
JS_PS_END
};

View File

@ -10,7 +10,7 @@ var getters = [
"multiline",
"source",
"sticky",
"unicode",
//"unicode",
];
for (var name of getters) {
@ -21,5 +21,9 @@ for (var name of getters) {
assertEq("get" in desc, true);
}
// When the /u flag is supported, remove this comment and the next line, and
// uncomment "unicode" in |props| above.
assertThrowsInstanceOf(() => RegExp("", "mygui").flags, SyntaxError);
if (typeof reportCompare === "function")
reportCompare(true, true);

View File

@ -8,15 +8,15 @@ var props = [
"ignoreCase",
"multiline",
"sticky",
"unicode",
//"unicode",
];
testThrows(RegExp.prototype);
test(/foo/iymg, [true, true, true, true, false]);
test(RegExp(""), [false, false, false, false, false]);
test(RegExp("", "mygi"), [true, true, true, true, false]);
// When the /u flag is supported, remove the following line and uncomment the
// next line.
// When the /u flag is supported, remove the following line, uncomment the
// next line, and uncomment "unicode" in |props| above.
assertThrowsInstanceOf(() => RegExp("", "mygui").flags, SyntaxError);
// test(RegExp("", "mygiu"), [true, true, true, true, true]);