зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1102219 - Part 3: Replace more `String.prototype.contains` with `String.prototype.includes` in JS code. r=till
This commit is contained in:
Родитель
cffa6ad6d2
Коммит
9824d9b62b
|
@ -1,8 +1,8 @@
|
|||
function f(x, y) {
|
||||
for (var i=0; i<40; i++) {
|
||||
var stack = getBacktrace({args: true, locals: true, thisprops: true});
|
||||
assertEq(stack.contains("f(x = "), true);
|
||||
assertEq(stack.contains("this = "), true);
|
||||
assertEq(stack.includes("f(x = "), true);
|
||||
assertEq(stack.includes("this = "), true);
|
||||
backtrace();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,8 +11,8 @@ function hasGname(f, v, hasIt = true) {
|
|||
try {
|
||||
var b = bytecode(f);
|
||||
if (b != "unavailable") {
|
||||
assertEq(b.contains(`getgname "${v}"`), hasIt);
|
||||
assertEq(b.contains(`getname "${v}"`), !hasIt);
|
||||
assertEq(b.includes(`getgname "${v}"`), hasIt);
|
||||
assertEq(b.includes(`getname "${v}"`), !hasIt);
|
||||
}
|
||||
} catch (e) {
|
||||
print(e.stack);
|
||||
|
|
|
@ -11,8 +11,8 @@ function hasGname(f, v) {
|
|||
try {
|
||||
var b = bytecode(f);
|
||||
if (b != "unavailable") {
|
||||
assertEq(b.contains(`getgname "${v}"`), true);
|
||||
assertEq(b.contains(`getname "${v}"`), false);
|
||||
assertEq(b.includes(`getgname "${v}"`), true);
|
||||
assertEq(b.includes(`getname "${v}"`), false);
|
||||
}
|
||||
} catch (e) {
|
||||
print(e.stack);
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
var BUGNUMBER = 1054755;
|
||||
var summary = 'String.prototype.{startsWith,endsWith,contains} should call IsRegExp.';
|
||||
var summary = 'String.prototype.{startsWith,endsWith,includes} should call IsRegExp.';
|
||||
|
||||
print(BUGNUMBER + ": " + summary);
|
||||
|
||||
for (var method of ["startsWith", "endsWith", "contains"]) {
|
||||
for (var method of ["startsWith", "endsWith", "includes"]) {
|
||||
for (var re of [/foo/, new RegExp()]) {
|
||||
assertThrowsInstanceOf(() => "foo"[method](re), TypeError);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче