|
1 <!DOCTYPE HTML> |
|
2 <html> |
|
3 <!-- |
|
4 https://bugzilla.mozilla.org/show_bug.cgi?id=604660 |
|
5 --> |
|
6 <head> |
|
7 <title>Test for Bug 604660</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=604660">Mozilla Bug 604660</a> |
|
14 <script> |
|
15 SimpleTest.waitForExplicitFinish(); |
|
16 var asyncState = false; |
|
17 var scriptState = 0; |
|
18 |
|
19 function scriptRan(num) { |
|
20 ++scriptState; |
|
21 is(scriptState, num, "Scripts ran in the wrong sequence."); |
|
22 } |
|
23 |
|
24 function asyncRan() { |
|
25 asyncState = true; |
|
26 } |
|
27 |
|
28 </script> |
|
29 <p id="display"><iframe src="file_bug604660-1.xml" onload="iframeloaded()";></iframe></p> |
|
30 <div id="content" style="display: none"> |
|
31 |
|
32 </div> |
|
33 <pre id="test"> |
|
34 <script class="testbody" type="text/javascript"> |
|
35 |
|
36 var xlstProcessorState = false; |
|
37 |
|
38 function xsltProcessorCreatedScriptRan() { |
|
39 xlstProcessorState = true; |
|
40 } |
|
41 |
|
42 function iframeloaded() { |
|
43 ok(asyncState, "Async script should have run."); |
|
44 is(scriptState, 5, "Five scripts should have run."); |
|
45 |
|
46 var processor = new XSLTProcessor(); |
|
47 |
|
48 var xhr = new XMLHttpRequest(); |
|
49 xhr.onreadystatechange = function() { |
|
50 if (this.readyState == 4) { |
|
51 processor.importStylesheet(this.responseXML); |
|
52 xhr.onreadystatechange = function() { |
|
53 if (this.readyState == 4) { |
|
54 var doc = processor.transformToDocument(this.responseXML); |
|
55 var target = document.getElementById("display"); |
|
56 target.appendChild(doc.documentElement.firstChild); |
|
57 ok(!xlstProcessorState, "Scripts created by transformToDocument should not run."); |
|
58 |
|
59 var fragment = processor.transformToFragment(this.responseXML, document); |
|
60 target.appendChild(fragment.firstChild.firstChild); |
|
61 ok(xlstProcessorState, "Scripts created by transformToFragment should run."); |
|
62 |
|
63 SimpleTest.finish(); |
|
64 } |
|
65 } |
|
66 xhr.open("GET", "file_bug604660-5.xml"); |
|
67 xhr.send(); |
|
68 } |
|
69 } |
|
70 xhr.open("GET", "file_bug604660-6.xsl"); |
|
71 xhr.send(); |
|
72 } |
|
73 </script> |
|
74 </pre> |
|
75 </body> |
|
76 </html> |
|
77 |