tor-browser

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

browser_hidden_browser_vsync.js (1458B)


      1 /* Any copyright is dedicated to the Public Domain.
      2   http://creativecommons.org/publicdomain/zero/1.0/ */
      3 
      4 "use strict";
      5 
      6 add_task(async function test_hidden_sidebar() {
      7  let b = document.createXULElement("browser");
      8  for (let [k, v] of Object.entries({
      9    type: "content",
     10    disablefullscreen: "true",
     11    disablehistory: "true",
     12    flex: "1",
     13    style: "min-width: 300px",
     14    message: "true",
     15    remote: "true",
     16    maychangeremoteness: "true",
     17  })) {
     18    b.setAttribute(k, v);
     19  }
     20  let mainBrowser = gBrowser.selectedBrowser;
     21  let panel = gBrowser.getPanel(mainBrowser);
     22  panel.append(b);
     23  let loaded = BrowserTestUtils.browserLoaded(b);
     24  BrowserTestUtils.startLoadingURIString(
     25    b,
     26    `data:text/html,<!doctype html><style>
     27  @keyframes fade-in {
     28   from {
     29     opacity: .25;
     30   }
     31   to {
     32     opacity: 1;
     33   }
     34  </style>
     35  <div style="
     36    animation-name: fade-in;
     37    animation-direction: alternate;
     38    animation-duration: 1s;
     39    animation-iteration-count: infinite;
     40    animation-timing-function: ease-in-out;
     41    background-color: red;
     42    height: 500px;
     43    width: 100%;
     44  "></div>`
     45  );
     46  await loaded;
     47  ok(b, "Browser was created.");
     48  await SpecialPowers.spawn(b, [], async () => {
     49    await new Promise(r =>
     50      content.requestAnimationFrame(() => content.requestAnimationFrame(r))
     51    );
     52  });
     53  b.hidden = true;
     54  ok(b.hidden, "Browser should be hidden.");
     55  // Now the framework will test to see vsync goes away
     56 });