OLD | NEW |
1 // | 1 // |
2 // This script provides some mechanics for testing ChromeFrame | 2 // This script provides some mechanics for testing ChromeFrame |
3 // | 3 // |
4 function onSuccess(name, id) { | 4 function onSuccess(name, id) { |
5 onFinished(name, id, "OK"); | 5 onFinished(name, id, "OK"); |
6 } | 6 } |
7 | 7 |
8 function onFailure(name, id, status) { | 8 function onFailure(name, id, status) { |
9 onFinished(name, id, status); | 9 onFinished(name, id, status); |
10 } | 10 } |
11 | 11 |
| 12 function byId(id) { |
| 13 return document.getElementById(id); |
| 14 } |
| 15 |
12 function getXHRObject(){ | 16 function getXHRObject(){ |
13 var XMLHTTP_PROGIDS = ['Msxml2.XMLHTTP', 'Microsoft.XMLHTTP', | 17 var XMLHTTP_PROGIDS = ['Msxml2.XMLHTTP', 'Microsoft.XMLHTTP', |
14 'Msxml2.XMLHTTP.4.0']; | 18 'Msxml2.XMLHTTP.4.0']; |
15 var http = null; | 19 var http = null; |
16 try { | 20 try { |
17 http = new XMLHttpRequest(); | 21 http = new XMLHttpRequest(); |
18 } catch(e) { | 22 } catch(e) { |
19 } | 23 } |
20 | 24 |
21 if (http) | 25 if (http) |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 | 88 |
85 // set a cookie to report the results... | 89 // set a cookie to report the results... |
86 var cookie = name + "." + id + ".status=" + result + "; path=/"; | 90 var cookie = name + "." + id + ".status=" + result + "; path=/"; |
87 document.cookie = cookie; | 91 document.cookie = cookie; |
88 | 92 |
89 // ...and POST the status back to the server | 93 // ...and POST the status back to the server |
90 postResult(name, result); | 94 postResult(name, result); |
91 } | 95 } |
92 | 96 |
93 function appendStatus(message) { | 97 function appendStatus(message) { |
94 var statusPanel = document.getElementById("statusPanel"); | 98 var statusPanel = byId("statusPanel"); |
95 if (statusPanel) { | 99 if (statusPanel) { |
96 statusPanel.innerHTML += '<BR>' + message; | 100 statusPanel.innerHTML += '<BR>' + message; |
97 } | 101 } |
98 } | 102 } |
99 | 103 |
100 function readCookie(name) { | 104 function readCookie(name) { |
101 var cookie_name = name + "="; | 105 var cookie_name = name + "="; |
102 var ca = document.cookie.split(';'); | 106 var ca = document.cookie.split(';'); |
103 | 107 |
104 for(var i = 0 ; i < ca.length ; i++) { | 108 for(var i = 0 ; i < ca.length ; i++) { |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 } | 150 } |
147 | 151 |
148 function TestIfRunningInChrome() { | 152 function TestIfRunningInChrome() { |
149 var is_chrome = isRunningInChrome(); | 153 var is_chrome = isRunningInChrome(); |
150 if (!is_chrome) { | 154 if (!is_chrome) { |
151 onFailure("ChromeFrameWindowOpen", "Window Open failed :-(", | 155 onFailure("ChromeFrameWindowOpen", "Window Open failed :-(", |
152 "User agent = " + navigator.userAgent.toLowerCase()); | 156 "User agent = " + navigator.userAgent.toLowerCase()); |
153 } | 157 } |
154 return is_chrome; | 158 return is_chrome; |
155 } | 159 } |
OLD | NEW |