mirror of
https://github.com/zen-browser/desktop.git
synced 2026-08-19 05:01:33 +00:00
gh-14990: Part 2 - Correctly set length hint for JSON writes (gh-14994)
This commit is contained in:
@@ -54,7 +54,7 @@ diff --git a/browser/components/sessionstore/SessionWriter.sys.mjs b/browser/com
|
||||
+ uncompressedBytes = await IOUtils.writeJSON(this.Paths.clean, state, {
|
||||
tmpPath: this.Paths.clean + ".tmp",
|
||||
compress: true,
|
||||
+ jsonLengthHint,
|
||||
+ lengthHint: jsonLengthHint,
|
||||
});
|
||||
fileStat = await IOUtils.stat(this.Paths.clean);
|
||||
} else if (this.state == STATE_RECOVERY) {
|
||||
@@ -69,7 +69,7 @@ diff --git a/browser/components/sessionstore/SessionWriter.sys.mjs b/browser/com
|
||||
tmpPath: this.Paths.recovery + ".tmp",
|
||||
backupFile: this.Paths.recoveryBackup,
|
||||
compress: true,
|
||||
+ jsonLengthHint,
|
||||
+ lengthHint: jsonLengthHint,
|
||||
});
|
||||
fileStat = await IOUtils.stat(this.Paths.recovery);
|
||||
} else {
|
||||
@@ -80,7 +80,7 @@ diff --git a/browser/components/sessionstore/SessionWriter.sys.mjs b/browser/com
|
||||
+ uncompressedBytes = await IOUtils.writeJSON(this.Paths.recovery, state, {
|
||||
tmpPath: this.Paths.recovery + ".tmp",
|
||||
compress: true,
|
||||
+ jsonLengthHint,
|
||||
+ lengthHint: jsonLengthHint,
|
||||
});
|
||||
fileStat = await IOUtils.stat(this.Paths.recovery);
|
||||
}
|
||||
|
||||
@@ -45,7 +45,8 @@
|
||||
"id": "D298708",
|
||||
"name": "Issue 14990",
|
||||
"replaces": {
|
||||
"this._lastJsonLength = uncompressedBytes;": "this._lastJsonLength = uncompressedBytes.jsonLength;"
|
||||
"this._lastJsonLength = uncompressedBytes;": "this._lastJsonLength = uncompressedBytes.jsonLength;",
|
||||
" jsonLengthHint,": " lengthHint: jsonLengthHint,"
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
diff --git a/toolkit/modules/JSONFile.sys.mjs b/toolkit/modules/JSONFile.sys.mjs
|
||||
index 397991e4af8f49b6365d729fc11267b5c1113400..70da83a0dd7658986dfd5f52103873bbb33b3c18 100644
|
||||
index 397991e4af8f49b6365d729fc11267b5c1113400..599ed16981aa1f1e9abfee2ad6c1883efd88e0ba 100644
|
||||
--- a/toolkit/modules/JSONFile.sys.mjs
|
||||
+++ b/toolkit/modules/JSONFile.sys.mjs
|
||||
@@ -132,6 +132,7 @@ export function JSONFile(config) {
|
||||
@@ -16,7 +16,7 @@ index 397991e4af8f49b6365d729fc11267b5c1113400..70da83a0dd7658986dfd5f52103873bb
|
||||
try {
|
||||
- await IOUtils.writeJSON(
|
||||
+ if (this._useSizeHints && this._lastSavedSize) {
|
||||
+ this._options.jsonLengthHint = Math.ceil(this._lastSavedSize * 1.05);
|
||||
+ this._options.lengthHint = Math.ceil(this._lastSavedSize * 1.05);
|
||||
+ }
|
||||
+ const result = await IOUtils.writeJSON(
|
||||
this.path,
|
||||
|
||||
Reference in New Issue
Block a user