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

Unified Diff: pdf/document_loader.cc

Issue 2407683002: PDF: Check the loaded URL in sendScriptingMessage_(). (Closed)
Patch Set: Created 4 years, 2 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: pdf/document_loader.cc
diff --git a/pdf/document_loader.cc b/pdf/document_loader.cc
index ae608eff93e6e45bb7db06517afb70a403f80da5..b124dbe8c0551a66f58564da558f279e529164e9 100644
--- a/pdf/document_loader.cc
+++ b/pdf/document_loader.cc
@@ -358,7 +358,8 @@ void DocumentLoader::DidOpen(int32_t result) {
return;
}
- int32_t http_code = loader_.GetResponseInfo().GetStatusCode();
+ pp::URLResponseInfo response = loader_.GetResponseInfo();
+ int32_t http_code = response.GetStatusCode();
if (http_code >= 400 && http_code < 500) {
// Error accessing resource. 4xx error indicate subsequent requests
// will fail too.
@@ -367,6 +368,21 @@ void DocumentLoader::DidOpen(int32_t result) {
return;
}
+ pp::Var response_url = response.GetURL();
+ std::string response_url_str;
+ if (response_url.is_string())
+ response_url_str = response_url.AsString();
+ if (response_url_str.empty())
+ return;
+
+ if (actual_url_.empty()) {
+ actual_url_ = response_url_str;
robwu 2016/10/09 10:49:50 Testing for URL equality may be too strict. Checki
Lei Zhang 2016/10/11 00:11:09 Ack. We can certainly do that if desired.
+ client_->OnGotActualURL(actual_url_);
+ } else {
+ if (actual_url_ != response_url_str)
Lei Zhang 2016/10/11 00:09:02 I was wondering about this as well. Would a web se
Tom Sepez 2016/10/11 16:10:47 Seems unlikely, but we'll find out. Want to add a
nasko 2016/10/12 00:47:47 Why not DumpWithoutCrashing? If it is never hit, i
+ return;
+ }
+
is_multipart_ = false;
current_chunk_size_ = 0;
current_chunk_read_ = 0;

Powered by Google App Engine
This is Rietveld 408576698