browser/components/customizableui/test/browser_877006_missing_view.js

Fri, 16 Jan 2015 18:13:44 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Fri, 16 Jan 2015 18:13:44 +0100
branch
TOR_BUG_9701
changeset 14
925c144e1f1f
permissions
-rw-r--r--

Integrate suggestion from review to improve consistency with existing code.

     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/. */
     5 "use strict";
     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   };
    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.");
    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 });
    39 add_task(function asyncCleanup() {
    40   yield resetCustomization();
    41 });

mercurial