Backed out changeset f04379a895c4 (bug 1926360) for causing bc failures @ browser_verticalTabs_widget_placements.js CLOSED TREE
This commit is contained in:
@@ -34,8 +34,6 @@ const kPrefCustomizationHorizontalTabstrip =
|
|||||||
"browser.uiCustomization.horizontalTabstrip";
|
"browser.uiCustomization.horizontalTabstrip";
|
||||||
const kPrefCustomizationHorizontalTabsBackup =
|
const kPrefCustomizationHorizontalTabsBackup =
|
||||||
"browser.uiCustomization.horizontalTabsBackup";
|
"browser.uiCustomization.horizontalTabsBackup";
|
||||||
const kPrefCustomizationNavBarWhenVerticalTabs =
|
|
||||||
"browser.uiCustomization.navBarWhenVerticalTabs";
|
|
||||||
const kPrefCustomizationAutoAdd = "browser.uiCustomization.autoAdd";
|
const kPrefCustomizationAutoAdd = "browser.uiCustomization.autoAdd";
|
||||||
const kPrefCustomizationDebug = "browser.uiCustomization.debug";
|
const kPrefCustomizationDebug = "browser.uiCustomization.debug";
|
||||||
const kPrefDrawInTitlebar = "browser.tabs.inTitlebar";
|
const kPrefDrawInTitlebar = "browser.tabs.inTitlebar";
|
||||||
@@ -248,13 +246,6 @@ XPCOMUtils.defineLazyPreferenceGetter(
|
|||||||
""
|
""
|
||||||
);
|
);
|
||||||
|
|
||||||
XPCOMUtils.defineLazyPreferenceGetter(
|
|
||||||
lazy,
|
|
||||||
"verticalPlacementsPref",
|
|
||||||
kPrefCustomizationNavBarWhenVerticalTabs,
|
|
||||||
""
|
|
||||||
);
|
|
||||||
|
|
||||||
ChromeUtils.defineLazyGetter(lazy, "log", () => {
|
ChromeUtils.defineLazyGetter(lazy, "log", () => {
|
||||||
let { ConsoleAPI } = ChromeUtils.importESModule(
|
let { ConsoleAPI } = ChromeUtils.importESModule(
|
||||||
"resource://gre/modules/Console.sys.mjs"
|
"resource://gre/modules/Console.sys.mjs"
|
||||||
@@ -2678,11 +2669,9 @@ var CustomizableUIInternal = {
|
|||||||
if (
|
if (
|
||||||
!gInBatchStack &&
|
!gInBatchStack &&
|
||||||
CustomizableUI.verticalTabsEnabled &&
|
CustomizableUI.verticalTabsEnabled &&
|
||||||
oldPlacement.area == CustomizableUI.AREA_NAVBAR &&
|
oldPlacement.area == CustomizableUI.AREA_TABSTRIP
|
||||||
this.getSavedHorizontalSnapshotState().includes(aWidgetId)
|
|
||||||
) {
|
) {
|
||||||
this.deleteWidgetInSavedHorizontalTabStripState(aWidgetId);
|
this.deleteWidgetInSavedHorizontalTabStripState(aWidgetId);
|
||||||
this.deleteWidgetInSavedNavBarWhenVerticalTabsState(aWidgetId);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.notifyListeners("onWidgetRemoved", aWidgetId, oldPlacement.area);
|
this.notifyListeners("onWidgetRemoved", aWidgetId, oldPlacement.area);
|
||||||
@@ -2736,7 +2725,7 @@ var CustomizableUIInternal = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
getSavedHorizontalSnapshotState() {
|
getSavedHorizontalSnapshotState() {
|
||||||
let state = [];
|
let state = null;
|
||||||
let prefValue = lazy.horizontalPlacementsPref;
|
let prefValue = lazy.horizontalPlacementsPref;
|
||||||
if (prefValue) {
|
if (prefValue) {
|
||||||
try {
|
try {
|
||||||
@@ -2751,22 +2740,6 @@ var CustomizableUIInternal = {
|
|||||||
return state;
|
return state;
|
||||||
},
|
},
|
||||||
|
|
||||||
getSavedVerticalSnapshotState() {
|
|
||||||
let state = [];
|
|
||||||
let prefValue = lazy.verticalPlacementsPref;
|
|
||||||
if (prefValue) {
|
|
||||||
try {
|
|
||||||
state = JSON.parse(prefValue);
|
|
||||||
} catch (e) {
|
|
||||||
lazy.log.warn(
|
|
||||||
`Failed to parse value of ${kPrefCustomizationNavBarWhenVerticalTabs}`,
|
|
||||||
e
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return state;
|
|
||||||
},
|
|
||||||
|
|
||||||
// Note that this does not populate gPlacements, which is done lazily.
|
// Note that this does not populate gPlacements, which is done lazily.
|
||||||
// The panel area is an exception here.
|
// The panel area is an exception here.
|
||||||
loadSavedState() {
|
loadSavedState() {
|
||||||
@@ -2935,15 +2908,6 @@ var CustomizableUIInternal = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
deleteWidgetInSavedNavBarWhenVerticalTabsState(aWidgetId) {
|
|
||||||
const savedPlacements = this.getSavedVerticalSnapshotState();
|
|
||||||
let position = savedPlacements.indexOf(aWidgetId);
|
|
||||||
if (position != -1) {
|
|
||||||
savedPlacements.splice(position, 1);
|
|
||||||
this.saveNavBarWhenVerticalTabsState(savedPlacements);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
saveHorizontalTabStripState(placements = []) {
|
saveHorizontalTabStripState(placements = []) {
|
||||||
if (!placements.length) {
|
if (!placements.length) {
|
||||||
placements = this.getAreaPlacementsForSaving(
|
placements = this.getAreaPlacementsForSaving(
|
||||||
@@ -2958,18 +2922,6 @@ var CustomizableUIInternal = {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
saveNavBarWhenVerticalTabsState(placements = []) {
|
|
||||||
if (!placements.length) {
|
|
||||||
placements = this.getAreaPlacementsForSaving(CustomizableUI.AREA_NAVBAR);
|
|
||||||
}
|
|
||||||
let serialized = JSON.stringify(placements, this.serializerHelper);
|
|
||||||
lazy.log.debug("Saving vertical navbar state.", serialized);
|
|
||||||
Services.prefs.setCharPref(
|
|
||||||
kPrefCustomizationNavBarWhenVerticalTabs,
|
|
||||||
serialized
|
|
||||||
);
|
|
||||||
},
|
|
||||||
|
|
||||||
getAreaPlacementsForSaving(area) {
|
getAreaPlacementsForSaving(area) {
|
||||||
// An early call to saveState can occur before all the lazy-area building is complete
|
// An early call to saveState can occur before all the lazy-area building is complete
|
||||||
let placements;
|
let placements;
|
||||||
@@ -4297,8 +4249,6 @@ var CustomizableUIInternal = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
CustomizableUI.beginBatchUpdate();
|
CustomizableUI.beginBatchUpdate();
|
||||||
let customVerticalNavbarPlacements = this.getSavedVerticalSnapshotState();
|
|
||||||
let tabstripPlacements = this.getSavedHorizontalSnapshotState();
|
|
||||||
// Remove non-default widgets to the nav-bar
|
// Remove non-default widgets to the nav-bar
|
||||||
for (let id of CustomizableUI.getWidgetIdsInArea("TabsToolbar")) {
|
for (let id of CustomizableUI.getWidgetIdsInArea("TabsToolbar")) {
|
||||||
if (id == "tabbrowser-tabs") {
|
if (id == "tabbrowser-tabs") {
|
||||||
@@ -4308,13 +4258,6 @@ var CustomizableUIInternal = {
|
|||||||
);
|
);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// We add the tab strip placements later in the case they have a custom position
|
|
||||||
if (
|
|
||||||
tabstripPlacements.includes(id) &&
|
|
||||||
customVerticalNavbarPlacements.includes(id)
|
|
||||||
) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (!CustomizableUI.isWidgetRemovable(id)) {
|
if (!CustomizableUI.isWidgetRemovable(id)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -4325,16 +4268,10 @@ var CustomizableUIInternal = {
|
|||||||
// Everything else gets moved to the nav-bar area while tabs are vertical
|
// Everything else gets moved to the nav-bar area while tabs are vertical
|
||||||
CustomizableUI.addWidgetToArea(id, CustomizableUI.AREA_NAVBAR);
|
CustomizableUI.addWidgetToArea(id, CustomizableUI.AREA_NAVBAR);
|
||||||
}
|
}
|
||||||
// Remove new tab from nav-bar when vertical tabs enabled
|
// Remove new tab from AREA_NAVBAR when vertical tabs enabled.
|
||||||
this.removeWidgetFromArea("new-tab-button");
|
this.removeWidgetFromArea("new-tab-button");
|
||||||
customVerticalNavbarPlacements.forEach((id, index) => {
|
|
||||||
if (tabstripPlacements.includes(id)) {
|
|
||||||
CustomizableUI.addWidgetToArea(id, CustomizableUI.AREA_NAVBAR, index);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
CustomizableUI.endBatchUpdate();
|
CustomizableUI.endBatchUpdate();
|
||||||
} else {
|
} else {
|
||||||
this.saveNavBarWhenVerticalTabsState();
|
|
||||||
// We're switching to vertical in this session; pull saved state from pref and update placements
|
// We're switching to vertical in this session; pull saved state from pref and update placements
|
||||||
this.restoreSavedHorizontalTabStripState();
|
this.restoreSavedHorizontalTabStripState();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -362,8 +362,6 @@ skip-if = [
|
|||||||
|
|
||||||
["browser_unified_extensions_reset.js"]
|
["browser_unified_extensions_reset.js"]
|
||||||
|
|
||||||
["browser_vertical_tabs_customize_navbar.js"]
|
|
||||||
|
|
||||||
["browser_widget_animation.js"]
|
["browser_widget_animation.js"]
|
||||||
|
|
||||||
["browser_widget_recreate_events.js"]
|
["browser_widget_recreate_events.js"]
|
||||||
|
|||||||
@@ -1,135 +0,0 @@
|
|||||||
/* Any copyright is dedicated to the Public Domain.
|
|
||||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
|
||||||
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
const kPrefCustomizationNavBarWhenVerticalTabs =
|
|
||||||
"browser.uiCustomization.verticalNavBar";
|
|
||||||
|
|
||||||
add_setup(async () => {
|
|
||||||
await SpecialPowers.pushPrefEnv({
|
|
||||||
set: [["sidebar.verticalTabs", true]],
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
registerCleanupFunction(async () => {
|
|
||||||
await SpecialPowers.popPrefEnv();
|
|
||||||
Services.prefs.clearUserPref(kPrefCustomizationNavBarWhenVerticalTabs);
|
|
||||||
gBrowser.removeAllTabsBut(gBrowser.tabs[0]);
|
|
||||||
});
|
|
||||||
|
|
||||||
// When switching to vertical tabs, the nav-bar customizations remain the same
|
|
||||||
// as when in horizontal tabs mode, with the addition of tab strip widgets
|
|
||||||
// This test asserts we remember any tab strip widget customizations in the nav-bar
|
|
||||||
// when switching between vertical and horizontal modes
|
|
||||||
add_task(async function () {
|
|
||||||
await startCustomizing();
|
|
||||||
is(gBrowser.tabs.length, 2, "Should have 2 tabs");
|
|
||||||
|
|
||||||
let nonCustomizingTab = gBrowser.tabContainer.querySelector(
|
|
||||||
"tab:not([customizemode=true])"
|
|
||||||
);
|
|
||||||
let finishedCustomizing = BrowserTestUtils.waitForEvent(
|
|
||||||
gNavToolbox,
|
|
||||||
"aftercustomization"
|
|
||||||
);
|
|
||||||
|
|
||||||
let alltabsPlacement = CustomizableUI.getPlacementOfWidget("alltabs-button");
|
|
||||||
let firefoxViewPlacement = CustomizableUI.getPlacementOfWidget(
|
|
||||||
"firefox-view-button"
|
|
||||||
);
|
|
||||||
is(
|
|
||||||
alltabsPlacement.position,
|
|
||||||
13,
|
|
||||||
"alltabs-button is in its original default position"
|
|
||||||
);
|
|
||||||
is(
|
|
||||||
firefoxViewPlacement.position,
|
|
||||||
12,
|
|
||||||
"firefox-view-button is in its original default position"
|
|
||||||
);
|
|
||||||
|
|
||||||
CustomizableUI.moveWidgetWithinArea("alltabs-button", 1);
|
|
||||||
CustomizableUI.moveWidgetWithinArea("firefox-view-button", 2);
|
|
||||||
|
|
||||||
await BrowserTestUtils.switchTab(gBrowser, nonCustomizingTab);
|
|
||||||
await finishedCustomizing;
|
|
||||||
|
|
||||||
alltabsPlacement = CustomizableUI.getPlacementOfWidget("alltabs-button");
|
|
||||||
firefoxViewPlacement = CustomizableUI.getPlacementOfWidget(
|
|
||||||
"firefox-view-button"
|
|
||||||
);
|
|
||||||
is(alltabsPlacement.area, "nav-bar", "alltabs-button is in the nav-bar");
|
|
||||||
is(
|
|
||||||
firefoxViewPlacement.area,
|
|
||||||
"nav-bar",
|
|
||||||
"firefox-view-button is in the nav-bar"
|
|
||||||
);
|
|
||||||
is(
|
|
||||||
alltabsPlacement.position,
|
|
||||||
1,
|
|
||||||
"alltabs-button is in its new custom position"
|
|
||||||
);
|
|
||||||
is(
|
|
||||||
firefoxViewPlacement.position,
|
|
||||||
2,
|
|
||||||
"firefox-view-button is in its new custom position"
|
|
||||||
);
|
|
||||||
|
|
||||||
await SpecialPowers.pushPrefEnv({
|
|
||||||
set: [["sidebar.verticalTabs", false]],
|
|
||||||
});
|
|
||||||
|
|
||||||
let horizontalAlltabsPlacement =
|
|
||||||
CustomizableUI.getPlacementOfWidget("alltabs-button");
|
|
||||||
let horizontalFirefoxViewPlacement = CustomizableUI.getPlacementOfWidget(
|
|
||||||
"firefox-view-button"
|
|
||||||
);
|
|
||||||
is(
|
|
||||||
horizontalAlltabsPlacement.area,
|
|
||||||
"TabsToolbar",
|
|
||||||
"alltabs-button is in the TabsToolbar"
|
|
||||||
);
|
|
||||||
is(
|
|
||||||
horizontalFirefoxViewPlacement.area,
|
|
||||||
"TabsToolbar",
|
|
||||||
"firefox-view-button is in the TabsToolbar"
|
|
||||||
);
|
|
||||||
is(
|
|
||||||
horizontalAlltabsPlacement.position,
|
|
||||||
3,
|
|
||||||
"alltabs-button is in its default horizontal mode position"
|
|
||||||
);
|
|
||||||
is(
|
|
||||||
horizontalFirefoxViewPlacement.position,
|
|
||||||
0,
|
|
||||||
"firefox-view-button is in its default horizontal mode position"
|
|
||||||
);
|
|
||||||
|
|
||||||
// Switching from vertical to horizontal and back to vertical, the customization should be remembered
|
|
||||||
await SpecialPowers.pushPrefEnv({
|
|
||||||
set: [["sidebar.verticalTabs", true]],
|
|
||||||
});
|
|
||||||
|
|
||||||
let newAlltabsPlacement =
|
|
||||||
CustomizableUI.getPlacementOfWidget("alltabs-button");
|
|
||||||
let newFirefoxViewPlacement = CustomizableUI.getPlacementOfWidget(
|
|
||||||
"firefox-view-button"
|
|
||||||
);
|
|
||||||
is(newAlltabsPlacement.area, "nav-bar", "alltabs-button is in the nav-bar");
|
|
||||||
is(
|
|
||||||
newFirefoxViewPlacement.area,
|
|
||||||
"nav-bar",
|
|
||||||
"firefox-view-button is in the nav-bar"
|
|
||||||
);
|
|
||||||
is(
|
|
||||||
newAlltabsPlacement.position,
|
|
||||||
1,
|
|
||||||
"alltabs-button is in its new custom position"
|
|
||||||
);
|
|
||||||
is(
|
|
||||||
newFirefoxViewPlacement.position,
|
|
||||||
2,
|
|
||||||
"firefox-view-button is in its new custom position"
|
|
||||||
);
|
|
||||||
});
|
|
||||||
@@ -7,6 +7,7 @@ registerCleanupFunction(async function resetToolbar() {
|
|||||||
await CustomizableUI.reset();
|
await CustomizableUI.reset();
|
||||||
Services.prefs.clearUserPref(kPrefCustomizationState);
|
Services.prefs.clearUserPref(kPrefCustomizationState);
|
||||||
Services.prefs.clearUserPref(kPrefCustomizationHorizontalTabstrip);
|
Services.prefs.clearUserPref(kPrefCustomizationHorizontalTabstrip);
|
||||||
|
Services.prefs.clearUserPref(kPrefCustomizationVerticalNavBar);
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -17,9 +17,12 @@ function imageBufferFromDataURI(encodedImageData) {
|
|||||||
const kPrefCustomizationState = "browser.uiCustomization.state";
|
const kPrefCustomizationState = "browser.uiCustomization.state";
|
||||||
const kPrefCustomizationHorizontalTabstrip =
|
const kPrefCustomizationHorizontalTabstrip =
|
||||||
"browser.uiCustomization.horizontalTabstrip";
|
"browser.uiCustomization.horizontalTabstrip";
|
||||||
|
const kPrefCustomizationVerticalNavBar =
|
||||||
|
"browser.uiCustomization.verticalNavBar";
|
||||||
// Ensure we clear any previous uiCustomization pref values
|
// Ensure we clear any previous uiCustomization pref values
|
||||||
Services.prefs.clearUserPref(kPrefCustomizationState);
|
Services.prefs.clearUserPref(kPrefCustomizationState);
|
||||||
Services.prefs.clearUserPref(kPrefCustomizationHorizontalTabstrip);
|
Services.prefs.clearUserPref(kPrefCustomizationHorizontalTabstrip);
|
||||||
|
Services.prefs.clearUserPref(kPrefCustomizationVerticalNavBar);
|
||||||
|
|
||||||
/* global browser */
|
/* global browser */
|
||||||
const extData = {
|
const extData = {
|
||||||
|
|||||||
Reference in New Issue
Block a user