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

Unified Diff: components/offline_pages/core/offline_page_model_impl.cc

Issue 2856053003: [Offline pages] Fix order of error checking so URL mismatch would not override other error codes (Closed)
Patch Set: Created 3 years, 8 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 | « components/offline_pages/core/offline_page_model_impl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/offline_pages/core/offline_page_model_impl.cc
diff --git a/components/offline_pages/core/offline_page_model_impl.cc b/components/offline_pages/core/offline_page_model_impl.cc
index fd8c266a90582b3c39f94c5704b1eccf8fb03558..596892d6171acbfba7f5d5bd205f01f10c151b64 100644
--- a/components/offline_pages/core/offline_page_model_impl.cc
+++ b/components/offline_pages/core/offline_page_model_impl.cc
@@ -688,18 +688,10 @@ void OfflinePageModelImpl::OnCreateArchiveDone(
const SavePageCallback& callback,
OfflinePageArchiver* archiver,
ArchiverResult archiver_result,
- const GURL& url,
+ const GURL& saved_url,
const base::FilePath& file_path,
const base::string16& title,
int64_t file_size) {
- if (save_page_params.url != url) {
- DVLOG(1) << "Saved URL does not match requested URL.";
- InformSavePageDone(callback, SavePageResult::ARCHIVE_CREATION_FAILED,
- save_page_params.client_id, offline_id);
- DeletePendingArchiver(archiver);
- return;
- }
-
if (archiver_result != ArchiverResult::SUCCESSFULLY_CREATED) {
SavePageResult result = ToSavePageResult(archiver_result);
InformSavePageDone(
@@ -707,8 +699,18 @@ void OfflinePageModelImpl::OnCreateArchiveDone(
DeletePendingArchiver(archiver);
return;
}
- OfflinePageItem offline_page_item(url, offline_id, save_page_params.client_id,
- file_path, file_size, start_time);
+
+ if (save_page_params.url != saved_url) {
+ DVLOG(1) << "Saved URL does not match requested URL.";
+ InformSavePageDone(callback, SavePageResult::ARCHIVE_CREATION_FAILED,
+ save_page_params.client_id, offline_id);
+ DeletePendingArchiver(archiver);
+ return;
+ }
+
+ OfflinePageItem offline_page_item(saved_url, offline_id,
+ save_page_params.client_id, file_path,
+ file_size, start_time);
offline_page_item.title = title;
offline_page_item.original_url = save_page_params.original_url;
store_->AddOfflinePage(offline_page_item,
« no previous file with comments | « components/offline_pages/core/offline_page_model_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698