зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1219757 - Part 1: Remove RegExp.multiline accessor. r=till
This commit is contained in:
Родитель
8b3aa73ad5
Коммит
d9e3bca691
|
@ -629,7 +629,6 @@ const JSFunctionSpec js::regexp_methods[] = {
|
|||
* RegExp class static properties and their Perl counterparts:
|
||||
*
|
||||
* RegExp.input $_
|
||||
* RegExp.multiline $*
|
||||
* RegExp.lastMatch $&
|
||||
* RegExp.lastParen $+
|
||||
* RegExp.leftContext $`
|
||||
|
@ -648,8 +647,6 @@ const JSFunctionSpec js::regexp_methods[] = {
|
|||
}
|
||||
|
||||
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()))
|
||||
|
@ -693,25 +690,9 @@ static_input_setter(JSContext* cx, unsigned argc, Value* vp)
|
|||
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;
|
||||
|
||||
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,
|
||||
JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_PSGS("multiline", static_multiline_getter, static_multiline_setter,
|
||||
JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_PSG("lastMatch", static_lastMatch_getter, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_PSG("lastParen", static_lastParen_getter, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_PSG("leftContext", static_leftContext_getter, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
|
@ -726,7 +707,6 @@ const JSPropertySpec js::regexp_static_props[] = {
|
|||
JS_PSG("$8", static_paren8_getter, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_PSG("$9", static_paren9_getter, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_PSGS("$_", static_input_getter, static_input_setter, JSPROP_PERMANENT),
|
||||
JS_PSGS("$*", static_multiline_getter, static_multiline_setter, JSPROP_PERMANENT),
|
||||
JS_PSG("$&", static_lastMatch_getter, JSPROP_PERMANENT),
|
||||
JS_PSG("$+", static_lastParen_getter, JSPROP_PERMANENT),
|
||||
JS_PSG("$`", static_leftContext_getter, JSPROP_PERMANENT),
|
||||
|
|
|
@ -13,7 +13,7 @@ try {
|
|||
valueOf: gc
|
||||
} - [])
|
||||
} catch (prop) {}
|
||||
function addThis() reportCompare(expect, actual, 'RegExp.multiline = 17');
|
||||
function addThis() reportCompare(expect, actual, 'ok');
|
||||
Object.defineProperty(Object.prototype, "name", {
|
||||
set: function (newValue) {}
|
||||
});
|
||||
|
|
|
@ -1,12 +0,0 @@
|
|||
// visibility of updates to RegExp.multiline
|
||||
|
||||
function foo(value) {
|
||||
for (var i = 0; i < 50; i++) {
|
||||
var re = /erwe/;
|
||||
assertEq(re.multiline, value);
|
||||
}
|
||||
}
|
||||
|
||||
foo(false);
|
||||
RegExp.multiline = true;
|
||||
foo(true);
|
|
@ -1,97 +0,0 @@
|
|||
/* -*- tab-width: 2; indent-tabs-mode: nil; js-indent-level: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
|
||||
/**
|
||||
Filename: RegExp_multiline.js
|
||||
Description: 'Tests RegExps multiline property'
|
||||
|
||||
Author: Nick Lerissa
|
||||
Date: March 12, 1998
|
||||
*/
|
||||
|
||||
var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
|
||||
var VERSION = 'no version';
|
||||
startTest();
|
||||
var TITLE = 'RegExp: multiline';
|
||||
|
||||
writeHeaderToLog('Executing script: RegExp_multiline.js');
|
||||
writeHeaderToLog( SECTION + " "+ TITLE);
|
||||
|
||||
// First we do a series of tests with RegExp.multiline set to false (default value)
|
||||
// Following this we do the same tests with RegExp.multiline set true(**).
|
||||
// RegExp.multiline
|
||||
new TestCase ( SECTION, "RegExp.multiline",
|
||||
false, RegExp.multiline);
|
||||
|
||||
// (multiline == false) '123\n456'.match(/^4../)
|
||||
new TestCase ( SECTION, "(multiline == false) '123\\n456'.match(/^4../)",
|
||||
null, '123\n456'.match(/^4../));
|
||||
|
||||
// (multiline == false) 'a11\na22\na23\na24'.match(/^a../g)
|
||||
new TestCase ( SECTION, "(multiline == false) 'a11\\na22\\na23\\na24'.match(/^a../g)",
|
||||
String(['a11']), String('a11\na22\na23\na24'.match(/^a../g)));
|
||||
|
||||
// (multiline == false) 'a11\na22'.match(/^.+^./)
|
||||
new TestCase ( SECTION, "(multiline == false) 'a11\na22'.match(/^.+^./)",
|
||||
null, 'a11\na22'.match(/^.+^./));
|
||||
|
||||
// (multiline == false) '123\n456'.match(/.3$/)
|
||||
new TestCase ( SECTION, "(multiline == false) '123\\n456'.match(/.3$/)",
|
||||
null, '123\n456'.match(/.3$/));
|
||||
|
||||
// (multiline == false) 'a11\na22\na23\na24'.match(/a..$/g)
|
||||
new TestCase ( SECTION, "(multiline == false) 'a11\\na22\\na23\\na24'.match(/a..$/g)",
|
||||
String(['a24']), String('a11\na22\na23\na24'.match(/a..$/g)));
|
||||
|
||||
// (multiline == false) 'abc\ndef'.match(/c$...$/)
|
||||
new TestCase ( SECTION, "(multiline == false) 'abc\ndef'.match(/c$...$/)",
|
||||
null, 'abc\ndef'.match(/c$...$/));
|
||||
|
||||
// (multiline == false) 'a11\na22\na23\na24'.match(new RegExp('a..$','g'))
|
||||
new TestCase ( SECTION, "(multiline == false) 'a11\\na22\\na23\\na24'.match(new RegExp('a..$','g'))",
|
||||
String(['a24']), String('a11\na22\na23\na24'.match(new RegExp('a..$','g'))));
|
||||
|
||||
// (multiline == false) 'abc\ndef'.match(new RegExp('c$...$'))
|
||||
new TestCase ( SECTION, "(multiline == false) 'abc\ndef'.match(new RegExp('c$...$'))",
|
||||
null, 'abc\ndef'.match(new RegExp('c$...$')));
|
||||
|
||||
// **Now we do the tests with RegExp.multiline set to true
|
||||
// RegExp.multiline = true; RegExp.multiline
|
||||
RegExp.multiline = true;
|
||||
new TestCase ( SECTION, "RegExp.multiline = true; RegExp.multiline",
|
||||
true, RegExp.multiline);
|
||||
|
||||
// (multiline == true) '123\n456'.match(/^4../)
|
||||
new TestCase ( SECTION, "(multiline == true) '123\\n456'.match(/^4../)",
|
||||
String(['456']), String('123\n456'.match(/^4../)));
|
||||
|
||||
// (multiline == true) 'a11\na22\na23\na24'.match(/^a../g)
|
||||
new TestCase ( SECTION, "(multiline == true) 'a11\\na22\\na23\\na24'.match(/^a../g)",
|
||||
String(['a11','a22','a23','a24']), String('a11\na22\na23\na24'.match(/^a../g)));
|
||||
|
||||
// (multiline == true) 'a11\na22'.match(/^.+^./)
|
||||
//new TestCase ( SECTION, "(multiline == true) 'a11\na22'.match(/^.+^./)",
|
||||
// String(['a11\na']), String('a11\na22'.match(/^.+^./)));
|
||||
|
||||
// (multiline == true) '123\n456'.match(/.3$/)
|
||||
new TestCase ( SECTION, "(multiline == true) '123\\n456'.match(/.3$/)",
|
||||
String(['23']), String('123\n456'.match(/.3$/)));
|
||||
|
||||
// (multiline == true) 'a11\na22\na23\na24'.match(/a..$/g)
|
||||
new TestCase ( SECTION, "(multiline == true) 'a11\\na22\\na23\\na24'.match(/a..$/g)",
|
||||
String(['a11','a22','a23','a24']), String('a11\na22\na23\na24'.match(/a..$/g)));
|
||||
|
||||
// (multiline == true) 'a11\na22\na23\na24'.match(new RegExp('a..$','g'))
|
||||
new TestCase ( SECTION, "(multiline == true) 'a11\\na22\\na23\\na24'.match(new RegExp('a..$','g'))",
|
||||
String(['a11','a22','a23','a24']), String('a11\na22\na23\na24'.match(new RegExp('a..$','g'))));
|
||||
|
||||
// (multiline == true) 'abc\ndef'.match(/c$....$/)
|
||||
//new TestCase ( SECTION, "(multiline == true) 'abc\ndef'.match(/c$.+$/)",
|
||||
// 'c\ndef', String('abc\ndef'.match(/c$.+$/)));
|
||||
|
||||
RegExp.multiline = false;
|
||||
|
||||
test();
|
|
@ -1,98 +0,0 @@
|
|||
/* -*- tab-width: 2; indent-tabs-mode: nil; js-indent-level: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
|
||||
/**
|
||||
Filename: RegExp_multiline_as_array.js
|
||||
Description: 'Tests RegExps $* property (same tests as RegExp_multiline.js but using $*)'
|
||||
|
||||
Author: Nick Lerissa
|
||||
Date: March 13, 1998
|
||||
*/
|
||||
|
||||
var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
|
||||
var VERSION = 'no version';
|
||||
startTest();
|
||||
var TITLE = 'RegExp: $*';
|
||||
|
||||
writeHeaderToLog('Executing script: RegExp_multiline_as_array.js');
|
||||
writeHeaderToLog( SECTION + " "+ TITLE);
|
||||
|
||||
|
||||
// First we do a series of tests with RegExp['$*'] set to false (default value)
|
||||
// Following this we do the same tests with RegExp['$*'] set true(**).
|
||||
// RegExp['$*']
|
||||
new TestCase ( SECTION, "RegExp['$*']",
|
||||
false, RegExp['$*']);
|
||||
|
||||
// (['$*'] == false) '123\n456'.match(/^4../)
|
||||
new TestCase ( SECTION, "(['$*'] == false) '123\\n456'.match(/^4../)",
|
||||
null, '123\n456'.match(/^4../));
|
||||
|
||||
// (['$*'] == false) 'a11\na22\na23\na24'.match(/^a../g)
|
||||
new TestCase ( SECTION, "(['$*'] == false) 'a11\\na22\\na23\\na24'.match(/^a../g)",
|
||||
String(['a11']), String('a11\na22\na23\na24'.match(/^a../g)));
|
||||
|
||||
// (['$*'] == false) 'a11\na22'.match(/^.+^./)
|
||||
new TestCase ( SECTION, "(['$*'] == false) 'a11\na22'.match(/^.+^./)",
|
||||
null, 'a11\na22'.match(/^.+^./));
|
||||
|
||||
// (['$*'] == false) '123\n456'.match(/.3$/)
|
||||
new TestCase ( SECTION, "(['$*'] == false) '123\\n456'.match(/.3$/)",
|
||||
null, '123\n456'.match(/.3$/));
|
||||
|
||||
// (['$*'] == false) 'a11\na22\na23\na24'.match(/a..$/g)
|
||||
new TestCase ( SECTION, "(['$*'] == false) 'a11\\na22\\na23\\na24'.match(/a..$/g)",
|
||||
String(['a24']), String('a11\na22\na23\na24'.match(/a..$/g)));
|
||||
|
||||
// (['$*'] == false) 'abc\ndef'.match(/c$...$/)
|
||||
new TestCase ( SECTION, "(['$*'] == false) 'abc\ndef'.match(/c$...$/)",
|
||||
null, 'abc\ndef'.match(/c$...$/));
|
||||
|
||||
// (['$*'] == false) 'a11\na22\na23\na24'.match(new RegExp('a..$','g'))
|
||||
new TestCase ( SECTION, "(['$*'] == false) 'a11\\na22\\na23\\na24'.match(new RegExp('a..$','g'))",
|
||||
String(['a24']), String('a11\na22\na23\na24'.match(new RegExp('a..$','g'))));
|
||||
|
||||
// (['$*'] == false) 'abc\ndef'.match(new RegExp('c$...$'))
|
||||
new TestCase ( SECTION, "(['$*'] == false) 'abc\ndef'.match(new RegExp('c$...$'))",
|
||||
null, 'abc\ndef'.match(new RegExp('c$...$')));
|
||||
|
||||
// **Now we do the tests with RegExp['$*'] set to true
|
||||
// RegExp['$*'] = true; RegExp['$*']
|
||||
RegExp['$*'] = true;
|
||||
new TestCase ( SECTION, "RegExp['$*'] = true; RegExp['$*']",
|
||||
true, RegExp['$*']);
|
||||
|
||||
// (['$*'] == true) '123\n456'.match(/^4../)
|
||||
new TestCase ( SECTION, "(['$*'] == true) '123\\n456'.match(/^4../)",
|
||||
String(['456']), String('123\n456'.match(/^4../)));
|
||||
|
||||
// (['$*'] == true) 'a11\na22\na23\na24'.match(/^a../g)
|
||||
new TestCase ( SECTION, "(['$*'] == true) 'a11\\na22\\na23\\na24'.match(/^a../g)",
|
||||
String(['a11','a22','a23','a24']), String('a11\na22\na23\na24'.match(/^a../g)));
|
||||
|
||||
// (['$*'] == true) 'a11\na22'.match(/^.+^./)
|
||||
//new TestCase ( SECTION, "(['$*'] == true) 'a11\na22'.match(/^.+^./)",
|
||||
// String(['a11\na']), String('a11\na22'.match(/^.+^./)));
|
||||
|
||||
// (['$*'] == true) '123\n456'.match(/.3$/)
|
||||
new TestCase ( SECTION, "(['$*'] == true) '123\\n456'.match(/.3$/)",
|
||||
String(['23']), String('123\n456'.match(/.3$/)));
|
||||
|
||||
// (['$*'] == true) 'a11\na22\na23\na24'.match(/a..$/g)
|
||||
new TestCase ( SECTION, "(['$*'] == true) 'a11\\na22\\na23\\na24'.match(/a..$/g)",
|
||||
String(['a11','a22','a23','a24']), String('a11\na22\na23\na24'.match(/a..$/g)));
|
||||
|
||||
// (['$*'] == true) 'a11\na22\na23\na24'.match(new RegExp('a..$','g'))
|
||||
new TestCase ( SECTION, "(['$*'] == true) 'a11\\na22\\na23\\na24'.match(new RegExp('a..$','g'))",
|
||||
String(['a11','a22','a23','a24']), String('a11\na22\na23\na24'.match(new RegExp('a..$','g'))));
|
||||
|
||||
// (['$*'] == true) 'abc\ndef'.match(/c$....$/)
|
||||
//new TestCase ( SECTION, "(['$*'] == true) 'abc\ndef'.match(/c$.+$/)",
|
||||
// 'c\ndef', String('abc\ndef'.match(/c$.+$/)));
|
||||
|
||||
RegExp['$*'] = false;
|
||||
|
||||
test();
|
|
@ -41,9 +41,4 @@ new TestCase ( SECTION, "'^^^x'.match(new RegExp('^\\^+'))",
|
|||
new TestCase ( SECTION, "'^^^x'.match(/^\\^+/)",
|
||||
String(['^^^']), String('^^^x'.match(/^\^+/)));
|
||||
|
||||
RegExp.multiline = true;
|
||||
// 'abc\n123xyz'.match(new RegExp('^\d+')) <multiline==true>
|
||||
new TestCase ( SECTION, "'abc\n123xyz'.match(new RegExp('^\\d+'))",
|
||||
String(['123']), String('abc\n123xyz'.match(new RegExp('^\\d+'))));
|
||||
|
||||
test();
|
||||
|
|
|
@ -41,9 +41,4 @@ new TestCase ( SECTION, "'a$$$'.match(new RegExp('\\$+$'))",
|
|||
new TestCase ( SECTION, "'a$$$'.match(/\\$+$/)",
|
||||
String(['$$$']), String('a$$$'.match(/\$+$/)));
|
||||
|
||||
RegExp.multiline = true;
|
||||
// 'abc\n123xyz890\nxyz'.match(new RegExp('\d+$')) <multiline==true>
|
||||
new TestCase ( SECTION, "'abc\n123xyz890\nxyz'.match(new RegExp('\\d+$'))",
|
||||
String(['890']), String('abc\n123xyz890\nxyz'.match(new RegExp('\\d+$'))));
|
||||
|
||||
test();
|
||||
|
|
|
@ -1,53 +0,0 @@
|
|||
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
var BUGNUMBER = 418504;
|
||||
var summary = 'Untagged boolean stored in a jsval in JS_ConvertValue';
|
||||
var actual = '';
|
||||
var expect = '';
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
test();
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function test()
|
||||
{
|
||||
enterFunc ('test');
|
||||
printBugNumber(BUGNUMBER);
|
||||
printStatus (summary);
|
||||
|
||||
expect = false;
|
||||
actual = RegExp.multiline;
|
||||
reportCompare(expect, actual, 'RegExp.multiline');
|
||||
|
||||
expect = true;
|
||||
RegExp.multiline = 17;
|
||||
actual = RegExp.multiline;
|
||||
reportCompare(expect, actual, 'RegExp.multiline = 17');
|
||||
|
||||
expect = true;
|
||||
RegExp.multiline = 17;
|
||||
actual = RegExp.multiline;
|
||||
reportCompare(expect, actual, 'RegExp.multiline = 17');
|
||||
|
||||
expect = true;
|
||||
RegExp.multiline = 17;
|
||||
actual = RegExp.multiline;
|
||||
reportCompare(expect, actual, 'RegExp.multiline = 17');
|
||||
|
||||
expect = true;
|
||||
RegExp.multiline = true;
|
||||
actual = RegExp.multiline;
|
||||
reportCompare(expect, actual, 'RegExp.multiline = true');
|
||||
|
||||
expect = true;
|
||||
RegExp.multiline = 17;
|
||||
actual = RegExp.multiline;
|
||||
reportCompare(expect, actual, 'RegExp.multiline = 17');
|
||||
|
||||
exitFunc ('test');
|
||||
}
|
|
@ -229,9 +229,9 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=933681
|
|||
"flags", "global", "ignoreCase", "multiline", "source", "sticky", "unicode",
|
||||
"lastIndex"];
|
||||
gConstructorProperties['RegExp'] =
|
||||
constructorProps(["input", "multiline", "lastMatch", "lastParen",
|
||||
constructorProps(["input", "lastMatch", "lastParen",
|
||||
"leftContext", "rightContext", "$1", "$2", "$3", "$4",
|
||||
"$5", "$6", "$7", "$8", "$9", "$_", "$*", "$&", "$+",
|
||||
"$5", "$6", "$7", "$8", "$9", "$_", "$&", "$+",
|
||||
"$`", "$'"])
|
||||
|
||||
// Sort an array that may contain symbols as well as strings.
|
||||
|
@ -714,9 +714,9 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=933681
|
|||
// properties that have to do with the last regexp execution in the global.
|
||||
// Xraying those makes no sense, so we just skip constructor properties for
|
||||
// RegExp xrays.
|
||||
let ctorPropsToSkip = ["input", "multiline", "lastMatch", "lastParen",
|
||||
let ctorPropsToSkip = ["input", "lastMatch", "lastParen",
|
||||
"leftContext", "rightContext", "$1", "$2", "$3",
|
||||
"$4", "$5", "$6", "$7", "$8", "$9", "$_", "$*", "$&",
|
||||
"$4", "$5", "$6", "$7", "$8", "$9", "$_", "$&",
|
||||
"$+", "$`", "$'"];
|
||||
testXray('RegExp', new iwin.RegExp('foo'), new iwin.RegExp(), [],
|
||||
ctorPropsToSkip);
|
||||
|
|
Загрузка…
Ссылка в новой задаче