Bug 891638 - "Highlight All" button does not persist when switching tabs. r=dao
authorAdam Dane [:hobophobe] <unusualtears@gmail.com>
Wed, 10 Jul 2013 16:53:34 -0500
changeset 138132 4c2d85b34ff82254da2e078db9e9b7a98718f5dc
parent 138131 e2ed327feb316b1ac1f939d9247974aa433dc778
child 138133 aeab42c594231c6aab336a74f33a336041a9a2f6
push id24945
push userryanvm@gmail.com
push dateFri, 12 Jul 2013 01:55:19 +0000
treeherdermozilla-central@9db9da2ecca0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdao
bugs891638
milestone25.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 891638 - "Highlight All" button does not persist when switching tabs. r=dao
browser/base/content/browser.js
browser/base/content/tabbrowser.xml
browser/base/content/test/browser_bug537013.js
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -3968,26 +3968,16 @@ var XULBrowserWindow = {
           if (content.document.readyState == "interactive" || content.document.readyState == "complete")
             disableFindCommands(shouldDisableFind(content.document));
           else {
             content.document.addEventListener("readystatechange", onContentRSChange);
           }
         }
       } else
         disableFindCommands(false);
-
-      if (gFindBarInitialized) {
-        if (gFindBar.findMode != gFindBar.FIND_NORMAL) {
-          // Close the Find toolbar if we're in old-style TAF mode
-          gFindBar.close();
-        }
-
-        // fix bug 253793 - turn off highlight when page changes
-        gFindBar.getElement("highlight").checked = false;
-      }
     }
     UpdateBackForwardCommands(gBrowser.webNavigation);
 
     gGestureSupport.restoreRotationState();
 
     // See bug 358202, when tabs are switched during a drag operation,
     // timers don't fire on windows (bug 203573)
     if (aRequest)
--- a/browser/base/content/tabbrowser.xml
+++ b/browser/base/content/tabbrowser.xml
@@ -682,16 +682,27 @@
                 if (this.mBrowser.userTypedClear > 0 ||
                     (aFlags & Ci.nsIWebProgressListener.LOCATION_CHANGE_ERROR_PAGE))
                   this.mBrowser.userTypedValue = null;
 
                 // Clear out the missing plugins list since it's related to the
                 // previous location.
                 this.mBrowser.missingPlugins = null;
 
+                if (this.mTabBrowser.isFindBarInitialized(this.mTab)) {
+                  let findBar = this.mTabBrowser.getFindBar(this.mTab);
+
+                  // Close the Find toolbar if we're in old-style TAF mode
+                  if (findBar.findMode != findBar.FIND_NORMAL)
+                    findBar.close();
+
+                  // fix bug 253793 - turn off highlight when page changes
+                  findBar.getElement("highlight").checked = false;
+                }
+
                 // Don't clear the favicon if this onLocationChange was
                 // triggered by a pushState or a replaceState.  See bug 550565.
                 if (!gMultiProcessBrowser) {
                   if (aWebProgress.isLoadingDocument &&
                       !(this.mBrowser.docShell.loadType & Ci.nsIDocShell.LOAD_CMD_PUSHSTATE))
                     this.mBrowser.mIconURL = null;
                 }
 
--- a/browser/base/content/test/browser_bug537013.js
+++ b/browser/base/content/test/browser_bug537013.js
@@ -34,29 +34,42 @@ function test() {
     }
   });
   texts.forEach(function(aText) addTabWithText(aText));
 
   // Set up the first tab
   gBrowser.selectedTab = tabs[0];
 
   setFindString(texts[0]);
+  // Turn on highlight for testing bug 891638
+  gFindBar.getElement("highlight").checked = true;
 
   // Make sure the second tab is correct, then set it up
   gBrowser.selectedTab = tabs[1];
   ok(gFindBar.hidden, "Second tab doesn't show find bar!");
   gFindBar.open();
   is(gFindBar._findField.value, texts[0],
      "Second tab kept old find value for new initialization!");
   setFindString(texts[1]);
 
   // Confirm the first tab is still correct, ensure re-hiding works as expected
   gBrowser.selectedTab = tabs[0];
   ok(!gFindBar.hidden, "First tab shows find bar!");
   is(gFindBar._findField.value, texts[0], "First tab persists find value!");
+  ok(gFindBar.getElement("highlight").checked,
+     "Highlight button state persists!");
+
+  // While we're here, let's test bug 253793
+  gBrowser.reload();
+  gBrowser.addEventListener("DOMContentLoaded", continueTests, true);
+}
+
+function continueTests() {
+  gBrowser.removeEventListener("DOMContentLoaded", continueTests, true);
+  ok(!gFindBar.getElement("highlight").checked, "Highlight button reset!");
   gFindBar.close();
   ok(gFindBar.hidden, "First tab doesn't show find bar!");
   gBrowser.selectedTab = tabs[1];
   ok(!gFindBar.hidden, "Second tab shows find bar!");
   gBrowser.selectedTab = tabs[0];
   ok(gFindBar.hidden, "First tab doesn't show find bar!");
 
   // Set up a third tab, no tests here