summaryrefslogtreecommitdiffstats
path: root/browser/components/sessionstore/SessionFile.sys.mjs
diff options
context:
space:
mode:
Diffstat (limited to 'browser/components/sessionstore/SessionFile.sys.mjs')
-rw-r--r--browser/components/sessionstore/SessionFile.sys.mjs20
1 files changed, 16 insertions, 4 deletions
diff --git a/browser/components/sessionstore/SessionFile.sys.mjs b/browser/components/sessionstore/SessionFile.sys.mjs
index 077529d739..a44a662e07 100644
--- a/browser/components/sessionstore/SessionFile.sys.mjs
+++ b/browser/components/sessionstore/SessionFile.sys.mjs
@@ -18,6 +18,7 @@
const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, {
+ sessionStoreLogger: "resource:///modules/sessionstore/SessionLogger.sys.mjs",
RunState: "resource:///modules/sessionstore/RunState.sys.mjs",
SessionStore: "resource:///modules/sessionstore/SessionStore.sys.mjs",
SessionWriter: "resource:///modules/sessionstore/SessionWriter.sys.mjs",
@@ -234,7 +235,7 @@ var SessionFileInternal = {
// 1546847. Just in case there are problems in the format of
// the parsed data, continue on. Favicons might be broken, but
// the session will at least be recovered
- console.error(e);
+ lazy.sessionStoreLogger.error(e);
}
}
@@ -247,7 +248,7 @@ var SessionFileInternal = {
)
) {
// Skip sessionstore files that we don't understand.
- console.error(
+ lazy.sessionStoreLogger.warn(
"Cannot extract data from Session Restore file ",
path,
". Wrong format/version: " + JSON.stringify(parsed.version) + "."
@@ -289,6 +290,7 @@ var SessionFileInternal = {
Services.telemetry
.getHistogramById("FX_SESSION_RESTORE_READ_FILE_MS")
.add(Date.now() - startMs);
+ lazy.sessionStoreLogger.debug(`Successful file read of ${key} file`);
break;
} catch (ex) {
if (DOMException.isInstance(ex) && ex.name == "NotFoundError") {
@@ -304,13 +306,20 @@ var SessionFileInternal = {
loadfail_reason: "File doesn't exist.",
}
);
+ // A file not existing can be normal and expected.
+ lazy.sessionStoreLogger.debug(
+ `Can't read session file which doesn't exist: ${key}`
+ );
} else if (
DOMException.isInstance(ex) &&
ex.name == "NotAllowedError"
) {
// The file might be inaccessible due to wrong permissions
// or similar failures. We'll just count it as "corrupted".
- console.error("Could not read session file ", ex);
+ lazy.sessionStoreLogger.error(
+ `NotAllowedError when reading session file: ${key}`,
+ ex
+ );
corrupted = true;
Services.telemetry.recordEvent(
"session_restore",
@@ -324,7 +333,7 @@ var SessionFileInternal = {
}
);
} else if (ex instanceof SyntaxError) {
- console.error(
+ lazy.sessionStoreLogger.error(
"Corrupt session file (invalid JSON found) ",
ex,
ex.stack
@@ -385,6 +394,9 @@ var SessionFileInternal = {
if (!result) {
// If everything fails, start with an empty session.
+ lazy.sessionStoreLogger.warn(
+ "No readable session files found to restore, starting with empty session"
+ );
result = {
origin: "empty",
source: "",