Backed out changeset e888096eee4b (bug 982656) for failures in browser_982656_restore_defaults_builtin_widgets.js

This commit is contained in:
Ed Morley 2014-06-10 17:13:28 +01:00
parent 2493a61193
commit 8947cb7df1
4 changed files with 7 additions and 74 deletions

View File

@ -1929,21 +1929,13 @@ let CustomizableUIInternal = {
this.notifyListeners("onWidgetCreated", widget.id);
if (widget.defaultArea) {
let addToDefaultPlacements = false;
let area = gAreas.get(widget.defaultArea);
if (widget.source == CustomizableUI.SOURCE_BUILTIN) {
addToDefaultPlacements = true;
} else if (!CustomizableUI.isBuiltinToolbar(widget.defaultArea) &&
widget.defaultArea != CustomizableUI.AREA_PANEL) {
addToDefaultPlacements = true;
}
if (addToDefaultPlacements) {
if (area.has("defaultPlacements")) {
area.get("defaultPlacements").push(widget.id);
} else {
area.set("defaultPlacements", [widget.id]);
}
//XXXgijs this won't have any effect for legacy items. Sort of OK because
// consumers can modify currentset? Maybe?
if (area.has("defaultPlacements")) {
area.get("defaultPlacements").push(widget.id);
} else {
area.set("defaultPlacements", [widget.id]);
}
}

View File

@ -665,7 +665,7 @@ CustomizeMode.prototype = {
if (customizationTarget && customizationTarget != areaNode) {
areas.push(customizationTarget.id);
}
let overflowTarget = areaNode && areaNode.getAttribute("overflowtarget");
let overflowTarget = areaNode.getAttribute("overflowtarget");
if (overflowTarget) {
areas.push(overflowTarget);
}

View File

@ -94,7 +94,6 @@ skip-if = os == "linux"
[browser_978084_dragEnd_after_move.js]
[browser_980155_add_overflow_toolbar.js]
[browser_981418-widget-onbeforecreated-handler.js]
[browser_982656_restore_defaults_builtin_widgets.js]
[browser_984455_bookmarks_items_reparenting.js]
skip-if = os == "linux"

View File

@ -1,58 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
// Restoring default should not place addon widgets back in the toolbar
add_task(function() {
ok(CustomizableUI.inDefaultState, "Default state to begin");
const kWidgetId = "bug982656-add-on-widget-should-not-restore-to-default-area";
let widgetSpec = {
id: kWidgetId,
defaultArea: CustomizableUI.AREA_NAVBAR
};
CustomizableUI.createWidget(widgetSpec);
ok(!CustomizableUI.inDefaultState, "Not in default state after widget added");
is(CustomizableUI.getPlacementOfWidget(kWidgetId).area, CustomizableUI.AREA_NAVBAR, "Widget should be in navbar");
yield resetCustomization();
ok(CustomizableUI.inDefaultState, "Back in default state after reset");
is(CustomizableUI.getPlacementOfWidget(kWidgetId), null, "Widget now in palette");
CustomizableUI.destroyWidget(kWidgetId);
});
// resetCustomization shouldn't move 3rd party widgets out of custom toolbars
add_task(function() {
const kToolbarId = "bug982656-toolbar-with-defaultset";
const kWidgetId = "bug982656-add-on-widget-should-restore-to-default-area-when-area-is-not-builtin";
ok(CustomizableUI.inDefaultState, "Everything should be in its default state.");
let toolbar = createToolbarWithPlacements(kToolbarId, [kWidgetId]);
ok(CustomizableUI.areas.indexOf(kToolbarId) != -1,
"Toolbar has been registered.");
is(CustomizableUI.getAreaType(kToolbarId), CustomizableUI.TYPE_TOOLBAR,
"Area should be registered as toolbar");
let widgetSpec = {
id: kWidgetId,
defaultArea: kToolbarId
};
CustomizableUI.createWidget(widgetSpec);
ok(!CustomizableUI.inDefaultState, "No longer in default state after toolbar is registered and visible.");
is(CustomizableUI.getPlacementOfWidget(kWidgetId).area, kToolbarId, "Widget should be in custom toolbar");
yield resetCustomization();
debugger;
ok(CustomizableUI.inDefaultState, "Back in default state after reset");
is(CustomizableUI.getPlacementOfWidget(kWidgetId).area, kToolbarId, "Widget still in custom toolbar");
ok(toolbar.collapsed, "Custom toolbar should be collapsed after reset");
toolbar.remove();
CustomizableUI.destroyWidget(kWidgetId);
CustomizableUI.unregisterArea(kToolbarId);
});