Bug 929297 - Part 2: Avoid calling amIAddonManager in reporters off the main process. r=njn

This commit is contained in:
Nils Maier 2013-10-28 04:53:00 +00:00
parent a6699d7288
commit ccc8856587
3 changed files with 20 additions and 6 deletions

View File

@ -484,8 +484,11 @@ nsWindowMemoryReporter::CollectReports(nsIMemoryReporterCallback* aCb,
// Collect window memory usage.
nsWindowSizes windowTotalSizes(NULL);
nsCOMPtr<amIAddonManager> addonManager =
do_GetService("@mozilla.org/addons/integration;1");
nsCOMPtr<amIAddonManager> addonManager;
if (XRE_GetProcessType() == GeckoProcessType_Default) {
// Only try to access the service from the main process.
addonManager = do_GetService("@mozilla.org/addons/integration;1");
}
for (uint32_t i = 0; i < windows.Length(); i++) {
rv = CollectWindowReports(windows[i], addonManager,
&windowTotalSizes, &ghostWindows,

View File

@ -1990,6 +1990,11 @@ private:
mAlreadyMappedToAddon = true;
if (XRE_GetProcessType() != GeckoProcessType_Default) {
// Only try to access the service from the main process.
return;
}
nsAutoCString addonId;
bool ok;
nsCOMPtr<amIAddonManager> addonManager =

View File

@ -2366,8 +2366,11 @@ ReportJSRuntimeExplicitTreeStats(const JS::RuntimeStats &rtStats,
nsIMemoryReporterCallback *cb,
nsISupports *closure, size_t *rtTotalOut)
{
nsCOMPtr<amIAddonManager> am =
do_GetService("@mozilla.org/addons/integration;1");
nsCOMPtr<amIAddonManager> am;
if (XRE_GetProcessType() == GeckoProcessType_Default) {
// Only try to access the service from the main process.
am = do_GetService("@mozilla.org/addons/integration;1");
}
return ReportJSRuntimeExplicitTreeStats(rtStats, rtPath, am.get(), cb,
closure, rtTotalOut);
}
@ -2604,8 +2607,11 @@ JSReporter::CollectReports(WindowPaths *windowPaths,
// callback may be a JS function, and executing JS while getting these
// stats seems like a bad idea.
nsCOMPtr<amIAddonManager> addonManager =
do_GetService("@mozilla.org/addons/integration;1");
nsCOMPtr<amIAddonManager> addonManager;
if (XRE_GetProcessType() == GeckoProcessType_Default) {
// Only try to access the service from the main process.
addonManager = do_GetService("@mozilla.org/addons/integration;1");
}
bool getLocations = !!addonManager;
XPCJSRuntimeStats rtStats(windowPaths, topWindowPaths, getLocations);
OrphanReporter orphanReporter(XPCConvert::GetISupportsFromJSObject);