diff --git a/browser/base/content/test/static/browser_all_files_referenced.js b/browser/base/content/test/static/browser_all_files_referenced.js index 6d333704bd1d..908a8839126b 100644 --- a/browser/base/content/test/static/browser_all_files_referenced.js +++ b/browser/base/content/test/static/browser_all_files_referenced.js @@ -13,9 +13,8 @@ var isDevtools = SimpleTest.harnessParameters.subsuite == "devtools"; var gExceptionPaths = [ "chrome://browser/content/defaultthemes/", "chrome://browser/locale/searchplugins/", - "resource://app/defaults/settings/blocklists/", - "resource://app/defaults/settings/main/", - "resource://app/defaults/settings/pinning/", + "resource://app/defaults/blocklists/", + "resource://app/defaults/pinning/", "resource://app/defaults/preferences/", "resource://gre/modules/commonjs/", "resource://gre/defaults/pref/", diff --git a/browser/installer/package-manifest.in b/browser/installer/package-manifest.in index d5fbc0ba6758..35d8d561ea04 100644 --- a/browser/installer/package-manifest.in +++ b/browser/installer/package-manifest.in @@ -449,9 +449,8 @@ @RESPATH@/greprefs.js @RESPATH@/defaults/autoconfig/prefcalls.js @RESPATH@/browser/defaults/permissions -@RESPATH@/browser/defaults/settings/blocklists -@RESPATH@/browser/defaults/settings/pinning -@RESPATH@/browser/defaults/settings/main +@RESPATH@/browser/defaults/blocklists +@RESPATH@/browser/defaults/pinning ; Warning: changing the path to channel-prefs.js can cause bugs (Bug 756325) ; Technically this is an app pref file, but we are keeping it in the original diff --git a/mobile/android/installer/package-manifest.in b/mobile/android/installer/package-manifest.in index c5863b4c8b3c..957fe1b3170c 100644 --- a/mobile/android/installer/package-manifest.in +++ b/mobile/android/installer/package-manifest.in @@ -87,8 +87,6 @@ @BINPATH@/application.ini @BINPATH@/platform.ini @BINPATH@/blocklist.xml -@BINPATH@/defaults/settings/blocklists/addons.json -@BINPATH@/defaults/settings/blocklists/certificates.json ; [Components] @BINPATH@/components/components.manifest diff --git a/services/settings/dumps/blocklists/addons.json b/services/blocklists/addons.json similarity index 100% rename from services/settings/dumps/blocklists/addons.json rename to services/blocklists/addons.json diff --git a/services/settings/dumps/blocklists/certificates.json b/services/blocklists/certificates.json similarity index 100% rename from services/settings/dumps/blocklists/certificates.json rename to services/blocklists/certificates.json diff --git a/services/settings/dumps/blocklists/gfx.json b/services/blocklists/gfx.json similarity index 100% rename from services/settings/dumps/blocklists/gfx.json rename to services/blocklists/gfx.json diff --git a/services/settings/dumps/blocklists/moz.build b/services/blocklists/moz.build similarity index 60% rename from services/settings/dumps/blocklists/moz.build rename to services/blocklists/moz.build index 19f5e6ea34cf..c8d6dd1bffa0 100644 --- a/services/settings/dumps/blocklists/moz.build +++ b/services/blocklists/moz.build @@ -7,10 +7,12 @@ with Files('**'): BUG_COMPONENT = ('Toolkit', 'Blocklisting') -FINAL_TARGET_FILES.defaults.settings.blocklists += ['addons.json', - 'certificates.json', - 'gfx.json', - 'plugins.json'] +FINAL_TARGET_FILES.defaults.blocklists += ['addons.json', + 'certificates.json', + 'gfx.json', + 'plugins.json'] + +FINAL_TARGET_FILES.defaults.pinning += ['pins.json'] if CONFIG['MOZ_BUILD_APP'] == 'browser': DIST_SUBDIR = 'browser' diff --git a/services/settings/dumps/pinning/pins.json b/services/blocklists/pins.json similarity index 100% rename from services/settings/dumps/pinning/pins.json rename to services/blocklists/pins.json diff --git a/services/settings/dumps/blocklists/plugins.json b/services/blocklists/plugins.json similarity index 100% rename from services/settings/dumps/blocklists/plugins.json rename to services/blocklists/plugins.json diff --git a/services/settings/dumps/readme.md b/services/blocklists/readme.md similarity index 100% rename from services/settings/dumps/readme.md rename to services/blocklists/readme.md diff --git a/services/common/docs/RemoteSettings.rst b/services/common/docs/RemoteSettings.rst index 94b9d06f41c4..9ed4e24d10f2 100644 --- a/services/common/docs/RemoteSettings.rst +++ b/services/common/docs/RemoteSettings.rst @@ -90,18 +90,6 @@ When an entry has a file attached to it, it has an ``attachment`` attribute, whi } }); -Initial data ------------- - -For newly created user profiles, the list of entries returned by the ``.get()`` method will be empty until the first synchronization happens. - -It is possible to package a dump of the server records that will be loaded into the local database when no synchronization has happened yet. It will thus serve as the default dataset and also reduce the amount of data to be downloaded on the first synchronization. - -#. Place the JSON dump of the server records in the ``services/settings/dumps/main/`` folder -#. Add the filename to the ``FINAL_TARGET_FILES`` list in ``services/settings/dumps/main/moz.build`` - -Now, when ``RemoteSettings("some-key").get()`` is called from an empty profile, the ``some-key.json`` file is going to be loaded before the results are returned. - Uptake Telemetry ================ diff --git a/services/common/remote-settings.js b/services/common/remote-settings.js index 789d1d5f4782..a3065a48cd6d 100644 --- a/services/common/remote-settings.js +++ b/services/common/remote-settings.js @@ -213,21 +213,6 @@ class RemoteSettingsClient { // whose target is matched. const { filters = {}, order } = options; const c = await this.openCollection(); - - const timestamp = await c.db.getLastModified(); - // If the local database was never synchronized, then we attempt to load - // a packaged JSON dump. - if (timestamp == null) { - try { - const { data } = await this._loadDumpFile(); - await c.loadDump(data); - } catch (e) { - // Report but return an empty list since there will be no data anyway. - Cu.reportError(e); - return []; - } - } - const { data } = await c.list({ filters, order }); return this._filterEntries(data); } @@ -417,7 +402,7 @@ class RemoteSettingsClient { async _loadDumpFile() { // Replace OS specific path separator by / for URI. const { components: folderFile } = OS.Path.split(this.filename); - const fileURI = `resource://app/defaults/settings/${folderFile.join("/")}`; + const fileURI = `resource://app/defaults/${folderFile.join("/")}`; const response = await fetch(fileURI); if (!response.ok) { throw new Error(`Could not read from '${fileURI}'`); diff --git a/services/common/tests/unit/test_blocklist_clients.js b/services/common/tests/unit/test_blocklist_clients.js index c54324471ece..e6964e9d202b 100644 --- a/services/common/tests/unit/test_blocklist_clients.js +++ b/services/common/tests/unit/test_blocklist_clients.js @@ -1,6 +1,5 @@ const { Constructor: CC } = Components; -ChromeUtils.import("resource://gre/modules/AppConstants.jsm"); ChromeUtils.import("resource://gre/modules/Services.jsm"); ChromeUtils.import("resource://testing-common/httpd.js"); const { FileUtils } = ChromeUtils.import("resource://gre/modules/FileUtils.jsm", {}); @@ -11,8 +10,6 @@ const BlocklistClients = ChromeUtils.import("resource://services-common/blocklis const BinaryInputStream = CC("@mozilla.org/binaryinputstream;1", "nsIBinaryInputStream", "setInputStream"); -const IS_ANDROID = AppConstants.platform == "android"; - let gBlocklistClients; let server; @@ -102,14 +99,7 @@ function run_test() { } add_task(async function test_initial_dump_is_loaded_as_synced_when_collection_is_empty() { - const november2016 = 1480000000000; - for (let {client} of gBlocklistClients) { - if (IS_ANDROID && client.collectionName != BlocklistClients.AddonBlocklistClient.collectionName) { - // On Android we don't ship the dumps of plugins and gfx. - continue; - } - // Test an empty db populates, but don't reach server (specified timestamp <= dump). await client.maybeSync(1, Date.now()); @@ -117,28 +107,6 @@ add_task(async function test_initial_dump_is_loaded_as_synced_when_collection_is const collection = await client.openCollection(); const { data: list } = await collection.list(); equal(list[0]._status, "synced"); - - // Verify that the internal timestamp was updated. - const timestamp = await collection.db.getLastModified(); - ok(timestamp > november2016, `Loaded dump of ${client.collectionName} has timestamp ${timestamp}`); - } -}); -add_task(clear_state); - -add_task(async function test_initial_dump_is_loaded_when_using_get_on_empty_collection() { - for (let {client} of gBlocklistClients) { - if (IS_ANDROID && client.collectionName != BlocklistClients.AddonBlocklistClient.collectionName) { - // On Android we don't ship the dumps of plugins and gfx. - continue; - } - // Internal database is empty. - const collection = await client.openCollection(); - const { data: list } = await collection.list(); - equal(list.length, 0); - - // Calling .get() will load the dump. - const afterLoaded = await client.get(); - ok(afterLoaded.length > 0, `Loaded dump of ${client.collectionName} has ${afterLoaded.length} records`); } }); add_task(clear_state); diff --git a/services/common/tests/unit/test_blocklist_targetapp_filter.js b/services/common/tests/unit/test_blocklist_targetapp_filter.js index f1c3f20467fd..b8fea5b7a18e 100644 --- a/services/common/tests/unit/test_blocklist_targetapp_filter.js +++ b/services/common/tests/unit/test_blocklist_targetapp_filter.js @@ -16,7 +16,6 @@ async function createRecords(records) { for (const record of records) { await collection.create(record); } - collection.db.saveLastModified(42); // Simulate sync (and prevent load dump). } diff --git a/services/common/tests/unit/test_remote_settings.js b/services/common/tests/unit/test_remote_settings.js index 75795f07c9e2..00e91dff3f4e 100644 --- a/services/common/tests/unit/test_remote_settings.js +++ b/services/common/tests/unit/test_remote_settings.js @@ -103,17 +103,6 @@ add_task(async function test_records_changes_are_overwritten_by_server_changes() }); add_task(clear_state); -add_task(async function test_default_records_come_from_a_local_dump_when_database_is_empty() { - // When collection is unknown, no dump is loaded, and there is no error. - let data = await RemoteSettings("some-unknown-key").get(); - equal(data.length, 0); - - // When collection has a dump in services/settings/dumps/{bucket}/{collection}.json - data = await RemoteSettings("certificates", { bucketName: "blocklists" }).get(); - notEqual(data.length, 0); -}); -add_task(clear_state); - add_task(async function test_sync_event_provides_information_about_records() { const serverTime = Date.now(); diff --git a/services/common/tests/unit/xpcshell.ini b/services/common/tests/unit/xpcshell.ini index 47386c29c638..55e06d7ee281 100644 --- a/services/common/tests/unit/xpcshell.ini +++ b/services/common/tests/unit/xpcshell.ini @@ -9,8 +9,8 @@ support-files = [test_load_modules.js] [test_blocklist_certificates.js] -# Skip signature tests for Thunderbird (Bug 1341983). -skip-if = appname == "thunderbird" +# Initial JSON data for blocklists are not shipped on Android. +skip-if = (os == "android" || appname == "thunderbird") tags = blocklist [test_blocklist_clients.js] tags = blocklist diff --git a/services/moz.build b/services/moz.build index ece8111c6198..33586d18b26d 100644 --- a/services/moz.build +++ b/services/moz.build @@ -10,12 +10,12 @@ with Files('moz.build'): DIRS += [ 'common', 'crypto', - 'settings', ] if CONFIG['MOZ_WIDGET_TOOLKIT'] != 'android': DIRS += [ 'fxaccounts', + 'blocklists', ] if CONFIG['MOZ_SERVICES_SYNC']: diff --git a/services/settings/dumps/main/moz.build b/services/settings/dumps/main/moz.build deleted file mode 100644 index a603d08be500..000000000000 --- a/services/settings/dumps/main/moz.build +++ /dev/null @@ -1,10 +0,0 @@ -# This Source Code Form is subject to the terms of the Mozilla Public -# 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.main += [ - 'tippytop.json', -] - -if CONFIG['MOZ_BUILD_APP'] == 'browser': - DIST_SUBDIR = 'browser' diff --git a/services/settings/dumps/main/tippytop.json b/services/settings/dumps/main/tippytop.json deleted file mode 100644 index ccb562190823..000000000000 --- a/services/settings/dumps/main/tippytop.json +++ /dev/null @@ -1 +0,0 @@ -{"data":[]} \ No newline at end of file diff --git a/services/settings/dumps/moz.build b/services/settings/dumps/moz.build deleted file mode 100644 index 3c73fb07f7aa..000000000000 --- a/services/settings/dumps/moz.build +++ /dev/null @@ -1,9 +0,0 @@ -# This Source Code Form is subject to the terms of the Mozilla Public -# 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/. - -DIRS += [ - 'blocklists', - 'main', - 'pinning', -] diff --git a/services/settings/dumps/pinning/moz.build b/services/settings/dumps/pinning/moz.build deleted file mode 100644 index bd172fd0e4bb..000000000000 --- a/services/settings/dumps/pinning/moz.build +++ /dev/null @@ -1,8 +0,0 @@ -# This Source Code Form is subject to the terms of the Mozilla Public -# 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.pinning += ['pins.json'] - -if CONFIG['MOZ_BUILD_APP'] == 'browser': - DIST_SUBDIR = 'browser' diff --git a/services/settings/moz.build b/services/settings/moz.build deleted file mode 100644 index eb69f67a2fb2..000000000000 --- a/services/settings/moz.build +++ /dev/null @@ -1,10 +0,0 @@ -# This Source Code Form is subject to the terms of the Mozilla Public -# 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/. - -with Files('**'): - BUG_COMPONENT = ('Firefox', 'Remote Settings Client') - -DIRS += [ - 'dumps', -]