diff --git a/modules/libpref/src/init/all.js b/modules/libpref/src/init/all.js index 05ef26933b6..9737c7f1ae7 100644 --- a/modules/libpref/src/init/all.js +++ b/modules/libpref/src/init/all.js @@ -107,7 +107,7 @@ pref("browser.search.powermode", 0); // (note: must be a string representation of a float or it'll default to 0.0) pref("browser.search.basic.min_ver", "0.0"); pref("browser.urlbar.autocomplete.enabled", true); -pref("browser.urlbar.clickSelectsAll",false); +pref("browser.urlbar.clickSelectsAll", true); pref("browser.history.last_page_visited", ""); pref("browser.history_expire_days", 9); diff --git a/modules/libpref/src/unix/unix.js b/modules/libpref/src/unix/unix.js index 23edbc96f45..4988de63fd3 100644 --- a/modules/libpref/src/unix/unix.js +++ b/modules/libpref/src/unix/unix.js @@ -51,6 +51,8 @@ pref("middlemouse.scrollbarPosition", true); // Clipboard behavior pref("clipboard.autocopy", true); +pref("browser.urlbar.clickSelectsAll", false); + // autocomplete keyboard grab workaround pref("autocomplete.grab_during_popup", true); pref("autocomplete.ungrab_during_mode_switch", true); diff --git a/xpfe/browser/resources/content/navigator.js b/xpfe/browser/resources/content/navigator.js index 85ccef42855..37b01feefe5 100644 --- a/xpfe/browser/resources/content/navigator.js +++ b/xpfe/browser/resources/content/navigator.js @@ -31,6 +31,7 @@ var gBrandBundle; var gNavigatorRegionBundle; var gBrandRegionBundle; var gLastValidURL = ""; +var gClickSelectsAll = -1; var pref = Components.classes["@mozilla.org/preferences;1"] .getService(Components.interfaces.nsIPref); @@ -1303,18 +1304,20 @@ function getNewThemes() loadURI(gBrandRegionBundle.getString("getNewThemesURL")); } -function URLBarMouseupHandler(aEvent) +function URLBarFocusHandler(aEvent) { - if (aEvent.button == 0 && pref.GetBoolPref("browser.urlbar.clickSelectsAll")) { - var selectionLen = gURLBar.selectionEnd - gURLBar.selectionStart; - if (selectionLen == 0) + if (gURLBar) { + if (gClickSelectsAll == -1) + gClickSelectsAll = pref.GetBoolPref("browser.urlbar.clickSelectsAll"); + if (gClickSelectsAll) gURLBar.setSelectionRange(0, gURLBar.textLength); } } function URLBarBlurHandler(aEvent) { - if (pref.GetBoolPref("browser.urlbar.clickSelectsAll")) + // XXX why the hell do we have to do this? + if (gClickSelectsAll) gURLBar.setSelectionRange(0, 0); } diff --git a/xpfe/browser/resources/content/navigator.xul b/xpfe/browser/resources/content/navigator.xul index 3d3c63e540c..fa7445b78e3 100644 --- a/xpfe/browser/resources/content/navigator.xul +++ b/xpfe/browser/resources/content/navigator.xul @@ -164,8 +164,7 @@ Contributor(s): ______________________________________. --> tooltip="aTooltip" tooltiptext="&locationBar.tooltip;" ontextcommand="return handleURLBarCommand(userAction);" ontextrevert="return handleURLBarRevert();" - onmouseup="URLBarMouseupHandler(event);" - onkeyup="URLBarKeyupHandler(event);" + onfocus="URLBarFocusHandler(event);" onblur="URLBarBlurHandler(event);">