tor-browser

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

browser_aboutprofiling-features.js (1006B)


      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 test() {
      8  info("Test that about:profiling can be loaded, and the features changed.");
      9 
     10  ok(
     11    Services.profiler.GetFeatures().includes("js"),
     12    "This test assumes that the JavaScript feature is available on every platform."
     13  );
     14 
     15  await withAboutProfiling(async document => {
     16    const jsInput = await getNearestInputFromText(document, "JavaScript");
     17 
     18    ok(
     19      activeConfigurationHasFeature("js"),
     20      "By default, the JS feature is always enabled."
     21    );
     22    ok(jsInput.checked, "The JavaScript input is checked when enabled.");
     23 
     24    jsInput.click();
     25 
     26    ok(
     27      !activeConfigurationHasFeature("js"),
     28      "The JS feature can be toggled off."
     29    );
     30    ok(!jsInput.checked, "The JS feature's input element is also toggled off.");
     31  });
     32 });