browser/components/customizableui/test/browser_877006_missing_view.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/browser/components/customizableui/test/browser_877006_missing_view.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,41 @@
     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 +// Should be able to add broken view widget
    1.11 +add_task(function testAddbrokenViewWidget() {
    1.12 +  const kWidgetId = 'test-877006-broken-widget';
    1.13 +  let widgetSpec = {
    1.14 +    id: kWidgetId,
    1.15 +    type: 'view',
    1.16 +    viewId: 'idontexist',
    1.17 +    /* Empty handler so we try to attach it maybe? */
    1.18 +    onViewShowing: function() {
    1.19 +    }
    1.20 +  };
    1.21 +
    1.22 +  let noError = true;
    1.23 +  try {
    1.24 +    CustomizableUI.createWidget(widgetSpec);
    1.25 +    CustomizableUI.addWidgetToArea(kWidgetId, CustomizableUI.AREA_NAVBAR);
    1.26 +  } catch (ex) {
    1.27 +    Cu.reportError(ex);
    1.28 +    noError = false;
    1.29 +  }
    1.30 +  ok(noError, "Should not throw an exception trying to add a broken view widget.");
    1.31 +
    1.32 +  noError = true;
    1.33 +  try {
    1.34 +    CustomizableUI.destroyWidget(kWidgetId);
    1.35 +  } catch (ex) {
    1.36 +    Cu.reportError(ex);
    1.37 +    noError = false;
    1.38 +  }
    1.39 +  ok(noError, "Should not throw an exception trying to remove the broken view widget.");
    1.40 +});
    1.41 +
    1.42 +add_task(function asyncCleanup() {
    1.43 +  yield resetCustomization();
    1.44 +});

mercurial