diff --git a/services/settings/RemoteSettingsClient.jsm b/services/settings/RemoteSettingsClient.jsm index 88626b743e47..124a0b0174e9 100644 --- a/services/settings/RemoteSettingsClient.jsm +++ b/services/settings/RemoteSettingsClient.jsm @@ -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: `false`). + * @param {boolean} options.loadDumpIfNewer Use dump data if it is newer than local data (default: `true`). * @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 = false, // TODO bug 1718083: should default to true. + loadDumpIfNewer = true, syncIfEmpty = true, } = options; let { verifySignature = false } = options; diff --git a/services/settings/test/unit/test_remote_settings_offline.js b/services/settings/test/unit/test_remote_settings_offline.js index 2eff2901f7ba..2dbb76642a4b 100644 --- a/services/settings/test/unit/test_remote_settings_offline.js +++ b/services/settings/test/unit/test_remote_settings_offline.js @@ -65,30 +65,31 @@ add_task(async function test_load_from_dump_when_offline() { }); add_task(clear_state); -add_task(async function test_skip_dump_after_empty_import() { +add_task(async function test_optional_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. + // when the database is initialized with an empty dump + // with `loadDumpIfNewer` disabled. await importData([]); // <-- Empty set of records. - const after = await client.get(); + const after = await client.get({ loadDumpIfNewer: false }); 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_skip_dump_after_non_empty_import() { +add_task(async function test_optional_skip_dump_after_non_empty_import() { await importData([{ last_modified: 1234, id: "dummy" }]); - const after = await client.get(); + const after = await client.get({ loadDumpIfNewer: false }); equal(after.length, 1, "Imported dummy data"); equal(await client.getLastModified(), 1234, "Expected timestamp of import"); await importData([]); - const after2 = await client.get(); + const after2 = await client.get({ loadDumpIfNewer: false }); equal(after2.length, 0, "Previous data wiped on duplicate import"); equal(await client.getLastModified(), 0, "Timestamp of empty collection"); }); @@ -97,7 +98,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({ loadDumpIfNewer: true }); + const after = await client.get(); equal(after.length, DUMP_RECORDS.length, "Imported dump"); equal(await client.getLastModified(), DUMP_LAST_MODIFIED, "dump's timestamp"); }); @@ -110,7 +111,7 @@ add_task(async function test_load_dump_after_non_empty_import() { await importData([{ last_modified: 1234, id: "dummy" }]); - const after = await client.get({ loadDumpIfNewer: true }); + const after = await client.get(); equal(after.length, DUMP_RECORDS.length, "Imported dump"); equal(await client.getLastModified(), DUMP_LAST_MODIFIED, "dump's timestamp"); }); @@ -124,7 +125,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({ loadDumpIfNewer: true }); + const after = await client.get(); equal(after.length, DUMP_RECORDS.length, "Imported dump"); equal(await client.getLastModified(), DUMP_LAST_MODIFIED, "dump's timestamp"); }); @@ -133,7 +134,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({ loadDumpIfNewer: true }); + const after = await client.get(); equal(after.length, 1, "Not importing dump when time matches"); equal(await client.getLastModified(), DUMP_LAST_MODIFIED, "Same timestamp"); }); diff --git a/toolkit/components/search/SearchEngineSelector.jsm b/toolkit/components/search/SearchEngineSelector.jsm index 18d054e3b2e1..10dadc7cb304 100644 --- a/toolkit/components/search/SearchEngineSelector.jsm +++ b/toolkit/components/search/SearchEngineSelector.jsm @@ -143,7 +143,6 @@ class SearchEngineSelector { try { result = await this._remoteConfig.get({ order: "id", - loadDumpIfNewer: true, }); } catch (ex) { logConsole.error(ex); diff --git a/toolkit/mozapps/extensions/Blocklist.jsm b/toolkit/mozapps/extensions/Blocklist.jsm index c713c8f5fb8b..6cf193ed285d 100644 --- a/toolkit/mozapps/extensions/Blocklist.jsm +++ b/toolkit/mozapps/extensions/Blocklist.jsm @@ -1008,7 +1008,7 @@ const ExtensionBlocklistMLBF = { this._stashes = null; return; } - let records = await this._client.get({ loadDumpIfNewer: true }); + let records = await this._client.get(); if (isUpdateReplaced()) { return; } diff --git a/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_blocklist_clients.js b/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_blocklist_clients.js index 7caaacb5e0ca..f89386d1531b 100644 --- a/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_blocklist_clients.js +++ b/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_blocklist_clients.js @@ -198,8 +198,10 @@ add_task( for (const record of records) { await client.db.create(record); } - await client.db.importChanges({}, 42); // Prevent from loading JSON dump. - const list = await client.get({ syncIfEmpty: false }); + const list = await client.get({ + loadDumpIfNewer: false, + syncIfEmpty: false, + }); equal(list.length, 4); ok(list.every(e => e.willMatch)); } diff --git a/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_blocklist_gfx.js b/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_blocklist_gfx.js index 6e6c3105a014..2b243ec6505a 100644 --- a/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_blocklist_gfx.js +++ b/toolkit/mozapps/extensions/test/xpcshell/rs-blocklist/test_blocklist_gfx.js @@ -8,7 +8,7 @@ const SAMPLE_GFX_RECORD = { feature: "DIRECT3D_9_LAYERS", devices: ["0x0a6c", "geforce"], featureStatus: "BLOCKED_DRIVER_VERSION", - last_modified: 1458035931837, + last_modified: 9999999999999, // High timestamp to prevent load of dump os: "WINNT 6.1", id: "3f947f16-37c2-4e96-d356-78b26363729b", versionRange: { minVersion: 0, maxVersion: "*" },