зеркало из https://github.com/mozilla/pjs.git
safety checks to prevent dereferencing null
This commit is contained in:
Родитель
e744366a53
Коммит
b1ffc95e12
|
@ -533,7 +533,10 @@ nsIStyleContext* StyleSetImpl::ResolveStyleFor(nsIPresContext* aPresContext,
|
|||
|
||||
if (nsnull != rules) {
|
||||
nsIAtom* medium = nsnull;
|
||||
aPresContext->GetMedium(&medium);
|
||||
NS_ASSERTION(aPresContext, "must have aPresContext");
|
||||
if (aPresContext) {
|
||||
aPresContext->GetMedium(&medium);
|
||||
}
|
||||
RulesMatchingData data(aPresContext, medium, aContent, aParentContext, rules);
|
||||
if (mBackstopSheets) {
|
||||
mBackstopSheets->EnumerateBackwards(EnumRulesMatching, &data);
|
||||
|
|
|
@ -1644,7 +1644,10 @@ PRInt32 CSSStyleSheetImpl::RulesMatching(nsIPresContext* aPresContext,
|
|||
|
||||
PRInt32 matchCount = 0;
|
||||
|
||||
if (!aPresContext || !aContent || !aResults) return matchCount;
|
||||
|
||||
nsIAtom* presMedium = nsnull;
|
||||
|
||||
aPresContext->GetMedium(&presMedium);
|
||||
|
||||
RuleCascadeData* cascade = GetRuleCascade(presMedium);
|
||||
|
|
|
@ -425,6 +425,8 @@ PRInt32 HTMLCSSStyleSheetImpl::RulesMatching(nsIPresContext* aPresContext,
|
|||
|
||||
PRInt32 matchCount = 0;
|
||||
|
||||
if (!aPresContext || !aContent || !aResults) return matchCount;
|
||||
|
||||
nsIStyledContent* styledContent;
|
||||
|
||||
// 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;
|
||||
|
||||
if (!aPresContext || !aContent || !aResults) return matchCount;
|
||||
|
||||
nsIStyledContent* styledContent;
|
||||
if (NS_SUCCEEDED(aContent->QueryInterface(nsIStyledContent::GetIID(), (void**)&styledContent))) {
|
||||
PRInt32 nameSpace;
|
||||
|
|
|
@ -533,7 +533,10 @@ nsIStyleContext* StyleSetImpl::ResolveStyleFor(nsIPresContext* aPresContext,
|
|||
|
||||
if (nsnull != rules) {
|
||||
nsIAtom* medium = nsnull;
|
||||
aPresContext->GetMedium(&medium);
|
||||
NS_ASSERTION(aPresContext, "must have aPresContext");
|
||||
if (aPresContext) {
|
||||
aPresContext->GetMedium(&medium);
|
||||
}
|
||||
RulesMatchingData data(aPresContext, medium, aContent, aParentContext, rules);
|
||||
if (mBackstopSheets) {
|
||||
mBackstopSheets->EnumerateBackwards(EnumRulesMatching, &data);
|
||||
|
|
|
@ -1644,7 +1644,10 @@ PRInt32 CSSStyleSheetImpl::RulesMatching(nsIPresContext* aPresContext,
|
|||
|
||||
PRInt32 matchCount = 0;
|
||||
|
||||
if (!aPresContext || !aContent || !aResults) return matchCount;
|
||||
|
||||
nsIAtom* presMedium = nsnull;
|
||||
|
||||
aPresContext->GetMedium(&presMedium);
|
||||
|
||||
RuleCascadeData* cascade = GetRuleCascade(presMedium);
|
||||
|
|
|
@ -425,6 +425,8 @@ PRInt32 HTMLCSSStyleSheetImpl::RulesMatching(nsIPresContext* aPresContext,
|
|||
|
||||
PRInt32 matchCount = 0;
|
||||
|
||||
if (!aPresContext || !aContent || !aResults) return matchCount;
|
||||
|
||||
nsIStyledContent* styledContent;
|
||||
|
||||
// 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;
|
||||
|
||||
if (!aPresContext || !aContent || !aResults) return matchCount;
|
||||
|
||||
nsIStyledContent* styledContent;
|
||||
if (NS_SUCCEEDED(aContent->QueryInterface(nsIStyledContent::GetIID(), (void**)&styledContent))) {
|
||||
PRInt32 nameSpace;
|
||||
|
|
|
@ -1644,7 +1644,10 @@ PRInt32 CSSStyleSheetImpl::RulesMatching(nsIPresContext* aPresContext,
|
|||
|
||||
PRInt32 matchCount = 0;
|
||||
|
||||
if (!aPresContext || !aContent || !aResults) return matchCount;
|
||||
|
||||
nsIAtom* presMedium = nsnull;
|
||||
|
||||
aPresContext->GetMedium(&presMedium);
|
||||
|
||||
RuleCascadeData* cascade = GetRuleCascade(presMedium);
|
||||
|
|
|
@ -425,6 +425,8 @@ PRInt32 HTMLCSSStyleSheetImpl::RulesMatching(nsIPresContext* aPresContext,
|
|||
|
||||
PRInt32 matchCount = 0;
|
||||
|
||||
if (!aPresContext || !aContent || !aResults) return matchCount;
|
||||
|
||||
nsIStyledContent* styledContent;
|
||||
|
||||
// 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;
|
||||
|
||||
if (!aPresContext || !aContent || !aResults) return matchCount;
|
||||
|
||||
nsIStyledContent* styledContent;
|
||||
if (NS_SUCCEEDED(aContent->QueryInterface(nsIStyledContent::GetIID(), (void**)&styledContent))) {
|
||||
PRInt32 nameSpace;
|
||||
|
|
|
@ -533,7 +533,10 @@ nsIStyleContext* StyleSetImpl::ResolveStyleFor(nsIPresContext* aPresContext,
|
|||
|
||||
if (nsnull != rules) {
|
||||
nsIAtom* medium = nsnull;
|
||||
aPresContext->GetMedium(&medium);
|
||||
NS_ASSERTION(aPresContext, "must have aPresContext");
|
||||
if (aPresContext) {
|
||||
aPresContext->GetMedium(&medium);
|
||||
}
|
||||
RulesMatchingData data(aPresContext, medium, aContent, aParentContext, rules);
|
||||
if (mBackstopSheets) {
|
||||
mBackstopSheets->EnumerateBackwards(EnumRulesMatching, &data);
|
||||
|
|
Загрузка…
Ссылка в новой задаче