summaryrefslogtreecommitdiffstats
path: root/accessible/tests/mochitest/events/docload/test_docload_busy.html
blob: 37caf306bb41f2a7fcbae9cb03234872e166c046 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
<html>

<head>
  <title>Accessible events testing for document</title>

  <link rel="stylesheet" type="text/css"
        href="chrome://mochikit/content/tests/SimpleTest/test.css" />

  <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>

  <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"
     href="https://bugzilla.mozilla.org/show_bug.cgi?id=658185"
     title="The DOM document loaded before it's shown shouldn't have busy state">
    Mozilla Bug 658185
  </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>