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

Unified Diff: tools/dom/src/_HttpRequestUtils.dart

Issue 11641005: Add cross-origin test with credentials. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 12 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:
View side-by-side diff with in-line comments
Download patch
Index: tools/dom/src/_HttpRequestUtils.dart
diff --git a/tools/dom/src/_HttpRequestUtils.dart b/tools/dom/src/_HttpRequestUtils.dart
index 36a46ec94ea7424a7bff24dcacf0285a22daa328..11c12833ed99a8fa3aba2a8a04cc21d61eac7966 100644
--- a/tools/dom/src/_HttpRequestUtils.dart
+++ b/tools/dom/src/_HttpRequestUtils.dart
@@ -8,18 +8,25 @@ 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 HttpRequest.get only invoked the callback
+ // when request.status was 0 or 200. 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.
+ onComplete(request);
}
});
« no previous file with comments | « tests/html/xhr_test.dart ('k') | tools/test.dart » ('j') | tools/testing/dart/browser_test.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698