tor-browser

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

browser_bounds_change.js (1353B)


      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 const { Layout } = ChromeUtils.importESModule(
      8  "chrome://mochitests/content/browser/accessible/tests/browser/Layout.sys.mjs"
      9 );
     10 
     11 /**
     12 * Test adding children to body that recieves its own accessible.
     13 */
     14 addAccessibleTask(
     15  `
     16  <style>
     17 
     18  body {
     19    overflow: hidden;
     20  }
     21 
     22  button {
     23    display: block;
     24    height: 2em;
     25    width: 100%;
     26  }
     27 </style>
     28 `,
     29  async function (browser, docAcc) {
     30    const r = waitForEvent(EVENT_REORDER);
     31    await invokeContentTask(browser, [], () => {
     32      content.requestAnimationFrame(() => {
     33        let btn = content.document.createElement("button");
     34        btn.textContent = "hello";
     35        content.document.body.appendChild(btn);
     36      });
     37    });
     38    await r;
     39 
     40    const dpr = await getContentDPR(browser);
     41    const bodyAcc = docAcc.firstChild;
     42    is(
     43      getAccessibleDOMNodeID(bodyAcc),
     44      "body",
     45      "Doc's child is body container"
     46    );
     47    const bodyHeightNotZero = () => {
     48      let [, , , height] = Layout.getBounds(bodyAcc, dpr);
     49      info(`height: ${height}`);
     50      return height > 0;
     51    };
     52 
     53    await untilCacheOk(bodyHeightNotZero, "Body height is not 0");
     54  }
     55 );