tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

browser_948985_non_removable_defaultArea.js (1588B)


      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 const kWidgetId = "test-destroy-non-removable-defaultArea";
      6 
      7 add_task(function () {
      8  let spec = {
      9    id: kWidgetId,
     10    label: "Test non-removable defaultArea re-adding.",
     11    removable: false,
     12    defaultArea: CustomizableUI.AREA_NAVBAR,
     13  };
     14  CustomizableUI.createWidget(spec);
     15  let placement = CustomizableUI.getPlacementOfWidget(kWidgetId);
     16  ok(placement, "Should have placed the widget.");
     17  is(
     18    placement && placement.area,
     19    CustomizableUI.AREA_NAVBAR,
     20    "Widget should be in navbar"
     21  );
     22  CustomizableUI.destroyWidget(kWidgetId);
     23  CustomizableUI.removeWidgetFromArea(kWidgetId);
     24 
     25  CustomizableUI.createWidget(spec);
     26  ok(placement, "Should have placed the widget.");
     27  is(
     28    placement && placement.area,
     29    CustomizableUI.AREA_NAVBAR,
     30    "Widget should be in navbar"
     31  );
     32  CustomizableUI.destroyWidget(kWidgetId);
     33  CustomizableUI.removeWidgetFromArea(kWidgetId);
     34 
     35  const kPrefCustomizationAutoAdd = "browser.uiCustomization.autoAdd";
     36  Services.prefs.setBoolPref(kPrefCustomizationAutoAdd, false);
     37  CustomizableUI.createWidget(spec);
     38  ok(placement, "Should have placed the widget.");
     39  is(
     40    placement && placement.area,
     41    CustomizableUI.AREA_NAVBAR,
     42    "Widget should be in navbar"
     43  );
     44  CustomizableUI.destroyWidget(kWidgetId);
     45  CustomizableUI.removeWidgetFromArea(kWidgetId);
     46  Services.prefs.clearUserPref(kPrefCustomizationAutoAdd);
     47 });