tor-browser

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

browser_styleeditor_remove_stylesheet.js (1049B)


      1 /* Any copyright is dedicated to the Public Domain.
      2   http://creativecommons.org/publicdomain/zero/1.0/ */
      3 "use strict";
      4 
      5 // Test that a removed style sheet don't show up in the style editor anymore.
      6 
      7 const TESTCASE_URI = TEST_BASE_HTTPS + "simple.html";
      8 
      9 add_task(async function () {
     10  const { ui } = await openStyleEditorForURL(TESTCASE_URI);
     11 
     12  is(ui.editors.length, 2, "Two sheets present after load.");
     13 
     14  info("Removing the <style> node");
     15  const onStyleRemoved = waitFor(() => ui.editors.length == 1);
     16  await SpecialPowers.spawn(gBrowser.selectedBrowser, [], () => {
     17    content.document.querySelector("style").remove();
     18  });
     19  await onStyleRemoved;
     20  is(ui.editors.length, 1, "There's only one stylesheet remaining");
     21 
     22  info("Removing the <link> node");
     23  const onLinkRemoved = waitFor(() => !ui.editors.length);
     24  await SpecialPowers.spawn(gBrowser.selectedBrowser, [], () => {
     25    content.document.querySelector("link").remove();
     26  });
     27  await onLinkRemoved;
     28  is(ui.editors.length, 0, "There's no stylesheet displayed anymore");
     29 });