browser_877006_missing_view.js (1157B)
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() {}, 16 }; 17 18 let noError = true; 19 try { 20 CustomizableUI.createWidget(widgetSpec); 21 CustomizableUI.addWidgetToArea(kWidgetId, CustomizableUI.AREA_NAVBAR); 22 } catch (ex) { 23 console.error(ex); 24 noError = false; 25 } 26 ok( 27 noError, 28 "Should not throw an exception trying to add a broken view widget." 29 ); 30 31 noError = true; 32 try { 33 CustomizableUI.destroyWidget(kWidgetId); 34 } catch (ex) { 35 console.error(ex); 36 noError = false; 37 } 38 ok( 39 noError, 40 "Should not throw an exception trying to remove the broken view widget." 41 ); 42 }); 43 44 add_task(async function asyncCleanup() { 45 await resetCustomization(); 46 });