OLD | NEW |
| (Empty) |
1 <html> | |
2 <head> | |
3 <meta http-equiv="x-ua-compatible" content="chrome=1" /> | |
4 <title>ChromeFrame XHR Authorization header test</title> | |
5 <script type="text/javascript" | |
6 src="chrome_frame_tester_helpers.js"></script> | |
7 | |
8 <script type="text/javascript"> | |
9 function ValidateUserAgent() { | |
10 if (isRunningInMSIE()) { | |
11 onFailure("FullTab_XMLHttpRequestAuthorizationHeaderTest", 1, | |
12 "Failed"); | |
13 return; | |
14 } | |
15 if (!SendHeader("Authorization", "Basic")) | |
16 return; | |
17 if (!SendHeader("accept", "application/json")) | |
18 return | |
19 if (SendHeader("cache-control", "no-cache")) { | |
20 onSuccess("FullTabModeIE_XHRHeaderTest", 1); | |
21 } | |
22 } | |
23 | |
24 function ValidateResponse(xhr, ExpectedValue) { | |
25 var pos = xhr.responseText.indexOf(ExpectedValue); | |
26 if (pos >= 0) { | |
27 return true; | |
28 } | |
29 return false; | |
30 } | |
31 | |
32 function SendHeader(header, header_value) { | |
33 var test_name = "FullTabModeIE_XHRHeaderTest"; | |
34 var xhr = getXHRObject(); | |
35 if (!xhr) { | |
36 onFailure(test_name, 1, "Failed to get XHR object"); | |
37 } | |
38 var request_uri = AppendArgumentsToBaseUrl("echoheader?", | |
39 header); | |
40 xhr.open("GET", request_uri, false); | |
41 xhr.setRequestHeader(header, header_value); | |
42 | |
43 try { | |
44 xhr.send(null); | |
45 if (ValidateResponse(xhr, header_value)) { | |
46 appendStatus("Received header: " + xhr.responseText); | |
47 return true; | |
48 } else { | |
49 onFailure(test_name, 1, | |
50 "Failed to find header in response."); | |
51 } | |
52 } catch (e) { | |
53 appendStatus("XHR send failed. Error: " + e.description); | |
54 onFailure(test_name, 1, "Failed to send XHR request"); | |
55 } | |
56 return false; | |
57 } | |
58 </script> | |
59 </head> | |
60 | |
61 <body onLoad="setTimeout(ValidateUserAgent, 100);"> | |
62 ChromeFrame full tab mode XMLHttpRequest HTTP header tests. | |
63 Verifies that HTTP headers set by XML HTTP requests make it via | |
64 the host network stack. | |
65 </body> | |
66 </html> | |
OLD | NEW |