test_unicode_noncharacters_utf8.html 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301
  1. <!DOCTYPE HTML>
  2. <html>
  3. <!--
  4. https://bugzilla.mozilla.org/show_bug.cgi?id=445886
  5. -->
  6. <head>
  7. <meta http-equiv="Content-type" content="text/html; charset=UTF-8">
  8. <title>Test for Unicode non-characters</title>
  9. <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
  10. <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
  11. </head>
  12. <body onload="Inject()">
  13. <pre id="test">
  14. <script class="testbody" type="text/javascript">
  15. /** Test that unicode non-characters are not discarded **/
  16. function test()
  17. {
  18. is($("display").innerHTML, "All good.", "Noncharacters not stripped");
  19. SimpleTest.finish();
  20. }
  21. function Inject()
  22. {
  23. // script fragments containing Unicode non-characters
  24. try {
  25. // U+FDD0
  26. eval("$(\"display\").inner﷐HTML += \" U+FDD0 is evil \"");
  27. } catch(e) {}
  28. try {
  29. // U+FDD1
  30. eval("$(\"display\").inner﷑HTML += \" U+FDD1 is evil \"");
  31. } catch(e) {}
  32. try {
  33. // U+FDD2
  34. eval("$(\"display\").inner﷒HTML += \" U+FDD2 is evil \"");
  35. } catch(e) {}
  36. try {
  37. // U+FDD3
  38. eval("$(\"display\").inner﷓HTML += \" U+FDD3 is evil \"");
  39. } catch(e) {}
  40. try {
  41. // U+FDD4
  42. eval("$(\"display\").inner﷔HTML += \" U+FDD4 is evil \"");
  43. } catch(e) {}
  44. try {
  45. // U+FDD5
  46. eval("$(\"display\").inner﷕HTML += \" U+FDD5 is evil \"");
  47. } catch(e) {}
  48. try {
  49. // U+FDD6
  50. eval("$(\"display\").inner﷖HTML += \" U+FDD6 is evil \"");
  51. } catch(e) {}
  52. try {
  53. // U+FDD7
  54. eval("$(\"display\").inner﷗HTML += \" U+FDD7 is evil \"");
  55. } catch(e) {}
  56. try {
  57. // U+FDD8
  58. eval("$(\"display\").inner﷘HTML += \" U+FDD8 is evil \"");
  59. } catch(e) {}
  60. try {
  61. // U+FDD9
  62. eval("$(\"display\").inner﷙HTML += \" U+FDD9 is evil \"");
  63. } catch(e) {}
  64. try {
  65. // U+FDDA
  66. eval("$(\"display\").inner﷚HTML += \" U+FDDA is evil \"");
  67. } catch(e) {}
  68. try {
  69. // U+FDDB
  70. eval("$(\"display\").inner﷛HTML += \" U+FDDB is evil \"");
  71. } catch(e) {}
  72. try {
  73. // U+FDDC
  74. eval("$(\"display\").inner﷜HTML += \" U+FDDC is evil \"");
  75. } catch(e) {}
  76. try {
  77. // U+FDDD
  78. eval("$(\"display\").inner﷝HTML += \" U+FDDD is evil \"");
  79. } catch(e) {}
  80. try {
  81. // U+FDDE
  82. eval("$(\"display\").inner﷞HTML += \" U+FDDE is evil \"");
  83. } catch(e) {}
  84. try {
  85. // U+FDDF
  86. eval("$(\"display\").inner﷟HTML += \" U+FDDF is evil \"");
  87. } catch(e) {}
  88. try {
  89. // U+FDE0
  90. eval("$(\"display\").inner﷠HTML += \" U+FDE0 is evil \"");
  91. } catch(e) {}
  92. try {
  93. // U+FDE1
  94. eval("$(\"display\").inner﷡HTML += \" U+FDE1 is evil \"");
  95. } catch(e) {}
  96. try {
  97. // U+FDE2
  98. eval("$(\"display\").inner﷢HTML += \" U+FDE2 is evil \"");
  99. } catch(e) {}
  100. try {
  101. // U+FDE3
  102. eval("$(\"display\").inner﷣HTML += \" U+FDE3 is evil \"");
  103. } catch(e) {}
  104. try {
  105. // U+FDE4
  106. eval("$(\"display\").inner﷤HTML += \" U+FDE4 is evil \"");
  107. } catch(e) {}
  108. try {
  109. // U+FDE5
  110. eval("$(\"display\").inner﷥HTML += \" U+FDE5 is evil \"");
  111. } catch(e) {}
  112. try {
  113. // U+FDE6
  114. eval("$(\"display\").inner﷦HTML += \" U+FDE6 is evil \"");
  115. } catch(e) {}
  116. try {
  117. // U+FDE7
  118. eval("$(\"display\").inner﷧HTML += \" U+FDE7 is evil \"");
  119. } catch(e) {}
  120. try {
  121. // U+FDE8
  122. eval("$(\"display\").inner﷨HTML += \" U+FDE8 is evil \"");
  123. } catch(e) {}
  124. try {
  125. // U+FDE9
  126. eval("$(\"display\").inner﷩HTML += \" U+FDE9 is evil \"");
  127. } catch(e) {}
  128. try {
  129. // U+FDEA
  130. eval("$(\"display\").inner﷪HTML += \" U+FDEA is evil \"");
  131. } catch(e) {}
  132. try {
  133. // U+FDEB
  134. eval("$(\"display\").inner﷫HTML += \" U+FDEB is evil \"");
  135. } catch(e) {}
  136. try {
  137. // U+FDEC
  138. eval("$(\"display\").inner﷬HTML += \" U+FDEC is evil \"");
  139. } catch(e) {}
  140. try {
  141. // U+FDED
  142. eval("$(\"display\").inner﷭HTML += \" U+FDED is evil \"");
  143. } catch(e) {}
  144. try {
  145. // U+FDEE
  146. eval("$(\"display\").inner﷮HTML += \" U+FDEE is evil \"");
  147. } catch(e) {}
  148. try {
  149. // U+FDEF
  150. eval("$(\"display\").inner﷯HTML += \" U+FDEF is evil \"");
  151. } catch(e) {}
  152. try {
  153. // U+FFFE
  154. eval("$(\"display\").inner￾HTML += \" U+FFFE is evil \"");
  155. } catch(e) {}
  156. try {
  157. // U+FFFF
  158. eval("$(\"display\").inner￿HTML += \" U+FFFF is evil \"");
  159. } catch(e) {}
  160. try {
  161. // U+1FFFE
  162. eval("$(\"display\").inner🿾HTML += \" U+1FFFE is evil \"");
  163. } catch(e) {}
  164. try {
  165. // U+1FFFF
  166. eval("$(\"display\").inner🿿HTML += \" U+1FFFF is evil \"");
  167. } catch(e) {}
  168. try {
  169. // U+2FFFE
  170. eval("$(\"display\").inner𯿾HTML += \" U+2FFFE is evil \"");
  171. } catch(e) {}
  172. try {
  173. // U+2FFFF
  174. eval("$(\"display\").inner𯿿HTML += \" U+2FFFF is evil \"");
  175. } catch(e) {}
  176. try {
  177. // U+3FFFE
  178. eval("$(\"display\").inner𿿾HTML += \" U+3FFFE is evil \"");
  179. } catch(e) {}
  180. try {
  181. // U+3FFFF
  182. eval("$(\"display\").inner𿿿HTML += \" U+3FFFF is evil \"");
  183. } catch(e) {}
  184. try {
  185. // U+4FFFE
  186. eval("$(\"display\").inner񏿾HTML += \" U+4FFFE is evil \"");
  187. } catch(e) {}
  188. try {
  189. // U+4FFFF
  190. eval("$(\"display\").inner񏿿HTML += \" U+4FFFF is evil \"");
  191. } catch(e) {}
  192. try {
  193. // U+5FFFE
  194. eval("$(\"display\").inner񟿾HTML += \" U+5FFFE is evil \"");
  195. } catch(e) {}
  196. try {
  197. // U+5FFFF
  198. eval("$(\"display\").inner񟿿HTML += \" U+5FFFF is evil \"");
  199. } catch(e) {}
  200. try {
  201. // U+6FFFE
  202. eval("$(\"display\").inner񯿾HTML += \" U+6FFFE is evil \"");
  203. } catch(e) {}
  204. try {
  205. // U+6FFFF
  206. eval("$(\"display\").inner񯿿HTML += \" U+6FFFF is evil \"");
  207. } catch(e) {}
  208. try {
  209. // U+7FFFE
  210. eval("$(\"display\").inner񿿾HTML += \" U+7FFFE is evil \"");
  211. } catch(e) {}
  212. try {
  213. // U+7FFFF
  214. eval("$(\"display\").inner񿿿HTML += \" U+7FFFF is evil \"");
  215. } catch(e) {}
  216. try {
  217. // U+8FFFE
  218. eval("$(\"display\").inner򏿾HTML += \" U+8FFFE is evil \"");
  219. } catch(e) {}
  220. try {
  221. // U+8FFFF
  222. eval("$(\"display\").inner򏿿HTML += \" U+8FFFF is evil \"");
  223. } catch(e) {}
  224. try {
  225. // U+9FFFE
  226. eval("$(\"display\").inner򟿾HTML += \" U+9FFFE is evil \"");
  227. } catch(e) {}
  228. try {
  229. // U+9FFFF
  230. eval("$(\"display\").inner򟿿HTML += \" U+9FFFF is evil \"");
  231. } catch(e) {}
  232. try {
  233. // U+AFFFE
  234. eval("$(\"display\").inner򯿾HTML += \" U+AFFFE is evil \"");
  235. } catch(e) {}
  236. try {
  237. // U+AFFFF
  238. eval("$(\"display\").inner򯿿HTML += \" U+AFFFF is evil \"");
  239. } catch(e) {}
  240. try {
  241. // U+BFFFE
  242. eval("$(\"display\").inner򿿾HTML += \" U+BFFFE is evil \"");
  243. } catch(e) {}
  244. try {
  245. // U+BFFFF
  246. eval("$(\"display\").inner򿿿HTML += \" U+BFFFF is evil \"");
  247. } catch(e) {}
  248. try {
  249. // U+CFFFE
  250. eval("$(\"display\").inner󏿾HTML += \" U+CFFFE is evil \"");
  251. } catch(e) {}
  252. try {
  253. // U+CFFFF
  254. eval("$(\"display\").inner󏿿HTML += \" U+CFFFF is evil \"");
  255. } catch(e) {}
  256. try {
  257. // U+DFFFE
  258. eval("$(\"display\").inner󟿾HTML += \" U+DFFFE is evil \"");
  259. } catch(e) {}
  260. try {
  261. // U+DFFFF
  262. eval("$(\"display\").inner󟿿HTML += \" U+DFFFF is evil \"");
  263. } catch(e) {}
  264. try {
  265. // U+EFFFE
  266. eval("$(\"display\").inner󯿾HTML += \" U+EFFFE is evil \"");
  267. } catch(e) {}
  268. try {
  269. // U+EFFFF
  270. eval("$(\"display\").inner󯿿HTML += \" U+EFFFF is evil \"");
  271. } catch(e) {}
  272. try {
  273. // U+FFFFE
  274. eval("$(\"display\").inner󿿾HTML += \" U+FFFFE is evil \"");
  275. } catch(e) {}
  276. try {
  277. // U+FFFFF
  278. eval("$(\"display\").inner󿿿HTML += \" U+FFFFF is evil \"");
  279. } catch(e) {}
  280. try {
  281. // U+10FFFE
  282. eval("$(\"display\").inner􏿾HTML += \" U+10FFFE is evil \"");
  283. } catch(e) {}
  284. try {
  285. // U+10FFFF
  286. eval("$(\"display\").inner􏿿HTML += \" U+10FFFF is evil \"");
  287. } catch(e) {}
  288. test();
  289. }
  290. SimpleTest.waitForExplicitFinish();
  291. </script>
  292. </pre>
  293. <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=445886">Mozilla Bug 445886</a>
  294. <p id="display">All good.</p>
  295. <div id="content" style="display: none"></div>
  296. </body>
  297. </html>