Bug 1637935 [wpt PR 23596] - [Trusted Types] Change tests for SVGScriptElement.innerHTML., a=testonly

Automatic update from web-platform-tests
[Trusted Types] Change tests for SVGScriptElement.innerHTML.

Bug: 1066841
Change-Id: I3cc4792e27e6384e53f3e7042e254a66532f5fae
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2201156
Reviewed-by: Mike West <mkwst@chromium.org>
Reviewed-by: Daniel Vogelheim <vogelheim@chromium.org>
Commit-Queue: Yifan Luo <lyf@chromium.org>
Cr-Commit-Position: refs/heads/master@{#769214}

--

wpt-commits: bb11e0cb0cec73827a1e0b59b07e8a83abbee613
wpt-pr: 23596
This commit is contained in:
Yifan Luo 2020-05-21 10:20:47 +00:00 коммит произвёл moz-wptsync-bot
Родитель 0ef457aa6c
Коммит 4259e41cba
1 изменённых файлов: 12 добавлений и 4 удалений

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

@ -20,7 +20,7 @@
}
const policy = trustedTypes.createPolicy("policy", {
createScript: x => x, createScriptURL: x => x });
createScript: x => x, createHTML: x => x, createScriptURL: x => x });
promise_test(t => {
assert_throws_js(TypeError, _ => {
@ -30,9 +30,17 @@
}, "Assign String to SVGScriptElement.innerHTML.");
promise_test(t => {
document.getElementById("script").innerHTML = policy.createScript("'modified via innerHTML';");
document.getElementById("script").innerHTML = policy.createHTML("'modified via innerHTML';");
return Promise.resolve();
}, "Assign TrustedScript to SVGScriptElement.innerHTML.");
}, "Assign TrustedHTML to SVGScriptElement.innerHTML.");
promise_test(t => {
const elem = document.createElementNS(
"http://www.w3.org/2000/svg", "script");
elem.innerHTML = policy.createHTML("'modified via innerHTML';");
document.getElementById("svg").appendChild(elem);
return promise_spv();
}, "Assign TrustedHTML to SVGScriptElement.innerHTML and execute it.");
promise_test(t => {
const elem = document.createElementNS(
@ -102,7 +110,7 @@
// but now expect all of them to pass.
promise_test(t => {
trustedTypes.createPolicy("default", {
createScript: x => x, createScriptURL: x => x });
createScript: x => x, createHTML: x => x, createScriptURL: x => x });
return Promise.resolve();
}, "Setup default policy");