gecko-dev/remote/command-line-handler.js
Andreas Tolfsen a3273a8312 bug 1533831: remote: disable remote agent; r=ochameau
This disables the remote agent through flipping the remote.enabled
preference to false.  This will cause the help text to disappear from
--help and the RemoteAgent#init() (in remote/RemoteAgent.jsm) to fail.

We also change RemoteAgent.jsm to being loaded lazily so that it
isn't imported.

Differential Revision: https://phabricator.services.mozilla.com/D27539

--HG--
extra : moz-landing-system : lando
2019-04-24 17:18:37 +00:00

39 lines
1.2 KiB
JavaScript

/* 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/. */
"use strict";
// Stopgap module until we can land bug 1536862 and remove this temporary file
const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
const {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
ChromeUtils.defineModuleGetter(this, "RemoteAgent",
"chrome://remote/content/RemoteAgent.jsm");
const RemoteAgentFactory = {
createInstance(outer, iid) {
if (outer) {
throw Cr.NS_ERROR_NO_AGGREGATION;
}
// we can't use Preferences.jsm before first paint
if (!Services.prefs.getBoolPref("remote.enabled")) {
return {};
}
return RemoteAgent.QueryInterface(iid);
},
};
function RemoteAgentComponent() {}
RemoteAgentComponent.prototype = {
classDescription: "Remote Agent",
classID: Components.ID("{8f685a9d-8181-46d6-a71d-869289099c6d}"),
contractID: "@mozilla.org/remote/agent",
_xpcom_factory: RemoteAgentFactory, /* eslint-disable-line */
};
this.NSGetFactory = XPCOMUtils.generateNSGetFactory([RemoteAgentComponent]);