tor-browser

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

browser_bounds_domain.js (2403B)


      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 // CacheDomain::Bounds, CacheKey::CrossDocOffset
      8 addAccessibleTask(
      9  `<div id="test">test</div>`,
     10  async function (browser, _, docAcc) {
     11    // Translate the iframe, which should modify cross-process offset.
     12    info("Setting the transform on the iframe");
     13    await SpecialPowers.spawn(browser, [DEFAULT_IFRAME_ID], iframeID => {
     14      let elm = content.document.getElementById(iframeID);
     15      elm.style.transform = "translate(100px,100px)";
     16    });
     17    await waitForContentPaint(browser);
     18 
     19    let acc = findAccessibleChildByID(docAcc, DEFAULT_IFRAME_ID);
     20    await testAttributeCachePresence(acc, "crossorigin", () => {
     21      // Querying bounds queries the CrossDocOffset info.
     22      acc.getBounds({}, {}, {}, {});
     23    });
     24  },
     25  {
     26    topLevel: false,
     27    iframe: true,
     28    remoteIframe: true,
     29    cacheDomains: CacheDomain.None,
     30  }
     31 );
     32 
     33 // CacheKey::IsClipped, CacheDomain::Bounds
     34 addAccessibleTask(
     35  `<div id="generic"><span aria-hidden="true" id="visible">Mozilla</span><span id="invisible" style="display: block !important;border: 0 !important;clip: rect(0 0 0 0) !important;height: 1px !important;margin: -1px !important;overflow: hidden !important;padding: 0 !important;position: absolute !important;white-space: nowrap !important;width: 1px !important;">Mozilla</span><br>I am some other text</div>`,
     36  async function (browser, docAcc) {
     37    let acc = findAccessibleChildByID(docAcc, "invisible");
     38    await testAttributeCachePresence(acc, "clip-rule", () => {
     39      // Querying bounds queries the IsClipped info.
     40      acc.getBounds({}, {}, {}, {});
     41    });
     42  },
     43  {
     44    topLevel: true,
     45    iframe: true,
     46    remoteIframe: true,
     47    cacheDomains: CacheDomain.None,
     48  }
     49 );
     50 
     51 // CacheKey::ParentRelativeBounds, CacheDomain::Bounds
     52 addAccessibleTask(
     53  `<br><div id="test">test</div>`,
     54  async function (browser, docAcc) {
     55    let acc = findAccessibleChildByID(docAcc, "test");
     56    await testAttributeCachePresence(acc, "relative-bounds", () => {
     57      // Querying bounds queries the ParentRelativeBounds info.
     58      acc.getBounds({}, {}, {}, {});
     59    });
     60  },
     61  {
     62    topLevel: true,
     63    iframe: true,
     64    remoteIframe: true,
     65    cacheDomains: CacheDomain.None,
     66  }
     67 );