tor-browser

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

browser_transparent.js (943B)


      1 /* Any copyright is dedicated to the Public Domain.
      2   https://creativecommons.org/publicdomain/zero/1.0/ */
      3 
      4 "use strict";
      5 
      6 function getContentCanvasBg(browser) {
      7  return SpecialPowers.spawn(browser, [], () => {
      8    return content.windowUtils.canvasBackgroundColor;
      9  });
     10 }
     11 
     12 add_task(async function test_transparent_dynamic() {
     13  await BrowserTestUtils.withNewTab(
     14    `data:text/html,hello`,
     15    async function (browser) {
     16      is(
     17        await getContentCanvasBg(browser),
     18        "rgb(255, 255, 255)",
     19        "Content bg should be white"
     20      );
     21      browser.toggleAttribute("transparent", true);
     22      is(
     23        await getContentCanvasBg(browser),
     24        "rgba(0, 0, 0, 0)",
     25        "Content bg should be transparent"
     26      );
     27      browser.toggleAttribute("transparent", false);
     28      is(
     29        await getContentCanvasBg(browser),
     30        "rgb(255, 255, 255)",
     31        "Content bg should be white again"
     32      );
     33    }
     34  );
     35 });