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

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

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:
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 898af6c54847cf0d5158a5ca3610b99c679bea0c..fb38152353b098984355a1024a3654a4ed902a23 100644
--- a/sdk/lib/html/dart2js/html_dart2js.dart
+++ b/sdk/lib/html/dart2js/html_dart2js.dart
@@ -18402,9 +18402,17 @@ class HttpRequest extends HttpRequestEventTarget {
}
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 | « 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