Bug 1103588 - Part 2: Replace deprecated String#contains with String#includes in devtools tests. r=jryans
authorChris Peterson <cpeterson@mozilla.com>
Sat, 09 Apr 2016 16:04:36 -0700
changeset 330820 28e0d6720135c0bd7153db04418e9ca82d814bf7
parent 330819 e0f16e09b67330faa40f8dd491e87963e0d2655e
child 330821 a4cd474335e4f6b4e6a299e20f9b27fc164caa4a
push id6048
push userkmoir@mozilla.com
push dateMon, 06 Jun 2016 19:02:08 +0000
treeherdermozilla-beta@46d72a56c57d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjryans
bugs1103588
milestone48.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 1103588 - Part 2: Replace deprecated String#contains with String#includes in devtools tests. r=jryans
devtools/client/debugger/test/mochitest/browser_dbg_worker-window.js
devtools/server/tests/unit/test_promises_actor_onnewpromise.js
devtools/server/tests/unit/test_promises_actor_onpromisesettled.js
devtools/server/tests/unit/test_promises_object_creationtimestamp.js
devtools/server/tests/unit/test_promises_object_timetosettle-01.js
devtools/server/tests/unit/test_promises_object_timetosettle-02.js
devtools/shared/heapsnapshot/census-tree-node.js
devtools/shared/tests/unit/test_fetch-http.js
--- a/devtools/client/debugger/test/mochitest/browser_dbg_worker-window.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg_worker-window.js
@@ -1,11 +1,13 @@
 // Check to make sure that a worker can be attached to a toolbox
 // directly, and that the toolbox has expected properties.
 
+"use strict";
+
 // Whitelisting this test.
 // As part of bug 1077403, the leaking uncaught rejections should be fixed.
 thisTestLeaksUncaughtRejectionsAndShouldBeFixed("[object Object]");
 
 var TAB_URL = EXAMPLE_URL + "doc_WorkerActor.attachThread-tab.html";
 var WORKER_URL = "code_WorkerActor.attachThread-worker.js";
 
 add_task(function* () {
@@ -28,17 +30,17 @@ add_task(function* () {
   let [, workerClient] = yield attachWorker(tabClient,
                                              findWorker(workers, WORKER_URL));
 
   let toolbox = yield gDevTools.showToolbox(TargetFactory.forWorker(workerClient),
                                             "jsdebugger",
                                             Toolbox.HostType.WINDOW);
 
   is(toolbox._host.type, "window", "correct host");
-  ok(toolbox._host._window.document.title.contains(WORKER_URL),
+  ok(toolbox._host._window.document.title.includes(WORKER_URL),
      "worker URL in host title");
 
   let toolTabs = toolbox.doc.querySelectorAll(".devtools-tab");
   let activeTools = [...toolTabs].map(tab=>tab.getAttribute("toolid"));
 
   is(activeTools.join(","), "webconsole,jsdebugger,scratchpad,options",
     "Correct set of tools supported by worker");
 
--- a/devtools/server/tests/unit/test_promises_actor_onnewpromise.js
+++ b/devtools/server/tests/unit/test_promises_actor_onnewpromise.js
@@ -11,17 +11,17 @@
 const { PromisesFront } = require("devtools/server/actors/promises");
 
 var events = require("sdk/event/core");
 
 add_task(function*() {
   let client = yield startTestDebuggerServer("promises-actor-test");
   let chromeActors = yield getChromeActors(client);
 
-  ok(Promise.toString().contains("native code"), "Expect native DOM Promise");
+  ok(Promise.toString().includes("native code"), "Expect native DOM Promise");
 
   // We have to attach the chrome TabActor before playing with the PromiseActor
   yield attachTab(client, chromeActors);
   yield testNewPromisesEvent(client, chromeActors,
     v => new Promise(resolve => resolve(v)));
 
   let response = yield listTabs(client);
   let targetTab = findTab(response.tabs, "promises-actor-test");
--- a/devtools/server/tests/unit/test_promises_actor_onpromisesettled.js
+++ b/devtools/server/tests/unit/test_promises_actor_onpromisesettled.js
@@ -13,17 +13,17 @@ Cu.import("resource://testing-common/Pro
 const { PromisesFront } = require("devtools/server/actors/promises");
 
 var events = require("sdk/event/core");
 
 add_task(function*() {
   let client = yield startTestDebuggerServer("promises-actor-test");
   let chromeActors = yield getChromeActors(client);
 
-  ok(Promise.toString().contains("native code"), "Expect native DOM Promise");
+  ok(Promise.toString().includes("native code"), "Expect native DOM Promise");
 
   // We have to attach the chrome TabActor before playing with the PromiseActor
   yield attachTab(client, chromeActors);
   yield testPromisesSettled(client, chromeActors,
     v => new Promise(resolve => resolve(v)),
     v => new Promise((resolve, reject) => reject(v)));
 
   let response = yield listTabs(client);
--- a/devtools/server/tests/unit/test_promises_object_creationtimestamp.js
+++ b/devtools/server/tests/unit/test_promises_object_creationtimestamp.js
@@ -10,17 +10,17 @@
 const { PromisesFront } = require("devtools/server/actors/promises");
 
 var events = require("sdk/event/core");
 
 add_task(function*() {
   let client = yield startTestDebuggerServer("promises-object-test");
   let chromeActors = yield getChromeActors(client);
 
-  ok(Promise.toString().contains("native code"), "Expect native DOM Promise.");
+  ok(Promise.toString().includes("native code"), "Expect native DOM Promise.");
 
   // We have to attach the chrome TabActor before playing with the PromiseActor
   yield attachTab(client, chromeActors);
   yield testPromiseCreationTimestamp(client, chromeActors, v => {
     return new Promise(resolve => resolve(v));
   });
 
   let response = yield listTabs(client);
--- a/devtools/server/tests/unit/test_promises_object_timetosettle-01.js
+++ b/devtools/server/tests/unit/test_promises_object_timetosettle-01.js
@@ -11,17 +11,17 @@
 const { PromisesFront } = require("devtools/server/actors/promises");
 
 var events = require("sdk/event/core");
 
 add_task(function*() {
   let client = yield startTestDebuggerServer("test-promises-timetosettle");
   let chromeActors = yield getChromeActors(client);
 
-  ok(Promise.toString().contains("native code"), "Expect native DOM Promise.");
+  ok(Promise.toString().includes("native code"), "Expect native DOM Promise.");
 
   // We have to attach the chrome TabActor before playing with the PromiseActor
   yield attachTab(client, chromeActors);
   yield testGetTimeToSettle(client, chromeActors, () => {
     let p = new Promise(() => {});
     p.name = "p";
     let q = p.then();
     q.name = "q";
--- a/devtools/server/tests/unit/test_promises_object_timetosettle-02.js
+++ b/devtools/server/tests/unit/test_promises_object_timetosettle-02.js
@@ -12,17 +12,17 @@ const { setTimeout } = require("sdk/time
 
 var events = require("sdk/event/core");
 
 add_task(function*() {
   let client = yield startTestDebuggerServer("test-promises-timetosettle");
   let chromeActors = yield getChromeActors(client);
   yield attachTab(client, chromeActors);
 
-  ok(Promise.toString().contains("native code"), "Expect native DOM Promise.");
+  ok(Promise.toString().includes("native code"), "Expect native DOM Promise.");
 
   // We have to attach the chrome TabActor before playing with the PromiseActor
   yield attachTab(client, chromeActors);
   yield testGetTimeToSettle(client, chromeActors,
     v => new Promise(resolve => setTimeout(() => resolve(v), 100)));
 
   let response = yield listTabs(client);
   let targetTab = findTab(response.tabs, "test-promises-timetosettle");
--- a/devtools/shared/heapsnapshot/census-tree-node.js
+++ b/devtools/shared/heapsnapshot/census-tree-node.js
@@ -659,22 +659,22 @@ function filter(tree, predicate) {
  */
 function makeFilterPredicate(filterString) {
   return function (node) {
     if (!node.name) {
       return false;
     }
 
     if (isSavedFrame(node.name)) {
-      return node.name.source.contains(filterString)
-        || (node.name.functionDisplayName || "").contains(filterString)
-        || (node.name.asyncCause || "").contains(filterString);
+      return node.name.source.includes(filterString)
+        || (node.name.functionDisplayName || "").includes(filterString)
+        || (node.name.asyncCause || "").includes(filterString);
     }
 
-    return String(node.name).contains(filterString);
+    return String(node.name).includes(filterString);
   };
 }
 
 /**
  * Takes a report from a census (`dbg.memory.takeCensus()`) and the breakdown
  * used to generate the census and returns a structure used to render
  * a tree to display the data.
  *
--- a/devtools/shared/tests/unit/test_fetch-http.js
+++ b/devtools/shared/tests/unit/test_fetch-http.js
@@ -28,17 +28,17 @@ function cacheRequestHandler(request, re
 }
 
 do_register_cleanup(() => {
   return new Promise(resolve => server.stop(resolve));
 });
 
 add_task(function* test_normal() {
   yield DevToolsUtils.fetch(NORMAL_URL).then(({content}) => {
-    ok(content.contains("The content looks correct."),
+    ok(content.includes("The content looks correct."),
       "The content looks correct.");
   });
 });
 
 add_task(function* test_caching() {
   let initialContent = null;
 
   do_print("Performing the first request.");