Backed out changeset 4035fee4dd33 (bug 1538042) for Mochitest failures in toolkit/components/windowcreator/test/test_nsFind.html
authorDorel Luca <dluca@mozilla.com>
Thu, 05 Sep 2019 12:21:18 +0300
changeset 491832 6c74ea8db80ca56f0553730043c6e07df3eb0415
parent 491831 9cd3d111277fbaf8bffb41b00b5d9203c5d307d8
child 491833 3a06725cd4a2446b0df12dd2fb66635d38e3879a
push id94536
push userdluca@mozilla.com
push dateThu, 05 Sep 2019 09:22:02 +0000
treeherderautoland@6c74ea8db80c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1538042
milestone71.0a1
backs out4035fee4dd33e16b02bee9bf7b5b14088fe80104
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
Backed out changeset 4035fee4dd33 (bug 1538042) for Mochitest failures in toolkit/components/windowcreator/test/test_nsFind.html
dom/base/test/test_find.html
toolkit/components/windowcreator/test/test_nsFind.html
--- a/dom/base/test/test_find.html
+++ b/dom/base/test/test_find.html
@@ -117,24 +117,16 @@ let runTests = t.step_func_done(function
   // such.
   //
   // See bug 1442466 / bug 1510485 / bug 1505887.
   testFindable(false, "foo", function(document) {
     let input = document.createElement("input");
     input.value = "foo";
     document.documentElement.appendChild(input);
   }, "Native anonymous content isn't exposed in window.find");
-
-  testFindable(false, "\0", `
-    &#0;
-  `);
-
-  testFindable(true, "\0", function(document) {
-    document.documentElement.appendChild(document.createTextNode("\0"));
-  }, "Inserted null characters are findable");
 });
 
 window.onload = function() {
   let iframe = document.createElement("iframe");
   iframe.onload = runTests;
   iframe.srcdoc = "<!doctype html><html></html>";
   document.body.appendChild(iframe);
 };
--- a/toolkit/components/windowcreator/test/test_nsFind.html
+++ b/toolkit/components/windowcreator/test/test_nsFind.html
@@ -3,43 +3,83 @@
 <!--
 https://bugzilla.mozilla.org/show_bug.cgi?id=450048
 -->
 <head>
   <meta charset="UTF-8">
   <title>Test for nsFind::Find()</title>
   <script src="/tests/SimpleTest/SimpleTest.js"></script>
   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=450048">Mozilla Bug 450048</a>
+<p id="display">This is the text to search i<b>n&shy;t</b>o</p>
+<p id="quotes">"straight" and &ldquo;curly&rdquo; and &lsquo;didn't&rsquo; and 'doesn&rsquo;t'</p>
+<div id="content" style="display: none">
 
+</div>
+<pre id="test">
 <script type="application/javascript">
 
 /** Test for Bug 450048 **/
-SimpleTest.waitForExplicitFinish();
 
-async function runTests() {
   // Check nsFind class and its nsIFind interface.
 
-  // Inject some text that we'll search for later.
-  const INJECTED_NULL_TEXT = "injected null\0";
-  const nullcharsinjected = document.getElementById("nullcharsinjected");
-  const nulltextnode = document.createTextNode(INJECTED_NULL_TEXT);
-  nullcharsinjected.appendChild(nulltextnode);
-
-  await new Promise(resolve => window.requestAnimationFrame(resolve));
-
   var rf = SpecialPowers.Cc["@mozilla.org/embedcomp/rangefind;1"]
                         .getService(SpecialPowers.Ci.nsIFind);
 
   var display = window.document.getElementById("display");
   var searchRange = window.document.createRange();
   searchRange.setStart(display, 0);
   searchRange.setEnd(display, display.childNodes.length);
   var startPt = searchRange;
   var endPt = searchRange;
 
+  // Check |null| detection on |aSearchRange| parameter.
+  try {
+    rf.Find("", null, startPt, endPt);
+
+    ok(false, "Missing NS_ERROR_ILLEGAL_VALUE exception");
+  } catch (e) {
+    let wrappedError = SpecialPowers.wrap(e);
+    if (wrappedError.result == SpecialPowers.Cr.NS_ERROR_ILLEGAL_VALUE) {
+      ok(true, null);
+    } else {
+      throw wrappedError;
+    }
+  }
+
+  // Check |null| detection on |aStartPoint| parameter.
+  try {
+    rf.Find("", searchRange, null, endPt);
+
+    ok(false, "Missing NS_ERROR_ILLEGAL_VALUE exception");
+  } catch (e) {
+    let wrappedError = SpecialPowers.wrap(e);
+    if (wrappedError.result == SpecialPowers.Cr.NS_ERROR_ILLEGAL_VALUE) {
+      ok(true, null);
+    } else {
+      throw wrappedError;
+    }
+  }
+
+  // Check |null| detection on |aEndPoint| parameter.
+  try {
+    rf.Find("", searchRange, startPt, null);
+
+    ok(false, "Missing NS_ERROR_ILLEGAL_VALUE exception");
+  } catch (e) {
+    let wrappedError = SpecialPowers.wrap(e);
+    if (wrappedError.result == SpecialPowers.Cr.NS_ERROR_ILLEGAL_VALUE) {
+      ok(true, null);
+    } else {
+      throw wrappedError;
+    }
+  }
+
   var searchValue, retRange;
 
   rf.findBackwards = false;
 
   rf.caseSensitive = false;
 
   searchValue = "TexT";
   retRange = rf.Find(searchValue, searchRange, startPt, endPt);
@@ -79,34 +119,35 @@ async function runTests() {
   ok(!retRange, "\"" + searchValue + "\" found (forward)");
 
   rf.findBackwards = true;
 
   // searchValue = "the";
   retRange = rf.Find(searchValue, searchRange, startPt, endPt);
   ok(retRange, "\"" + searchValue + "\" not found (backward)");
 
+
   // Curly quotes and straight quotes should match.
 
   rf.caseSensitive = false;
   rf.findBackwards = false;
 
   function find(node, value) {
     var range = document.createRange();
     range.setStart(node, 0);
     range.setEnd(node, node.childNodes.length);
     return rf.Find(value, range, range, range);
   }
 
   function assertFound(node, value) {
-    ok(find(node, value), "\"" + value + "\" should be found");
+    ok(find(node, value), "\"" + value + "\" not found");
   }
 
   function assertNotFound(node, value) {
-    ok(!find(node, value), "\"" + value + "\" should not be found");
+    ok(!find(node, value), "\"" + value + "\" found");
   }
 
   var quotes = document.getElementById("quotes");
 
   assertFound(quotes, "\"straight\"");
   assertFound(quotes, "\u201Cstraight\u201D");
 
   assertNotFound(quotes, "'straight'");
@@ -175,81 +216,12 @@ async function runTests() {
   assertFound(quotes, "\u201Ccurly\u201D");
 
   assertFound(quotes, "\u2018didn't\u2019");
   assertNotFound(quotes, "'didn't'");
 
   assertFound(quotes, "'doesn\u2019t'");
   assertNotFound(quotes, "'doesn\u2018t'");
   assertNotFound(quotes, "'doesn't'");
-
-  // Embedded strings containing null characters can't be found, because
-  // the HTML parser converts them to \ufffd, which is the replacement
-  // character.
-  const nullcharsnative = document.getElementById("nullcharsnative");
-  assertFound(nullcharsnative, "native null\ufffd");
-
-  // Injected strings containing null characters can be found.
-  assertFound(nullcharsinjected, INJECTED_NULL_TEXT);
-
-  // Do these test at the end since they trigger failure screenshots in
-  // the test harness, and we want as much information as possible about
-  // any OTHER tests that may have already failed.
-
-  // Check |null| detection on |aSearchRange| parameter.
-  try {
-    rf.Find("", null, startPt, endPt);
-
-    ok(false, "Missing NS_ERROR_ILLEGAL_VALUE exception");
-  } catch (e) {
-    let wrappedError = SpecialPowers.wrap(e);
-    if (wrappedError.result == SpecialPowers.Cr.NS_ERROR_ILLEGAL_VALUE) {
-      ok(true, null);
-    } else {
-      throw wrappedError;
-    }
-  }
-
-  // Check |null| detection on |aStartPoint| parameter.
-  try {
-    rf.Find("", searchRange, null, endPt);
-
-    ok(false, "Missing NS_ERROR_ILLEGAL_VALUE exception");
-  } catch (e) {
-    let wrappedError = SpecialPowers.wrap(e);
-    if (wrappedError.result == SpecialPowers.Cr.NS_ERROR_ILLEGAL_VALUE) {
-      ok(true, null);
-    } else {
-      throw wrappedError;
-    }
-  }
-
-  // Check |null| detection on |aEndPoint| parameter.
-  try {
-    rf.Find("", searchRange, startPt, null);
-
-    ok(false, "Missing NS_ERROR_ILLEGAL_VALUE exception");
-  } catch (e) {
-    let wrappedError = SpecialPowers.wrap(e);
-    if (wrappedError.result == SpecialPowers.Cr.NS_ERROR_ILLEGAL_VALUE) {
-      ok(true, null);
-    } else {
-      throw wrappedError;
-    }
-  }
-
-  SimpleTest.finish();
-}
 </script>
-</head>
-<body onload="runTests()">
-<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=450048">Mozilla Bug 450048</a>
-<p id="display">This is the text to search i<b>n&shy;t</b>o</p>
-<p id="quotes">"straight" and &ldquo;curly&rdquo; and &lsquo;didn't&rsquo; and 'doesn&rsquo;t'</p>
-<p id="nullcharsnative">native null&#0;</p>
-<p id="nullcharsinjected"></p>
-<div id="content" style="display: none">
-
-</div>
-<pre id="test">
 </pre>
 </body>
 </html>