OLD | NEW |
1 <?xml version="1.0"?> | 1 <?xml version="1.0"?> |
2 <!-- | 2 <!-- |
3 - The contents of this file are subject to the Mozilla Public | 3 - The contents of this file are subject to the Mozilla Public |
4 - License Version 1.1 (the "License"); you may not use this file | 4 - License Version 1.1 (the "License"); you may not use this file |
5 - except in compliance with the License. You may obtain a copy of | 5 - except in compliance with the License. You may obtain a copy of |
6 - the License at http://www.mozilla.org/MPL/ | 6 - the License at http://www.mozilla.org/MPL/ |
7 - | 7 - |
8 - Software distributed under the License is distributed on an "AS | 8 - Software distributed under the License is distributed on an "AS |
9 - IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or | 9 - IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or |
10 - implied. See the License for the specific language governing | 10 - implied. See the License for the specific language governing |
(...skipping 26 matching lines...) Expand all Loading... |
37 } | 37 } |
38 </style> | 38 </style> |
39 <script type="text/javascript"> | 39 <script type="text/javascript"> |
40 var p = new XMLHttpRequest(); | 40 var p = new XMLHttpRequest(); |
41 | 41 |
42 if (window.testRunner) { | 42 if (window.testRunner) { |
43 testRunner.dumpAsText(); | 43 testRunner.dumpAsText(); |
44 testRunner.waitUntilDone(); | 44 testRunner.waitUntilDone(); |
45 } | 45 } |
46 | 46 |
| 47 // Some properties do not have stable/guaranteed values; |
| 48 // emit default values for these. |
| 49 var propertiesWithDefaultValues = {loaded: 0, total: 0, position: 0, totalSize:
0}; |
| 50 |
47 function myfunc(e) | 51 function myfunc(e) |
48 { | 52 { |
49 document.getElementById("id1").firstChild.nodeValue = p.responseText; | 53 document.getElementById("id1").firstChild.nodeValue = p.responseText; |
50 if (p.responseXML) { | 54 if (p.responseXML) { |
51 var s = new XMLSerializer(); | 55 var s = new XMLSerializer(); |
52 var d = p.responseXML; | 56 var d = p.responseXML; |
53 var str = s.serializeToString(d); | 57 var str = s.serializeToString(d); |
54 document.getElementById("id2").firstChild.nodeValue = str; | 58 document.getElementById("id2").firstChild.nodeValue = str; |
55 } | 59 } |
56 document.getElementById("id3").firstChild.nodeValue = p.getAllResponseHeaders(
); | 60 document.getElementById("id3").firstChild.nodeValue = p.getAllResponseHeaders(
); |
57 document.getElementById("id4").firstChild.nodeValue = p.status; | 61 document.getElementById("id4").firstChild.nodeValue = p.status; |
58 document.getElementById("id5").firstChild.nodeValue = p.statusText; | 62 document.getElementById("id5").firstChild.nodeValue = p.statusText; |
59 document.getElementById("id6").firstChild.nodeValue = p.readyState; | 63 document.getElementById("id6").firstChild.nodeValue = p.readyState; |
60 var propNames = new Array; | 64 var propNames = new Array; |
61 for (prop in e) { | 65 for (prop in e) { |
62 if (prop != "timeStamp") { | 66 if (prop != "timeStamp") { |
63 propNames.push(prop); | 67 propNames.push(prop); |
64 } | 68 } |
65 } | 69 } |
66 propNames.sort(); | 70 propNames.sort(); |
67 var eventProperties = ""; | 71 var eventProperties = ""; |
68 for (i in propNames) { | 72 for (i in propNames) { |
69 var prop = propNames[i]; | 73 var prop = propNames[i]; |
70 eventProperties += prop + " : '" + e[prop] + "'\n"; | 74 var value = (prop in propertiesWithDefaultValues) ? propertiesWithDefaul
tValues[prop] : e[prop]; |
| 75 eventProperties += prop + " : '" + value + "'\n"; |
71 } | 76 } |
72 | 77 |
73 document.getElementById("id7").firstChild.nodeValue = | 78 document.getElementById("id7").firstChild.nodeValue = |
74 "Event object: " + e + "\n" + | 79 "Event object: " + e + "\n" + |
75 "Event properties:\n" + eventProperties; | 80 "Event properties:\n" + eventProperties; |
76 | 81 |
77 if (window.testRunner) | 82 if (window.testRunner) |
78 testRunner.notifyDone(); | 83 testRunner.notifyDone(); |
79 } | 84 } |
80 | 85 |
81 p.onload = myfunc; | 86 p.onload = myfunc; |
82 p.open("GET", "resources/xmlhttprequest-get-data.xml"); | 87 p.open("GET", "resources/xmlhttprequest-get-data.xml"); |
83 | 88 |
(...skipping 23 matching lines...) Expand all Loading... |
107 </div> | 112 </div> |
108 <div class="box"><span class="boxheader">readyState</span> | 113 <div class="box"><span class="boxheader">readyState</span> |
109 <pre id="id6">@@No result@@</pre> | 114 <pre id="id6">@@No result@@</pre> |
110 </div> | 115 </div> |
111 <div class="box"><span class="boxheader">Event information</span> | 116 <div class="box"><span class="boxheader">Event information</span> |
112 <pre id="id7">@@No result@@</pre> | 117 <pre id="id7">@@No result@@</pre> |
113 </div> | 118 </div> |
114 | 119 |
115 </body> | 120 </body> |
116 </html> | 121 </html> |
OLD | NEW |