1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/browser/components/customizableui/test/browser_945739_showInPrivateBrowsing_customize_mode.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,35 @@ 1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.7 + 1.8 +"use strict"; 1.9 + 1.10 +const kWidgetId = "test-private-browsing-customize-mode-widget"; 1.11 + 1.12 +// Add a widget via the API with showInPrivateBrowsing set to false 1.13 +// and ensure it does not appear in the list of unused widgets in private 1.14 +// windows. 1.15 +add_task(function testPrivateBrowsingCustomizeModeWidget() { 1.16 + CustomizableUI.createWidget({ 1.17 + id: kWidgetId, 1.18 + showInPrivateBrowsing: false 1.19 + }); 1.20 + 1.21 + let normalWidgetArray = CustomizableUI.getUnusedWidgets(gNavToolbox.palette); 1.22 + normalWidgetArray = normalWidgetArray.map((w) => w.id); 1.23 + ok(normalWidgetArray.indexOf(kWidgetId) > -1, 1.24 + "Widget should appear as unused in non-private window"); 1.25 + 1.26 + let privateWindow = yield openAndLoadWindow({private: true}); 1.27 + let privateWidgetArray = CustomizableUI.getUnusedWidgets(privateWindow.gNavToolbox.palette); 1.28 + privateWidgetArray = privateWidgetArray.map((w) => w.id); 1.29 + is(privateWidgetArray.indexOf(kWidgetId), -1, 1.30 + "Widget should not appear as unused in private window"); 1.31 + yield promiseWindowClosed(privateWindow); 1.32 + 1.33 + CustomizableUI.destroyWidget(kWidgetId); 1.34 +}); 1.35 + 1.36 +add_task(function asyncCleanup() { 1.37 + yield resetCustomization(); 1.38 +});