Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(334)

Unified Diff: sdk/lib/html/dart2js/html_dart2js.dart

Issue 12224055: Converting XHR from onLoad to onReadyStateChange (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
Download patch
« no previous file with comments | « no previous file | sdk/lib/html/dartium/html_dartium.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/html/dart2js/html_dart2js.dart
diff --git a/sdk/lib/html/dart2js/html_dart2js.dart b/sdk/lib/html/dart2js/html_dart2js.dart
index e33d421417b5c54dbd7df861804c9c92101fb578..1fdbeed3c78a6b1afdcca755cf0f5b1e0a3c9a82 100644
--- a/sdk/lib/html/dart2js/html_dart2js.dart
+++ b/sdk/lib/html/dart2js/html_dart2js.dart
@@ -12768,6 +12768,11 @@ class HttpRequest extends EventTarget native "*XMLHttpRequest" {
* * The `Access-Control-Allow-Credentials` header of `url` must be set to true.
* * If `Access-Control-Expose-Headers` has not been set to true, only a subset of all the response headers will be returned when calling [getAllRequestHeaders].
*
+ * Note that requests for file:// URIs are only supported by Chrome extensions
+ * with appropriate permissions in their manifest. Requests to file:// URIs
+ * will also never fail- the Future will always complete successfully, even
+ * when the file cannot be found.
+ *
* See also: [authorization headers](http://en.wikipedia.org/wiki/Basic_access_authentication).
*/
static Future<HttpRequest> request(String url,
@@ -12794,8 +12799,9 @@ class HttpRequest extends EventTarget native "*XMLHttpRequest" {
}
xhr.onLoad.listen((e) {
- if (xhr.status >= 200 && xhr.status < 300 ||
- xhr.status == 304 ) {
+ // Note: file:// URIs have status of 0.
+ if ((xhr.status >= 200 && xhr.status < 300) ||
+ xhr.status == 0 || xhr.status == 304) {
completer.complete(xhr);
} else {
completer.completeError(e);
« no previous file with comments | « no previous file | sdk/lib/html/dartium/html_dartium.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698