Bug 1477637 [wpt PR 12140] - Replaced HTML*Element tests with two generic test files, a=testonly

Automatic update from web-platform-testsReplaced HTML*Element tests with two generic test files

HTML*Element href and src test files merged into two
HTMLElement-generic test files.

Bug: 739170
Change-Id: I3cf49c9d72540c7f51439fb157f1d201048a349e
Reviewed-on: https://chromium-review.googlesource.com/1146567
Commit-Queue: Mike West <mkwst@chromium.org>
Reviewed-by: Mike West <mkwst@chromium.org>
Cr-Commit-Position: refs/heads/master@{#582550}

--

wpt-commits: af5652d49d6e52dcb26dd5dd07e60a57fcc60de1
wpt-pr: 12140
This commit is contained in:
Maja Kabus 2018-08-15 09:58:14 +00:00 коммит произвёл moz-wptsync-bot
Родитель 861a417ec9
Коммит 57995f411e
32 изменённых файлов: 130 добавлений и 1185 удалений

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

@ -392135,57 +392135,9 @@
{} {}
] ]
], ],
"trusted-types/HTMLAnchorElement-href.tentative.html": [ "trusted-types/HTMLElement-generic.tentative.html": [
[ [
"/trusted-types/HTMLAnchorElement-href.tentative.html", "/trusted-types/HTMLElement-generic.tentative.html",
{}
]
],
"trusted-types/HTMLAreaElement-href.tentative.html": [
[
"/trusted-types/HTMLAreaElement-href.tentative.html",
{}
]
],
"trusted-types/HTMLBaseElement-href.tentative.html": [
[
"/trusted-types/HTMLBaseElement-href.tentative.html",
{}
]
],
"trusted-types/HTMLIFrameElement-src.tentative.html": [
[
"/trusted-types/HTMLIFrameElement-src.tentative.html",
{}
]
],
"trusted-types/HTMLImageElement-src.tentative.html": [
[
"/trusted-types/HTMLImageElement-src.tentative.html",
{}
]
],
"trusted-types/HTMLLinkElement-href.tentative.html": [
[
"/trusted-types/HTMLLinkElement-href.tentative.html",
{}
]
],
"trusted-types/HTMLMediaElement-src.tentative.html": [
[
"/trusted-types/HTMLMediaElement-src.tentative.html",
{}
]
],
"trusted-types/HTMLObjectElement.tentative.html": [
[
"/trusted-types/HTMLObjectElement.tentative.html",
{}
]
],
"trusted-types/HTMLSourceElement-src.tentative.html": [
[
"/trusted-types/HTMLSourceElement-src.tentative.html",
{} {}
] ]
], ],
@ -392219,57 +392171,9 @@
{} {}
] ]
], ],
"trusted-types/block-string-assignment-to-HTMLAnchorElement-href.tentative.html": [ "trusted-types/block-string-assignment-to-HTMLElement-generic.tentative.html": [
[ [
"/trusted-types/block-string-assignment-to-HTMLAnchorElement-href.tentative.html", "/trusted-types/block-string-assignment-to-HTMLElement-generic.tentative.html",
{}
]
],
"trusted-types/block-string-assignment-to-HTMLAreaElement-href.tentative.html": [
[
"/trusted-types/block-string-assignment-to-HTMLAreaElement-href.tentative.html",
{}
]
],
"trusted-types/block-string-assignment-to-HTMLBaseElement-href.tentative.html": [
[
"/trusted-types/block-string-assignment-to-HTMLBaseElement-href.tentative.html",
{}
]
],
"trusted-types/block-string-assignment-to-HTMLIFrameElement-src.tentative.html": [
[
"/trusted-types/block-string-assignment-to-HTMLIFrameElement-src.tentative.html",
{}
]
],
"trusted-types/block-string-assignment-to-HTMLImageElement-src.tentative.html": [
[
"/trusted-types/block-string-assignment-to-HTMLImageElement-src.tentative.html",
{}
]
],
"trusted-types/block-string-assignment-to-HTMLLinkElement-href.tentative.html": [
[
"/trusted-types/block-string-assignment-to-HTMLLinkElement-href.tentative.html",
{}
]
],
"trusted-types/block-string-assignment-to-HTMLMediaElement-src.tentative.html": [
[
"/trusted-types/block-string-assignment-to-HTMLMediaElement-src.tentative.html",
{}
]
],
"trusted-types/block-string-assignment-to-HTMLObjectElement.tentative.html": [
[
"/trusted-types/block-string-assignment-to-HTMLObjectElement.tentative.html",
{}
]
],
"trusted-types/block-string-assignment-to-HTMLSourceElement-src.tentative.html": [
[
"/trusted-types/block-string-assignment-to-HTMLSourceElement-src.tentative.html",
{} {}
] ]
], ],
@ -392279,30 +392183,12 @@
{} {}
] ]
], ],
"trusted-types/block-string-assignment-to-embed-src.tentative.html": [
[
"/trusted-types/block-string-assignment-to-embed-src.tentative.html",
{}
]
],
"trusted-types/block-string-assignment-to-frame-src.tentative.html": [
[
"/trusted-types/block-string-assignment-to-frame-src.tentative.html",
{}
]
],
"trusted-types/block-string-assignment-to-innerHTML.tentative.html": [ "trusted-types/block-string-assignment-to-innerHTML.tentative.html": [
[ [
"/trusted-types/block-string-assignment-to-innerHTML.tentative.html", "/trusted-types/block-string-assignment-to-innerHTML.tentative.html",
{} {}
] ]
], ],
"trusted-types/block-string-assignment-to-input-src.tentative.html": [
[
"/trusted-types/block-string-assignment-to-input-src.tentative.html",
{}
]
],
"trusted-types/block-string-assignment-to-insertAdjacentHTML.tentative.html": [ "trusted-types/block-string-assignment-to-insertAdjacentHTML.tentative.html": [
[ [
"/trusted-types/block-string-assignment-to-insertAdjacentHTML.tentative.html", "/trusted-types/block-string-assignment-to-insertAdjacentHTML.tentative.html",
@ -392333,18 +392219,6 @@
{} {}
] ]
], ],
"trusted-types/block-string-assignment-to-script-src.tentative.html": [
[
"/trusted-types/block-string-assignment-to-script-src.tentative.html",
{}
]
],
"trusted-types/block-string-assignment-to-track-src.tentative.html": [
[
"/trusted-types/block-string-assignment-to-track-src.tentative.html",
{}
]
],
"trusted-types/block-string-assignment-to-window-open.tentative.html": [ "trusted-types/block-string-assignment-to-window-open.tentative.html": [
[ [
"/trusted-types/block-string-assignment-to-window-open.tentative.html", "/trusted-types/block-string-assignment-to-window-open.tentative.html",
@ -392363,30 +392237,12 @@
{} {}
] ]
], ],
"trusted-types/embed-src.tentative.html": [
[
"/trusted-types/embed-src.tentative.html",
{}
]
],
"trusted-types/frame-src.tentative.html": [
[
"/trusted-types/frame-src.tentative.html",
{}
]
],
"trusted-types/innerHTML.tentative.html": [ "trusted-types/innerHTML.tentative.html": [
[ [
"/trusted-types/innerHTML.tentative.html", "/trusted-types/innerHTML.tentative.html",
{} {}
] ]
], ],
"trusted-types/input-src.tentative.html": [
[
"/trusted-types/input-src.tentative.html",
{}
]
],
"trusted-types/insertAdjacentHTML.tentative.html": [ "trusted-types/insertAdjacentHTML.tentative.html": [
[ [
"/trusted-types/insertAdjacentHTML.tentative.html", "/trusted-types/insertAdjacentHTML.tentative.html",
@ -392417,12 +392273,6 @@
{} {}
] ]
], ],
"trusted-types/script-src.tentative.html": [
[
"/trusted-types/script-src.tentative.html",
{}
]
],
"trusted-types/srcDoc-requiresTrustedTypes.tentative.html": [ "trusted-types/srcDoc-requiresTrustedTypes.tentative.html": [
[ [
"/trusted-types/srcDoc-requiresTrustedTypes.tentative.html", "/trusted-types/srcDoc-requiresTrustedTypes.tentative.html",
@ -392435,12 +392285,6 @@
{} {}
] ]
], ],
"trusted-types/track-src.tentative.html": [
[
"/trusted-types/track-src.tentative.html",
{}
]
],
"trusted-types/window-open.tentative.html": [ "trusted-types/window-open.tentative.html": [
[ [
"/trusted-types/window-open.tentative.html", "/trusted-types/window-open.tentative.html",
@ -642486,40 +642330,8 @@
"53d2b44febd6510b4216bb21cb22a83ed6663e5b", "53d2b44febd6510b4216bb21cb22a83ed6663e5b",
"testharness" "testharness"
], ],
"trusted-types/HTMLAnchorElement-href.tentative.html": [ "trusted-types/HTMLElement-generic.tentative.html": [
"33c8989642a5a6e1ae3482cdaff2a39a402e40f8", "486b008986bc4e3328c8b709674359538d408800",
"testharness"
],
"trusted-types/HTMLAreaElement-href.tentative.html": [
"8ac509d34b21a2a396cbd3dbcf7859b06fbd7f0a",
"testharness"
],
"trusted-types/HTMLBaseElement-href.tentative.html": [
"80bed8079818047917b72b12d2d108ca51510e57",
"testharness"
],
"trusted-types/HTMLIFrameElement-src.tentative.html": [
"6e89a0f397e4014550ae16842199bfc62c4125d5",
"testharness"
],
"trusted-types/HTMLImageElement-src.tentative.html": [
"5797aa5079e6fb3f3e4e7a83af524b6b2ef6a013",
"testharness"
],
"trusted-types/HTMLLinkElement-href.tentative.html": [
"7f6e7e23e872026346c952fb3a3cbd1708a18397",
"testharness"
],
"trusted-types/HTMLMediaElement-src.tentative.html": [
"c54dfddd8278853ca73b696ab05d05ac7e03a458",
"testharness"
],
"trusted-types/HTMLObjectElement.tentative.html": [
"a9dcc94a43ba2cc96a960057dbdeab89a093bc1a",
"testharness"
],
"trusted-types/HTMLSourceElement-src.tentative.html": [
"6791a0fc118be18ae997806c347177246c05e147",
"testharness" "testharness"
], ],
"trusted-types/META.yml": [ "trusted-types/META.yml": [
@ -642546,62 +642358,18 @@
"ef4487749dd0c12a00bd3ab42c1353467a6eeb8f", "ef4487749dd0c12a00bd3ab42c1353467a6eeb8f",
"testharness" "testharness"
], ],
"trusted-types/block-string-assignment-to-HTMLAnchorElement-href.tentative.html": [ "trusted-types/block-string-assignment-to-HTMLElement-generic.tentative.html": [
"53334e2e810bb27900908ccdf71105c0a687f016", "79bbb24f541b43123ef1d5f814fb3108275b974c",
"testharness"
],
"trusted-types/block-string-assignment-to-HTMLAreaElement-href.tentative.html": [
"5879d1c330e3b7503de80a8f7b0bb61b34b2cf41",
"testharness"
],
"trusted-types/block-string-assignment-to-HTMLBaseElement-href.tentative.html": [
"a973e29f2758034fac4b6c788f5ed6fe82ccb5d6",
"testharness"
],
"trusted-types/block-string-assignment-to-HTMLIFrameElement-src.tentative.html": [
"8db0d60cdeb92f7ec456a1126c1a88175a002590",
"testharness"
],
"trusted-types/block-string-assignment-to-HTMLImageElement-src.tentative.html": [
"44461067a3f13c9a9973761bfd036e74b2dda96c",
"testharness"
],
"trusted-types/block-string-assignment-to-HTMLLinkElement-href.tentative.html": [
"11950da775ee8917c0fa7d2b6c6090d748e27001",
"testharness"
],
"trusted-types/block-string-assignment-to-HTMLMediaElement-src.tentative.html": [
"38ac53f2027ee3b5289f3569d76ca30def09fbcb",
"testharness"
],
"trusted-types/block-string-assignment-to-HTMLObjectElement.tentative.html": [
"87e1f46464f7a6b08cc84344638ddc98714e2f0a",
"testharness"
],
"trusted-types/block-string-assignment-to-HTMLSourceElement-src.tentative.html": [
"37ab90cd700fa6bb766ebc185d9bb5e6c4734428",
"testharness" "testharness"
], ],
"trusted-types/block-string-assignment-to-createContextualFragment.tentative.html": [ "trusted-types/block-string-assignment-to-createContextualFragment.tentative.html": [
"1d67a51ff6ab1df879a59af5ee7c6ad9a0609be0", "1d67a51ff6ab1df879a59af5ee7c6ad9a0609be0",
"testharness" "testharness"
], ],
"trusted-types/block-string-assignment-to-embed-src.tentative.html": [
"005dfe20be62cb72fefed836fc6d809e3dd118bc",
"testharness"
],
"trusted-types/block-string-assignment-to-frame-src.tentative.html": [
"c915e430a6d29c855663812fa453212f16268aa9",
"testharness"
],
"trusted-types/block-string-assignment-to-innerHTML.tentative.html": [ "trusted-types/block-string-assignment-to-innerHTML.tentative.html": [
"67faf6ea7d30ebb76bb857faf0faf04743917dfb", "67faf6ea7d30ebb76bb857faf0faf04743917dfb",
"testharness" "testharness"
], ],
"trusted-types/block-string-assignment-to-input-src.tentative.html": [
"732ebe80d62ef8442b47b0789d045944f8410238",
"testharness"
],
"trusted-types/block-string-assignment-to-insertAdjacentHTML.tentative.html": [ "trusted-types/block-string-assignment-to-insertAdjacentHTML.tentative.html": [
"70bb803442f14cbdcb356be6f6cdceca83522008", "70bb803442f14cbdcb356be6f6cdceca83522008",
"testharness" "testharness"
@ -642622,14 +642390,6 @@
"8cf6c4b065a87f83015e5519ce86ecb6e1115e12", "8cf6c4b065a87f83015e5519ce86ecb6e1115e12",
"testharness" "testharness"
], ],
"trusted-types/block-string-assignment-to-script-src.tentative.html": [
"ade76848209bebc46cc8eb4c011012742f385581",
"testharness"
],
"trusted-types/block-string-assignment-to-track-src.tentative.html": [
"b6f81e9d0e4576ed6dc0781164a6adacce6d5318",
"testharness"
],
"trusted-types/block-string-assignment-to-window-open.tentative.html": [ "trusted-types/block-string-assignment-to-window-open.tentative.html": [
"2c3a8ce056685a5306472ee2e1a87bcbfc4c11e9", "2c3a8ce056685a5306472ee2e1a87bcbfc4c11e9",
"testharness" "testharness"
@ -642642,22 +642402,10 @@
"12794199722f6e2f078efa9ce9f91146c8ae9219", "12794199722f6e2f078efa9ce9f91146c8ae9219",
"testharness" "testharness"
], ],
"trusted-types/embed-src.tentative.html": [
"75760278fac4dc4e1dff94dd727f3c105dd8ae00",
"testharness"
],
"trusted-types/frame-src.tentative.html": [
"31a1ce919c24c063aeffe12a6a20cb4d9181e7d9",
"testharness"
],
"trusted-types/innerHTML.tentative.html": [ "trusted-types/innerHTML.tentative.html": [
"f9f32d42a766346f5fd4e5fd18d8e20f7acba810", "f9f32d42a766346f5fd4e5fd18d8e20f7acba810",
"testharness" "testharness"
], ],
"trusted-types/input-src.tentative.html": [
"8cbd0ad41721974bfaf8d2d4cf0ee88fa7272d02",
"testharness"
],
"trusted-types/insertAdjacentHTML.tentative.html": [ "trusted-types/insertAdjacentHTML.tentative.html": [
"a95dd6c0bacc9844d25e64453b66aab759c76ad7", "a95dd6c0bacc9844d25e64453b66aab759c76ad7",
"testharness" "testharness"
@ -642678,10 +642426,6 @@
"1deb46bf5e3d102550575d5e79eaf05cdf9739f6", "1deb46bf5e3d102550575d5e79eaf05cdf9739f6",
"testharness" "testharness"
], ],
"trusted-types/script-src.tentative.html": [
"7235cc3bca650db268a6bc1b85ca47ae1c80d352",
"testharness"
],
"trusted-types/srcDoc-requiresTrustedTypes.tentative.html": [ "trusted-types/srcDoc-requiresTrustedTypes.tentative.html": [
"b957488bee42d17b3160144b1cdaccfdfb8f1689", "b957488bee42d17b3160144b1cdaccfdfb8f1689",
"testharness" "testharness"
@ -642691,13 +642435,9 @@
"testharness" "testharness"
], ],
"trusted-types/support/helper.sub.js": [ "trusted-types/support/helper.sub.js": [
"036dbed7d1593f2ffe05d1fac4e00603b0ce6a37", "91112d8f239069a9f88fdcffc46f5b2d49e49321",
"support" "support"
], ],
"trusted-types/track-src.tentative.html": [
"cfe5374e41c56606c8499f32af8e87d0510bf50c",
"testharness"
],
"trusted-types/window-open.tentative.html": [ "trusted-types/window-open.tentative.html": [
"66ffbd78399c70cca883ac55b6f380587bffc9ab", "66ffbd78399c70cca883ac55b6f380587bffc9ab",
"testharness" "testharness"

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

@ -1,21 +0,0 @@
<!DOCTYPE html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="support/helper.sub.js"></script>
<body>
<script>
//helper function for the tests
function testHref(str, url) {
var a = document.createElement('a');
a.href = url;
assert_equals(a.href, str);
}
test(t => {
testHref(URLS.safe, TrustedURL.create(URLS.safe));
}, "a.href = URLS.safe, TrustedURL.create");
test(t => {
testHref(URLS.safe, TrustedURL.unsafelyCreate(URLS.safe));
}, "a.href = URLS.safe, TrustedURL.unsafelyCreate");
</script>

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

@ -1,25 +0,0 @@
<!DOCTYPE html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="support/helper.sub.js"></script>
<body>
<map>
<script>
//helper function for the tests
function testHref(str, url) {
var area = document.createElement('area');
area.href = url;
area.alt = "Area";
assert_equals(area.href, str);
}
test(t => {
testHref(URLS.safe, TrustedURL.create(URLS.safe));
}, "area.href = URLS.safe, TrustedURL.create");
test(t => {
testHref(URLS.safe, TrustedURL.unsafelyCreate(URLS.safe));
}, "area.href = URLS.safe, TrustedURL.unsafelyCreate");
</script>
</map>
</body>

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

@ -1,24 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="support/helper.sub.js"></script>
<script>
//helper function for the tests
function testHref(str, url) {
var base = document.createElement('base');
base.href = url;
assert_equals(base.href, str);
}
test(t => {
testHref(URLS.safe, TrustedURL.create(URLS.safe));
}, "base.href = URLS.safe, TrustedURL.create");
test(t => {
testHref(URLS.safe, TrustedURL.unsafelyCreate(URLS.safe));
}, "base.href = URLS.safe, TrustedURL.unsafelyCreate");
</script>
</head>

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

@ -0,0 +1,43 @@
<!DOCTYPE html>
<head>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="support/helper.sub.js"></script>
</head>
<body>
<script>
//TrustedURL Assignments
let testCases = [
[ 'a', 'href' ],
[ 'area', 'href' ],
[ 'base', 'href' ],
[ 'frame', 'src' ],
[ 'iframe', 'src' ],
[ 'img', 'src' ],
[ 'input', 'src' ],
[ 'link', 'href' ],
[ 'video', 'src' ],
[ 'object', 'data' ],
[ 'object', 'codeBase' ],
[ 'source', 'src' ],
[ 'track', 'src' ]
];
testCases.forEach(c => {
test(t => {
assert_accepts_trusted_url(c[0], c[1]);
}, c[0] + "." + c[1] + " accepts TrustedURL");
});
//TrustedScriptURL Assignments
let scriptTestCases = [
[ 'embed', 'src' ],
[ 'script', 'src' ]
];
scriptTestCases.forEach(c => {
test(t => {
assert_accepts_trusted_script_url(c[0], c[1]);
}, c[0] + "." + c[1] + " accepts TrustedScriptURL");
});
</script>

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

@ -1,23 +0,0 @@
<!DOCTYPE html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="./support/helper.sub.js"></script>
<body>
<script>
test(t => {
var url = TrustedURL.create(URLS.safe);
var d = document.createElement('iframe');
d.src = url;
assert_equals("" + d.src, URLS.safe);
}, "src = TrustedURL.create().");
test(t => {
var url = TrustedURL.unsafelyCreate(URLS.safe);
var d = document.createElement('iframe');
d.src = url;
assert_equals("" + d.src, URLS.safe);
}, "src = TrustedURL.unsafelyCreate().");
</script>

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

@ -1,24 +0,0 @@
<!DOCTYPE html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="./support/helper.sub.js"></script>
<body>
<script>
test(t => {
var url = TrustedURL.create(URLS.safe);
var d = document.createElement('image');
d.src = url;
assert_equals("" + d.src, URLS.safe);
}, "src = TrustedURL.create().");
test(t => {
var url = TrustedURL.unsafelyCreate(URLS.safe);
var d = document.createElement('image');
d.src = url;
assert_equals("" + d.src, URLS.safe);
}, "src = TrustedURL.unsafelyCreate().");
</script>

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

@ -1,21 +0,0 @@
<!DOCTYPE html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="support/helper.sub.js"></script>
<body>
<script>
//helper function for the tests
function testHref(str, url) {
var link = document.createElement('link');
link.href = url;
assert_equals(link.href, str);
}
test(t => {
testHref(URLS.safe, TrustedURL.create(URLS.safe));
}, "link.href = URLS.safe, TrustedURL.create");
test(t => {
testHref(URLS.safe, TrustedURL.unsafelyCreate(URLS.safe));
}, "link.href = URLS.safe, TrustedURL.unsafelyCreate");
</script>

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

@ -1,23 +0,0 @@
<!DOCTYPE html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="./support/helper.sub.js"></script>
<body>
<script>
test(t => {
var url = TrustedURL.create(URLS.safe);
var d = document.createElement('video');
d.src = url;
assert_equals("" + d.src, URLS.safe);
}, "src = TrustedURL.create().");
test(t => {
var url = TrustedURL.unsafelyCreate(URLS.safe);
var d = document.createElement('video');
d.src = url;
assert_equals("" + d.src, URLS.safe);
}, "src = TrustedURL.unsafelyCreate().");
</script>

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

@ -1,23 +0,0 @@
<!DOCTYPE html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="support/helper.sub.js"></script>
<body>
<script>
//helper function for the tests
function testData(str, url) {
var objectElement = document.createElement('object');
objectElement.data = url;
objectElement.codeBase = url;
assert_equals(objectElement.data, str);
assert_equals(objectElement.codeBase,str);
}
test(t => {
testData(URLS.safe, TrustedURL.create(URLS.safe));
}, "Basic processing: safe URL, safe construction.");
test(t => {
testData(URLS.safe, TrustedURL.unsafelyCreate(URLS.safe));
}, "Basic processing: safe URL, unsafe construction.");
</script>

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

@ -1,22 +0,0 @@
<!DOCTYPE html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="./support/helper.sub.js"></script>
<body>
<script>
test(t => {
var url = TrustedURL.create(URLS.safe);
var d = document.createElement('source');
d.src = url;
assert_equals(d.src, URLS.safe);
}, "src = TrustedURL.create().");
test(t => {
var url = TrustedURL.unsafelyCreate(URLS.safe);
var d = document.createElement('source');
d.src = url;
assert_equals(d.src, URLS.safe);
}, "src = TrustedURL.unsafelyCreate().");
</script>

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

@ -1,43 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="support/helper.sub.js"></script>
<meta http-equiv="Content-Security-Policy" content="require-trusted-types">
</head>
<body>
<script>
//helper function for the tests
function testHref(str, url) {
var a = document.createElement('a');
a.href = url;
assert_equals(a.href, str);
}
//URL assignments do not throw.
test(t => {
testHref(URLS.safe, TrustedURL.create(URLS.safe));
}, "a.href = URLS.safe, TrustedURL.create");
test(t => {
testHref(URLS.safe, TrustedURL.unsafelyCreate(URLS.safe));
}, "a.href = URLS.safe, TrustedURL.unsafelyCreate");
// String assignments throw.
test(t => {
var a = document.createElement('a');
assert_throws(new TypeError(), _ => {
a.href = "A string";
});
}, "`a.href = string` throws");
//Null assignment throws.
test(t => {
var a = document.createElement('a');
assert_throws(new TypeError(), _ => {
a.href = null;
});
}, "`a.href = null` throws");
</script>

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

@ -1,46 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="support/helper.sub.js"></script>
<meta http-equiv="Content-Security-Policy" content="require-trusted-types">
</head>
<body>
<map>
<script>
//helper function for the tests
function testHref(str, url) {
var area = document.createElement('area');
area.href = url;
area.alt = "Area";
assert_equals(area.href, str);
}
//URL assignments do not throw.
test(t => {
testHref(URLS.safe, TrustedURL.create(URLS.safe));
}, "area.href = URLS.safe, TrustedURL.create");
test(t => {
testHref(URLS.safe, TrustedURL.unsafelyCreate(URLS.safe));
}, "area.href = URLS.safe, TrustedURL.unsafelyCreate");
// String assignments throw.
test(t => {
var area = document.createElement('area');
assert_throws(new TypeError(), _ => {
area.href = "A string";
});
}, "`area.href = string` throws");
//Null assignment throws.
test(t => {
var area = document.createElement('area');
assert_throws(new TypeError(), _ => {
area.href = null;
});
}, "`area.href = null` throws");
</script>
</map>

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

@ -1,43 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="support/helper.sub.js"></script>
<meta http-equiv="Content-Security-Policy" content="require-trusted-types">
<script>
//helper function for the tests
function testHref(str, url) {
var base = document.createElement('base');
base.href = url;
assert_equals(base.href, str);
}
//URL assignments do not throw.
test(t => {
testHref(URLS.safe, TrustedURL.create(URLS.safe));
}, "base.href = URLS.safe, TrustedURL.create");
test(t => {
testHref(URLS.safe, TrustedURL.unsafelyCreate(URLS.safe));
}, "base.href = URLS.safe, TrustedURL.unsafelyCreate");
// String assignments throw.
test(t => {
var base = document.createElement('base');
assert_throws(new TypeError(), _ => {
base.href = "A string";
});
}, "`base.href = string` throws");
//Null assignment throws.
test(t => {
var base = document.createElement('base');
assert_throws(new TypeError(), _ => {
base.href = null;
});
}, "`base.href = null` throws");
</script>
</head>

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

@ -0,0 +1,50 @@
<!DOCTYPE html>
<html>
<head>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="support/helper.sub.js"></script>
<meta http-equiv="Content-Security-Policy" content="require-trusted-types">
</head>
<body>
<script>
//TrustedURL Assignments
let testCases = [
[ 'a', 'href' ],
[ 'area', 'href' ],
[ 'base', 'href' ],
[ 'frame', 'src' ],
[ 'iframe', 'src' ],
[ 'img', 'src' ],
[ 'input', 'src' ],
[ 'link', 'href' ],
[ 'video', 'src' ],
[ 'object', 'data' ],
[ 'object', 'codeBase' ],
[ 'source', 'src' ],
[ 'track', 'src' ]
];
testCases.forEach(c => {
test(t => {
assert_accepts_trusted_url(c[0], c[1]);
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 TrustedURL");
});
//TrustedScriptURL Assignments
let scriptTestCases = [
[ 'embed', 'src' ],
[ 'script', 'src' ]
];
scriptTestCases.forEach(c => {
test(t => {
assert_accepts_trusted_script_url(c[0], c[1]);
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 TrustedScriptURL");
});
</script>

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

@ -1,33 +0,0 @@
<!DOCTYPE html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="./support/helper.sub.js"></script>
<meta http-equiv="Content-Security-Policy" content="require-trusted-types">
<body>
<script>
//URL assignments don't throw
test(t => {
var url = TrustedURL.create(URLS.safe);
var d = document.createElement('iframe');
d.src = url;
assert_equals("" + d.src, URLS.safe);
}, "src = TrustedURL.create().");
test(t => {
var url = TrustedURL.unsafelyCreate(URLS.safe);
var d = document.createElement('iframe');
d.src = url;
assert_equals("" + d.src, URLS.safe);
}, "src = TrustedURL.unsafelyCreate().");
//String assignment throws
test(t => {
var d = document.createElement('iframe');
assert_throws(new TypeError(), _ => {
d.src = "Fail.";
});
}, "'src = string' throws.");
</script>

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

@ -1,33 +0,0 @@
<!DOCTYPE html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="./support/helper.sub.js"></script>
<meta http-equiv="Content-Security-Policy" content="require-trusted-types">
<body>
<script>
//URL assignments don't throw
test(t => {
var url = TrustedURL.create(URLS.safe);
var d = document.createElement('img');
d.src = url;
assert_equals("" + d.src, URLS.safe);
}, "src = TrustedURL.create().");
test(t => {
var url = TrustedURL.unsafelyCreate(URLS.safe);
var d = document.createElement('img');
d.src = url;
assert_equals("" + d.src, URLS.safe);
}, "src = TrustedURL.unsafelyCreate().");
//String assignment throws
test(t => {
var d = document.createElement('img');
assert_throws(new TypeError(), _ => {
d.src = "Fail.";
});
}, "'src = string' throws.");
</script>

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

@ -1,43 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="support/helper.sub.js"></script>
<meta http-equiv="Content-Security-Policy" content="require-trusted-types">
</head>
<body>
<script>
//helper function for the tests
function testHref(str, url) {
var link = document.createElement('link');
link.href = url;
assert_equals(link.href, str);
}
//URL assignments do not throw.
test(t => {
testHref(URLS.safe, TrustedURL.create(URLS.safe));
}, "link.href = URLS.safe, TrustedURL.create");
test(t => {
testHref(URLS.safe, TrustedURL.unsafelyCreate(URLS.safe));
}, "link.href = URLS.safe, TrustedURL.unsafelyCreate");
// String assignments throw.
test(t => {
var link = document.createElement('link');
assert_throws(new TypeError(), _ => {
link.href = "A string";
});
}, "`link.href = string` throws");
//Null assignment throws.
test(t => {
var link = document.createElement('link');
assert_throws(new TypeError(), _ => {
link.href = null;
});
}, "`link.href = null` throws");
</script>

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

@ -1,33 +0,0 @@
<!DOCTYPE html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="./support/helper.sub.js"></script>
<meta http-equiv="Content-Security-Policy" content="require-trusted-types">
<body>
<script>
//URL assignments don't throw
test(t => {
var url = TrustedURL.create(URLS.safe);
var d = document.createElement('video');
d.src = url;
assert_equals("" + d.src, URLS.safe);
}, "src = TrustedURL.create().");
test(t => {
var url = TrustedURL.unsafelyCreate(URLS.safe);
var d = document.createElement('video');
d.src = url;
assert_equals("" + d.src, URLS.safe);
}, "src = TrustedURL.unsafelyCreate().");
//String assignment throws
test(t => {
var d = document.createElement('video');
assert_throws(new TypeError(), _ => {
d.src = "Fail.";
});
}, "'src = string' throws.");
</script>

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

@ -1,60 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="support/helper.sub.js"></script>
<meta http-equiv="Content-Security-Policy" content="require-trusted-types">
</head>
<body>
<script>
//helper function for the tests
function testData(str, url) {
var objectElement = document.createElement('object');
objectElement.data = url;
objectElement.codeBase = url;
assert_equals(objectElement.data, str);
assert_equals(objectElement.codeBase, str);
}
//URL assignments do not throw
test(t => {
testData(URLS.safe, TrustedURL.create(URLS.safe));
}, "Basic processing: safe URL, safe construction.");
test(t => {
testData(URLS.safe, TrustedURL.unsafelyCreate(URLS.safe));
}, "Basic processing: safe URL, unsafe construction.");
//String assignments throw
test(t => {
var objectElement = document.createElement('object');
assert_throws(new TypeError(), _ => {
objectElement.data = "A string";
});
}, "`objectElement.data = string` throws");
test(t => {
var objectElement = document.createElement('object');
assert_throws(new TypeError(), _ => {
objectElement.codeBase = "A string";
});
}, "`objectElement.codeBase = string` throws");
//Null assignment throws.
test(t => {
var objectElement = document.createElement('object');
assert_throws(new TypeError(), _ => {
objectElement.data = null;
});
}, "`objectElement.data = null` throws");
//Null assignment throws.
test(t => {
var objectElement = document.createElement('object');
assert_throws(new TypeError(), _ => {
objectElement.codeBase = null;
});
}, "`objectElement.codeBase = null` throws");
</script>

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

@ -1,36 +0,0 @@
<!DOCTYPE html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="./support/helper.sub.js"></script>
<meta http-equiv="Content-Security-Policy" content="require-trusted-types">
<body>
<script>
//URL assignments don't throw
test(t => {
var url = TrustedURL.create(URLS.safe);
var d = document.createElement('source');
d.src = url;
assert_equals(d.src, URLS.safe);
}, "src = TrustedURL.create().");
test(t => {
var url = TrustedURL.unsafelyCreate(URLS.safe);
var d = document.createElement('source');
d.src = url;
assert_equals(d.src, URLS.safe);
}, "src = TrustedURL.unsafelyCreate().");
//String assignment throws
test(t => {
var url = "Fail."
var d = document.createElement('source');
assert_throws(new TypeError(), _ => {
d.src = url;
});
}, "'src = string' throws.");
</script>

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

@ -1,56 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="./support/helper.sub.js"></script>
<meta http-equiv="Content-Security-Policy" content="require-trusted-types">
</head>
<body>
<script>
// String assignments throw.
test(t => {
var s = document.createElement('embed');
assert_throws(new TypeError(), _ => {
s.src = "Fail.";
});
assert_equals('', s.src);
}, "src = 'string' assignment throws.");
// TrustedURL assignments throw.
test(t => {
var url = TrustedURL.unsafelyCreate(URLS.safe);
var s = document.createElement('embed');
assert_throws(new TypeError(), _ => {
s.src = url;
});
assert_equals('', s.src);
}, "src = TrustedURL.unsafelyCreate(URLS.safe) assignment throws");
// TrustedScriptURL assignments work.
test(t => {
var url = TrustedScriptURL.unsafelyCreate(URLS.safe);
var s = document.createElement('embed');
s.src = url;
assert_equals(url + '', s.src);
}, "src = TrustedScriptURL.unsafelyCreate(URLS.safe)");
test(t => {
var url = TrustedScriptURL.unsafelyCreate(URLS.javascript);
var s = document.createElement('embed');
s.src = url;
assert_equals(url + '', s.src);
}, "src = TrustedScriptURL.unsafelyCreate(URLS.javascript)");
test(t => {
var url = TrustedScriptURL.unsafelyCreate(URLS.external);
var s = document.createElement('embed');
s.src = url;
assert_equals(url + '', s.src);
}, "src = TrustedScriptURL.unsafelyCreate(URLS.external)");
</script>

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

@ -1,33 +0,0 @@
<!DOCTYPE html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="./support/helper.sub.js"></script>
<meta http-equiv="Content-Security-Policy" content="require-trusted-types">
<body>
<script>
//URL assignments don't throw
test(t => {
var url = TrustedURL.create(URLS.safe);
var d = document.createElement('frame');
d.src = url;
assert_equals("" + d.src, URLS.safe);
}, "src = TrustedURL.create().");
test(t => {
var url = TrustedURL.unsafelyCreate(URLS.safe);
var d = document.createElement('frame');
d.src = url;
assert_equals("" + d.src, URLS.safe);
}, "src = TrustedURL.unsafelyCreate().");
//String assignment throws
test(t => {
var d = document.createElement('frame');
assert_throws(new TypeError(), _ => {
d.src = "Fail.";
});
}, "'src = string' throws.");
</script>

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

@ -1,33 +0,0 @@
<!DOCTYPE html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="./support/helper.sub.js"></script>
<meta http-equiv="Content-Security-Policy" content="require-trusted-types">
<body>
<script>
//URL assignments don't throw
test(t => {
var url = TrustedURL.create(URLS.safe);
var d = document.createElement('input');
d.src = url;
assert_equals("" + d.src, URLS.safe);
}, "src = TrustedURL.create().");
test(t => {
var url = TrustedURL.unsafelyCreate(URLS.safe);
var d = document.createElement('input');
d.src = url;
assert_equals("" + d.src, URLS.safe);
}, "src = TrustedURL.unsafelyCreate().");
//String assignment throws
test(t => {
var d = document.createElement('input');
assert_throws(new TypeError(), _ => {
d.src = "Fail.";
});
}, "'src = string' throws.");
</script>

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

@ -1,56 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="support/helper.sub.js"></script>
<meta http-equiv="Content-Security-Policy" content="require-trusted-types">
</head>
<body>
<script>
// String assignments throw.
test(t => {
var s = document.createElement('script');
assert_throws(new TypeError(), _ => {
s.src = URLS.safe;
});
assert_equals('', s.src);
}, "'string'");
// TrustedURL assignments throw.
test(t => {
var url = TrustedURL.unsafelyCreate(URLS.safe);
var s = document.createElement('script');
assert_throws(new TypeError(), _ => {
s.src = url;
});
assert_equals('', s.src);
}, "TrustedURL(safe)");
// TrustedScriptURL assignments work.
test(t => {
var url = TrustedScriptURL.unsafelyCreate(URLS.safe);
var s = document.createElement('script');
s.src = url;
assert_equals(url + '', s.src);
}, "TrustedScriptURL(safe)");
test(t => {
var url = TrustedScriptURL.unsafelyCreate(URLS.javascript);
var s = document.createElement('script');
s.src = url;
assert_equals(url + '', s.src);
}, "TrustedScriptURL(javascript)");
test(t => {
var url = TrustedScriptURL.unsafelyCreate(URLS.external);
var s = document.createElement('script');
s.src = url;
assert_equals(url + '', s.src);
}, "TrustedScriptURL(external)");
</script>

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

@ -1,33 +0,0 @@
<!DOCTYPE html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="./support/helper.sub.js"></script>
<meta http-equiv="Content-Security-Policy" content="require-trusted-types">
<body>
<script>
//URL assignments don't throw
test(t => {
var url = TrustedURL.create(URLS.safe);
var d = document.createElement('track');
d.src = url;
assert_equals("" + d.src, URLS.safe);
}, "src = TrustedURL.create().");
test(t => {
var url = TrustedURL.unsafelyCreate(URLS.safe);
var d = document.createElement('track');
d.src = url;
assert_equals("" + d.src, URLS.safe);
}, "src = TrustedURL.unsafelyCreate().");
//String assignment throws
test(t => {
var d = document.createElement('track');
assert_throws(new TypeError(), _ => {
d.src = "Fail.";
});
}, "'src = string' throws.");
</script>

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

@ -1,30 +0,0 @@
<!DOCTYPE html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="./support/helper.sub.js"></script>
<body>
<script>
test(t => {
var url = TrustedScriptURL.unsafelyCreate(URLS.safe);
var s = document.createElement('embed');
s.src = url;
assert_equals(url + '', s.src);
}, "src = TrustedScriptURL.unsafelyCreate(URLS.safe)");
test(t => {
var url = TrustedScriptURL.unsafelyCreate(URLS.javascript);
var s = document.createElement('embed');
s.src = url;
assert_equals(url + '', s.src);
}, "src = TrustedScriptURL.unsafelyCreate(URLS.javascript)");
test(t => {
var url = TrustedScriptURL.unsafelyCreate(URLS.external);
var s = document.createElement('embed');
s.src = url;
assert_equals(url + '', s.src);
}, "src = TrustedScriptURL.unsafelyCreate(URLS.external)");
</script>

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

@ -1,23 +0,0 @@
<!DOCTYPE html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="./support/helper.sub.js"></script>
<body>
<script>
test(t => {
var url = TrustedURL.create(URLS.safe);
var d = document.createElement('frame');
d.src = url;
assert_equals("" + d.src, URLS.safe);
}, "src = TrustedURL.create().");
test(t => {
var url = TrustedURL.unsafelyCreate(URLS.safe);
var d = document.createElement('frame');
d.src = url;
assert_equals("" + d.src, URLS.safe);
}, "src = TrustedURL.unsafelyCreate().");
</script>

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

@ -1,23 +0,0 @@
<!DOCTYPE html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="./support/helper.sub.js"></script>
<body>
<script>
test(t => {
var url = TrustedURL.create(URLS.safe);
var d = document.createElement('input');
d.src = url;
assert_equals("" + d.src, URLS.safe);
}, "src = TrustedURL.create().");
test(t => {
var url = TrustedURL.unsafelyCreate(URLS.safe);
var d = document.createElement('input');
d.src = url;
assert_equals("" + d.src, URLS.safe);
}, "src = TrustedURL.unsafelyCreate().");
</script>

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

@ -1,30 +0,0 @@
<!DOCTYPE html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="support/helper.sub.js"></script>
<body>
<script>
test(t => {
var url = TrustedScriptURL.unsafelyCreate(URLS.safe);
var s = document.createElement('script');
s.src = url;
assert_equals(url + '', s.src);
});
test(t => {
var url = TrustedScriptURL.unsafelyCreate(URLS.javascript);
var s = document.createElement('script');
s.src = url;
assert_equals(url + '', s.src);
});
test(t => {
var url = TrustedScriptURL.unsafelyCreate(URLS.external);
var s = document.createElement('script');
s.src = url;
assert_equals(url + '', s.src);
});
</script>

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

@ -45,3 +45,31 @@ function createFrameAndHref(href) {
document.body.appendChild(i); document.body.appendChild(i);
}); });
} }
let trustedHTML = TrustedHTML.escape(STRINGS.unescapedHTML);
function assert_accepts_trusted_html(tag, attribute) {
let elem = document.createElement(tag);
elem[attribute] = trustedHTML;
assert_equals(elem[attribute] + "", STRINGS.unescapedHTML);
}
let trustedURL = TrustedURL.create(URLS.safe);
function assert_accepts_trusted_url(tag, attribute) {
let elem = document.createElement(tag);
elem[attribute] = trustedURL;
assert_equals(elem[attribute] + "", URLS.safe);
}
let trustedScriptURL = TrustedScriptURL.unsafelyCreate(URLS.safe);
function assert_accepts_trusted_script_url(tag, attribute) {
let elem = document.createElement(tag);
elem[attribute] = trustedScriptURL;
assert_equals(elem[attribute] + "", URLS.safe);
}
function assert_throws_no_trusted_type(tag, attribute, value) {
let elem = document.createElement(tag);
assert_throws(new TypeError(), _ => {
elem[attribute] = value;
});
}

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

@ -1,23 +0,0 @@
<!DOCTYPE html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="./support/helper.sub.js"></script>
<body>
<script>
test(t => {
var url = TrustedURL.create(URLS.safe);
var d = document.createElement('track');
d.src = url;
assert_equals("" + d.src, URLS.safe);
}, "src = TrustedURL.create().");
test(t => {
var url = TrustedURL.unsafelyCreate(URLS.safe);
var d = document.createElement('track');
d.src = url;
assert_equals("" + d.src, URLS.safe);
}, "src = TrustedURL.unsafelyCreate().");
</script>