Bug 1372326 - record services initialized during startup, r=mconley.

This commit is contained in:
Florian Quèze 2017-06-13 08:39:39 +02:00
Родитель bfe09ec4ed
Коммит d0a8fb470b
2 изменённых файлов: 15 добавлений и 3 удалений

Просмотреть файл

@ -56,6 +56,9 @@ const startupPhases = {
components: new Set([
"nsSearchService.js",
"UnifiedComplete.js",
]),
services: new Set([
"@mozilla.org/browser/search-service;1",
])
}},
@ -102,7 +105,7 @@ function test() {
let loadedList = data[phase];
let whitelist = startupPhases[phase].whitelist || null;
if (whitelist) {
for (let scriptType in loadedList) {
for (let scriptType in whitelist) {
loadedList[scriptType] = loadedList[scriptType].filter(c => {
if (!whitelist[scriptType].has(c))
return true;

Просмотреть файл

@ -2,7 +2,8 @@
* 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/. */
const {classes: Cc, utils: Cu, interfaces: Ci} = Components;
const {classes: Cc, utils: Cu, interfaces: Ci, manager: Cm} = Components;
Cm.QueryInterface(Ci.nsIServiceManager);
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");
@ -35,7 +36,15 @@ startupRecorder.prototype = {
record(name) {
this.data[name] = {
components: this.loader.loadedComponents(),
modules: this.loader.loadedModules()
modules: this.loader.loadedModules(),
services: Object.keys(Cc).filter(c => {
try {
Cm.isServiceInstantiatedByContractID(c, Ci.nsISupports);
return true;
} catch (e) {
return false;
}
})
};
},