Bug 1102219 - Part 3: Replace more `String.prototype.contains` with `String.prototype.includes` in JS code. r=till

This commit is contained in:
Tooru Fujisawa 2015-04-30 00:32:01 +09:00
Родитель cffa6ad6d2
Коммит 9824d9b62b
4 изменённых файлов: 8 добавлений и 8 удалений

Просмотреть файл

@ -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);