Skip to content

Commit 9493331

Browse files
andruudchromium-wpt-export-bot
authored andcommitted
Fix crash when setting aliases on computed style.
The incoming CSSPropertyID may be an unresolved property, therefore CSSUnresolvedProperty::Get must be used rather than CSSProperty::Get. This bug exists in Chrome stable as well, but it was pretty hard to discover (by e.g. ClusterFuzz) because aliases were not enumerated until recently. [email protected] Bug: 844816 Change-Id: I97c81764d2027f86004d3b02316cac44412ef0ea Reviewed-on: https://chromium-review.googlesource.com/1065993 Reviewed-by: Rune Lillesveen <[email protected]> Commit-Queue: Anders Ruud <[email protected]> Cr-Commit-Position: refs/heads/master@{#560540}
1 parent dcbc9bc commit 9493331

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<!DOCTYPE>
2+
<title>NoModificationAllowedError when mutating read only properties</title>
3+
<link rel="author" title="Anders Hartvoll Ruud" href="[email protected]">
4+
<link rel="help" href="https://www.w3.org/TR/cssom-1/#dom-cssstyledeclaration-setpropertyvalue">
5+
<meta name="assert" content="This test verifies that NoModificationAllowedError is thrown when mutating read only properties" />
6+
<script src="/resources/testharness.js"></script>
7+
<script src="/resources/testharnessreport.js"></script>
8+
<body></body>
9+
<script>
10+
test(function(t) {
11+
assert_equals(document.defaultView.getComputedStyle(document.body, null).parentRule, null);
12+
}, "Computed style parent (should be null)");
13+
14+
test(function(t) {
15+
assert_throws("NoModificationAllowedError", function() {
16+
document.defaultView.getComputedStyle(document.body, null).color = "blue";
17+
});
18+
}, "Exception thrown when trying to change a computed style declaration via property");
19+
20+
test(function(t) {
21+
assert_throws("NoModificationAllowedError", function() {
22+
document.defaultView.getComputedStyle(document.body, null).setProperty("color", "blue");
23+
});
24+
}, "Exception thrown when trying to change a computed style declaration via setProperty");
25+
26+
test(function(t) {
27+
assert_throws("NoModificationAllowedError", function() {
28+
document.defaultView.getComputedStyle(document.body, null).webkitTransition = "";
29+
});
30+
}, "Exception thrown when trying to change a computed style alias via property");
31+
32+
test(function(t) {
33+
assert_throws("NoModificationAllowedError", function() {
34+
document.defaultView.getComputedStyle(document.body, null).setProperty("webkitTransition", "");
35+
});
36+
}, "Exception thrown when trying to change a computed style alias via setProperty");
37+
</script>

0 commit comments

Comments
 (0)