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

Unified Diff: chrome/browser/resources/settings/route.js

Issue 2200013002: Settings Router Refactor: Improve chrome://md-settings/foobar behavior. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove some junk Created 4 years, 5 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: chrome/browser/resources/settings/route.js
diff --git a/chrome/browser/resources/settings/route.js b/chrome/browser/resources/settings/route.js
index dc4f177aafd754a0af8b714d77e5cc4f30e603de..70b3570064f87252fd36fbd789b157c632940bd3 100644
--- a/chrome/browser/resources/settings/route.js
+++ b/chrome/browser/resources/settings/route.js
@@ -296,7 +296,15 @@ cr.define('settings', function() {
* function settings.navigateTo.
* @private {!settings.Route}
*/
- var currentRoute_ = getRouteForPath(window.location.pathname) || Route.BASIC;
+ var currentRoute_ = (function() {
+ var route = getRouteForPath(window.location.pathname);
+ if (route)
+ return route;
+
+ // Reset the URL path to '/' if the user navigates to a nonexistent URL.
+ window.history.replaceState(undefined, '', Route.BASIC.path);
+ return Route.BASIC;
+ })();
Dan Beam 2016/08/02 00:11:04 how would this leak global variables? var current
tommycli 2016/08/02 00:14:29 Yeah, it complains :D
/**
* Helper function to set the current route and notify all observers.
@@ -320,7 +328,7 @@ cr.define('settings', function() {
if (assert(route) == currentRoute_)
return;
- window.history.pushState(undefined, document.title, route.path);
+ window.history.pushState(undefined, '', route.path);
setCurrentRoute(route);
};
« 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