Bug 978861: disable prefillWithSelection on OSX by default, fix its semantics when enabled. r=ehsan
☠☠ backed out by aa15867d381b ☠ ☠
authorMike de Boer <mdeboer@mozilla.com>
Tue, 06 May 2014 12:01:48 +0200
changeset 181823 df4ae5ba7d6efe377724f7706fd0b5fde06ff677
parent 181822 88955975f26e9a839a0eba9e1d21909a1c9aca9d
child 181824 cc62c0f430af293f22d4a899629e1a0e2d1b0783
push id26733
push userryanvm@gmail.com
push dateTue, 06 May 2014 20:50:37 +0000
treeherdermozilla-central@4e4e0f502969 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersehsan
bugs978861
milestone32.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 978861: disable prefillWithSelection on OSX by default, fix its semantics when enabled. r=ehsan
modules/libpref/src/init/all.js
toolkit/content/tests/chrome/findbar_window.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
 pref("accessibility.typeaheadfind.matchesCountTimeout", 250);
 pref("accessibility.typeaheadfind.matchesCountLimit", 100);
 
 // 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);
--- a/toolkit/content/tests/chrome/findbar_window.xul
+++ b/toolkit/content/tests/chrome/findbar_window.xul
@@ -28,16 +28,22 @@
     const SEARCH_TEXT = "Text Test";
 
     var gFindBar = null;
     var gBrowser;
 
     var gClipboard = Cc["@mozilla.org/widget/clipboard;1"].getService(Ci.nsIClipboard);
     var gHasFindClipboard = gClipboard.supportsFindClipboard();
 
+    // 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.
+    let prefsvc = Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefBranch);
+    prefsvc.setBoolPref("accessibility.typeaheadfind.prefillwithselection", true);
+
     var gStatusText;
     var gXULBrowserWindow = {
       QueryInterface: function(aIID) {
         if (aIID.Equals(Ci.nsIXULBrowserWindow) ||
             aIID.Equals(Ci.nsISupports))
          return this;
 
         throw Cr.NS_NOINTERFACE;
@@ -354,22 +360,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();
@@ -484,19 +488,16 @@
           }
         }, timeout);
       }
 
       asyncForEach(tests, testString, callback);
     }
 
     function testClipboardSearchString(aExpected) {
-      if (!gHasFindClipboard)
-        return;
-
       if (!aExpected)
         aExpected = "";
       var searchStr = gFindBar.browser.finder.clipboardSearchString;
       ok(searchStr.toLowerCase() == aExpected.toLowerCase(),
         "testClipboardSearchString: search string not set to '" + aExpected +
         "', instead found '" + searchStr + "'");
     }
   ]]></script>
--- a/toolkit/content/widgets/findbar.xml
+++ b/toolkit/content/widgets/findbar.xml
@@ -1193,16 +1193,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>