Backed out changeset b44ee81f22b7 (bug 1880230) for causing bc failures in browser_privatebrowsing_resetPBM.js CLOSED TREE
This commit is contained in:
@@ -1178,10 +1178,6 @@ var CustomizableUIInternal = {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!inPrivateWindow && widget?.hideInNonPrivateBrowsing) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.ensureButtonContextMenu(node, aAreaNode);
|
this.ensureButtonContextMenu(node, aAreaNode);
|
||||||
|
|
||||||
// This needs updating in case we're resetting / undoing a reset.
|
// This needs updating in case we're resetting / undoing a reset.
|
||||||
@@ -1414,8 +1410,6 @@ var CustomizableUIInternal = {
|
|||||||
let showInPrivateBrowsing = gPalette.has(aWidgetId)
|
let showInPrivateBrowsing = gPalette.has(aWidgetId)
|
||||||
? gPalette.get(aWidgetId).showInPrivateBrowsing
|
? gPalette.get(aWidgetId).showInPrivateBrowsing
|
||||||
: true;
|
: true;
|
||||||
let hideInNonPrivateBrowsing =
|
|
||||||
gPalette.get(aWidgetId)?.hideInNonPrivateBrowsing ?? false;
|
|
||||||
|
|
||||||
for (let areaNode of areaNodes) {
|
for (let areaNode of areaNodes) {
|
||||||
let window = areaNode.ownerGlobal;
|
let window = areaNode.ownerGlobal;
|
||||||
@@ -1426,13 +1420,6 @@ var CustomizableUIInternal = {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
|
||||||
hideInNonPrivateBrowsing &&
|
|
||||||
!lazy.PrivateBrowsingUtils.isWindowPrivate(window)
|
|
||||||
) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
let container = this.getCustomizationTarget(areaNode);
|
let container = this.getCustomizationTarget(areaNode);
|
||||||
let widgetNode = window.document.getElementById(aWidgetId);
|
let widgetNode = window.document.getElementById(aWidgetId);
|
||||||
if (widgetNode && isOverflowable) {
|
if (widgetNode && isOverflowable) {
|
||||||
@@ -1610,8 +1597,6 @@ var CustomizableUIInternal = {
|
|||||||
let showInPrivateBrowsing = gPalette.has(aWidgetId)
|
let showInPrivateBrowsing = gPalette.has(aWidgetId)
|
||||||
? gPalette.get(aWidgetId).showInPrivateBrowsing
|
? gPalette.get(aWidgetId).showInPrivateBrowsing
|
||||||
: true;
|
: true;
|
||||||
let hideInNonPrivateBrowsing =
|
|
||||||
gPalette.get(aWidgetId)?.hideInNonPrivateBrowsing ?? false;
|
|
||||||
|
|
||||||
if (
|
if (
|
||||||
!showInPrivateBrowsing &&
|
!showInPrivateBrowsing &&
|
||||||
@@ -1620,13 +1605,6 @@ var CustomizableUIInternal = {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
|
||||||
hideInNonPrivateBrowsing &&
|
|
||||||
!lazy.PrivateBrowsingUtils.isWindowPrivate(window)
|
|
||||||
) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
let [, widgetNode] = this.getWidgetNode(aWidgetId, window);
|
let [, widgetNode] = this.getWidgetNode(aWidgetId, window);
|
||||||
if (!widgetNode) {
|
if (!widgetNode) {
|
||||||
lazy.log.error("Widget '" + aWidgetId + "' not found, unable to move");
|
lazy.log.error("Widget '" + aWidgetId + "' not found, unable to move");
|
||||||
@@ -1888,12 +1866,6 @@ var CustomizableUIInternal = {
|
|||||||
) {
|
) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if (
|
|
||||||
aWidget.hideInNonPrivateBrowsing &&
|
|
||||||
!lazy.PrivateBrowsingUtils.isWindowPrivate(aDocument.defaultView)
|
|
||||||
) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
lazy.log.debug("Building " + aWidget.id + " of type " + aWidget.type);
|
lazy.log.debug("Building " + aWidget.id + " of type " + aWidget.type);
|
||||||
|
|
||||||
@@ -2392,10 +2364,7 @@ var CustomizableUIInternal = {
|
|||||||
// gPalette.
|
// gPalette.
|
||||||
for (let [id, widget] of gPalette) {
|
for (let [id, widget] of gPalette) {
|
||||||
if (!widget.currentArea) {
|
if (!widget.currentArea) {
|
||||||
if (
|
if (widget.showInPrivateBrowsing || !isWindowPrivate) {
|
||||||
(isWindowPrivate && widget.showInPrivateBrowsing) ||
|
|
||||||
(!isWindowPrivate && !widget.hideInNonPrivateBrowsing)
|
|
||||||
) {
|
|
||||||
widgets.add(id);
|
widgets.add(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3022,7 +2991,6 @@ var CustomizableUIInternal = {
|
|||||||
tooltiptext: null,
|
tooltiptext: null,
|
||||||
l10nId: null,
|
l10nId: null,
|
||||||
showInPrivateBrowsing: true,
|
showInPrivateBrowsing: true,
|
||||||
hideInNonPrivateBrowsing: false,
|
|
||||||
_introducedInVersion: -1,
|
_introducedInVersion: -1,
|
||||||
_introducedByPref: null,
|
_introducedByPref: null,
|
||||||
keepBroadcastAttributesWhenCustomizing: false,
|
keepBroadcastAttributesWhenCustomizing: false,
|
||||||
@@ -3065,7 +3033,6 @@ var CustomizableUIInternal = {
|
|||||||
const kOptBoolProps = [
|
const kOptBoolProps = [
|
||||||
"removable",
|
"removable",
|
||||||
"showInPrivateBrowsing",
|
"showInPrivateBrowsing",
|
||||||
"hideInNonPrivateBrowsing",
|
|
||||||
"overflows",
|
"overflows",
|
||||||
"tabSpecific",
|
"tabSpecific",
|
||||||
"locationSpecific",
|
"locationSpecific",
|
||||||
@@ -3600,12 +3567,7 @@ var CustomizableUIInternal = {
|
|||||||
// that are present. This avoids including items that don't exist (e.g. ids
|
// that are present. This avoids including items that don't exist (e.g. ids
|
||||||
// of add-on items that the user has uninstalled).
|
// of add-on items that the user has uninstalled).
|
||||||
let orderedPlacements = CustomizableUI.getWidgetIdsInArea(container.id);
|
let orderedPlacements = CustomizableUI.getWidgetIdsInArea(container.id);
|
||||||
return orderedPlacements.filter(w => {
|
return orderedPlacements.filter(w => currentWidgets.has(w));
|
||||||
return (
|
|
||||||
currentWidgets.has(w) ||
|
|
||||||
this.getWidgetProvider(w) == CustomizableUI.PROVIDER_API
|
|
||||||
);
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
|
|
||||||
get inDefaultState() {
|
get inDefaultState() {
|
||||||
@@ -4247,8 +4209,6 @@ export var CustomizableUI = {
|
|||||||
* as the "$shortcut" variable to the fluent message.
|
* as the "$shortcut" variable to the fluent message.
|
||||||
* - showInPrivateBrowsing: whether to show the widget in private browsing
|
* - showInPrivateBrowsing: whether to show the widget in private browsing
|
||||||
* mode (optional, default: true)
|
* mode (optional, default: true)
|
||||||
* - hideInNonPrivateBrowsing: whether to hide the widget in non private
|
|
||||||
* browsing mode windows (optional, default: false)
|
|
||||||
* - tabSpecific: If true, closes the panel if the tab changes.
|
* - tabSpecific: If true, closes the panel if the tab changes.
|
||||||
* - locationSpecific: If true, closes the panel if the location changes.
|
* - locationSpecific: If true, closes the panel if the location changes.
|
||||||
* This is similar to tabSpecific, but also if the location
|
* This is similar to tabSpecific, but also if the location
|
||||||
@@ -4303,8 +4263,6 @@ export var CustomizableUI = {
|
|||||||
* - tooltiptext: for API-provided widgets, the tooltip of the widget;
|
* - tooltiptext: for API-provided widgets, the tooltip of the widget;
|
||||||
* - showInPrivateBrowsing: for API-provided widgets, whether the widget is
|
* - showInPrivateBrowsing: for API-provided widgets, whether the widget is
|
||||||
* visible in private browsing;
|
* visible in private browsing;
|
||||||
* - hideInNonPrivateBrowsing: for API-provided widgets, whether the widget is
|
|
||||||
* hidden in non-private browsing;
|
|
||||||
*
|
*
|
||||||
* Single window wrappers obtained through forWindow(someWindow) or from the
|
* Single window wrappers obtained through forWindow(someWindow) or from the
|
||||||
* instances array have the following properties
|
* instances array have the following properties
|
||||||
@@ -5011,7 +4969,6 @@ function WidgetGroupWrapper(aWidget) {
|
|||||||
"label",
|
"label",
|
||||||
"tooltiptext",
|
"tooltiptext",
|
||||||
"showInPrivateBrowsing",
|
"showInPrivateBrowsing",
|
||||||
"hideInNonPrivateBrowsing",
|
|
||||||
"viewId",
|
"viewId",
|
||||||
"disallowSubView",
|
"disallowSubView",
|
||||||
"webExtension",
|
"webExtension",
|
||||||
|
|||||||
@@ -43,8 +43,6 @@ tags = "overflowable-toolbar"
|
|||||||
# MacOS builds in browser_876926_customize_mode_wrapping.js
|
# MacOS builds in browser_876926_customize_mode_wrapping.js
|
||||||
skip-if = ["os == 'mac' && debug"]
|
skip-if = ["os == 'mac' && debug"]
|
||||||
|
|
||||||
["browser_1880230_hideInNonPrivateBrowsing.js"]
|
|
||||||
|
|
||||||
["browser_694291_searchbar_preference.js"]
|
["browser_694291_searchbar_preference.js"]
|
||||||
|
|
||||||
["browser_873501_handle_specials.js"]
|
["browser_873501_handle_specials.js"]
|
||||||
|
|||||||
@@ -1,172 +0,0 @@
|
|||||||
/* Any copyright is dedicated to the Public Domain.
|
|
||||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
|
||||||
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
const kWidgetId = "pbm-only-test-widget";
|
|
||||||
|
|
||||||
function assertWidgetExists(aWindow, aExists) {
|
|
||||||
if (aExists) {
|
|
||||||
ok(
|
|
||||||
aWindow.document.getElementById(kWidgetId),
|
|
||||||
"Should have found test widget in the window"
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
is(
|
|
||||||
aWindow.document.getElementById(kWidgetId),
|
|
||||||
null,
|
|
||||||
"Should not have found test widget in the window"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// A widget that is created with hideInNonPrivateBrowsing undefined should
|
|
||||||
// have that value default to false.
|
|
||||||
add_task(function () {
|
|
||||||
let wrapper = CustomizableUI.createWidget({
|
|
||||||
id: kWidgetId,
|
|
||||||
});
|
|
||||||
ok(
|
|
||||||
!wrapper.hideInNonPrivateBrowsing,
|
|
||||||
"hideInNonPrivateBrowsing should have defaulted to false."
|
|
||||||
);
|
|
||||||
CustomizableUI.destroyWidget(kWidgetId);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Add a widget via the API with hideInNonPrivateBrowsing set to true
|
|
||||||
// and ensure it does not appear in pre-existing or newly created
|
|
||||||
// non-private windows.
|
|
||||||
add_task(async function () {
|
|
||||||
let plain1 = await openAndLoadWindow();
|
|
||||||
let private1 = await openAndLoadWindow({ private: true });
|
|
||||||
CustomizableUI.createWidget({
|
|
||||||
id: kWidgetId,
|
|
||||||
removable: true,
|
|
||||||
hideInNonPrivateBrowsing: true,
|
|
||||||
});
|
|
||||||
CustomizableUI.addWidgetToArea(kWidgetId, CustomizableUI.AREA_NAVBAR);
|
|
||||||
assertWidgetExists(plain1, false);
|
|
||||||
assertWidgetExists(private1, true);
|
|
||||||
|
|
||||||
// Now open up some new windows. The widget should not exist in the new
|
|
||||||
// plain window, but exist in the new private window.
|
|
||||||
let plain2 = await openAndLoadWindow();
|
|
||||||
let private2 = await openAndLoadWindow({ private: true });
|
|
||||||
assertWidgetExists(plain2, false);
|
|
||||||
assertWidgetExists(private2, true);
|
|
||||||
|
|
||||||
// Try moving the widget around and make sure it doesn't get added
|
|
||||||
// to the non-private windows. We'll start by appending it to the tabstrip.
|
|
||||||
CustomizableUI.addWidgetToArea(kWidgetId, CustomizableUI.AREA_TABSTRIP);
|
|
||||||
assertWidgetExists(plain1, false);
|
|
||||||
assertWidgetExists(plain2, false);
|
|
||||||
assertWidgetExists(private1, true);
|
|
||||||
assertWidgetExists(private2, true);
|
|
||||||
|
|
||||||
// And then move it to the beginning of the tabstrip.
|
|
||||||
CustomizableUI.moveWidgetWithinArea(kWidgetId, 0);
|
|
||||||
assertWidgetExists(plain1, false);
|
|
||||||
assertWidgetExists(plain2, false);
|
|
||||||
assertWidgetExists(private1, true);
|
|
||||||
assertWidgetExists(private2, true);
|
|
||||||
|
|
||||||
CustomizableUI.removeWidgetFromArea(kWidgetId);
|
|
||||||
assertWidgetExists(plain1, false);
|
|
||||||
assertWidgetExists(plain2, false);
|
|
||||||
assertWidgetExists(private1, false);
|
|
||||||
assertWidgetExists(private2, false);
|
|
||||||
|
|
||||||
await Promise.all(
|
|
||||||
[plain1, plain2, private1, private2].map(promiseWindowClosed)
|
|
||||||
);
|
|
||||||
|
|
||||||
CustomizableUI.destroyWidget(kWidgetId);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Add a widget via the API with hideInNonPrivateBrowsing set to false,
|
|
||||||
// and ensure that it appears in pre-existing or newly created
|
|
||||||
// private browsing windows.
|
|
||||||
add_task(async function () {
|
|
||||||
let plain1 = await openAndLoadWindow();
|
|
||||||
let private1 = await openAndLoadWindow({ private: true });
|
|
||||||
|
|
||||||
CustomizableUI.createWidget({
|
|
||||||
id: kWidgetId,
|
|
||||||
removable: true,
|
|
||||||
hideInNonPrivateBrowsing: false,
|
|
||||||
});
|
|
||||||
CustomizableUI.addWidgetToArea(kWidgetId, CustomizableUI.AREA_NAVBAR);
|
|
||||||
assertWidgetExists(plain1, true);
|
|
||||||
assertWidgetExists(private1, true);
|
|
||||||
|
|
||||||
// Now open up some new windows. The widget should exist in the new
|
|
||||||
// plain window, but not the new private window.
|
|
||||||
let plain2 = await openAndLoadWindow();
|
|
||||||
let private2 = await openAndLoadWindow({ private: true });
|
|
||||||
|
|
||||||
assertWidgetExists(plain2, true);
|
|
||||||
assertWidgetExists(private2, true);
|
|
||||||
|
|
||||||
// Try moving the widget around and make sure it doesn't get added
|
|
||||||
// to the private windows. We'll start by appending it to the tabstrip.
|
|
||||||
CustomizableUI.addWidgetToArea(kWidgetId, CustomizableUI.AREA_TABSTRIP);
|
|
||||||
assertWidgetExists(plain1, true);
|
|
||||||
assertWidgetExists(plain2, true);
|
|
||||||
assertWidgetExists(private1, true);
|
|
||||||
assertWidgetExists(private2, true);
|
|
||||||
|
|
||||||
// And then move it to the beginning of the tabstrip.
|
|
||||||
CustomizableUI.moveWidgetWithinArea(kWidgetId, 0);
|
|
||||||
assertWidgetExists(plain1, true);
|
|
||||||
assertWidgetExists(plain2, true);
|
|
||||||
assertWidgetExists(private1, true);
|
|
||||||
assertWidgetExists(private2, true);
|
|
||||||
|
|
||||||
CustomizableUI.removeWidgetFromArea(kWidgetId);
|
|
||||||
assertWidgetExists(plain1, false);
|
|
||||||
assertWidgetExists(plain2, false);
|
|
||||||
assertWidgetExists(private1, false);
|
|
||||||
assertWidgetExists(private2, false);
|
|
||||||
|
|
||||||
await Promise.all(
|
|
||||||
[plain1, plain2, private1, private2].map(promiseWindowClosed)
|
|
||||||
);
|
|
||||||
|
|
||||||
CustomizableUI.destroyWidget(kWidgetId);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Add a widget via the API with hideInNonPrivateBrowsing set to true
|
|
||||||
// and ensure it does not appear in the list of unused widgets in private
|
|
||||||
// windows.
|
|
||||||
add_task(async function testPrivateBrowsingCustomizeModeWidget() {
|
|
||||||
CustomizableUI.createWidget({
|
|
||||||
id: kWidgetId,
|
|
||||||
hideInNonPrivateBrowsing: true,
|
|
||||||
});
|
|
||||||
|
|
||||||
let normalWidgetArray = CustomizableUI.getUnusedWidgets(gNavToolbox.palette);
|
|
||||||
normalWidgetArray = normalWidgetArray.map(w => w.id);
|
|
||||||
is(
|
|
||||||
normalWidgetArray.indexOf(kWidgetId),
|
|
||||||
-1,
|
|
||||||
"Widget should not appear as unused in non-private window"
|
|
||||||
);
|
|
||||||
|
|
||||||
let privateWindow = await openAndLoadWindow({ private: true });
|
|
||||||
let privateWidgetArray = CustomizableUI.getUnusedWidgets(
|
|
||||||
privateWindow.gNavToolbox.palette
|
|
||||||
);
|
|
||||||
privateWidgetArray = privateWidgetArray.map(w => w.id);
|
|
||||||
Assert.greater(
|
|
||||||
privateWidgetArray.indexOf(kWidgetId),
|
|
||||||
-1,
|
|
||||||
"Widget should appear as unused in private window"
|
|
||||||
);
|
|
||||||
await promiseWindowClosed(privateWindow);
|
|
||||||
|
|
||||||
CustomizableUI.destroyWidget(kWidgetId);
|
|
||||||
});
|
|
||||||
|
|
||||||
add_task(async function asyncCleanup() {
|
|
||||||
await resetCustomization();
|
|
||||||
});
|
|
||||||
@@ -20,8 +20,6 @@ add_task(async function () {
|
|||||||
ok(CustomizableUI.inDefaultState, "Should start in default state.");
|
ok(CustomizableUI.inDefaultState, "Should start in default state.");
|
||||||
let navbarTarget = CustomizableUI.getCustomizationTarget(navbar);
|
let navbarTarget = CustomizableUI.getCustomizationTarget(navbar);
|
||||||
let oldChildCount = navbarTarget.childElementCount;
|
let oldChildCount = navbarTarget.childElementCount;
|
||||||
let placements = [...navbarTarget.children].map(node => node.id);
|
|
||||||
|
|
||||||
window.resizeTo(kForceOverflowWidthPx, window.outerHeight);
|
window.resizeTo(kForceOverflowWidthPx, window.outerHeight);
|
||||||
await TestUtils.waitForCondition(
|
await TestUtils.waitForCondition(
|
||||||
() => navbar.hasAttribute("overflowing"),
|
() => navbar.hasAttribute("overflowing"),
|
||||||
@@ -53,6 +51,9 @@ add_task(async function () {
|
|||||||
|
|
||||||
// Verify actual physical placements match those of the placement array:
|
// Verify actual physical placements match those of the placement array:
|
||||||
let placementCounter = 0;
|
let placementCounter = 0;
|
||||||
|
let placements = CustomizableUI.getWidgetIdsInArea(
|
||||||
|
CustomizableUI.AREA_NAVBAR
|
||||||
|
);
|
||||||
for (let node of navbarTarget.children) {
|
for (let node of navbarTarget.children) {
|
||||||
if (node.getAttribute("skipintoolbarset") == "true") {
|
if (node.getAttribute("skipintoolbarset") == "true") {
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
@@ -48,7 +48,6 @@ export const ResetPBMPanel = {
|
|||||||
onViewHiding(aEvent) {
|
onViewHiding(aEvent) {
|
||||||
ResetPBMPanel.onViewHiding(aEvent);
|
ResetPBMPanel.onViewHiding(aEvent);
|
||||||
},
|
},
|
||||||
hideInNonPrivateBrowsing: true,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
if (this._enabled) {
|
if (this._enabled) {
|
||||||
|
|||||||
@@ -192,6 +192,10 @@
|
|||||||
|
|
||||||
#reset-pbm-toolbar-button {
|
#reset-pbm-toolbar-button {
|
||||||
list-style-image: url("chrome://browser/skin/flame.svg");
|
list-style-image: url("chrome://browser/skin/flame.svg");
|
||||||
|
|
||||||
|
:root:not([privatebrowsingmode]) & {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#email-link-button {
|
#email-link-button {
|
||||||
|
|||||||
Reference in New Issue
Block a user