From 8a6b7fe6dca4342ca58525dbb2ea5eb0f648e620 Mon Sep 17 00:00:00 2001 From: "dtownsend%oxymoronical.com" Date: Fri, 25 Jan 2008 09:30:41 +0000 Subject: [PATCH] Bug 366973: crash reporter should send list of installed extensions. r=robstrong, a=beltzner git-svn-id: svn://10.0.0.236/trunk@243975 18797224-902f-48f8-a5cc-f745e15eee43 --- .../extensions/src/nsExtensionManager.js.in | 24 ++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/mozilla/toolkit/mozapps/extensions/src/nsExtensionManager.js.in b/mozilla/toolkit/mozapps/extensions/src/nsExtensionManager.js.in index 6157407e252..2a6c1c197a7 100644 --- a/mozilla/toolkit/mozapps/extensions/src/nsExtensionManager.js.in +++ b/mozilla/toolkit/mozapps/extensions/src/nsExtensionManager.js.in @@ -57,6 +57,7 @@ Components.utils.import("resource://gre/modules/XPCOMUtils.jsm"); const PREF_EM_CHECK_COMPATIBILITY = "extensions.checkCompatibility"; const PREF_EM_CHECK_UPDATE_SECURITY = "extensions.checkUpdateSecurity"; const PREF_EM_LAST_APP_VERSION = "extensions.lastAppVersion"; +const PREF_EM_ENABLED_ITEMS = "extensions.enabledItems"; const PREF_UPDATE_COUNT = "extensions.update.count"; const PREF_UPDATE_DEFAULT_URL = "extensions.update.url"; const PREF_EM_IGNOREMTIMECHANGES = "extensions.ignoreMTimeChanges"; @@ -2573,6 +2574,20 @@ ExtensionManager.prototype = { } catch (e) { } + + if ("nsICrashReporter" in Ci && gApp instanceof Ci.nsICrashReporter) { + // Annotate the crash report with the list of add-ons + try { + try { + gApp.annotateCrashReport("Add-ons", gPref.getCharPref(PREF_EM_ENABLED_ITEMS)); + } catch (e) { } + gApp.annotateCrashReport("Theme", gPref.getCharPref(PREF_GENERAL_SKINS_SELECTEDSKIN)); + } + catch (ex) { + // This will fail in unnofficial builds, ignorable error + } + } + gLoggingEnabled = getPref("getBoolPref", PREF_EM_LOGGING_ENABLED, false); gCheckCompatibility = getPref("getBoolPref", PREF_EM_CHECK_COMPATIBILITY, true); gCheckUpdateSecurity = getPref("getBoolPref", PREF_EM_CHECK_UPDATE_SECURITY, true); @@ -3841,7 +3856,8 @@ ExtensionManager.prototype = { } // Suppress items that have been disabled by the user or the app. if (ds.getItemProperty(item.id, "isDisabled") != "true") - activeItems.push({ id: item.id, location: installLocation }); + activeItems.push({ id: item.id, version: item.version, + location: installLocation }); } return activeItems; @@ -3867,6 +3883,7 @@ ExtensionManager.prototype = { var extensionsLocationsFile = getFile(KEY_PROFILEDIR, [FILE_EXTENSION_MANIFEST]); var fos = openSafeFileOutputStream(extensionsLocationsFile); + var enabledItems = []; var extensionSectionHeader = "[ExtensionDirs]\r\n"; fos.write(extensionSectionHeader, extensionSectionHeader.length); for (var i = 0; i < validExtensions.length; ++i) { @@ -3875,6 +3892,7 @@ ExtensionManager.prototype = { var descriptor = getAbsoluteDescriptor(itemLocation); var line = "Extension" + i + "=" + descriptor + "\r\n"; fos.write(line, line.length); + enabledItems.push(e.id + ":" + e.version); } var themeSectionHeader = "[ThemeDirs]\r\n"; @@ -3885,10 +3903,14 @@ ExtensionManager.prototype = { var descriptor = getAbsoluteDescriptor(itemLocation); var line = "Extension" + i + "=" + descriptor + "\r\n"; fos.write(line, line.length); + enabledItems.push(e.id + ":" + e.version); } closeSafeFileOutputStream(fos); + // Cache the enabled list for annotating the crash report subsequently + gPref.setCharPref(PREF_EM_ENABLED_ITEMS, enabledItems.join(",")); + // Now refresh the compatibility manifest. this._extensionListChanged = needsRestart; },