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

Unified Diff: content/browser/web_contents/navigation_controller_impl.h

Issue 10871090: history.replaceState(..., location.href) clearing page-action icons. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 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/web_contents/navigation_controller_impl.h
===================================================================
--- content/browser/web_contents/navigation_controller_impl.h (revision 153532)
+++ content/browser/web_contents/navigation_controller_impl.h (working copy)
@@ -156,14 +156,23 @@
// pending and in page navigations only happen on committed pages. If there
// is no last committed entry, then nothing will be in-page.
//
- // Special note: if the URLs are the same, it does NOT count as an in-page
- // navigation. Neither does an input URL that has no ref, even if the rest is
- // the same. This may seem weird, but when we're considering whether a
- // navigation happened without loading anything, the same URL would be a
- // reload, while only a different ref would be in-page (pages can't clear
+ // Special note: if the URLs are the same, it does NOT automatically count as
+ // an in-page navigation. Neither does an input URL that has no ref, even if
+ // the rest is the same. This may seem weird, but when we're considering
+ // whether a navigation happened without loading anything, the same URL could
+ // be a reload, while only a different ref would be in-page (pages can't clear
// refs without reload, only change to "#" which we don't count as empty).
- bool IsURLInPageNavigation(const GURL& url) const;
+ bool IsURLInPageNavigation(const GURL& url) const {
+ return IsURLInPageNavigation(url, false);
Charlie Reis 2012/08/28 20:06:16 Isn't overloading usually frowned upon in Chrome?
Tom Sepez 2012/08/28 20:17:41 Yep, but it avoids having to write a comment about
+ }
+ // The situation is made murkier by history.replaceState(), which could
+ // provide the same URL as part of an in-page navigation, not a reload. So
+ // we need this form which lets this the (untrustworthy) renderer resolve the
Charlie Reis 2012/08/28 20:06:16 nit: which lets the
Tom Sepez 2012/08/28 20:17:41 Done.
+ // ambiguity, but only when the URLs are equal. This should be safe since the
Charlie Reis 2012/08/28 20:06:16 maybe: "URLs are equal (apart from refs)"?
Tom Sepez 2012/08/28 20:17:41 Current impl is strict equality.
+ // origin isn't changing.
+ bool IsURLInPageNavigation(const GURL& url, bool renderer_says_in_page) const;
+
// Sets the SessionStorageNamespace for the given |partition_id|. This is
// used during initialization of a new NavigationController to allow
// pre-population of the SessionStorageNamespace objects. Session restore,

Powered by Google App Engine
This is Rietveld 408576698