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

Unified Diff: pdf/instance.cc

Issue 838103002: Fix for #US#US issue in inprocess PDF case. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressing nit. Created 5 years, 11 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pdf/instance.cc
diff --git a/pdf/instance.cc b/pdf/instance.cc
index 9b4d52ac684e11a722f01efbde712b88a93068d2..83cb5123a4739e32d6b477783da4467c2743da40 100644
--- a/pdf/instance.cc
+++ b/pdf/instance.cc
@@ -1226,7 +1226,13 @@ void Instance::NavigateTo(const std::string& url, bool open_in_new_tab) {
// If |url_copy| starts with '#', then it's for the same URL with a
// different URL fragment.
if (url_copy[0] == '#') {
- url_copy = url_ + url_copy;
+ // if '#' is already present in |url_| then remove old fragment and add
+ // new |url_copy| fragment.
+ std::size_t index = url_.find('#');
+ if (index != std::string::npos)
+ url_copy = url_.substr(0, index) + url_copy;
+ else
+ url_copy = url_ + url_copy;
// Changing the href does not actually do anything when navigating in the
// same tab, so do the actual page scroll here. Then fall through so the
// href gets updated.
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698