tor-browser

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

browser_role.js (874B)


      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 ATSPI_ROLE_DOCUMENT_WEB = 95;
      8 const ATSPI_ROLE_PARAGRAPH = 73;
      9 
     10 addAccessibleTask(
     11  `
     12 <p id="p">p</p>
     13  `,
     14  async function () {
     15    let role = await runPython(`
     16      global doc
     17      doc = getDoc()
     18      return doc.getRole()
     19    `);
     20    is(role, ATSPI_ROLE_DOCUMENT_WEB, "doc has correct ATSPI role");
     21    ok(
     22      await runPython(`
     23        global p
     24        p = findByDomId(doc, "p")
     25        return p == doc[0]
     26      `),
     27      "doc's first child is p"
     28    );
     29    role = await runPython(`p.getRole()`);
     30    is(role, ATSPI_ROLE_PARAGRAPH, "p has correct ATSPI role");
     31  },
     32  { chrome: true, topLevel: true, iframe: true, remoteIframe: true }
     33 );