Bug 1007207 - Don't treat self-implemented classinfo instances differently during XPCWN creation. r=peterv

This commit is contained in:
Bobby Holley 2014-05-28 12:04:13 -07:00
Родитель ba67732f00
Коммит 7f390b6bd2
1 изменённых файлов: 3 добавлений и 5 удалений

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

@ -324,16 +324,14 @@ XPCWrappedNative::GetNewOrUsed(xpcObjectHelper& helper,
// It is possible that we will then end up forwarding this entire call
// to this same function but with a different scope.
// If we are making a wrapper for the nsIClassInfo interface then
// If we are making a wrapper for an nsIClassInfo singleton then
// We *don't* want to have it use the prototype meant for instances
// of that class.
bool iidIsClassInfo = Interface->GetIID()->Equals(NS_GET_IID(nsIClassInfo));
uint32_t classInfoFlags;
bool isClassInfoSingleton = helper.GetClassInfo() == helper.Object() &&
NS_SUCCEEDED(helper.GetClassInfo()
->GetFlags(&classInfoFlags)) &&
(classInfoFlags & nsIClassInfo::SINGLETON_CLASSINFO);
bool isClassInfo = iidIsClassInfo || isClassInfoSingleton;
nsIClassInfo *info = helper.GetClassInfo();
@ -348,7 +346,7 @@ XPCWrappedNative::GetNewOrUsed(xpcObjectHelper& helper,
// described by the nsIClassInfo, not for the class info object
// itself.
const XPCNativeScriptableCreateInfo& sciWrapper =
isClassInfo ? sci :
isClassInfoSingleton ? sci :
GatherScriptableCreateInfo(identity, info, sciProto, sci);
RootedObject parent(cx, Scope->GetGlobalJSObject());
@ -413,7 +411,7 @@ XPCWrappedNative::GetNewOrUsed(xpcObjectHelper& helper,
// Note that the security check happens inside FindTearOff - after the
// wrapper is actually created, but before JS code can see it.
if (info && !isClassInfo) {
if (info && !isClassInfoSingleton) {
proto = XPCWrappedNativeProto::GetNewOrUsed(Scope, info, &sciProto);
if (!proto)
return NS_ERROR_FAILURE;