зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset 79f782edbda9 (bug 1718083) for causing xpcshell failures in test_supports_filter_expressions CLOSED TREE
This commit is contained in:
Родитель
e35a0919fb
Коммит
31102d1c1c
|
@ -345,7 +345,7 @@ class RemoteSettingsClient extends EventEmitter {
|
|||
* @param {Object} options.filters Filter the results (default: `{}`).
|
||||
* @param {String} options.order The order to apply (eg. `"-last_modified"`).
|
||||
* @param {boolean} options.dumpFallback Fallback to dump data if read of local DB fails (default: `true`).
|
||||
* @param {boolean} options.loadDumpIfNewer Use dump data if it is newer than local data (default: `true`).
|
||||
* @param {boolean} options.loadDumpIfNewer Use dump data if it is newer than local data (default: `false`).
|
||||
* @param {boolean} options.syncIfEmpty Synchronize from server if local data is empty (default: `true`).
|
||||
* @param {boolean} options.verifySignature Verify the signature of the local data (default: `false`).
|
||||
* @return {Promise}
|
||||
|
@ -355,7 +355,7 @@ class RemoteSettingsClient extends EventEmitter {
|
|||
filters = {},
|
||||
order = "", // not sorted by default.
|
||||
dumpFallback = true,
|
||||
loadDumpIfNewer = true,
|
||||
loadDumpIfNewer = false, // TODO bug 1718083: should default to true.
|
||||
syncIfEmpty = true,
|
||||
} = options;
|
||||
let { verifySignature = false } = options;
|
||||
|
|
|
@ -65,31 +65,30 @@ add_task(async function test_load_from_dump_when_offline() {
|
|||
});
|
||||
add_task(clear_state);
|
||||
|
||||
add_task(async function test_optional_skip_dump_after_empty_import() {
|
||||
add_task(async function test_skip_dump_after_empty_import() {
|
||||
// clear_state should have wiped the database.
|
||||
const before = await client.get({ syncIfEmpty: false });
|
||||
equal(before.length, 0, "collection empty after clearing");
|
||||
|
||||
// Verify that the dump is not imported again by client.get()
|
||||
// when the database is initialized with an empty dump
|
||||
// with `loadDumpIfNewer` disabled.
|
||||
// when the database is initialized with an empty dump.
|
||||
await importData([]); // <-- Empty set of records.
|
||||
|
||||
const after = await client.get({ loadDumpIfNewer: false });
|
||||
const after = await client.get();
|
||||
equal(after.length, 0, "collection still empty due to import");
|
||||
equal(await client.getLastModified(), 0, "Empty dump has no timestamp");
|
||||
});
|
||||
add_task(clear_state);
|
||||
|
||||
add_task(async function test_optional_skip_dump_after_non_empty_import() {
|
||||
add_task(async function test_skip_dump_after_non_empty_import() {
|
||||
await importData([{ last_modified: 1234, id: "dummy" }]);
|
||||
|
||||
const after = await client.get({ loadDumpIfNewer: false });
|
||||
const after = await client.get();
|
||||
equal(after.length, 1, "Imported dummy data");
|
||||
equal(await client.getLastModified(), 1234, "Expected timestamp of import");
|
||||
|
||||
await importData([]);
|
||||
const after2 = await client.get({ loadDumpIfNewer: false });
|
||||
const after2 = await client.get();
|
||||
equal(after2.length, 0, "Previous data wiped on duplicate import");
|
||||
equal(await client.getLastModified(), 0, "Timestamp of empty collection");
|
||||
});
|
||||
|
@ -98,7 +97,7 @@ add_task(clear_state);
|
|||
add_task(async function test_load_dump_after_empty_import() {
|
||||
await importData([]); // <-- Empty set of records, i.e. last_modified = 0.
|
||||
|
||||
const after = await client.get();
|
||||
const after = await client.get({ loadDumpIfNewer: true });
|
||||
equal(after.length, DUMP_RECORDS.length, "Imported dump");
|
||||
equal(await client.getLastModified(), DUMP_LAST_MODIFIED, "dump's timestamp");
|
||||
});
|
||||
|
@ -111,7 +110,7 @@ add_task(async function test_load_dump_after_non_empty_import() {
|
|||
|
||||
await importData([{ last_modified: 1234, id: "dummy" }]);
|
||||
|
||||
const after = await client.get();
|
||||
const after = await client.get({ loadDumpIfNewer: true });
|
||||
equal(after.length, DUMP_RECORDS.length, "Imported dump");
|
||||
equal(await client.getLastModified(), DUMP_LAST_MODIFIED, "dump's timestamp");
|
||||
});
|
||||
|
@ -125,7 +124,7 @@ add_task(async function test_load_dump_after_import_from_broken_distro() {
|
|||
// No last_modified time.
|
||||
await importData([{ id: "dummy" }]);
|
||||
|
||||
const after = await client.get();
|
||||
const after = await client.get({ loadDumpIfNewer: true });
|
||||
equal(after.length, DUMP_RECORDS.length, "Imported dump");
|
||||
equal(await client.getLastModified(), DUMP_LAST_MODIFIED, "dump's timestamp");
|
||||
});
|
||||
|
@ -134,7 +133,7 @@ add_task(clear_state);
|
|||
add_task(async function test_skip_dump_if_same_last_modified() {
|
||||
await importData([{ last_modified: DUMP_LAST_MODIFIED, id: "dummy" }]);
|
||||
|
||||
const after = await client.get();
|
||||
const after = await client.get({ loadDumpIfNewer: true });
|
||||
equal(after.length, 1, "Not importing dump when time matches");
|
||||
equal(await client.getLastModified(), DUMP_LAST_MODIFIED, "Same timestamp");
|
||||
});
|
||||
|
|
|
@ -143,6 +143,7 @@ class SearchEngineSelector {
|
|||
try {
|
||||
result = await this._remoteConfig.get({
|
||||
order: "id",
|
||||
loadDumpIfNewer: true,
|
||||
});
|
||||
} catch (ex) {
|
||||
logConsole.error(ex);
|
||||
|
|
|
@ -1008,7 +1008,7 @@ const ExtensionBlocklistMLBF = {
|
|||
this._stashes = null;
|
||||
return;
|
||||
}
|
||||
let records = await this._client.get();
|
||||
let records = await this._client.get({ loadDumpIfNewer: true });
|
||||
if (isUpdateReplaced()) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -198,10 +198,8 @@ add_task(
|
|||
for (const record of records) {
|
||||
await client.db.create(record);
|
||||
}
|
||||
const list = await client.get({
|
||||
loadDumpIfNewer: false,
|
||||
syncIfEmpty: false,
|
||||
});
|
||||
await client.db.importChanges({}, 42); // Prevent from loading JSON dump.
|
||||
const list = await client.get({ syncIfEmpty: false });
|
||||
equal(list.length, 4);
|
||||
ok(list.every(e => e.willMatch));
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ const SAMPLE_GFX_RECORD = {
|
|||
feature: "DIRECT3D_9_LAYERS",
|
||||
devices: ["0x0a6c", "geforce"],
|
||||
featureStatus: "BLOCKED_DRIVER_VERSION",
|
||||
last_modified: 9999999999999, // High timestamp to prevent load of dump
|
||||
last_modified: 1458035931837,
|
||||
os: "WINNT 6.1",
|
||||
id: "3f947f16-37c2-4e96-d356-78b26363729b",
|
||||
versionRange: { minVersion: 0, maxVersion: "*" },
|
||||
|
|
Загрузка…
Ссылка в новой задаче