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: "use strict"; michael@0: michael@0: const kWidgetId = "test-private-browsing-customize-mode-widget"; michael@0: michael@0: // Add a widget via the API with showInPrivateBrowsing set to false michael@0: // and ensure it does not appear in the list of unused widgets in private michael@0: // windows. michael@0: add_task(function testPrivateBrowsingCustomizeModeWidget() { michael@0: CustomizableUI.createWidget({ michael@0: id: kWidgetId, michael@0: showInPrivateBrowsing: false michael@0: }); michael@0: michael@0: let normalWidgetArray = CustomizableUI.getUnusedWidgets(gNavToolbox.palette); michael@0: normalWidgetArray = normalWidgetArray.map((w) => w.id); michael@0: ok(normalWidgetArray.indexOf(kWidgetId) > -1, michael@0: "Widget should appear as unused in non-private window"); michael@0: michael@0: let privateWindow = yield openAndLoadWindow({private: true}); michael@0: let privateWidgetArray = CustomizableUI.getUnusedWidgets(privateWindow.gNavToolbox.palette); michael@0: privateWidgetArray = privateWidgetArray.map((w) => w.id); michael@0: is(privateWidgetArray.indexOf(kWidgetId), -1, michael@0: "Widget should not appear as unused in private window"); michael@0: yield promiseWindowClosed(privateWindow); michael@0: michael@0: CustomizableUI.destroyWidget(kWidgetId); michael@0: }); michael@0: michael@0: add_task(function asyncCleanup() { michael@0: yield resetCustomization(); michael@0: });