browser/components/customizableui/test/browser_941083_invalidate_wrapper_cache_createWidget.js

branch
TOR_BUG_3246
changeset 6
8bccb770b82d
equal deleted inserted replaced
-1:000000000000 0:c861f501d58f
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4
5 "use strict";
6
7 // See https://bugzilla.mozilla.org/show_bug.cgi?id=941083
8
9 const kWidgetId = "test-invalidate-wrapper-cache";
10
11 // Check createWidget invalidates the widget cache
12 add_task(function() {
13 let groupWrapper = CustomizableUI.getWidget(kWidgetId);
14 ok(groupWrapper, "Should get group wrapper.");
15 let singleWrapper = groupWrapper.forWindow(window);
16 ok(singleWrapper, "Should get single wrapper.");
17
18 CustomizableUI.createWidget({id: kWidgetId, label: "Test invalidating widgets caching"});
19
20 let newGroupWrapper = CustomizableUI.getWidget(kWidgetId);
21 ok(newGroupWrapper, "Should get a group wrapper again.");
22 isnot(newGroupWrapper, groupWrapper, "Wrappers shouldn't be the same.");
23 isnot(newGroupWrapper.provider, groupWrapper.provider, "Wrapper providers shouldn't be the same.");
24
25 let newSingleWrapper = newGroupWrapper.forWindow(window);
26 isnot(newSingleWrapper, singleWrapper, "Single wrappers shouldn't be the same.");
27 isnot(newSingleWrapper.provider, singleWrapper.provider, "Single wrapper providers shouldn't be the same.");
28
29 CustomizableUI.destroyWidget(kWidgetId);
30 ok(!CustomizableUI.getWidget(kWidgetId), "Shouldn't get a wrapper after destroying the widget.");
31 });

mercurial