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

Unified Diff: components/sessions/content/content_serialized_navigation_driver.cc

Issue 2355543003: Invalidate the page state when restoring WebUIs (Closed)
Patch Set: rebase, fix comment Created 4 years, 3 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: components/sessions/content/content_serialized_navigation_driver.cc
diff --git a/components/sessions/content/content_serialized_navigation_driver.cc b/components/sessions/content/content_serialized_navigation_driver.cc
index a3305a8695311157429112f3677d91fa124daac5..f7af1144fca06da0d4159d10a81b4404e381428d 100644
--- a/components/sessions/content/content_serialized_navigation_driver.cc
+++ b/components/sessions/content/content_serialized_navigation_driver.cc
@@ -103,6 +103,14 @@ void ContentSerializedNavigationDriver::Sanitize(
content::Referrer::SanitizeForRequest(navigation->virtual_url_,
old_referrer);
+ // Clear any WebUI page state so that WebUI pages reloaded rather than
+ // restored from page state. This fixes session restore when WebUI URLs
+ // change.
+ if (navigation->virtual_url_.SchemeIs(content::kChromeUIScheme) &&
+ navigation->original_request_url_.SchemeIs(content::kChromeUIScheme)) {
Charlie Reis 2016/09/22 18:59:51 This seems like it affects too many cases. For UR
Dan Beam 2016/09/22 19:37:34 do those pages set different virtual URLs? could
calamity 2016/09/23 05:06:33 I don't think we can figure out if the page state
Charlie Reis 2016/09/23 06:33:53 Confirmed that chrome://settings and chrome://hist
+ navigation->encoded_page_state_ = std::string();
+ }
+
// No need to compare the policy, as it doesn't change during
// sanitization. If there has been a change, the referrer needs to be
// stripped from the page state as well.

Powered by Google App Engine
This is Rietveld 408576698