tor-browser

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

browser_relations_domain_2.js (2713B)


      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 // Continued from browser_relations_domain_1.js.
      8 // Split up to avoid timeouts in test-verify.
      9 
     10 // RelationType::CONTROLLED_BY, CacheDomain::Relations
     11 addAccessibleTask(
     12  `
     13  <button id="controller">test</button>
     14  <output id="controlled" for="controller">test</div>
     15 `,
     16  async function (browser, docAcc) {
     17    let acc = findAccessibleChildByID(docAcc, "controlled");
     18    await testAttributeCachePresence(acc, "for", () => {
     19      acc.getRelationByType(0);
     20    });
     21  },
     22  {
     23    topLevel: true,
     24    iframe: true,
     25    remoteIframe: true,
     26    cacheDomains: CacheDomain.None,
     27  }
     28 );
     29 
     30 // RelationType::DESCRIBED_BY, CacheDomain::Relations
     31 addAccessibleTask(
     32  `
     33  <button aria-describedby="label" id="button">test</button>
     34  <label id="label">button label</label>
     35 `,
     36  async function (browser, docAcc) {
     37    let acc = findAccessibleChildByID(docAcc, "button");
     38    await testAttributeCachePresence(acc, "describedby", () => {
     39      acc.getRelationByType(0);
     40    });
     41  },
     42  {
     43    topLevel: true,
     44    iframe: true,
     45    remoteIframe: true,
     46    cacheDomains: CacheDomain.None,
     47  }
     48 );
     49 
     50 // RelationType::FLOWS_TO, CacheDomain::Relations
     51 addAccessibleTask(
     52  `
     53  <div id="flowto" aria-flowto="flowfrom">flow to</div>
     54  <div id="flowfrom">flow from</div>
     55 `,
     56  async function (browser, docAcc) {
     57    let acc = findAccessibleChildByID(docAcc, "flowto");
     58    await testAttributeCachePresence(acc, "flowto", () => {
     59      acc.getRelationByType(0);
     60    });
     61  },
     62  {
     63    topLevel: true,
     64    iframe: true,
     65    remoteIframe: true,
     66    cacheDomains: CacheDomain.None,
     67  }
     68 );
     69 
     70 // RelationType::DETAILS, CacheDomain::Relations
     71 addAccessibleTask(
     72  `
     73  <input id="has_details" aria-details="details"/>
     74  <div id="details"></div>
     75 `,
     76  async function (browser, docAcc) {
     77    let acc = findAccessibleChildByID(docAcc, "has_details");
     78    await testAttributeCachePresence(acc, "details", () => {
     79      acc.getRelationByType(0);
     80    });
     81  },
     82  {
     83    topLevel: true,
     84    iframe: true,
     85    remoteIframe: true,
     86    cacheDomains: CacheDomain.None,
     87  }
     88 );
     89 
     90 // RelationType::ERRORMSG, CacheDomain::Relations
     91 addAccessibleTask(
     92  `
     93  <input id="has_error" aria-errormessage="error">
     94  <div id="error"></div>
     95 `,
     96  async function (browser, docAcc) {
     97    let acc = findAccessibleChildByID(docAcc, "has_error");
     98    await testAttributeCachePresence(acc, "errormessage", () => {
     99      acc.getRelationByType(0);
    100    });
    101  },
    102  {
    103    topLevel: true,
    104    iframe: true,
    105    remoteIframe: true,
    106    cacheDomains: CacheDomain.None,
    107  }
    108 );