tor-browser

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

browser_net_columns_pref.js (1635B)


      1 /* Any copyright is dedicated to the Public Domain.
      2   http://creativecommons.org/publicdomain/zero/1.0/ */
      3 
      4 "use strict";
      5 
      6 /**
      7 * Tests if visible columns are properly saved. Note that the column
      8 * header is visible only if there are requests in the list.
      9 */
     10 
     11 add_task(async function () {
     12  Services.prefs.setCharPref(
     13    "devtools.netmonitor.visibleColumns",
     14    '["status", "contentSize", "waterfall"]'
     15  );
     16 
     17  const { monitor } = await initNetMonitor(SIMPLE_URL, {
     18    requestCount: 1,
     19  });
     20  info("Starting test... ");
     21 
     22  const { document, store, windowRequire } = monitor.panelWin;
     23  const Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
     24  store.dispatch(Actions.batchEnable(false));
     25 
     26  const wait = waitForNetworkEvents(monitor, 1);
     27  await reloadBrowser();
     28  await wait;
     29 
     30  ok(
     31    document.querySelector("#requests-list-status-button"),
     32    "Status column should be shown"
     33  );
     34  ok(
     35    document.querySelector("#requests-list-contentSize-button"),
     36    "Content size column should be shown"
     37  );
     38 
     39  await hideColumn(monitor, "status");
     40  await hideColumn(monitor, "contentSize");
     41 
     42  let visibleColumns = JSON.parse(
     43    Services.prefs.getCharPref("devtools.netmonitor.visibleColumns")
     44  );
     45 
     46  ok(!visibleColumns.includes("status"), "Pref should be synced for status");
     47  ok(
     48    !visibleColumns.includes("contentSize"),
     49    "Pref should be synced for contentSize"
     50  );
     51 
     52  await showColumn(monitor, "status");
     53 
     54  visibleColumns = JSON.parse(
     55    Services.prefs.getCharPref("devtools.netmonitor.visibleColumns")
     56  );
     57 
     58  ok(visibleColumns.includes("status"), "Pref should be synced for status");
     59 });