Written on Jul 30, 2018
So I have added all services from Services.jsm to Services.py
and firefox has compiled successfully, but one of the errors I get upon starting
Firefox is that Services.search is undefined. I define Services.search if MOZ_TOOLKIT_SEARCH is defined. But it seems as though MOZ_TOOLKIT_SEARCH is not defined, even though it’s needed. Let’s try to figure out how to define it.
I found this code bit.
for var in ('MOZ_TOOLKIT_SEARCH',
'MOZ_SYSTEM_NSS',
'MOZ_UPDATER',
'MOZ_ANDROID_MOZILLA_ONLINE',
'MOZ_SWITCHBOARD'):
if CONFIG[var]:
DEFINES[var] = True
So I added the following to xpcom/build/moz.build
for var in ('MOZ_TOOLKIT_SEARCH',
'MOZ_CRASHREPORTER',
'MOZ_GECKO_PROFILER',
'ANDROID'):
if CONFIG[var]:
DEFINES[var] = True
because all of the above are mentioned in Services.jsm.
I am running firefox, and while most of the things are working, I am getting the following error in the console:
... TypeError: Services.blocklist.pluginQueries is undefined (resource://gre/modules/Blocklist.jsm:310:1) JS Stack trace: _init@Blocklist.jsm:310:1
So turns out Blocklist service, similar to CrashManageris also defined in JavaScript.
I need to figure out how to expose it to C++.
Next steps and observations
"@mozilla.org/extensions/blocklist;1" in cpp files shows that when a service is retrieved using the above contract id, it is treated as nsIBlocklistService.nsIBlocklistService classblocklist or for nsIBlocklistServiceextensions.manifest file, and I am not sure if I need this as well
extensions.manifestnsIBlocklistService.pluginQueriesBlocklist defined in several places?
Blocklist definition back to this bug.Blocklist.jsm is just a stubServices.blocklist.pluginQueries is not defined, and I think perhaps that due to
the field not being specified in the interface in the idl filesServices.blocklist.isLoaded returns false when I comment out the old Service object and use mine, and returns true when the old Service object is used globallyCu.isModuleLoaded(BLOCKLIST_JSM) returns false, so I guess we are not loading it properly when we are exposing it via C++.Blocklist.jsm. What we have in Blocklist.jsm is only a stub, and the real implementation is located in toolkit/mozapps/extensions/addonManager.js. The real implementation also contains some fields that are not exposed through idl. Should we go ahead andwebidl