Commit 340ddabb authored by Sean Harrison's avatar Sean Harrison Committed by Commit Bot

PathVisited UMA random values fix

The pathvisited UMA was recording every typo as a different page, we only want to record valid pages, so now we check if it a valid settings page before recording.

Bug: 869847
Change-Id: I53a7834f9d8544d9bc6bbdb3e2cca9887b2fb49e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1819311Reviewed-by: default avatarDavid Roger <droger@chromium.org>
Reviewed-by: default avatarChristian Dullweber <dullweber@chromium.org>
Commit-Queue: Sean Harrison <harrisonsean@chromium.org>
Cr-Commit-Position: refs/heads/master@{#703344}
parent 0afa5cc5
...@@ -749,12 +749,13 @@ cr.define('settings', function() { ...@@ -749,12 +749,13 @@ cr.define('settings', function() {
* Initialize the route and query params from the URL. * Initialize the route and query params from the URL.
*/ */
initializeRouteFromUrl() { initializeRouteFromUrl() {
this.recordMetrics(window.location.pathname);
assert(!this.initializeRouteFromUrlCalled_); assert(!this.initializeRouteFromUrlCalled_);
this.initializeRouteFromUrlCalled_ = true; this.initializeRouteFromUrlCalled_ = true;
const route = this.getRouteForPath(window.location.pathname); const route = this.getRouteForPath(window.location.pathname);
if (route) {
this.recordMetrics(window.location.pathname);
}
// Never allow direct navigation to ADVANCED. // Never allow direct navigation to ADVANCED.
if (route && route != this.routes_.ADVANCED) { if (route && route != this.routes_.ADVANCED) {
this.currentRoute = route; this.currentRoute = route;
...@@ -773,6 +774,7 @@ cr.define('settings', function() { ...@@ -773,6 +774,7 @@ cr.define('settings', function() {
assert(!urlPath.startsWith('chrome://')); assert(!urlPath.startsWith('chrome://'));
assert(!urlPath.startsWith('settings')); assert(!urlPath.startsWith('settings'));
assert(urlPath.startsWith('/')); assert(urlPath.startsWith('/'));
assert(!urlPath.match(/\?/g));
chrome.metricsPrivate.recordSparseHashable( chrome.metricsPrivate.recordSparseHashable(
'WebUI.Settings.PathVisited', urlPath); 'WebUI.Settings.PathVisited', urlPath);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment