diff --git a/browser/base/content/browser.js b/browser/base/content/browser.js index 494bb9e5dbcb..b177c0d36519 100644 --- a/browser/base/content/browser.js +++ b/browser/base/content/browser.js @@ -2326,11 +2326,11 @@ function BrowserReload() { BrowserReloadWithFlags(reloadFlags); } +const kSkipCacheFlags = Ci.nsIWebNavigation.LOAD_FLAGS_BYPASS_PROXY | + Ci.nsIWebNavigation.LOAD_FLAGS_BYPASS_CACHE; function BrowserReloadSkipCache() { // Bypass proxy and cache. - const reloadFlags = Ci.nsIWebNavigation.LOAD_FLAGS_BYPASS_PROXY | - Ci.nsIWebNavigation.LOAD_FLAGS_BYPASS_CACHE; - BrowserReloadWithFlags(reloadFlags); + BrowserReloadWithFlags(kSkipCacheFlags); } function BrowserHome(aEvent) { @@ -5640,24 +5640,43 @@ var TabsProgressListener = { onStateChange(aBrowser, aWebProgress, aRequest, aStateFlags, aStatus) { // Collect telemetry data about tab load times. if (aWebProgress.isTopLevel && (!aRequest.originalURI || aRequest.originalURI.scheme != "about")) { - let stopwatchRunning = TelemetryStopwatch.running("FX_PAGE_LOAD_MS_2", aBrowser); + let histogram = "FX_PAGE_LOAD_MS_2"; + let recordLoadTelemetry = true; + if (aWebProgress.loadType & Ci.nsIDocShell.LOAD_CMD_RELOAD) { + // loadType is constructed by shifting loadFlags, this is why we need to + // do the same shifting here. + // https://searchfox.org/mozilla-central/rev/11cfa0462a6b5d8c5e2111b8cfddcf78098f0141/docshell/base/nsDocShellLoadTypes.h#22 + if (aWebProgress.loadType & (kSkipCacheFlags << 16)) { + histogram = "FX_PAGE_RELOAD_SKIP_CACHE_MS"; + } else if (aWebProgress.loadType == Ci.nsIDocShell.LOAD_CMD_RELOAD) { + histogram = "FX_PAGE_RELOAD_NORMAL_MS"; + } else { + recordLoadTelemetry = false; + } + } + + let stopwatchRunning = TelemetryStopwatch.running(histogram, aBrowser); if (aStateFlags & Ci.nsIWebProgressListener.STATE_IS_WINDOW) { if (aStateFlags & Ci.nsIWebProgressListener.STATE_START) { if (stopwatchRunning) { // Oops, we're seeing another start without having noticed the previous stop. - TelemetryStopwatch.cancel("FX_PAGE_LOAD_MS_2", aBrowser); + if (recordLoadTelemetry) + TelemetryStopwatch.cancel(histogram, aBrowser); } - TelemetryStopwatch.start("FX_PAGE_LOAD_MS_2", aBrowser); + if (recordLoadTelemetry) + TelemetryStopwatch.start(histogram, aBrowser); Services.telemetry.getHistogramById("FX_TOTAL_TOP_VISITS").add(true); } else if (aStateFlags & Ci.nsIWebProgressListener.STATE_STOP && stopwatchRunning /* we won't see STATE_START events for pre-rendered tabs */) { - TelemetryStopwatch.finish("FX_PAGE_LOAD_MS_2", aBrowser); + if (recordLoadTelemetry) + TelemetryStopwatch.finish(histogram, aBrowser); } } else if (aStateFlags & Ci.nsIWebProgressListener.STATE_STOP && aStatus == Cr.NS_BINDING_ABORTED && stopwatchRunning /* we won't see STATE_START events for pre-rendered tabs */) { - TelemetryStopwatch.cancel("FX_PAGE_LOAD_MS_2", aBrowser); + if (recordLoadTelemetry) + TelemetryStopwatch.cancel(histogram, aBrowser); } } }, diff --git a/toolkit/components/telemetry/Histograms.json b/toolkit/components/telemetry/Histograms.json index b1433d1808e5..050954aedb68 100644 --- a/toolkit/components/telemetry/Histograms.json +++ b/toolkit/components/telemetry/Histograms.json @@ -6340,6 +6340,28 @@ "alert_emails": ["tdsmith@mozilla.com", "perfteam@mozilla.com", "product-metrics-telemetry-alerts@mozilla.com"], "releaseChannelCollection": "opt-out" }, + "FX_PAGE_RELOAD_NORMAL_MS": { + "record_in_processes": ["main"], + "expires_in_version": "never", + "kind": "linear", + "high": 10000, + "n_buckets": 200, + "description": "Firefox: Time taken to reload a page (ms) when using the LOAD_RELOAD_NORMAL flag", + "bug_numbers": [1549519], + "alert_emails": ["sefeng@mozilla.com", "perfteam@mozilla.com", "product-metrics-telemetry-alerts@mozilla.com"], + "releaseChannelCollection": "opt-out" + }, + "FX_PAGE_RELOAD_SKIP_CACHE_MS": { + "record_in_processes": ["main"], + "expires_in_version": "never", + "kind": "linear", + "high": 10000, + "n_buckets": 200, + "description": "Firefox: Time taken to reload a page (ms) when caches are skipped", + "bug_numbers": [1549519], + "alert_emails": ["sefeng@mozilla.com", "perfteam@mozilla.com", "product-metrics-telemetry-alerts@mozilla.com"], + "releaseChannelCollection": "opt-out" + }, "FX_SCHEDULE_PRESSURE_IDLE_SAMPLE_MS": { "record_in_processes": ["main"], "expires_in_version": "61", diff --git a/toolkit/components/telemetry/histogram-whitelists.json b/toolkit/components/telemetry/histogram-whitelists.json index 5faee0ff951d..701306b3a113 100644 --- a/toolkit/components/telemetry/histogram-whitelists.json +++ b/toolkit/components/telemetry/histogram-whitelists.json @@ -1272,7 +1272,9 @@ "GC_MINOR_REASON_LONG", "SSL_CT_POLICY_COMPLIANT_CONNECTIONS_BY_CA", "SSL_CT_POLICY_NON_COMPLIANT_CONNECTIONS_BY_CA", - "FX_PAGE_LOAD_MS_2" + "FX_PAGE_LOAD_MS_2", + "FX_PAGE_RELOAD_NORMAL_MS", + "FX_PAGE_RELOAD_SKIP_CACHE_MS" ], "expiry_default": [ "IDLE_NOTIFY_IDLE_MS",