Backed out changeset 9dbda637a860 (bug 1316515) for failing test_findbar.xul (+ assertion on debug) and browser_bug537013.js. r=backout a=backout
authorSebastian Hengst <archaeopteryx@coole-files.de>
Sun, 20 Nov 2016 21:48:07 +0100
changeset 352511 a99c9599b45835479e6e18da0614b0652d42435a
parent 352510 e6cdaa21d3df0e9a0009c52f9cf31c2a6f767603
child 352512 b278545f77a0eac6e7b2e6c508df2d9a44c727df
push id6795
push userjlund@mozilla.com
push dateMon, 23 Jan 2017 14:19:46 +0000
treeherdermozilla-esr52@76101b503191 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbackout, backout
bugs1316515, 537013
milestone52.0a2
backs out9dbda637a860cdc3f9809209f50e47f110977ecf
Backed out changeset 9dbda637a860 (bug 1316515) for failing test_findbar.xul (+ assertion on debug) and browser_bug537013.js. r=backout a=backout
toolkit/content/tests/chrome/findbar_window.xul
toolkit/modules/FinderHighlighter.jsm
--- a/toolkit/content/tests/chrome/findbar_window.xul
+++ b/toolkit/content/tests/chrome/findbar_window.xul
@@ -260,28 +260,16 @@
           }
         };
         gFindBar.browser.finder.addResultListener(listener);
         // Make sure we resolve _at least_ after five times the find iterator timeout.
         setTimeout(resolve, (ITERATOR_TIMEOUT * 5) + 20);
       });
     }
 
-    function promiseHighlightFinished() {
-      return new Promise(resolve => {
-        let listener = {
-          onHighlightFinished() {
-            gFindBar.browser.finder.removeResultListener(listener);
-            resolve();
-          }
-        };
-        gFindBar.browser.finder.addResultListener(listener);
-      });
-    }
-
     var enterStringIntoFindField = Task.async(function* (str, waitForResult = true) {
       for (let promise, i = 0; i < str.length; i++) {
         if (waitForResult) {
           promise = promiseFindResult();
         }
         let event = document.createEvent("KeyboardEvent");
         event.initKeyEvent("keypress", true, true, null, false, false,
                            false, false, 0, str.charCodeAt(i));
@@ -443,16 +431,17 @@
         Assert.equal(content.getSelection().toString(), args.searchStr,
           "testQuickFindLink: failed to find sample link");
       });
       testClipboardSearchString(searchStr);
     }
 
     // See bug 963925 for more details on this test.
     function* testFindWithHighlight() {
+      //yield clearFocus();
       gFindBar._findField.value = "";
 
       // For this test, we want to closely control the selection. The easiest
       // way to do so is to replace the implementation of
       // Finder.getInitialSelection with a no-op and call the findbar's callback
       // (onCurrentSelection(..., true)) ourselves with our hand-picked
       // selection.
       let oldGetInitialSelection = gFindBar.browser.finder.getInitialSelection;
@@ -496,53 +485,16 @@
       gFindBar.onFindAgainCommand();
       a = gFindBar._findField.value;
       b = gFindBar._browser.finder._fastFind.searchString;
       c = gFindBar._browser.finder.searchString;
       ok(a == b && b == c, "testFindWithHighlight 5: " + a + ", " + b + ", " + c + ".");
 
       highlightButton.click();
       ok(!highlightButton.checked, "testFindWithHighlight: Highlight All should be unchecked.");
-
-      // Regression test for bug 1316515.
-      searchStr = "e";
-      gFindBar.clear();
-      yield enterStringIntoFindField(searchStr);
-
-      yield ContentTask.spawn(gBrowser, {}, function* () {
-        let controller = docShell.QueryInterface(Ci.nsIInterfaceRequestor)
-                                 .getInterface(Ci.nsISelectionDisplay)
-                                 .QueryInterface(Ci.nsISelectionController);
-        let sel = controller.getSelection(Ci.nsISelectionController.SELECTION_FIND);
-        Assert.equal(sel.rangeCount, 0, "testFindWithHighlight - 1316515: no highlights, please [1]");
-      });
-
-      highlightButton.click();
-      ok(highlightButton.checked, "testFindWithHighlight: Highlight All should be checked.");
-
-      yield promiseHighlightFinished();
-
-      yield ContentTask.spawn(gBrowser, {}, function* () {
-        let controller = docShell.QueryInterface(Ci.nsIInterfaceRequestor)
-                                 .getInterface(Ci.nsISelectionDisplay)
-                                 .QueryInterface(Ci.nsISelectionController);
-        let sel = controller.getSelection(Ci.nsISelectionController.SELECTION_FIND);
-        // The other 4 ranges are in a different controller.
-        Assert.equal(sel.rangeCount, 3, "testFindWithHighlight - 1316515: more highlights, please");
-      });
-
-      synthesizeKey("VK_BACK_SPACE", {});
-
-      yield ContentTask.spawn(gBrowser, null, function* () {
-        let controller = docShell.QueryInterface(Ci.nsIInterfaceRequestor)
-                                 .getInterface(Ci.nsISelectionDisplay)
-                                 .QueryInterface(Ci.nsISelectionController);
-        let sel = controller.getSelection(Ci.nsISelectionController.SELECTION_FIND);
-        Assert.equal(sel.rangeCount, 0, "testFindWithHighlight - 1316515: no highlights, please [2]");
-      });
     }
 
     function* testQuickFindText() {
       yield clearFocus();
 
       yield ContentTask.spawn(gBrowser, null, function* () {
         let document = content.document;
         let event = document.createEvent("KeyboardEvent");
--- a/toolkit/modules/FinderHighlighter.jsm
+++ b/toolkit/modules/FinderHighlighter.jsm
@@ -406,34 +406,33 @@ FinderHighlighter.prototype = {
    *   {String}  searchString  The string the search was performed with.
    *   {Boolean} storeResult   Indicator if the search string should be stored
    *                           by the consumer of the Finder.
    */
   update(data) {
     let window = this.finder._getWindow();
     let dict = this.getForWindow(window);
     let foundRange = this.finder._fastFind.getFoundRange();
-
-    if (data.result == Ci.nsITypeAheadFind.FIND_NOTFOUND || !data.searchString || !foundRange) {
-      this.hide();
-      return;
-    }
-
     if (!this._modal) {
       if (this._highlightAll) {
         dict.currentFoundRange = foundRange;
         let params = this.iterator.params;
         if (this.iterator._areParamsEqual(params, dict.lastIteratorParams))
           return;
         if (params)
           this.highlight(true, params.word, params.linksOnly);
       }
       return;
     }
 
+    if (data.result == Ci.nsITypeAheadFind.FIND_NOTFOUND || !data.searchString || !foundRange) {
+      this.hide();
+      return;
+    }
+
     if (foundRange !== dict.currentFoundRange || data.findAgain) {
       dict.currentFoundRange = foundRange;
 
       let textContent = this._getRangeContentArray(foundRange);
       if (!textContent.length) {
         this.hide(window);
         return;
       }