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

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

Issue 2231203002: Settings Router Refactor: Normalize URL only for main settings page. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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: chrome/browser/resources/settings/route.js
diff --git a/chrome/browser/resources/settings/route.js b/chrome/browser/resources/settings/route.js
index 096b3c13c9ecc79ea540eec75d273a1504609128..091e4b745d3665aeda6803f9cc0a45a4bf9407d0 100644
--- a/chrome/browser/resources/settings/route.js
+++ b/chrome/browser/resources/settings/route.js
@@ -312,16 +312,18 @@ cr.define('settings', function() {
*/
var currentQueryParameters_ = new URLSearchParams();
- // Initialize the route and query params from the URL.
- (function() {
+ /**
+ * Initialize the route and query params from the URL.
+ */
+ var initializeRouteFromUrl = function() {
var route = getRouteForPath(window.location.pathname);
michaelpg 2016/08/12 22:18:02 wonder if it's worth adding a check that we only c
tommycli 2016/08/15 17:36:00 Done.
if (route) {
currentRoute_ = route;
currentQueryParameters_ = new URLSearchParams(window.location.search);
} else {
- window.history.pushState(undefined, '', Route.BASIC.path);
+ window.history.replaceState(undefined, '', Route.BASIC.path);
}
- })();
+ };
/**
* Helper function to set the current route and notify all observers.
@@ -379,6 +381,7 @@ cr.define('settings', function() {
Route: Route,
RouteObserverBehavior: RouteObserverBehavior,
getRouteForPath: getRouteForPath,
+ initializeRouteFromUrl: initializeRouteFromUrl,
getCurrentRoute: getCurrentRoute,
getQueryParameters: getQueryParameters,
navigateTo: navigateTo,
« no previous file with comments | « chrome/browser/resources/settings/compiled_resources2.gyp ('k') | chrome/browser/resources/settings/settings.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698