зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset 6ce7064d4bf6 (bug 1692214) for browser-chrome failures on browser_proton_toolbar_hide_home_and_library_buttons.js. CLOSED TREE
This commit is contained in:
Родитель
2ddf86653d
Коммит
3aa417b128
|
@ -516,10 +516,10 @@ module.exports = {
|
|||
"browser/components/customizableui/test/browser_1042100_default_placements_update.js",
|
||||
"browser/components/customizableui/test/browser_1096763_seen_widgets_post_reset.js",
|
||||
"browser/components/customizableui/test/browser_1161838_inserted_new_default_buttons.js",
|
||||
"browser/components/customizableui/test/browser_1686523_hide_home_button.js",
|
||||
"browser/components/customizableui/test/browser_989338_saved_placements_not_resaved.js",
|
||||
"browser/components/customizableui/test/browser_currentset_post_reset.js",
|
||||
"browser/components/customizableui/test/browser_panel_keyboard_navigation.js",
|
||||
"browser/components/customizableui/test/browser_proton_toolbar_hide_home_and_library_buttons.js",
|
||||
"browser/components/enterprisepolicies/tests/browser/browser_policies_setAndLockPref_API.js",
|
||||
"browser/components/enterprisepolicies/tests/browser/head.js",
|
||||
"browser/components/enterprisepolicies/tests/xpcshell/head.js",
|
||||
|
|
|
@ -66,7 +66,6 @@ const kPrefAutoTouchMode = "browser.touchmode.auto";
|
|||
const kPrefAutoHideDownloadsButton = "browser.download.autohideButton";
|
||||
const kPrefProtonToolbarVersion = "browser.proton.toolbar.version";
|
||||
const kPrefHomeButtonUsed = "browser.engagement.home-button.has-used";
|
||||
const kPrefLibraryButtonUsed = "browser.engagement.library-button.has-used";
|
||||
|
||||
const kExpectedWindowURL = AppConstants.BROWSER_CHROME_URL;
|
||||
|
||||
|
@ -261,7 +260,7 @@ var CustomizableUIInternal = {
|
|||
"urlbar-container",
|
||||
"spring",
|
||||
"downloads-button",
|
||||
gProtonToolbarEnabled ? null : "library-button",
|
||||
"library-button",
|
||||
AppConstants.MOZ_DEV_EDITION ? "developer-button" : null,
|
||||
"sidebar-button",
|
||||
"fxa-toolbar-menu-button",
|
||||
|
@ -602,7 +601,7 @@ var CustomizableUIInternal = {
|
|||
},
|
||||
|
||||
_updateForNewProtonVersion() {
|
||||
const VERSION = 2;
|
||||
const VERSION = 1;
|
||||
let currentVersion = Services.prefs.getIntPref(
|
||||
kPrefProtonToolbarVersion,
|
||||
0
|
||||
|
@ -617,10 +616,9 @@ var CustomizableUIInternal = {
|
|||
return;
|
||||
}
|
||||
|
||||
let placements = gSavedState.placements[CustomizableUI.AREA_NAVBAR];
|
||||
|
||||
// Remove the home button if it hasn't been used and is set to about:home
|
||||
if (currentVersion < 1) {
|
||||
let placements = gSavedState.placements[CustomizableUI.AREA_NAVBAR];
|
||||
let homePage = HomePage.get();
|
||||
if (
|
||||
placements.includes("home-button") &&
|
||||
|
@ -630,19 +628,9 @@ var CustomizableUIInternal = {
|
|||
) {
|
||||
placements.splice(placements.indexOf("home-button"), 1);
|
||||
}
|
||||
}
|
||||
|
||||
// Remove the library button if it hasn't been used
|
||||
if (currentVersion < 2) {
|
||||
if (
|
||||
placements.includes("library-button") &&
|
||||
!Services.prefs.getBoolPref(kPrefLibraryButtonUsed)
|
||||
) {
|
||||
placements.splice(placements.indexOf("library-button"), 1);
|
||||
}
|
||||
Services.prefs.setIntPref(kPrefProtonToolbarVersion, VERSION);
|
||||
}
|
||||
|
||||
Services.prefs.setIntPref(kPrefProtonToolbarVersion, VERSION);
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
|
@ -134,6 +134,7 @@ skip-if = os == "mac"
|
|||
[browser_1161838_inserted_new_default_buttons.js]
|
||||
skip-if = verify
|
||||
[browser_1484275_PanelMultiView_toggle_with_other_popup.js]
|
||||
[browser_1686523_hide_home_button.js]
|
||||
[browser_allow_dragging_removable_false.js]
|
||||
[browser_bookmarks_toolbar_collapsed_restore_default.js]
|
||||
[browser_bookmarks_toolbar_shown_newtab.js]
|
||||
|
@ -169,7 +170,6 @@ skip-if = os == "mac"
|
|||
skip-if = (verify && (os == 'linux' || os == 'mac'))
|
||||
tags = fullscreen
|
||||
[browser_panelUINotifications_multiWindow.js]
|
||||
[browser_proton_toolbar_hide_home_and_library_buttons.js]
|
||||
[browser_remove_customized_specials.js]
|
||||
[browser_reset_builtin_widget_currentArea.js]
|
||||
[browser_switch_to_customize_mode.js]
|
||||
|
|
|
@ -18,13 +18,8 @@ ChromeUtils.defineModuleGetter(
|
|||
const kPrefProtonToolbarEnabled = "browser.proton.toolbar.enabled";
|
||||
const kPrefProtonToolbarVersion = "browser.proton.toolbar.version";
|
||||
const kPrefHomeButtonUsed = "browser.engagement.home-button.has-used";
|
||||
const kPrefLibraryButtonUsed = "browser.engagement.library-button.has-used";
|
||||
|
||||
async function testToolbarButtons(
|
||||
shouldRemoveHomeButton,
|
||||
shouldRemoveLibraryButton,
|
||||
shouldUpdateVersion
|
||||
) {
|
||||
async function testHomeButton(shouldRemoveHomeButton, shouldUpdateVersion) {
|
||||
const defaultPlacements = [
|
||||
"back-button",
|
||||
"forward-button",
|
||||
|
@ -55,20 +50,15 @@ async function testToolbarButtons(
|
|||
};
|
||||
CustomizableUIInternal._updateForNewProtonVersion();
|
||||
|
||||
let navbarPlacements = CustomizableUIBSPass.gSavedState.placements["nav-bar"];
|
||||
let includesHomeButton = navbarPlacements.includes("home-button");
|
||||
let includesLibraryButton = navbarPlacements.includes("library-button");
|
||||
let includesHomeButton = CustomizableUIBSPass.gSavedState.placements[
|
||||
"nav-bar"
|
||||
].includes("home-button");
|
||||
|
||||
Assert.equal(
|
||||
!includesHomeButton,
|
||||
shouldRemoveHomeButton,
|
||||
"Correctly handles home button"
|
||||
);
|
||||
Assert.equal(
|
||||
!includesLibraryButton,
|
||||
shouldRemoveLibraryButton,
|
||||
"Correctly handles library button"
|
||||
);
|
||||
|
||||
let toolbarVersion = Services.prefs.getIntPref(kPrefProtonToolbarVersion);
|
||||
if (shouldUpdateVersion) {
|
||||
|
@ -87,55 +77,39 @@ async function testToolbarButtons(
|
|||
* pref is false, and the homepage is about:home or about:blank.
|
||||
* Otherwise, the home button should remain if it was previously
|
||||
* in the navbar.
|
||||
* Also checks that the library button is removed from the nav-bar
|
||||
* if proton is enabled and the toolbar engagement pref is false.
|
||||
*/
|
||||
add_task(async function testButtonRemoval() {
|
||||
let tests = [
|
||||
// Proton enabled without home and library engagement
|
||||
// Proton enabled without engagement
|
||||
{
|
||||
prefs: [[kPrefProtonToolbarEnabled, true]],
|
||||
shouldRemoveHomeButton: true,
|
||||
shouldRemoveLibraryButton: true,
|
||||
shouldUpdateVersion: true,
|
||||
},
|
||||
// Proton enabled with home engagement
|
||||
// Proton enabled with engagement
|
||||
{
|
||||
prefs: [
|
||||
[kPrefProtonToolbarEnabled, true],
|
||||
[kPrefHomeButtonUsed, true],
|
||||
],
|
||||
shouldRemoveHomeButton: false,
|
||||
shouldRemoveLibraryButton: true,
|
||||
shouldUpdateVersion: true,
|
||||
},
|
||||
// Proton disabled
|
||||
{
|
||||
prefs: [[kPrefProtonToolbarEnabled, false]],
|
||||
shouldRemoveHomeButton: false,
|
||||
shouldRemoveLibraryButton: false,
|
||||
shouldUpdateVersion: false,
|
||||
},
|
||||
// Proton enabled with custom homepage
|
||||
{
|
||||
prefs: [[kPrefProtonToolbarEnabled, true]],
|
||||
shouldRemoveHomeButton: false,
|
||||
shouldRemoveLibraryButton: true,
|
||||
shouldUpdateVersion: true,
|
||||
async fn() {
|
||||
HomePage.safeSet("https://example.com");
|
||||
},
|
||||
},
|
||||
// Proton enabled with library engagement
|
||||
{
|
||||
prefs: [
|
||||
[kPrefProtonToolbarEnabled, true],
|
||||
[kPrefLibraryButtonUsed, true],
|
||||
],
|
||||
shouldRemoveHomeButton: true,
|
||||
shouldRemoveLibraryButton: false,
|
||||
shouldUpdateVersion: true,
|
||||
},
|
||||
];
|
||||
|
||||
for (let test of tests) {
|
||||
|
@ -145,11 +119,7 @@ add_task(async function testButtonRemoval() {
|
|||
if (test.fn) {
|
||||
await test.fn();
|
||||
}
|
||||
testToolbarButtons(
|
||||
test.shouldRemoveHomeButton,
|
||||
test.shouldRemoveLibraryButton,
|
||||
test.shouldUpdateVersion
|
||||
);
|
||||
testHomeButton(test.shouldRemoveHomeButton, test.shouldUpdateVersion);
|
||||
HomePage.reset();
|
||||
await SpecialPowers.popPrefEnv();
|
||||
}
|
Загрузка…
Ссылка в новой задаче