diff --git a/browser/modules/ContentCrashHandlers.jsm b/browser/modules/ContentCrashHandlers.jsm index 7024fc328b07..46a762f1ca0a 100644 --- a/browser/modules/ContentCrashHandlers.jsm +++ b/browser/modules/ContentCrashHandlers.jsm @@ -322,6 +322,12 @@ var TabCrashHandler = { browser.docShell.displayLoadError(Cr.NS_ERROR_BUILDID_MISMATCH, uri, null); tab.setAttribute("crashed", true); + + // Make sure to only count once even if there are multiple windows + // that will all show about:restartrequired. + if (this._crashedTabCount == 1) { + Services.telemetry.scalarAdd("dom.contentprocess.buildID_mismatch", 1); + } }, /** diff --git a/browser/modules/test/browser/browser.ini b/browser/modules/test/browser/browser.ini index b54b960afc9d..756a0474535d 100644 --- a/browser/modules/test/browser/browser.ini +++ b/browser/modules/test/browser/browser.ini @@ -50,3 +50,4 @@ support-files = usageTelemetrySearchSuggestions.xml [browser_UsageTelemetry_content.js] [browser_UsageTelemetry_content_aboutHome.js] +[browser_UsageTelemetry_content_aboutRestartRequired.js] diff --git a/browser/modules/test/browser/browser_UsageTelemetry_content_aboutRestartRequired.js b/browser/modules/test/browser/browser_UsageTelemetry_content_aboutRestartRequired.js new file mode 100644 index 000000000000..cf94215a78fa --- /dev/null +++ b/browser/modules/test/browser/browser_UsageTelemetry_content_aboutRestartRequired.js @@ -0,0 +1,30 @@ +"use strict"; + +const SCALAR_BUILDID_MISMATCH = "dom.contentprocess.buildID_mismatch"; + +add_task(async function test_aboutRestartRequired() { + let CrashHandlers = {}; + ChromeUtils.import("resource:///modules/ContentCrashHandlers.jsm", + CrashHandlers); + + // Let's reset the counts. + Services.telemetry.clearScalars(); + + let scalars = + getParentProcessScalars(Ci.nsITelemetry.DATASET_RELEASE_CHANNEL_OPTOUT); + + // Check preconditions + is(scalars[SCALAR_BUILDID_MISMATCH], undefined, + "Build ID mismatch count should be undefined"); + + // Simulate buildID mismatch + CrashHandlers.TabCrashHandler._crashedTabCount = 1; + CrashHandlers.TabCrashHandler.sendToRestartRequiredPage( + gBrowser.selectedTab.linkedBrowser); + + scalars = + getParentProcessScalars(Ci.nsITelemetry.DATASET_RELEASE_CHANNEL_OPTOUT); + + is(scalars[SCALAR_BUILDID_MISMATCH], 1, + "Build ID mismatch count should be 1."); +}); diff --git a/toolkit/components/telemetry/Scalars.yaml b/toolkit/components/telemetry/Scalars.yaml index 46f3d2dcdb3b..a1276c966740 100644 --- a/toolkit/components/telemetry/Scalars.yaml +++ b/toolkit/components/telemetry/Scalars.yaml @@ -776,6 +776,20 @@ dom.contentprocess: record_in_processes: - 'main' + buildID_mismatch: + bug_numbers: + - 1366808 + description: > + The number of times the about:restartrequired page appeared due to a + buildID mismatch between the parent and the content processes. + expires: never + kind: uint + notification_emails: + - spohl@mozilla.com + release_channel_collection: opt-out + record_in_processes: + - 'main' + devtools.toolbar.eyedropper: opened: bug_numbers: