From e63248f6d75c7a155bc300ba847252b8f354d600 Mon Sep 17 00:00:00 2001 From: caitpotter88 Date: Mon, 9 Nov 2015 06:03:15 -0800 Subject: [PATCH] [regexp] remove no-op RegExp.multiline accessor and alias Remove some non-standard code that doesn't do anything anyways. While FireFox uses this to set the default value for the multiline flag, it is nonstandard and slated for removal. The matching behaviour has never been implemented in either JSC or V8, so there is little web-compat risk. The only possible risk could be someone depending on the ToBoolean() behaviour of the flag, but this seems unlikely. BUG=v8:3870 LOG=N R=adamk@chromium.org, littledan@chromium.org, yangguo@chromium.org CQ_INCLUDE_TRYBOTS=tryserver.chromium.linux:linux_chromium_rel_ng;tryserver.blink:linux_blink_rel Review URL: https://codereview.chromium.org/1417733012 Cr-Commit-Position: refs/heads/master@{#31882} --- src/js/regexp.js | 19 ------------------- test/mjsunit/regexp-static.js | 2 -- test/mozilla/mozilla.status | 5 +++++ 3 files changed, 5 insertions(+), 21 deletions(-) diff --git a/src/js/regexp.js b/src/js/regexp.js index ef1ca6d06e..ab75cd5fc4 100644 --- a/src/js/regexp.js +++ b/src/js/regexp.js @@ -416,25 +416,6 @@ var RegExpSetInput = function(string) { %DefineAccessorPropertyUnchecked(GlobalRegExp, '$_', RegExpGetInput, RegExpSetInput, DONT_ENUM | DONT_DELETE); -// The properties multiline and $* are aliases for each other. When this -// value is set in SpiderMonkey, the value it is set to is coerced to a -// boolean. We mimic that behavior with a slight difference: in SpiderMonkey -// the value of the expression 'RegExp.multiline = null' (for instance) is the -// boolean false (i.e., the value after coercion), while in V8 it is the value -// null (i.e., the value before coercion). - -// Getter and setter for multiline. -var multiline = false; -var RegExpGetMultiline = function() { return multiline; }; -var RegExpSetMultiline = function(flag) { multiline = flag ? true : false; }; - -%DefineAccessorPropertyUnchecked(GlobalRegExp, 'multiline', RegExpGetMultiline, - RegExpSetMultiline, DONT_DELETE); -%DefineAccessorPropertyUnchecked(GlobalRegExp, '$*', RegExpGetMultiline, - RegExpSetMultiline, - DONT_ENUM | DONT_DELETE); - - var NoOpSetter = function(ignored) {}; diff --git a/test/mjsunit/regexp-static.js b/test/mjsunit/regexp-static.js index 62e4e7e3bd..0d6d85c660 100644 --- a/test/mjsunit/regexp-static.js +++ b/test/mjsunit/regexp-static.js @@ -144,8 +144,6 @@ for (var i = 1; i <= 9; i++) { assertEquals("", RegExp['$' + (i)], "$" + i); } -RegExp.multiline = "foo"; -assertTrue(typeof RegExp.multiline == typeof Boolean(), "RegExp.multiline coerces values to booleans"); RegExp.input = Number(); assertTrue(typeof RegExp.input == typeof String(), "RegExp.input coerces values to booleans"); diff --git a/test/mozilla/mozilla.status b/test/mozilla/mozilla.status index d2e8121786..1bc6bf5576 100644 --- a/test/mozilla/mozilla.status +++ b/test/mozilla/mozilla.status @@ -90,6 +90,11 @@ # ES2015 ToLength semantics 'ecma_3/RegExp/15.10.6.2-2': [FAIL], + # RegExp.multiline is not part of any ECMAScript specification, and is + # slated for deprecation in Mozilla + # (https://bugzilla.mozilla.org/show_bug.cgi?id=1220457) + 'js1_5/Regress/regress-418504': [FAIL], + ##################### SKIPPED TESTS ##################### # This test checks that we behave properly in an out-of-memory