Bug 780121 - Expose internal Add-ons Manager objects in debug builds. r=Mossop
authorBlair McBride <bmcbride@mozilla.com>
Mon, 13 Aug 2012 14:19:37 +1200
changeset 107681 320b8cd5c893d6482e102dc6a043bc40eae010ae
parent 107680 f360d7bf33dcfa0b7c4418e57ea07d8282412e09
child 107682 9fcf6f5cb2c1182d0a903f0c2caf07f0606819ef
push id1490
push userakeybl@mozilla.com
push dateMon, 08 Oct 2012 18:29:50 +0000
treeherdermozilla-beta@f335e7dacdc1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersMossop
bugs780121
milestone17.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 780121 - Expose internal Add-ons Manager objects in debug builds. r=Mossop
toolkit/mozapps/extensions/AddonManager.jsm
toolkit/mozapps/extensions/Makefile.in
toolkit/mozapps/extensions/XPIProvider.jsm
--- a/toolkit/mozapps/extensions/AddonManager.jsm
+++ b/toolkit/mozapps/extensions/AddonManager.jsm
@@ -2113,16 +2113,22 @@ var AddonManager = {
   // an application change making an add-on incompatible. Doesn't include
   // add-ons that were pending being disabled the last time the application ran.
   STARTUP_CHANGE_DISABLED: "disabled",
   // Add-ons that were detected as enabled during startup, normally because of
   // an application change making an add-on compatible. Doesn't include
   // add-ons that were pending being enabled the last time the application ran.
   STARTUP_CHANGE_ENABLED: "enabled",
 
+#ifdef MOZ_EM_DEBUG
+  get __AddonManagerInternal__() {
+    return AddonManagerInternal;
+  },
+#endif
+
   getInstallForURL: function AM_getInstallForURL(aUrl, aCallback, aMimetype,
                                                  aHash, aName, aIconURL,
                                                  aVersion, aLoadGroup) {
     AddonManagerInternal.getInstallForURL(aUrl, aCallback, aMimetype, aHash,
                                           aName, aIconURL, aVersion, aLoadGroup);
   },
 
   getInstallForFile: function AM_getInstallForFile(aFile, aCallback, aMimetype) {
--- a/toolkit/mozapps/extensions/Makefile.in
+++ b/toolkit/mozapps/extensions/Makefile.in
@@ -12,16 +12,24 @@ include $(DEPTH)/config/autoconf.mk
 ifeq (,$(filter aurora beta release esr,$(MOZ_UPDATE_CHANNEL)))
 DEFINES += -DMOZ_COMPATIBILITY_NIGHTLY=1
 endif
 
 # This is used in multiple places, so is defined here to avoid it getting
 # out of sync.
 DEFINES += -DMOZ_EXTENSIONS_DB_SCHEMA=13
 
+# Additional debugging info is exposed in debug builds, or by setting the
+# MOZ_EM_DEBUG environment variable when building.
+ifneq (,$(MOZ_EM_DEBUG))
+DEFINES += -DMOZ_EM_DEBUG=1
+else ifdef MOZ_DEBUG
+DEFINES += -DMOZ_EM_DEBUG=1
+endif
+
 MODULE = extensions
 
 XPIDLSRCS = \
   amIInstallTrigger.idl \
   amIWebInstallListener.idl \
   amIWebInstaller.idl \
   $(NULL)
 
--- a/toolkit/mozapps/extensions/XPIProvider.jsm
+++ b/toolkit/mozapps/extensions/XPIProvider.jsm
@@ -5208,16 +5208,22 @@ AddonInstall.createUpdate = function(aCa
 
 /**
  * Creates a wrapper for an AddonInstall that only exposes the public API
  *
  * @param  install
  *         The AddonInstall to create a wrapper for
  */
 function AddonInstallWrapper(aInstall) {
+#ifdef MOZ_EM_DEBUG
+  this.__defineGetter__("__AddonInstallInternal__", function AIW_debugGetter() {
+    return aInstall;
+  });
+#endif
+
   ["name", "type", "version", "iconURL", "releaseNotesURI", "file", "state", "error",
    "progress", "maxProgress", "certificate", "certName"].forEach(function(aProp) {
     this.__defineGetter__(aProp, function() aInstall[aProp]);
   }, this);
 
   this.__defineGetter__("existingAddon", function() {
     return createWrapper(aInstall.existingAddon);
   });
@@ -5749,16 +5755,22 @@ function createWrapper(aAddon) {
   return aAddon._wrapper;
 }
 
 /**
  * The AddonWrapper wraps an Addon to provide the data visible to consumers of
  * the public API.
  */
 function AddonWrapper(aAddon) {
+#ifdef MOZ_EM_DEBUG
+  this.__defineGetter__("__AddonInternal__", function AW_debugGetter() {
+    return aAddon;
+  });
+#endif
+
   function chooseValue(aObj, aProp) {
     let repositoryAddon = aAddon._repositoryAddon;
     let objValue = aObj[aProp];
 
     if (repositoryAddon && (aProp in repositoryAddon) &&
         (objValue === undefined || objValue === null)) {
       return [repositoryAddon[aProp], true];
     }