Bug 1102219 - Part 5: Replace more `String.prototype.contains` with `String.prototype.includes` in chrome code. r=till
authorTooru Fujisawa <arai_a@mac.com>
Thu, 30 Apr 2015 00:32:05 +0900
changeset 241579 e81e12215951
parent 241578 61e6cb9215a4
child 241580 02ffa1e00567
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 5: Replace more `String.prototype.contains` with `String.prototype.includes` in chrome code. r=till
addon-sdk/source/test/addons/e10s-content/lib/test-page-worker.js
browser/base/content/aboutNetError.xhtml
browser/base/content/browser.js
browser/base/content/test/general/browser_devices_get_user_media_in_frame.js
browser/base/content/test/general/browser_fxa_migrate.js
browser/components/loop/test/shared/mixins_test.js
browser/components/uitour/UITour.jsm
browser/devtools/canvasdebugger/callslist.js
browser/devtools/canvasdebugger/test/browser_canvas-actor-test-11.js
browser/devtools/framework/toolbox.js
browser/devtools/inspector/test/browser_inspector_menu-03-paste-items.js
browser/devtools/shared/profiler/frame-utils.js
browser/devtools/shared/test/browser_flame-graph-04.js
browser/devtools/shared/test/browser_telemetry_button_eyedropper.js
browser/devtools/styleeditor/test/browser_styleeditor_private_perwindowpb.js
browser/devtools/styleinspector/rule-view.js
dom/base/test/chrome/window_nsITextInputProcessor.xul
dom/cache/test/mochitest/serviceworker_driver.js
dom/canvas/test/webgl-conformance/conformance/textures/texture-npot-video.html
dom/html/test/forms/test_input_file_picker.html
dom/workers/test/serviceworkers/fetch/context/index.html
dom/workers/test/serviceworkers/fetch_event_worker.js
dom/workers/test/serviceworkers/test_serviceworker_interfaces.js
toolkit/devtools/server/actors/animation.js
toolkit/devtools/webconsole/test/test_page_errors.html
--- a/addon-sdk/source/test/addons/e10s-content/lib/test-page-worker.js
+++ b/addon-sdk/source/test/addons/e10s-content/lib/test-page-worker.js
@@ -475,17 +475,17 @@ exports.testMessageQueue = function (ass
 };
 
 exports.testWindowStopDontBreak = function (assert, done) {
   const { Ci, Cc } = require('chrome');
   const consoleService = Cc['@mozilla.org/consoleservice;1'].
                             getService(Ci.nsIConsoleService);
   const listener = {
     observe: ({message}) => {
-      if (message.contains('contentWorker is null'))
+      if (message.includes('contentWorker is null'))
         assert.fail('contentWorker is null');
     }
   };
   consoleService.registerListener(listener)
 
   let page = new Page({
     contentURL: 'data:text/html;charset=utf-8,testWindowStopDontBreak',
     contentScriptWhen: 'ready',
--- a/browser/base/content/aboutNetError.xhtml
+++ b/browser/base/content/aboutNetError.xhtml
@@ -203,17 +203,17 @@
         }
 
         window.addEventListener("AboutNetErrorOptions", function(evt) {
         // Pinning errors are of type nssFailure2
           if (getErrorCode() == "nssFailure2") {
             var learnMoreLink = document.getElementById("learnMoreLink");
             // nssFailure2 also gets us other non-overrideable errors. Choose
             // a "learn more" link based on description:
-            if (getDescription().contains("mozilla_pkix_error_key_pinning_failure")) {
+            if (getDescription().includes("mozilla_pkix_error_key_pinning_failure")) {
               learnMoreLink.href = "https://support.mozilla.org/kb/certificate-pinning-reports";
             }
 
             var options = JSON.parse(evt.detail);
             if (options && options.enabled) {
               var checkbox = document.getElementById('automaticallyReportInFuture');
               showCertificateErrorReporting();
               if (options.automatic) {
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -7196,17 +7196,17 @@ let gPrivateBrowsingUI = {
       }
     }
 
     if (gURLBar &&
         !PrivateBrowsingUtils.permanentPrivateBrowsing) {
       // Disable switch to tab autocompletion for private windows.
       // We leave it enabled for permanent private browsing mode though.
       let value = gURLBar.getAttribute("autocompletesearchparam") || "";
-      if (!value.contains("disable-private-actions")) {
+      if (!value.includes("disable-private-actions")) {
         gURLBar.setAttribute("autocompletesearchparam",
                              value + " disable-private-actions");
       }
     }
   }
 };
 
 let gRemoteTabsUI = {
--- a/browser/base/content/test/general/browser_devices_get_user_media_in_frame.js
+++ b/browser/base/content/test/general/browser_devices_get_user_media_in_frame.js
@@ -143,17 +143,17 @@ function activateSecondaryAction(aAction
       EventUtils.synthesizeKey("VK_DOWN", {});
 
     // Activate
     EventUtils.synthesizeKey("VK_RETURN", {});
   }, false);
 
   // One down event to open the popup
   EventUtils.synthesizeKey("VK_DOWN",
-                           { altKey: !navigator.platform.contains("Mac") });
+                           { altKey: !navigator.platform.includes("Mac") });
 }
 
 registerCleanupFunction(function() {
   gBrowser.removeCurrentTab();
   kObservedTopics.forEach(topic => {
     Services.obs.removeObserver(observer, topic);
   });
   Services.prefs.clearUserPref(PREF_PERMISSION_FAKE);
--- a/browser/base/content/test/general/browser_fxa_migrate.js
+++ b/browser/base/content/test/general/browser_fxa_migrate.js
@@ -27,17 +27,17 @@ add_task(function* test() {
                                imports.fxaMigrator.STATE_USER_FXA_VERIFIED);
   buttonState = yield buttonPromise;
   assertButtonState(buttonState, "migrate-verify", true,
                     "foo@example.com not verified");
   let note = Weave.Notifications.notifications.find(n => {
     return n.title == NOTIFICATION_TITLE;
   });
   Assert.ok(!!note, "Needs-verification notification should be present");
-  Assert.ok(note.description.contains(email.data),
+  Assert.ok(note.description.includes(email.data),
             "Needs-verification notification should include email");
 
   // Fake the state where no migration is needed.
   buttonPromise = promiseButtonMutation();
   Services.obs.notifyObservers(null, STATE_CHANGED_TOPIC, null);
   buttonState = yield buttonPromise;
   // In this case, the front end has called fxAccounts.getSignedInUser() to
   // update the button label and status.  But since there isn't actually a user,
--- a/browser/components/loop/test/shared/mixins_test.js
+++ b/browser/components/loop/test/shared/mixins_test.js
@@ -224,19 +224,19 @@ describe("loop.shared.mixins", function(
       };
 
       sharedMixins.setRootObject(rootObject);
 
       view = TestUtils.renderIntoDocument(React.createElement(TestComp));
 
       sandbox.stub(view, "getDOMNode").returns({
         querySelector: function(classSelector) {
-          if (classSelector.contains("local")) {
+          if (classSelector.includes("local")) {
             return localElement;
-          } else if (classSelector.contains("screen")) {
+          } else if (classSelector.includes("screen")) {
             return screenShareElement;
           }
           return remoteElement;
         }
       });
     });
 
     afterEach(function() {
--- a/browser/components/uitour/UITour.jsm
+++ b/browser/components/uitour/UITour.jsm
@@ -420,17 +420,17 @@ this.UITour = {
         // The rest is only relevant if Telemetry is enabled.
         if (!UITelemetry.enabled) {
           log.debug("registerPageID: Telemetry disabled, not doing anything");
           break;
         }
 
         // We don't want to allow BrowserUITelemetry.BUCKET_SEPARATOR in the
         // pageID, as it could make parsing the telemetry bucket name difficult.
-        if (data.pageID.contains(BrowserUITelemetry.BUCKET_SEPARATOR)) {
+        if (data.pageID.includes(BrowserUITelemetry.BUCKET_SEPARATOR)) {
           log.warn("registerPageID: Invalid page ID specified");
           break;
         }
 
         this.addSeenPageID(data.pageID);
         this.pageIDSourceBrowsers.set(browser, data.pageID);
         this.setTelemetryBucket(data.pageID);
 
--- a/browser/devtools/canvasdebugger/callslist.js
+++ b/browser/devtools/canvasdebugger/callslist.js
@@ -348,20 +348,20 @@ let CallsListView = Heritage.extend(Widg
 
     this.filterContents(e => {
       let call = e.attachment.actor;
       let name = call.name.toLowerCase();
       let file = call.file.toLowerCase();
       let line = call.line.toString().toLowerCase();
       let args = call.argsPreview.toLowerCase();
 
-      return name.contains(lowerCaseSearchToken) ||
-             file.contains(lowerCaseSearchToken) ||
-             line.contains(lowerCaseSearchToken) ||
-             args.contains(lowerCaseSearchToken);
+      return name.includes(lowerCaseSearchToken) ||
+             file.includes(lowerCaseSearchToken) ||
+             line.includes(lowerCaseSearchToken) ||
+             args.includes(lowerCaseSearchToken);
     });
   },
 
   /**
    * The wheel listener for the filmstrip that contains all the thumbnails.
    */
   _onScroll: function(e) {
     this._filmstrip.scrollLeft += e.deltaX;
--- a/browser/devtools/canvasdebugger/test/browser_canvas-actor-test-11.js
+++ b/browser/devtools/canvasdebugger/test/browser_canvas-actor-test-11.js
@@ -60,17 +60,17 @@ function ifTestingSupported() {
   is(functionCalls[7].type, CallWatcherFront.METHOD_FUNCTION,
     "The last called function is correctly identified as a method.");
   is(functionCalls[7].name, "setTimeout",
     "The last called function's name is correct.");
   is(functionCalls[7].file, SET_TIMEOUT_URL,
     "The last called function's file is correct.");
   is(functionCalls[7].line, 30,
     "The last called function's line is correct.");
-  ok(functionCalls[7].argsPreview.contains("Function"),
+  ok(functionCalls[7].argsPreview.includes("Function"),
     "The last called function's args preview is correct.");
   is(functionCalls[7].callerPreview, "",
     "The last called function's caller preview is correct.");
 
   let firstNonDrawCall = yield functionCalls[1].getDetails();
   let secondNonDrawCall = yield functionCalls[3].getDetails();
   let lastNonDrawCall = yield functionCalls[7].getDetails();
 
--- a/browser/devtools/framework/toolbox.js
+++ b/browser/devtools/framework/toolbox.js
@@ -1657,23 +1657,23 @@ Toolbox.prototype = {
     if (dims === "2560×1600") return 9;
     if (dims === "2880x1800") return 10;
     if (width.value > 2880 || height.value > 1800) return 12;
 
     return 11; // Other dimension such as a VM.
   },
 
   _getOsCpu: function() {
-    if (oscpu.contains("NT 5.1") || oscpu.contains("NT 5.2")) return 0;
-    if (oscpu.contains("NT 6.0")) return 1;
-    if (oscpu.contains("NT 6.1")) return 2;
-    if (oscpu.contains("NT 6.2")) return 3;
-    if (oscpu.contains("NT 6.3")) return 4;
-    if (oscpu.contains("OS X"))   return 5;
-    if (oscpu.contains("Linux"))  return 6;
+    if (oscpu.includes("NT 5.1") || oscpu.includes("NT 5.2")) return 0;
+    if (oscpu.includes("NT 6.0")) return 1;
+    if (oscpu.includes("NT 6.1")) return 2;
+    if (oscpu.includes("NT 6.2")) return 3;
+    if (oscpu.includes("NT 6.3")) return 4;
+    if (oscpu.includes("OS X"))   return 5;
+    if (oscpu.includes("Linux"))  return 6;
 
     return 12; // Other OS.
   },
 
   /**
    * Destroy the current host, and remove event listeners from its frame.
    *
    * @return {promise} to be resolved when the host is destroyed.
--- a/browser/devtools/inspector/test/browser_inspector_menu-03-paste-items.js
+++ b/browser/devtools/inspector/test/browser_inspector_menu-03-paste-items.js
@@ -55,17 +55,17 @@ add_task(function* () {
 
     let onNodeReselected = inspector.markup.once("reselectedonremoved");
     let menu = inspector.panelDoc.getElementById("node-menu-pasteouterhtml");
     dispatchCommandEvent(menu);
 
     info("Waiting for inspector selection to update");
     yield onNodeReselected;
 
-    ok(content.document.body.outerHTML.contains(clipboard.get()),
+    ok(content.document.body.outerHTML.includes(clipboard.get()),
        "Clipboard content was pasted into the node's outer HTML.");
     ok(!getNode(outerHTMLSelector, { expectNoMatch: true }),
       "The original node was removed.");
   }
 
   function* testPasteInnerHTMLMenu() {
     info("Testing that 'Paste Inner HTML' menu item works.");
     clipboard.set("this was pasted (innerHTML)");
--- a/browser/devtools/shared/profiler/frame-utils.js
+++ b/browser/devtools/shared/profiler/frame-utils.js
@@ -59,18 +59,18 @@ exports.parseLocation = function parseLo
 * @param object frame
 *        The { category, location } properties of the frame.
 * @return boolean
 *         True if a content frame, false if a chrome frame.
 */
 exports.isContent = function isContent ({ category, location }) {
   // Only C++ stack frames have associated category information.
   return !!(!category &&
-    !CHROME_SCHEMES.find(e => location.contains(e)) &&
-    CONTENT_SCHEMES.find(e => location.contains(e)));
+    !CHROME_SCHEMES.find(e => location.includes(e)) &&
+    CONTENT_SCHEMES.find(e => location.includes(e)));
 }
 
 /**
  * This filters out platform data frames in a sample. With latest performance
  * tool in Fx40, when displaying only content, we still filter out all platform data,
  * except we generalize platform data that are leaves. We do this because of two
  * observations:
  *
--- a/browser/devtools/shared/test/browser_flame-graph-04.js
+++ b/browser/devtools/shared/test/browser_flame-graph-04.js
@@ -50,17 +50,17 @@ function testGraph(graph) {
   info("Text at 1px width   : " + text1px);
 
   is(text1000px, text,
     "The fitted text for 1000px width is correct.");
 
   isnot(text50px, text,
     "The fitted text for 50px width is correct (1).");
 
-  ok(text50px.contains(L10N.ellipsis),
+  ok(text50px.includes(L10N.ellipsis),
     "The fitted text for 50px width is correct (2).");
 
   is(graph._getFittedText(text, 10), L10N.ellipsis,
     "The fitted text for 10px width is correct.");
 
   is(graph._getFittedText(text, 1), "",
     "The fitted text for 1px width is correct.");
 }
--- a/browser/devtools/shared/test/browser_telemetry_button_eyedropper.js
+++ b/browser/devtools/shared/test/browser_telemetry_button_eyedropper.js
@@ -36,17 +36,17 @@ function* testButton(toolbox, Telemetry)
   checkResults("_EYEDROPPER_", Telemetry);
 }
 
 function checkResults(histIdFocus, Telemetry) {
   let result = Telemetry.prototype.telemetryInfo;
 
   for (let [histId, value] of Iterator(result)) {
     if (histId.startsWith("DEVTOOLS_INSPECTOR_") ||
-        !histId.contains(histIdFocus)) {
+        !histId.includes(histIdFocus)) {
       // Inspector stats are tested in
       // browser_telemetry_toolboxtabs_{toolname}.js so we skip them here
       // because we only open the inspector once for this test.
       continue;
     }
 
     if (histId.endsWith("OPENED_PER_USER_FLAG")) {
       ok(value.length === 1 && value[0] === true,
--- a/browser/devtools/styleeditor/test/browser_styleeditor_private_perwindowpb.js
+++ b/browser/devtools/styleeditor/test/browser_styleeditor_private_perwindowpb.js
@@ -38,17 +38,17 @@ function checkDiskCacheFor(host)
     onCacheStorageInfo: function(num, consumption)
     {
       info("disk storage contains " + num + " entries");
     },
     onCacheEntryInfo: function(uri)
     {
       var urispec = uri.asciiSpec;
       info(urispec);
-      foundPrivateData |= urispec.contains(host);
+      foundPrivateData |= urispec.includes(host);
     },
     onCacheEntryVisitCompleted: function()
     {
       is(foundPrivateData, false, "web content present in disk cache");
       deferred.resolve();
     }
   };
   function Visitor() {}
--- a/browser/devtools/styleinspector/rule-view.js
+++ b/browser/devtools/styleinspector/rule-view.js
@@ -2060,17 +2060,17 @@ CssRuleView.prototype = {
     } else if (aRule.domRule.type === ELEMENT_STYLE) {
       selectorNodes = [];
     }
 
     aValue = aValue.trim();
 
     // Highlight search matches in the rule selectors
     for (let selectorNode of selectorNodes) {
-      if (selectorNode.textContent.toLowerCase().contains(aValue)) {
+      if (selectorNode.textContent.toLowerCase().includes(aValue)) {
         selectorNode.classList.add("ruleview-highlight");
         this._highlightedElements.push(selectorNode);
         isHighlighted = true;
       }
     }
 
     // Parse search value as a single property line and extract the property
     // name and value. Otherwise, use the search value as both the name and
@@ -2085,20 +2085,20 @@ CssRuleView.prototype = {
       let propertyValue = textProp.editor.valueSpan.textContent.toLowerCase();
       let propertyName = textProp.name.toLowerCase();
 
       // If the input value matches a property line like `font-family: arial`,
       // then check to make sure the name and value match.  Otherwise, just
       // compare the input string directly against the name and value elements.
       let matches = false;
       if (propertyMatch && name && value) {
-        matches = propertyName.contains(name) && propertyValue.contains(value);
+        matches = propertyName.includes(name) && propertyValue.includes(value);
       } else {
-        matches = (name && propertyName.contains(name)) ||
-                  (value && propertyValue.contains(value));
+        matches = (name && propertyName.includes(name)) ||
+                  (value && propertyValue.includes(value));
       }
 
       if (matches) {
       // if (matchTextProperty || matchNameOrValue) {
         textProp.editor.element.classList.add("ruleview-highlight");
         this._highlightedElements.push(textProp.editor.element);
         isHighlighted = true;
       }
--- a/dom/base/test/chrome/window_nsITextInputProcessor.xul
+++ b/dom/base/test/chrome/window_nsITextInputProcessor.xul
@@ -119,25 +119,25 @@ function runBeginInputTransactionMethodT
      description + "The input element should have composing string");
 
   // Composing nsITextInputProcessor instance shouldn't allow initialize it again.
   try {
     TIP1.beginInputTransaction(window, simpleCallback);
     ok(false,
        "TIP1.beginInputTransaction(window) should cause throwing an exception because it's composing with different purpose");
   } catch (e) {
-    ok(e.message.contains("NS_ERROR_ALREADY_INITIALIZED"),
+    ok(e.message.includes("NS_ERROR_ALREADY_INITIALIZED"),
        description + "TIP1.beginInputTransaction(window) should cause throwing an exception including NS_ERROR_ALREADY_INITIALIZED because it's composing for tests");
   }
   try {
     TIP1.beginInputTransactionForTests(otherWindow);
     ok(false,
        "TIP1.beginInputTransactionForTests(otherWindow) should cause throwing an exception because it's composing on different window");
   } catch (e) {
-    ok(e.message.contains("NS_ERROR_ALREADY_INITIALIZED"),
+    ok(e.message.includes("NS_ERROR_ALREADY_INITIALIZED"),
        description + "TIP1.beginInputTransaction(otherWindow) should cause throwing an exception including NS_ERROR_ALREADY_INITIALIZED because it's composing on this window");
   }
   ok(TIP1.beginInputTransactionForTests(window),
      description + "TIP1.beginInputTransactionForTests(window) should succeed because TextEventDispatcher was initialized with same purpose");
   ok(TIP1.beginInputTransactionForTests(childWindow),
      description + "TIP1.beginInputTransactionForTests(childWindow) should succeed because TextEventDispatcher was initialized with same purpose and is shared by window and childWindow");
   ok(!TIP2.beginInputTransaction(window, simpleCallback),
      description + "TIP2.beginInputTransaction(window) should not succeed because there is composition synthesized by TIP1");
@@ -609,17 +609,17 @@ function runBeginInputTransactionMethodT
   input.addEventListener("compositionstart", function (aEvent) {
     events.push(aEvent);
     input.removeEventListener(aEvent.type, arguments.callee, false);
     try {
       TIP1.beginInputTransaction(otherWindow, simpleCallback);
       ok(false,
          description + "TIP1.beginInputTransaction(otherWindow, simpleCallback) called from \"compositionstart\" should throw an exception during startComposition()");
     } catch (e) {
-      ok(e.message.contains("NS_ERROR_ALREADY_INITIALIZED"),
+      ok(e.message.includes("NS_ERROR_ALREADY_INITIALIZED"),
          description + "TIP1.beginInputTransaction(otherWindow, simpleCallback) called from \"compositionstart\" should cause NS_ERROR_ALREADY_INITIALIZED during startComposition()");
     }
   }, false);
   TIP1.beginInputTransaction(window, simpleCallback);
   TIP1.startComposition();
   is(events.length, 1,
      description + "compositionstart event should be fired by TIP1.startComposition()");
   TIP1.cancelComposition();
@@ -629,53 +629,53 @@ function runBeginInputTransactionMethodT
   input.addEventListener("compositionstart", function (aEvent) {
     events.push(aEvent);
     input.removeEventListener(aEvent.type, arguments.callee, false);
     try {
       TIP1.beginInputTransaction(otherWindow, simpleCallback);
       ok(false,
          description + "TIP1.beginInputTransaction(otherWindow, simpleCallback) called from \"compositionstart\" should throw an exception during flushPendingComposition()");
     } catch (e) {
-      ok(e.message.contains("NS_ERROR_ALREADY_INITIALIZED"),
+      ok(e.message.includes("NS_ERROR_ALREADY_INITIALIZED"),
          description + "TIP1.beginInputTransaction(otherWindow, simpleCallback) called from \"compositionstart\" should cause NS_ERROR_ALREADY_INITIALIZED during flushPendingComposition()");
     }
   }, false);
   input.addEventListener("compositionupdate", function (aEvent) {
     events.push(aEvent);
     input.removeEventListener(aEvent.type, arguments.callee, false);
     try {
       TIP1.beginInputTransaction(otherWindow, simpleCallback);
       ok(false,
          description + "TIP1.beginInputTransaction(otherWindow, simpleCallback) called from \"compositionupdate\" should throw an exception during flushPendingComposition()");
     } catch (e) {
-      ok(e.message.contains("NS_ERROR_ALREADY_INITIALIZED"),
+      ok(e.message.includes("NS_ERROR_ALREADY_INITIALIZED"),
          description + "TIP1.beginInputTransaction(otherWindow, simpleCallback) called from \"compositionupdate\" should cause NS_ERROR_ALREADY_INITIALIZED during flushPendingComposition()");
     }
   }, false);
   input.addEventListener("text", function (aEvent) {
     events.push(aEvent);
     input.removeEventListener(aEvent.type, arguments.callee, false);
     try {
       TIP1.beginInputTransaction(otherWindow, simpleCallback);
       ok(false,
          description + "TIP1.beginInputTransaction(otherWindow, simpleCallback) called from \"text\" should throw an exception during flushPendingComposition()");
     } catch (e) {
-      ok(e.message.contains("NS_ERROR_ALREADY_INITIALIZED"),
+      ok(e.message.includes("NS_ERROR_ALREADY_INITIALIZED"),
          description + "TIP1.beginInputTransaction(otherWindow, simpleCallback) called from \"text\" should cause NS_ERROR_ALREADY_INITIALIZED during flushPendingComposition()");
     }
   }, false);
   input.addEventListener("input", function (aEvent) {
     events.push(aEvent);
     input.removeEventListener(aEvent.type, arguments.callee, false);
     try {
       TIP1.beginInputTransaction(otherWindow, simpleCallback);
       ok(false,
          description + "TIP1.beginInputTransaction(otherWindow, simpleCallback) called from \"input\" should throw an exception during flushPendingComposition()");
     } catch (e) {
-      ok(e.message.contains("NS_ERROR_ALREADY_INITIALIZED"),
+      ok(e.message.includes("NS_ERROR_ALREADY_INITIALIZED"),
          description + "TIP1.beginInputTransaction(otherWindow, simpleCallback) called from \"input\" should cause NS_ERROR_ALREADY_INITIALIZED during flushPendingComposition()");
     }
   }, false);
   TIP1.beginInputTransaction(window, simpleCallback);
   TIP1.setPendingCompositionString(composingStr);
   TIP1.appendClauseToPendingComposition(composingStr.length, TIP1.ATTR_RAW_CLAUSE);
   TIP1.flushPendingComposition();
   is(events.length, 4,
@@ -699,41 +699,41 @@ function runBeginInputTransactionMethodT
   input.addEventListener("text", function (aEvent) {
     events.push(aEvent);
     input.removeEventListener(aEvent.type, arguments.callee, false);
     try {
       TIP1.beginInputTransaction(otherWindow, simpleCallback);
       ok(false,
          description + "TIP1.beginInputTransaction(otherWindow, simpleCallback) called from \"text\" should throw an exception during commitComposition()");
     } catch (e) {
-      ok(e.message.contains("NS_ERROR_ALREADY_INITIALIZED"),
+      ok(e.message.includes("NS_ERROR_ALREADY_INITIALIZED"),
          description + "TIP1.beginInputTransaction(otherWindow, simpleCallback) called from \"text\" should cause NS_ERROR_ALREADY_INITIALIZED during commitComposition()");
     }
   }, false);
   input.addEventListener("compositionend", function (aEvent) {
     events.push(aEvent);
     input.removeEventListener(aEvent.type, arguments.callee, false);
     try {
       TIP1.beginInputTransaction(otherWindow, simpleCallback);
       ok(false,
          description + "TIP1.beginInputTransaction(otherWindow, simpleCallback) called from \"compositionend\" should throw an exception during commitComposition()");
     } catch (e) {
-      ok(e.message.contains("NS_ERROR_ALREADY_INITIALIZED"),
+      ok(e.message.includes("NS_ERROR_ALREADY_INITIALIZED"),
          description + "TIP1.beginInputTransaction(otherWindow, simpleCallback) called from \"compositionend\" should cause NS_ERROR_ALREADY_INITIALIZED during commitComposition()");
     }
   }, false);
   input.addEventListener("input", function (aEvent) {
     events.push(aEvent);
     input.removeEventListener(aEvent.type, arguments.callee, false);
     try {
       TIP1.beginInputTransaction(otherWindow, simpleCallback);
       ok(false,
          description + "TIP1.beginInputTransaction(otherWindow, simpleCallback) called from \"input\" should throw an exception during commitComposition()");
     } catch (e) {
-      ok(e.message.contains("NS_ERROR_ALREADY_INITIALIZED"),
+      ok(e.message.includes("NS_ERROR_ALREADY_INITIALIZED"),
          description + "TIP1.beginInputTransaction(otherWindow, simpleCallback) called from \"input\" should cause NS_ERROR_ALREADY_INITIALIZED during commitComposition()");
     }
   }, false);
   TIP1.commitComposition();
   is(events.length, 3,
      description + "text, compositionend and input events should be fired by TIP1.commitComposition()");
   is(events[0].type, "text",
      description + "events[0] should be text");
@@ -747,65 +747,65 @@ function runBeginInputTransactionMethodT
   input.addEventListener("compositionstart", function (aEvent) {
     events.push(aEvent);
     input.removeEventListener(aEvent.type, arguments.callee, false);
     try {
       TIP1.beginInputTransaction(otherWindow, simpleCallback);
       ok(false,
          description + "TIP1.beginInputTransaction(otherWindow, simpleCallback) called from \"compositionstart\" should throw an exception during commitCompositionWith(\"bar\")");
     } catch (e) {
-      ok(e.message.contains("NS_ERROR_ALREADY_INITIALIZED"),
+      ok(e.message.includes("NS_ERROR_ALREADY_INITIALIZED"),
          description + "TIP1.beginInputTransaction(otherWindow, simpleCallback) called from \"compositionstart\" should cause NS_ERROR_ALREADY_INITIALIZED during commitCompositionWith(\"bar\")");
     }
   }, false);
   input.addEventListener("compositionupdate", function (aEvent) {
     events.push(aEvent);
     input.removeEventListener(aEvent.type, arguments.callee, false);
     try {
       TIP1.beginInputTransaction(otherWindow, simpleCallback);
       ok(false,
          description + "TIP1.beginInputTransaction(otherWindow, simpleCallback) called from \"compositionupdate\" should throw an exception during commitCompositionWith(\"bar\")");
     } catch (e) {
-      ok(e.message.contains("NS_ERROR_ALREADY_INITIALIZED"),
+      ok(e.message.includes("NS_ERROR_ALREADY_INITIALIZED"),
          description + "TIP1.beginInputTransaction(otherWindow, simpleCallback) called from \"compositionupdate\" should cause NS_ERROR_ALREADY_INITIALIZED during commitCompositionWith(\"bar\")");
     }
   }, false);
   input.addEventListener("text", function (aEvent) {
     events.push(aEvent);
     input.removeEventListener(aEvent.type, arguments.callee, false);
     try {
       TIP1.beginInputTransaction(otherWindow, simpleCallback);
       ok(false,
          description + "TIP1.beginInputTransaction(otherWindow, simpleCallback) called from \"text\" should throw an exception during commitCompositionWith(\"bar\")");
     } catch (e) {
-      ok(e.message.contains("NS_ERROR_ALREADY_INITIALIZED"),
+      ok(e.message.includes("NS_ERROR_ALREADY_INITIALIZED"),
          description + "TIP1.beginInputTransaction(otherWindow, simpleCallback) called from \"text\" should cause NS_ERROR_ALREADY_INITIALIZED during commitCompositionWith(\"bar\")");
     }
   }, false);
   input.addEventListener("compositionend", function (aEvent) {
     events.push(aEvent);
     input.removeEventListener(aEvent.type, arguments.callee, false);
     try {
       TIP1.beginInputTransaction(otherWindow, simpleCallback);
       ok(false,
          description + "TIP1.beginInputTransaction(otherWindow, simpleCallback) called from \"compositionend\" should throw an exception during commitCompositionWith(\"bar\")");
     } catch (e) {
-      ok(e.message.contains("NS_ERROR_ALREADY_INITIALIZED"),
+      ok(e.message.includes("NS_ERROR_ALREADY_INITIALIZED"),
          description + "TIP1.beginInputTransaction(otherWindow, simpleCallback) called from \"compositionend\" should cause NS_ERROR_ALREADY_INITIALIZED during commitCompositionWith(\"bar\")");
     }
   }, false);
   input.addEventListener("input", function (aEvent) {
     events.push(aEvent);
     input.removeEventListener(aEvent.type, arguments.callee, false);
     try {
       TIP1.beginInputTransaction(otherWindow, simpleCallback);
       ok(false,
          description + "TIP1.beginInputTransaction(otherWindow, simpleCallback) called from \"input\" should throw an exception during commitCompositionWith(\"bar\")");
     } catch (e) {
-      ok(e.message.contains("NS_ERROR_ALREADY_INITIALIZED"),
+      ok(e.message.includes("NS_ERROR_ALREADY_INITIALIZED"),
          description + "TIP1.beginInputTransaction(otherWindow, simpleCallback) called from \"input\" should cause NS_ERROR_ALREADY_INITIALIZED during commitCompositionWith(\"bar\")");
     }
   }, false);
   TIP1.beginInputTransaction(window, simpleCallback);
   TIP1.commitCompositionWith("bar");
   is(events.length, 5,
      description + "compositionstart, compositionupdate, text, compositionend and input events should be fired by TIP1.commitCompositionWith(\"bar\")");
   is(events[0].type, "compositionstart",
@@ -828,53 +828,53 @@ function runBeginInputTransactionMethodT
   input.addEventListener("compositionupdate", function (aEvent) {
     events.push(aEvent);
     input.removeEventListener(aEvent.type, arguments.callee, false);
     try {
       TIP1.beginInputTransaction(otherWindow, simpleCallback);
       ok(false,
          description + "TIP1.beginInputTransaction(otherWindow, simpleCallback) called from \"compositionupdate\" should throw an exception during cancelComposition()");
     } catch (e) {
-      ok(e.message.contains("NS_ERROR_ALREADY_INITIALIZED"),
+      ok(e.message.includes("NS_ERROR_ALREADY_INITIALIZED"),
          description + "TIP1.beginInputTransaction(otherWindow, simpleCallback) called from \"compositionupdate\" should cause NS_ERROR_ALREADY_INITIALIZED during cancelComposition()");
     }
   }, false);
   input.addEventListener("text", function (aEvent) {
     events.push(aEvent);
     input.removeEventListener(aEvent.type, arguments.callee, false);
     try {
       TIP1.beginInputTransaction(otherWindow, simpleCallback);
       ok(false,
          description + "TIP1.beginInputTransaction(otherWindow, simpleCallback) called from \"text\" should throw an exception during cancelComposition()");
     } catch (e) {
-      ok(e.message.contains("NS_ERROR_ALREADY_INITIALIZED"),
+      ok(e.message.includes("NS_ERROR_ALREADY_INITIALIZED"),
          description + "TIP1.beginInputTransaction(otherWindow, simpleCallback) called from \"text\" should cause NS_ERROR_ALREADY_INITIALIZED during cancelComposition()");
     }
   }, false);
   input.addEventListener("compositionend", function (aEvent) {
     events.push(aEvent);
     input.removeEventListener(aEvent.type, arguments.callee, false);
     try {
       TIP1.beginInputTransaction(otherWindow, simpleCallback);
       ok(false,
          description + "TIP1.beginInputTransaction(otherWindow, simpleCallback) called from \"compositionend\" should throw an exception during cancelComposition()");
     } catch (e) {
-      ok(e.message.contains("NS_ERROR_ALREADY_INITIALIZED"),
+      ok(e.message.includes("NS_ERROR_ALREADY_INITIALIZED"),
          description + "TIP1.beginInputTransaction(otherWindow, simpleCallback) called from \"compositionend\" should cause NS_ERROR_ALREADY_INITIALIZED during cancelComposition()");
     }
   }, false);
   input.addEventListener("input", function (aEvent) {
     events.push(aEvent);
     input.removeEventListener(aEvent.type, arguments.callee, false);
     try {
       TIP1.beginInputTransaction(otherWindow, simpleCallback);
       ok(false,
          description + "TIP1.beginInputTransaction(otherWindow, simpleCallback) called from \"input\" should throw an exception during cancelComposition()");
     } catch (e) {
-      ok(e.message.contains("NS_ERROR_ALREADY_INITIALIZED"),
+      ok(e.message.includes("NS_ERROR_ALREADY_INITIALIZED"),
          description + "TIP1.beginInputTransaction(otherWindow, simpleCallback) called from \"input\" should cause NS_ERROR_ALREADY_INITIALIZED during cancelComposition()");
     }
   }, false);
   TIP1.cancelComposition();
   is(events.length, 4,
      description + "compositionupdate, text, compositionend and input events should be fired by TIP1.cancelComposition()");
   is(events[0].type, "compositionupdate",
      description + "events[0] should be compositionupdate");
@@ -891,53 +891,53 @@ function runBeginInputTransactionMethodT
   input.addEventListener("keydown", function (aEvent) {
     events.push(aEvent);
     input.removeEventListener(aEvent.type, arguments.callee, false);
     try {
       TIP1.beginInputTransaction(otherWindow, simpleCallback);
       ok(false,
          description + "TIP1.beginInputTransaction(otherWindow, simpleCallback) called from \"keydown\" should throw an exception during keydown()");
     } catch (e) {
-      ok(e.message.contains("NS_ERROR_ALREADY_INITIALIZED"),
+      ok(e.message.includes("NS_ERROR_ALREADY_INITIALIZED"),
          description + "TIP1.beginInputTransaction(otherWindow, simpleCallback) called from \"keydown\" should cause NS_ERROR_ALREADY_INITIALIZED during keydown()");
     }
   }, false);
   input.addEventListener("keypress", function (aEvent) {
     events.push(aEvent);
     input.removeEventListener(aEvent.type, arguments.callee, false);
     try {
       TIP1.beginInputTransaction(otherWindow, simpleCallback);
       ok(false,
          description + "TIP1.beginInputTransaction(otherWindow, simpleCallback) called from \"keypress\" should throw an exception during keydown()");
     } catch (e) {
-      ok(e.message.contains("NS_ERROR_ALREADY_INITIALIZED"),
+      ok(e.message.includes("NS_ERROR_ALREADY_INITIALIZED"),
          description + "TIP1.beginInputTransaction(otherWindow, simpleCallback) called from \"keypress\" should cause NS_ERROR_ALREADY_INITIALIZED during keydown()");
     }
   }, false);
   input.addEventListener("input", function (aEvent) {
     events.push(aEvent);
     input.removeEventListener(aEvent.type, arguments.callee, false);
     try {
       TIP1.beginInputTransaction(otherWindow, simpleCallback);
       ok(false,
          description + "TIP1.beginInputTransaction(otherWindow, simpleCallback) called from \"input\" should throw an exception during keydown()");
     } catch (e) {
-      ok(e.message.contains("NS_ERROR_ALREADY_INITIALIZED"),
+      ok(e.message.includes("NS_ERROR_ALREADY_INITIALIZED"),
          description + "TIP1.beginInputTransaction(otherWindow, simpleCallback) called from \"input\" should cause NS_ERROR_ALREADY_INITIALIZED during keydown()");
     }
   }, false);
   input.addEventListener("keyup", function (aEvent) {
     events.push(aEvent);
     input.removeEventListener(aEvent.type, arguments.callee, false);
     try {
       TIP1.beginInputTransaction(otherWindow, simpleCallback);
       ok(false,
          description + "TIP1.beginInputTransaction(otherWindow, simpleCallback) called from \"keyup\" should throw an exception during keyup()");
     } catch (e) {
-      ok(e.message.contains("NS_ERROR_ALREADY_INITIALIZED"),
+      ok(e.message.includes("NS_ERROR_ALREADY_INITIALIZED"),
          description + "TIP1.beginInputTransaction(otherWindow, simpleCallback) called from \"keyup\" should cause NS_ERROR_ALREADY_INITIALIZED during keyup()");
     }
   }, false);
   var keyA = new KeyboardEvent("", { key: "a", code: "KeyA", keyCode: KeyboardEvent.DOM_VK_A });
   TIP1.keydown(keyA);
   TIP1.keyup(keyA);
   is(events.length, 4,
      description + "keydown, keypress, input, keyup events should be fired by TIP1.keydown() and TIP1.keyup()");
@@ -955,17 +955,17 @@ function runBeginInputTransactionMethodT
   input.addEventListener("compositionstart", function (aEvent) {
     events.push(aEvent);
     input.removeEventListener(aEvent.type, arguments.callee, false);
     try {
       TIP1.beginInputTransactionForTests(otherWindow, simpleCallback);
       ok(false,
          description + "TIP1.beginInputTransactionForTests(otherWindow, simpleCallback) called from \"compositionstart\" should throw an exception during startComposition()");
     } catch (e) {
-      ok(e.message.contains("NS_ERROR_ALREADY_INITIALIZED"),
+      ok(e.message.includes("NS_ERROR_ALREADY_INITIALIZED"),
          description + "TIP1.beginInputTransactionForTests(otherWindow, simpleCallback) called from \"compositionstart\" should cause NS_ERROR_ALREADY_INITIALIZED during startComposition()");
     }
   }, false);
   TIP1.beginInputTransactionForTests(window, simpleCallback);
   TIP1.startComposition();
   is(events.length, 1,
      description + "compositionstart event should be fired by TIP1.startComposition()");
   TIP1.cancelComposition();
@@ -975,53 +975,53 @@ function runBeginInputTransactionMethodT
   input.addEventListener("compositionstart", function (aEvent) {
     events.push(aEvent);
     input.removeEventListener(aEvent.type, arguments.callee, false);
     try {
       TIP1.beginInputTransactionForTests(otherWindow, simpleCallback);
       ok(false,
          description + "TIP1.beginInputTransactionForTests(otherWindow, simpleCallback) called from \"compositionstart\" should throw an exception during flushPendingComposition()");
     } catch (e) {
-      ok(e.message.contains("NS_ERROR_ALREADY_INITIALIZED"),
+      ok(e.message.includes("NS_ERROR_ALREADY_INITIALIZED"),
          description + "TIP1.beginInputTransactionForTests(otherWindow, simpleCallback) called from \"compositionstart\" should cause NS_ERROR_ALREADY_INITIALIZED during flushPendingComposition()");
     }
   }, false);
   input.addEventListener("compositionupdate", function (aEvent) {
     events.push(aEvent);
     input.removeEventListener(aEvent.type, arguments.callee, false);
     try {
       TIP1.beginInputTransactionForTests(otherWindow, simpleCallback);
       ok(false,
          description + "TIP1.beginInputTransactionForTests(otherWindow, simpleCallback) called from \"compositionupdate\" should throw an exception during flushPendingComposition()");
     } catch (e) {
-      ok(e.message.contains("NS_ERROR_ALREADY_INITIALIZED"),
+      ok(e.message.includes("NS_ERROR_ALREADY_INITIALIZED"),
          description + "TIP1.beginInputTransactionForTests(otherWindow, simpleCallback) called from \"compositionupdate\" should cause NS_ERROR_ALREADY_INITIALIZED during flushPendingComposition()");
     }
   }, false);
   input.addEventListener("text", function (aEvent) {
     events.push(aEvent);
     input.removeEventListener(aEvent.type, arguments.callee, false);
     try {
       TIP1.beginInputTransactionForTests(otherWindow, simpleCallback);
       ok(false,
          description + "TIP1.beginInputTransactionForTests(otherWindow, simpleCallback) called from \"text\" should throw an exception during flushPendingComposition()");
     } catch (e) {
-      ok(e.message.contains("NS_ERROR_ALREADY_INITIALIZED"),
+      ok(e.message.includes("NS_ERROR_ALREADY_INITIALIZED"),
          description + "TIP1.beginInputTransactionForTests(otherWindow, simpleCallback) called from \"text\" should cause NS_ERROR_ALREADY_INITIALIZED during flushPendingComposition()");
     }
   }, false);
   input.addEventListener("input", function (aEvent) {
     events.push(aEvent);
     input.removeEventListener(aEvent.type, arguments.callee, false);
     try {
       TIP1.beginInputTransactionForTests(otherWindow, simpleCallback);
       ok(false,
          description + "TIP1.beginInputTransactionForTests(otherWindow, simpleCallback) called from \"input\" should throw an exception during flushPendingComposition()");
     } catch (e) {
-      ok(e.message.contains("NS_ERROR_ALREADY_INITIALIZED"),
+      ok(e.message.includes("NS_ERROR_ALREADY_INITIALIZED"),
          description + "TIP1.beginInputTransactionForTests(otherWindow, simpleCallback) called from \"input\" should cause NS_ERROR_ALREADY_INITIALIZED during flushPendingComposition()");
     }
   }, false);
   TIP1.beginInputTransactionForTests(window, simpleCallback);
   TIP1.setPendingCompositionString(composingStr);
   TIP1.appendClauseToPendingComposition(composingStr.length, TIP1.ATTR_RAW_CLAUSE);
   TIP1.flushPendingComposition();
   is(events.length, 4,
@@ -1045,41 +1045,41 @@ function runBeginInputTransactionMethodT
   input.addEventListener("text", function (aEvent) {
     events.push(aEvent);
     input.removeEventListener(aEvent.type, arguments.callee, false);
     try {
       TIP1.beginInputTransactionForTests(otherWindow, simpleCallback);
       ok(false,
          description + "TIP1.beginInputTransactionForTests(otherWindow, simpleCallback) called from \"text\" should throw an exception during commitComposition()");
     } catch (e) {
-      ok(e.message.contains("NS_ERROR_ALREADY_INITIALIZED"),
+      ok(e.message.includes("NS_ERROR_ALREADY_INITIALIZED"),
          description + "TIP1.beginInputTransactionForTests(otherWindow, simpleCallback) called from \"text\" should cause NS_ERROR_ALREADY_INITIALIZED during commitComposition()");
     }
   }, false);
   input.addEventListener("compositionend", function (aEvent) {
     events.push(aEvent);
     input.removeEventListener(aEvent.type, arguments.callee, false);
     try {
       TIP1.beginInputTransactionForTests(otherWindow, simpleCallback);
       ok(false,
          description + "TIP1.beginInputTransactionForTests(otherWindow, simpleCallback) called from \"compositionend\" should throw an exception during commitComposition()");
     } catch (e) {
-      ok(e.message.contains("NS_ERROR_ALREADY_INITIALIZED"),
+      ok(e.message.includes("NS_ERROR_ALREADY_INITIALIZED"),
          description + "TIP1.beginInputTransactionForTests(otherWindow, simpleCallback) called from \"compositionend\" should cause NS_ERROR_ALREADY_INITIALIZED during commitComposition()");
     }
   }, false);
   input.addEventListener("input", function (aEvent) {
     events.push(aEvent);
     input.removeEventListener(aEvent.type, arguments.callee, false);
     try {
       TIP1.beginInputTransactionForTests(otherWindow, simpleCallback);
       ok(false,
          description + "TIP1.beginInputTransactionForTests(otherWindow, simpleCallback) called from \"input\" should throw an exception during commitComposition()");
     } catch (e) {
-      ok(e.message.contains("NS_ERROR_ALREADY_INITIALIZED"),
+      ok(e.message.includes("NS_ERROR_ALREADY_INITIALIZED"),
          description + "TIP1.beginInputTransactionForTests(otherWindow, simpleCallback) called from \"input\" should cause NS_ERROR_ALREADY_INITIALIZED during commitComposition()");
     }
   }, false);
   TIP1.commitComposition();
   is(events.length, 3,
      description + "text, compositionend and input events should be fired by TIP1.commitComposition()");
   is(events[0].type, "text",
      description + "events[0] should be text");
@@ -1093,65 +1093,65 @@ function runBeginInputTransactionMethodT
   input.addEventListener("compositionstart", function (aEvent) {
     events.push(aEvent);
     input.removeEventListener(aEvent.type, arguments.callee, false);
     try {
       TIP1.beginInputTransactionForTests(otherWindow, simpleCallback);
       ok(false,
          description + "TIP1.beginInputTransactionForTests(otherWindow, simpleCallback) called from \"compositionstart\" should throw an exception during commitCompositionWith(\"bar\")");
     } catch (e) {
-      ok(e.message.contains("NS_ERROR_ALREADY_INITIALIZED"),
+      ok(e.message.includes("NS_ERROR_ALREADY_INITIALIZED"),
          description + "TIP1.beginInputTransactionForTests(otherWindow, simpleCallback) called from \"compositionstart\" should cause NS_ERROR_ALREADY_INITIALIZED during commitCompositionWith(\"bar\")");
     }
   }, false);
   input.addEventListener("compositionupdate", function (aEvent) {
     events.push(aEvent);
     input.removeEventListener(aEvent.type, arguments.callee, false);
     try {
       TIP1.beginInputTransactionForTests(otherWindow, simpleCallback);
       ok(false,
          description + "TIP1.beginInputTransactionForTests(otherWindow, simpleCallback) called from \"compositionupdate\" should throw an exception during commitCompositionWith(\"bar\")");
     } catch (e) {
-      ok(e.message.contains("NS_ERROR_ALREADY_INITIALIZED"),
+      ok(e.message.includes("NS_ERROR_ALREADY_INITIALIZED"),
          description + "TIP1.beginInputTransactionForTests(otherWindow, simpleCallback) called from \"compositionupdate\" should cause NS_ERROR_ALREADY_INITIALIZED during commitCompositionWith(\"bar\")");
     }
   }, false);
   input.addEventListener("text", function (aEvent) {
     events.push(aEvent);
     input.removeEventListener(aEvent.type, arguments.callee, false);
     try {
       TIP1.beginInputTransactionForTests(otherWindow, simpleCallback);
       ok(false,
          description + "TIP1.beginInputTransactionForTests(otherWindow, simpleCallback) called from \"text\" should throw an exception during commitCompositionWith(\"bar\")");
     } catch (e) {
-      ok(e.message.contains("NS_ERROR_ALREADY_INITIALIZED"),
+      ok(e.message.includes("NS_ERROR_ALREADY_INITIALIZED"),
          description + "TIP1.beginInputTransactionForTests(otherWindow, simpleCallback) called from \"text\" should cause NS_ERROR_ALREADY_INITIALIZED during commitCompositionWith(\"bar\")");
     }
   }, false);
   input.addEventListener("compositionend", function (aEvent) {
     events.push(aEvent);
     input.removeEventListener(aEvent.type, arguments.callee, false);
     try {
       TIP1.beginInputTransactionForTests(otherWindow, simpleCallback);
       ok(false,
          description + "TIP1.beginInputTransactionForTests(otherWindow, simpleCallback) called from \"compositionend\" should throw an exception during commitCompositionWith(\"bar\")");
     } catch (e) {
-      ok(e.message.contains("NS_ERROR_ALREADY_INITIALIZED"),
+      ok(e.message.includes("NS_ERROR_ALREADY_INITIALIZED"),
          description + "TIP1.beginInputTransactionForTests(otherWindow, simpleCallback) called from \"compositionend\" should cause NS_ERROR_ALREADY_INITIALIZED during commitCompositionWith(\"bar\")");
     }
   }, false);
   input.addEventListener("input", function (aEvent) {
     events.push(aEvent);
     input.removeEventListener(aEvent.type, arguments.callee, false);
     try {
       TIP1.beginInputTransactionForTests(otherWindow, simpleCallback);
       ok(false,
          description + "TIP1.beginInputTransactionForTests(otherWindow, simpleCallback) called from \"input\" should throw an exception during commitCompositionWith(\"bar\")");
     } catch (e) {
-      ok(e.message.contains("NS_ERROR_ALREADY_INITIALIZED"),
+      ok(e.message.includes("NS_ERROR_ALREADY_INITIALIZED"),
          description + "TIP1.beginInputTransactionForTests(otherWindow, simpleCallback) called from \"input\" should cause NS_ERROR_ALREADY_INITIALIZED during commitCompositionWith(\"bar\")");
     }
   }, false);
   TIP1.beginInputTransactionForTests(window, simpleCallback);
   TIP1.commitCompositionWith("bar");
   is(events.length, 5,
      description + "compositionstart, compositionupdate, text, compositionend and input events should be fired by TIP1.commitCompositionWith(\"bar\")");
   is(events[0].type, "compositionstart",
@@ -1174,53 +1174,53 @@ function runBeginInputTransactionMethodT
   input.addEventListener("compositionupdate", function (aEvent) {
     events.push(aEvent);
     input.removeEventListener(aEvent.type, arguments.callee, false);
     try {
       TIP1.beginInputTransactionForTests(otherWindow, simpleCallback);
       ok(false,
          description + "TIP1.beginInputTransactionForTests(otherWindow, simpleCallback) called from \"compositionupdate\" should throw an exception during cancelComposition()");
     } catch (e) {
-      ok(e.message.contains("NS_ERROR_ALREADY_INITIALIZED"),
+      ok(e.message.includes("NS_ERROR_ALREADY_INITIALIZED"),
          description + "TIP1.beginInputTransactionForTests(otherWindow, simpleCallback) called from \"compositionupdate\" should cause NS_ERROR_ALREADY_INITIALIZED during cancelComposition()");
     }
   }, false);
   input.addEventListener("text", function (aEvent) {
     events.push(aEvent);
     input.removeEventListener(aEvent.type, arguments.callee, false);
     try {
       TIP1.beginInputTransactionForTests(otherWindow, simpleCallback);
       ok(false,
          description + "TIP1.beginInputTransactionForTests(otherWindow, simpleCallback) called from \"text\" should throw an exception during cancelComposition()");
     } catch (e) {
-      ok(e.message.contains("NS_ERROR_ALREADY_INITIALIZED"),
+      ok(e.message.includes("NS_ERROR_ALREADY_INITIALIZED"),
          description + "TIP1.beginInputTransactionForTests(otherWindow, simpleCallback) called from \"text\" should cause NS_ERROR_ALREADY_INITIALIZED during cancelComposition()");
     }
   }, false);
   input.addEventListener("compositionend", function (aEvent) {
     events.push(aEvent);
     input.removeEventListener(aEvent.type, arguments.callee, false);
     try {
       TIP1.beginInputTransactionForTests(otherWindow, simpleCallback);
       ok(false,
          description + "TIP1.beginInputTransactionForTests(otherWindow, simpleCallback) called from \"compositionend\" should throw an exception during cancelComposition()");
     } catch (e) {
-      ok(e.message.contains("NS_ERROR_ALREADY_INITIALIZED"),
+      ok(e.message.includes("NS_ERROR_ALREADY_INITIALIZED"),
          description + "TIP1.beginInputTransactionForTests(otherWindow, simpleCallback) called from \"compositionend\" should cause NS_ERROR_ALREADY_INITIALIZED during cancelComposition()");
     }
   }, false);
   input.addEventListener("input", function (aEvent) {
     events.push(aEvent);
     input.removeEventListener(aEvent.type, arguments.callee, false);
     try {
       TIP1.beginInputTransactionForTests(otherWindow, simpleCallback);
       ok(false,
          description + "TIP1.beginInputTransactionForTests(otherWindow, simpleCallback) called from \"input\" should throw an exception during cancelComposition()");
     } catch (e) {
-      ok(e.message.contains("NS_ERROR_ALREADY_INITIALIZED"),
+      ok(e.message.includes("NS_ERROR_ALREADY_INITIALIZED"),
          description + "TIP1.beginInputTransactionForTests(otherWindow, simpleCallback) called from \"input\" should cause NS_ERROR_ALREADY_INITIALIZED during cancelComposition()");
     }
   }, false);
   TIP1.cancelComposition();
   is(events.length, 4,
      description + "compositionupdate, text, compositionend and input events should be fired by TIP1.cancelComposition()");
   is(events[0].type, "compositionupdate",
      description + "events[0] should be compositionupdate");
@@ -1237,53 +1237,53 @@ function runBeginInputTransactionMethodT
   input.addEventListener("keydown", function (aEvent) {
     events.push(aEvent);
     input.removeEventListener(aEvent.type, arguments.callee, false);
     try {
       TIP1.beginInputTransactionForTests(otherWindow, simpleCallback);
       ok(false,
          description + "TIP1.beginInputTransactionForTests(otherWindow, simpleCallback) called from \"keydown\" should throw an exception during keydown()");
     } catch (e) {
-      ok(e.message.contains("NS_ERROR_ALREADY_INITIALIZED"),
+      ok(e.message.includes("NS_ERROR_ALREADY_INITIALIZED"),
          description + "TIP1.beginInputTransactionForTests(otherWindow, simpleCallback) called from \"keydown\" should cause NS_ERROR_ALREADY_INITIALIZED during keydown()");
     }
   }, false);
   input.addEventListener("keypress", function (aEvent) {
     events.push(aEvent);
     input.removeEventListener(aEvent.type, arguments.callee, false);
     try {
       TIP1.beginInputTransactionForTests(otherWindow, simpleCallback);
       ok(false,
          description + "TIP1.beginInputTransactionForTests(otherWindow, simpleCallback) called from \"keypress\" should throw an exception during keydown()");
     } catch (e) {
-      ok(e.message.contains("NS_ERROR_ALREADY_INITIALIZED"),
+      ok(e.message.includes("NS_ERROR_ALREADY_INITIALIZED"),
          description + "TIP1.beginInputTransactionForTests(otherWindow, simpleCallback) called from \"keypress\" should cause NS_ERROR_ALREADY_INITIALIZED during keydown()");
     }
   }, false);
   input.addEventListener("input", function (aEvent) {
     events.push(aEvent);
     input.removeEventListener(aEvent.type, arguments.callee, false);
     try {
       TIP1.beginInputTransactionForTests(otherWindow, simpleCallback);
       ok(false,
          description + "TIP1.beginInputTransactionForTests(otherWindow, simpleCallback) called from \"input\" should throw an exception during keydown()");
     } catch (e) {
-      ok(e.message.contains("NS_ERROR_ALREADY_INITIALIZED"),
+      ok(e.message.includes("NS_ERROR_ALREADY_INITIALIZED"),
          description + "TIP1.beginInputTransactionForTests(otherWindow, simpleCallback) called from \"input\" should cause NS_ERROR_ALREADY_INITIALIZED during keydown()");
     }
   }, false);
   input.addEventListener("keyup", function (aEvent) {
     events.push(aEvent);
     input.removeEventListener(aEvent.type, arguments.callee, false);
     try {
       TIP1.beginInputTransactionForTests(otherWindow, simpleCallback);
       ok(false,
          description + "TIP1.beginInputTransactionForTests(otherWindow, simpleCallback) called from \"keyup\" should throw an exception during keyup()");
     } catch (e) {
-      ok(e.message.contains("NS_ERROR_ALREADY_INITIALIZED"),
+      ok(e.message.includes("NS_ERROR_ALREADY_INITIALIZED"),
          description + "TIP1.beginInputTransactionForTests(otherWindow, simpleCallback) called from \"keyup\" should cause NS_ERROR_ALREADY_INITIALIZED during keyup()");
     }
   }, false);
   var keyA = new KeyboardEvent("", { key: "a", code: "KeyA", keyCode: KeyboardEvent.DOM_VK_A });
   TIP1.keydown(keyA);
   TIP1.keyup(keyA);
   is(events.length, 4,
      description + "keydown, keypress, input, keyup events should be fired by TIP1.keydown() and TIP1.keyup()");
@@ -1303,17 +1303,17 @@ function runBeginInputTransactionMethodT
   ok(TIP2.beginInputTransactionForTests(window),
      description + "TIP2.beginInputTransactionForTests() should succeed because there is no composition");
   try {
     TIP1.startComposition();
     ok(false,
        description + "TIP1.startComposition() should cause throwing an exception because TIP2 took the ownership");
     TIP1.cancelComposition();
   } catch (e) {
-    ok(e.message.contains("NS_ERROR_NOT_INITIALIZED"),
+    ok(e.message.includes("NS_ERROR_NOT_INITIALIZED"),
        description + "TIP1.startComposition() should cause throwing an exception including NS_ERROR_NOT_INITIALIZED");
   } finally {
     is(input.value, "",
        description + "The input element should not have commit string");
   }
 
   // Let's check if flushPendingComposition() throws an exception after ownership is stolen.
   ok(TIP1.beginInputTransactionForTests(window),
@@ -1324,17 +1324,17 @@ function runBeginInputTransactionMethodT
   try {
     TIP1.setPendingCompositionString(composingStr);
     TIP1.appendClauseToPendingComposition(composingStr.length, TIP1.ATTR_RAW_CLAUSE);
     TIP1.flushPendingComposition()
     ok(false,
        description + "TIP1.flushPendingComposition() should cause throwing an exception because TIP2 took the ownership");
     TIP1.cancelComposition();
   } catch (e) {
-    ok(e.message.contains("NS_ERROR_NOT_INITIALIZED"),
+    ok(e.message.includes("NS_ERROR_NOT_INITIALIZED"),
        description + "TIP1.flushPendingComposition() should cause throwing an exception including NS_ERROR_NOT_INITIALIZED");
   } finally {
     is(input.value, "",
        description + "The input element should not have commit string");
   }
 
   // Let's check if commitCompositionWith("bar") throws an exception after ownership is stolen.
   ok(TIP1.beginInputTransactionForTests(window),
@@ -1342,17 +1342,17 @@ function runBeginInputTransactionMethodT
   ok(TIP2.beginInputTransactionForTests(window),
      description + "TIP2.beginInputTransactionForTests() should succeed because there is no composition");
   input.value = "";
   try {
     TIP1.commitCompositionWith("bar");
     ok(false,
        description + "TIP1.commitCompositionWith(\"bar\") should cause throwing an exception because TIP2 took the ownership");
   } catch (e) {
-    ok(e.message.contains("NS_ERROR_NOT_INITIALIZED"),
+    ok(e.message.includes("NS_ERROR_NOT_INITIALIZED"),
        description + "TIP1.commitCompositionWith(\"bar\") should cause throwing an exception including NS_ERROR_NOT_INITIALIZED");
   } finally {
     is(input.value, "",
        description + "The input element should not have commit string");
   }
 
   // Let's check if keydown() throws an exception after ownership is stolen.
   ok(TIP1.beginInputTransactionForTests(window),
@@ -1361,17 +1361,17 @@ function runBeginInputTransactionMethodT
      description + "TIP2.beginInputTransactionForTests() should succeed because there is no composition");
   input.value = "";
   try {
     var keyF = new KeyboardEvent("", { key: "f", code: "KeyF", keyCode: KeyboardEvent.DOM_VK_F });
     TIP1.keydown(keyF);
     ok(false,
        description + "TIP1.keydown(keyF) should cause throwing an exception because TIP2 took the ownership");
   } catch (e) {
-    ok(e.message.contains("NS_ERROR_NOT_INITIALIZED"),
+    ok(e.message.includes("NS_ERROR_NOT_INITIALIZED"),
        description + "TIP1.keydown(keyF) should cause throwing an exception including NS_ERROR_NOT_INITIALIZED");
   } finally {
     is(input.value, "",
        description + "The input element should not be modified");
   }
 
   // Let's check if keyup() throws an exception after ownership is stolen.
   ok(TIP1.beginInputTransactionForTests(window),
@@ -1380,50 +1380,50 @@ function runBeginInputTransactionMethodT
      description + "TIP2.beginInputTransactionForTests() should succeed because there is no composition");
   input.value = "";
   try {
     var keyF = new KeyboardEvent("", { key: "f", code: "KeyF", keyCode: KeyboardEvent.DOM_VK_F });
     TIP1.keyup(keyF);
     ok(false,
        description + "TIP1.keyup(keyF) should cause throwing an exception because TIP2 took the ownership");
   } catch (e) {
-    ok(e.message.contains("NS_ERROR_NOT_INITIALIZED"),
+    ok(e.message.includes("NS_ERROR_NOT_INITIALIZED"),
        description + "TIP1.keyup(keyF) should cause throwing an exception including NS_ERROR_NOT_INITIALIZED");
   } finally {
     is(input.value, "",
        description + "The input element should not be modified");
   }
 
   // aCallback of nsITextInputProcessor.beginInputTransaction() must not be omitted.
   try {
     TIP1.beginInputTransaction(window);
     ok(false,
        description + "TIP1.beginInputTransaction(window) should be failed since aCallback is omitted");
   } catch (e) {
-    ok(e.message.contains("Not enough arguments"),
+    ok(e.message.includes("Not enough arguments"),
        description + "TIP1.beginInputTransaction(window) should cause throwing an exception including \"Not enough arguments\" since aCallback is omitted");
   }
 
   // aCallback of nsITextInputProcessor.beginInputTransaction() must not be undefined.
   try {
     TIP1.beginInputTransaction(window, undefined);
     ok(false,
        description + "TIP1.beginInputTransaction(window, undefined) should be failed since aCallback is undefined");
   } catch (e) {
-    ok(e.message.contains("NS_ERROR_ILLEGAL_VALUE"),
+    ok(e.message.includes("NS_ERROR_ILLEGAL_VALUE"),
        description + "TIP1.beginInputTransaction(window, undefined) should cause throwing an exception including NS_ERROR_ILLEGAL_VALUE since aCallback is undefined");
   }
 
   // aCallback of nsITextInputProcessor.beginInputTransaction() must not be null.
   try {
     TIP1.beginInputTransaction(window, null);
     ok(false,
        description + "TIP1.beginInputTransaction(window, null) should be failed since aCallback is null");
   } catch (e) {
-    ok(e.message.contains("NS_ERROR_ILLEGAL_VALUE"),
+    ok(e.message.includes("NS_ERROR_ILLEGAL_VALUE"),
        description + "TIP1.beginInputTransaction(window, null) should cause throwing an exception including NS_ERROR_ILLEGAL_VALUE since aCallback is null");
   }
 }
 
 function runReleaseTests()
 {
   var description = "runReleaseTests(): ";
 
@@ -3343,49 +3343,49 @@ function runErrorTests()
 
   // startComposition() should throw an exception if there is already a composition
   TIP.startComposition();
   try {
     TIP.startComposition();
     ok(false,
        description + "startComposition() should fail if it was already called");
   } catch (e) {
-    ok(e.message.contains("NS_ERROR_FAILURE"),
+    ok(e.message.includes("NS_ERROR_FAILURE"),
        description + "startComposition() should cause NS_ERROR_FAILURE if there is already composition");
   } finally {
     TIP.cancelComposition();
   }
 
   // cancelComposition() should throw an exception if there is no composition
   try {
     TIP.cancelComposition();
     ok(false,
        description + "cancelComposition() should fail if there is no composition");
   } catch (e) {
-    ok(e.message.contains("NS_ERROR_FAILURE"),
+    ok(e.message.includes("NS_ERROR_FAILURE"),
        description + "cancelComposition() should cause NS_ERROR_FAILURE if there is no composition");
   }
 
   // commitComposition() without commit string should throw an exception if there is no composition
   try {
     TIP.commitComposition();
     ok(false,
        description + "commitComposition() should fail if there is no composition");
   } catch (e) {
-    ok(e.message.contains("NS_ERROR_FAILURE"),
+    ok(e.message.includes("NS_ERROR_FAILURE"),
        description + "commitComposition() should cause NS_ERROR_FAILURE if there is no composition");
   }
 
   // commitCompositionWith("") should throw an exception if there is no composition
   try {
     TIP.commitCompositionWith("");
     ok(false,
        description + "commitCompositionWith(\"\") should fail if there is no composition");
   } catch (e) {
-    ok(e.message.contains("NS_ERROR_FAILURE"),
+    ok(e.message.includes("NS_ERROR_FAILURE"),
        description + "commitCompositionWith(\"\") should cause NS_ERROR_FAILURE if there is no composition");
   }
 
   // Pending composition string should allow to flush without clause information (for compatibility)
   try {
     TIP.setPendingCompositionString("foo");
     TIP.flushPendingComposition();
     ok(true,
@@ -3400,201 +3400,201 @@ function runErrorTests()
   try {
     TIP.setPendingCompositionString("foo");
     TIP.appendClauseToPendingComposition(2, TIP.ATTR_RAW_CLAUSE);
     TIP.flushPendingComposition();
     ok(false,
        description + "flushPendingComposition() should fail if appendClauseToPendingComposition() doesn't fill all composition string");
     TIP.cancelComposition();
   } catch (e) {
-    ok(e.message.contains("NS_ERROR_ILLEGAL_VALUE"),
+    ok(e.message.includes("NS_ERROR_ILLEGAL_VALUE"),
        description + "flushPendingComposition() should cause NS_ERROR_ILLEGAL_VALUE if appendClauseToPendingComposition() doesn't fill all composition string");
   }
 
   // Pending composition string must not be shorter than appended clause length
   try {
     TIP.setPendingCompositionString("foo");
     TIP.appendClauseToPendingComposition(4, TIP.ATTR_RAW_CLAUSE);
     TIP.flushPendingComposition();
     ok(false,
        description + "flushPendingComposition() should fail if appendClauseToPendingComposition() appends longer clause information");
     TIP.cancelComposition();
   } catch (e) {
-    ok(e.message.contains("NS_ERROR_ILLEGAL_VALUE"),
+    ok(e.message.includes("NS_ERROR_ILLEGAL_VALUE"),
        description + "flushPendingComposition() should cause NS_ERROR_ILLEGAL_VALUE if appendClauseToPendingComposition() appends longer clause information");
   }
 
   // Pending composition must not have clause information with empty string
   try {
     TIP.appendClauseToPendingComposition(1, TIP.ATTR_RAW_CLAUSE);
     TIP.flushPendingComposition();
     ok(false,
        description + "flushPendingComposition() should fail if there is a clause with empty string");
     TIP.cancelComposition();
   } catch (e) {
-    ok(e.message.contains("NS_ERROR_ILLEGAL_VALUE"),
+    ok(e.message.includes("NS_ERROR_ILLEGAL_VALUE"),
        description + "flushPendingComposition() should cause NS_ERROR_ILLEGAL_VALUE if there is a clause with empty string");
   }
 
   // Appending a clause whose length is 0 should cause an exception
   try {
     TIP.appendClauseToPendingComposition(0, TIP.ATTR_RAW_CLAUSE);
     ok(false,
        description + "appendClauseToPendingComposition() should fail if the length is 0");
     TIP.flushPendingComposition();
     TIP.cancelComposition();
   } catch (e) {
-    ok(e.message.contains("NS_ERROR_ILLEGAL_VALUE"),
+    ok(e.message.includes("NS_ERROR_ILLEGAL_VALUE"),
        description + "appendClauseToPendingComposition() should cause NS_ERROR_ILLEGAL_VALUE if the length is 0");
   }
 
   // Appending a clause whose attribute is invalid should cause an exception
   try {
     TIP.setPendingCompositionString("foo");
     TIP.appendClauseToPendingComposition(3, 0);
     ok(false,
        description + "appendClauseToPendingComposition() should fail if the attribute is invalid");
     TIP.flushPendingComposition();
     TIP.cancelComposition();
   } catch (e) {
-    ok(e.message.contains("NS_ERROR_ILLEGAL_VALUE"),
+    ok(e.message.includes("NS_ERROR_ILLEGAL_VALUE"),
        description + "appendClauseToPendingComposition() should cause NS_ERROR_ILLEGAL_VALUE if the attribute is invalid");
   }
 
   // Setting caret position outside of composition string should cause an exception
   try {
     TIP.setPendingCompositionString("foo");
     TIP.appendClauseToPendingComposition(3, TIP.ATTR_RAW_CLAUSE);
     TIP.setCaretInPendingComposition(4);
     TIP.flushPendingComposition();
     ok(false,
        description + "flushPendingComposition() should fail if caret position is out of composition string");
     TIP.cancelComposition();
   } catch (e) {
-    ok(e.message.contains("NS_ERROR_ILLEGAL_VALUE"),
+    ok(e.message.includes("NS_ERROR_ILLEGAL_VALUE"),
        description + "flushPendingComposition() should cause NS_ERROR_ILLEGAL_VALUE if caret position is out of composition string");
   }
 
   // Calling keydown() with a KeyboardEvent initialized with invalid code value should cause an exception.
   input.value = "";
   try {
     var keyInvalidCode = new KeyboardEvent("", { key: "f", code: "InvalidCodeValue", keyCode: KeyboardEvent.DOM_VK_F });
     TIP.keydown(keyInvalidCode);
     ok(false,
        description + "TIP.keydown(keyInvalidCode) should cause throwing an exception because its code value is not registered");
   } catch (e) {
-    ok(e.message.contains("NS_ERROR_ILLEGAL_VALUE"),
+    ok(e.message.includes("NS_ERROR_ILLEGAL_VALUE"),
        description + "TIP.keydown(keyInvalidCode) should cause throwing an exception including NS_ERROR_ILLEGAL_VALUE");
   } finally {
     is(input.value, "",
        description + "The input element should not be modified");
   }
 
   // Calling keyup() with a KeyboardEvent initialized with invalid code value should cause an exception.
   input.value = "";
   try {
     var keyInvalidCode = new KeyboardEvent("", { key: "f", code: "InvalidCodeValue", keyCode: KeyboardEvent.DOM_VK_F });
     TIP.keyup(keyInvalidCode);
     ok(false,
        description + "TIP.keyup(keyInvalidCode) should cause throwing an exception because its code value is not registered");
   } catch (e) {
-    ok(e.message.contains("NS_ERROR_ILLEGAL_VALUE"),
+    ok(e.message.includes("NS_ERROR_ILLEGAL_VALUE"),
        description + "TIP.keyup(keyInvalidCode) should cause throwing an exception including NS_ERROR_ILLEGAL_VALUE");
   } finally {
     is(input.value, "",
        description + "The input element should not be modified");
   }
 
   // Calling keydown(KEY_NON_PRINTABLE_KEY) with a KeyboardEvent initialized with non-key name should cause an exception.
   input.value = "";
   try {
     var keyInvalidKey = new KeyboardEvent("", { key: "ESCAPE", code: "Escape", keyCode: KeyboardEvent.DOM_VK_Escape});
     TIP.keydown(keyInvalidKey, TIP.KEY_NON_PRINTABLE_KEY);
     ok(false,
        description + "TIP.keydown(keyInvalidKey, TIP.KEY_NON_PRINTABLE_KEY) should cause throwing an exception because its key value is not registered");
   } catch (e) {
-    ok(e.message.contains("NS_ERROR_ILLEGAL_VALUE"),
+    ok(e.message.includes("NS_ERROR_ILLEGAL_VALUE"),
        description + "keydown(keyInvalidKey, TIP.KEY_NON_PRINTABLE_KEY) should cause throwing an exception including NS_ERROR_ILLEGAL_VALUE");
   } finally {
     is(input.value, "",
        description + "The input element should not be modified");
   }
 
   // Calling keyup(KEY_NON_PRINTABLE_KEY) with a KeyboardEvent initialized with non-key name should cause an exception.
   input.value = "";
   try {
     var keyInvalidKey = new KeyboardEvent("", { key: "ESCAPE", code: "Escape", keyCode: KeyboardEvent.DOM_VK_Escape});
     TIP.keydown(keyInvalidKey, TIP.KEY_NON_PRINTABLE_KEY);
     ok(false,
        description + "TIP.keyup(keyInvalidKey, TIP.KEY_NON_PRINTABLE_KEY) should cause throwing an exception because its key value is not registered");
   } catch (e) {
-    ok(e.message.contains("NS_ERROR_ILLEGAL_VALUE"),
+    ok(e.message.includes("NS_ERROR_ILLEGAL_VALUE"),
        description + "keyup(keyInvalidKey, TIP.KEY_NON_PRINTABLE_KEY) should cause throwing an exception including NS_ERROR_ILLEGAL_VALUE");
   } finally {
     is(input.value, "",
        description + "The input element should not be modified");
   }
 
   // KEY_KEEP_KEY_LOCATION_STANDARD flag should be used only when .location is not initialized with non-zero value.
   try {
     var keyEvent = new KeyboardEvent("", { code: "Enter", location: KeyboardEvent.DOM_KEY_LOCATION_LEFT });
     TIP.keydown(keyEvent, TIP.KEY_KEEP_KEY_LOCATION_STANDARD);
     ok(false,
        description + "keydown(KEY_KEEP_KEY_LOCATION_STANDARD) should fail if the .location of the key event is initialized with non-zero value");
   } catch (e) {
-    ok(e.message.contains("NS_ERROR_ILLEGAL_VALUE"),
+    ok(e.message.includes("NS_ERROR_ILLEGAL_VALUE"),
        description + "keydown(KEY_KEEP_KEY_LOCATION_STANDARD) should cause NS_ERROR_ILLEGAL_VALUE if the .location of the key event is initialized with nonzero value");
   }
   try {
     var keyEvent = new KeyboardEvent("", { code: "Enter", location: KeyboardEvent.DOM_KEY_LOCATION_LEFT });
     TIP.keyup(keyEvent, TIP.KEY_KEEP_KEY_LOCATION_STANDARD);
     ok(false,
        description + "keyup(KEY_KEEP_KEY_LOCATION_STANDARD) should fail if the .location of the key event is initialized with non-zero value");
   } catch (e) {
-    ok(e.message.contains("NS_ERROR_ILLEGAL_VALUE"),
+    ok(e.message.includes("NS_ERROR_ILLEGAL_VALUE"),
        description + "keyup(KEY_KEEP_KEY_LOCATION_STANDARD) should cause NS_ERROR_ILLEGAL_VALUE if the .location of the key event is initialized with nonzero value");
   }
 
   // KEY_KEEP_KEYCODE_ZERO flag should be used only when .keyCode is not initialized with non-zero value.
   try {
     var keyEvent = new KeyboardEvent("", { key: "Enter", keyCode: KeyboardEvent.DOM_VK_RETURN });
     TIP.keydown(keyEvent, TIP.KEY_KEEP_KEYCODE_ZERO);
     ok(false,
        description + "keydown(KEY_KEEP_KEYCODE_ZERO) should fail if the .keyCode of the key event is initialized with non-zero value");
   } catch (e) {
-    ok(e.message.contains("NS_ERROR_ILLEGAL_VALUE"),
+    ok(e.message.includes("NS_ERROR_ILLEGAL_VALUE"),
        description + "keydown(KEY_KEEP_KEYCODE_ZERO) should cause NS_ERROR_ILLEGAL_VALUE if the .keyCode of the key event is initialized with nonzero value");
   }
   try {
     var keyEvent = new KeyboardEvent("", { key: "Enter", keyCode: KeyboardEvent.DOM_VK_RETURN });
     TIP.keyup(keyEvent, TIP.KEY_KEEP_KEYCODE_ZERO);
     ok(false,
        description + "keyup(KEY_KEEP_KEYCODE_ZERO) should fail if the .keyCode of the key event is initialized with non-zero value");
   } catch (e) {
-    ok(e.message.contains("NS_ERROR_ILLEGAL_VALUE"),
+    ok(e.message.includes("NS_ERROR_ILLEGAL_VALUE"),
        description + "keyup(KEY_KEEP_KEYCODE_ZERO) should cause NS_ERROR_ILLEGAL_VALUE if the .keyCode of the key event is initialized with nonzero value");
   }
 
   // Specifying KEY_DONT_DISPATCH_MODIFIER_KEY_EVENT with non-modifier key, it should cause an exception.
   try {
     var keyEvent = new KeyboardEvent("", { key: "a", code: "ShiftLeft" });
     TIP.keyup(keyEvent, TIP.KEY_DONT_DISPATCH_MODIFIER_KEY_EVENT);
     ok(false,
        description + "keydown(KEY_DONT_DISPATCH_MODIFIER_KEY_EVENT) should fail if the .key value isn't a modifier key");
   } catch (e) {
-    ok(e.message.contains("NS_ERROR_ILLEGAL_VALUE"),
+    ok(e.message.includes("NS_ERROR_ILLEGAL_VALUE"),
        description + "keydown(KEY_DONT_DISPATCH_MODIFIER_KEY_EVENT) should cause NS_ERROR_ILLEGAL_VALUE if the .key value isn't a modifier key");
   }
   try {
     var keyEvent = new KeyboardEvent("", { key: "Enter", code: "ShiftLeft" });
     TIP.keyup(keyEvent, TIP.KEY_DONT_DISPATCH_MODIFIER_KEY_EVENT);
     ok(false,
        description + "keydown(KEY_DONT_DISPATCH_MODIFIER_KEY_EVENT) should fail if the .key value isn't a modifier key");
   } catch (e) {
-    ok(e.message.contains("NS_ERROR_ILLEGAL_VALUE"),
+    ok(e.message.includes("NS_ERROR_ILLEGAL_VALUE"),
        description + "keydown(KEY_DONT_DISPATCH_MODIFIER_KEY_EVENT) should cause NS_ERROR_ILLEGAL_VALUE if the .key value isn't a modifier key");
   }
 
   // The type of key events specified to composition methods should be "" or "keydown".
   var kKeyEventTypes = [
     { type: "keydown",   valid: true },
     { type: "keypress",  valid: false },
     { type: "keyup",     valid: false },
@@ -3609,64 +3609,64 @@ function runErrorTests()
     try {
       TIP.startComposition(keyEvent);
       ok(kKeyEventTypes[i].valid,
          testDescription + "TIP.startComposition(keyEvent) should not accept the event type");
       TIP.cancelComposition();
     } catch (e) {
       ok(!kKeyEventTypes[i].valid,
          testDescription + "TIP.startComposition(keyEvent) should not throw an exception for the event type");
-      ok(e.message.contains("NS_ERROR_ILLEGAL_VALUE"),
+      ok(e.message.includes("NS_ERROR_ILLEGAL_VALUE"),
          testDescription + "TIP.startComposition(keyEvent) should cause NS_ERROR_ILLEGAL_VALUE if the key event type isn't valid");
     }
     try {
       TIP.setPendingCompositionString("foo");
       TIP.appendClauseToPendingComposition(3, TIP.ATTR_RAW_CLAUSE);
       TIP.setCaretInPendingComposition(3);
       TIP.flushPendingComposition(keyEvent);
       ok(kKeyEventTypes[i].valid,
          testDescription + "TIP.flushPendingComposition(keyEvent) should not accept the event type");
       TIP.cancelComposition();
     } catch (e) {
       ok(!kKeyEventTypes[i].valid,
          testDescription + "TIP.flushPendingComposition(keyEvent) should not throw an exception for the event type");
-      ok(e.message.contains("NS_ERROR_ILLEGAL_VALUE"),
+      ok(e.message.includes("NS_ERROR_ILLEGAL_VALUE"),
          testDescription + "TIP.flushPendingComposition(keyEvent) should cause NS_ERROR_ILLEGAL_VALUE if the key event type isn't valid");
     }
     try {
       TIP.startComposition();
       TIP.commitComposition(keyEvent);
       ok(kKeyEventTypes[i].valid,
          testDescription + "TIP.commitComposition(keyEvent) should not accept the event type");
     } catch (e) {
       ok(!kKeyEventTypes[i].valid,
          testDescription + "TIP.commitComposition(keyEvent) should not throw an exception for the event type");
-      ok(e.message.contains("NS_ERROR_ILLEGAL_VALUE"),
+      ok(e.message.includes("NS_ERROR_ILLEGAL_VALUE"),
          testDescription + "TIP.commitComposition(keyEvent) should cause NS_ERROR_ILLEGAL_VALUE if the key event type isn't valid");
       TIP.cancelComposition();
     }
     try {
       TIP.commitCompositionWith("foo", keyEvent);
       ok(kKeyEventTypes[i].valid,
          testDescription + "TIP.commitCompositionWith(\"foo\", keyEvent) should not accept the event type");
     } catch (e) {
       ok(!kKeyEventTypes[i].valid,
          testDescription + "TIP.commitCompositionWith(\"foo\", keyEvent) should not throw an exception for the event type");
-      ok(e.message.contains("NS_ERROR_ILLEGAL_VALUE"),
+      ok(e.message.includes("NS_ERROR_ILLEGAL_VALUE"),
          testDescription + "TIP.commitCompositionWith(\"foo\", keyEvent) should cause NS_ERROR_ILLEGAL_VALUE if the key event type isn't valid");
     }
     try {
       TIP.startComposition();
       TIP.cancelComposition(keyEvent);
       ok(kKeyEventTypes[i].valid,
          testDescription + "TIP.cancelComposition(keyEvent) should not accept the event type");
     } catch (e) {
       ok(!kKeyEventTypes[i].valid,
          testDescription + "TIP.cancelComposition(keyEvent) should not throw an exception for the event type");
-      ok(e.message.contains("NS_ERROR_ILLEGAL_VALUE"),
+      ok(e.message.includes("NS_ERROR_ILLEGAL_VALUE"),
          testDescription + "TIP.cancelComposition(keyEvent) should cause NS_ERROR_ILLEGAL_VALUE if the key event type isn't valid");
       TIP.cancelComposition();
     }
     input.value = "";
   }
 }
 
 function runCommitCompositionTests()
--- a/dom/cache/test/mochitest/serviceworker_driver.js
+++ b/dom/cache/test/mochitest/serviceworker_driver.js
@@ -1,13 +1,13 @@
 // Any copyright is dedicated to the Public Domain.
 // http://creativecommons.org/publicdomain/zero/1.0/
 
 function serviceWorkerTestExec(testFile) {
-  var isB2G = !navigator.userAgent.contains("Android") &&
+  var isB2G = !navigator.userAgent.includes("Android") &&
               /Mobile|Tablet/.test(navigator.userAgent);
   if (isB2G) {
     // TODO B2G doesn't support running service workers for now due to bug 1137683.
     dump("Skipping running the test in SW until bug 1137683 gets fixed.\n");
     return Promise.resolve();
   }
   return new Promise(function(resolve, reject) {
     function setupSW(registration) {
--- a/dom/canvas/test/webgl-conformance/conformance/textures/texture-npot-video.html
+++ b/dom/canvas/test/webgl-conformance/conformance/textures/texture-npot-video.html
@@ -18,17 +18,17 @@ var successfullyParsed = false;
 if (window.initNonKhronosFramework) {
     window.initNonKhronosFramework(true);
 }
 
 function init()
 {
     description('Verify npot video');
 
-    if (navigator.userAgent.contains("Android")) {
+    if (navigator.userAgent.includes("Android")) {
         SimpleTest.expectAssertions(4); // bug 1143227
     }
 
     var canvas = document.getElementById("example");
     gl = wtu.create3DContext(canvas);
     var program = wtu.setupTexturedQuad(gl);
 
     gl.clearColor(0,0,0,1);
--- a/dom/html/test/forms/test_input_file_picker.html
+++ b/dom/html/test/forms/test_input_file_picker.html
@@ -211,20 +211,20 @@ function runTests() {
         if (mixRefExtensionList == undefined) {
           mixRefExtensionList = "";
         }
       } else {
         if (testName == "mix") {
           // Mixing mime type and file extension filters ("image/jpeg" and
           // ".jpg" here) shouldn't restrict the list but only extend it, if file
           // extension filter isn't a duplicate
-          ok(filters[0].contains(mixRefExtensionList),
+          ok(filters[0].includes(mixRefExtensionList),
              "Mixing mime types and file extension filters shouldn't restrict extension list: " +
              mixRefExtensionList + " | " + filters[0]);
-          ok(filters[0].contains("*.jpg"),
+          ok(filters[0].includes("*.jpg"),
              "Filter should contain '.jpg' extension", filters[0]);
         } else {
           is(filters[0], testData[currentTest][2],
              "Correct filters should have been added (" + testName + ")");
           is(filters.length, testData[currentTest][1],
              "appendFilters not called as often as expected (" + testName + ")");
         }
         is(filterIndex, testData[currentTest][3],
--- a/dom/workers/test/serviceworkers/fetch/context/index.html
+++ b/dom/workers/test/serviceworkers/fetch/context/index.html
@@ -1,11 +1,11 @@
 <!DOCTYPE html>
 <script>
-  var isAndroid = navigator.userAgent.contains("Android");
+  var isAndroid = navigator.userAgent.includes("Android");
   var isB2G = !isAndroid && /Mobile|Tablet/.test(navigator.userAgent);
 
   function ok(v, msg) {
     window.parent.postMessage({status: "ok", result: !!v, message: msg}, "*");
   }
 
   function is(a, b, msg) {
     ok(a === b, msg + ", expected '" + b + "', got '" + a + "'");
--- a/dom/workers/test/serviceworkers/fetch_event_worker.js
+++ b/dom/workers/test/serviceworkers/fetch_event_worker.js
@@ -1,170 +1,170 @@
 var seenIndex = false;
 
 onfetch = function(ev) {
-  if (ev.request.url.contains("synthesized.txt")) {
+  if (ev.request.url.includes("synthesized.txt")) {
     ev.respondWith(Promise.resolve(
       new Response("synthesized response body", {})
     ));
   }
 
-  else if (ev.request.url.contains("synthesized-404.txt")) {
+  else if (ev.request.url.includes("synthesized-404.txt")) {
     ev.respondWith(Promise.resolve(
       new Response("synthesized response body", { status: 404 })
     ));
   }
 
-  else if (ev.request.url.contains("synthesized-headers.txt")) {
+  else if (ev.request.url.includes("synthesized-headers.txt")) {
     ev.respondWith(Promise.resolve(
       new Response("synthesized response body", {
         headers: {
           "X-Custom-Greeting": "Hello"
         }
       })
     ));
   }
 
-  else if (ev.request.url.contains("test-respondwith-response.txt")) {
+  else if (ev.request.url.includes("test-respondwith-response.txt")) {
     ev.respondWith(new Response("test-respondwith-response response body", {}));
   }
 
-  else if (ev.request.url.contains("synthesized-redirect-real-file.txt")) {
+  else if (ev.request.url.includes("synthesized-redirect-real-file.txt")) {
     ev.respondWith(Promise.resolve(
       Response.redirect("fetch/real-file.txt")
     ));
   }
 
-  else if (ev.request.url.contains("synthesized-redirect-synthesized.txt")) {
+  else if (ev.request.url.includes("synthesized-redirect-synthesized.txt")) {
     ev.respondWith(Promise.resolve(
       Response.redirect("synthesized.txt")
     ));
   }
 
-  else if (ev.request.url.contains("ignored.txt")) {
+  else if (ev.request.url.includes("ignored.txt")) {
   }
 
-  else if (ev.request.url.contains("rejected.txt")) {
+  else if (ev.request.url.includes("rejected.txt")) {
     ev.respondWith(Promise.reject());
   }
 
-  else if (ev.request.url.contains("nonresponse.txt")) {
+  else if (ev.request.url.includes("nonresponse.txt")) {
     ev.respondWith(Promise.resolve(5));
   }
 
-  else if (ev.request.url.contains("nonresponse2.txt")) {
+  else if (ev.request.url.includes("nonresponse2.txt")) {
     ev.respondWith(Promise.resolve({}));
   }
 
-  else if (ev.request.url.contains("headers.txt")) {
+  else if (ev.request.url.includes("headers.txt")) {
     var ok = true;
     ok &= ev.request.headers.get("X-Test1") == "header1";
     ok &= ev.request.headers.get("X-Test2") == "header2";
     ev.respondWith(Promise.resolve(
       new Response(ok.toString(), {})
     ));
   }
 
-  else if (ev.request.url.contains("nonexistent_image.gif")) {
+  else if (ev.request.url.includes("nonexistent_image.gif")) {
     ev.respondWith(Promise.resolve(
       new Response(atob("R0lGODlhAQABAIAAAAUEBAAAACwAAAAAAQABAAACAkQBADs"), {
         headers: {
           "Content-Type": "image/gif"
         }
       })
     ));
   }
 
-  else if (ev.request.url.contains("nonexistent_script.js")) {
+  else if (ev.request.url.includes("nonexistent_script.js")) {
     ev.respondWith(Promise.resolve(
       new Response("check_intercepted_script();", {})
     ));
   }
 
-  else if (ev.request.url.contains("nonexistent_stylesheet.css")) {
+  else if (ev.request.url.includes("nonexistent_stylesheet.css")) {
     ev.respondWith(Promise.resolve(
       new Response("#style-test { background-color: black !important; }", {
         headers : {
           "Content-Type": "text/css"
         }
       })
     ));
   }
 
-  else if (ev.request.url.contains("nonexistent_page.html")) {
+  else if (ev.request.url.includes("nonexistent_page.html")) {
     ev.respondWith(Promise.resolve(
       new Response("<script>window.frameElement.test_result = true;</script>", {
         headers : {
           "Content-Type": "text/html"
         }
       })
     ));
   }
 
-  else if (ev.request.url.contains("nonexistent_worker_script.js")) {
+  else if (ev.request.url.includes("nonexistent_worker_script.js")) {
     ev.respondWith(Promise.resolve(
       new Response("postMessage('worker-intercept-success')", {})
     ));
   }
 
-  else if (ev.request.url.contains("nonexistent_imported_script.js")) {
+  else if (ev.request.url.includes("nonexistent_imported_script.js")) {
     ev.respondWith(Promise.resolve(
       new Response("check_intercepted_script();", {})
     ));
   }
 
-  else if (ev.request.url.contains("deliver-gzip")) {
+  else if (ev.request.url.includes("deliver-gzip")) {
     // Don't handle the request, this will make Necko perform a network request, at
     // which point SetApplyConversion must be re-enabled, otherwise the request
     // will fail.
     return;
   }
 
-  else if (ev.request.url.contains("hello.gz")) {
+  else if (ev.request.url.includes("hello.gz")) {
     ev.respondWith(fetch("fetch/deliver-gzip.sjs"));
   }
 
-  else if (ev.request.url.contains("hello-after-extracting.gz")) {
+  else if (ev.request.url.includes("hello-after-extracting.gz")) {
     ev.respondWith(fetch("fetch/deliver-gzip.sjs").then(function(res) {
       return res.text().then(function(body) {
         return new Response(body, { status: res.status, statusText: res.statusText, headers: res.headers });
       });
     }));
   }
 
-  else if (ev.request.url.contains('opaque-on-same-origin')) {
+  else if (ev.request.url.includes('opaque-on-same-origin')) {
     var url = 'http://example.com/tests/dom/base/test/file_CrossSiteXHR_server.sjs?status=200';
     ev.respondWith(fetch(url, { mode: 'no-cors' }));
   }
 
-  else if (ev.request.url.contains('opaque-no-cors')) {
+  else if (ev.request.url.includes('opaque-no-cors')) {
     if (ev.request.mode != "no-cors") {
       ev.respondWith(Promise.reject());
       return;
     }
 
     var url = 'http://example.com/tests/dom/base/test/file_CrossSiteXHR_server.sjs?status=200';
     ev.respondWith(fetch(url, { mode: ev.request.mode }));
   }
 
-  else if (ev.request.url.contains('cors-for-no-cors')) {
+  else if (ev.request.url.includes('cors-for-no-cors')) {
     if (ev.request.mode != "no-cors") {
       ev.respondWith(Promise.reject());
       return;
     }
 
     var url = 'http://example.com/tests/dom/base/test/file_CrossSiteXHR_server.sjs?status=200&allowOrigin=*';
     ev.respondWith(fetch(url));
   }
 
-  else if (ev.request.url.contains('example.com')) {
+  else if (ev.request.url.includes('example.com')) {
     ev.respondWith(fetch(ev.request));
   }
 
-  else if (ev.request.url.contains("index.html")) {
+  else if (ev.request.url.includes("index.html")) {
     if (seenIndex) {
         var body = "<script>" +
                      "opener.postMessage({status: 'ok', result: " + ev.isReload + "," +
                                          "message: 'reload status should be indicated'}, '*');" +
                      "opener.postMessage({status: 'done'}, '*');" +
                    "</script>";
         ev.respondWith(new Response(body, {headers: {'Content-Type': 'text/html'}}));
     } else {
--- a/dom/workers/test/serviceworkers/test_serviceworker_interfaces.js
+++ b/dom/workers/test/serviceworkers/test_serviceworker_interfaces.js
@@ -185,19 +185,19 @@ var interfaceNamesInGlobalScope =
 // IMPORTANT: Do not change this list without review from a DOM peer!
     "WorkerNavigator",
 // IMPORTANT: Do not change this list without review from a DOM peer!
   ];
 // IMPORTANT: Do not change the list above without review from a DOM peer!
 
 function createInterfaceMap(prefMap, permissionMap, version, userAgent, isB2G) {
   var isNightly = version.endsWith("a1");
-  var isRelease = !version.contains("a");
+  var isRelease = !version.includes("a");
   var isDesktop = !/Mobile|Tablet/.test(userAgent);
-  var isAndroid = !!navigator.userAgent.contains("Android");
+  var isAndroid = !!navigator.userAgent.includes("Android");
 
   var interfaceMap = {};
 
   function addInterfaces(interfaces)
   {
     for (var entry of interfaces) {
       if (typeof(entry) === "string") {
         interfaceMap[entry] = true;
--- a/toolkit/devtools/server/actors/animation.js
+++ b/toolkit/devtools/server/actors/animation.js
@@ -102,17 +102,17 @@ let AnimationPlayerActor = ActorClass({
     // Note that this may be incorrect if by the time the AnimationPlayerActor
     // is initialized, one of the transitions has ended, but it's the best we
     // can do for now.
     if (!names) {
       return this.playerIndex;
     }
 
     // If there's only one name.
-    if (names.contains(",") === -1) {
+    if (names.includes(",") === -1) {
       return 0;
     }
 
     // If there are several names, retrieve the index of the animation name in
     // the list.
     names = names.split(",").map(n => n.trim());
     for (let i = 0; i < names.length; i ++) {
       if (names[i] === this.player.effect.name) {
--- a/toolkit/devtools/webconsole/test/test_page_errors.html
+++ b/toolkit/devtools/webconsole/test/test_page_errors.html
@@ -67,17 +67,17 @@ function onAttach(aState, aResponse)
   aState.dbgClient.addListener("pageError", onPageError);
   doPageErrors();
 }
 
 let pageErrors = [];
 
 function onPageError(aState, aType, aPacket)
 {
-  if (!aPacket.pageError.sourceName.contains("test_page_errors")) {
+  if (!aPacket.pageError.sourceName.includes("test_page_errors")) {
     info("Ignoring error from unknown source: " + aPacket.pageError.sourceName);
     return;
   }
 
   is(aPacket.from, aState.actor, "page error actor");
 
   pageErrors.push(aPacket.pageError);
   if (pageErrors.length != expectedPageErrors.length) {