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 5da1bdfb5b877687ba9ba83831c2a3a3588f7590..e7de516de5d680dd8f6f534680c363ff1b087199 100644 |
--- a/sdk/lib/html/dart2js/html_dart2js.dart |
+++ b/sdk/lib/html/dart2js/html_dart2js.dart |
@@ -24219,18 +24219,26 @@ class _HttpRequestUtils { |
// Helper for factory HttpRequest.get |
static HttpRequest get(String url, |
- onSuccess(HttpRequest request), |
+ onComplete(HttpRequest request), |
bool withCredentials) { |
final request = new HttpRequest(); |
request.open('GET', url, true); |
request.withCredentials = withCredentials; |
- // Status 0 is for local XHR request. |
request.on.readyStateChange.add((e) { |
- if (request.readyState == HttpRequest.DONE && |
- (request.status == 200 || request.status == 0)) { |
- onSuccess(request); |
+ if (request.readyState == HttpRequest.DONE) { |
+ // TODO(efortuna): Previously the HttpRequest.get only called the |
+ // callback with the additional constraints below on the status. This |
+ // causes two problems 1) request.status = 0 for ANY local XHR request |
+ // (file found or not found) 2) the user facing function claims that the |
+ // callback is called on completion of the request, regardless of |
+ // status. Because the new event model is coming in soon, rather than |
+ // fixing the callbacks version, we just need to revisit the desired |
+ // behavior when we're using streams/futures. |
+ // Status 0 is for local XHR request. |
+ //(request.status == 200 || request.status == 0)) { |
+ onComplete(request); |
} |
}); |