summaryrefslogtreecommitdiffstats
path: root/intl/uconv/tests/test_unicode_noncharacterescapes.html
blob: 58cbe84ab0776bc9874f6425a814e220544f3ad9 (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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=445886
-->
<head>
  <meta http-equiv="Content-type" content="text/html; charset=UTF-8">
  <title>Test for Unicode non-characters</title>
  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body onload="Inject()">
<pre id="test">
<script class="testbody" type="text/javascript">

/** Test that unicode non-characters are not discarded **/
function test()
{
    is($("display").innerHTML,"All good.", "Noncharacters not stripped");
    SimpleTest.finish();
}

function Inject()
{
    // script fragments containing Unicode non-characters
    try {
        // U+FDD0
        eval("$(\"display\").inner\ufdd0HTML += \" U+FDD0 is evil\"");
    } catch(e) {}
    try {
        // U+FDD1
        eval("$(\"display\").inner\ufdd1HTML += \" U+FDD1 is evil\"");
    } catch(e) {}
    try {
        // U+FDD2
        eval("$(\"display\").inner\ufdd2HTML += \" U+FDD2 is evil\"");
    } catch(e) {}
    try {
        // U+FDD3
        eval("$(\"display\").inner\ufdd3HTML += \" U+FDD3 is evil\"");
    } catch(e) {}
    try {
        // U+FDD4
        eval("$(\"display\").inner\ufdd4HTML += \" U+FDD4 is evil\"");
    } catch(e) {}
    try {
        // U+FDD5
        eval("$(\"display\").inner\ufdd5HTML += \" U+FDD5 is evil\"");
    } catch(e) {}
    try {
        // U+FDD6
        eval("$(\"display\").inner\ufdd6HTML += \" U+FDD6 is evil\"");
    } catch(e) {}
    try {
        // U+FDD7
        eval("$(\"display\").inner\ufdd7HTML += \" U+FDD7 is evil\"");
    } catch(e) {}
    try {
        // U+FDD8
        eval("$(\"display\").inner\ufdd8HTML += \" U+FDD8 is evil\"");
    } catch(e) {}
    try {
        // U+FDD9
        eval("$(\"display\").inner\ufdd9HTML += \" U+FDD9 is evil\"");
    } catch(e) {}
    try {
        // U+FDDA
        eval("$(\"display\").inner\ufddaHTML += \" U+FDDA is evil\"");
    } catch(e) {}
    try {
        // U+FDDB
        eval("$(\"display\").inner\ufddbHTML += \" U+FDDB is evil\"");
    } catch(e) {}
    try {
        // U+FDDC
        eval("$(\"display\").inner\ufddcHTML += \" U+FDDC is evil\"");
    } catch(e) {}
    try {
        // U+FDDD
        eval("$(\"display\").inner\ufdddHTML += \" U+FDDD is evil\"");
    } catch(e) {}
    try {
        // U+FDDE
        eval("$(\"display\").inner\ufddeHTML += \" U+FDDE is evil\"");
    } catch(e) {}
    try {
        // U+FDDF
        eval("$(\"display\").inner\ufddfHTML += \" U+FDDF is evil\"");
    } catch(e) {}
    try {
        // U+FDE0
        eval("$(\"display\").inner\ufde0HTML += \" U+FDE0 is evil\"");
    } catch(e) {}
    try {
        // U+FDE1
        eval("$(\"display\").inner\ufde1HTML += \" U+FDE1 is evil\"");
    } catch(e) {}
    try {
        // U+FDE2
        eval("$(\"display\").inner\ufde2HTML += \" U+FDE2 is evil\"");
    } catch(e) {}
    try {
        // U+FDE3
        eval("$(\"display\").inner\ufde3HTML += \" U+FDE3 is evil\"");
    } catch(e) {}
    try {
        // U+FDE4
        eval("$(\"display\").inner\ufde4HTML += \" U+FDE4 is evil\"");
    } catch(e) {}
    try {
        // U+FDE5
        eval("$(\"display\").inner\ufde5HTML += \" U+FDE5 is evil\"");
    } catch(e) {}
    try {
        // U+FDE6
        eval("$(\"display\").inner\ufde6HTML += \" U+FDE6 is evil\"");
    } catch(e) {}
    try {
        // U+FDE7
        eval("$(\"display\").inner\ufde7HTML += \" U+FDE7 is evil\"");
    } catch(e) {}
    try {
        // U+FDE8
        eval("$(\"display\").inner\ufde8HTML += \" U+FDE8 is evil\"");
    } catch(e) {}
    try {
        // U+FDE9
        eval("$(\"display\").inner\ufde9HTML += \" U+FDE9 is evil\"");
    } catch(e) {}
    try {
        // U+FDEA
        eval("$(\"display\").inner\ufdeaHTML += \" U+FDEA is evil\"");
    } catch(e) {}
    try {
        // U+FDEB
        eval("$(\"display\").inner\ufdebHTML += \" U+FDEB is evil\"");
    } catch(e) {}
    try {
        // U+FDEC
        eval("$(\"display\").inner\ufdecHTML += \" U+FDEC is evil\"");
    } catch(e) {}
    try {
        // U+FDED
        eval("$(\"display\").inner\ufdedHTML += \" U+FDED is evil\"");
    } catch(e) {}
    try {
        // U+FDEE
        eval("$(\"display\").inner\ufdeeHTML += \" U+FDEE is evil\"");
    } catch(e) {}
    try {
        // U+FDEF
        eval("$(\"display\").inner\ufdefHTML += \" U+FDEF is evil\"");
    } catch(e) {}
    try {
        // U+FFFE
        eval("$(\"display\").inner\ufffeHTML += \" U+FFFE is evil\"");
    } catch(e) {}
    try {
        // U+FFFF
        eval("$(\"display\").inner\uffffHTML += \" U+FFFF is evil\"");
    } catch(e) {}
    try {
        // U+1FFFE
        eval("$(\"display\").inner\ud83f\udffeHTML += \" U+1FFFE is evil\"");
    } catch(e) {}
    try {
        // U+1FFFF
        eval("$(\"display\").inner\ud83f\udfffHTML += \" U+1FFFF is evil\"");
    } catch(e) {}
    try {
        // U+2FFFE
        eval("$(\"display\").inner\ud87f\udffeHTML += \" U+2FFFE is evil\"");
    } catch(e) {}
    try {
        // U+2FFFF
        eval("$(\"display\").inner\ud87f\udfffHTML += \" U+2FFFF is evil\"");
    } catch(e) {}
    try {
        // U+3FFFE
        eval("$(\"display\").inner\ud8bf\udffeHTML += \" U+3FFFE is evil\"");
    } catch(e) {}
    try {
        // U+3FFFF
        eval("$(\"display\").inner\ud8bf\udfffHTML += \" U+3FFFF is evil\"");
    } catch(e) {}
    try {
        // U+4FFFE
        eval("$(\"display\").inner\ud8ff\udffeHTML += \" U+4FFFE is evil\"");
    } catch(e) {}
    try {
        // U+4FFFF
        eval("$(\"display\").inner\ud8ff\udfffHTML += \" U+4FFFF is evil\"");
    } catch(e) {}
    try {
        // U+5FFFE
        eval("$(\"display\").inner\ud93f\udffeHTML += \" U+5FFFE is evil\"");
    } catch(e) {}
    try {
        // U+5FFFF
        eval("$(\"display\").inner\ud93f\udfffHTML += \" U+5FFFF is evil\"");
    } catch(e) {}
    try {
        // U+6FFFE
        eval("$(\"display\").inner\ud97f\udffeHTML += \" U+6FFFE is evil\"");
    } catch(e) {}
    try {
        // U+6FFFF
        eval("$(\"display\").inner\ud97f\udfffHTML += \" U+6FFFF is evil\"");
    } catch(e) {}
    try {
        // U+7FFFE
        eval("$(\"display\").inner\ud9bf\udffeHTML += \" U+7FFFE is evil\"");
    } catch(e) {}
    try {
        // U+7FFFF
        eval("$(\"display\").inner\ud9bf\udfffHTML += \" U+7FFFF is evil\"");
    } catch(e) {}
    try {
        // U+8FFFE
        eval("$(\"display\").inner\ud9ff\udffeHTML += \" U+8FFFE is evil\"");
    } catch(e) {}
    try {
        // U+8FFFF
        eval("$(\"display\").inner\ud9ff\udfffHTML += \" U+8FFFF is evil\"");
    } catch(e) {}
    try {
        // U+9FFFE
        eval("$(\"display\").inner\uda3f\udffeHTML += \" U+9FFFE is evil\"");
    } catch(e) {}
    try {
        // U+9FFFF
        eval("$(\"display\").inner\uda3f\udfffHTML += \" U+9FFFF is evil\"");
    } catch(e) {}
    try {
        // U+AFFFE
        eval("$(\"display\").inner\uda7f\udffeHTML += \" U+AFFFE is evil\"");
    } catch(e) {}
    try {
        // U+AFFFF
        eval("$(\"display\").inner\uda7f\udfffHTML += \" U+AFFFF is evil\"");
    } catch(e) {}
    try {
        // U+BFFFE
        eval("$(\"display\").inner\udabf\udffeHTML += \" U+BFFFE is evil\"");
    } catch(e) {}
    try {
        // U+BFFFF
        eval("$(\"display\").inner\udabf\udfffHTML += \" U+BFFFF is evil\"");
    } catch(e) {}
    try {
        // U+CFFFE
        eval("$(\"display\").inner\udaff\udffeHTML += \" U+CFFFE is evil\"");
    } catch(e) {}
    try {
        // U+CFFFF
        eval("$(\"display\").inner\udaff\udfffHTML += \" U+CFFFF is evil\"");
    } catch(e) {}
    try {
        // U+DFFFE
        eval("$(\"display\").inner\udb3f\udffeHTML += \" U+DFFFE is evil\"");
    } catch(e) {}
    try {
        // U+DFFFF
        eval("$(\"display\").inner\udb3f\udfffHTML += \" U+DFFFF is evil\"");
    } catch(e) {}
    try {
        // U+EFFFE
        eval("$(\"display\").inner\udb7f\udffeHTML += \" U+EFFFE is evil\"");
    } catch(e) {}
    try {
        // U+EFFFF
        eval("$(\"display\").inner\udb7f\udfffHTML += \" U+EFFFF is evil\"");
    } catch(e) {}
    try {
        // U+FFFFE
        eval("$(\"display\").inner\udbbf\udffeHTML += \" U+FFFFE is evil\"");
    } catch(e) {}
    try {
        // U+FFFFF
        eval("$(\"display\").inner\udbbf\udfffHTML += \" U+FFFFF is evil\"");
    } catch(e) {}
    try {
        // U+10FFFE
        eval("$(\"display\").inner\udbff\udffeHTML += \" U+10FFFE is evil\"");
    } catch(e) {}
    try {
        // U+10FFFF
        eval("$(\"display\").inner\udbff\udfffHTML += \" U+10FFFF is evil\"");
    } catch(e) {}
    test();
}

  SimpleTest.waitForExplicitFinish();
</script>
</pre>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=445886">Mozilla Bug 445886</a>
<p id="display">All good.</p>
<div id="content" style="display: none"></div>
</body>
</html>