Bug 1327212 - undo a line removal done in bug 935521 that causes regressions. r=Gijs
authorMike de Boer <mdeboer@mozilla.com>
Sat, 07 Jan 2017 01:05:33 +0100
changeset 328352 3644b91c1e1c491e25605d5475e501cdbe360d48
parent 328351 f1b501863c275a094197347fc2b878db56e19fe4
child 328353 1d126c201b0f8acfc55a2fc965cc87e786740cf8
push id31168
push userryanvm@gmail.com
push dateSat, 07 Jan 2017 16:20:16 +0000
treeherdermozilla-central@2d62b03b833b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersGijs
bugs1327212, 935521
milestone53.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 1327212 - undo a line removal done in bug 935521 that causes regressions. r=Gijs MozReview-Commit-ID: HaUEOSpEsXs
browser/base/content/test/general/browser_bug537013.js
toolkit/content/tests/chrome/findbar_window.xul
toolkit/content/widgets/findbar.xml
--- a/browser/base/content/test/general/browser_bug537013.js
+++ b/browser/base/content/test/general/browser_bug537013.js
@@ -122,14 +122,14 @@ function continueTests3() {
 
 // Test that findbar gets restored when a tab is moved to a new window.
 function checkNewWindow() {
   ok(!newWindow.gFindBar.hidden, "New window shows find bar!");
   // Disabled the following assertion due to intermittent failure on OSX 10.6 Debug.
   if (!HasFindClipboard) {
     is(newWindow.gFindBar._findField.value, texts[1],
        "New window find bar has correct find value!");
+    ok(!newWindow.gFindBar.getElement("find-next").disabled,
+       "New window findbar has disabled buttons!");
   }
-  ok(newWindow.gFindBar.getElement("find-next").disabled,
-     "New window findbar has disabled buttons!");
   newWindow.close();
   finish();
 }
--- a/toolkit/content/tests/chrome/findbar_window.xul
+++ b/toolkit/content/tests/chrome/findbar_window.xul
@@ -150,17 +150,21 @@
       yield testQuickFindClose();
       // TODO: This doesn't seem to work when the findbar is connected to a
       //       remote browser element.
       if (!gBrowser.hasAttribute("remote"))
         yield testFindAgainNotFound();
       yield testToggleEntireWord();
     }
 
-    function testFindButtonsState(enabled = true) {
+    function testFindButtonsState(enabled = null) {
+      // If `enabled` is not explicitly passed in, we set it to its most logical
+      // value.
+      if (enabled === null)
+        enabled = !!gFindBar._findField.value;
       is(gFindBar.getElement("find-next").disabled, !enabled,
         `Expected the 'next' button to be ${enabled ? 'enabled' : 'disabled'}`);
       is(gFindBar.getElement("find-previous").disabled, !enabled,
         `Expected the 'previous' button to be ${enabled ? 'enabled' : 'disabled'}`);
     }
 
     function* testFindbarSelection() {
       function checkFindbarState(aTestName, aExpSelection) {
--- a/toolkit/content/widgets/findbar.xml
+++ b/toolkit/content/widgets/findbar.xml
@@ -1080,17 +1080,18 @@
         ]]></body>
       </method>
 
       <method name="updateControlState">
         <parameter name="aResult"/>
         <parameter name="aFindPrevious"/>
         <body><![CDATA[
           this._updateStatusUI(aResult, aFindPrevious);
-          this._enableFindButtons(aResult !== this.nsITypeAheadFind.FIND_NOTFOUND);
+          this._enableFindButtons(aResult !== this.nsITypeAheadFind.FIND_NOTFOUND &&
+            !!this._findField.value);
         ]]></body>
       </method>
 
       <method name="_dispatchFindEvent">
         <parameter name="aType"/>
         <parameter name="aFindPrevious"/>
         <body><![CDATA[
           let event = document.createEvent("CustomEvent");
@@ -1329,16 +1330,17 @@
             if (clipboardSearchString)
               aSelectionString = clipboardSearchString;
           }
 
           if (aSelectionString)
             this._findField.value = aSelectionString;
 
           if (aIsInitialSelection) {
+            this._enableFindButtons(!!this._findField.value);
             this._findField.select();
             this._findField.focus();
 
             this._startFindDeferred.resolve();
             this._startFindDeferred = null;
           }
         ]]></body>
       </method>