summaryrefslogtreecommitdiffstats
path: root/chrome_frame/test/data/xmlhttprequest_test.html
blob: f5894c29fe95a37b64f6cbb0adbba8aa2990c89b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<html>
  <head>
    <meta http-equiv="x-ua-compatible" content="chrome=1" />
    <title>ChromeFrame keyevent test</title>
    <script type="text/javascript"
        src="chrome_frame_tester_helpers.js"></script>

    <script type="text/javascript">
      function ValidateUserAgent() {
        if (isRunningInMSIE()) {
          onFailure("FullTab_XMLHttpRequestTest", 1, "Failed");
        }

        SendXHRRequest();
      }

      function SendXHRRequest() {
        var xhr = getXHRObject();
        if (!xhr) {
          onFailure("FullTab_XMLHttpRequestTest", 1,
                    "Failed to get XHR object");
        }

        var url = GetBaseUrlPath() + "echoheader?User-Agent";
        xhr.open("GET", url, false);
        try {
          xhr.send(null);
          var pos = xhr.responseText.indexOf("chromeframe");
          if (pos >= 0) {
            appendStatus("Received user agent: " + xhr.responseText);
            onSuccess("FullTab_XMLHttpRequestTest", 1);
          } else {
            onFailure("FullTab_XMLHttpRequestTest", 1,
                      "Failed to find chromeframe in user agent.");
          }
        } catch (e) {
          appendStatus("XHR send failed. Error: " + e.description);
          onFailure("FullTab_XMLHttpRequestTest", 1,
                    "Failed to send XHR request");
        }
      }
    </script>
  </head>

  <body onLoad="setTimeout(ValidateUserAgent, 100);">
    ChromeFrame full tab mode XMLHttpRequest test. Verifies that
    XMLHttpRequests use the host network stack.
  </body>
</html>