mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-19 16:25:38 +00:00
Bug 1640023 - Sync on .get() when no metadata r=Standard8
Differential Revision: https://phabricator.services.mozilla.com/D77233
This commit is contained in:
parent
c131cacfef
commit
1cfe96cf26
@ -382,12 +382,10 @@ class RemoteSettingsClient extends EventEmitter {
|
||||
let metadata = await this.db.getMetadata();
|
||||
if (syncIfEmpty && ObjectUtils.isEmpty(metadata)) {
|
||||
// No sync occured yet, may have records from dump but no metadata.
|
||||
console.debug(
|
||||
`${this.identifier} Required metadata, fetching from server.`
|
||||
);
|
||||
metadata = await this.httpClient().getData();
|
||||
await this.db.saveMetadata(metadata);
|
||||
await this.sync({ loadDump: false });
|
||||
metadata = await this.db.getMetadata();
|
||||
}
|
||||
// Will throw MissingSignatureError if no metadata and `syncIfEmpty` is false.
|
||||
await this._validateCollectionSignature(
|
||||
localRecords,
|
||||
timestamp,
|
||||
|
@ -71,18 +71,10 @@ function run_test() {
|
||||
"/v1/buckets/monitor/collections/changes/records",
|
||||
handleResponse
|
||||
);
|
||||
server.registerPathHandler(
|
||||
"/v1/buckets/main/collections/password-fields",
|
||||
handleResponse
|
||||
);
|
||||
server.registerPathHandler(
|
||||
"/v1/buckets/main/collections/password-fields/changeset",
|
||||
handleResponse
|
||||
);
|
||||
server.registerPathHandler(
|
||||
"/v1/buckets/main/collections/language-dictionaries",
|
||||
handleResponse
|
||||
);
|
||||
server.registerPathHandler(
|
||||
"/v1/buckets/main/collections/language-dictionaries/changeset",
|
||||
handleResponse
|
||||
@ -1125,24 +1117,6 @@ wNuvFqc=
|
||||
],
|
||||
},
|
||||
},
|
||||
"GET:/v1/buckets/main/collections/password-fields": {
|
||||
sampleHeaders: [
|
||||
"Access-Control-Allow-Origin: *",
|
||||
"Access-Control-Expose-Headers: Retry-After, Content-Length, Alert, Backoff",
|
||||
"Content-Type: application/json; charset=UTF-8",
|
||||
"Server: waitress",
|
||||
'Etag: "3000"',
|
||||
],
|
||||
status: { status: 200, statusText: "OK" },
|
||||
responseBody: {
|
||||
data: {
|
||||
signature: {
|
||||
signature: "some-sig",
|
||||
x5u: `http://localhost:${port}/fake-x5u`,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
"GET:/v1/buckets/main/collections/password-fields/changeset?_expected=1337": {
|
||||
sampleHeaders: [
|
||||
"Access-Control-Allow-Origin: *",
|
||||
@ -1154,7 +1128,10 @@ wNuvFqc=
|
||||
status: { status: 200, statusText: "OK" },
|
||||
responseBody: {
|
||||
metadata: {
|
||||
signature: {},
|
||||
signature: {
|
||||
signature: "some-sig",
|
||||
x5u: `http://localhost:${port}/fake-x5u`,
|
||||
},
|
||||
},
|
||||
timestamp: 3000,
|
||||
changes: [
|
||||
@ -1167,26 +1144,6 @@ wNuvFqc=
|
||||
],
|
||||
},
|
||||
},
|
||||
"GET:/v1/buckets/main/collections/language-dictionaries": {
|
||||
sampleHeaders: [
|
||||
"Access-Control-Allow-Origin: *",
|
||||
"Access-Control-Expose-Headers: Retry-After, Content-Length, Alert, Backoff",
|
||||
"Content-Type: application/json; charset=UTF-8",
|
||||
"Server: waitress",
|
||||
'Etag: "1234"',
|
||||
],
|
||||
status: { status: 200, statusText: "OK" },
|
||||
responseBody: JSON.stringify({
|
||||
data: {
|
||||
id: "language-dictionaries",
|
||||
last_modified: 1234,
|
||||
signature: {
|
||||
signature: "xyz",
|
||||
x5u: `http://localhost:${port}/fake-x5u`,
|
||||
},
|
||||
},
|
||||
}),
|
||||
},
|
||||
"GET:/v1/buckets/main/collections/language-dictionaries/changeset": {
|
||||
sampleHeaders: [
|
||||
"Access-Control-Allow-Origin: *",
|
||||
|
Loading…
Reference in New Issue
Block a user