diff options
Diffstat (limited to 'libre/iceweasel/9001-FSDG-sync-remote-settings-with-local-dump.patch')
-rw-r--r-- | libre/iceweasel/9001-FSDG-sync-remote-settings-with-local-dump.patch | 41 |
1 files changed, 19 insertions, 22 deletions
diff --git a/libre/iceweasel/9001-FSDG-sync-remote-settings-with-local-dump.patch b/libre/iceweasel/9001-FSDG-sync-remote-settings-with-local-dump.patch index e1da46760..c46d90f51 100644 --- a/libre/iceweasel/9001-FSDG-sync-remote-settings-with-local-dump.patch +++ b/libre/iceweasel/9001-FSDG-sync-remote-settings-with-local-dump.patch @@ -85,7 +85,7 @@ index f91e5dcb67..c09c58e693 100644 }, - CHANGES_PATH: "/buckets/monitor/collections/changes/changeset", -+ CHANGES_PATH: "/monitor/changes.json", ++ CHANGES_PATH: "/monitor/changes", /** * Logger instance. @@ -280,7 +280,7 @@ Date: Wed, 30 Dec 2020 17:47:41 +0200 Subject: [PATCH 04/13] Utils: fetch timestamps of each collection locally Utils.CHANGES_PATH points to -services/settings/dumps/monitor/changes.json +services/settings/dumps/monitor/changes which will be generated later by JSON processing script. Fetch the timestamps from that file and mock response headers to not confuse any code that expects them. @@ -317,7 +317,7 @@ index c09c58e693..f5605b1b16 100644 const params = { ...filters, _expected: expectedTimestamp ?? 0, -@@ -315,7 +315,10 @@ var Utils = { +@@ -315,7 +315,11 @@ var Utils = { .map(([k, v]) => `${k}=${encodeURIComponent(v)}`) .join("&"); } @@ -326,6 +326,7 @@ index c09c58e693..f5605b1b16 100644 + const responseDate = new Date().toUTCString() + response.headers.set("Date", responseDate); + response.headers.set("Last-Modified", responseDate); ++ response.headers.set("Content-Type", "application/json"); if (response.status >= 500) { throw new Error(`Server error ${response.status} ${response.statusText}`); @@ -356,7 +357,7 @@ index 0000000000..d3d017fda5 +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + -+FINAL_TARGET_FILES.defaults.settings.monitor += ["changes.json"] ++FINAL_TARGET_FILES.defaults.settings.monitor += ["changes"] + +if CONFIG["MOZ_BUILD_APP"] == "browser": + DIST_SUBDIR = "browser" @@ -782,18 +783,15 @@ diff --git a/services/settings/RemoteSettingsClient.jsm b/services/settings/Remo index 64ac27d149..ac6259ca2c 100644 --- a/services/settings/RemoteSettingsClient.jsm +++ b/services/settings/RemoteSettingsClient.jsm -@@ -219,7 +219,10 @@ class AttachmentDownloader extends Downloader { - async deleteAll() { - let allRecords = await this._client.db.list(); - return Promise.all( -- allRecords.filter(r => !!r.attachment).map(r => this.delete(r)) -+ allRecords.filter(r => !!r.attachment).map(r => { -+ this.delete(r); -+ this.deleteCached(r.id); -+ }) +@@ -219,7 +219,7 @@ class AttachmentDownloader extends Downloader { + allRecords + .filter(r => !!r.attachment) + .map(r => +- Promise.all([this.deleteDownloaded(r), this.deleteFromDisk(r)]) ++ Promise.all([this.deleteDownloaded(r), this.deleteFromDisk(r), this.deleteCached(r.id)]) + ) ); } - } @@ -1013,7 +1016,7 @@ class RemoteSettingsClient extends EventEmitter { // Signature failed, clear local DB because it contains // bad data (local + remote changes). @@ -879,19 +877,18 @@ diff --git a/services/settings/Attachments.jsm b/services/settings/Attachments.j index 70c02627ac..d24d8907fd 100644 --- a/services/settings/Attachments.jsm +++ b/services/settings/Attachments.jsm -@@ -141,10 +141,11 @@ class Downloader { +@@ -151,9 +151,10 @@ class Downloader { + retries, checkHash, attachmentId = record?.id, - useCache = false, - fallbackToCache = false, fallbackToDump = false, } = options || {}; - + const fallbackToCache = false; -+ - if (!useCache) { - // For backwards compatibility. - // WARNING: Its return type is different from what's documented. ++ + if (!attachmentId) { + // Check for pre-condition. This should not happen, but it is explicitly + // checked to avoid mixing up attachments, which could be dangerous. @@ -204,6 +205,7 @@ class Downloader { const newBuffer = await this.downloadAsBytes(record, { retries, @@ -899,7 +896,7 @@ index 70c02627ac..d24d8907fd 100644 + dumpInfo, }); const blob = new Blob([newBuffer]); - if (useCache) { + // Store in cache but don't wait for it before returning. @@ -239,7 +241,7 @@ class Downloader { } |