Confused about require("chrome") support

The following text can be found on this blog post concerning depricating XUL: The Future of Developin Firefox Add-Ons

We will also continue supporting SDK add-ons as long as they don’t use require(‘chrome’) or some of the low-level APIs that provide access to XUL elements.

However, I just installed the Firefox Nightly build and my test add-on seems to be working fine, although it uses require(‘chrome’).

Relevant code from the add-on:

var { Cc, Ci } = require("chrome");
var SearchService = Cc["@mozilla.org/browser/search-service;1"].getService(Ci.nsIBrowserSearchService);
SearchService.addEngineWithDetails('mysearch', 'icon', 'mysearchalias', 'my search description', 'get', 'http://stackoverflow.com/search?q={searchTerms}');
SearchService.currentEngine = SearchService.getEngineByName('mysearch');

Am I misunderstanding something? Will the support for require(‘chrome’) be dropped at a later time?

1 Like

That’s not talking about e10s that’s talking about deprecating XUL, and almost deprecating the SDK, to switch over to WebExtensions. Yes require(“chrome”) will be dropped within the next 12-18 months.

Is there a draft or something to know how to do things that we now do with require(“chrome”).

For example, I get and set advanced network settings in an addon. As far as I know the only way to do it now is with:

const {Cu} = require(‘chrome’);
Cu.import(“resource://gre/modules/Services.jsm”);
var prefService = Services.prefs;

Thanks

Also, will submissions made to addons.mozilla.org in the next 6 months that use require(‘chrome’) be successfully approved and signed?

I don’t think there’s anything like that now. As new APIs are added, they should be documented. At the moment the official doc is this wiki page.

1 Like

Yes.

Hi,

I am also now looking at rebuilding a firefox using the addons sdk.
The main purpose of the extensions is to read the http traffic for analytics purposes and translate it to a more user friendly manner in order to run our validation.

Any idea or suggestion on how to achieve it if the require(‘chrome’) will be deprecated?

Thanks

If you use the WebExtensions API instead, you can use this:

(you will never see a response body, though)