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 appendStatus("Success reported!"); | 5 appendStatus("Success reported!"); |
6 onFinished(name, id, "OK"); | 6 onFinished(name, id, "OK"); |
7 } | 7 } |
8 | 8 |
9 function onFailure(name, id, status) { | 9 function onFailure(name, id, status) { |
10 appendStatus("Failure reported: " + status); | 10 appendStatus("Failure reported: " + status); |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 } | 152 } |
153 | 153 |
154 // Appends arguments passed in to the base document url and returns the same. | 154 // Appends arguments passed in to the base document url and returns the same. |
155 function AppendArgumentsToBaseUrl() { | 155 function AppendArgumentsToBaseUrl() { |
156 var url = GetBaseUrlPath(); | 156 var url = GetBaseUrlPath(); |
157 for (arg_index = 0; arg_index < arguments.length; arg_index++) { | 157 for (arg_index = 0; arg_index < arguments.length; arg_index++) { |
158 url += arguments[arg_index]; | 158 url += arguments[arg_index]; |
159 } | 159 } |
160 return url; | 160 return url; |
161 } | 161 } |
| 162 |
| 163 // Get the value of the first parameter from the query string which matches the |
| 164 // given name. |
| 165 function getURLParameter(name) { |
| 166 name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]"); |
| 167 var regexString = "[\\?&]" + name + "=([^&#]*)"; |
| 168 var regex = new RegExp(regexString); |
| 169 var results = regex.exec(window.location.href); |
| 170 if (results == null) { |
| 171 return ""; |
| 172 } else { |
| 173 return results[1]; |
| 174 } |
| 175 } |
| 176 |
| 177 // Create new URL by given html page name and querystring, based on current URL |
| 178 // path. |
| 179 function buildURL(pageName, queryString) { |
| 180 var path = window.location.pathname; |
| 181 var url = ""; |
| 182 |
| 183 url += window.location.protocol + "//" + window.location.host; |
| 184 if (path.lastIndexOf("/") > 0) { |
| 185 url += path.substring(0, path.lastIndexOf("/")) + "/" + pageName; |
| 186 } else { |
| 187 url += "/" + pageName; |
| 188 } |
| 189 url += ((queryString == "") ? "" : "?" + queryString); |
| 190 return url; |
| 191 } |
OLD | NEW |