Bug 1483957 [wpt PR 12531] - HTMLScriptElement text attributes modified to accept TrustedTypes, a=testonly

Automatic update from web-platform-testsHTMLScriptElement text attributes modified to accept TrustedTypes

HTMLScriptElement::text() and setText() functions modified to accept
TrustedScript as an argument.
Added HTMLScriptElement::innerText and HTMLScriptElement:textContent
attributes to override existing implementations in HTMLElement
and Node, and to accept TrustedScript.

Changed HTMLElement::innerText and Node::textContent .idl definitions
and adjusted setters and getters to accept TrustedScript.

Bug: 739170
Change-Id: I63da5714ffac328c6ae2f76e5da58c05f44a1cbf
Reviewed-on: https://chromium-review.googlesource.com/c/1178046
Commit-Queue: Daniel Vogelheim <vogelheim@chromium.org>
Reviewed-by: Mike West <mkwst@chromium.org>
Reviewed-by: Kouhei Ueno <kouhei@chromium.org>
Cr-Commit-Position: refs/heads/master@{#607232}

--

wpt-commits: 860091dbc783a678f128328646a519d9891f0838
wpt-pr: 12531
This commit is contained in:
Daniel Vogelheim 2018-11-13 13:42:28 +00:00 коммит произвёл moz-wptsync-bot
Родитель 97faf52fc2
Коммит 35d48d4314
2 изменённых файлов: 35 добавлений и 5 удалений

Просмотреть файл

@ -8,7 +8,7 @@
<script>
var testnb = 0;
// TrustedURL Assignments
let testCases = [
const URLTestCases = [
[ 'a', 'href' ],
[ 'area', 'href' ],
[ 'base', 'href' ],
@ -24,27 +24,27 @@
[ 'track', 'src' ]
];
testCases.forEach(c => {
URLTestCases.forEach(c => {
test(t => {
assert_element_accepts_trusted_url(window, ++testnb, t, c[0], c[1], RESULTS.URL);
}, c[0] + "." + c[1] + " assigned via policy (successful URL transformation)");
});
// TrustedScriptURL Assignments
let scriptTestCases = [
const scriptURLTestCases = [
[ 'embed', 'src' ],
[ 'script', 'src' ]
];
testnb = 0;
scriptTestCases.forEach(c => {
scriptURLTestCases.forEach(c => {
test(t => {
assert_element_accepts_trusted_script_url(window, ++testnb, t, c[0], c[1], RESULTS.SCRIPTURL);
}, c[0] + "." + c[1] + " assigned via policy (successful ScriptURL transformation)");
});
// TrustedHTML Assignments
let HTMLTestCases = [
const HTMLTestCases = [
[ 'div', 'innerHTML' ],
[ 'iframe', 'srcdoc' ]
];
@ -55,4 +55,18 @@
assert_element_accepts_trusted_html(window, ++testnb, t, c[0], c[1], RESULTS.HTML);
}, c[0] + "." + c[1] + " assigned via policy (successful HTML transformation)");
});
// TrustedScript Assignments
const scriptTestCases = [
[ 'script', 'text' ],
[ 'script', 'innerText' ],
[ 'script', 'textContent' ]
];
testnb = 0;
scriptTestCases.forEach(c => {
test(t => {
assert_element_accepts_trusted_script(window, c, t, c[0], c[1], RESULTS.SCRIPT);
}, c[0] + "." + c[1] + " assigned via policy (successful Script transformation)");
});
</script>

Просмотреть файл

@ -89,4 +89,20 @@
assert_element_accepts_trusted_type(c[0], c[1], null, "null");
}, c[0] + "." + c[1] + " accepts string and null after default policy was created");
});
// TrustedScript Assignments
const scriptTestCases = [
[ 'script', 'text' ],
[ 'script', 'innerText' ],
[ 'script', 'textContent' ]
];
testnb = 0;
scriptTestCases.forEach(c => {
test(t => {
assert_element_accepts_trusted_script(window, ++testnb, t, c[0], c[1], RESULTS.SCRIPT);
assert_throws_no_trusted_type(c[0], c[1], 'A string');
assert_throws_no_trusted_type(c[0], c[1], null);
}, c[0] + "." + c[1] + " accepts only TrustedScript");
});
</script>