Bug 1102219 - Part 3: Replace more `String.prototype.contains` with `String.prototype.includes` in JS code. r=till
authorTooru Fujisawa <arai_a@mac.com>
Thu, 30 Apr 2015 00:32:01 +0900
changeset 241577 39659c916ff9
parent 241576 c376c4157a85
child 241578 61e6cb9215a4
push id59175
push userarai_a@mac.com
push dateWed, 29 Apr 2015 15:33:29 +0000
treeherdermozilla-inbound@e81e12215951 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstill
bugs1102219
milestone40.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 1102219 - Part 3: Replace more `String.prototype.contains` with `String.prototype.includes` in JS code. r=till
js/src/jit-test/tests/basic/bug1015339.js
js/src/jit-test/tests/basic/eval-scopes.js
js/src/jit-test/tests/basic/function-gname.js
js/src/tests/ecma_6/String/IsRegExp.js
--- a/js/src/jit-test/tests/basic/bug1015339.js
+++ b/js/src/jit-test/tests/basic/bug1015339.js
@@ -1,9 +1,9 @@
 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();
     }
 }
 f(1, 2);
--- a/js/src/jit-test/tests/basic/eval-scopes.js
+++ b/js/src/jit-test/tests/basic/eval-scopes.js
@@ -6,18 +6,18 @@ function bytecode(f) {
 }
 
 function hasGname(f, v, hasIt = true) {
     // Do a try-catch that prints the full stack, so we can tell
     // _which_ part of this test failed.
     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);
 	throw e;
     }
 }
 
 var x = "outer";
--- a/js/src/jit-test/tests/basic/function-gname.js
+++ b/js/src/jit-test/tests/basic/function-gname.js
@@ -6,18 +6,18 @@ function bytecode(f) {
 }
 
 function hasGname(f, v) {
     // Do a try-catch that prints the full stack, so we can tell
     // _which_ part of this test failed.
     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);
 	throw e;
     }
 }
 
 var x = "outer";
--- a/js/src/tests/ecma_6/String/IsRegExp.js
+++ b/js/src/tests/ecma_6/String/IsRegExp.js
@@ -1,14 +1,14 @@
 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);
 
     re[Symbol.match] = false;
     "foo"[method](re);
   }
 
   for (var v1 of [true, 1, "bar", [], {}, Symbol.iterator]) {