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

Unified Diff: chrome/browser/android/offline_pages/prerendering_loader.cc

Issue 2294933003: [Offline Pages] Handle prerender FinalStatus UnsupportedScheme as a cancel rather than failure. (Closed)
Patch Set: Revert started try count change from this cl and added TODO with followup bug id. Created 4 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
« no previous file with comments | « no previous file | chrome/browser/android/offline_pages/prerendering_loader_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/android/offline_pages/prerendering_loader.cc
diff --git a/chrome/browser/android/offline_pages/prerendering_loader.cc b/chrome/browser/android/offline_pages/prerendering_loader.cc
index 6f454028d33ae1ed2e3157747b55aca825368e9b..2b84f713c4375d54447379d70c876f4ef8fb1e70 100644
--- a/chrome/browser/android/offline_pages/prerendering_loader.cc
+++ b/chrome/browser/android/offline_pages/prerendering_loader.cc
@@ -157,17 +157,30 @@ void PrerenderingLoader::HandleLoadingStopped() {
if (IsIdle())
return;
- if (adapter_->IsActive()) {
- DVLOG(1) << "Load failed: " << adapter_->GetFinalStatus();
- adapter_->DestroyActive();
- }
// Request status depends on whether we are still loading (failed) or
// did load and then loading was stopped (cancel - from prerender stack).
Offliner::RequestStatus request_status =
IsLoaded() ? Offliner::RequestStatus::PRERENDERING_CANCELED
: Offliner::RequestStatus::PRERENDERING_FAILED;
- // TODO(dougarnett): For failure, determine from final status if retry-able
- // and report different failure statuses if retry-able or not.
+
+ if (adapter_->IsActive()) {
+ prerender::FinalStatus final_status = adapter_->GetFinalStatus();
+ DVLOG(1) << "Load failed: " << final_status;
+
+ // Loss of network connection can show up as unsupported scheme per
+ // a redirect to a special data URL is used to navigate to error page.
+ // We want to be able to retry these request so for now treat any
+ // unsupported scheme error as a cancel.
+ // TODO(dougarnett): Use new FinalStatus code if/when supported (642768).
+ // TODO(dougarnett): Create whitelist of final status codes that should
+ // not be considered failures (and define new RequestStatus code for them).
+ if (adapter_->GetFinalStatus() ==
+ prerender::FinalStatus::FINAL_STATUS_UNSUPPORTED_SCHEME) {
+ request_status = Offliner::RequestStatus::PRERENDERING_CANCELED;
+ }
+ adapter_->DestroyActive();
+ }
+
snapshot_controller_.reset(nullptr);
session_contents_.reset(nullptr);
state_ = State::IDLE;
« no previous file with comments | « no previous file | chrome/browser/android/offline_pages/prerendering_loader_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698