Bug 978861: disable prefillWithSelection on OSX by default, fix its semantics when enabled. r=ehsan, a=sylvestre.
authorMike de Boer <mdeboer@mozilla.com>
Tue, 06 May 2014 18:21:16 +0200
changeset 199080 7ea30f70ccd6180bed246ccfb2b358b62e0f36e5
parent 199079 9b62596f615108b0042065d5dfaa9e8bcadec0cb
child 199081 b7c28ae275957cd402043bfe1283c5b16fa580f3
push id3624
push userasasaki@mozilla.com
push dateMon, 09 Jun 2014 21:49:01 +0000
treeherdermozilla-beta@b1a5da15899a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersehsan, sylvestre
bugs978861
milestone31.0a2
Bug 978861: disable prefillWithSelection on OSX by default, fix its semantics when enabled. r=ehsan, a=sylvestre.
modules/libpref/src/init/all.js
toolkit/content/tests/chrome/findbar_window.xul
toolkit/content/tests/chrome/test_findbar.xul
toolkit/content/widgets/findbar.xml
--- a/modules/libpref/src/init/all.js
+++ b/modules/libpref/src/init/all.js
@@ -518,17 +518,21 @@ pref("accessibility.typeaheadfind.autost
 // other - "auto"   (case-sensitive for mixed-case input, insensitive otherwise)
 pref("accessibility.typeaheadfind.casesensitive", 0);
 pref("accessibility.typeaheadfind.linksonly", true);
 pref("accessibility.typeaheadfind.startlinksonly", false);
 pref("accessibility.typeaheadfind.timeout", 4000);
 pref("accessibility.typeaheadfind.enabletimeout", true);
 pref("accessibility.typeaheadfind.soundURL", "beep");
 pref("accessibility.typeaheadfind.enablesound", true);
+#ifdef XP_MACOSX
+pref("accessibility.typeaheadfind.prefillwithselection", false);
+#else
 pref("accessibility.typeaheadfind.prefillwithselection", true);
+#endif
 
 // use Mac OS X Appearance panel text smoothing setting when rendering text, disabled by default
 pref("gfx.use_text_smoothing_setting", false);
 
 // loading and rendering of framesets and iframes
 pref("browser.frames.enabled", true);
 
 // Number of characters to consider emphasizing for rich autocomplete results
--- a/toolkit/content/tests/chrome/findbar_window.xul
+++ b/toolkit/content/tests/chrome/findbar_window.xul
@@ -344,22 +344,20 @@
       c = gFindBar._browser.finder.searchString;
       ok(a == searchStr && b == c, "testFindWithHighlight 2: " + searchStr +
          ", " + a + ", " + b + ", " + c + ".");
 
       let highlightButton = gFindBar.getElement("highlight");
       highlightButton.click();
       ok(highlightButton.checked, "testFindWithHighlight 3: Highlight All should be checked.");
 
-      if (!gHasFindClipboard) {
-        a = gFindBar._findField.value;
-        b = gFindBar._browser.finder._fastFind.searchString;
-        c = gFindBar._browser.finder.searchString;
-        ok(a == searchStr && b == c, "testFindWithHighlight 4: " + a + ", " + b + ", " + c + ".");
-      }
+      a = gFindBar._findField.value;
+      b = gFindBar._browser.finder._fastFind.searchString;
+      c = gFindBar._browser.finder.searchString;
+      ok(a == searchStr && b == c, "testFindWithHighlight 4: " + a + ", " + b + ", " + c + ".");
 
       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();
--- a/toolkit/content/tests/chrome/test_findbar.xul
+++ b/toolkit/content/tests/chrome/test_findbar.xul
@@ -23,15 +23,22 @@ https://bugzilla.mozilla.org/show_bug.cg
 </pre>
 </body>
 
 <script class="testbody" type="application/javascript">
 <![CDATA[
 
 /** Test for Bug 288254 **/
 SimpleTest.waitForExplicitFinish();
-window.open("findbar_window.xul", "findbartest", 
-            "chrome,width=600,height=600");
+
+// Since bug 978861, this pref is set to `false` on OSX. For this test, we'll
+// set it `true` to disable the find clipboard on OSX, which interferes with
+// our tests.
+SpecialPowers.pushPrefEnv({
+  set: [["accessibility.typeaheadfind.prefillwithselection", true]]
+}, () => {
+  window.open("findbar_window.xul", "findbartest", "chrome,width=600,height=600");
+});
 
 ]]>
 </script>
 
 </window>
--- a/toolkit/content/widgets/findbar.xml
+++ b/toolkit/content/widgets/findbar.xml
@@ -1121,16 +1121,23 @@
           let searchString = this.browser.finder.setSearchStringToSelection();
           if (searchString)
             this._findField.value = searchString;
         ]]></body>
       </method>
 
       <method name="_onFindFieldFocus">
         <body><![CDATA[
+          let prefsvc =
+            Components.classes["@mozilla.org/preferences-service;1"]
+                      .getService(Components.interfaces.nsIPrefBranch);
+          const kPref = "accessibility.typeaheadfind.prefillwithselection";
+          if (this.prefillWithSelection && prefsvc.getBoolPref(kPref))
+            return;
+
           let clipboardSearchString = this._browser.finder.clipboardSearchString;
           if (clipboardSearchString && this._findField.value != clipboardSearchString) {
             this._findField.value = clipboardSearchString;
             // Changing the search string makes the previous status invalid, so
             // we better clear it here.
             this._updateStatusUI();
           }
         ]]></body>