DescriptionFix memory error during selector matching due to getMatchedCSSRules.
The issue is that getMatchedCSSRules wasn't correctly pointing at its
parent stylesheet, which meant that it didn't mark the style resolver
as changed when it's selectorText was updated. This in turn meant that
we had two RuleDatas for a rule that now only had one selector (i.e. it
should only have one RuleData) and we'd try to access the selector at
and index that didn't exist.
Instead, when creating the CSSOM wrappers for getMatchedCSSRules,
find the stylesheet corresponding to each rule and register the wrapper
appropriately with it. We still need to leave in the codepath for
lacking a sheet because we won't file a stylesheet for rules that are
not CSSStyleRules (e.g. @import).
We also leave in the lacking a sheet codepath for the inspector and editing.
I'm not convinced the inspector code is correct, but this patch at
least fixes the error that is accessible from JS. The editing code really
shouldn't be creating CSSOM wrappers.
BUG=297976
Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=160879
Patch Set 1 #
Total comments: 2
Patch Set 2 : stop calling willMutateRules #
Total comments: 7
Patch Set 3 : address review comments #Messages
Total messages: 14 (0 generated)
|