mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-06 00:10:25 +00:00
Fix crash bug 93270 by ensuring that the nsHTMLStyleSheetImpl always has a non-null mDocumentColorRule and mTableTHRule. r=pierre sr=hyatt
This commit is contained in:
parent
a578cecc6a
commit
7ae28c26a1
@ -101,6 +101,11 @@ public:
|
|||||||
|
|
||||||
virtual void SizeOf(nsISizeOfHandler *aSizeofHandler, PRUint32 &aSize);
|
virtual void SizeOf(nsISizeOfHandler *aSizeofHandler, PRUint32 &aSize);
|
||||||
|
|
||||||
|
void Reset() {
|
||||||
|
mForegroundSet = PR_FALSE;
|
||||||
|
mBackgroundSet = PR_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
nscolor mBackgroundColor;
|
nscolor mBackgroundColor;
|
||||||
PRBool mForegroundSet;
|
PRBool mForegroundSet;
|
||||||
PRBool mBackgroundSet;
|
PRBool mBackgroundSet;
|
||||||
@ -205,10 +210,9 @@ void HTMLColorRule::SizeOf(nsISizeOfHandler *aSizeOfHandler, PRUint32 &aSize)
|
|||||||
HTMLDocumentColorRule::HTMLDocumentColorRule(nsIHTMLStyleSheet* aSheet)
|
HTMLDocumentColorRule::HTMLDocumentColorRule(nsIHTMLStyleSheet* aSheet)
|
||||||
: HTMLColorRule(aSheet)
|
: HTMLColorRule(aSheet)
|
||||||
{
|
{
|
||||||
mForegroundSet = PR_FALSE;
|
Reset();
|
||||||
mBackgroundSet = PR_FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
HTMLDocumentColorRule::~HTMLDocumentColorRule()
|
HTMLDocumentColorRule::~HTMLDocumentColorRule()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -286,6 +290,10 @@ public:
|
|||||||
|
|
||||||
virtual void SizeOf(nsISizeOfHandler *aSizeofHandler, PRUint32 &aSize);
|
virtual void SizeOf(nsISizeOfHandler *aSizeofHandler, PRUint32 &aSize);
|
||||||
|
|
||||||
|
void Reset()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
nsIHTMLStyleSheet* mSheet; // not ref-counted, cleared by content
|
nsIHTMLStyleSheet* mSheet; // not ref-counted, cleared by content
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -390,6 +398,11 @@ public:
|
|||||||
TableTHRule(nsIHTMLStyleSheet* aSheet);
|
TableTHRule(nsIHTMLStyleSheet* aSheet);
|
||||||
virtual ~TableTHRule();
|
virtual ~TableTHRule();
|
||||||
|
|
||||||
|
void Reset()
|
||||||
|
{
|
||||||
|
GenericTableRule::Reset();
|
||||||
|
}
|
||||||
|
|
||||||
NS_IMETHOD MapRuleInfoInto(nsRuleData* aRuleData);
|
NS_IMETHOD MapRuleInfoInto(nsRuleData* aRuleData);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -511,6 +524,7 @@ public:
|
|||||||
void operator delete(void* ptr);
|
void operator delete(void* ptr);
|
||||||
|
|
||||||
HTMLStyleSheetImpl(void);
|
HTMLStyleSheetImpl(void);
|
||||||
|
nsresult Init();
|
||||||
|
|
||||||
NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr);
|
NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr);
|
||||||
NS_IMETHOD_(nsrefcnt) AddRef();
|
NS_IMETHOD_(nsrefcnt) AddRef();
|
||||||
@ -668,10 +682,22 @@ HTMLStyleSheetImpl::HTMLStyleSheetImpl(void)
|
|||||||
mDocumentColorRule(nsnull)
|
mDocumentColorRule(nsnull)
|
||||||
{
|
{
|
||||||
NS_INIT_REFCNT();
|
NS_INIT_REFCNT();
|
||||||
|
}
|
||||||
|
|
||||||
|
nsresult
|
||||||
|
HTMLStyleSheetImpl::Init()
|
||||||
|
{
|
||||||
mTableTHRule = new TableTHRule(this);
|
mTableTHRule = new TableTHRule(this);
|
||||||
mDocumentColorRule = new HTMLDocumentColorRule(this);
|
if (!mTableTHRule)
|
||||||
NS_ADDREF(mDocumentColorRule);
|
return NS_ERROR_OUT_OF_MEMORY;
|
||||||
NS_ADDREF(mTableTHRule);
|
NS_ADDREF(mTableTHRule);
|
||||||
|
|
||||||
|
mDocumentColorRule = new HTMLDocumentColorRule(this);
|
||||||
|
if (!mDocumentColorRule)
|
||||||
|
return NS_ERROR_OUT_OF_MEMORY;
|
||||||
|
NS_ADDREF(mDocumentColorRule);
|
||||||
|
|
||||||
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
PRBool PR_CALLBACK MappedDropSheet(nsHashKey *aKey, void *aData, void* closure)
|
PRBool PR_CALLBACK MappedDropSheet(nsHashKey *aKey, void *aData, void* closure)
|
||||||
@ -820,18 +846,14 @@ HTMLStyleSheetImpl::RulesMatching(nsIPresContext* aPresContext,
|
|||||||
aRuleWalker->Forward(mTableTHRule);
|
aRuleWalker->Forward(mTableTHRule);
|
||||||
}
|
}
|
||||||
else if (tag == nsHTMLAtoms::table) {
|
else if (tag == nsHTMLAtoms::table) {
|
||||||
if (mDocumentColorRule) {
|
nsCompatibility mode;
|
||||||
nsCompatibility mode;
|
aPresContext->GetCompatibilityMode(&mode);
|
||||||
aPresContext->GetCompatibilityMode(&mode);
|
if (eCompatibility_NavQuirks == mode) {
|
||||||
if (eCompatibility_NavQuirks == mode) {
|
aRuleWalker->Forward(mDocumentColorRule);
|
||||||
aRuleWalker->Forward(mDocumentColorRule);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (tag == nsHTMLAtoms::html) {
|
else if (tag == nsHTMLAtoms::html) {
|
||||||
if (mDocumentColorRule) {
|
aRuleWalker->Forward(mDocumentColorRule);
|
||||||
aRuleWalker->Forward(mDocumentColorRule);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
NS_IF_RELEASE(tag);
|
NS_IF_RELEASE(tag);
|
||||||
} // end html namespace
|
} // end html namespace
|
||||||
@ -1005,14 +1027,8 @@ NS_IMETHODIMP HTMLStyleSheetImpl::Reset(nsIURI* aURL)
|
|||||||
mActiveRule->mSheet = nsnull;
|
mActiveRule->mSheet = nsnull;
|
||||||
NS_RELEASE(mActiveRule);
|
NS_RELEASE(mActiveRule);
|
||||||
}
|
}
|
||||||
if (mDocumentColorRule) {
|
mDocumentColorRule->Reset();
|
||||||
mDocumentColorRule->mSheet = nsnull;
|
mTableTHRule->Reset();
|
||||||
NS_RELEASE(mDocumentColorRule);
|
|
||||||
}
|
|
||||||
if (mTableTHRule) {
|
|
||||||
mTableTHRule->mSheet = nsnull;
|
|
||||||
NS_RELEASE(mTableTHRule);
|
|
||||||
}
|
|
||||||
|
|
||||||
mMappedAttrTable.Enumerate(MappedDropSheet);
|
mMappedAttrTable.Enumerate(MappedDropSheet);
|
||||||
mMappedAttrTable.Reset();
|
mMappedAttrTable.Reset();
|
||||||
@ -1055,26 +1071,20 @@ NS_IMETHODIMP HTMLStyleSheetImpl::GetVisitedLinkColor(nscolor& aColor)
|
|||||||
|
|
||||||
NS_IMETHODIMP HTMLStyleSheetImpl::GetDocumentForegroundColor(nscolor& aColor)
|
NS_IMETHODIMP HTMLStyleSheetImpl::GetDocumentForegroundColor(nscolor& aColor)
|
||||||
{
|
{
|
||||||
if ((nsnull == mDocumentColorRule) ||
|
if (!mDocumentColorRule->mForegroundSet)
|
||||||
!mDocumentColorRule->mForegroundSet) {
|
|
||||||
return NS_HTML_STYLE_PROPERTY_NOT_THERE;
|
return NS_HTML_STYLE_PROPERTY_NOT_THERE;
|
||||||
}
|
|
||||||
else {
|
aColor = mDocumentColorRule->mColor;
|
||||||
aColor = mDocumentColorRule->mColor;
|
return NS_OK;
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP HTMLStyleSheetImpl::GetDocumentBackgroundColor(nscolor& aColor)
|
NS_IMETHODIMP HTMLStyleSheetImpl::GetDocumentBackgroundColor(nscolor& aColor)
|
||||||
{
|
{
|
||||||
if ((nsnull == mDocumentColorRule) ||
|
if (!mDocumentColorRule->mBackgroundSet)
|
||||||
!mDocumentColorRule->mBackgroundSet) {
|
|
||||||
return NS_HTML_STYLE_PROPERTY_NOT_THERE;
|
return NS_HTML_STYLE_PROPERTY_NOT_THERE;
|
||||||
}
|
|
||||||
else {
|
aColor = mDocumentColorRule->mBackgroundColor;
|
||||||
aColor = mDocumentColorRule->mBackgroundColor;
|
return NS_OK;
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP HTMLStyleSheetImpl::SetLinkColor(nscolor aColor)
|
NS_IMETHODIMP HTMLStyleSheetImpl::SetLinkColor(nscolor aColor)
|
||||||
@ -1349,12 +1359,12 @@ void HTMLStyleSheetImpl::SizeOf(nsISizeOfHandler *aSizeOfHandler, PRUint32 &aSiz
|
|||||||
tag = getter_AddRefs(NS_NewAtom("ActiveRule"));
|
tag = getter_AddRefs(NS_NewAtom("ActiveRule"));
|
||||||
aSizeOfHandler->AddSize(tag,localSize);
|
aSizeOfHandler->AddSize(tag,localSize);
|
||||||
}
|
}
|
||||||
if(mDocumentColorRule && uniqueItems->AddItem((void*)mDocumentColorRule)){
|
if(uniqueItems->AddItem((void*)mDocumentColorRule)){
|
||||||
localSize = sizeof(*mDocumentColorRule);
|
localSize = sizeof(*mDocumentColorRule);
|
||||||
tag = getter_AddRefs(NS_NewAtom("DocumentColorRule"));
|
tag = getter_AddRefs(NS_NewAtom("DocumentColorRule"));
|
||||||
aSizeOfHandler->AddSize(tag,localSize);
|
aSizeOfHandler->AddSize(tag,localSize);
|
||||||
}
|
}
|
||||||
if(mTableTHRule && uniqueItems->AddItem((void*)mTableTHRule)){
|
if(uniqueItems->AddItem((void*)mTableTHRule)){
|
||||||
localSize = sizeof(*mTableTHRule);
|
localSize = sizeof(*mTableTHRule);
|
||||||
tag = getter_AddRefs(NS_NewAtom("TableTHRule"));
|
tag = getter_AddRefs(NS_NewAtom("TableTHRule"));
|
||||||
aSizeOfHandler->AddSize(tag,localSize);
|
aSizeOfHandler->AddSize(tag,localSize);
|
||||||
@ -1417,17 +1427,19 @@ NS_NewHTMLStyleSheet(nsIHTMLStyleSheet** aInstancePtrResult, nsIURI* aURL,
|
|||||||
NS_HTML nsresult
|
NS_HTML nsresult
|
||||||
NS_NewHTMLStyleSheet(nsIHTMLStyleSheet** aInstancePtrResult)
|
NS_NewHTMLStyleSheet(nsIHTMLStyleSheet** aInstancePtrResult)
|
||||||
{
|
{
|
||||||
if (aInstancePtrResult == nsnull) {
|
NS_PRECONDITION(aInstancePtrResult, "null out param");
|
||||||
return NS_ERROR_NULL_POINTER;
|
|
||||||
}
|
|
||||||
|
|
||||||
HTMLStyleSheetImpl *it = new HTMLStyleSheetImpl();
|
HTMLStyleSheetImpl *it = new HTMLStyleSheetImpl();
|
||||||
|
if (!it) {
|
||||||
if (nsnull == it) {
|
*aInstancePtrResult = nsnull;
|
||||||
return NS_ERROR_OUT_OF_MEMORY;
|
return NS_ERROR_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_ADDREF(it);
|
NS_ADDREF(it);
|
||||||
*aInstancePtrResult = it;
|
nsresult rv = it->Init();
|
||||||
return NS_OK;
|
if (NS_FAILED(rv))
|
||||||
|
NS_RELEASE(it);
|
||||||
|
|
||||||
|
*aInstancePtrResult = it; // NS_ADDREF above, or set to null by NS_RELEASE
|
||||||
|
return rv;
|
||||||
}
|
}
|
||||||
|
@ -101,6 +101,11 @@ public:
|
|||||||
|
|
||||||
virtual void SizeOf(nsISizeOfHandler *aSizeofHandler, PRUint32 &aSize);
|
virtual void SizeOf(nsISizeOfHandler *aSizeofHandler, PRUint32 &aSize);
|
||||||
|
|
||||||
|
void Reset() {
|
||||||
|
mForegroundSet = PR_FALSE;
|
||||||
|
mBackgroundSet = PR_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
nscolor mBackgroundColor;
|
nscolor mBackgroundColor;
|
||||||
PRBool mForegroundSet;
|
PRBool mForegroundSet;
|
||||||
PRBool mBackgroundSet;
|
PRBool mBackgroundSet;
|
||||||
@ -205,10 +210,9 @@ void HTMLColorRule::SizeOf(nsISizeOfHandler *aSizeOfHandler, PRUint32 &aSize)
|
|||||||
HTMLDocumentColorRule::HTMLDocumentColorRule(nsIHTMLStyleSheet* aSheet)
|
HTMLDocumentColorRule::HTMLDocumentColorRule(nsIHTMLStyleSheet* aSheet)
|
||||||
: HTMLColorRule(aSheet)
|
: HTMLColorRule(aSheet)
|
||||||
{
|
{
|
||||||
mForegroundSet = PR_FALSE;
|
Reset();
|
||||||
mBackgroundSet = PR_FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
HTMLDocumentColorRule::~HTMLDocumentColorRule()
|
HTMLDocumentColorRule::~HTMLDocumentColorRule()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -286,6 +290,10 @@ public:
|
|||||||
|
|
||||||
virtual void SizeOf(nsISizeOfHandler *aSizeofHandler, PRUint32 &aSize);
|
virtual void SizeOf(nsISizeOfHandler *aSizeofHandler, PRUint32 &aSize);
|
||||||
|
|
||||||
|
void Reset()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
nsIHTMLStyleSheet* mSheet; // not ref-counted, cleared by content
|
nsIHTMLStyleSheet* mSheet; // not ref-counted, cleared by content
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -390,6 +398,11 @@ public:
|
|||||||
TableTHRule(nsIHTMLStyleSheet* aSheet);
|
TableTHRule(nsIHTMLStyleSheet* aSheet);
|
||||||
virtual ~TableTHRule();
|
virtual ~TableTHRule();
|
||||||
|
|
||||||
|
void Reset()
|
||||||
|
{
|
||||||
|
GenericTableRule::Reset();
|
||||||
|
}
|
||||||
|
|
||||||
NS_IMETHOD MapRuleInfoInto(nsRuleData* aRuleData);
|
NS_IMETHOD MapRuleInfoInto(nsRuleData* aRuleData);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -511,6 +524,7 @@ public:
|
|||||||
void operator delete(void* ptr);
|
void operator delete(void* ptr);
|
||||||
|
|
||||||
HTMLStyleSheetImpl(void);
|
HTMLStyleSheetImpl(void);
|
||||||
|
nsresult Init();
|
||||||
|
|
||||||
NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr);
|
NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr);
|
||||||
NS_IMETHOD_(nsrefcnt) AddRef();
|
NS_IMETHOD_(nsrefcnt) AddRef();
|
||||||
@ -668,10 +682,22 @@ HTMLStyleSheetImpl::HTMLStyleSheetImpl(void)
|
|||||||
mDocumentColorRule(nsnull)
|
mDocumentColorRule(nsnull)
|
||||||
{
|
{
|
||||||
NS_INIT_REFCNT();
|
NS_INIT_REFCNT();
|
||||||
|
}
|
||||||
|
|
||||||
|
nsresult
|
||||||
|
HTMLStyleSheetImpl::Init()
|
||||||
|
{
|
||||||
mTableTHRule = new TableTHRule(this);
|
mTableTHRule = new TableTHRule(this);
|
||||||
mDocumentColorRule = new HTMLDocumentColorRule(this);
|
if (!mTableTHRule)
|
||||||
NS_ADDREF(mDocumentColorRule);
|
return NS_ERROR_OUT_OF_MEMORY;
|
||||||
NS_ADDREF(mTableTHRule);
|
NS_ADDREF(mTableTHRule);
|
||||||
|
|
||||||
|
mDocumentColorRule = new HTMLDocumentColorRule(this);
|
||||||
|
if (!mDocumentColorRule)
|
||||||
|
return NS_ERROR_OUT_OF_MEMORY;
|
||||||
|
NS_ADDREF(mDocumentColorRule);
|
||||||
|
|
||||||
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
PRBool PR_CALLBACK MappedDropSheet(nsHashKey *aKey, void *aData, void* closure)
|
PRBool PR_CALLBACK MappedDropSheet(nsHashKey *aKey, void *aData, void* closure)
|
||||||
@ -820,18 +846,14 @@ HTMLStyleSheetImpl::RulesMatching(nsIPresContext* aPresContext,
|
|||||||
aRuleWalker->Forward(mTableTHRule);
|
aRuleWalker->Forward(mTableTHRule);
|
||||||
}
|
}
|
||||||
else if (tag == nsHTMLAtoms::table) {
|
else if (tag == nsHTMLAtoms::table) {
|
||||||
if (mDocumentColorRule) {
|
nsCompatibility mode;
|
||||||
nsCompatibility mode;
|
aPresContext->GetCompatibilityMode(&mode);
|
||||||
aPresContext->GetCompatibilityMode(&mode);
|
if (eCompatibility_NavQuirks == mode) {
|
||||||
if (eCompatibility_NavQuirks == mode) {
|
aRuleWalker->Forward(mDocumentColorRule);
|
||||||
aRuleWalker->Forward(mDocumentColorRule);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (tag == nsHTMLAtoms::html) {
|
else if (tag == nsHTMLAtoms::html) {
|
||||||
if (mDocumentColorRule) {
|
aRuleWalker->Forward(mDocumentColorRule);
|
||||||
aRuleWalker->Forward(mDocumentColorRule);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
NS_IF_RELEASE(tag);
|
NS_IF_RELEASE(tag);
|
||||||
} // end html namespace
|
} // end html namespace
|
||||||
@ -1005,14 +1027,8 @@ NS_IMETHODIMP HTMLStyleSheetImpl::Reset(nsIURI* aURL)
|
|||||||
mActiveRule->mSheet = nsnull;
|
mActiveRule->mSheet = nsnull;
|
||||||
NS_RELEASE(mActiveRule);
|
NS_RELEASE(mActiveRule);
|
||||||
}
|
}
|
||||||
if (mDocumentColorRule) {
|
mDocumentColorRule->Reset();
|
||||||
mDocumentColorRule->mSheet = nsnull;
|
mTableTHRule->Reset();
|
||||||
NS_RELEASE(mDocumentColorRule);
|
|
||||||
}
|
|
||||||
if (mTableTHRule) {
|
|
||||||
mTableTHRule->mSheet = nsnull;
|
|
||||||
NS_RELEASE(mTableTHRule);
|
|
||||||
}
|
|
||||||
|
|
||||||
mMappedAttrTable.Enumerate(MappedDropSheet);
|
mMappedAttrTable.Enumerate(MappedDropSheet);
|
||||||
mMappedAttrTable.Reset();
|
mMappedAttrTable.Reset();
|
||||||
@ -1055,26 +1071,20 @@ NS_IMETHODIMP HTMLStyleSheetImpl::GetVisitedLinkColor(nscolor& aColor)
|
|||||||
|
|
||||||
NS_IMETHODIMP HTMLStyleSheetImpl::GetDocumentForegroundColor(nscolor& aColor)
|
NS_IMETHODIMP HTMLStyleSheetImpl::GetDocumentForegroundColor(nscolor& aColor)
|
||||||
{
|
{
|
||||||
if ((nsnull == mDocumentColorRule) ||
|
if (!mDocumentColorRule->mForegroundSet)
|
||||||
!mDocumentColorRule->mForegroundSet) {
|
|
||||||
return NS_HTML_STYLE_PROPERTY_NOT_THERE;
|
return NS_HTML_STYLE_PROPERTY_NOT_THERE;
|
||||||
}
|
|
||||||
else {
|
aColor = mDocumentColorRule->mColor;
|
||||||
aColor = mDocumentColorRule->mColor;
|
return NS_OK;
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP HTMLStyleSheetImpl::GetDocumentBackgroundColor(nscolor& aColor)
|
NS_IMETHODIMP HTMLStyleSheetImpl::GetDocumentBackgroundColor(nscolor& aColor)
|
||||||
{
|
{
|
||||||
if ((nsnull == mDocumentColorRule) ||
|
if (!mDocumentColorRule->mBackgroundSet)
|
||||||
!mDocumentColorRule->mBackgroundSet) {
|
|
||||||
return NS_HTML_STYLE_PROPERTY_NOT_THERE;
|
return NS_HTML_STYLE_PROPERTY_NOT_THERE;
|
||||||
}
|
|
||||||
else {
|
aColor = mDocumentColorRule->mBackgroundColor;
|
||||||
aColor = mDocumentColorRule->mBackgroundColor;
|
return NS_OK;
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP HTMLStyleSheetImpl::SetLinkColor(nscolor aColor)
|
NS_IMETHODIMP HTMLStyleSheetImpl::SetLinkColor(nscolor aColor)
|
||||||
@ -1349,12 +1359,12 @@ void HTMLStyleSheetImpl::SizeOf(nsISizeOfHandler *aSizeOfHandler, PRUint32 &aSiz
|
|||||||
tag = getter_AddRefs(NS_NewAtom("ActiveRule"));
|
tag = getter_AddRefs(NS_NewAtom("ActiveRule"));
|
||||||
aSizeOfHandler->AddSize(tag,localSize);
|
aSizeOfHandler->AddSize(tag,localSize);
|
||||||
}
|
}
|
||||||
if(mDocumentColorRule && uniqueItems->AddItem((void*)mDocumentColorRule)){
|
if(uniqueItems->AddItem((void*)mDocumentColorRule)){
|
||||||
localSize = sizeof(*mDocumentColorRule);
|
localSize = sizeof(*mDocumentColorRule);
|
||||||
tag = getter_AddRefs(NS_NewAtom("DocumentColorRule"));
|
tag = getter_AddRefs(NS_NewAtom("DocumentColorRule"));
|
||||||
aSizeOfHandler->AddSize(tag,localSize);
|
aSizeOfHandler->AddSize(tag,localSize);
|
||||||
}
|
}
|
||||||
if(mTableTHRule && uniqueItems->AddItem((void*)mTableTHRule)){
|
if(uniqueItems->AddItem((void*)mTableTHRule)){
|
||||||
localSize = sizeof(*mTableTHRule);
|
localSize = sizeof(*mTableTHRule);
|
||||||
tag = getter_AddRefs(NS_NewAtom("TableTHRule"));
|
tag = getter_AddRefs(NS_NewAtom("TableTHRule"));
|
||||||
aSizeOfHandler->AddSize(tag,localSize);
|
aSizeOfHandler->AddSize(tag,localSize);
|
||||||
@ -1417,17 +1427,19 @@ NS_NewHTMLStyleSheet(nsIHTMLStyleSheet** aInstancePtrResult, nsIURI* aURL,
|
|||||||
NS_HTML nsresult
|
NS_HTML nsresult
|
||||||
NS_NewHTMLStyleSheet(nsIHTMLStyleSheet** aInstancePtrResult)
|
NS_NewHTMLStyleSheet(nsIHTMLStyleSheet** aInstancePtrResult)
|
||||||
{
|
{
|
||||||
if (aInstancePtrResult == nsnull) {
|
NS_PRECONDITION(aInstancePtrResult, "null out param");
|
||||||
return NS_ERROR_NULL_POINTER;
|
|
||||||
}
|
|
||||||
|
|
||||||
HTMLStyleSheetImpl *it = new HTMLStyleSheetImpl();
|
HTMLStyleSheetImpl *it = new HTMLStyleSheetImpl();
|
||||||
|
if (!it) {
|
||||||
if (nsnull == it) {
|
*aInstancePtrResult = nsnull;
|
||||||
return NS_ERROR_OUT_OF_MEMORY;
|
return NS_ERROR_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_ADDREF(it);
|
NS_ADDREF(it);
|
||||||
*aInstancePtrResult = it;
|
nsresult rv = it->Init();
|
||||||
return NS_OK;
|
if (NS_FAILED(rv))
|
||||||
|
NS_RELEASE(it);
|
||||||
|
|
||||||
|
*aInstancePtrResult = it; // NS_ADDREF above, or set to null by NS_RELEASE
|
||||||
|
return rv;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user