tor-browser

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

browser_devtools-presets.js (1533B)


      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 "use strict";
      5 
      6 add_task(async function test() {
      7  info("Test that about:profiling presets configure the profiler");
      8 
      9  if (!Services.profiler.GetFeatures().includes("stackwalk")) {
     10    ok(true, "This platform does not support stackwalking, skip this test.");
     11    return;
     12  }
     13 
     14  // This test assumes that the Web Developer preset is set by default, which is
     15  // not the case on Nightly and custom builds.
     16  PrefsPresets.changePreset(
     17    "aboutprofiling",
     18    "web-developer",
     19    Services.profiler.GetFeatures()
     20  );
     21 
     22  await withDevToolsPanel(async document => {
     23    {
     24      const presets = await getNearestInputFromText(document, "Settings");
     25 
     26      is(presets.value, "web-developer", "The presets default to webdev mode.");
     27      ok(
     28        !(await devToolsActiveConfigurationHasFeature(document, "stackwalk")),
     29        "Stack walking is not used in Web Developer mode."
     30      );
     31    }
     32 
     33    {
     34      const presets = await getNearestInputFromText(document, "Settings");
     35      setReactFriendlyInputValue(presets, "firefox-platform");
     36      is(
     37        presets.value,
     38        "firefox-platform",
     39        "The preset was changed to Firefox Platform"
     40      );
     41      ok(
     42        await devToolsActiveConfigurationHasFeature(document, "stackwalk"),
     43        "Stack walking is used in Firefox Platform mode."
     44      );
     45    }
     46  });
     47 });