Bug 449371 Firefox/Thunderbird crashes at exit [@ gdk_display_x11_finalize], p=Brian...
[wine-gecko.git] / testing / mochitest / tests / test_bug300691-2.html
blobe2a4e4986dd8b9d299f169641f23add19b97002e
1 <!DOCTYPE HTML>
2 <html>
3 <!--
4 https://bugzilla.mozilla.org/show_bug.cgi?id=300691
5 -->
6 <head>
7 <title>Test for Bug 300691</title>
8 <script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
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>
13 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=300691">Mozilla Bug 300691</a>
14 <p id="display"></p>
15 <div id="content" style="display: none">
17 </div>
18 <pre id="test">
19 <script type="text/javascript">
20 // First, setup. We'll be toggling these variables as we go.
21 // Note that scripts don't execute immediately when you put text in them --
22 // they wait for the currently-running script to finish.
23 var test1Ran = false;
24 var test2Ran = false;
25 var test3Ran = false;
26 var test4Ran = false;
27 var test5Ran = false;
28 var test6Ran = false;
29 var test7Ran = false;
30 var test8Ran = false;
31 var test9Ran = false;
32 var test10Ran = false;
33 var test11Ran = false;
34 var test12Ran = false;
35 var test13Ran = false;
36 var test14aRan = false;
37 var test14bRan = false;
38 var test15aRan = false;
39 var test15bRan = false;
40 </script>
41 <script id="test1" type="text/javascript">test1Ran = true;</script>
42 <script id="test2" type="text/javascript"></script>
43 <script id="test3" type="text/javascript">;</script>
44 <script id="test4" type="text/javascript"> </script>
45 <script id="test5" type="text/javascript"></script>
46 <script id="test6" type="text/javascript"></script>
47 <script id="test7" type="text/javascript"></script>
48 <script id="test8" type="text/javascript"></script>
49 <script id="test9" type="text/javascript"></script>
50 <script id="test10" type="text/javascript" src="data:text/javascript,">
51 test10Ran = true;
52 </script>
53 <script id="test11" type="text/javascript"
54 src="data:text/javascript,test11Ran = true">
55 test11Ran = false;
56 </script>
57 <script id="test12" type="text/javascript"></script>
58 <script id="test13" type="text/javascript"></script>
59 <script id="test14" type="text/javascript"></script>
60 <script id="test15" type="text/javascript"></script>
61 <script class="testbody" type="text/javascript">
62 /** Test for Bug 300691 **/
63 $("test2").appendChild(document.createTextNode("test2Ran = true"));
64 is(test2Ran, false, "Not yet 2!");
66 $("test3").appendChild(document.createTextNode("test3Ran = true"));
67 is(test3Ran, false, "Not yet 3!");
69 $("test4").appendChild(document.createTextNode("test4Ran = true"));
70 is(test4Ran, false, "Not yet 4!");
72 $("test5").appendChild(document.createTextNode(" "));
73 $("test5").appendChild(document.createTextNode("test5Ran = true"));
74 is(test5Ran, false, "Not yet 5!");
76 $("test6").appendChild(document.createTextNode(" "));
78 $("test7").appendChild(document.createTextNode(""));
80 $("test8").appendChild(document.createTextNode(""));
82 $("test9").appendChild(document.createTextNode(""));
84 $("test12").src = "data:text/javascript,test12Ran = true;";
85 is(test12Ran, false, "Not yet 12!");
87 $("test13").setAttribute("src", "data:text/javascript,test13Ran = true;");
88 is(test13Ran, false, "Not yet 13!");
90 $("test14").src = "data:text/javascript,test14aRan = true;";
91 $("test14").appendChild(document.createTextNode("test14bRan = true"));
92 is(test14aRan, false, "Not yet 14a!");
93 is(test14bRan, false, "Not yet 14b!");
95 $("test15").src = "data:text/javascript,test15aRan = true;";
96 $("test15").appendChild(document.createTextNode("test15bRan = true"));
97 $("test15").removeAttribute("src");
98 is(test15aRan, false, "Not yet 15a!");
99 is(test15bRan, false, "Not yet 15b!");
100 </script>
101 <script type="text/javascript">
102 // Follow up on some of those
103 $("test6").appendChild(document.createTextNode("test6Ran = true"));
104 is(test6Ran, false, "Not yet 6!");
106 $("test7").appendChild(document.createTextNode("test7Ran = true"));
107 is(test7Ran, false, "Not yet 7!");
109 $("test8").insertBefore(document.createTextNode("test8Ran = true"),
110 $("test8").firstChild);
111 is(test8Ran, false, "Not yet 8!");
113 $("test9").firstChild.data = "test9Ran = true";
114 is(test9Ran, false, "Not yet 9!");
115 </script>
116 <script type="text/javascript">
117 is(test1Ran, true, "Should have run!");
118 is(test2Ran, true, "Should execute empty script on child append");
119 is(test3Ran, false, "Already executed test3 script once");
120 is(test4Ran, false,
121 "Shouldn't execute whitespace-only script on child append; should have executed it before");
122 is(test5Ran, true,
123 "By the time it tries to execute, it's got both textnodes");
124 is(test6Ran, false,
125 "Shouldn't execute whitespace-only script on child append 2; should have executed it when it became nonempty");
126 is(test7Ran, true, "Should execute empty script on child append 2");
127 is(test8Ran, true, "Should execute empty script on child insert");
128 is(test9Ran, true, "Should execute empty script if child gets some text");
129 is(test10Ran, false, "Has an src; inline part shouldn't run");
130 is(test11Ran, true, "Script with src should have run");
131 is(test12Ran, true, "Setting src should execute script");
132 is(test13Ran, true, "Setting src attribute should execute script");
133 is(test14aRan, true, "src attribute takes precedence over inline content");
134 is(test14bRan, false, "src attribute takes precedence over inline content 2");
135 is(test15aRan, true,
136 "src attribute load should have started before the attribute got removed");
137 is(test15bRan, false,
138 "src attribute still got executed, so this shouldn't have been");
139 </script>
140 </pre>
141 </body>
142 </html>