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

Unified Diff: content/browser/loader/resource_loader.cc

Issue 1271733002: [2/3 chromium] Support redirect option of Request and "opaqueredirect" response type. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: check deffered Created 5 years, 4 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: content/browser/loader/resource_loader.cc
diff --git a/content/browser/loader/resource_loader.cc b/content/browser/loader/resource_loader.cc
index 0339cf11c0d5ade2f2f4ebe14a64cd3da4289c3b..f92dfa52540fa9eb91289f404d86a83bc9efadec 100644
--- a/content/browser/loader/resource_loader.cc
+++ b/content/browser/loader/resource_loader.cc
@@ -280,6 +280,28 @@ void ResourceLoader::OnReceivedRedirect(net::URLRequest* unused,
return;
}
+ if (info->fetch_redirect_mode() == FETCH_REDIRECT_MODE_ERROR) {
mmenke 2015/08/10 15:52:02 We're going to need unit tests for both these path
horo 2015/08/11 05:58:20 Added ResourceDispatcherHostTest.FetchRedirectMode
+ Cancel();
+ return;
+ } else if (info->fetch_redirect_mode() == FETCH_REDIRECT_MODE_MANUAL) {
+ // TODO(horo): If we will support upload progress events for Fetch API, we
+ // have to call ReportUploadProgress().
mmenke 2015/08/10 15:52:02 This should actually probably be done unconditiona
mmenke 2015/08/10 15:52:02 nit: Move "will" should before "have".
horo 2015/08/11 05:58:20 Done.
horo 2015/08/11 05:58:20 FETCH_REDIRECT_MODE_MANUAL is supported only by Fe
+ CompleteResponseStarted();
mmenke 2015/08/10 15:52:02 Suggest a blank line after CompleteResponseStarted
horo 2015/08/11 05:58:20 Done.
+ // We don't need to read the response body because there is no way to read
+ // the body of opaque-redirect filtered response's internal response.
mmenke 2015/08/10 15:52:02 nit: Don't use "we" in comments.
horo 2015/08/11 05:58:20 Done.
+ // TODO(horo): When we will support any API which expose the internal body,
mmenke 2015/08/10 15:52:02 Is this "when" or "if"?
mmenke 2015/08/10 15:52:02 nit: Move "will" should before "have".
horo 2015/08/11 05:58:20 Done.
horo 2015/08/11 05:58:20 Done.
+ // we have to read the body before calling ResponseCompleted().
mmenke 2015/08/10 15:52:02 Add warning that Cache changes will be needed befo
horo 2015/08/11 05:58:20 Done.
+ if (is_deferred()) {
mmenke 2015/08/10 15:52:02 I'm not following how this is possible.
horo 2015/08/11 05:58:20 Removed and added "DCHECK(!is_deferred())"
+ // If |deferred_stage_| is set while calling CompleteResponseStarted(),
+ // we reset |deferred_stage_| to call ResponseCompleted when resumed.
mmenke 2015/08/10 15:52:02 nit: Don't use "we" in comments.
horo 2015/08/11 05:58:20 Removed.
+ DCHECK(DEFERRED_READ == deferred_stage_);
mmenke 2015/08/10 15:52:02 I'm really not following how this is possible. We
+ deferred_stage_ = DEFERRED_RESPONSE_COMPLETE;
+ return;
+ }
+ ResponseCompleted();
+ return;
+ }
+
delegate_->DidReceiveRedirect(this, redirect_info.new_url);
if (delegate_->HandleExternalProtocol(this, redirect_info.new_url)) {

Powered by Google App Engine
This is Rietveld 408576698