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

Unified Diff: tools/dom/templates/html/impl/impl_XMLHttpRequest.darttemplate

Issue 1135893003: Pass Redirect status higher than 307 through to the user (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 7 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
« no previous file with comments | « tests/html/xhr_test.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/dom/templates/html/impl/impl_XMLHttpRequest.darttemplate
diff --git a/tools/dom/templates/html/impl/impl_XMLHttpRequest.darttemplate b/tools/dom/templates/html/impl/impl_XMLHttpRequest.darttemplate
index 1994ff87aa0e75076cb64145b919cc49a8908355..d7fffe9679616340a87a8733376bf0cc5b4b36c7 100644
--- a/tools/dom/templates/html/impl/impl_XMLHttpRequest.darttemplate
+++ b/tools/dom/templates/html/impl/impl_XMLHttpRequest.darttemplate
@@ -221,9 +221,17 @@ $(ANNOTATIONS)$(NATIVESPEC)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS
}
xhr.onLoad.listen((e) {
- // Note: file:// URIs have status of 0.
- if ((xhr.status >= 200 && xhr.status < 300) ||
- xhr.status == 0 || xhr.status == 304) {
+ var accepted = xhr.status >= 200 && xhr.status < 300;
+ var fileUri = xhr.status == 0; // file:// URIs have status of 0.
+ var notModified = xhr.status == 304;
+ // Redirect status is specified up to 307, but others have been used in
+ // practice. Notably Google Drive uses 308 Resume Incomplete for
+ // resumable uploads, and it's also been used as a redirect. The
+ // redirect case will be handled by the browser before it gets to us,
+ // so if we see it we should pass it through to the user.
+ var unknownRedirect = xhr.status > 307 && xhr.status < 400;
+
+ if (accepted || fileUri || notModified || unknownRedirect) {
completer.complete(xhr);
} else {
completer.completeError(e);
« no previous file with comments | « tests/html/xhr_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698