зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1007207 - Don't treat self-implemented classinfo instances differently during XPCWN creation. r=peterv
This commit is contained in:
Родитель
ba67732f00
Коммит
7f390b6bd2
|
@ -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;
|
||||
|
|
Загрузка…
Ссылка в новой задаче