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:
Mike Conley 2014-04-13 19:49:07 -04:00
Родитель bf5e816c4d
Коммит f6e2866184
3 изменённых файлов: 18 добавлений и 14 удалений

Просмотреть файл

@ -338,7 +338,7 @@ let CustomizableUIInternal = {
if (!areaIsKnown) {
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
// various places elsewhere.
gFuturePlacements.set(aName, new Set());

Просмотреть файл

@ -99,10 +99,10 @@ skip-if = os == "linux"
[browser_985815_propagate_setToolbarVisibility.js]
[browser_981305_separator_insertion.js]
[browser_989609_bootstrapped_custom_toolbar.js]
[browser_987177_destroyWidget_xul.js]
[browser_987177_xul_wrapper_updating.js]
[browser_987492_window_api.js]
[browser_992747_toggle_noncustomizable_toolbar.js]
[browser_993322_widget_notoolbar.js]
[browser_bootstrapped_custom_toolbar.js]
[browser_panel_toggle.js]

Просмотреть файл

@ -7,13 +7,14 @@
const kTestBarID = "testBar";
const kWidgetID = "characterencoding-button";
function createTestBar() {
function createTestBar(aLegacy) {
let testBar = document.createElement("toolbar");
testBar.id = kTestBarID;
testBar.setAttribute("customizable", "true");
CustomizableUI.registerArea(kTestBarID,
{ type: CustomizableUI.TYPE_TOOLBAR, legacy: false }
);
CustomizableUI.registerArea(kTestBarID, {
type: CustomizableUI.TYPE_TOOLBAR,
legacy: aLegacy,
});
gNavToolbox.appendChild(testBar);
return testBar;
}
@ -22,7 +23,8 @@ function createTestBar() {
* Helper function that does the following:
*
* 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
* toolbar.
* 3) Enters customize mode and makes sure that the
@ -31,15 +33,15 @@ function createTestBar() {
* the custom toolbar.
* 5) Checks that the widget has no placement.
* 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
* properly back in the toolbar.
* 8) Exits customize mode, removes and de-registers the
* toolbar, and resets the toolbars to default.
*/
function checkRestoredPresence(aWidgetID) {
function checkRestoredPresence(aWidgetID, aLegacy) {
return Task.spawn(function* () {
let testBar = createTestBar();
let testBar = createTestBar(aLegacy);
CustomizableUI.addWidgetToArea(aWidgetID, kTestBarID);
let placement = CustomizableUI.getPlacementOfWidget(aWidgetID);
is(placement.area, kTestBarID,
@ -51,7 +53,7 @@ function checkRestoredPresence(aWidgetID) {
let placement = CustomizableUI.getPlacementOfWidget(aWidgetID);
is(placement, null, "Expected " + aWidgetID + " to be in the palette");
testBar = createTestBar();
testBar = createTestBar(aLegacy);
yield startCustomizing();
let placement = CustomizableUI.getPlacementOfWidget(aWidgetID);
@ -67,9 +69,11 @@ function checkRestoredPresence(aWidgetID) {
}
add_task(function* () {
yield checkRestoredPresence("downloads-button")
yield checkRestoredPresence("downloads-button", false);
yield checkRestoredPresence("downloads-button", true);
});
add_task(function* () {
yield checkRestoredPresence("characterencoding-button")
yield checkRestoredPresence("characterencoding-button", false);
yield checkRestoredPresence("characterencoding-button", true);
});