tor-browser

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

browser_role.js (1183B)


      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 ROLE_SYSTEM_DOCUMENT = 15;
      8 const ROLE_SYSTEM_GROUPING = 20;
      9 const IA2_ROLE_PARAGRAPH = 1054;
     10 
     11 addAccessibleTask(
     12  `
     13 <p id="p">p</p>
     14  `,
     15  async function () {
     16    let role = await runPython(`
     17      global doc
     18      doc = getDocIa2()
     19      return doc.accRole(CHILDID_SELF)
     20    `);
     21    is(role, ROLE_SYSTEM_DOCUMENT, "doc has correct MSAA role");
     22    role = await runPython(`doc.role()`);
     23    is(role, ROLE_SYSTEM_DOCUMENT, "doc has correct IA2 role");
     24    ok(
     25      await runPython(`
     26        global p
     27        p = findIa2ByDomId(doc, "p")
     28        firstChild = toIa2(doc.accChild(1))
     29        return p == firstChild
     30      `),
     31      "doc's first child is p"
     32    );
     33    role = await runPython(`p.accRole(CHILDID_SELF)`);
     34    is(role, ROLE_SYSTEM_GROUPING, "p has correct MSAA role");
     35    role = await runPython(`p.role()`);
     36    is(role, IA2_ROLE_PARAGRAPH, "p has correct IA2 role");
     37  },
     38  { chrome: true, topLevel: true, iframe: true, remoteIframe: true }
     39 );