tor-browser

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

helper-collapsibilities.js (1497B)


      1 /* Any copyright is dedicated to the Public Domain.
      2   http://creativecommons.org/publicdomain/zero/1.0/ */
      3 
      4 "use strict";
      5 
      6 const TARGET_PANES = [
      7  {
      8    title: "Temporary Extensions",
      9    pref: "devtools.aboutdebugging.collapsibilities.temporaryExtension",
     10  },
     11  {
     12    title: "Extensions",
     13    pref: "devtools.aboutdebugging.collapsibilities.installedExtension",
     14  },
     15  {
     16    title: "Tabs",
     17    pref: "devtools.aboutdebugging.collapsibilities.tab",
     18  },
     19  {
     20    title: "Service Workers",
     21    pref: "devtools.aboutdebugging.collapsibilities.serviceWorker",
     22  },
     23  {
     24    title: "Shared Workers",
     25    pref: "devtools.aboutdebugging.collapsibilities.sharedWorker",
     26  },
     27  {
     28    title: "Other Workers",
     29    pref: "devtools.aboutdebugging.collapsibilities.otherWorker",
     30  },
     31 ];
     32 /* exported TARGET_PANES */
     33 
     34 function prepareCollapsibilitiesTest() {
     35  // Make all collapsibilities to be expanded.
     36  for (const { pref } of TARGET_PANES) {
     37    Services.prefs.setBoolPref(pref, false);
     38  }
     39 }
     40 /* exported prepareCollapsibilitiesTest */
     41 
     42 async function toggleCollapsibility(debugTargetPane) {
     43  debugTargetPane.querySelector(".qa-debug-target-pane-title").click();
     44  // Wait for animation of collapse/expand.
     45  const animations = debugTargetPane.ownerDocument.getAnimations();
     46  await Promise.all(animations.map(animation => animation.finished));
     47 }
     48 /* exported toggleCollapsibility */
     49 
     50 registerCleanupFunction(() => {
     51  for (const { pref } of TARGET_PANES) {
     52    Services.prefs.clearUserPref(pref);
     53  }
     54 });