diff options
Diffstat (limited to 'browser/components/sessionstore/SessionStartup.sys.mjs')
-rw-r--r-- | browser/components/sessionstore/SessionStartup.sys.mjs | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/browser/components/sessionstore/SessionStartup.sys.mjs b/browser/components/sessionstore/SessionStartup.sys.mjs index ff3ba55176..0d017ac035 100644 --- a/browser/components/sessionstore/SessionStartup.sys.mjs +++ b/browser/components/sessionstore/SessionStartup.sys.mjs @@ -158,6 +158,11 @@ export var SessionStartup = { */ _onSessionFileRead({ source, parsed, noFilesFound }) { this._initialized = true; + const crashReasons = { + FINAL_STATE_WRITING_INCOMPLETE: "final-state-write-incomplete", + SESSION_STATE_FLAG_MISSING: + "session-state-missing-or-running-at-last-write", + }; // Let observers modify the state before it is used let supportsStateString = this._createSupportsString(source); @@ -210,12 +215,17 @@ export var SessionStartup = { delete this._initialState.lastSessionState; } + let previousSessionCrashedReason = "N/A"; lazy.CrashMonitor.previousCheckpoints.then(checkpoints => { if (checkpoints) { // If the previous session finished writing the final state, we'll // assume there was no crash. this._previousSessionCrashed = !checkpoints["sessionstore-final-state-write-complete"]; + if (!checkpoints["sessionstore-final-state-write-complete"]) { + previousSessionCrashedReason = + crashReasons.FINAL_STATE_WRITING_INCOMPLETE; + } } else if (noFilesFound) { // If the Crash Monitor could not load a checkpoints file it will // provide null. This could occur on the first run after updating to @@ -241,6 +251,13 @@ export var SessionStartup = { this._previousSessionCrashed = !stateFlagPresent || this._initialState.session.state == STATE_RUNNING_STR; + if ( + !stateFlagPresent || + this._initialState.session.state == STATE_RUNNING_STR + ) { + previousSessionCrashedReason = + crashReasons.SESSION_STATE_FLAG_MISSING; + } } // Report shutdown success via telemetry. Shortcoming here are @@ -249,6 +266,16 @@ export var SessionStartup = { Services.telemetry .getHistogramById("SHUTDOWN_OK") .add(!this._previousSessionCrashed); + Services.telemetry.recordEvent( + "session_restore", + "shutdown_success", + "session_startup", + null, + { + shutdown_ok: this._previousSessionCrashed.toString(), + shutdown_reason: previousSessionCrashedReason, + } + ); Services.obs.addObserver(this, "sessionstore-windows-restored", true); @@ -268,7 +295,7 @@ export var SessionStartup = { /** * Handle notifications */ - observe(subject, topic, data) { + observe(subject, topic) { switch (topic) { case "sessionstore-windows-restored": Services.obs.removeObserver(this, "sessionstore-windows-restored"); |