Fix crash when looking at style rules of element matching no rules. b=141022 r=hewitt sr=waterson

git-svn-id: svn://10.0.0.236/trunk@197456 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
dbaron%fas.harvard.edu 2006-05-17 02:33:58 +00:00
parent c61ba654b0
commit 251b457cd9

View File

@ -99,14 +99,11 @@ inDOMUtils::GetStyleRules(nsIDOMElement *aElement, nsISupportsArray **_retval)
styleContext->GetRuleNode(&ruleNode);
nsCOMPtr<nsIStyleRule> srule;
PRBool isRoot;
do {
for (PRBool isRoot; mCSSUtils->IsRuleNodeRoot(ruleNode, &isRoot), !isRoot;
mCSSUtils->GetRuleNodeParent(ruleNode, &ruleNode)) {
mCSSUtils->GetRuleNodeRule(ruleNode, getter_AddRefs(srule));
rules->InsertElementAt(srule, 0);
mCSSUtils->GetRuleNodeParent(ruleNode, &ruleNode);
mCSSUtils->IsRuleNodeRoot(ruleNode, &isRoot);
} while (!isRoot);
}
*_retval = rules;
NS_IF_ADDREF(*_retval);