4 https://bugzilla.mozilla.org/show_bug.cgi?id=300691
7 <title>Test for Bug
300691</title>
8 <script src=
"/tests/SimpleTest/SimpleTest.js"></script>
9 <link rel=
"stylesheet" type=
"text/css" href=
"/tests/SimpleTest/test.css" />
12 <a target=
"_blank" href=
"https://bugzilla.mozilla.org/show_bug.cgi?id=300691">Mozilla Bug
300691</a>
14 <div id=
"content" style=
"display: none">
18 <script type=
"text/javascript">
19 // First, setup. We'll be toggling these variables as we go.
29 var test10Ran
= false;
30 var test11Ran
= false;
31 var test12Ran
= false;
32 var test13Ran
= false;
33 var test14aRan
= false;
34 var test14bRan
= false;
35 var test15aRan
= false;
36 var test15bRan
= false;
38 <script id=
"test1" type=
"text/javascript">test1Ran = true;
</script>
39 <script id=
"test2" type=
"text/javascript"></script>
40 <script id=
"test3" type=
"text/javascript">;
</script>
41 <script id=
"test4" type=
"text/javascript"> </script>
42 <script id=
"test5" type=
"text/javascript"></script>
43 <script id=
"test6" type=
"text/javascript"></script>
44 <script id=
"test7" type=
"text/javascript"></script>
45 <script id=
"test8" type=
"text/javascript"></script>
46 <script id=
"test9" type=
"text/javascript"></script>
47 <script id=
"test10" type=
"text/javascript" src=
"data:text/javascript,">
50 <script id=
"test11" type=
"text/javascript"
51 src=
"data:text/javascript,test11Ran = true">
54 <script id=
"test12" type=
"text/javascript"></script>
55 <script id=
"test13" type=
"text/javascript"></script>
56 <script id=
"test14" type=
"text/javascript"></script>
57 <script id=
"test15" type=
"text/javascript"></script>
58 <script class=
"testbody" type=
"text/javascript">
59 /** Test for Bug
300691 **/
60 $(
"test2").appendChild(document.createTextNode(
"test2Ran = true"));
61 is(test2Ran, true,
"Should be 2!");
63 $(
"test3").appendChild(document.createTextNode(
"test3Ran = true"));
64 is(test3Ran, false,
"Should have run already 3!");
66 $(
"test4").appendChild(document.createTextNode(
"test4Ran = true"));
67 is(test4Ran, false,
"Should have run already 4!");
69 $(
"test5").appendChild(document.createTextNode(
" "));
70 $(
"test5").appendChild(document.createTextNode(
"test5Ran = true"));
71 is(test5Ran, false,
"Should have run already 5!");
73 $(
"test6").appendChild(document.createTextNode(
" "));
75 $(
"test7").appendChild(document.createTextNode(
""));
77 $(
"test8").appendChild(document.createTextNode(
""));
79 $(
"test9").appendChild(document.createTextNode(
""));
81 $(
"test12").src =
"data:text/javascript,test12Ran = true;";
82 is(test12Ran, false,
"Not yet 12!");
84 $(
"test13").setAttribute(
"src",
"data:text/javascript,test13Ran = true;");
85 is(test13Ran, false,
"Not yet 13!");
87 $(
"test14").src =
"data:text/javascript,test14aRan = true;";
88 $(
"test14").appendChild(document.createTextNode(
"test14bRan = true"));
89 is(test14aRan, false,
"Not yet 14a!");
90 is(test14bRan, false,
"Not yet 14b!");
92 $(
"test15").src =
"data:text/javascript,test15aRan = true;";
93 $(
"test15").appendChild(document.createTextNode(
"test15bRan = true"));
94 $(
"test15").removeAttribute(
"src");
95 is(test15aRan, false,
"Not yet 15a!");
96 is(test15bRan, false,
"Not yet 15b!");
98 <script type=
"text/javascript">
99 // Follow up on some of those
100 $("test6").appendChild(document
.createTextNode("test6Ran = true"));
101 is(test6Ran
, false, "Should have run already 6!");
103 $("test7").appendChild(document
.createTextNode("test7Ran = true"));
104 is(test7Ran
, true, "Should be 7!");
106 $("test8").insertBefore(document
.createTextNode("test8Ran = true"),
107 $("test8").firstChild
);
108 is(test8Ran
, true, "Should be 8!");
110 $("test9").firstChild
.data
= "test9Ran = true";
111 is(test9Ran
, true, "Should be 9!");
113 <script type=
"text/javascript">
115 is(test1Ran
, true, "Should have run!");
116 is(test3Ran
, false, "Already executed test3 script once");
118 "Should have executed whitespace-only script already");
120 "Should have executed once the whitespace node was added");
122 "Should have executed once the whitespace node was added 2");
123 is(test10Ran
, false, "Has an src; inline part shouldn't run");
124 is(test11Ran
, true, "Script with src should have run");
125 is(test12Ran
, true, "Setting src should execute script");
126 is(test13Ran
, true, "Setting src attribute should execute script");
127 is(test14aRan
, true, "src attribute takes precedence over inline content");
128 is(test14bRan
, false, "src attribute takes precedence over inline content 2");
130 "src attribute load should have started before the attribute got removed");
131 is(test15bRan
, false,
132 "src attribute still got executed, so this shouldn't have been");
136 SimpleTest
.waitForExplicitFinish();