michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: const kWidgetId = "test-destroy-non-removable-defaultArea"; michael@0: michael@0: add_task(function() { michael@0: let spec = {id: kWidgetId, label: "Test non-removable defaultArea re-adding.", michael@0: removable: false, defaultArea: CustomizableUI.AREA_NAVBAR}; michael@0: CustomizableUI.createWidget(spec); michael@0: let placement = CustomizableUI.getPlacementOfWidget(kWidgetId); michael@0: ok(placement, "Should have placed the widget."); michael@0: is(placement && placement.area, CustomizableUI.AREA_NAVBAR, "Widget should be in navbar"); michael@0: CustomizableUI.destroyWidget(kWidgetId); michael@0: CustomizableUI.removeWidgetFromArea(kWidgetId); michael@0: michael@0: CustomizableUI.createWidget(spec); michael@0: ok(placement, "Should have placed the widget."); michael@0: is(placement && placement.area, CustomizableUI.AREA_NAVBAR, "Widget should be in navbar"); michael@0: CustomizableUI.destroyWidget(kWidgetId); michael@0: CustomizableUI.removeWidgetFromArea(kWidgetId); michael@0: michael@0: const kPrefCustomizationAutoAdd = "browser.uiCustomization.autoAdd"; michael@0: Services.prefs.setBoolPref(kPrefCustomizationAutoAdd, false); michael@0: CustomizableUI.createWidget(spec); michael@0: ok(placement, "Should have placed the widget."); michael@0: is(placement && placement.area, CustomizableUI.AREA_NAVBAR, "Widget should be in navbar"); michael@0: CustomizableUI.destroyWidget(kWidgetId); michael@0: CustomizableUI.removeWidgetFromArea(kWidgetId); michael@0: Services.prefs.clearUserPref(kPrefCustomizationAutoAdd); michael@0: }); michael@0: