| 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 getXHRObject(){ | 12 function getXHRObject(){ |
| 13 var XMLHTTP_PROGIDS = ['Msxml2.XMLHTTP', 'Microsoft.XMLHTTP', | 13 var XMLHTTP_PROGIDS = ['Msxml2.XMLHTTP', 'Microsoft.XMLHTTP', |
| 14 'Msxml2.XMLHTTP.4.0']; | 14 'Msxml2.XMLHTTP.4.0']; |
| 15 var http = null; | 15 var http = null; |
| 16 try { | 16 try { |
| 17 http = new XMLHttpRequest(); | 17 http = new XMLHttpRequest(); |
| 18 } catch(e) { | 18 } catch(e) { |
| 19 } | 19 } |
| 20 | 20 |
| 21 if (http) | 21 if (http) |
| 22 return http; | 22 return http; |
| 23 | 23 |
| 24 for (var i = 0; i < 3; ++i) { | 24 for (var i = 0; i < 3; ++i) { |
| 25 var progid = XMLHTTP_PROGIDS[i]; | 25 var progid = XMLHTTP_PROGIDS[i]; |
| 26 try { | 26 try { |
| 27 http = new ActiveXObject(progid); | 27 http = new ActiveXObject(progid); |
| 28 } catch(e) { | 28 } catch(e) { |
| 29 } | 29 } |
| 30 | 30 |
| 31 if (http) | 31 if (http) |
| 32 break; | 32 break; |
| 33 } | 33 } |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 | 133 |
| 134 return false; | 134 return false; |
| 135 } | 135 } |
| 136 | 136 |
| 137 function reloadUsingCFProtocol() { | 137 function reloadUsingCFProtocol() { |
| 138 var redirect_location = "cf:"; | 138 var redirect_location = "cf:"; |
| 139 redirect_location += window.location; | 139 redirect_location += window.location; |
| 140 window.location = redirect_location; | 140 window.location = redirect_location; |
| 141 } | 141 } |
| 142 | 142 |
| 143 function isRunningInChrome() { |
| 144 var is_chrome = /chrome/.test(navigator.userAgent.toLowerCase()); |
| 145 return is_chrome; |
| 146 } |
| 147 |
| 143 function TestIfRunningInChrome() { | 148 function TestIfRunningInChrome() { |
| 144 var is_chrome = /chrome/.test(navigator.userAgent.toLowerCase()); | 149 var is_chrome = isRunningInChrome(); |
| 145 if (!is_chrome) { | 150 if (!isRunningInChrome()) { |
| 146 onFailure("ChromeFrameWindowOpen", "Window Open failed :-(", | 151 onFailure("ChromeFrameWindowOpen", "Window Open failed :-(", |
| 147 "User agent = " + navigator.userAgent.toLowerCase()); | 152 "User agent = " + navigator.userAgent.toLowerCase()); |
| 148 } | 153 } |
| 149 return is_chrome; | 154 return is_chrome; |
| 150 } | 155 } |
| OLD | NEW |