safety checks to prevent dereferencing null
This commit is contained in:
@@ -533,7 +533,10 @@ nsIStyleContext* StyleSetImpl::ResolveStyleFor(nsIPresContext* aPresContext,
|
|||||||
|
|
||||||
if (nsnull != rules) {
|
if (nsnull != rules) {
|
||||||
nsIAtom* medium = nsnull;
|
nsIAtom* medium = nsnull;
|
||||||
|
NS_ASSERTION(aPresContext, "must have aPresContext");
|
||||||
|
if (aPresContext) {
|
||||||
aPresContext->GetMedium(&medium);
|
aPresContext->GetMedium(&medium);
|
||||||
|
}
|
||||||
RulesMatchingData data(aPresContext, medium, aContent, aParentContext, rules);
|
RulesMatchingData data(aPresContext, medium, aContent, aParentContext, rules);
|
||||||
if (mBackstopSheets) {
|
if (mBackstopSheets) {
|
||||||
mBackstopSheets->EnumerateBackwards(EnumRulesMatching, &data);
|
mBackstopSheets->EnumerateBackwards(EnumRulesMatching, &data);
|
||||||
|
|||||||
@@ -1644,7 +1644,10 @@ PRInt32 CSSStyleSheetImpl::RulesMatching(nsIPresContext* aPresContext,
|
|||||||
|
|
||||||
PRInt32 matchCount = 0;
|
PRInt32 matchCount = 0;
|
||||||
|
|
||||||
|
if (!aPresContext || !aContent || !aResults) return matchCount;
|
||||||
|
|
||||||
nsIAtom* presMedium = nsnull;
|
nsIAtom* presMedium = nsnull;
|
||||||
|
|
||||||
aPresContext->GetMedium(&presMedium);
|
aPresContext->GetMedium(&presMedium);
|
||||||
|
|
||||||
RuleCascadeData* cascade = GetRuleCascade(presMedium);
|
RuleCascadeData* cascade = GetRuleCascade(presMedium);
|
||||||
|
|||||||
@@ -425,6 +425,8 @@ PRInt32 HTMLCSSStyleSheetImpl::RulesMatching(nsIPresContext* aPresContext,
|
|||||||
|
|
||||||
PRInt32 matchCount = 0;
|
PRInt32 matchCount = 0;
|
||||||
|
|
||||||
|
if (!aPresContext || !aContent || !aResults) return matchCount;
|
||||||
|
|
||||||
nsIStyledContent* styledContent;
|
nsIStyledContent* styledContent;
|
||||||
|
|
||||||
// just get the one and only style rule from the content's STYLE attribute
|
// just get the one and only style rule from the content's STYLE attribute
|
||||||
|
|||||||
@@ -553,6 +553,8 @@ PRInt32 HTMLStyleSheetImpl::RulesMatching(nsIPresContext* aPresContext,
|
|||||||
|
|
||||||
PRInt32 matchCount = 0;
|
PRInt32 matchCount = 0;
|
||||||
|
|
||||||
|
if (!aPresContext || !aContent || !aResults) return matchCount;
|
||||||
|
|
||||||
nsIStyledContent* styledContent;
|
nsIStyledContent* styledContent;
|
||||||
if (NS_SUCCEEDED(aContent->QueryInterface(nsIStyledContent::GetIID(), (void**)&styledContent))) {
|
if (NS_SUCCEEDED(aContent->QueryInterface(nsIStyledContent::GetIID(), (void**)&styledContent))) {
|
||||||
PRInt32 nameSpace;
|
PRInt32 nameSpace;
|
||||||
|
|||||||
@@ -533,7 +533,10 @@ nsIStyleContext* StyleSetImpl::ResolveStyleFor(nsIPresContext* aPresContext,
|
|||||||
|
|
||||||
if (nsnull != rules) {
|
if (nsnull != rules) {
|
||||||
nsIAtom* medium = nsnull;
|
nsIAtom* medium = nsnull;
|
||||||
|
NS_ASSERTION(aPresContext, "must have aPresContext");
|
||||||
|
if (aPresContext) {
|
||||||
aPresContext->GetMedium(&medium);
|
aPresContext->GetMedium(&medium);
|
||||||
|
}
|
||||||
RulesMatchingData data(aPresContext, medium, aContent, aParentContext, rules);
|
RulesMatchingData data(aPresContext, medium, aContent, aParentContext, rules);
|
||||||
if (mBackstopSheets) {
|
if (mBackstopSheets) {
|
||||||
mBackstopSheets->EnumerateBackwards(EnumRulesMatching, &data);
|
mBackstopSheets->EnumerateBackwards(EnumRulesMatching, &data);
|
||||||
|
|||||||
@@ -1644,7 +1644,10 @@ PRInt32 CSSStyleSheetImpl::RulesMatching(nsIPresContext* aPresContext,
|
|||||||
|
|
||||||
PRInt32 matchCount = 0;
|
PRInt32 matchCount = 0;
|
||||||
|
|
||||||
|
if (!aPresContext || !aContent || !aResults) return matchCount;
|
||||||
|
|
||||||
nsIAtom* presMedium = nsnull;
|
nsIAtom* presMedium = nsnull;
|
||||||
|
|
||||||
aPresContext->GetMedium(&presMedium);
|
aPresContext->GetMedium(&presMedium);
|
||||||
|
|
||||||
RuleCascadeData* cascade = GetRuleCascade(presMedium);
|
RuleCascadeData* cascade = GetRuleCascade(presMedium);
|
||||||
|
|||||||
@@ -425,6 +425,8 @@ PRInt32 HTMLCSSStyleSheetImpl::RulesMatching(nsIPresContext* aPresContext,
|
|||||||
|
|
||||||
PRInt32 matchCount = 0;
|
PRInt32 matchCount = 0;
|
||||||
|
|
||||||
|
if (!aPresContext || !aContent || !aResults) return matchCount;
|
||||||
|
|
||||||
nsIStyledContent* styledContent;
|
nsIStyledContent* styledContent;
|
||||||
|
|
||||||
// just get the one and only style rule from the content's STYLE attribute
|
// just get the one and only style rule from the content's STYLE attribute
|
||||||
|
|||||||
@@ -553,6 +553,8 @@ PRInt32 HTMLStyleSheetImpl::RulesMatching(nsIPresContext* aPresContext,
|
|||||||
|
|
||||||
PRInt32 matchCount = 0;
|
PRInt32 matchCount = 0;
|
||||||
|
|
||||||
|
if (!aPresContext || !aContent || !aResults) return matchCount;
|
||||||
|
|
||||||
nsIStyledContent* styledContent;
|
nsIStyledContent* styledContent;
|
||||||
if (NS_SUCCEEDED(aContent->QueryInterface(nsIStyledContent::GetIID(), (void**)&styledContent))) {
|
if (NS_SUCCEEDED(aContent->QueryInterface(nsIStyledContent::GetIID(), (void**)&styledContent))) {
|
||||||
PRInt32 nameSpace;
|
PRInt32 nameSpace;
|
||||||
|
|||||||
@@ -1644,7 +1644,10 @@ PRInt32 CSSStyleSheetImpl::RulesMatching(nsIPresContext* aPresContext,
|
|||||||
|
|
||||||
PRInt32 matchCount = 0;
|
PRInt32 matchCount = 0;
|
||||||
|
|
||||||
|
if (!aPresContext || !aContent || !aResults) return matchCount;
|
||||||
|
|
||||||
nsIAtom* presMedium = nsnull;
|
nsIAtom* presMedium = nsnull;
|
||||||
|
|
||||||
aPresContext->GetMedium(&presMedium);
|
aPresContext->GetMedium(&presMedium);
|
||||||
|
|
||||||
RuleCascadeData* cascade = GetRuleCascade(presMedium);
|
RuleCascadeData* cascade = GetRuleCascade(presMedium);
|
||||||
|
|||||||
@@ -425,6 +425,8 @@ PRInt32 HTMLCSSStyleSheetImpl::RulesMatching(nsIPresContext* aPresContext,
|
|||||||
|
|
||||||
PRInt32 matchCount = 0;
|
PRInt32 matchCount = 0;
|
||||||
|
|
||||||
|
if (!aPresContext || !aContent || !aResults) return matchCount;
|
||||||
|
|
||||||
nsIStyledContent* styledContent;
|
nsIStyledContent* styledContent;
|
||||||
|
|
||||||
// just get the one and only style rule from the content's STYLE attribute
|
// just get the one and only style rule from the content's STYLE attribute
|
||||||
|
|||||||
@@ -553,6 +553,8 @@ PRInt32 HTMLStyleSheetImpl::RulesMatching(nsIPresContext* aPresContext,
|
|||||||
|
|
||||||
PRInt32 matchCount = 0;
|
PRInt32 matchCount = 0;
|
||||||
|
|
||||||
|
if (!aPresContext || !aContent || !aResults) return matchCount;
|
||||||
|
|
||||||
nsIStyledContent* styledContent;
|
nsIStyledContent* styledContent;
|
||||||
if (NS_SUCCEEDED(aContent->QueryInterface(nsIStyledContent::GetIID(), (void**)&styledContent))) {
|
if (NS_SUCCEEDED(aContent->QueryInterface(nsIStyledContent::GetIID(), (void**)&styledContent))) {
|
||||||
PRInt32 nameSpace;
|
PRInt32 nameSpace;
|
||||||
|
|||||||
@@ -533,7 +533,10 @@ nsIStyleContext* StyleSetImpl::ResolveStyleFor(nsIPresContext* aPresContext,
|
|||||||
|
|
||||||
if (nsnull != rules) {
|
if (nsnull != rules) {
|
||||||
nsIAtom* medium = nsnull;
|
nsIAtom* medium = nsnull;
|
||||||
|
NS_ASSERTION(aPresContext, "must have aPresContext");
|
||||||
|
if (aPresContext) {
|
||||||
aPresContext->GetMedium(&medium);
|
aPresContext->GetMedium(&medium);
|
||||||
|
}
|
||||||
RulesMatchingData data(aPresContext, medium, aContent, aParentContext, rules);
|
RulesMatchingData data(aPresContext, medium, aContent, aParentContext, rules);
|
||||||
if (mBackstopSheets) {
|
if (mBackstopSheets) {
|
||||||
mBackstopSheets->EnumerateBackwards(EnumRulesMatching, &data);
|
mBackstopSheets->EnumerateBackwards(EnumRulesMatching, &data);
|
||||||
|
|||||||
Reference in New Issue
Block a user