-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cherry-pick 267815.506@safari-7617-branch (4009863). https://bugs.web…
…kit.org/show_bug.cgi?id=263950 jsc_fuz/wktr: ASSERT_WITH_SECURITY_IMPLICATION(position <= size()); in CSSStyleSheet::insertRule(...) CSSStyleSheet.cpp:365 https://bugs.webkit.org/show_bug.cgi?id=263950 rdar://117469266 Reviewed by Antti Koivisto and Darin Adler. Based on specification, we should return early and throw InvalidStateError exception when attempting to delete @namespace rule, and list contains anything other than @import or @namespace rules. * LayoutTests/fast/css/delete-namespace-rule-when-child-rule-exists-expected.txt: Added. * LayoutTests/fast/css/delete-namespace-rule-when-child-rule-exists.html: Added. * LayoutTests/imported/w3c/web-platform-tests/css/cssom/delete-namespace-rule-when-child-rule-exists-expected.txt: Added. * LayoutTests/imported/w3c/web-platform-tests/css/cssom/delete-namespace-rule-when-child-rule-exists.html: Added. * Source/WebCore/css/CSSStyleSheet.cpp: (WebCore::CSSStyleSheet::deleteRule): * Source/WebCore/css/StyleSheetContents.cpp: (WebCore::StyleSheetContents::wrapperDeleteRule): * Source/WebCore/css/StyleSheetContents.h: Canonical link: https://commits.webkit.org/267815.506@safari-7617-branch Canonical link: https://commits.webkit.org/266719.156@webkitglib/2.42
- Loading branch information
1 parent
fe115c9
commit 822396c
Showing
7 changed files
with
49 additions
and
8 deletions.
There are no files selected for viewing
9 changes: 9 additions & 0 deletions
9
LayoutTests/fast/css/delete-namespace-rule-when-child-rule-exists-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
Tests that deleting a @namespace rule when list contains anything other than @import or @namespace rules should throw InvalidStateError. | ||
|
||
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". | ||
|
||
|
||
PASS styleSheet.deleteRule(0) threw exception InvalidStateError: The object is in an invalid state.. | ||
PASS successfullyParsed is true | ||
|
||
TEST COMPLETE |
12 changes: 12 additions & 0 deletions
12
LayoutTests/fast/css/delete-namespace-rule-when-child-rule-exists.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<style> | ||
@namespace a url(); | ||
</style> | ||
<script src="../../resources/js-test.js"></script> | ||
<script> | ||
description("Tests that deleting a @namespace rule when list contains anything other than @import or @namespace rules should throw InvalidStateError."); | ||
|
||
let styleSheet = document.styleSheets[0]; | ||
styleSheet.cssRules[0]; | ||
styleSheet.insertRule(`b {}`, 1); | ||
shouldThrowErrorName("styleSheet.deleteRule(0)", "InvalidStateError"); | ||
</script> |
2 changes: 2 additions & 0 deletions
2
...3c/web-platform-tests/css/cssom/delete-namespace-rule-when-child-rule-exists-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
|
||
PASS Deleting a @namespace rule when list contains anything other than @import or @namespace rules should throw InvalidStateError. |
15 changes: 15 additions & 0 deletions
15
...ported/w3c/web-platform-tests/css/cssom/delete-namespace-rule-when-child-rule-exists.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<link rel="help" href="https://drafts.csswg.org/cssom-1/#remove-a-css-rule"> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<style> | ||
@namespace a url(); | ||
</style> | ||
<script> | ||
test(function () { | ||
let styleSheet = document.styleSheets[0]; | ||
styleSheet.cssRules[0]; | ||
styleSheet.insertRule(`b {}`, 1); | ||
assert_throws_dom("InvalidStateError", () => styleSheet.deleteRule(0)); | ||
}, "Deleting a @namespace rule when list contains anything other than @import or @namespace rules should throw InvalidStateError."); | ||
|
||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters