Tue, 06 Jan 2015 21:39:09 +0100
Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.
1 <!DOCTYPE html>
2 <html>
4 <head>
5 <title>Test accessible recreation</title>
7 <link rel="stylesheet" type="text/css"
8 href="chrome://mochikit/content/tests/SimpleTest/test.css" />
10 <script type="application/javascript"
11 src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
13 <script type="application/javascript"
14 src="../common.js"></script>
15 <script type="application/javascript"
16 src="../role.js"></script>
17 <script type="application/javascript"
18 src="../events.js"></script>
20 <script type="application/javascript">
22 ////////////////////////////////////////////////////////////////////////////
23 // Invokers
25 function textLeafUpdate(aID, aIsTextLeafLinkable)
26 {
27 this.node = getNode(aID);
29 this.eventSeq = [
30 new invokerChecker(EVENT_REORDER, this.node.parentNode)
31 ];
33 this.finalCheck = function textLeafUpdate_finalCheck()
34 {
35 var textLeaf = getAccessible(this.node).firstChild;
36 is(textLeaf.actionCount, (aIsTextLeafLinkable ? 1 : 0),
37 "Wrong action numbers!");
38 }
39 }
41 function setOnClickAttr(aID)
42 {
43 this.__proto__ = new textLeafUpdate(aID, true);
45 this.invoke = function setOnClickAttr_invoke()
46 {
47 this.node.setAttribute("onclick", "alert(3);");
48 }
50 this.getID = function setOnClickAttr_getID()
51 {
52 return "make " + prettyName(aID) + " linkable";
53 }
54 }
56 function removeOnClickAttr(aID)
57 {
58 this.__proto__ = new textLeafUpdate(aID, false);
60 this.invoke = function removeOnClickAttr_invoke()
61 {
62 this.node.removeAttribute("onclick");
63 }
65 this.getID = function removeOnClickAttr_getID()
66 {
67 return "unmake " + prettyName(aID) + " linkable";
68 }
69 }
71 function setOnClickNRoleAttrs(aID)
72 {
73 this.__proto__ = new textLeafUpdate(aID, true);
75 this.invoke = function setOnClickAttr_invoke()
76 {
77 this.node.setAttribute("role", "link");
78 this.node.setAttribute("onclick", "alert(3);");
79 }
81 this.getID = function setOnClickAttr_getID()
82 {
83 return "make " + prettyName(aID) + " linkable";
84 }
85 }
87 function removeTextData(aID)
88 {
89 this.containerNode = getNode(aID);
90 this.textNode = this.containerNode.firstChild;
92 this.eventSeq = [
93 new invokerChecker(EVENT_REORDER, this.containerNode)
94 ];
96 this.invoke = function removeTextData_invoke()
97 {
98 var tree = {
99 role: ROLE_PARAGRAPH,
100 children: [
101 {
102 role: ROLE_TEXT_LEAF,
103 name: "text"
104 }
105 ]
106 };
107 testAccessibleTree(this.containerNode, tree);
109 this.textNode.data = "";
110 }
112 this.finalCheck = function removeTextData_finalCheck()
113 {
114 var tree = {
115 role: ROLE_PARAGRAPH,
116 children: []
117 };
118 testAccessibleTree(this.containerNode, tree);
119 }
121 this.getID = function removeTextData_finalCheck()
122 {
123 return "remove text data of text node inside '" + aID + "'.";
124 }
125 }
127 ////////////////////////////////////////////////////////////////////////////
128 // Test
130 //gA11yEventDumpID = "eventdump"; // debug stuff
131 //gA11yEventDumpToConsole = true;
133 var gQueue = null;
135 function doTest()
136 {
137 gQueue = new eventQueue();
139 // adds onclick on element, text leaf should inherit its action
140 gQueue.push(new setOnClickAttr("div"));
142 // remove onclick attribute, text leaf shouldn't have any action
143 gQueue.push(new removeOnClickAttr("div"));
145 // set onclick attribute making span accessible, it's inserted into tree
146 // and adopts text leaf accessible, text leaf should have an action
147 gQueue.push(new setOnClickNRoleAttrs("span"));
149 // text data removal of text node should remove its text accessible
150 gQueue.push(new removeTextData("p"));
151 gQueue.push(new removeTextData("pre"));
153 gQueue.invoke(); // SimpleTest.finish() will be called in the end
154 }
156 SimpleTest.waitForExplicitFinish();
157 addA11yLoadEvent(doTest);
158 </script>
159 </head>
160 <body>
162 <a target="_blank"
163 title="Clean up the code of accessible initialization and binding to the tree"
164 href="https://bugzilla.mozilla.org/show_bug.cgi?id=545465">
165 Mozilla Bug 545465
166 </a>
167 <a target="_blank"
168 title="Make sure accessible tree is correct when rendered text is changed"
169 href="https://bugzilla.mozilla.org/show_bug.cgi?id=625652">
170 Mozilla Bug 625652
171 </a>
172 <a target="_blank"
173 title="Remove text accesible getting no text inside a preformatted area"
174 href="https://bugzilla.mozilla.org/show_bug.cgi?id=706335">
175 Mozilla Bug 706335
176 </a>
178 <p id="display"></p>
179 <div id="content" style="display: none"></div>
180 <pre id="test">
181 </pre>
183 <div id="container">
184 <div id="div">div</div>
185 <span id="span">span</span>
186 </div>
188 <p id="p">text</p>
189 <pre id="pre">text</pre>
191 <div id="eventdump"></div>
192 </body>
193 </html>