Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
<html>
<head>
  <title>Accessible events testing for document</title>
  <link rel="stylesheet" type="text/css"
  <script type="application/javascript"
          src="../../common.js"></script>
  <script type="application/javascript"
          src="../../role.js"></script>
  <script type="application/javascript"
          src="../../states.js"></script>
  <script type="application/javascript"
          src="../../events.js"></script>
  <script type="application/javascript">
    // //////////////////////////////////////////////////////////////////////////
    // Invokers
    function makeIFrameVisible(aID) {
      this.DOMNode = getNode(aID);
      this.eventSeq = [
        new invokerChecker(EVENT_REORDER, this.DOMNode.parentNode),
        {
          type: EVENT_STATE_CHANGE,
          get target() {
            return getAccessible("iframe").firstChild;
          },
          match(aEvent) {
            // The document shouldn't have busy state (the DOM document was
            // loaded before its accessible was created). Do this test lately to
            // make sure the content of document accessible was created
            // initially, prior to this the document accessible keeps busy
            // state. The initial creation happens asynchronously after document
            // creation, there are no events we could use to catch it.
            let { state, isEnabled } = aEvent.QueryInterface(nsIAccessibleStateChangeEvent);
            return state & STATE_BUSY && !isEnabled;
          },
        },
      ];
      this.invoke = () => (this.DOMNode.style.visibility = "visible");
      this.getID = () =>
        "The accessible for DOM document loaded before it's shown shouldn't have busy state.";
    }
    // //////////////////////////////////////////////////////////////////////////
    // Do tests
    function doTests() {
      const gQueue = new eventQueue();
      gQueue.push(new makeIFrameVisible("iframe"));
      gQueue.invoke(); // Will call SimpleTest.finish();
    }
    SimpleTest.waitForExplicitFinish();
    addA11yLoadEvent(doTests);
  </script>
</head>
<body>
  <a target="_blank"
     title="The DOM document loaded before it's shown shouldn't have busy state">
  </a>
  <p id="display"></p>
  <div id="content" style="display: none"></div>
  <pre id="test">
  </pre>
  <div id="testContainer"><iframe id="iframe" src="about:mozilla" style="visibility: hidden;"></iframe></div>
</body>
</html>