Bug 1366896, part 2 - Add and use Cc.Initialize method. r=gabor
MozReview-Commit-ID: Amqt9JsTMqG
--- a/js/xpconnect/idl/xpccomponents.idl
+++ b/js/xpconnect/idl/xpccomponents.idl
@@ -39,16 +39,18 @@ interface nsIXPCComponents_Interfaces :
/**
* interface of Components.classes
* (interesting stuff only reflected into JavaScript)
*/
[scriptable, uuid(978ff520-d26c-11d2-9842-006008962422)]
interface nsIXPCComponents_Classes : nsISupports
{
+ // Make it so that |cid| gets mapped to |idString|.
+ void initialize(in nsIJSCID cid, in string idString);
};
/**
* interface of Components.classesByID
* (interesting stuff only reflected into JavaScript)
*/
[scriptable, uuid(336a9590-4d19-11d3-9893-006008962422)]
interface nsIXPCComponents_ClassesByID : nsISupports
--- a/js/xpconnect/src/XPCComponents.cpp
+++ b/js/xpconnect/src/XPCComponents.cpp
@@ -749,16 +749,24 @@ nsXPCComponents_Classes::Resolve(nsIXPCo
JSPROP_RESOLVING);
}
}
}
}
return NS_OK;
}
+NS_IMETHODIMP
+nsXPCComponents_Classes::Initialize(nsIJSCID* cid,
+ const char* str)
+{
+ return cid->Initialize(str);
+}
+
+
/***************************************************************************/
/***************************************************************************/
/***************************************************************************/
class nsXPCComponents_ClassesByID final :
public nsIXPCComponents_ClassesByID,
public nsIXPCScriptable,
public nsIClassInfo
--- a/testing/modules/AppInfo.jsm
+++ b/testing/modules/AppInfo.jsm
@@ -124,10 +124,15 @@ this.updateAppInfo = function(options) {
throw Cr.NS_ERROR_NO_AGGREGATION;
}
return currentAppInfo.QueryInterface(iid);
},
};
registrar.registerFactory(id, "XULAppInfo", cid, factory);
+
+ // Ensure that Cc actually maps cid to the new shim AppInfo. This is
+ // needed when JSM global sharing is enabled, because some prior
+ // code may already have looked up |Cc[cid]|.
+ Cc.initialize(Cc[cid], cid);
};