Bug 1357716 - stylo: Don't return uninitialized pointers from GetCSSStyleRules. r=xidorn

MozReview-Commit-ID: JPj6d27PALc

--HG--
extra : rebase_source : 7565f4aeee5a6bf2b134d0b05981cc18038247db
This commit is contained in:
Matt Brubeck 2017-05-18 14:50:05 -07:00
Родитель 2c63a95b33
Коммит 22c6f54aa2
1 изменённых файлов: 9 добавлений и 5 удалений

Просмотреть файл

@ -299,11 +299,15 @@ inDOMUtils::GetCSSStyleRules(nsIDOMElement *aElement,
// Find matching rules in the table.
for (size_t j = 0; j < rawRuleCount; j++) {
const RawServoStyleRule* rawRule = rawRuleList.ElementAt(j);
ServoStyleRule* rule;
rawRulesToRules.Get(rawRule, &rule);
MOZ_ASSERT(rule, "We should always be able to map a raw rule to a rule.");
ServoStyleRule* rule = nullptr;
if (rawRulesToRules.Get(rawRule, &rule)) {
MOZ_ASSERT(rule, "rule should not be null");
RefPtr<css::Rule> ruleObj(rule);
rules->AppendElement(ruleObj, false);
} else {
// FIXME (bug 1359217): Need a reliable way to map raw rules to rules.
NS_WARNING("stylo: Could not map raw rule to a rule.");
}
}
}