Bug 1219757 - Part 0: Remove RegExp.multiline warning. r=till
authorTooru Fujisawa <arai_a@mac.com>
Sun, 21 Feb 2016 20:40:37 +0900
changeset 289947 75826602a7885b740b13a02281f0e6462345baa0
parent 289946 eb62677979ba4020d1cb045a034438a9cc4fb8cc
child 289948 e5ae8475e40e2dd74033f3163e42811e1fc6de88
push id74045
push userarai_a@mac.com
push dateWed, 23 Mar 2016 04:58:59 +0000
treeherdermozilla-inbound@604a180b6cc0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstill
bugs1219757
milestone48.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1219757 - Part 0: Remove RegExp.multiline warning. r=till
js/src/builtin/RegExp.cpp
js/src/jit-test/tests/basic/regexp-multiline-warning.js
js/src/js.msg
js/src/jscompartment.cpp
js/src/jscompartment.h
--- a/js/src/builtin/RegExp.cpp
+++ b/js/src/builtin/RegExp.cpp
@@ -643,16 +643,18 @@ const JSFunctionSpec js::regexp_methods[
         CallArgs args = CallArgsFromVp(argc, vp);                               \
         RegExpStatics* res = cx->global()->getRegExpStatics(cx);                \
         if (!res)                                                               \
             return false;                                                       \
         code;                                                                   \
     }
 
 DEFINE_STATIC_GETTER(static_input_getter,        return res->createPendingInput(cx, args.rval()))
+DEFINE_STATIC_GETTER(static_multiline_getter,    args.rval().setBoolean(res->multiline());
+                                                 return true)
 DEFINE_STATIC_GETTER(static_lastMatch_getter,    return res->createLastMatch(cx, args.rval()))
 DEFINE_STATIC_GETTER(static_lastParen_getter,    return res->createLastParen(cx, args.rval()))
 DEFINE_STATIC_GETTER(static_leftContext_getter,  return res->createLeftContext(cx, args.rval()))
 DEFINE_STATIC_GETTER(static_rightContext_getter, return res->createRightContext(cx, args.rval()))
 
 DEFINE_STATIC_GETTER(static_paren1_getter,       STATIC_PAREN_GETTER_CODE(1))
 DEFINE_STATIC_GETTER(static_paren2_getter,       STATIC_PAREN_GETTER_CODE(2))
 DEFINE_STATIC_GETTER(static_paren3_getter,       STATIC_PAREN_GETTER_CODE(3))
@@ -687,56 +689,23 @@ static_input_setter(JSContext* cx, unsig
         return false;
 
     res->setPendingInput(str);
     args.rval().setString(str);
     return true;
 }
 
 static bool
-WarnOnceAboutRegExpMultiline(JSContext* cx)
-{
-    if (!cx->compartment()->warnedAboutRegExpMultiline) {
-        if (!JS_ReportErrorFlagsAndNumber(cx, JSREPORT_WARNING, GetErrorMessage, nullptr,
-                                          JSMSG_DEPRECATED_REGEXP_MULTILINE))
-        {
-            return false;
-        }
-        cx->compartment()->warnedAboutRegExpMultiline = true;
-    }
-
-    return true;
-}
-
-static bool
-static_multiline_getter(JSContext* cx, unsigned argc, Value* vp)
-{
-    CallArgs args = CallArgsFromVp(argc, vp);
-    RegExpStatics* res = cx->global()->getRegExpStatics(cx);
-    if (!res)
-        return false;
-
-    if (!WarnOnceAboutRegExpMultiline(cx))
-        return false;
-
-    args.rval().setBoolean(res->multiline());
-    return true;
-}
-
-static bool
 static_multiline_setter(JSContext* cx, unsigned argc, Value* vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
     RegExpStatics* res = cx->global()->getRegExpStatics(cx);
     if (!res)
         return false;
 
-    if (!WarnOnceAboutRegExpMultiline(cx))
-        return false;
-
     bool b = ToBoolean(args.get(0));
     res->setMultiline(cx, b);
     args.rval().setBoolean(b);
     return true;
 }
 
 const JSPropertySpec js::regexp_static_props[] = {
     JS_PSGS("input", static_input_getter, static_input_setter,
deleted file mode 100644
--- a/js/src/jit-test/tests/basic/regexp-multiline-warning.js
+++ /dev/null
@@ -1,23 +0,0 @@
-// RegExp.multiline access should be warned once and only once.
-
-function testWarn(code) {
-  enableLastWarning();
-  var g = newGlobal();
-  g.code = code;
-  g.eval('eval(code)');
-  var warning = getLastWarning();
-  assertEq(warning !== null, true, "warning should be caught for " + code);
-  assertEq(warning.name, "SyntaxError");
-
-  clearLastWarning();
-  g.eval('eval(code)');
-  warning = getLastWarning();
-  assertEq(warning, null, "warning should not be caught for 2nd ocurrence");
-  disableLastWarning();
-}
-
-testWarn("var a = RegExp.multiline;");
-testWarn("RegExp.multiline = true;");
-
-testWarn("var a = RegExp['$*'];");
-testWarn("RegExp['$*'] = true;");
--- a/js/src/js.msg
+++ b/js/src/js.msg
@@ -438,17 +438,16 @@ MSG_DEF(JSMSG_INVALID_LOCALES_ELEMENT, 0
 MSG_DEF(JSMSG_INVALID_LOCALE_MATCHER,  1, JSEXN_RANGEERR, "invalid locale matcher in supportedLocalesOf(): {0}")
 MSG_DEF(JSMSG_INVALID_OPTION_VALUE,    2, JSEXN_RANGEERR, "invalid value {1} for option {0}")
 MSG_DEF(JSMSG_INVALID_TIME_ZONE,       1, JSEXN_RANGEERR, "invalid time zone in DateTimeFormat(): {0}")
 MSG_DEF(JSMSG_UNDEFINED_CURRENCY,      0, JSEXN_TYPEERR, "undefined currency in NumberFormat() with currency style")
 
 // RegExp
 MSG_DEF(JSMSG_BACK_REF_OUT_OF_RANGE,   0, JSEXN_SYNTAXERR, "back reference out of range in regular expression")
 MSG_DEF(JSMSG_BAD_CLASS_RANGE,         0, JSEXN_SYNTAXERR, "invalid range in character class")
-MSG_DEF(JSMSG_DEPRECATED_REGEXP_MULTILINE, 0, JSEXN_SYNTAXERR, "RegExp.multiline is deprecated. Use m flag instead")
 MSG_DEF(JSMSG_ESCAPE_AT_END_OF_REGEXP, 0, JSEXN_SYNTAXERR, "\\ at end of pattern")
 MSG_DEF(JSMSG_INVALID_DECIMAL_ESCAPE, 0, JSEXN_SYNTAXERR, "invalid decimal escape in regular expression")
 MSG_DEF(JSMSG_INVALID_GROUP,           0, JSEXN_SYNTAXERR, "invalid regexp group")
 MSG_DEF(JSMSG_INVALID_IDENTITY_ESCAPE, 0, JSEXN_SYNTAXERR, "invalid identity escape in regular expression")
 MSG_DEF(JSMSG_INVALID_UNICODE_ESCAPE,  0, JSEXN_SYNTAXERR, "invalid unicode escape in regular expression")
 MSG_DEF(JSMSG_MISSING_PAREN,           0, JSEXN_SYNTAXERR, "unterminated parenthetical")
 MSG_DEF(JSMSG_NEWREGEXP_FLAGGED,       0, JSEXN_TYPEERR, "can't supply flags when constructing one RegExp from another")
 MSG_DEF(JSMSG_NOTHING_TO_REPEAT,       0, JSEXN_SYNTAXERR, "nothing to repeat")
--- a/js/src/jscompartment.cpp
+++ b/js/src/jscompartment.cpp
@@ -47,17 +47,16 @@ JSCompartment::JSCompartment(Zone* zone,
     zone_(zone),
     runtime_(zone->runtimeFromMainThread()),
     principals_(nullptr),
     isSystem_(false),
     isSelfHosting(false),
     marked(true),
     warnedAboutFlagsArgument(false),
     warnedAboutExprClosure(false),
-    warnedAboutRegExpMultiline(false),
 #ifdef DEBUG
     firedOnNewGlobalObject(false),
 #endif
     global_(nullptr),
     enterCompartmentDepth(0),
     performanceMonitoring(runtime_),
     data(nullptr),
     objectMetadataCallback(nullptr),
--- a/js/src/jscompartment.h
+++ b/js/src/jscompartment.h
@@ -291,17 +291,16 @@ struct JSCompartment
   private:
     JSPrincipals*                principals_;
     bool                         isSystem_;
   public:
     bool                         isSelfHosting;
     bool                         marked;
     bool                         warnedAboutFlagsArgument;
     bool                         warnedAboutExprClosure;
-    bool                         warnedAboutRegExpMultiline;
 
 #ifdef DEBUG
     bool                         firedOnNewGlobalObject;
 #endif
 
     void mark() { marked = true; }
 
   private: