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 18:21:16 +02:00
parent 6ef0a43d82
commit 62551ad323
4 changed files with 24 additions and 8 deletions

View File

@ -523,7 +523,11 @@ pref("accessibility.typeaheadfind.timeout", 4000);
pref("accessibility.typeaheadfind.enabletimeout", true); pref("accessibility.typeaheadfind.enabletimeout", true);
pref("accessibility.typeaheadfind.soundURL", "beep"); pref("accessibility.typeaheadfind.soundURL", "beep");
pref("accessibility.typeaheadfind.enablesound", true); pref("accessibility.typeaheadfind.enablesound", true);
#ifdef XP_MACOSX
pref("accessibility.typeaheadfind.prefillwithselection", false);
#else
pref("accessibility.typeaheadfind.prefillwithselection", true); pref("accessibility.typeaheadfind.prefillwithselection", true);
#endif
pref("accessibility.typeaheadfind.matchesCountTimeout", 250); pref("accessibility.typeaheadfind.matchesCountTimeout", 250);
pref("accessibility.typeaheadfind.matchesCountLimit", 100); pref("accessibility.typeaheadfind.matchesCountLimit", 100);

View File

@ -359,12 +359,10 @@
highlightButton.click(); highlightButton.click();
ok(highlightButton.checked, "testFindWithHighlight 3: Highlight All should be checked."); ok(highlightButton.checked, "testFindWithHighlight 3: Highlight All should be checked.");
if (!gHasFindClipboard) { a = gFindBar._findField.value;
a = gFindBar._findField.value; b = gFindBar._browser.finder._fastFind.searchString;
b = gFindBar._browser.finder._fastFind.searchString; c = gFindBar._browser.finder.searchString;
c = gFindBar._browser.finder.searchString; ok(a == searchStr && b == c, "testFindWithHighlight 4: " + a + ", " + b + ", " + c + ".");
ok(a == searchStr && b == c, "testFindWithHighlight 4: " + a + ", " + b + ", " + c + ".");
}
gFindBar.onFindAgainCommand(); gFindBar.onFindAgainCommand();
a = gFindBar._findField.value; a = gFindBar._findField.value;

View File

@ -31,8 +31,15 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=288254
/** Test for Bug 257061 and Bug 288254 **/ /** Test for Bug 257061 and Bug 288254 **/
SimpleTest.waitForExplicitFinish(); 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> </script>

View File

@ -1198,6 +1198,13 @@
<method name="_onFindFieldFocus"> <method name="_onFindFieldFocus">
<body><![CDATA[ <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; let clipboardSearchString = this._browser.finder.clipboardSearchString;
if (clipboardSearchString && this._findField.value != clipboardSearchString) { if (clipboardSearchString && this._findField.value != clipboardSearchString) {
this._findField.value = clipboardSearchString; this._findField.value = clipboardSearchString;