зеркало из https://github.com/mozilla/gecko-dev.git
Fix for bug 373035 (Make content/dom code get nsDOMClassInfo without going through nsIDOMScriptObjectFactory). r/sr=jst.
This commit is contained in:
Родитель
c9355efc94
Коммит
e5d3f5db52
|
@ -1110,14 +1110,7 @@ private:
|
|||
(ptr, result)
|
||||
|
||||
#define NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(_class) \
|
||||
if (aIID.Equals(NS_GET_IID(nsIClassInfo))) { \
|
||||
foundInterface = \
|
||||
nsContentUtils::GetClassInfoInstance(eDOMClassInfo_##_class##_id); \
|
||||
if (!foundInterface) { \
|
||||
*aInstancePtr = nsnull; \
|
||||
return NS_ERROR_OUT_OF_MEMORY; \
|
||||
} \
|
||||
} else
|
||||
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(_class)
|
||||
|
||||
#define NS_INTERFACE_MAP_ENTRY_TEAROFF(_interface, _allocator) \
|
||||
if (aIID.Equals(NS_GET_IID(_interface))) { \
|
||||
|
|
|
@ -588,15 +588,6 @@ nsContentUtils::Shutdown()
|
|||
}
|
||||
}
|
||||
|
||||
// static
|
||||
nsISupports *
|
||||
nsContentUtils::GetClassInfoInstance(nsDOMClassInfoID aID)
|
||||
{
|
||||
nsIDOMScriptObjectFactory *factory = GetDOMScriptObjectFactory();
|
||||
|
||||
return factory ? factory->GetClassInfoInstance(aID) : nsnull;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether two nodes come from the same origin. aTrustedNode is
|
||||
* considered 'safe' in that a user can operate on it and that it isn't
|
||||
|
|
|
@ -1103,8 +1103,7 @@ NS_NewHTML##_elementName##Element(nsINodeInfo *aNodeInfo, PRBool aFromParser)\
|
|||
#define NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO_IF_TAG(_class, _tag) \
|
||||
if (mNodeInfo->Equals(nsGkAtoms::_tag) && \
|
||||
aIID.Equals(NS_GET_IID(nsIClassInfo))) { \
|
||||
foundInterface = \
|
||||
nsContentUtils::GetClassInfoInstance(eDOMClassInfo_##_class##_id); \
|
||||
foundInterface = NS_GetDOMClassInfoInstance(eDOMClassInfo_##_class##_id); \
|
||||
if (!foundInterface) { \
|
||||
*aInstancePtr = nsnull; \
|
||||
return NS_ERROR_OUT_OF_MEMORY; \
|
||||
|
|
|
@ -82,7 +82,7 @@ nsXMLElement::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
|||
} else if (aIID.Equals(NS_GET_IID(nsIDOMElement))) {
|
||||
inst = NS_STATIC_CAST(nsIDOMElement *, this);
|
||||
} else if (aIID.Equals(NS_GET_IID(nsIClassInfo))) {
|
||||
inst = nsContentUtils::GetClassInfoInstance(eDOMClassInfo_Element_id);
|
||||
inst = NS_GetDOMClassInfoInstance(eDOMClassInfo_Element_id);
|
||||
NS_ENSURE_TRUE(inst, NS_ERROR_OUT_OF_MEMORY);
|
||||
} else {
|
||||
return PostQueryInterface(aIID, aInstancePtr);
|
||||
|
|
|
@ -654,9 +654,8 @@ nsXTFElementWrapper::GetInterfaces(PRUint32* aCount, nsIID*** aArray)
|
|||
PRUint32 xtfCount = 0;
|
||||
nsIID** xtfArray = nsnull;
|
||||
|
||||
nsCOMPtr<nsISupports> ci =
|
||||
nsContentUtils::GetClassInfoInstance(eDOMClassInfo_Element_id);
|
||||
nsCOMPtr<nsIClassInfo> baseCi = do_QueryInterface(ci);
|
||||
nsCOMPtr<nsIClassInfo> baseCi =
|
||||
NS_GetDOMClassInfoInstance(eDOMClassInfo_Element_id);
|
||||
if (baseCi) {
|
||||
baseCi->GetInterfaces(&baseCount, &baseArray);
|
||||
}
|
||||
|
@ -715,7 +714,7 @@ nsXTFElementWrapper::GetHelperForLanguage(PRUint32 language,
|
|||
{
|
||||
*aHelper = nsnull;
|
||||
nsCOMPtr<nsIClassInfo> ci =
|
||||
do_QueryInterface(nsContentUtils::GetClassInfoInstance(eDOMClassInfo_Element_id));
|
||||
NS_GetDOMClassInfoInstance(eDOMClassInfo_Element_id);
|
||||
return
|
||||
ci ? ci->GetHelperForLanguage(language, aHelper) : NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
|
|
|
@ -462,7 +462,7 @@ nsXULElement::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
|||
new nsXULElementTearoff(this));
|
||||
NS_ENSURE_TRUE(inst, NS_ERROR_OUT_OF_MEMORY);
|
||||
} else if (aIID.Equals(NS_GET_IID(nsIClassInfo))) {
|
||||
inst = nsContentUtils::GetClassInfoInstance(eDOMClassInfo_XULElement_id);
|
||||
inst = NS_GetDOMClassInfoInstance(eDOMClassInfo_XULElement_id);
|
||||
NS_ENSURE_TRUE(inst, NS_ERROR_OUT_OF_MEMORY);
|
||||
} else {
|
||||
return PostQueryInterface(aIID, aInstancePtr);
|
||||
|
|
|
@ -395,4 +395,20 @@ enum nsDOMClassInfoID {
|
|||
eDOMClassInfoIDCount
|
||||
};
|
||||
|
||||
/**
|
||||
* nsIClassInfo helper macros
|
||||
*/
|
||||
|
||||
extern nsIClassInfo*
|
||||
NS_GetDOMClassInfoInstance(nsDOMClassInfoID aID);
|
||||
|
||||
#define NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(_class) \
|
||||
if (aIID.Equals(NS_GET_IID(nsIClassInfo))) { \
|
||||
foundInterface = NS_GetDOMClassInfoInstance(eDOMClassInfo_##_class##_id); \
|
||||
if (!foundInterface) { \
|
||||
*aInstancePtr = nsnull; \
|
||||
return NS_ERROR_OUT_OF_MEMORY; \
|
||||
} \
|
||||
} else
|
||||
|
||||
#endif // nsDOMClassInfoID_h__
|
||||
|
|
|
@ -3720,7 +3720,7 @@ nsDOMClassInfo::InnerObject(nsIXPConnectWrappedNative *wrapper, JSContext * cx,
|
|||
|
||||
// static
|
||||
nsIClassInfo *
|
||||
nsDOMClassInfo::GetClassInfoInstance(nsDOMClassInfoID aID)
|
||||
NS_GetDOMClassInfoInstance(nsDOMClassInfoID aID)
|
||||
{
|
||||
if (aID >= eDOMClassInfoIDCount) {
|
||||
NS_ERROR("Bad ID!");
|
||||
|
@ -3728,8 +3728,8 @@ nsDOMClassInfo::GetClassInfoInstance(nsDOMClassInfoID aID)
|
|||
return nsnull;
|
||||
}
|
||||
|
||||
if (!sIsInitialized) {
|
||||
nsresult rv = Init();
|
||||
if (!nsDOMClassInfo::sIsInitialized) {
|
||||
nsresult rv = nsDOMClassInfo::Init();
|
||||
|
||||
NS_ENSURE_SUCCESS(rv, nsnull);
|
||||
}
|
||||
|
@ -5324,7 +5324,7 @@ nsWindowSH::GlobalResolve(nsGlobalWindow *aWin, JSContext *cx,
|
|||
|
||||
nsDOMClassInfoID ci_id = (nsDOMClassInfoID)id;
|
||||
|
||||
nsCOMPtr<nsIClassInfo> ci(GetClassInfoInstance(ci_id));
|
||||
nsCOMPtr<nsIClassInfo> ci(NS_GetDOMClassInfoInstance(ci_id));
|
||||
NS_ENSURE_TRUE(ci, NS_ERROR_UNEXPECTED);
|
||||
|
||||
nsCOMPtr<nsIXPConnectJSObjectHolder> proto_holder;
|
||||
|
|
|
@ -119,7 +119,6 @@ public:
|
|||
// GetClassInfoA so I can't, those $%#@^! bastards!!! What gives
|
||||
// them the right to do that?
|
||||
|
||||
static nsIClassInfo* GetClassInfoInstance(nsDOMClassInfoID aID);
|
||||
static nsIClassInfo* GetClassInfoInstance(nsDOMClassInfoData* aData);
|
||||
|
||||
static void ShutDown();
|
||||
|
@ -176,6 +175,8 @@ public:
|
|||
static nsresult PreserveNodeWrapper(nsIXPConnectWrappedNative *aWrapper);
|
||||
|
||||
protected:
|
||||
friend nsIClassInfo* NS_GetDOMClassInfoInstance(nsDOMClassInfoID aID);
|
||||
|
||||
const nsDOMClassInfoData* mData;
|
||||
|
||||
static nsresult Init();
|
||||
|
@ -1581,18 +1582,4 @@ public:
|
|||
void InvalidateContextAndWrapperCache();
|
||||
|
||||
|
||||
/**
|
||||
* nsIClassInfo helper macros
|
||||
*/
|
||||
|
||||
#define NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(_class) \
|
||||
if (aIID.Equals(NS_GET_IID(nsIClassInfo))) { \
|
||||
foundInterface = \
|
||||
nsDOMClassInfo::GetClassInfoInstance(eDOMClassInfo_##_class##_id); \
|
||||
if (!foundInterface) { \
|
||||
*aInstancePtr = nsnull; \
|
||||
return NS_ERROR_OUT_OF_MEMORY; \
|
||||
} \
|
||||
} else
|
||||
|
||||
#endif /* nsDOMClassInfo_h___ */
|
||||
|
|
|
@ -220,7 +220,7 @@ nsDOMScriptObjectFactory::NewScriptGlobalObject(PRBool aIsChrome,
|
|||
NS_IMETHODIMP_(nsISupports *)
|
||||
nsDOMScriptObjectFactory::GetClassInfoInstance(nsDOMClassInfoID aID)
|
||||
{
|
||||
return nsDOMClassInfo::GetClassInfoInstance(aID);
|
||||
return NS_GetDOMClassInfoInstance(aID);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP_(nsISupports *)
|
||||
|
|
Загрузка…
Ссылка в новой задаче