mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-25 22:29:07 +00:00
Bug 1463750 - Move RemoteSettings to services/settings/ r=mgoodwin
MozReview-Commit-ID: 7IwUysPBHZu --HG-- rename : services/common/remote-settings.js => services/settings/remote-settings.js rename : services/common/tests/unit/test_remote_settings.js => services/settings/test/unit/test_remote_settings.js rename : services/common/tests/unit/test_remote_settings_jexl_filters.js => services/settings/test/unit/test_remote_settings_jexl_filters.js rename : services/common/tests/unit/test_remote_settings_poll.js => services/settings/test/unit/test_remote_settings_poll.js extra : rebase_source : 19384aaa4f1598bccdb856d164a96b66d36d1a39
This commit is contained in:
parent
a053a5beb0
commit
5d67782ca2
@ -299,6 +299,7 @@
|
||||
@RESPATH@/components/CaptivePortalDetectComponents.manifest
|
||||
@RESPATH@/components/captivedetect.js
|
||||
@RESPATH@/components/servicesComponents.manifest
|
||||
@RESPATH@/components/servicesSettings.manifest
|
||||
@RESPATH@/components/cryptoComponents.manifest
|
||||
@RESPATH@/components/TelemetryStartup.js
|
||||
@RESPATH@/components/TelemetryStartup.manifest
|
||||
|
@ -11,8 +11,8 @@ var EXPORTED_SYMBOLS = [
|
||||
ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||
const { OS } = ChromeUtils.import("resource://gre/modules/osfile.jsm", {});
|
||||
|
||||
ChromeUtils.defineModuleGetter(this, "RemoteSettings", "resource://services-common/remote-settings.js");
|
||||
ChromeUtils.defineModuleGetter(this, "jexlFilterFunc", "resource://services-common/remote-settings.js");
|
||||
ChromeUtils.defineModuleGetter(this, "RemoteSettings", "resource://services-settings/remote-settings.js");
|
||||
ChromeUtils.defineModuleGetter(this, "jexlFilterFunc", "resource://services-settings/remote-settings.js");
|
||||
|
||||
const PREF_BLOCKLIST_BUCKET = "services.blocklist.bucket";
|
||||
const PREF_BLOCKLIST_ONECRL_COLLECTION = "services.blocklist.onecrl.collection";
|
||||
|
@ -4,7 +4,7 @@
|
||||
Remote Settings
|
||||
===============
|
||||
|
||||
The `remote-settings.js <https://dxr.mozilla.org/mozilla-central/source/services/common/remote-settings.js>`_ module offers the ability to fetch remote settings that are kept in sync with Mozilla servers.
|
||||
The `remote-settings.js <https://dxr.mozilla.org/mozilla-central/source/services/settings/remote-settings.js>`_ module offers the ability to fetch remote settings that are kept in sync with Mozilla servers.
|
||||
|
||||
|
||||
Usage
|
||||
@ -14,7 +14,7 @@ The ``get()`` method returns the list of entries for a specific key. Each entry
|
||||
|
||||
.. code-block:: js
|
||||
|
||||
const { RemoteSettings } = ChromeUtils.import("resource://services-common/remote-settings.js", {});
|
||||
const { RemoteSettings } = ChromeUtils.import("resource://services-settings/remote-settings.js", {});
|
||||
|
||||
const data = await RemoteSettings("a-key").get();
|
||||
|
||||
|
@ -21,7 +21,6 @@ EXTRA_JS_MODULES['services-common'] += [
|
||||
'kinto-storage-adapter.js',
|
||||
'logmanager.js',
|
||||
'observers.js',
|
||||
'remote-settings.js',
|
||||
'rest.js',
|
||||
'uptake-telemetry.js',
|
||||
'utils.js',
|
||||
|
@ -20,7 +20,7 @@ function addResourceAlias() {
|
||||
const handler = Services.io.getProtocolHandler("resource")
|
||||
.QueryInterface(Ci.nsIResProtocolHandler);
|
||||
|
||||
let modules = ["common", "crypto"];
|
||||
let modules = ["common", "crypto", "settings"];
|
||||
for (let module of modules) {
|
||||
let uri = Services.io.newURI("resource://gre/modules/services-" + module + "/");
|
||||
handler.setSubstitution("services-" + module, uri);
|
||||
|
@ -1,5 +1,5 @@
|
||||
const BlocklistClients = ChromeUtils.import("resource://services-common/blocklist-clients.js", {});
|
||||
const { RemoteSettings } = ChromeUtils.import("resource://services-common/remote-settings.js", {});
|
||||
const { RemoteSettings } = ChromeUtils.import("resource://services-settings/remote-settings.js", {});
|
||||
|
||||
const APP_ID = "xpcshell@tests.mozilla.org";
|
||||
const TOOLKIT_ID = "toolkit@mozilla.org";
|
||||
|
@ -18,12 +18,6 @@ tags = blocklist
|
||||
tags = blocklist
|
||||
[test_blocklist_pinning.js]
|
||||
tags = blocklist
|
||||
[test_remote_settings.js]
|
||||
tags = remote-settings blocklist
|
||||
[test_remote_settings_poll.js]
|
||||
tags = remote-settings blocklist
|
||||
[test_remote_settings_jexl_filters.js]
|
||||
tags = remote-settings
|
||||
|
||||
[test_kinto.js]
|
||||
tags = blocklist
|
||||
|
@ -8,3 +8,13 @@ with Files('**'):
|
||||
DIRS += [
|
||||
'dumps',
|
||||
]
|
||||
|
||||
EXTRA_COMPONENTS += [
|
||||
'servicesSettings.manifest',
|
||||
]
|
||||
|
||||
EXTRA_JS_MODULES['services-settings'] += [
|
||||
'remote-settings.js',
|
||||
]
|
||||
|
||||
XPCSHELL_TESTS_MANIFESTS += ['test/unit/xpcshell.ini']
|
||||
|
@ -275,8 +275,8 @@ class RemoteSettingsClient {
|
||||
// a packaged JSON dump.
|
||||
if (timestamp == null) {
|
||||
try {
|
||||
const { data } = await this._loadDumpFile();
|
||||
await c.loadDump(data);
|
||||
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);
|
2
services/settings/servicesSettings.manifest
Normal file
2
services/settings/servicesSettings.manifest
Normal file
@ -0,0 +1,2 @@
|
||||
# Register resource aliases
|
||||
resource services-settings resource://gre/modules/services-settings/
|
7
services/settings/test/unit/.eslintrc.js
Normal file
7
services/settings/test/unit/.eslintrc.js
Normal file
@ -0,0 +1,7 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = {
|
||||
"extends": [
|
||||
"plugin:mozilla/xpcshell-test"
|
||||
]
|
||||
};
|
@ -1,9 +1,11 @@
|
||||
/* import-globals-from ../../../common/tests/unit/head_helpers.js */
|
||||
|
||||
const { Constructor: CC } = Components;
|
||||
|
||||
ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||
ChromeUtils.import("resource://testing-common/httpd.js");
|
||||
|
||||
const { RemoteSettings } = ChromeUtils.import("resource://services-common/remote-settings.js", {});
|
||||
const { RemoteSettings } = ChromeUtils.import("resource://services-settings/remote-settings.js", {});
|
||||
const { UptakeTelemetry } = ChromeUtils.import("resource://services-common/uptake-telemetry.js", {});
|
||||
|
||||
const BinaryInputStream = CC("@mozilla.org/binaryinputstream;1",
|
@ -1,4 +1,5 @@
|
||||
const { RemoteSettings } = ChromeUtils.import("resource://services-common/remote-settings.js", {});
|
||||
ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||
const { RemoteSettings } = ChromeUtils.import("resource://services-settings/remote-settings.js", {});
|
||||
|
||||
let client;
|
||||
|
@ -1,6 +1,10 @@
|
||||
/* import-globals-from ../../../common/tests/unit/head_helpers.js */
|
||||
|
||||
ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||
ChromeUtils.import("resource://testing-common/httpd.js");
|
||||
|
||||
const { UptakeTelemetry } = ChromeUtils.import("resource://services-common/uptake-telemetry.js", {});
|
||||
const { RemoteSettings } = ChromeUtils.import("resource://services-common/remote-settings.js", {});
|
||||
const { RemoteSettings } = ChromeUtils.import("resource://services-settings/remote-settings.js", {});
|
||||
|
||||
var server;
|
||||
|
8
services/settings/test/unit/xpcshell.ini
Normal file
8
services/settings/test/unit/xpcshell.ini
Normal file
@ -0,0 +1,8 @@
|
||||
[DEFAULT]
|
||||
head = ../../../common/tests/unit/head_global.js ../../../common/tests/unit/head_helpers.js
|
||||
firefox-appdir = browser
|
||||
tags = remote-settings
|
||||
|
||||
[test_remote_settings.js]
|
||||
[test_remote_settings_poll.js]
|
||||
[test_remote_settings_jexl_filters.js]
|
@ -40,7 +40,7 @@ XPCOMUtils.defineLazyGetter(this, "RemoteSettings", function() {
|
||||
// Instantiate blocklist clients.
|
||||
BlocklistClients.initialize();
|
||||
// Import RemoteSettings for ``pollChanges()``
|
||||
const { RemoteSettings } = ChromeUtils.import("resource://services-common/remote-settings.js", {});
|
||||
const { RemoteSettings } = ChromeUtils.import("resource://services-settings/remote-settings.js", {});
|
||||
return RemoteSettings;
|
||||
});
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user