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: // Should be able to add broken view widget michael@0: add_task(function testAddbrokenViewWidget() { michael@0: const kWidgetId = 'test-877006-broken-widget'; michael@0: let widgetSpec = { michael@0: id: kWidgetId, michael@0: type: 'view', michael@0: viewId: 'idontexist', michael@0: /* Empty handler so we try to attach it maybe? */ michael@0: onViewShowing: function() { michael@0: } michael@0: }; michael@0: michael@0: let noError = true; michael@0: try { michael@0: CustomizableUI.createWidget(widgetSpec); michael@0: CustomizableUI.addWidgetToArea(kWidgetId, CustomizableUI.AREA_NAVBAR); michael@0: } catch (ex) { michael@0: Cu.reportError(ex); michael@0: noError = false; michael@0: } michael@0: ok(noError, "Should not throw an exception trying to add a broken view widget."); michael@0: michael@0: noError = true; michael@0: try { michael@0: CustomizableUI.destroyWidget(kWidgetId); michael@0: } catch (ex) { michael@0: Cu.reportError(ex); michael@0: noError = false; michael@0: } michael@0: ok(noError, "Should not throw an exception trying to remove the broken view widget."); michael@0: }); michael@0: michael@0: add_task(function asyncCleanup() { michael@0: yield resetCustomization(); michael@0: });