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 192212 b431c1c19a26
parent 192211 02e1dd202d67
child 192213 594456499788
push id3525
push usermdeboer@mozilla.com
push date2014-05-07 09:08 +0000
treeherdermozilla-beta@b431c1c19a26 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersehsan, sylvestre
bugs978861
milestone30.0
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
@@ -500,17 +500,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
@@ -25,15 +25,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
@@ -1119,16 +1119,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>