--- Waterfox-6.5.2/browser/app/profile/firefox.js +++ Waterfox-6.5.2/browser/app/profile/firefox.js @@ -353,16 +353,24 @@ #ifdef XP_MACOSX pref("browser.fullscreen.autohide", false); #else pref("browser.fullscreen.autohide", true); #endif pref("browser.overlink-delay", 80); +#ifdef UNIX_BUT_NOT_MAC + pref("browser.urlbar.clickSelectsAll", false); + pref("browser.urlbar.doubleClickSelectsAll", true); +#else + pref("browser.urlbar.clickSelectsAll", true); + pref("browser.urlbar.doubleClickSelectsAll", false); +#endif + pref("browser.theme.colorway-closet", true); #ifdef XP_MACOSX #ifdef NIGHTLY_BUILD pref("browser.theme.macos.native-theme", true); #else pref("browser.theme.macos.native-theme", false); #endif --- Waterfox-6.5.2/browser/components/urlbar/tests/browser/browser_retainedResultsOnFocus.js +++ Waterfox-6.5.2/browser/components/urlbar/tests/browser/browser_retainedResultsOnFocus.js @@ -66,17 +66,20 @@ info("Focus with the mouse."); promiseState = checkPanelStatePersists(win, false); EventUtils.synthesizeMouseAtCenter(win.gURLBar.inputField, {}, win); await promiseState; } add_setup(async function () { await SpecialPowers.pushPrefEnv({ - set: [["browser.urlbar.autoFill", true]], + set: [ + ["browser.urlbar.autoFill", true], + ["browser.urlbar.clickSelectsAll", true] + ], }); // Add some history for the empty panel and autofill. await PlacesTestUtils.addVisits([ { uri: "https://example.com/", transition: PlacesUtils.history.TRANSITIONS.TYPED, }, { --- Waterfox-6.5.2/browser/components/urlbar/tests/browser/browser.toml +++ Waterfox-6.5.2/browser/components/urlbar/tests/browser/browser.toml @@ -204,16 +204,18 @@ ["browser_deleteAllText.js"] ["browser_display_selectedAction_Extensions.js"] ["browser_dns_first_for_single_words.js"] skip-if = ["verify && os == 'linux'"] # Bug 1581635 +["browser_doubleClickSelectsAll.js"] + ["browser_downArrowKeySearch.js"] https_first_disabled = true ["browser_dragdropURL.js"] ["browser_dynamicResults.js"] https_first_disabled = true support-files = [ --- Waterfox-6.5.2/browser/components/urlbar/tests/browser/browser_urlbar_selection.js +++ Waterfox-6.5.2/browser/components/urlbar/tests/browser/browser_urlbar_selection.js @@ -57,103 +57,95 @@ toX, toY, { type: "mouseup" }, target.ownerGlobal ); return promise; } -function resetPrimarySelection(val = "") { - if ( - Services.clipboard.isClipboardTypeSupported( - Services.clipboard.kSelectionClipboard - ) - ) { - // Reset the clipboard. - clipboardHelper.copyStringToClipboard( - val, - Services.clipboard.kSelectionClipboard - ); - } -} - -function checkPrimarySelection(expectedVal = "") { - if ( - Services.clipboard.isClipboardTypeSupported( - Services.clipboard.kSelectionClipboard - ) - ) { - let primaryAsText = SpecialPowers.getClipboardData( - "text/plain", - SpecialPowers.Ci.nsIClipboard.kSelectionClipboard - ); - Assert.equal(primaryAsText, expectedVal); - } -} - add_setup(async function () { + SpecialPowers.pushPrefEnv({ + set: [["browser.urlbar.clickSelectsAll", true]], + }); // On macOS, we must "warm up" the Urlbar to get the first test to pass. gURLBar.value = ""; await click(gURLBar.inputField); gURLBar.blur(); }); add_task(async function leftClickSelectsAll() { - resetPrimarySelection(); gURLBar.value = exampleSearch; await click(gURLBar.inputField); Assert.equal( gURLBar.selectionStart, 0, "The entire search term should be selected." ); Assert.equal( gURLBar.selectionEnd, exampleSearch.length, "The entire search term should be selected." ); gURLBar.blur(); - checkPrimarySelection(); }); add_task(async function leftClickSelectsUrl() { - resetPrimarySelection(); gURLBar.value = exampleUrl; await click(gURLBar.inputField); Assert.equal(gURLBar.selectionStart, 0, "The entire url should be selected."); Assert.equal( gURLBar.selectionEnd, UrlbarTestUtils.trimURL(exampleUrl).length, "The entire url should be selected." ); gURLBar.blur(); - checkPrimarySelection(); +}); + +// Test to ensure that the doubleClickSelectsAll pref does not interfere with +// single click behaviour (Double CSA itself is tested in +// urlbar/tests/browser_doubleClickSelectsAll.js). +add_task(async function bothPrefsEnabled() { + Services.prefs.setBoolPref("browser.urlbar.doubleClickSelectsAll", true); + gURLBar.value = exampleSearch; + await click(gURLBar.inputField); + Assert.equal( + gURLBar.selectionStart, + 0, + "The entire search term should be selected." + ); + Assert.equal( + gURLBar.selectionEnd, + exampleSearch.length, + "The entire search term should be selected." + ); + gURLBar.blur(); + Services.prefs.clearUserPref("browser.urlbar.doubleClickSelectsAll"); }); add_task(async function rightClickSelectsAll() { + // The text should be selected even when the pref is disabled. + await SpecialPowers.pushPrefEnv({ + set: [["browser.urlbar.clickSelectsAll", false]], + }); gURLBar.inputField.focus(); gURLBar.value = exampleUrl; // Remove the selection so the focus() call above doesn't influence the test. gURLBar.selectionStart = gURLBar.selectionEnd = 0; - resetPrimarySelection(); - await openContextMenu(gURLBar.inputField); Assert.equal(gURLBar.selectionStart, 0, "The entire URL should be selected."); Assert.equal( gURLBar.selectionEnd, UrlbarTestUtils.trimURL(exampleUrl).length, "The entire URL should be selected." ); - checkPrimarySelection(); - let contextMenu = gURLBar.querySelector("moz-input-box").menupopup; // While the context menu is open, test the "Select All" button. let contextMenuItem = contextMenu.firstElementChild; while ( contextMenuItem.nextElementSibling && contextMenuItem.getAttribute("cmd") != "cmd_selectAll" ) { @@ -181,106 +173,90 @@ Assert.equal( gURLBar.selectionEnd, UrlbarTestUtils.trimURL(exampleUrl).length, "The entire URL should be selected after clicking selectAll button." ); gURLBar.querySelector("moz-input-box").menupopup.hidePopup(); gURLBar.blur(); - checkPrimarySelection(gURLBar.untrimmedValue); await SpecialPowers.popPrefEnv(); }); add_task(async function contextMenuDoesNotCancelSelection() { gURLBar.inputField.focus(); gURLBar.value = exampleUrl; gURLBar.selectionStart = 3; gURLBar.selectionEnd = 7; - resetPrimarySelection(); - await openContextMenu(gURLBar.inputField); Assert.equal( gURLBar.selectionStart, 3, "The selection should not have changed." ); Assert.equal( gURLBar.selectionEnd, 7, "The selection should not have changed." ); gURLBar.querySelector("moz-input-box").menupopup.hidePopup(); gURLBar.blur(); - checkPrimarySelection(); }); add_task(async function dragSelect() { - resetPrimarySelection(); gURLBar.value = exampleSearch.repeat(10); // Drags from an artibrary offset of 30 to test for bug 1562145: that the // selection does not start at the beginning. await drag(gURLBar.inputField, 30, 0, 60, 0); Assert.greater( gURLBar.selectionStart, 0, "Selection should not start at the beginning of the string." ); - let selectedVal = gURLBar.value.substring( - gURLBar.selectionStart, - gURLBar.selectionEnd - ); gURLBar.blur(); - checkPrimarySelection(selectedVal); }); /** * Testing for bug 1571018: that the entire Urlbar isn't selected when the * Urlbar is dragged following a selectsAll event then a blur. */ add_task(async function dragAfterSelectAll() { - resetPrimarySelection(); gURLBar.value = exampleSearch.repeat(10); await click(gURLBar.inputField); Assert.equal( gURLBar.selectionStart, 0, "The entire search term should be selected." ); Assert.equal( gURLBar.selectionEnd, exampleSearch.repeat(10).length, "The entire search term should be selected." ); gURLBar.blur(); - checkPrimarySelection(); // The offset of 30 is arbitrary. await drag(gURLBar.inputField, 30, 0, 60, 0); Assert.notEqual( gURLBar.selectionStart, 0, "Only part of the search term should be selected." ); Assert.notEqual( gURLBar.selectionEnd, exampleSearch.repeat(10).length, "Only part of the search term should be selected." ); - - checkPrimarySelection( - gURLBar.value.substring(gURLBar.selectionStart, gURLBar.selectionEnd) - ); }); /** * Testing for bug 1571018: that the entire Urlbar is selected when the Urlbar * is refocused following a partial text selection then a blur. */ add_task(async function selectAllAfterDrag() { gURLBar.value = exampleSearch; --- Waterfox-6.5.2/modules/libpref/init/all.js +++ Waterfox-6.5.2/modules/libpref/init/all.js @@ -2820,16 +2820,18 @@ pref("network.protocol-handler.warn-external.file", false); pref("browser.drag_out_of_frame_style", 1); // Middle-mouse handling pref("middlemouse.paste", true); pref("middlemouse.openNewWindow", true); pref("middlemouse.scrollbarPosition", true); + pref("browser.urlbar.clickSelectsAll", false); + // Tab focus model bit field: // 1 focuses text controls, 2 focuses other form elements, 4 adds links. // Leave this at the default, 7, to match mozilla1.0-era user expectations. // pref("accessibility.tabfocus", 1); pref("helpers.global_mime_types_file", "/etc/mime.types"); pref("helpers.global_mailcap_file", "/etc/mailcap"); pref("helpers.private_mime_types_file", "~/.mime.types");