зеркало из 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)
|
(ptr, result)
|
||||||
|
|
||||||
#define NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(_class) \
|
#define NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(_class) \
|
||||||
if (aIID.Equals(NS_GET_IID(nsIClassInfo))) { \
|
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(_class)
|
||||||
foundInterface = \
|
|
||||||
nsContentUtils::GetClassInfoInstance(eDOMClassInfo_##_class##_id); \
|
|
||||||
if (!foundInterface) { \
|
|
||||||
*aInstancePtr = nsnull; \
|
|
||||||
return NS_ERROR_OUT_OF_MEMORY; \
|
|
||||||
} \
|
|
||||||
} else
|
|
||||||
|
|
||||||
#define NS_INTERFACE_MAP_ENTRY_TEAROFF(_interface, _allocator) \
|
#define NS_INTERFACE_MAP_ENTRY_TEAROFF(_interface, _allocator) \
|
||||||
if (aIID.Equals(NS_GET_IID(_interface))) { \
|
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
|
* 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
|
* considered 'safe' in that a user can operate on it and that it isn't
|
||||||
|
|
|
@ -1101,10 +1101,9 @@ NS_NewHTML##_elementName##Element(nsINodeInfo *aNodeInfo, PRBool aFromParser)\
|
||||||
|
|
||||||
|
|
||||||
#define NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO_IF_TAG(_class, _tag) \
|
#define NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO_IF_TAG(_class, _tag) \
|
||||||
if (mNodeInfo->Equals(nsGkAtoms::_tag) && \
|
if (mNodeInfo->Equals(nsGkAtoms::_tag) && \
|
||||||
aIID.Equals(NS_GET_IID(nsIClassInfo))) { \
|
aIID.Equals(NS_GET_IID(nsIClassInfo))) { \
|
||||||
foundInterface = \
|
foundInterface = NS_GetDOMClassInfoInstance(eDOMClassInfo_##_class##_id); \
|
||||||
nsContentUtils::GetClassInfoInstance(eDOMClassInfo_##_class##_id); \
|
|
||||||
if (!foundInterface) { \
|
if (!foundInterface) { \
|
||||||
*aInstancePtr = nsnull; \
|
*aInstancePtr = nsnull; \
|
||||||
return NS_ERROR_OUT_OF_MEMORY; \
|
return NS_ERROR_OUT_OF_MEMORY; \
|
||||||
|
|
|
@ -82,7 +82,7 @@ nsXMLElement::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
||||||
} else if (aIID.Equals(NS_GET_IID(nsIDOMElement))) {
|
} else if (aIID.Equals(NS_GET_IID(nsIDOMElement))) {
|
||||||
inst = NS_STATIC_CAST(nsIDOMElement *, this);
|
inst = NS_STATIC_CAST(nsIDOMElement *, this);
|
||||||
} else if (aIID.Equals(NS_GET_IID(nsIClassInfo))) {
|
} 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);
|
NS_ENSURE_TRUE(inst, NS_ERROR_OUT_OF_MEMORY);
|
||||||
} else {
|
} else {
|
||||||
return PostQueryInterface(aIID, aInstancePtr);
|
return PostQueryInterface(aIID, aInstancePtr);
|
||||||
|
|
|
@ -654,9 +654,8 @@ nsXTFElementWrapper::GetInterfaces(PRUint32* aCount, nsIID*** aArray)
|
||||||
PRUint32 xtfCount = 0;
|
PRUint32 xtfCount = 0;
|
||||||
nsIID** xtfArray = nsnull;
|
nsIID** xtfArray = nsnull;
|
||||||
|
|
||||||
nsCOMPtr<nsISupports> ci =
|
nsCOMPtr<nsIClassInfo> baseCi =
|
||||||
nsContentUtils::GetClassInfoInstance(eDOMClassInfo_Element_id);
|
NS_GetDOMClassInfoInstance(eDOMClassInfo_Element_id);
|
||||||
nsCOMPtr<nsIClassInfo> baseCi = do_QueryInterface(ci);
|
|
||||||
if (baseCi) {
|
if (baseCi) {
|
||||||
baseCi->GetInterfaces(&baseCount, &baseArray);
|
baseCi->GetInterfaces(&baseCount, &baseArray);
|
||||||
}
|
}
|
||||||
|
@ -715,7 +714,7 @@ nsXTFElementWrapper::GetHelperForLanguage(PRUint32 language,
|
||||||
{
|
{
|
||||||
*aHelper = nsnull;
|
*aHelper = nsnull;
|
||||||
nsCOMPtr<nsIClassInfo> ci =
|
nsCOMPtr<nsIClassInfo> ci =
|
||||||
do_QueryInterface(nsContentUtils::GetClassInfoInstance(eDOMClassInfo_Element_id));
|
NS_GetDOMClassInfoInstance(eDOMClassInfo_Element_id);
|
||||||
return
|
return
|
||||||
ci ? ci->GetHelperForLanguage(language, aHelper) : NS_ERROR_NOT_AVAILABLE;
|
ci ? ci->GetHelperForLanguage(language, aHelper) : NS_ERROR_NOT_AVAILABLE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -462,7 +462,7 @@ nsXULElement::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
||||||
new nsXULElementTearoff(this));
|
new nsXULElementTearoff(this));
|
||||||
NS_ENSURE_TRUE(inst, NS_ERROR_OUT_OF_MEMORY);
|
NS_ENSURE_TRUE(inst, NS_ERROR_OUT_OF_MEMORY);
|
||||||
} else if (aIID.Equals(NS_GET_IID(nsIClassInfo))) {
|
} 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);
|
NS_ENSURE_TRUE(inst, NS_ERROR_OUT_OF_MEMORY);
|
||||||
} else {
|
} else {
|
||||||
return PostQueryInterface(aIID, aInstancePtr);
|
return PostQueryInterface(aIID, aInstancePtr);
|
||||||
|
|
|
@ -395,4 +395,20 @@ enum nsDOMClassInfoID {
|
||||||
eDOMClassInfoIDCount
|
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__
|
#endif // nsDOMClassInfoID_h__
|
||||||
|
|
|
@ -3720,7 +3720,7 @@ nsDOMClassInfo::InnerObject(nsIXPConnectWrappedNative *wrapper, JSContext * cx,
|
||||||
|
|
||||||
// static
|
// static
|
||||||
nsIClassInfo *
|
nsIClassInfo *
|
||||||
nsDOMClassInfo::GetClassInfoInstance(nsDOMClassInfoID aID)
|
NS_GetDOMClassInfoInstance(nsDOMClassInfoID aID)
|
||||||
{
|
{
|
||||||
if (aID >= eDOMClassInfoIDCount) {
|
if (aID >= eDOMClassInfoIDCount) {
|
||||||
NS_ERROR("Bad ID!");
|
NS_ERROR("Bad ID!");
|
||||||
|
@ -3728,8 +3728,8 @@ nsDOMClassInfo::GetClassInfoInstance(nsDOMClassInfoID aID)
|
||||||
return nsnull;
|
return nsnull;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!sIsInitialized) {
|
if (!nsDOMClassInfo::sIsInitialized) {
|
||||||
nsresult rv = Init();
|
nsresult rv = nsDOMClassInfo::Init();
|
||||||
|
|
||||||
NS_ENSURE_SUCCESS(rv, nsnull);
|
NS_ENSURE_SUCCESS(rv, nsnull);
|
||||||
}
|
}
|
||||||
|
@ -5324,7 +5324,7 @@ nsWindowSH::GlobalResolve(nsGlobalWindow *aWin, JSContext *cx,
|
||||||
|
|
||||||
nsDOMClassInfoID ci_id = (nsDOMClassInfoID)id;
|
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);
|
NS_ENSURE_TRUE(ci, NS_ERROR_UNEXPECTED);
|
||||||
|
|
||||||
nsCOMPtr<nsIXPConnectJSObjectHolder> proto_holder;
|
nsCOMPtr<nsIXPConnectJSObjectHolder> proto_holder;
|
||||||
|
|
|
@ -119,7 +119,6 @@ public:
|
||||||
// GetClassInfoA so I can't, those $%#@^! bastards!!! What gives
|
// GetClassInfoA so I can't, those $%#@^! bastards!!! What gives
|
||||||
// them the right to do that?
|
// them the right to do that?
|
||||||
|
|
||||||
static nsIClassInfo* GetClassInfoInstance(nsDOMClassInfoID aID);
|
|
||||||
static nsIClassInfo* GetClassInfoInstance(nsDOMClassInfoData* aData);
|
static nsIClassInfo* GetClassInfoInstance(nsDOMClassInfoData* aData);
|
||||||
|
|
||||||
static void ShutDown();
|
static void ShutDown();
|
||||||
|
@ -176,6 +175,8 @@ public:
|
||||||
static nsresult PreserveNodeWrapper(nsIXPConnectWrappedNative *aWrapper);
|
static nsresult PreserveNodeWrapper(nsIXPConnectWrappedNative *aWrapper);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
friend nsIClassInfo* NS_GetDOMClassInfoInstance(nsDOMClassInfoID aID);
|
||||||
|
|
||||||
const nsDOMClassInfoData* mData;
|
const nsDOMClassInfoData* mData;
|
||||||
|
|
||||||
static nsresult Init();
|
static nsresult Init();
|
||||||
|
@ -1581,18 +1582,4 @@ public:
|
||||||
void InvalidateContextAndWrapperCache();
|
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___ */
|
#endif /* nsDOMClassInfo_h___ */
|
||||||
|
|
|
@ -220,7 +220,7 @@ nsDOMScriptObjectFactory::NewScriptGlobalObject(PRBool aIsChrome,
|
||||||
NS_IMETHODIMP_(nsISupports *)
|
NS_IMETHODIMP_(nsISupports *)
|
||||||
nsDOMScriptObjectFactory::GetClassInfoInstance(nsDOMClassInfoID aID)
|
nsDOMScriptObjectFactory::GetClassInfoInstance(nsDOMClassInfoID aID)
|
||||||
{
|
{
|
||||||
return nsDOMClassInfo::GetClassInfoInstance(aID);
|
return NS_GetDOMClassInfoInstance(aID);
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP_(nsISupports *)
|
NS_IMETHODIMP_(nsISupports *)
|
||||||
|
|
Загрузка…
Ссылка в новой задаче