зеркало из https://github.com/mozilla/gecko-dev.git
Bug 995161 - Customize mode can still break after bootstrapped add-on with custom legacy:true toolbar restarts. r=Gijs.
--HG-- rename : browser/components/customizableui/test/browser_989609_bootstrapped_custom_toolbar.js => browser/components/customizableui/test/browser_bootstrapped_custom_toolbar.js
This commit is contained in:
Родитель
bf5e816c4d
Коммит
f6e2866184
|
@ -338,7 +338,7 @@ let CustomizableUIInternal = {
|
||||||
if (!areaIsKnown) {
|
if (!areaIsKnown) {
|
||||||
gAreas.set(aName, props);
|
gAreas.set(aName, props);
|
||||||
|
|
||||||
if (props.get("legacy")) {
|
if (props.get("legacy") && !gPlacements.has(aName)) {
|
||||||
// Guarantee this area exists in gFuturePlacements, to avoid checking it in
|
// Guarantee this area exists in gFuturePlacements, to avoid checking it in
|
||||||
// various places elsewhere.
|
// various places elsewhere.
|
||||||
gFuturePlacements.set(aName, new Set());
|
gFuturePlacements.set(aName, new Set());
|
||||||
|
|
|
@ -99,10 +99,10 @@ skip-if = os == "linux"
|
||||||
|
|
||||||
[browser_985815_propagate_setToolbarVisibility.js]
|
[browser_985815_propagate_setToolbarVisibility.js]
|
||||||
[browser_981305_separator_insertion.js]
|
[browser_981305_separator_insertion.js]
|
||||||
[browser_989609_bootstrapped_custom_toolbar.js]
|
|
||||||
[browser_987177_destroyWidget_xul.js]
|
[browser_987177_destroyWidget_xul.js]
|
||||||
[browser_987177_xul_wrapper_updating.js]
|
[browser_987177_xul_wrapper_updating.js]
|
||||||
[browser_987492_window_api.js]
|
[browser_987492_window_api.js]
|
||||||
[browser_992747_toggle_noncustomizable_toolbar.js]
|
[browser_992747_toggle_noncustomizable_toolbar.js]
|
||||||
[browser_993322_widget_notoolbar.js]
|
[browser_993322_widget_notoolbar.js]
|
||||||
|
[browser_bootstrapped_custom_toolbar.js]
|
||||||
[browser_panel_toggle.js]
|
[browser_panel_toggle.js]
|
||||||
|
|
|
@ -7,13 +7,14 @@
|
||||||
const kTestBarID = "testBar";
|
const kTestBarID = "testBar";
|
||||||
const kWidgetID = "characterencoding-button";
|
const kWidgetID = "characterencoding-button";
|
||||||
|
|
||||||
function createTestBar() {
|
function createTestBar(aLegacy) {
|
||||||
let testBar = document.createElement("toolbar");
|
let testBar = document.createElement("toolbar");
|
||||||
testBar.id = kTestBarID;
|
testBar.id = kTestBarID;
|
||||||
testBar.setAttribute("customizable", "true");
|
testBar.setAttribute("customizable", "true");
|
||||||
CustomizableUI.registerArea(kTestBarID,
|
CustomizableUI.registerArea(kTestBarID, {
|
||||||
{ type: CustomizableUI.TYPE_TOOLBAR, legacy: false }
|
type: CustomizableUI.TYPE_TOOLBAR,
|
||||||
);
|
legacy: aLegacy,
|
||||||
|
});
|
||||||
gNavToolbox.appendChild(testBar);
|
gNavToolbox.appendChild(testBar);
|
||||||
return testBar;
|
return testBar;
|
||||||
}
|
}
|
||||||
|
@ -22,7 +23,8 @@ function createTestBar() {
|
||||||
* Helper function that does the following:
|
* Helper function that does the following:
|
||||||
*
|
*
|
||||||
* 1) Creates a custom toolbar and registers it
|
* 1) Creates a custom toolbar and registers it
|
||||||
* with CustomizableUI.
|
* with CustomizableUI. Sets the legacy attribute
|
||||||
|
* of the object passed to registerArea to aLegacy.
|
||||||
* 2) Adds the widget with ID aWidgetID to that new
|
* 2) Adds the widget with ID aWidgetID to that new
|
||||||
* toolbar.
|
* toolbar.
|
||||||
* 3) Enters customize mode and makes sure that the
|
* 3) Enters customize mode and makes sure that the
|
||||||
|
@ -31,15 +33,15 @@ function createTestBar() {
|
||||||
* the custom toolbar.
|
* the custom toolbar.
|
||||||
* 5) Checks that the widget has no placement.
|
* 5) Checks that the widget has no placement.
|
||||||
* 6) Re-adds and re-registers a custom toolbar with the same
|
* 6) Re-adds and re-registers a custom toolbar with the same
|
||||||
* ID as the first one.
|
* ID and options as the first one.
|
||||||
* 7) Enters customize mode and checks that the widget is
|
* 7) Enters customize mode and checks that the widget is
|
||||||
* properly back in the toolbar.
|
* properly back in the toolbar.
|
||||||
* 8) Exits customize mode, removes and de-registers the
|
* 8) Exits customize mode, removes and de-registers the
|
||||||
* toolbar, and resets the toolbars to default.
|
* toolbar, and resets the toolbars to default.
|
||||||
*/
|
*/
|
||||||
function checkRestoredPresence(aWidgetID) {
|
function checkRestoredPresence(aWidgetID, aLegacy) {
|
||||||
return Task.spawn(function* () {
|
return Task.spawn(function* () {
|
||||||
let testBar = createTestBar();
|
let testBar = createTestBar(aLegacy);
|
||||||
CustomizableUI.addWidgetToArea(aWidgetID, kTestBarID);
|
CustomizableUI.addWidgetToArea(aWidgetID, kTestBarID);
|
||||||
let placement = CustomizableUI.getPlacementOfWidget(aWidgetID);
|
let placement = CustomizableUI.getPlacementOfWidget(aWidgetID);
|
||||||
is(placement.area, kTestBarID,
|
is(placement.area, kTestBarID,
|
||||||
|
@ -51,7 +53,7 @@ function checkRestoredPresence(aWidgetID) {
|
||||||
let placement = CustomizableUI.getPlacementOfWidget(aWidgetID);
|
let placement = CustomizableUI.getPlacementOfWidget(aWidgetID);
|
||||||
is(placement, null, "Expected " + aWidgetID + " to be in the palette");
|
is(placement, null, "Expected " + aWidgetID + " to be in the palette");
|
||||||
|
|
||||||
testBar = createTestBar();
|
testBar = createTestBar(aLegacy);
|
||||||
|
|
||||||
yield startCustomizing();
|
yield startCustomizing();
|
||||||
let placement = CustomizableUI.getPlacementOfWidget(aWidgetID);
|
let placement = CustomizableUI.getPlacementOfWidget(aWidgetID);
|
||||||
|
@ -67,9 +69,11 @@ function checkRestoredPresence(aWidgetID) {
|
||||||
}
|
}
|
||||||
|
|
||||||
add_task(function* () {
|
add_task(function* () {
|
||||||
yield checkRestoredPresence("downloads-button")
|
yield checkRestoredPresence("downloads-button", false);
|
||||||
|
yield checkRestoredPresence("downloads-button", true);
|
||||||
});
|
});
|
||||||
|
|
||||||
add_task(function* () {
|
add_task(function* () {
|
||||||
yield checkRestoredPresence("characterencoding-button")
|
yield checkRestoredPresence("characterencoding-button", false);
|
||||||
});
|
yield checkRestoredPresence("characterencoding-button", true);
|
||||||
|
});
|
Загрузка…
Ссылка в новой задаче