forked from qtwebkit/qtwebkit
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove Trusted Types enforcement from toggleAttribute
https://bugs.webkit.org/show_bug.cgi?id=275352 Reviewed by Darin Adler. The DOM spec PR no longer enforced Trusted Types within toggleAttribute so this removes that from the implementation. See whatwg/dom#1268 * LayoutTests/imported/w3c/web-platform-tests/trusted-types/Element-toggleAttribute-expected.txt: Added. * LayoutTests/imported/w3c/web-platform-tests/trusted-types/Element-toggleAttribute.html: Added. * Source/WebCore/dom/Element.cpp: (WebCore::Element::toggleAttribute): Canonical link: https://commits.webkit.org/279950@main
- Loading branch information
1 parent
355516c
commit 3124656
Showing
3 changed files
with
39 additions
and
13 deletions.
There are no files selected for viewing
5 changes: 5 additions & 0 deletions
5
...tTests/imported/w3c/web-platform-tests/trusted-types/Element-toggleAttribute-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,5 @@ | ||
|
||
|
||
PASS TT should not interfere with toggleAttribute on an event handler | ||
PASS TT should not interfere with toggleAttribute on an iframe srcdoc | ||
|
33 changes: 33 additions & 0 deletions
33
LayoutTests/imported/w3c/web-platform-tests/trusted-types/Element-toggleAttribute.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,33 @@ | ||
<!DOCTYPE html> | ||
<head> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<meta http-equiv="Content-Security-Policy" content="require-trusted-types-for 'script'"> | ||
</head> | ||
<body> | ||
<div> | ||
<p id="p" onclick="alert(1)"></p> | ||
<iframe id="iframe" srcdoc="abc"></iframe> | ||
</div> | ||
<script> | ||
// Regression test for crbug.com/341057803. | ||
// This tests that TT doesn't interfere with regular DOM behaviour, and so | ||
// these tests should pass on any browser, whether they support TT or not. | ||
|
||
test(t => { | ||
const elem = document.getElementById("p"); | ||
elem.toggleAttribute("onclick"); | ||
assert_false(elem.hasAttribute("onclick")); | ||
elem.toggleAttribute("onclick"); | ||
assert_true(elem.hasAttribute("onclick")); | ||
}, "TT should not interfere with toggleAttribute on an event handler"); | ||
|
||
test(t => { | ||
const elem = document.getElementById("iframe"); | ||
elem.toggleAttribute("srcdoc"); | ||
assert_false(elem.hasAttribute("srcdoc")); | ||
elem.toggleAttribute("srcdoc"); | ||
assert_true(elem.hasAttribute("srcdoc")); | ||
}, "TT should not interfere with toggleAttribute on an iframe srcdoc"); | ||
</script> | ||
</body> |
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