tor-browser

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

browser_content_tree.js (1993B)


      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 /* import-globals-from ../../mochitest/role.js */
      8 loadScripts({ name: "role.js", dir: MOCHITESTS_DIR });
      9 
     10 addAccessibleTask(
     11  `<table id="table">
     12    <tr>
     13      <td>cell1</td>
     14      <td>cell2</td>
     15    </tr>
     16  </table>
     17  <ul id="ul">
     18    <li id="li">item1</li>
     19  </ul>`,
     20  async function (browser, iframeDocAcc, contentDocAcc) {
     21    ok(iframeDocAcc, "IFRAME document accessible is present");
     22    (gIsRemoteIframe ? isnot : is)(
     23      browser.browsingContext.currentWindowGlobal.osPid,
     24      browser.browsingContext.children[0].currentWindowGlobal.osPid,
     25      `Content and IFRAME documents are in ${
     26        gIsRemoteIframe ? "separate processes" : "same process"
     27      }.`
     28    );
     29 
     30    const tree = {
     31      DOCUMENT: [
     32        {
     33          INTERNAL_FRAME: [
     34            {
     35              DOCUMENT: [
     36                {
     37                  TABLE: [
     38                    {
     39                      ROW: [
     40                        { CELL: [{ TEXT_LEAF: [] }] },
     41                        { CELL: [{ TEXT_LEAF: [] }] },
     42                      ],
     43                    },
     44                  ],
     45                },
     46                {
     47                  LIST: [
     48                    {
     49                      LISTITEM: [{ LISTITEM_MARKER: [] }, { TEXT_LEAF: [] }],
     50                    },
     51                  ],
     52                },
     53              ],
     54            },
     55          ],
     56        },
     57      ],
     58    };
     59    testAccessibleTree(contentDocAcc, tree);
     60 
     61    const iframeAcc = contentDocAcc.getChildAt(0);
     62    is(
     63      iframeAcc.getChildAt(0),
     64      iframeDocAcc,
     65      "Document for the IFRAME matches IFRAME's first child."
     66    );
     67 
     68    is(
     69      iframeDocAcc.parent,
     70      iframeAcc,
     71      "IFRAME document's parent matches the IFRAME."
     72    );
     73  },
     74  { topLevel: false, iframe: true, remoteIframe: true }
     75 );