|
1 <html xmlns="http://www.w3.org/1999/xhtml"> |
|
2 <!-- |
|
3 https://bugzilla.mozilla.org/show_bug.cgi?id=332848 |
|
4 --> |
|
5 <head> |
|
6 <title>Test for Bug 332848</title> |
|
7 <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
|
8 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> |
|
9 </head> |
|
10 <body> |
|
11 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=332848">Mozilla Bug 332848</a> |
|
12 <p id="display"></p> |
|
13 <div id="content" style="display: none"> |
|
14 |
|
15 </div> |
|
16 <pre id="test"> |
|
17 <script class="testbody" type="text/javascript"> |
|
18 <![CDATA[ |
|
19 |
|
20 /** Test for Bug 332848 **/ |
|
21 |
|
22 // parseChecker will become true if we keep parsing after calling close(). |
|
23 var parseChecker = false; |
|
24 |
|
25 function test() { |
|
26 try { |
|
27 document.open(); |
|
28 is(0, 1, "document.open succeeded"); |
|
29 } catch (e) { |
|
30 is (e.name, "InvalidStateError", |
|
31 "Wrong exception from document.open"); |
|
32 is (e.code, DOMException.INVALID_STATE_ERR, |
|
33 "Wrong exception from document.open"); |
|
34 } |
|
35 |
|
36 try { |
|
37 document.write("aaa"); |
|
38 is(0, 1, "document.write succeeded"); |
|
39 } catch (e) { |
|
40 is (e.name, "InvalidStateError", |
|
41 "Wrong exception from document.write"); |
|
42 is (e.code, DOMException.INVALID_STATE_ERR, |
|
43 "Wrong exception from document.write"); |
|
44 } |
|
45 |
|
46 try { |
|
47 document.writeln("aaa"); |
|
48 is(0, 1, "document.write succeeded"); |
|
49 } catch (e) { |
|
50 is (e.name, "InvalidStateError", |
|
51 "Wrong exception from document.write"); |
|
52 is (e.code, DOMException.INVALID_STATE_ERR, |
|
53 "Wrong exception from document.write"); |
|
54 } |
|
55 |
|
56 try { |
|
57 document.close(); |
|
58 is(0, 1, "document.close succeeded"); |
|
59 } catch (e) { |
|
60 is (e.name, "InvalidStateError", |
|
61 "Wrong exception from document.close"); |
|
62 is (e.code, DOMException.INVALID_STATE_ERR, |
|
63 "Wrong exception from document.close"); |
|
64 } |
|
65 } |
|
66 |
|
67 function loadTest() { |
|
68 is(parseChecker, true, "Parsing stopped"); |
|
69 test(); |
|
70 SimpleTest.finish(); |
|
71 } |
|
72 |
|
73 window.onload = loadTest; |
|
74 |
|
75 SimpleTest.waitForExplicitFinish(); |
|
76 |
|
77 test(); |
|
78 ]]> |
|
79 </script> |
|
80 <script> |
|
81 parseChecker = true; |
|
82 </script> |
|
83 </pre> |
|
84 </body> |
|
85 </html> |
|
86 |