Index: chrome/browser/resources/settings/route.js |
diff --git a/chrome/browser/resources/settings/route.js b/chrome/browser/resources/settings/route.js |
index c5f9aa7f5c82258587818ff654cdd42155fa15bd..fb5e8f8735d84467957cc154e32869a97cfb8214 100644 |
--- a/chrome/browser/resources/settings/route.js |
+++ b/chrome/browser/resources/settings/route.js |
@@ -317,18 +317,19 @@ cr.define('settings', function() { |
}; |
/** |
- * Navigates to the previous route, but will never exit Settings. If there is |
- * no previous route in the history, navigates to the immediate parent. |
+ * Navigates to the previous route if it has an equal or lesser depth. |
+ * If there is no previous route in history meeting those requirements, |
+ * this navigates to the immediate parent. This will never exit Settings. |
*/ |
var navigateToPreviousRoute = function() { |
var previousRoute = |
window.history.state && |
assert(getRouteForPath(/** @type {string} */ (window.history.state))); |
- if (previousRoute) |
+ if (previousRoute && previousRoute.depth <= currentRoute_.depth) |
window.history.back(); |
else |
- navigateTo(settings.getCurrentRoute().parent || Route.BASIC); |
+ navigateTo(currentRoute_.parent || Route.BASIC); |
}; |
window.addEventListener('popstate', function(event) { |