|
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 // Should be able to add broken view widget |
|
8 add_task(function testAddbrokenViewWidget() { |
|
9 const kWidgetId = 'test-877006-broken-widget'; |
|
10 let widgetSpec = { |
|
11 id: kWidgetId, |
|
12 type: 'view', |
|
13 viewId: 'idontexist', |
|
14 /* Empty handler so we try to attach it maybe? */ |
|
15 onViewShowing: function() { |
|
16 } |
|
17 }; |
|
18 |
|
19 let noError = true; |
|
20 try { |
|
21 CustomizableUI.createWidget(widgetSpec); |
|
22 CustomizableUI.addWidgetToArea(kWidgetId, CustomizableUI.AREA_NAVBAR); |
|
23 } catch (ex) { |
|
24 Cu.reportError(ex); |
|
25 noError = false; |
|
26 } |
|
27 ok(noError, "Should not throw an exception trying to add a broken view widget."); |
|
28 |
|
29 noError = true; |
|
30 try { |
|
31 CustomizableUI.destroyWidget(kWidgetId); |
|
32 } catch (ex) { |
|
33 Cu.reportError(ex); |
|
34 noError = false; |
|
35 } |
|
36 ok(noError, "Should not throw an exception trying to remove the broken view widget."); |
|
37 }); |
|
38 |
|
39 add_task(function asyncCleanup() { |
|
40 yield resetCustomization(); |
|
41 }); |