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
5 - except in compliance with the License. You may obtain a copy of
6 - the License at http://www.mozilla.org/MPL/
8 - Software distributed under the License is distributed on an "AS
9 - IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
10 - implied. See the License for the specific language governing
11 - rights and limitations under the License.
13 - The Original Code is Mozilla Test Cases.
15 - The Initial Developer of the Original Code is Netscape Communications
16 - Corp. Portions created by Netscape Communications Corp. are
17 - Copyright (C) 2001 Netscape Communications Corp. All
22 <html xmlns=
"http://www.w3.org/1999/xhtml">
24 <title>GET test
</title>
25 <style type=
"text/css">
28 border:
1px solid black;
39 <script type=
"text/javascript">
40 var p = new XMLHttpRequest();
42 if (window.testRunner) {
43 testRunner.dumpAsText();
44 testRunner.waitUntilDone();
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};
53 document.getElementById(
"id1").firstChild.nodeValue = p.responseText;
55 var s = new XMLSerializer();
56 var d = p.responseXML;
57 var str = s.serializeToString(d);
58 document.getElementById(
"id2").firstChild.nodeValue = str;
60 document.getElementById(
"id3").firstChild.nodeValue = p.getAllResponseHeaders();
61 document.getElementById(
"id4").firstChild.nodeValue = p.status;
62 document.getElementById(
"id5").firstChild.nodeValue = p.statusText;
63 document.getElementById(
"id6").firstChild.nodeValue = p.readyState;
64 var propNames = new Array;
66 if (prop !=
"timeStamp") {
71 var eventProperties =
"";
72 for (i in propNames) {
73 var prop = propNames[i];
74 var value = (prop in propertiesWithDefaultValues) ? propertiesWithDefaultValues[prop] : e[prop];
75 eventProperties += prop +
" : '" + value +
"'\n";
78 document.getElementById(
"id7").firstChild.nodeValue =
79 "Event object: " + e +
"\n" +
80 "Event properties:\n" + eventProperties;
82 if (window.testRunner)
83 testRunner.notifyDone();
87 p.open(
"GET",
"resources/xmlhttprequest-get-data.xml");
95 <body onload=
"mysend();">
98 <div class=
"box"><span class=
"boxheader">responseText
</span>
99 <pre id=
"id1">@@No result@@
</pre>
101 <div class=
"box"><span class=
"boxheader">responseXML serialized
</span>
102 <pre id=
"id2">@@No result@@
</pre>
104 <div class=
"box"><span class=
"boxheader">getAllResponseHeaders()
</span>
105 <pre id=
"id3">@@No result@@
</pre>
107 <div class=
"box"><span class=
"boxheader">status
</span>
108 <pre id=
"id4">@@No result@@
</pre>
110 <div class=
"box"><span class=
"boxheader">statusText
</span>
111 <pre id=
"id5">@@No result@@
</pre>
113 <div class=
"box"><span class=
"boxheader">readyState
</span>
114 <pre id=
"id6">@@No result@@
</pre>
116 <div class=
"box"><span class=
"boxheader">Event information
</span>
117 <pre id=
"id7">@@No result@@
</pre>