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>
3 <head>
4 <title>nsIAccessibleText getText related function tests for rich text</title>
5 <link rel="stylesheet" type="text/css"
6 href="chrome://mochikit/content/tests/SimpleTest/test.css" />
8 <style>
9 h6.gencontent:before {
10 content: "aga"
11 }
12 </style>
14 <script type="application/javascript"
15 src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
16 <script type="application/javascript"
17 src="../common.js"></script>
18 <script type="application/javascript"
19 src="../text.js"></script>
21 <script type="application/javascript">
22 function doTest()
23 {
24 //////////////////////////////////////////////////////////////////////////
25 // null getText
26 //////////////////////////////////////////////////////////////////////////
28 var emptyTextAcc = getAccessible("nulltext", [nsIAccessibleText]);
29 is(emptyTextAcc.getText(0, -1), "", "getText() END_OF_TEXT with null string");
30 is(emptyTextAcc.getText(0, 0), "", "getText() Len==0 with null string");
32 //////////////////////////////////////////////////////////////////////////
33 // hypertext
34 //////////////////////////////////////////////////////////////////////////
36 // ! - embedded object char
37 // __h__e__l__l__o__ __!__ __s__e__e__ __!__
38 // 0 1 2 3 4 5 6 7 8 9 10 11 12 13
40 var IDs = [ "hypertext", "hypertext2" ];
42 ////////////////////////////////////////////////////////////////////////
43 // characterCount
45 testCharacterCount(IDs, 13);
47 ////////////////////////////////////////////////////////////////////////
48 // getText
50 testText(IDs, 0, 1, "h");
51 testText(IDs, 5, 7, " " + kEmbedChar);
52 testText(IDs, 10, 13, "e " + kEmbedChar);
53 testText(IDs, 0, 13, "hello " + kEmbedChar + " see " + kEmbedChar);
55 ////////////////////////////////////////////////////////////////////////
56 // getTextAtOffset line boundary
58 testTextAtOffset(0, BOUNDARY_LINE_START, "line ", 0, 5,
59 "hypertext3", kOk, kOk, kOk);
61 // XXX: see bug 634202.
62 testTextAtOffset(0, BOUNDARY_LINE_START, "line ", 0, 5,
63 "hypertext4", kTodo, kOk, kTodo);
65 //////////////////////////////////////////////////////////////////////////
66 // list
67 //////////////////////////////////////////////////////////////////////////
69 IDs = [ "list" ];
70 testCharacterCount(IDs, 1);
71 testText(IDs, 0, 1, kEmbedChar);
73 IDs = [ "listitem" ];
74 testCharacterCount(IDs, 5);
75 testText(IDs, 0, 5, "1.foo");
77 testText(["testbr"], 0, 3, "foo");
79 testTextAtOffset(2, nsIAccessibleText.BOUNDARY_CHAR, "o", 2, 3, "testbr",
80 kOk, kOk, kOk);
81 testTextAtOffset(2, nsIAccessibleText.BOUNDARY_WORD_START, "foo\n", 0, 4,
82 "testbr", kTodo, kOk, kTodo);
83 testTextBeforeOffset(2, nsIAccessibleText.BOUNDARY_LINE_START, "foo\n",
84 0, 4, "testbr", kTodo, kOk, kTodo);
86 SimpleTest.finish();
87 }
89 SimpleTest.waitForExplicitFinish();
90 addA11yLoadEvent(doTest);
91 </script>
92 </head>
93 <body>
95 <a target="_blank"
96 title="Fix getText"
97 href="https://bugzilla.mozilla.org/show_bug.cgi?id=630001">
98 Bug 630001, part3
99 </a>
100 <a target="_blank"
101 title="getTextAtOffset line boundary may return more than one line"
102 href="https://bugzilla.mozilla.org/show_bug.cgi?id=638326">
103 Bug 638326
104 </a>
105 <a target="_blank"
106 title="getText(0, -1) fails with empty text"
107 href="https://bugzilla.mozilla.org/show_bug.cgi?id=749810">
108 Bug 749810
109 </a>
111 <p id="display"></p>
112 <div id="content" style="display: none"></div>
113 <pre id="test">
114 </pre>
116 <div id="nulltext"></div>
118 <div id="hypertext">hello <a>friend</a> see <img></div>
119 <div id="hypertext2">hello <a>friend</a> see <input></div>
120 <ol id="list"><li id="listitem">foo</li></ol>
122 <div id="hypertext3">line
123 <!-- haha -->
124 <!-- hahaha -->
125 <h6>heading</h6>
126 </div>
128 <div id="hypertext4">line
129 <!-- haha -->
130 <!-- hahaha -->
131 <h6 role="presentation" class="gencontent">heading</h6>
132 </div>
134 <div id="testbr">foo<br/></div>
136 </body>
137 </html>