tor-browser

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

test_docload_busy.html (2705B)


      1 <html>
      2 
      3 <head>
      4  <title>Accessible events testing for document</title>
      5 
      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="../../states.js"></script>
     17  <script type="application/javascript"
     18          src="../../events.js"></script>
     19 
     20  <script type="application/javascript">
     21    // //////////////////////////////////////////////////////////////////////////
     22    // Invokers
     23 
     24    function makeIFrameVisible(aID) {
     25      this.DOMNode = getNode(aID);
     26 
     27      this.eventSeq = [
     28        new invokerChecker(EVENT_REORDER, this.DOMNode.parentNode),
     29        {
     30          type: EVENT_STATE_CHANGE,
     31          get target() {
     32            return getAccessible("iframe").firstChild;
     33          },
     34          match(aEvent) {
     35            // The document shouldn't have busy state (the DOM document was
     36            // loaded before its accessible was created). Do this test lately to
     37            // make sure the content of document accessible was created
     38            // initially, prior to this the document accessible keeps busy
     39            // state. The initial creation happens asynchronously after document
     40            // creation, there are no events we could use to catch it.
     41            let { state, isEnabled } = aEvent.QueryInterface(nsIAccessibleStateChangeEvent);
     42            return state & STATE_BUSY && !isEnabled;
     43          },
     44        },
     45      ];
     46 
     47      this.invoke = () => (this.DOMNode.style.visibility = "visible");
     48 
     49      this.getID = () =>
     50        "The accessible for DOM document loaded before it's shown shouldn't have busy state.";
     51    }
     52 
     53 
     54    // //////////////////////////////////////////////////////////////////////////
     55    // Do tests
     56 
     57    function doTests() {
     58      const gQueue = new eventQueue();
     59      gQueue.push(new makeIFrameVisible("iframe"));
     60      gQueue.invoke(); // Will call SimpleTest.finish();
     61    }
     62 
     63    SimpleTest.waitForExplicitFinish();
     64    addA11yLoadEvent(doTests);
     65  </script>
     66 </head>
     67 
     68 <body>
     69 
     70  <a target="_blank"
     71     href="https://bugzilla.mozilla.org/show_bug.cgi?id=658185"
     72     title="The DOM document loaded before it's shown shouldn't have busy state">
     73    Mozilla Bug 658185
     74  </a>
     75 
     76  <p id="display"></p>
     77  <div id="content" style="display: none"></div>
     78  <pre id="test">
     79  </pre>
     80 
     81  <div id="testContainer"><iframe id="iframe" src="about:mozilla" style="visibility: hidden;"></iframe></div>
     82 </body>
     83 </html>