tor-browser

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

browser_985815_propagate_setToolbarVisibility.js (1831B)


      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 add_task(async function () {
      8  ok(CustomizableUI.inDefaultState, "Should start in default state.");
      9  this.otherWin = await openAndLoadWindow({ private: true }, true);
     10  await startCustomizing(this.otherWin);
     11  let resetButton = this.otherWin.document.getElementById(
     12    "customization-reset-button"
     13  );
     14  ok(resetButton.disabled, "Reset button should be disabled");
     15 
     16  if (typeof CustomizableUI.setToolbarVisibility == "function") {
     17    CustomizableUI.setToolbarVisibility("PersonalToolbar", true);
     18  } else {
     19    setToolbarVisibility(document.getElementById("PersonalToolbar"), true);
     20  }
     21 
     22  let otherPersonalToolbar =
     23    this.otherWin.document.getElementById("PersonalToolbar");
     24  let personalToolbar = document.getElementById("PersonalToolbar");
     25  ok(
     26    !otherPersonalToolbar.collapsed,
     27    "Toolbar should be uncollapsed in private window"
     28  );
     29  ok(
     30    !personalToolbar.collapsed,
     31    "Toolbar should be uncollapsed in normal window"
     32  );
     33  ok(!resetButton.disabled, "Reset button should be enabled");
     34 
     35  await this.otherWin.gCustomizeMode.reset();
     36 
     37  ok(
     38    otherPersonalToolbar.collapsed,
     39    "Toolbar should be collapsed in private window"
     40  );
     41  ok(personalToolbar.collapsed, "Toolbar should be collapsed in normal window");
     42  ok(resetButton.disabled, "Reset button should be disabled");
     43 
     44  await endCustomizing(this.otherWin);
     45 
     46  await promiseWindowClosed(this.otherWin);
     47 });
     48 
     49 add_task(async function asyncCleanup() {
     50  if (this.otherWin && !this.otherWin.closed) {
     51    await promiseWindowClosed(this.otherWin);
     52  }
     53  if (!CustomizableUI.inDefaultState) {
     54    CustomizableUI.reset();
     55  }
     56 });