Backed out changeset f6c028e4f604 (bug 1253233) for test failures in test_bug263683.xul
authorCarsten "Tomcat" Book <cbook@mozilla.com>
Wed, 23 Mar 2016 09:09:40 +0100
changeset 289879 efe7d026ac641759838dd3897c37892e37e5b244
parent 289878 e044d0a616db6b86c1e5b04f1ef592349f145082
child 290021 6202ade0e6d688ffb67932398e56cfc6fa04ceb3
child 290022 767606cd6c63ee7fd056ca45ce00a65e3bb4ddca
push id30111
push usercbook@mozilla.com
push dateWed, 23 Mar 2016 09:49:28 +0000
treeherdermozilla-central@efe7d026ac64 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1253233, 263683
milestone48.0a1
backs outf6c028e4f604b518e0cb0c8b7400a57b25300fe5
first release with
nightly linux32
efe7d026ac64 / 48.0a1 / 20160323030400 / files
nightly linux64
efe7d026ac64 / 48.0a1 / 20160323030400 / files
nightly mac
efe7d026ac64 / 48.0a1 / 20160323030400 / files
nightly win32
efe7d026ac64 / 48.0a1 / 20160323030400 / files
nightly win64
efe7d026ac64 / 48.0a1 / 20160323030400 / files
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Backed out changeset f6c028e4f604 (bug 1253233) for test failures in test_bug263683.xul
toolkit/content/tests/chrome/bug263683_window.xul
toolkit/modules/RemoteFinder.jsm
--- a/toolkit/content/tests/chrome/bug263683_window.xul
+++ b/toolkit/content/tests/chrome/bug263683_window.xul
@@ -1,141 +1,83 @@
 <?xml version="1.0"?>
 
 <!-- This Source Code Form is subject to the terms of the Mozilla Public
    - License, v. 2.0. If a copy of the MPL was not distributed with this
    - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
 
 <?xml-stylesheet href="chrome://global/skin" type="text/css"?>
-<?xml-stylesheet
-  href="chrome://mochikit/content/tests/SimpleTest/test.css"
-  type="text/css"?>
 
 <window id="263683test"
         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
         width="600"
         height="600"
         onload="SimpleTest.executeSoon(startTest);"
         title="263683 test">
 
   <script type="application/javascript"><![CDATA[
-    const {interfaces: Ci, classes: Cc, results: Cr, utils: Cu} = Components;
-    Cu.import("resource://gre/modules/Task.jsm");
-    Cu.import("resource://testing-common/ContentTask.jsm");
-    ContentTask.setTestScope(window.opener.wrappedJSObject);
+    const Ci = Components.interfaces;
+    const Cc = Components.classes;
+    const Cr = Components.results;
 
     var gFindBar = null;
     var gBrowser;
 
-    var imports = ["SimpleTest", "ok", "info"];
+    var imports = ["SimpleTest", "ok"];
     for (var name of imports) {
       window[name] = window.opener.wrappedJSObject[name];
     }
 
-    function startTest() {
-      Task.spawn(function* () {
-        gFindBar = document.getElementById("FindToolbar");
-        for (let browserId of ["content", "content-remote"]) {
-          yield startTestWithBrowser(browserId);
-        }
-      }).then(() => {
-        window.close();
-        SimpleTest.finish();
-      });
+    function finish() {
+      window.close();
+      SimpleTest.finish();
     }
 
-    function* startTestWithBrowser(browserId) {
-      info("Starting test with browser '" + browserId + "'");
-      gBrowser = document.getElementById(browserId);
-      gFindBar.browser = gBrowser;
-      let promise = ContentTask.spawn(gBrowser, null, function* () {
-        return new Promise(resolve => {
-          addEventListener("DOMContentLoaded", function listener() {
-            removeEventListener("DOMContentLoaded", listener);
-            resolve();
-          });
-        });
-      });
+    function startTest() {
+      gFindBar = document.getElementById("FindToolbar");
+      gBrowser = document.getElementById("content");
+      gBrowser.addEventListener("pageshow", onPageShow, false);
       gBrowser.loadURI('data:text/html,<h2>Text mozilla</h2><input id="inp" type="text" />');
-      yield promise;
-      yield onDocumentLoaded();
     }
 
-    function toggleHighlightAndWait(highlight) {
-      return new Promise(resolve => {
-        let listener = {
-          onHighlightFinished: function() {
-            dump("HIGHLIGHT FINISHED!\n");
-            gFindBar.browser.finder.removeResultListener(listener);
-            resolve();
-          }
-        };
-        gFindBar.browser.finder.addResultListener(listener);
-        gFindBar.toggleHighlight(highlight);
-      });
-    }
-
-    function* onDocumentLoaded() {
+    function onPageShow() {
       gFindBar.open();
       var search = "mozilla";
       gFindBar._findField.value = search;
       var matchCase = gFindBar.getElement("find-case-sensitive");
       if (matchCase.checked)
         matchCase.doCommand();
 
       gFindBar._find();
-      yield toggleHighlightAndWait(true);
-
-      yield ContentTask.spawn(gBrowser, { search }, function* (args) {
-        let controller = docShell.QueryInterface(Ci.nsIInterfaceRequestor)
-                                 .getInterface(Ci.nsISelectionDisplay)
-                                 .QueryInterface(Ci.nsISelectionController);
-        Assert.ok("SELECTION_FIND" in controller, "Correctly detects new selection type");
-        let selection = controller.getSelection(controller.SELECTION_FIND);
-        
-        Assert.equal(selection.rangeCount, 1,
-          "Correctly added a match to the selection type");
-        Assert.equal(selection.getRangeAt(0).toString().toLowerCase(),
-          args.search, "Added the correct match");
-      });
-
-      yield toggleHighlightAndWait(false);
-
-      yield ContentTask.spawn(gBrowser, { search }, function* (args) {
-        let controller = docShell.QueryInterface(Ci.nsIInterfaceRequestor)
-                                 .getInterface(Ci.nsISelectionDisplay)
-                                 .QueryInterface(Ci.nsISelectionController);
-        let selection = controller.getSelection(controller.SELECTION_FIND);
-        Assert.equal(selection.rangeCount, 0, "Correctly removed the range");
+      var highlightButton = gFindBar.getElement("highlight");
+      if (!highlightButton.checked)
+        highlightButton.click();
 
-        let input = content.document.getElementById("inp");
-        input.value = args.search;
-      });
- 
-      yield toggleHighlightAndWait(true);
-
-      yield ContentTask.spawn(gBrowser, { search }, function* (args) {
-        let input = content.document.getElementById("inp");
-        let inputController = input.editor.selectionController;
-        let inputSelection = inputController.getSelection(inputController.SELECTION_FIND);
+      var controller = gFindBar.browser.docShell.QueryInterface(Ci.nsIInterfaceRequestor)
+                                       .getInterface(Ci.nsISelectionDisplay)
+                                       .QueryInterface(Ci.nsISelectionController);
+      ok('SELECTION_FIND' in controller, "Correctly detects new selection type");
+      var selection = controller.getSelection(controller.SELECTION_FIND);
+      
+      ok(selection.rangeCount == 1, "Correctly added a match to the selection type");
+      ok(selection.getRangeAt(0).toString().toLowerCase() == search, "Added the correct match");
+      highlightButton.click();
+      ok(selection.rangeCount == 0, "Correctly removed the range");
 
-        Assert.equal(inputSelection.rangeCount, 1,
-          "Correctly added a match from input to the selection type");
-        Assert.equal(inputSelection.getRangeAt(0).toString().toLowerCase(),
-          args.search, "Added the correct match");
-      });
-
-      yield toggleHighlightAndWait(false);
+      var input = gBrowser.contentDocument.getElementById("inp");
+      input.value = search;
+ 
+      highlightButton.click();
 
-      yield ContentTask.spawn(gBrowser, null, function* () {
-        let input = content.document.getElementById("inp");
-        let inputController = input.editor.selectionController;
-        let inputSelection = inputController.getSelection(inputController.SELECTION_FIND);
+      var inputController = input.editor.selectionController;
+      var inputSelection = inputController.getSelection(inputController.SELECTION_FIND);
 
-        Assert.equal(inputSelection.rangeCount, 0, "Correctly removed the range");
-      });
+      ok(inputSelection.rangeCount == 1, "Correctly added a match from input to the selection type");
+      ok(inputSelection.getRangeAt(0).toString().toLowerCase() == search, "Added the correct match");
+      highlightButton.click();
+      ok(inputSelection.rangeCount == 0, "Correctly removed the range");
+      finish();
     }
   ]]></script>
 
   <browser type="content-primary" flex="1" id="content" src="about:blank"/>
-  <browser type="content-primary" flex="1" id="content-remote" remote="true" src="about:blank"/>
   <findbar id="FindToolbar" browserid="content"/>
 </window>
--- a/toolkit/modules/RemoteFinder.jsm
+++ b/toolkit/modules/RemoteFinder.jsm
@@ -24,28 +24,26 @@ function RemoteFinder(browser) {
 }
 
 RemoteFinder.prototype = {
   swapBrowser: function(aBrowser) {
     if (this._messageManager) {
       this._messageManager.removeMessageListener("Finder:Result", this);
       this._messageManager.removeMessageListener("Finder:MatchesResult", this);
       this._messageManager.removeMessageListener("Finder:CurrentSelectionResult",this);
-      this._messageManager.removeMessageListener("Finder:HighlightFinished",this);
     }
     else {
       aBrowser.messageManager.sendAsyncMessage("Finder:Initialize");
     }
 
     this._browser = aBrowser;
     this._messageManager = this._browser.messageManager;
     this._messageManager.addMessageListener("Finder:Result", this);
     this._messageManager.addMessageListener("Finder:MatchesResult", this);
     this._messageManager.addMessageListener("Finder:CurrentSelectionResult", this);
-    this._messageManager.addMessageListener("Finder:HighlightFinished", this);
 
     // Ideally listeners would have removed themselves but that doesn't happen
     // right now
     this._listeners.clear();
   },
 
   addResultListener: function (aListener) {
     this._listeners.add(aListener);
@@ -68,20 +66,16 @@ RemoteFinder.prototype = {
       case "Finder:MatchesResult":
         callback = "onMatchesCountResult";
         params = [ aMessage.data ];
         break;
       case "Finder:CurrentSelectionResult":
         callback = "onCurrentSelection";
         params = [ aMessage.data.selection, aMessage.data.initial ];
         break;
-      case "Finder:HighlightFinished":
-        callback = "onHighlightFinished";
-        params = [ aMessage.data ];
-        break;
     }
 
     for (let l of this._listeners) {
       // Don't let one callback throwing stop us calling the rest
       try {
         l[callback].apply(l, params);
       }
       catch (e) {
@@ -203,20 +197,16 @@ RemoteFinderListener.prototype = {
   },
 
   // When the child receives messages with results of requestMatchesCount,
   // it passes them forward to the parent.
   onMatchesCountResult: function (aData) {
     this._global.sendAsyncMessage("Finder:MatchesResult", aData);
   },
 
-  onHighlightFinished: function(aData) {
-    this._global.sendAsyncMessage("Finder:HighlightFinished", aData);
-  },
-
   receiveMessage: function (aMessage) {
     let data = aMessage.data;
 
     switch (aMessage.name) {
       case "Finder:CaseSensitive":
         this._finder.caseSensitive = data.caseSensitive;
         break;