Commit b30a6772 authored by Naina Raisinghani's avatar Naina Raisinghani Committed by Commit Bot

Only copy parsed properties over when mutating a rule.

Currently when we copy over a StyleRule we parse all proeprties
greedily. This should only be the already parsed properties. The greedy
method may result in a dangerous state.

This is a speculative fix for the ClusterFuzz issue.

Bug: 774061
Change-Id: I0b7f09018c7cf2d8ca75ea5d705016fbcce6f0ae
Reviewed-on: https://chromium-review.googlesource.com/722579Reviewed-by: default avatarDarren Shen <shend@chromium.org>
Commit-Queue: nainar <nainar@chromium.org>
Cr-Commit-Position: refs/heads/master@{#509352}
parent e18ac62b
<!DOCTYPE html>
<link type="text/css" rel="stylesheet" href="resources/lazy-pasing-delete-rule-crash.css"/>
<script src='../../resources/testharness.js'></script>
<script src='../../resources/testharnessreport.js'></script>
<div id="success"></div>
<script>
test(function() {
document.styleSheets[0].deleteRule(0);
}, "Test that deleting a rule with lazy parsing turned on doesn't cause a crash");
</script>
\ No newline at end of file
#success:before { content:'SUCCESS' }
\ No newline at end of file
......@@ -234,7 +234,8 @@ StyleRule::StyleRule(const StyleRule& o)
: StyleRuleBase(o),
should_consider_for_matching_rules_(kConsiderIfNonEmpty),
selector_list_(o.selector_list_.Copy()),
properties_(o.Properties().MutableCopy()) {}
properties_(o.ParsedProperties() ? o.ParsedProperties()->MutableCopy()
: nullptr) {}
StyleRule::~StyleRule() {}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment