Bug 978861: disable prefillWithSelection on OSX by default, fix its semantics when enabled. r=ehsan

This commit is contained in:
Mike de Boer 2014-05-06 12:01:48 +02:00
parent c03fa1bcb3
commit 15e4265ceb
3 changed files with 21 additions and 9 deletions

View File

@ -523,7 +523,11 @@ 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);

View File

@ -33,6 +33,12 @@
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) {
@ -359,12 +365,10 @@
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;
@ -489,9 +493,6 @@
}
function testClipboardSearchString(aExpected) {
if (!gHasFindClipboard)
return;
if (!aExpected)
aExpected = "";
var searchStr = gFindBar.browser.finder.clipboardSearchString;

View File

@ -1198,6 +1198,13 @@
<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;