| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 part of $LIBRARYNAME; | 5 part of $LIBRARYNAME; |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * A utility for retrieving data from a URL. | 8 * A utility for retrieving data from a URL. |
| 9 * | 9 * |
| 10 * HttpRequest can be used to obtain data from http, ftp, and file | 10 * HttpRequest can be used to obtain data from http, ftp, and file |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 var xhr = JS('var', 'new XDomainRequest()'); | 243 var xhr = JS('var', 'new XDomainRequest()'); |
| 244 JS('', '#.open(#, #)', xhr, method, url); | 244 JS('', '#.open(#, #)', xhr, method, url); |
| 245 JS('', '#.onload = #', xhr, convertDartClosureToJS((e) { | 245 JS('', '#.onload = #', xhr, convertDartClosureToJS((e) { |
| 246 var response = JS('String', '#.responseText', xhr); | 246 var response = JS('String', '#.responseText', xhr); |
| 247 completer.complete(response); | 247 completer.complete(response); |
| 248 }, 1)); | 248 }, 1)); |
| 249 JS('', '#.onerror = #', xhr, convertDartClosureToJS((e) { | 249 JS('', '#.onerror = #', xhr, convertDartClosureToJS((e) { |
| 250 completer.completeError(e); | 250 completer.completeError(e); |
| 251 }, 1)); | 251 }, 1)); |
| 252 | 252 |
| 253 // IE9 RTM - XDomainRequest issued requests may abort if all event handlers |
| 254 // not specified |
| 255 // http://social.msdn.microsoft.com/Forums/ie/en-US/30ef3add-767c-4436-b8a9-
f1ca19b4812e/ie9-rtm-xdomainrequest-issued-requests-may-abort-if-all-event-handl
ers-not-specified |
| 256 JS('', '#.onprogress = {}', xhr); |
| 257 JS('', '#.ontimeout = {}', xhr); |
| 258 JS('', '#.timeout = Number.MAX_VALUE', xhr); |
| 259 |
| 253 if (sendData != null) { | 260 if (sendData != null) { |
| 254 JS('', '#.send(#)', xhr, sendData); | 261 JS('', '#.send(#)', xhr, sendData); |
| 255 } else { | 262 } else { |
| 256 JS('', '#.send()', xhr); | 263 JS('', '#.send()', xhr); |
| 257 } | 264 } |
| 258 | 265 |
| 259 return completer.future; | 266 return completer.future; |
| 260 $endif | 267 $endif |
| 261 } | 268 } |
| 262 | 269 |
| 263 $!MEMBERS | 270 $!MEMBERS |
| 264 } | 271 } |
| OLD | NEW |