tor-browser

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

test_bug1276857.html (4117B)


      1 <!DOCTYPE html>
      2 <html>
      3 
      4 <head>
      5  <title>DOM mutations test</title>
      6  <link rel="stylesheet" type="text/css"
      7        href="chrome://mochikit/content/tests/SimpleTest/test.css" />
      8 
      9  <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
     10 
     11  <script type="application/javascript"
     12          src="../common.js"></script>
     13  <script type="application/javascript"
     14          src="../role.js"></script>
     15  <script type="application/javascript"
     16          src="../events.js"></script>
     17 
     18  <script type="application/javascript">
     19    function runTest() {
     20      let iframe = document.getElementById("iframe");
     21 
     22      // children change will recreate the table
     23      this.eventSeq = [
     24        new invokerChecker(EVENT_REORDER, () => {
     25          let doc = getNode("iframe").contentDocument;
     26          return doc && doc.getElementById("c1");
     27        }),
     28      ];
     29 
     30      this.invoke = function runTest_invoke() {
     31        var tree = {
     32          SECTION: [ // c1
     33            { TEXT_LEAF: [] }, // Some text
     34            { TEXT_CONTAINER: [
     35              { TEXT_LEAF: [] }, // something with ..
     36            ] },
     37            { TEXT_LEAF: [] }, // More text
     38          ],
     39        };
     40        testAccessibleTree(iframe.contentDocument.getElementById("c1"), tree);
     41 
     42        iframe.contentDocument.getElementById("c1_t").querySelector("span").remove();
     43      };
     44 
     45      this.finalCheck = function runTest_finalCheck() {
     46        var tree = {
     47          SECTION: [ // c1
     48            { TEXT_LEAF: [] }, // Some text
     49            { TEXT_LEAF: [] }, // More text
     50          ],
     51        };
     52        testAccessibleTree(iframe.contentDocument.getElementById("c1"), tree);
     53      };
     54 
     55      this.getID = function runTest_getID() {
     56        return "child DOM node is removed before the layout notifies the a11y about parent removal/show";
     57      };
     58    }
     59 
     60    function runShadowTest() {
     61      // children change will recreate the table
     62      this.eventSeq = [
     63        new invokerChecker(EVENT_REORDER, () => {
     64          let doc = getNode("iframe").contentDocument;
     65          return doc && doc.getElementById("c2");
     66        }),
     67      ];
     68 
     69      this.invoke = function runShadowTest_invoke() {
     70        var tree = {
     71          SECTION: [ // c2
     72            { TEXT_LEAF: [] }, // Some text
     73            { TEXT_CONTAINER: [
     74              { TEXT_LEAF: [] }, // something with ..
     75            ] },
     76            { TEXT_LEAF: [] }, // More text
     77          ],
     78        };
     79        const iframe = document.getElementById("iframe");
     80        testAccessibleTree(iframe.contentDocument.getElementById("c2"), tree);
     81 
     82        var shadowRoot = iframe.contentDocument.getElementById("c2_c").shadowRoot;
     83        shadowRoot.firstElementChild.querySelector("span").remove();
     84        // bug 1487312
     85        shadowRoot.firstElementChild.offsetTop;
     86        shadowRoot.appendChild(document.createElement("button"));
     87      };
     88 
     89      this.finalCheck = function runShadowTest_finalCheck() {
     90        var tree = {
     91          SECTION: [ // c2
     92            { TEXT_LEAF: [] }, // Some text
     93            { TEXT_LEAF: [] }, // More text
     94            { PUSHBUTTON: [] }, // The button we appended.
     95          ],
     96        };
     97        const iframe = document.getElementById("iframe");
     98        testAccessibleTree(iframe.contentDocument.getElementById("c2"), tree);
     99      };
    100 
    101      this.getID = function runShadowTest_getID() {
    102        return "child DOM node is removed before the layout notifies the a11y about parent removal/show in shadow DOM";
    103      };
    104    }
    105 
    106    // enableLogging("tree");
    107    // gA11yEventDumpToConsole = true;
    108 
    109    var gQueue = null;
    110    function doTest() {
    111      gQueue = new eventQueue();
    112      gQueue.push(new runTest());
    113      gQueue.push(new runShadowTest());
    114      gQueue.invoke(); // will call SimpleTest.finish();
    115    }
    116 
    117    SimpleTest.waitForExplicitFinish();
    118 
    119    window.onload = () => {
    120      let iframe = document.createElement("iframe");
    121      iframe.id = "iframe";
    122      iframe.src = "test_bug1276857_subframe.html";
    123      addA11yLoadEvent(doTest, iframe.contentWindow);
    124      document.body.appendChild(iframe);
    125    };
    126  </script>
    127 
    128 </head>
    129 <body>
    130 </body>
    131 </html>