Update web-platform-tests to revision e4c65276b686cd788b2c4f8c395025df371e84a1

This commit is contained in:
WPT Sync Bot 2019-10-12 10:24:51 +00:00
parent a84d4ab755
commit 6edbabc2c6
68 changed files with 661 additions and 354 deletions

View file

@ -7,7 +7,7 @@
expected: FAIL
[Opening a blob URL in a new window immediately before revoking it works.]
expected: FAIL
expected: TIMEOUT
[Opening a blob URL in a noopener about:blank window immediately before revoking it works.]
expected: FAIL

View file

@ -275316,6 +275316,9 @@
"mediasession/README.md": [
[]
],
"mediasession/helper/artwork-generator.html": [
[]
],
"mimesniff/META.yml": [
[]
],
@ -319327,6 +319330,18 @@
{}
]
],
"css/css-grid/layout-algorithm/grid-flex-track-intrinsic-sizes-001.html": [
[
"css/css-grid/layout-algorithm/grid-flex-track-intrinsic-sizes-001.html",
{}
]
],
"css/css-grid/layout-algorithm/grid-flex-track-intrinsic-sizes-002.html": [
[
"css/css-grid/layout-algorithm/grid-flex-track-intrinsic-sizes-002.html",
{}
]
],
"css/css-grid/layout-algorithm/grid-intrinsic-size-with-orthogonal-items.html": [
[
"css/css-grid/layout-algorithm/grid-intrinsic-size-with-orthogonal-items.html",
@ -454617,7 +454632,7 @@
"support"
],
".github/workflows/documentation.yml": [
"8b892ba88ea010e01ae688aa1770a19fb0707ea8",
"400722f792190a6ec8d8d0b24977d70bfec79aa9",
"support"
],
".github/workflows/manifest.yml": [
@ -573916,6 +573931,14 @@
"ab55502487328d11ac153440fec4963e6e70709c",
"testharness"
],
"css/css-grid/layout-algorithm/grid-flex-track-intrinsic-sizes-001.html": [
"a478f9ace23f0488a60e2ea1e4f2da8ff81221cd",
"testharness"
],
"css/css-grid/layout-algorithm/grid-flex-track-intrinsic-sizes-002.html": [
"ef5f1ae10932935e990bd83bc8b33e9e88d49fa3",
"testharness"
],
"css/css-grid/layout-algorithm/grid-intrinsic-size-with-orthogonal-items.html": [
"1097956647846dd2493ab5d1c3458660c67868de",
"testharness"
@ -596669,7 +596692,7 @@
"testharness"
],
"css/css-transforms/parsing/transform-valid.html": [
"7879bd686a6f32b76947c1ffee6f8aff4c2c4db2",
"8237a9a4a6882dd0ec3495464c8fbfb7f52e65d3",
"testharness"
],
"css/css-transforms/parsing/translate-parsing-invalid.html": [
@ -609073,7 +609096,7 @@
"reftest"
],
"css/css-writing-modes/normal-flow-overconstrained-vlr-005.xht": [
"2754e2454765ef9aebbf697807ece3729f2c0226",
"a443db4e83000c70c65a8dc46a8deb9216c1bf28",
"reftest"
],
"css/css-writing-modes/normal-flow-overconstrained-vrl-002.xht": [
@ -609081,7 +609104,7 @@
"reftest"
],
"css/css-writing-modes/normal-flow-overconstrained-vrl-004.xht": [
"472405d1efa86950dfc0f0134802dabe76f1c5de",
"d084c2c6a94bd934f96d6cc13f26ded361eb5628",
"reftest"
],
"css/css-writing-modes/ortho-htb-alongside-vrl-floats-002-ref.xht": [
@ -658501,7 +658524,7 @@
"support"
],
"interfaces/cookie-store.idl": [
"c3204b2515a2000ca9be0cf6b4f6732e0ddc63a1",
"3e1a90ab63f5fc4afa36db8dda9fa1174236e26b",
"support"
],
"interfaces/cors-rfc1918.idl": [
@ -658581,7 +658604,7 @@
"support"
],
"interfaces/cssom-view.idl": [
"5d30ede1e40debc56ab71ba58a7ddec0ba5b40cf",
"34036484195e28b3068c9ef09f44acd0bed6bda9",
"support"
],
"interfaces/cssom.idl": [
@ -662172,12 +662195,16 @@
"7c7c9f8d57a46ae310b1a63df7c6117f89b56d63",
"support"
],
"mediasession/helper/artwork-generator.html": [
"5a2fbb151d9b4eec6f6dc16fc12d8708e01e25d9",
"support"
],
"mediasession/idlharness.window.js": [
"e4d914544ed5df95b20287f8bd5482fdd7fe1045",
"testharness"
],
"mediasession/mediametadata.html": [
"e545e732ddabb27bdc14aef7a28e025b4cc15ca7",
"11f6a5f9767248b9dbec50a36d39dabb392e48aa",
"testharness"
],
"mediasession/playbackstate.html": [
@ -687957,7 +687984,7 @@
"support"
],
"scroll-to-text-fragment/scroll-to-text-fragment.html": [
"85f07f38229404e45f0afbb413ea950241238ff4",
"e05210f1ea06e3f7676cc86392c6eb5b3d1d8837",
"testharness"
],
"secure-contexts/META.yml": [
@ -698269,7 +698296,7 @@
"support"
],
"tools/ci/website_build.sh": [
"e99fcb0cc9fb8b7451301a1e2d318daa631baf62",
"d23829f0bcdab7cd4c3b966c8a3fea711737a0d8",
"support"
],
"tools/conftest.py": [
@ -704233,7 +704260,7 @@
"support"
],
"trusted-types/Node-multiple-arguments.tentative.html": [
"062c26d653c344b902e48744a0b54f72af816fc6",
"e3e4a2635e9820c762ca0c10ccd54e244e7bb499",
"testharness"
],
"trusted-types/Range-createContextualFragment.tentative.html": [
@ -704241,67 +704268,67 @@
"testharness"
],
"trusted-types/TrustedTypePolicy-CSP-no-name.tentative.html": [
"2dfec26f5a0432e19fdbd139dadd3908b8acac3f",
"18819b20894644094684df6ca48d7e5a5b762d8e",
"testharness"
],
"trusted-types/TrustedTypePolicy-CSP-wildcard.tentative.html": [
"22b87965614fd16d280d5a97f9150d07ccca3d3e",
"0e97a4a245a9ef01e1c65f159a9bd300a93b903f",
"testharness"
],
"trusted-types/TrustedTypePolicy-CSP.tentative.html": [
"1293493ec1f7780b297d2040274150f0aba32adc",
"0b57c3a908a9a6218d45c4692ee6fd901e49328b",
"testharness"
],
"trusted-types/TrustedTypePolicy-createXXX.tentative.html": [
"a078af4b36bf295c1c3bc5814631e79779a3c73e",
"73ed8c72b23d5101f8e9e0f9867b1330aef0dc87",
"testharness"
],
"trusted-types/TrustedTypePolicy-name.tentative.html": [
"c121fe4cab50ab52a7159184bfa012e85d555768",
"4b7c30c855980ef2c4e5ab548a9b8def7991de77",
"testharness"
],
"trusted-types/TrustedTypePolicyFactory-constants.tentative.html": [
"f164e792345463ac658e925a0187fe9b3f21a127",
"001a6cea4813b0c7f720448d95690c63429405a6",
"testharness"
],
"trusted-types/TrustedTypePolicyFactory-createPolicy-createXYZTests.tentative.html": [
"8cdc837cba83ef6fa609556f4be453cdca1fc0a0",
"05c7301af7172165a6594e56eadc413cc6900977",
"testharness"
],
"trusted-types/TrustedTypePolicyFactory-createPolicy-cspTests-noNamesGiven.tentative.html": [
"2fc8f0122564190551de99ea1e47085a78fb7816",
"cec1bfb6041e525557c92f4cd7621c64f065654b",
"testharness"
],
"trusted-types/TrustedTypePolicyFactory-createPolicy-cspTests-wildcard.tentative.html": [
"7edc64be314a58b81d9d77f69a920faad598d0e0",
"f1b5f27e709bc1eb986f1a1160d0df0b5ec9a99d",
"testharness"
],
"trusted-types/TrustedTypePolicyFactory-createPolicy-cspTests.tentative.html": [
"1293493ec1f7780b297d2040274150f0aba32adc",
"0b57c3a908a9a6218d45c4692ee6fd901e49328b",
"testharness"
],
"trusted-types/TrustedTypePolicyFactory-createPolicy-nameTests.tentative.html": [
"6d43e0bafc61f34c17d7d7b751bf69f12d035adf",
"e0aa53756d6a23fd99d0469104ca061bf7831398",
"testharness"
],
"trusted-types/TrustedTypePolicyFactory-defaultPolicy.tentative.html": [
"ea00566854d12cbd6d2610aafdac44fd549ffbe7",
"7ac09d8bb96c0ef163590db1552012651648b68b",
"testharness"
],
"trusted-types/TrustedTypePolicyFactory-getPropertyType.tentative.html": [
"90fc7d5566d8d74dd70b7ff74a349dc424b4cdf8",
"f9ba8f2782209df2362c902d5666dbbf4bba34f8",
"testharness"
],
"trusted-types/TrustedTypePolicyFactory-isXXX.tentative.html": [
"854f69ed1e550bd660b8cf7a18b4a81a666072fd",
"efaac5d90d8f07f79f89aa72e633294a60487018",
"testharness"
],
"trusted-types/TrustedTypePolicyFactory-metadata.tentative.html": [
"694e4d2660fce5c3b89e457023ea147c84d67834",
"70f77b1bb552c3e1f9069b8847a2231aa5b19d48",
"testharness"
],
"trusted-types/Window-TrustedTypes.tentative.html": [
"5bbb4356c21d249a21c8204aad6c9ba7a353cb4e",
"c61d9207b65f430b08c6801a5ffc04d3d0efedd1",
"testharness"
],
"trusted-types/Window-open.tentative.html": [
@ -704309,11 +704336,11 @@
"testharness"
],
"trusted-types/WorkerGlobalScope-importScripts.https.html": [
"6ae52639d1dc0d5b303cb4cdb6fb727481234be9",
"9dbfd7b93c97abda7beff52e2e9afebefe518f29",
"testharness"
],
"trusted-types/block-Node-multiple-arguments.tentative.html": [
"f84998d4c54ce0d33b19aa3df1e1658d2ba2e655",
"5552e1313728c9688b7dfa32a9ee2bea38faa151",
"testharness"
],
"trusted-types/block-eval.tentative.html": [
@ -704321,27 +704348,27 @@
"testharness"
],
"trusted-types/block-string-assignment-to-DOMParser-parseFromString.tentative.html": [
"4446a58836695355efd0fbf3f9f5a0bd6c60c8a3",
"82e31200e6ba5150672e28a898d70d71486ada8a",
"testharness"
],
"trusted-types/block-string-assignment-to-DOMWindowTimers-setTimeout-setInterval.tentative.html": [
"2554ce635607ba06df3d975a0437b0862a30d799",
"468ed7b6975194ffde6b4106b0d78f5b99ca24ee",
"testharness"
],
"trusted-types/block-string-assignment-to-Document-write.tentative.html": [
"845df475fa0c8833c63b4db7992cde1a804635f9",
"4defb56c88ed763bf65c3f45e16a7d56234b7970",
"testharness"
],
"trusted-types/block-string-assignment-to-Element-insertAdjacentHTML.tentative.html": [
"ae1ace69bf85853d0f1c3db333e4507ac1896073",
"37a73f08c20a297a74bd7025906444a1083cb0c1",
"testharness"
],
"trusted-types/block-string-assignment-to-Element-outerHTML.tentative.html": [
"945e3dd2a79b026ad35f379deece04c19eb89d8c",
"8f314a26bf5d522276864abdc989a403afdfd170",
"testharness"
],
"trusted-types/block-string-assignment-to-Element-setAttribute.tentative.html": [
"d77d9dab58681658d04a7b55d1f340da8f684bfa",
"3cae5d29b445ec452d6832c062bf6ce59a54242f",
"testharness"
],
"trusted-types/block-string-assignment-to-Element-setAttributeNS.tentative.html": [
@ -704349,27 +704376,27 @@
"testharness"
],
"trusted-types/block-string-assignment-to-HTMLElement-generic.tentative.html": [
"fe27d45d08a2d8f9a98e44c3d0244230f343954d",
"89d1216d27e2dcf27ad5faa941e224cc495e9363",
"testharness"
],
"trusted-types/block-string-assignment-to-Location-assign.tentative.html": [
"4c295ffa284acb21436f06ecbf06ac4073365efe",
"8e89d0d1a6044a354011ed904a621fc519e619ed",
"testharness"
],
"trusted-types/block-string-assignment-to-Location-href.tentative.html": [
"86bce7994d6e9e43bddc590519126f4ee266cf06",
"998ee21f3456a8a59692774d057bddba349ee15f",
"testharness"
],
"trusted-types/block-string-assignment-to-Location-replace.tentative.html": [
"aa3af64e12b1d2b296e8dedd40b9cef749b1431c",
"e85bb646fc96f2eafbe2c1953633ebcd59212641",
"testharness"
],
"trusted-types/block-string-assignment-to-Range-createContextualFragment.tentative.html": [
"4919b7fd4de8dcbe66daa87fdd1285dd96d4580d",
"61553eb71dfcf4a49e580450602aabcc3e515282",
"testharness"
],
"trusted-types/block-string-assignment-to-Window-open.tentative.html": [
"c66a16d5c00535c3def556afc5daff3a7614c62c",
"e9c1c79050be5c0d28ea6927e9f8285da11b973d",
"testharness"
],
"trusted-types/block-text-node-insertion-into-script-element.tentative.html": [
@ -704377,7 +704404,7 @@
"testharness"
],
"trusted-types/default-policy-report-only.tentative.html": [
"1170655c5f53088e6ff0815c98175af81f5bd1d2",
"1a54fd6232917415338e3fac3f622f929a4432f8",
"testharness"
],
"trusted-types/default-policy-report-only.tentative.html.headers": [
@ -704385,7 +704412,7 @@
"support"
],
"trusted-types/default-policy.tentative.html": [
"68e05c1305b0a55b73871cb3ab72f1b534a37c5e",
"672eccfb430b404f8d13e8fb3ec8ea8408d4a70c",
"testharness"
],
"trusted-types/default-policy.tentative.html.headers": [
@ -704393,15 +704420,15 @@
"support"
],
"trusted-types/eval-with-permissive-csp.tentative.html": [
"25b4948c039c68c425e22f5e30ae4338327b6ce2",
"074fe79dc93fee6563bcb9ce2db3fa708bf4ad4f",
"testharness"
],
"trusted-types/idlharness.window.js": [
"de13697764ed487060de3dd425cd39cba73ff13b",
"4c1ee6e04a36971593eea7e89841d147a4febcd5",
"testharness"
],
"trusted-types/support/WorkerGlobalScope-importScripts.https.js": [
"8665c695c92137147193cfed075083e2de15cd90",
"fa63c8bad0fcd9f93d89c8c3bea2d8a0b59d2094",
"support"
],
"trusted-types/support/WorkerGlobalScope-importScripts.https.js.headers": [
@ -704409,7 +704436,7 @@
"support"
],
"trusted-types/support/helper.sub.js": [
"36ee24046ed283fc294978ada74168c515d3e17f",
"d63ff54ad60d40045da5bbe864458688c0554dbc",
"support"
],
"trusted-types/support/worker.js": [
@ -704417,7 +704444,7 @@
"support"
],
"trusted-types/trusted-types-eval-reporting-no-unsafe-eval.tentative.https.html": [
"dc8653617504f5ed895789cff92c2553dce972e7",
"e15ecfaa86c5b48dcc3aa9903ab7b0ab89af8474",
"testharness"
],
"trusted-types/trusted-types-eval-reporting-no-unsafe-eval.tentative.https.html.headers": [
@ -704425,7 +704452,7 @@
"support"
],
"trusted-types/trusted-types-eval-reporting-report-only.tentative.https.html": [
"1fb65459468d96f86e4a467aa8da2f3be489ae31",
"bd8933a48355f46f1973764874e017b263df197c",
"testharness"
],
"trusted-types/trusted-types-eval-reporting-report-only.tentative.https.html.headers": [
@ -704433,7 +704460,7 @@
"support"
],
"trusted-types/trusted-types-eval-reporting.tentative.https.html": [
"4ec5db1adce7478cc3e97f942a9de68f1263d31d",
"c751ae1330cd01cfb1c4b21d0a676576656837b2",
"testharness"
],
"trusted-types/trusted-types-eval-reporting.tentative.https.html.headers": [
@ -704441,7 +704468,7 @@
"support"
],
"trusted-types/trusted-types-report-only.tentative.https.html": [
"f33183b4906975f03ebb3f3a21adb63839c89adb",
"1a17d529fd158db853af547c55de675bf71f194e",
"testharness"
],
"trusted-types/trusted-types-report-only.tentative.https.html.headers": [
@ -704449,7 +704476,7 @@
"support"
],
"trusted-types/trusted-types-reporting-check-report.https.html": [
"111907788d279a722aced631dc19b20afb6f0285",
"fc98f5cbc586e4238dbf1c8dc20b74105693bec4",
"testharness"
],
"trusted-types/trusted-types-reporting-check-report.https.html.sub.headers": [
@ -704457,7 +704484,7 @@
"support"
],
"trusted-types/trusted-types-reporting.tentative.https.html": [
"0104ba358058199a77f1af5afb27e3255da8da64",
"6a79fec07b6626c87a22a3b1c4e778a33c975e67",
"testharness"
],
"trusted-types/trusted-types-reporting.tentative.https.html.headers": [
@ -710049,7 +710076,7 @@
"testharness"
],
"web-nfc/NDEFRecord_constructor.https.html": [
"aa3de01509c12b9ec1fba7b17d59abb633e932f0",
"7a0da33a54370dda699546553c0b18ced937a91c",
"testharness"
],
"web-nfc/NFCErrorEvent_constructor.https.html": [
@ -710057,7 +710084,7 @@
"testharness"
],
"web-nfc/NFCReader_options.https.html": [
"8b38f558a0a8fb03afac573bd8f39820f37cc4fa",
"5761747f907fad40873023f8ba746bef19fb08e7",
"testharness"
],
"web-nfc/NFCReader_scan.https.html": [
@ -710069,7 +710096,7 @@
"testharness"
],
"web-nfc/NFCWriter_push.https.html": [
"50a230344a14c372854df93e3c29815156e855dc",
"dda160f159a23223c0910d2393ecbc8c8e38aed1",
"testharness"
],
"web-nfc/README.md": [

View file

@ -324,15 +324,9 @@
[<iframe>: separate response Content-Type: text/html;" \\" text/plain]
expected: FAIL
[<iframe>: combined response Content-Type: text/html;" text/plain]
expected: FAIL
[<iframe>: separate response Content-Type: text/html */*;charset=gbk]
expected: FAIL
[<iframe>: separate response Content-Type: text/html */*]
expected: FAIL
[<iframe>: separate response Content-Type: text/plain */*;charset=gbk]
[<iframe>: combined response Content-Type: text/html;x=" text/plain]
expected: FAIL

View file

@ -11,6 +11,3 @@
[X-Content-Type-Options%3A%20nosniff%0C]
expected: FAIL
[X-Content-Type-Options%3A%20%2Cnosniff]
expected: FAIL

View file

@ -1,4 +1,4 @@
[traverse_the_history_5.html]
[traverse_the_history_2.html]
[Multiple history traversals, last would be aborted]
expected: FAIL

View file

@ -0,0 +1,4 @@
[traverse_the_history_4.html]
[Multiple history traversals, last would be aborted]
expected: FAIL

View file

@ -1,4 +1,5 @@
[embedded-opener-remove-frame.html]
expected: CRASH
[opener and "removed" embedded documents]
expected: FAIL

View file

@ -1,10 +0,0 @@
[non-active-document.html]
[DOMParser]
expected: FAIL
[createHTMLDocument]
expected: FAIL
[<template>]
expected: FAIL

View file

@ -0,0 +1,7 @@
[toggleEvent.html]
[Calling open twice on 'details' fires only one toggle event]
expected: FAIL
[Setting open=true to opened 'details' element should not fire a toggle event at the 'details' element]
expected: FAIL

View file

@ -1,2 +0,0 @@
[Worker-constructor.html]
expected: ERROR

View file

@ -2,6 +2,10 @@ on:
push:
branches:
- master
paths:
- 'docs/**'
- 'resources/**'
- 'tools/**'
pull_request:
paths:
- 'docs/**'

View file

@ -0,0 +1,81 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>CSS Grid Layout Test: Intrinsic contribution of an item with flex tracks</title>
<link rel="author" title="Oriol Brufau" href="mailto:obrufau@igalia.com">
<link rel="help" href="https://drafts.csswg.org/css-grid/#algo-spanning-items" title="11.5.3 Increase sizes to accommodate spanning items crossing content-sized tracks">
<link rel="help" href="https://drafts.csswg.org/css-grid/#algo-spanning-flex-items" title="11.5.4 Increase sizes to accommodate spanning items crossing flexible tracks">
<meta name="assert" content="This test checks that the intrinsic contribution of a single grid item is distributed correctly among the tracks it spans when flexible tracks are involved.">
<style>
#grid {
display: grid;
width: 50px;
height: 50px;
border: solid;
}
#item {
width: 100px;
height: 100px;
background: blue;
}
</style>
<div id="log"></div>
<div id="grid">
<div id="item"></div>
</div>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../grid-definition/support/testing-utils.js"></script>
<script>
const item = document.getElementById("item");
function checkTrackSizes(span, trackList, expected) {
item.style.gridColumn = item.style.gridRow = `span ${span}`;
TestingUtils.testGridTemplateColumnsRows("grid", trackList, trackList, expected, expected);
}
// Item spanning an intrinsic flexible track
checkTrackSizes(1, "0fr", "100px");
checkTrackSizes(1, "1fr", "100px");
checkTrackSizes(1, "2fr", "100px");
// Item spanning a fixed flexible track
checkTrackSizes(1, "minmax(0, 0fr)", "0px");
checkTrackSizes(1, "minmax(0, .5fr)", "25px");
checkTrackSizes(1, "minmax(0, 1fr)", "50px");
checkTrackSizes(1, "minmax(0, 2fr)", "50px");
checkTrackSizes(1, "minmax(75px, 1fr)", "75px");
// Item spanning 2 intrinsic flexible tracks
checkTrackSizes(2, "0fr 0fr", "50px 50px");
checkTrackSizes(2, "0fr 1fr", "0px 100px");
checkTrackSizes(2, "1fr 0fr", "100px 0px");
checkTrackSizes(2, "1fr 1fr", "50px 50px");
checkTrackSizes(2, "1fr 3fr", "25px 75px");
checkTrackSizes(2, "0fr 0fr 1fr", "50px 50px 0px");
// Item spanning 2 fixed flexible tracks
checkTrackSizes(2, "minmax(0, 0fr) minmax(0, 0fr)", "0px 0px");
checkTrackSizes(2, "minmax(0, 0fr) minmax(0, 1fr)", "0px 50px");
checkTrackSizes(2, "minmax(15px, 0fr) minmax(0, 1fr)", "15px 35px");
checkTrackSizes(2, "minmax(20px, 1fr) minmax(0, 1fr)", "25px 25px");
checkTrackSizes(2, "minmax(30px, 1fr) minmax(0, 1fr)", "30px 20px");
// Item spanning an intrinsic flexible track and a fixed flexible track
checkTrackSizes(2, "0fr minmax(0, 0fr)", "100px 0px");
checkTrackSizes(2, "0fr minmax(0, 1fr)", "100px 0px");
checkTrackSizes(2, "1fr minmax(0, 1fr)", "100px 0px");
checkTrackSizes(2, "1fr minmax(25px, 1fr)", "75px 25px");
// Item spanning an intrinsic flexible track and an intrinsic non-flexible track
checkTrackSizes(2, "0fr auto", "100px 0px");
checkTrackSizes(2, "1fr auto", "100px 0px");
checkTrackSizes(2, "1fr max-content", "100px 0px");
// Item spanning a fixed flexible track and an intrinsic non-flexible track
checkTrackSizes(2, "minmax(0, 0fr) auto", "0px 100px");
checkTrackSizes(2, "minmax(0, 1fr) auto", "0px 100px");
checkTrackSizes(2, "minmax(25px, 0fr) auto", "25px 75px");
checkTrackSizes(2, "minmax(25px, 1fr) auto", "25px 75px");
</script>

View file

@ -0,0 +1,105 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>CSS Grid Layout Test: Intrinsic contributions of 2 items with flex tracks</title>
<link rel="author" title="Oriol Brufau" href="mailto:obrufau@igalia.com">
<link rel="help" href="https://drafts.csswg.org/css-grid/#algo-spanning-items" title="11.5.3 Increase sizes to accommodate spanning items crossing content-sized tracks">
<link rel="help" href="https://drafts.csswg.org/css-grid/#algo-spanning-flex-items" title="11.5.4 Increase sizes to accommodate spanning items crossing flexible tracks">
<meta name="assert" content="This test checks that the intrinsic contributions of 2 items are distributed in the right order when flexible tracks are involved.">
<style>
#grid {
display: grid;
grid-template-areas: ". . . ."
". a . ."
". . . ."
". . . b";
width: 50px;
height: 50px;
border: solid;
}
#item1 {
grid-column: 1 / a;
grid-row: 1 / a;
width: 60px;
height: 60px;
background: blue;
}
#item2 {
grid-column: a / b;
grid-row: a / b;
width: 150px;
height: 150px;
background: yellow;
}
</style>
<div id="log"></div>
<div id="grid">
<div id="item1"></div>
<div id="item2"></div>
</div>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../grid-definition/support/testing-utils.js"></script>
<script>
function checkTrackSizes(trackList, expected) {
TestingUtils.testGridTemplateColumnsRows("grid", trackList, trackList, expected, expected);
}
// We have a symmetric grid with 2 items and 4 tracks, as follows:
// ╔═╤═╗─┬─┐
// ╟─╔═╬═╪═╗
// ╚═╬═╝─┼─╢
// ├─╫─┼─┼─╢
// └─╚═╧═╧═╝
// The 1st item has spans less tracks (2) than the 2nd item (3),
// therefore its contribution (60px) is distributed first.
// All the 60px go to the 2nd track, since the 1st track is not intrinsic.
// Then the 2nd item only needs to distribute 150px-60px=90px
// among the 3rd and 4th tracks.
checkTrackSizes("minmax(0, 1fr) auto auto auto", "0px 60px 45px 45px");
// The 1st item now spans a flexible track with an intrinsic minimum,
// therefore its contribution (60px) is distributed last.
// The 2nd item distributes its contribution (150px) among the 2nd, 3rd and 4th tracks.
// Then the 1st item only needs to distribute 60px-50px=10px to the 1st track.
checkTrackSizes("1fr auto auto auto", "10px 50px 50px 50px");
// Now both items span a flexible track with an intrinsic minimum,
// so their contributions are handled simultaneously,
// even if the 1st item still spans less tracks than the 2nd one.
// Therefore the distribution is as follows:
// - 1st track: 60px/2 = 30px
// - 2nd track: max(60px/2, 150px/3) = 50px
// - 3rd track: 150px/3 = 50px
// - 4th track: 150px/3 = 50px
checkTrackSizes("1fr 1fr 1fr 1fr", "30px 50px 50px 50px");
// Like the previous case, but with different flex ratios:
// - 1st track: 60px/2 = 30px
// - 2nd track: max(60px/2, 150px/6) = 30px
// - 3rd track: 150px/6 = 25px
// - 4th track: 150px*4/6 = 100px
checkTrackSizes("1fr 1fr 1fr 4fr", "30px 30px 25px 100px");
// Change the grid as follows:
// ╔═╦═╤═╗
// ╠═╝─┼─╢
// ╟─┼─┼─╢
// ╚═╧═╧═╝
document.getElementById("grid").style.gridTemplateAreas = `
"a . ."
". . ."
". . b"`;
// Now the 1st item has a span of 1, so usually we would handle its contribution
// at the very beginning, before items that span multiple tracks.
// But not if its track is flexible, then it's still handled at the end,
// simultaneously with other items that span some intrinsic flexible track.
// - 1nd track: max(60px, 150px/3) = 60px
// - 2nd track: 150px/3 = 50px
// - 3rd track: 150px/3 = 50px
checkTrackSizes("1fr 1fr 1fr", "60px 50px 50px");
</script>

View file

@ -47,12 +47,6 @@ test_valid_value("transform", "skewY(0)", "skewY(0deg)");
test_valid_value("transform", "skewY(-90deg)");
test_valid_value("transform", "translate(1px, 2%) scale(3, 4) rotate(-90deg)");
// Regression test for crbug.com/995038
test_valid_value("transform", "translateX(2e80px)", "translateX(3.40282e+38px)");
test_valid_value("transform", "rotate(2e80deg)", "rotate(3.40282e+38deg)");
test_valid_value("transform", "scaleX(2e80)", "scaleX(3.40282e+38)");
test_valid_value("transform", "skewX(2e80deg)", "skewX(3.40282e+38deg)");
</script>
</body>
</html>

View file

@ -36,10 +36,6 @@
html
{
writing-mode: vertical-lr;
}
body#containing-block
{
background-image: url("support/bg-red-3col-2row-320x320.png");
background-position: 198px 8px;
/* first value represents the horizontal position and the second represents the vertical position */
@ -58,9 +54,12 @@
198px
*/
background-repeat: no-repeat;
}
#containing-block
{
direction: rtl;
height: 320px;
margin: 8px;
}
p
@ -70,7 +69,7 @@
margin-right: 16px;
}
div
#test
{
background-color: green;
margin-top: 160px;
@ -139,16 +138,16 @@ And so computed margin-top value must be 80px .
</head>
<body id="containing-block">
<p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
<!--
The image says:
Test passes if there is a filled
green square and <strong>no red</strong>.
-->
<div></div>
<body>
<div id="containing-block">
<p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
<!--
The image says:
Test passes if there is a filled
green square and <strong>no red</strong>.
-->
<div id="test"></div>
</div>
</body>
</html>

View file

@ -36,10 +36,6 @@
html
{
writing-mode: vertical-rl;
}
body#containing-block
{
background-image: url("support/bg-red-3col-2row-320x320.png");
background-position: -152px 8px;
/* first value represents the horizontal position and the second represents the vertical position */
@ -54,9 +50,11 @@
-152px
*/
background-repeat: no-repeat;
}
#containing-block
{
direction: rtl;
height: 320px;
margin: 8px;
}
p
@ -66,7 +64,7 @@
margin-right: 16px;
}
div
#test
{
background-color: green;
margin-top: 160px;
@ -135,16 +133,16 @@ And so computed margin-top value must be 80px .
</head>
<body id="containing-block">
<p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
<!--
The image says:
Test passes if there is a filled
green square and <strong>no red</strong>.
-->
<div></div>
<body>
<div id="containing-block">
<p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p>
<!--
The image says:
Test passes if there is a filled
green square and <strong>no red</strong>.
-->
<div id="test"></div>
</div>
</body>
</html>

View file

@ -43,7 +43,7 @@ dictionary CookieStoreGetOptions {
enum CookieSameSite {
"strict",
"lax",
"unrestricted"
"none"
};
dictionary CookieStoreSetOptions {

View file

@ -53,8 +53,8 @@ partial interface Window {
interface MediaQueryList : EventTarget {
readonly attribute CSSOMString media;
readonly attribute boolean matches;
void addListener(EventListener? listener);
void removeListener(EventListener? listener);
void addListener(EventListener? callback);
void removeListener(EventListener? callback);
attribute EventHandler onchange;
};

View file

@ -0,0 +1,18 @@
<!DOCTYPE html>
<title>MediaImage</title>
<script>
function createArtworkFromURLs(sources) {
let artwork = [];
for (const source of sources) {
artwork.push({
src: source
});
}
let metadata = new MediaMetadata({
artwork: artwork
});
return metadata.artwork;
}
</script>

View file

@ -4,6 +4,16 @@
<script src="/resources/testharnessreport.js"></script>
<script>
function load_iframe(src) {
return new Promise(resolve => {
const iframe = document.createElement('iframe');
iframe.onload = () => { resolve(iframe); };
iframe.src = src;
iframe.style.display = 'none';
document.documentElement.appendChild(iframe);
});
}
test(function() {
var metadata = new MediaMetadata({});
navigator.mediaSession.metadata = metadata;
@ -189,4 +199,21 @@ test(function() {
});
}, "Test that MediaImage.src is required")
promise_test(async t => {
const URLs = [
'http://example.com',
'../foo',
'./foo/bar',
'/foo/bar',
];
const subframe = await load_iframe('helper/artwork-generator.html');
// createArtworkFromURLs is a function in the subframe.
const artwork = subframe.contentWindow.createArtworkFromURLs(URLs);
assert_equals(artwork.length, URLs.length);
for (let i = 0 ; i < artwork.length ; ++i) {
assert_equals(artwork[i].src, new URL(URLs[i], document.URL).href);
}
}, 'Test that the base URL of MediaImage is the base URL of entry setting object');
</script>

View file

@ -8,24 +8,24 @@
<script>
let test_cases = [
{ fragment: '#', expect_position: 'top' },
{ fragment: '##targetText=test', expect_position: 'text' },
{ fragment: '##targetText=this,page', expect_position: 'text' },
{ fragment: '##targetText=this-,is,test', expect_position: 'text' },
{ fragment: '##targetText=this-,is,test,-page', expect_position: 'text' },
{ fragment: '##targetText=this-,is,page,-none', expect_position: 'top' },
{ fragment: '##targetText=this,test,-page', expect_position: 'text' },
{ fragment: '##targetText=this%20is%20a%20test%20page', expect_position: 'text' },
{ fragment: '##targetText=this&targetText=test,page', expect_position: 'text' },
{ fragment: '##targetText=tes&targetText=age', expect_position: 'top' },
{ fragment: '#pagestate##targetText=test', expect_position: 'text' },
{ fragment: '#pagestate##targetText=nomatch', expect_position: 'top' },
{ fragment: '#element##targetText=nomatch', expect_position: 'element' },
{ fragment: '#element##directive', expect_position: 'element' },
{ fragment: '#:~:text=test', expect_position: 'text' },
{ fragment: '#:~:text=this,page', expect_position: 'text' },
{ fragment: '#:~:text=this-,is,test', expect_position: 'text' },
{ fragment: '#:~:text=this-,is,test,-page', expect_position: 'text' },
{ fragment: '#:~:text=this-,is,page,-none', expect_position: 'top' },
{ fragment: '#:~:text=this,test,-page', expect_position: 'text' },
{ fragment: '#:~:text=this%20is%20a%20test%20page', expect_position: 'text' },
{ fragment: '#:~:text=this&text=test,page', expect_position: 'text' },
{ fragment: '#:~:text=tes&text=age', expect_position: 'top' },
{ fragment: '#pagestate:~:text=test', expect_position: 'text' },
{ fragment: '#pagestate:~:text=nomatch', expect_position: 'top' },
{ fragment: '#element:~:text=nomatch', expect_position: 'element' },
{ fragment: '#element:~:directive', expect_position: 'element' },
];
test(t => {
assert_equals(typeof(window.location.selector), 'object', 'window.location.selector is defined');
}, 'Scroll to text is feature detectable via window.location.selector');
assert_equals(typeof(window.location.fragmentDirective), 'object', 'window.location.fragmentDirective is defined');
}, 'Scroll to text is feature detectable via window.location.fragmentDirective');
for (const test_case of test_cases) {
promise_test(t => new Promise(resolve => {

View file

@ -25,20 +25,6 @@ function targets_master {
test $(json_property ${GITHUB_EVENT_PATH} ref) == 'refs/heads/master'
}
function modifies_relevant_files {
base_revision=$(json_property ${GITHUB_EVENT_PATH} before)
git diff --name-only ${base_revision} | \
grep -E --silent '^(docs|tools)/'
}
if ! modifies_relevant_files ; then
echo No files related to the website have been modified. Exiting without
echo building.
exit ${neutral_status}
fi
git config --global user.email "wpt-pr-bot@users.noreply.github.com"
git config --global user.name "wpt-pr-bot"

View file

@ -9,7 +9,7 @@
<div id="container"></div>
<script>
const container = document.querySelector("#container");
const policy = window.TrustedTypes.createPolicy("policy", {
const policy = window.trustedTypes.createPolicy("policy", {
createScript: t => t,
});
function stringify(arg) {

View file

@ -9,7 +9,7 @@
// No name given test
test(t => {
assert_throws(new TypeError(),
() => window.TrustedTypes.createPolicy('SomeName', { createHTML: s => s } ),
() => window.trustedTypes.createPolicy('SomeName', { createHTML: s => s } ),
"createPolicy with an empty trusted-types CSP directive");
}, "No name list given - policy creation fails.");
</script>

View file

@ -7,7 +7,7 @@
<body>
<script>
test(t => {
let policy = window.TrustedTypes.createPolicy('SomeName', { createHTML: s => s } );
let policy = window.trustedTypes.createPolicy('SomeName', { createHTML: s => s } );
assert_equals(policy.name, 'SomeName');
}, "CSP supports wildcards.");
</script>

View file

@ -8,20 +8,20 @@
<script>
// Whitelisted name test
test(t => {
let policy = window.TrustedTypes.createPolicy('SomeName', { createHTML: s => s } );
let policy = window.trustedTypes.createPolicy('SomeName', { createHTML: s => s } );
assert_equals(policy.name, 'SomeName');
}, "Whitelisted policy creation works.");
// Another whitelisted name test
test(t => {
let policy = window.TrustedTypes.createPolicy('JustOneMoreName', { createHTML: s => s } );
let policy = window.trustedTypes.createPolicy('JustOneMoreName', { createHTML: s => s } );
assert_equals(policy.name, 'JustOneMoreName');
}, "Another whitelisted policy creation works.");
// Non-whitelisted names test
test(t => {
assert_throws(new TypeError(), _ => {
window.TrustedTypes.createPolicy('SomeOtherName', { createURL: s => s } );
window.trustedTypes.createPolicy('SomeOtherName', { createURL: s => s } );
});
}, "Non-whitelisted policy creation throws.");
</script>

View file

@ -7,14 +7,14 @@
<body>
<script>
test(t => {
const p1 = TrustedTypes.createPolicy("policyHTMLAndScript", {
const p1 = trustedTypes.createPolicy("policyHTMLAndScript", {
createHTML: s => s,
createScript: s => s
});
assert_throws(new TypeError(), _ => { p1.createScriptURL("foo"); });
assert_throws(new TypeError(), _ => { p1.createURL("foo"); });
const p2 = TrustedTypes.createPolicy("policyURLAndScriptURL", {
const p2 = trustedTypes.createPolicy("policyURLAndScriptURL", {
createURL: s => s,
createScriptURL: s => s
});
@ -29,7 +29,7 @@
createURL: (s) => s,
createScript: (s) => s,
};
policy = TrustedTypes.createPolicy(Math.random(), noopPolicy, true);
policy = trustedTypes.createPolicy(Math.random(), noopPolicy, true);
let el = document.createElement("div");
el.title = policy.createHTML(INPUTS.URL);
@ -40,12 +40,12 @@
}, "Attributes without type constraints will work as before.");
test(t => {
const policy = TrustedTypes.createPolicy("nullpolicy", null);
const policy = trustedTypes.createPolicy("nullpolicy", null);
assert_throws(new TypeError(), _ => { policy.createScriptURL("foo"); });
assert_throws(new TypeError(), _ => { policy.createURL("foo"); });
assert_throws(new TypeError(), _ => { policy.createHTML("foo"); });
assert_throws(new TypeError(), _ => { policy.createScript("foo"); });
}, "TrustedTypes.createPolicy(.., null) creates empty policy.");
}, "trustedTypes.createPolicy(.., null) creates empty policy.");
// testCases contains a list of policy functions and expected results (when
@ -85,7 +85,7 @@
return function(name, fn) {
let options = {};
options[trustedMethodName] = fn;
let policy = window.TrustedTypes.createPolicy(name, options);
let policy = window.trustedTypes.createPolicy(name, options);
let result = policy[trustedMethodName](defaultArg);
assert_true(result instanceof trustedType);
return result;

View file

@ -8,7 +8,7 @@
<script>
// Policy name test
test(t => {
let policy = TrustedTypes.createPolicy('hidden', { createHTML: s => s }, false );
let policy = trustedTypes.createPolicy('hidden', { createHTML: s => s }, false );
assert_true(policy instanceof TrustedTypePolicy);
assert_equals(policy.name, 'hidden');
}, "policy.name = name");
@ -16,14 +16,14 @@
// Duplicate names test
test(t => {
assert_throws(new TypeError(), _ => {
TrustedTypes.createPolicy('hidden', { createURL: s => s } );
trustedTypes.createPolicy('hidden', { createURL: s => s } );
});
}, "duplicate policy name attempt throws");
// Retrieve policy names tests
test(t => {
let policy = TrustedTypes.createPolicy('exposed', { createURL: s => s }, true );
let names = TrustedTypes.getPolicyNames();
let policy = trustedTypes.createPolicy('exposed', { createURL: s => s }, true );
let names = trustedTypes.getPolicyNames();
assert_equals(names.length, 2);
assert_true(names.includes('hidden'));
assert_true(names.includes('exposed'));

View file

@ -7,20 +7,20 @@
<body>
<script>
test(t => {
const empty = TrustedTypes.emptyHTML;
assert_true(TrustedTypes.isHTML(empty));
const empty = trustedTypes.emptyHTML;
assert_true(trustedTypes.isHTML(empty));
assert_equals(empty.toString(), "");
}, 'TrustedTypes.emptyHTML returns the intended value.');
}, 'trustedTypes.emptyHTML returns the intended value.');
test(t => {
try { TrustedTypes.emptyHTML = 'fake'; } catch { }
assert_true(TrustedTypes.isHTML(TrustedTypes.emptyHTML));
assert_equals(TrustedTypes.emptyHTML.toString(), "");
}, 'TrustedTypes.emptyHTML cannot be redefined.');
try { trustedTypes.emptyHTML = 'fake'; } catch { }
assert_true(trustedTypes.isHTML(trustedTypes.emptyHTML));
assert_equals(trustedTypes.emptyHTML.toString(), "");
}, 'trustedTypes.emptyHTML cannot be redefined.');
test(t => {
try { Object.defineProperty(TrustedTypes, 'emptyHTML', 'fake'); } catch { }
assert_true(TrustedTypes.isHTML(TrustedTypes.emptyHTML));
assert_equals(TrustedTypes.emptyHTML.toString(), "");
}, 'TrustedTypes.emptyHTML cannot be redefined via defineProperty.');
assert_true(trustedTypes.isHTML(trustedTypes.emptyHTML));
assert_equals(trustedTypes.emptyHTML.toString(), "");
}, 'trustedTypes.emptyHTML cannot be redefined via defineProperty.');
</script>

View file

@ -6,10 +6,10 @@
<script>
//HTML tests
function createHTMLTest(policyName, policy, expectedHTML, t) {
let p = window.TrustedTypes.createPolicy(policyName, policy);
let p = window.trustedTypes.createPolicy(policyName, policy);
let html = p.createHTML('whatever');
assert_true(html instanceof TrustedHTML);
assert_true(TrustedTypes.isHTML(html));
assert_true(trustedTypes.isHTML(html));
assert_equals(html + "", expectedHTML);
}
@ -33,7 +33,7 @@
}, "html = identity function, global string changed");
test(t => {
let p = window.TrustedTypes.createPolicy('TestPolicyHTML5', { createHTML: s => { throw new Error(); }});
let p = window.trustedTypes.createPolicy('TestPolicyHTML5', { createHTML: s => { throw new Error(); }});
assert_throws(new Error(), _ => {
p.createHTML('whatever');
});
@ -57,14 +57,14 @@
}, "html = this without bind");
test(t => {
let p = window.TrustedTypes.createPolicy('TestPolicyHTML8', null);
let p = window.trustedTypes.createPolicy('TestPolicyHTML8', null);
assert_throws(new TypeError(), _ => {
p.createHTML('whatever');
});
}, "html - calling undefined callback throws");
test(t => {
let p = window.TrustedTypes.createPolicy('TestPolicyHTML9', { createHTML: createHTMLJS });
let p = window.trustedTypes.createPolicy('TestPolicyHTML9', { createHTML: createHTMLJS });
assert_throws(new TypeError(), _ => {
p.createScript(INPUTS.SCRIPT);
});
@ -78,10 +78,10 @@
//Script tests
function createScriptTest(policyName, policy, expectedScript, t) {
let p = window.TrustedTypes.createPolicy(policyName, policy);
let p = window.trustedTypes.createPolicy(policyName, policy);
let script = p.createScript('whatever');
assert_true(script instanceof TrustedScript);
assert_true(TrustedTypes.isScript(script));
assert_true(trustedTypes.isScript(script));
assert_equals(script + "", expectedScript);
}
@ -105,7 +105,7 @@
}, "script = identity function, global string changed");
test(t => {
let p = window.TrustedTypes.createPolicy('TestPolicyScript5', {
let p = window.trustedTypes.createPolicy('TestPolicyScript5', {
createScript: s => { throw new Error(); }
});
assert_throws(new Error(), _ => {
@ -131,14 +131,14 @@
}, "script = this without bind");
test(t => {
let p = window.TrustedTypes.createPolicy('TestPolicyScript8', null);
let p = window.trustedTypes.createPolicy('TestPolicyScript8', null);
assert_throws(new TypeError(), _ => {
p.createScript('whatever');
});
}, "script - calling undefined callback throws");
test(t => {
let p = window.TrustedTypes.createPolicy('TestPolicyScript9', { createScript: createScriptJS });
let p = window.trustedTypes.createPolicy('TestPolicyScript9', { createScript: createScriptJS });
assert_throws(new TypeError(), _ => {
p.createHTML(INPUTS.HTML);
});
@ -153,10 +153,10 @@
//ScriptURL tests
function createScriptURLTest(policyName, policy, expectedScriptURL, t) {
let p = window.TrustedTypes.createPolicy(policyName, policy);
let p = window.trustedTypes.createPolicy(policyName, policy);
let scriptUrl = p.createScriptURL(INPUTS.SCRIPTURL);
assert_true(scriptUrl instanceof TrustedScriptURL);
assert_true(TrustedTypes.isScriptURL(scriptUrl));
assert_true(trustedTypes.isScriptURL(scriptUrl));
assert_equals(scriptUrl + "", expectedScriptURL);
}
@ -180,7 +180,7 @@
}, "script_url = identity function, global string changed");
test(t => {
let p = window.TrustedTypes.createPolicy('TestPolicyScriptURL5', {
let p = window.trustedTypes.createPolicy('TestPolicyScriptURL5', {
createScriptURL: s => { throw new Error(); }
});
assert_throws(new Error(), _ => {
@ -206,14 +206,14 @@
}, "script_url = this without bind");
test(t => {
let p = window.TrustedTypes.createPolicy('TestPolicyScriptURL8', null);
let p = window.trustedTypes.createPolicy('TestPolicyScriptURL8', null);
assert_throws(new TypeError(), _ => {
p.createScriptURL(INPUTS.SCRIPTURL);
});
}, "script_url - calling undefined callback throws");
test(t => {
let p = window.TrustedTypes.createPolicy('TestPolicyScriptURL9', { createScriptURL: createScriptURLJS });
let p = window.trustedTypes.createPolicy('TestPolicyScriptURL9', { createScriptURL: createScriptURLJS });
assert_throws(new TypeError(), _ => {
p.createHTML(INPUTS.HTML);
});
@ -228,10 +228,10 @@
//URL tests
function createURLTest(policyName, policy, expectedURL, t) {
let p = window.TrustedTypes.createPolicy(policyName, policy);
let p = window.trustedTypes.createPolicy(policyName, policy);
let url = p.createURL(INPUTS.URL);
assert_true(url instanceof TrustedURL);
assert_true(TrustedTypes.isURL(url));
assert_true(trustedTypes.isURL(url));
assert_equals(url + "", expectedURL);
}
@ -255,7 +255,7 @@
}, "url = identity function, global string changed");
test(t => {
let p = window.TrustedTypes.createPolicy('TestPolicyURL5', {
let p = window.trustedTypes.createPolicy('TestPolicyURL5', {
createURL: s => { throw new Error(); }
});
assert_throws(new Error(), _ => {
@ -281,14 +281,14 @@
}, "url = this without bind");
test(t => {
let p = window.TrustedTypes.createPolicy('TestPolicyURL8', null);
let p = window.trustedTypes.createPolicy('TestPolicyURL8', null);
assert_throws(new TypeError(), _ => {
p.createURL(INPUTS.URL);
});
}, "url - calling undefined callback throws");
test(t => {
let p = window.TrustedTypes.createPolicy('TestPolicyURL9', { createURL: createURLJS });
let p = window.trustedTypes.createPolicy('TestPolicyURL9', { createURL: createURLJS });
assert_throws(new TypeError(), _ => {
p.createHTML(INPUTS.HTML);
});

View file

@ -8,7 +8,7 @@
//No name given test
test(t => {
assert_throws(new TypeError(), _ => {
window.TrustedTypes.createPolicy('SomeName', { createHTML: s => s } );
window.trustedTypes.createPolicy('SomeName', { createHTML: s => s } );
});
}, "No name list given - policy creation throws");
</script>

View file

@ -7,7 +7,7 @@
<script>
//No name given test
test(t => {
let policy = window.TrustedTypes.createPolicy('SomeName', { createHTML: s => s } );
let policy = window.trustedTypes.createPolicy('SomeName', { createHTML: s => s } );
assert_equals(policy.name, 'SomeName');
}, "Wildcard given - policy creation works");
</script>

View file

@ -8,20 +8,20 @@
<script>
// Whitelisted name test
test(t => {
let policy = window.TrustedTypes.createPolicy('SomeName', { createHTML: s => s } );
let policy = window.trustedTypes.createPolicy('SomeName', { createHTML: s => s } );
assert_equals(policy.name, 'SomeName');
}, "Whitelisted policy creation works.");
// Another whitelisted name test
test(t => {
let policy = window.TrustedTypes.createPolicy('JustOneMoreName', { createHTML: s => s } );
let policy = window.trustedTypes.createPolicy('JustOneMoreName', { createHTML: s => s } );
assert_equals(policy.name, 'JustOneMoreName');
}, "Another whitelisted policy creation works.");
// Non-whitelisted names test
test(t => {
assert_throws(new TypeError(), _ => {
window.TrustedTypes.createPolicy('SomeOtherName', { createURL: s => s } );
window.trustedTypes.createPolicy('SomeOtherName', { createURL: s => s } );
});
}, "Non-whitelisted policy creation throws.");
</script>

View file

@ -6,7 +6,7 @@
<script>
//Policy name test
test(t => {
let policy = window.TrustedTypes.createPolicy('SomeName', { createHTML: s => s } );
let policy = window.trustedTypes.createPolicy('SomeName', { createHTML: s => s } );
assert_true(policy instanceof TrustedTypePolicy);
assert_equals(policy.name, 'SomeName');
}, "policy.name = name");
@ -14,14 +14,14 @@
//Duplicate names test
test(t => {
assert_throws(new TypeError(), _ => {
window.TrustedTypes.createPolicy('SomeName', { createURL: s => s } );
window.trustedTypes.createPolicy('SomeName', { createURL: s => s } );
});
}, "duplicate policy name attempt throws");
//Retrieve policy names tests
test(t => {
let policy = window.TrustedTypes.createPolicy('SomeOtherName', { createURL: s => s } );
let names = window.TrustedTypes.getPolicyNames();
let policy = window.trustedTypes.createPolicy('SomeOtherName', { createURL: s => s } );
let names = window.trustedTypes.getPolicyNames();
assert_true(names.includes('SomeName'));
assert_true(names.includes('SomeOtherName'));
}, "Retrieving policy names");

View file

@ -5,20 +5,20 @@
<body>
<script>
test(t => {
assert_equals(window.TrustedTypes.defaultPolicy, null);
assert_equals(window.trustedTypes.defaultPolicy, null);
}, "defaultPolicy with no default created is not an error");
test(t => {
let policy = window.TrustedTypes.createPolicy('default', { createHTML: s => s } );
let policy = window.trustedTypes.createPolicy('default', { createHTML: s => s } );
assert_true(policy instanceof TrustedTypePolicy);
assert_equals(policy, window.TrustedTypes.defaultPolicy);
assert_equals(policy, window.trustedTypes.defaultPolicy);
}, "defaultPolicy returns the correct default policy");
test(t => {
let foo_policy = window.TrustedTypes.createPolicy('foo', { createHTML: s => s } );
let default_policy = window.TrustedTypes.defaultPolicy;
window.TrustedTypes.defaultPolicy = foo_policy;
assert_equals(window.TrustedTypes.defaultPolicy, default_policy);
assert_not_equals(window.TrustedTypes.defaultPolicy, foo_policy);
let foo_policy = window.trustedTypes.createPolicy('foo', { createHTML: s => s } );
let default_policy = window.trustedTypes.defaultPolicy;
window.trustedTypes.defaultPolicy = foo_policy;
assert_equals(window.trustedTypes.defaultPolicy, default_policy);
assert_not_equals(window.trustedTypes.defaultPolicy, foo_policy);
}, "defaultPolicy is a read-only property");
</script>

View file

@ -8,77 +8,77 @@
<div id="target"></div>
<script>
test(t => {
assert_equals(TrustedTypes.getPropertyType("a", "href"), "TrustedURL");
assert_equals(TrustedTypes.getPropertyType("a", "id"), null);
assert_equals(TrustedTypes.getPropertyType("a", "b"), null);
}, "sanity check TrustedTypes.getPropertyType for the HTML a element.");
assert_equals(trustedTypes.getPropertyType("a", "href"), "TrustedURL");
assert_equals(trustedTypes.getPropertyType("a", "id"), null);
assert_equals(trustedTypes.getPropertyType("a", "b"), null);
}, "sanity check trustedTypes.getPropertyType for the HTML a element.");
test(t => {
assert_equals(TrustedTypes.getAttributeType("img", "onerror"), "TrustedScript");
assert_equals(TrustedTypes.getAttributeType("img", "width"), null);
assert_equals(TrustedTypes.getAttributeType("img", "madeup"), null);
}, "sanity check TrustedTypes.getAttributeType.");
assert_equals(trustedTypes.getAttributeType("img", "onerror"), "TrustedScript");
assert_equals(trustedTypes.getAttributeType("img", "width"), null);
assert_equals(trustedTypes.getAttributeType("img", "madeup"), null);
}, "sanity check trustedTypes.getAttributeType.");
test(t => {
assert_true(!!TrustedTypes.getTypeMapping());
}, "sanity check TrustedTypes.getTypeMapping");
assert_true(!!trustedTypes.getTypeMapping());
}, "sanity check trustedTypes.getTypeMapping");
// getPropertyType tests adapted from WICG/trusted-types polyfill:
test(t => {
// returns the proper type for attribute-related properties
assert_equals(TrustedTypes.getPropertyType("script", "src"), "TrustedScriptURL");
assert_equals(TrustedTypes.getPropertyType("img", "src"), "TrustedURL");
assert_equals(trustedTypes.getPropertyType("script", "src"), "TrustedScriptURL");
assert_equals(trustedTypes.getPropertyType("img", "src"), "TrustedURL");
// is case insensitive for tag names
assert_equals(TrustedTypes.getPropertyType("SCRIPT", "src"), "TrustedScriptURL");
assert_equals(TrustedTypes.getPropertyType("ImG", "src"), "TrustedURL");
assert_equals(trustedTypes.getPropertyType("SCRIPT", "src"), "TrustedScriptURL");
assert_equals(trustedTypes.getPropertyType("ImG", "src"), "TrustedURL");
// is case sensitive for property names
assert_equals(TrustedTypes.getPropertyType("script", "sRc"), null);
assert_equals(TrustedTypes.getPropertyType("div", "innerhtml"), null);
assert_equals(trustedTypes.getPropertyType("script", "sRc"), null);
assert_equals(trustedTypes.getPropertyType("div", "innerhtml"), null);
// returns the proper type for innerHTML
assert_equals(TrustedTypes.getPropertyType("div", "innerHTML"), "TrustedHTML");
assert_equals(trustedTypes.getPropertyType("div", "innerHTML"), "TrustedHTML");
// returns the proper type for outerHTML
assert_equals(TrustedTypes.getPropertyType("div", "outerHTML"), "TrustedHTML");
assert_equals(trustedTypes.getPropertyType("div", "outerHTML"), "TrustedHTML");
// returns the proper type for script.prop
["text", "innerText", "textContent"].forEach((prop) => {
assert_equals(TrustedTypes.getPropertyType("script", prop), "TrustedScript");
assert_equals(trustedTypes.getPropertyType("script", prop), "TrustedScript");
});
}, "getPropertyType tests adapted from WICG/trusted-types polyfill");
test(t => {
// returns the proper type
assert_equals(TrustedTypes.getAttributeType('script', 'src'), 'TrustedScriptURL');
assert_equals(TrustedTypes.getAttributeType('img', 'src'), 'TrustedURL');
assert_equals(trustedTypes.getAttributeType('script', 'src'), 'TrustedScriptURL');
assert_equals(trustedTypes.getAttributeType('img', 'src'), 'TrustedURL');
// ignores attributes from unknown namespaces
assert_equals(TrustedTypes.getAttributeType(
assert_equals(trustedTypes.getAttributeType(
'a', 'href', '', 'http://foo.bar'), null);
// is case insensitive for element names
assert_equals(TrustedTypes.getAttributeType('SCRIPT', 'src'), 'TrustedScriptURL');
assert_equals(TrustedTypes.getAttributeType('imG', 'src'), 'TrustedURL');
assert_equals(trustedTypes.getAttributeType('SCRIPT', 'src'), 'TrustedScriptURL');
assert_equals(trustedTypes.getAttributeType('imG', 'src'), 'TrustedURL');
// is case insensitive for the attribute names
assert_equals(TrustedTypes.getAttributeType('script', 'SRC'), 'TrustedScriptURL');
assert_equals(TrustedTypes.getAttributeType('imG', 'srC'), 'TrustedURL');
assert_equals(trustedTypes.getAttributeType('script', 'SRC'), 'TrustedScriptURL');
assert_equals(trustedTypes.getAttributeType('imG', 'srC'), 'TrustedURL');
// supports the inline event handlers
assert_equals(TrustedTypes.getAttributeType('img', 'onerror'), 'TrustedScript');
assert_equals(TrustedTypes.getAttributeType('unknown', 'onerror'), 'TrustedScript');
assert_equals(trustedTypes.getAttributeType('img', 'onerror'), 'TrustedScript');
assert_equals(trustedTypes.getAttributeType('unknown', 'onerror'), 'TrustedScript');
// defaults to undefined
assert_equals(TrustedTypes.getAttributeType('unknown', 'src'), null);
assert_equals(TrustedTypes.getAttributeType('img', 'bar'), null);
assert_equals(trustedTypes.getAttributeType('unknown', 'src'), null);
assert_equals(trustedTypes.getAttributeType('img', 'bar'), null);
}, "getAttributeType tests adapted from WICG/trusted-types polyfill");
test(t=> {
const map = TrustedTypes.getTypeMapping();
const map = trustedTypes.getTypeMapping();
// Spot testing some values.
assert_equals(map["script"].attributes.src, "TrustedScriptURL");
@ -89,10 +89,10 @@
// getTypeMapping returns a 'clean' object, in case the return value has
// been modified.
map["*"].attributes["foo"] = "bar";
assert_equals(TrustedTypes.getTypeMapping()["*"].attributes["foo"], undefined);
assert_equals(trustedTypes.getTypeMapping()["*"].attributes["foo"], undefined);
;
// Unknown namespaces:
assert_equals(TrustedTypes.getTypeMapping("http://foo/bar"), undefined);
assert_equals(trustedTypes.getTypeMapping("http://foo/bar"), undefined);
}, "getTypeMapping tests adapted from WICG/trusted-types polyfill");
// Test case handling for both attributes and properties.
@ -100,12 +100,12 @@
for (let elem of ["object", "OBJECT", "oBjEcT"]) {
test(t => {
// attributes are case-insensitive, so all variants should be defined.
assert_true(TrustedTypes.getAttributeType(elem, attr) != undefined);
assert_true(trustedTypes.getAttributeType(elem, attr) != undefined);
}, `${elem}[${attr}] is defined`);
test(t => {
// properties are case-sensitive, so only the "correct" spelling
// should be defined.
assert_equals(TrustedTypes.getPropertyType(elem, attr) != undefined,
assert_equals(trustedTypes.getPropertyType(elem, attr) != undefined,
attr == "codeBase");
}, `${elem}.${attr} is maybe defined`);
}

View file

@ -16,94 +16,94 @@
// isHTML tests
test(t => {
const p = TrustedTypes.createPolicy('html', noopPolicy);
const p = trustedTypes.createPolicy('html', noopPolicy);
let html = p.createHTML(INPUTS.HTML);
assert_true(TrustedTypes.isHTML(html));
assert_true(trustedTypes.isHTML(html));
let html2 = Object.create(html);
// instanceof can pass, but we rely on isHTML
assert_true(html2 instanceof TrustedHTML);
assert_false(TrustedTypes.isHTML(html2));
assert_false(trustedTypes.isHTML(html2));
let html3 = Object.assign({}, html, {toString: () => 'fake'});
assert_false(TrustedTypes.isHTML(html3));
assert_false(trustedTypes.isHTML(html3));
}, 'TrustedTypePolicyFactory.isHTML requires the object to be created via policy.');
// isScript tests
test(t => {
const p = TrustedTypes.createPolicy('script', noopPolicy);
const p = trustedTypes.createPolicy('script', noopPolicy);
let script = p.createScript(INPUTS.SCRIPT);
assert_true(TrustedTypes.isScript(script));
assert_true(trustedTypes.isScript(script));
let script2 = Object.create(script);
// instanceof can pass, but we rely on isScript
assert_true(script2 instanceof TrustedScript);
assert_false(TrustedTypes.isScript(script2));
assert_false(trustedTypes.isScript(script2));
let script3 = Object.assign({}, script, {toString: () => 'fake'});
assert_false(TrustedTypes.isScript(script3));
assert_false(trustedTypes.isScript(script3));
}, 'TrustedTypePolicyFactory.isScript requires the object to be created via policy.');
// isScriptURL tests
test(t => {
const p = TrustedTypes.createPolicy('script_url', noopPolicy);
const p = trustedTypes.createPolicy('script_url', noopPolicy);
let script = p.createScriptURL(INPUTS.SCRIPTURL);
assert_true(TrustedTypes.isScriptURL(script));
assert_true(trustedTypes.isScriptURL(script));
let script2 = Object.create(script);
// instanceof can pass, but we rely on isScript
assert_true(script2 instanceof TrustedScriptURL);
assert_false(TrustedTypes.isScriptURL(script2));
assert_false(trustedTypes.isScriptURL(script2));
let script3 = Object.assign({}, script, {toString: () => 'fake'});
assert_false(TrustedTypes.isScriptURL(script3));
assert_false(trustedTypes.isScriptURL(script3));
}, 'TrustedTypePolicyFactory.isScriptURL requires the object to be created via policy.');
// isURL tests
test(t => {
const p = TrustedTypes.createPolicy('url', noopPolicy);
const p = trustedTypes.createPolicy('url', noopPolicy);
let url = p.createURL(INPUTS.URL);
assert_true(TrustedTypes.isURL(url));
assert_true(trustedTypes.isURL(url));
let url2 = Object.create(url);
// instanceof can pass, but we rely on isScript
assert_true(url2 instanceof TrustedURL);
assert_false(TrustedTypes.isURL(url2));
assert_false(trustedTypes.isURL(url2));
let url3 = Object.assign({}, url, {toString: () => 'fake'});
assert_false(TrustedTypes.isURL(url3));
assert_false(trustedTypes.isURL(url3));
}, 'TrustedTypePolicyFactory.isURL requires the object to be created via policy.');
// Test non-object parameters.
test(t => {
assert_false(TrustedTypes.isHTML(null));
assert_false(TrustedTypes.isHTML(123));
assert_false(TrustedTypes.isHTML(0.5));
assert_false(TrustedTypes.isHTML('test'));
assert_false(TrustedTypes.isHTML({}));
assert_false(TrustedTypes.isScript(null));
assert_false(TrustedTypes.isScript(123));
assert_false(TrustedTypes.isScript(0.5));
assert_false(TrustedTypes.isScript('test'));
assert_false(TrustedTypes.isScript({}));
assert_false(TrustedTypes.isURL(null));
assert_false(TrustedTypes.isURL(123));
assert_false(TrustedTypes.isURL(0.5));
assert_false(TrustedTypes.isURL('test'));
assert_false(TrustedTypes.isURL({}));
assert_false(TrustedTypes.isScriptURL(null));
assert_false(TrustedTypes.isScriptURL(123));
assert_false(TrustedTypes.isScriptURL(0.5));
assert_false(TrustedTypes.isScriptURL('test'));
assert_false(TrustedTypes.isScriptURL({}));
assert_false(trustedTypes.isHTML(null));
assert_false(trustedTypes.isHTML(123));
assert_false(trustedTypes.isHTML(0.5));
assert_false(trustedTypes.isHTML('test'));
assert_false(trustedTypes.isHTML({}));
assert_false(trustedTypes.isScript(null));
assert_false(trustedTypes.isScript(123));
assert_false(trustedTypes.isScript(0.5));
assert_false(trustedTypes.isScript('test'));
assert_false(trustedTypes.isScript({}));
assert_false(trustedTypes.isURL(null));
assert_false(trustedTypes.isURL(123));
assert_false(trustedTypes.isURL(0.5));
assert_false(trustedTypes.isURL('test'));
assert_false(trustedTypes.isURL({}));
assert_false(trustedTypes.isScriptURL(null));
assert_false(trustedTypes.isScriptURL(123));
assert_false(trustedTypes.isScriptURL(0.5));
assert_false(trustedTypes.isScriptURL('test'));
assert_false(trustedTypes.isScriptURL({}));
}, 'TrustedTypePolicyFactory.isXXX should accept anything without throwing.');
// Redefinition tests, assign to property.
@ -112,44 +112,44 @@
// what [Unforgeable] does. Hence, the tests use try {..} catch {} to cover
// both situationsm rather than expect_throws(...).)
test(t => {
try { TrustedTypes.isHTML = () => 'fake'; } catch { }
assert_false(TrustedTypes.isHTML({}));
try { trustedTypes.isHTML = () => 'fake'; } catch { }
assert_false(trustedTypes.isHTML({}));
}, 'TrustedTypePolicyFactory.IsHTML cannot be redefined.');
test(t => {
try { TrustedTypes.isScript = () => 'fake'; } catch { }
assert_false(TrustedTypes.isScript({}));
try { trustedTypes.isScript = () => 'fake'; } catch { }
assert_false(trustedTypes.isScript({}));
}, 'TrustedTypePolicyFactory.isScript cannot be redefined.');
test(t => {
try { TrustedTypes.isScriptURL = () => 'fake'; } catch { }
assert_false(TrustedTypes.isScriptURL({}));
try { trustedTypes.isScriptURL = () => 'fake'; } catch { }
assert_false(trustedTypes.isScriptURL({}));
}, 'TrustedTypePolicyFactory.isScriptURL cannot be redefined.');
test(t => {
try { TrustedTypes.isURL = () => 'fake'; } catch { }
assert_false(TrustedTypes.isURL({}));
try { trustedTypes.isURL = () => 'fake'; } catch { }
assert_false(trustedTypes.isURL({}));
}, 'TrustedTypePolicyFactory.isURL cannot be redefined.');
// Redefinition tests, via Object.defineProperty.
test(t => {
try { Object.defineProperty(TrustedTypes, 'isHTML', () => 'fake'); } catch { }
assert_false(TrustedTypes.isHTML({}));
assert_false(trustedTypes.isHTML({}));
}, 'TrustedTypePolicyFactory.IsHTML cannot be redefined via defineProperty.');
test(t => {
try { Object.defineProperty(TrustedTypes, 'isScript', () => 'fake'); } catch { }
assert_false(TrustedTypes.isScript({}));
assert_false(trustedTypes.isScript({}));
}, 'TrustedTypePolicyFactory.isScript cannot be redefined via definePropert.');
test(t => {
try { Object.defineProperty(TrustedTypes, 'isScriptURL', () => 'fake'); } catch { }
assert_false(TrustedTypes.isScriptURL({}));
assert_false(trustedTypes.isScriptURL({}));
}, 'TrustedTypePolicyFactory.isScriptURL cannot be redefined via definePropert.');
test(t => {
try { Object.defineProperty(TrustedTypes, 'isURL', () => 'fake'); } catch { }
assert_false(TrustedTypes.isURL({}));
assert_false(trustedTypes.isURL({}));
}, 'TrustedTypePolicyFactory.isURL cannot be redefined via definePropert.');
</script>

View file

@ -9,7 +9,7 @@
<div id="target"></div>
<script>
const policy = TrustedTypes.createPolicy("anythinggoes", {
const policy = trustedTypes.createPolicy("anythinggoes", {
"createHTML": x => x,
"createScript": x => x,
"createURL": x => x,
@ -41,7 +41,7 @@
// so we'll get decent error messages when it might fail.
test(t => {
// Collect all element and property names from getTypeMapping().
const map = TrustedTypes.getTypeMapping();
const map = trustedTypes.getTypeMapping();
for (let elem in map) {
elements.push(elem);
properties = properties.concat(Object.keys(map[elem].properties));
@ -91,7 +91,7 @@
test(t => {
const element = target.appendChild(document.createElement(elem));
t.add_cleanup(_ => element.remove());
const expected_type = TrustedTypes.getPropertyType(elem, property);
const expected_type = trustedTypes.getPropertyType(elem, property);
const value = create_value[type];
const test_fn = _ => { element[property] = value; };
if (type == expected_type || !expected_type) {
@ -129,7 +129,7 @@
test(t => {
const element = target.appendChild(document.createElement(elem));
t.add_cleanup(_ => element.remove());
const expected_type = TrustedTypes.getAttributeType(elem, property);
const expected_type = trustedTypes.getAttributeType(elem, property);
const value = create_value[type];
const test_fn = _ => { element.setAttribute(property, value); };
if (type == expected_type || !expected_type) {

View file

@ -5,9 +5,9 @@
<body>
<script>
test(t => {
let factory = window.TrustedTypes;
let factory = window.trustedTypes;
assert_true(factory instanceof TrustedTypePolicyFactory);
}, "factory = window.TrustedTypes");
}, "factory = window.trustedTypes");
test(t => {
assert_throws(new TypeError(), _ => {

View file

@ -18,7 +18,7 @@
// For the same reason we cannot use the otherwise preferred 'META: workers'
// tag, since that test setup would be blocked as soon as trusted types
// enforcement is enabled.
const test_setup_policy = TrustedTypes.createPolicy("hurrayanythinggoes", {
const test_setup_policy = trustedTypes.createPolicy("hurrayanythinggoes", {
createScriptURL: x => x});
const test_url =
test_setup_policy.createScriptURL("support/WorkerGlobalScope-importScripts.https.js");

View file

@ -10,7 +10,7 @@
<div id="container"></div>
<script>
const container = document.querySelector("#container");
const policy = window.TrustedTypes.createPolicy("policy", {
const policy = window.trustedTypes.createPolicy("policy", {
createScript: t => t,
});
function stringify(arg) {

View file

@ -33,7 +33,7 @@
// After default policy creation string assignment implicitly calls createHTML.
test(t => {
let p = window.TrustedTypes.createPolicy("default", { createHTML: createHTMLJS }, true);
let p = window.trustedTypes.createPolicy("default", { createHTML: createHTMLJS }, true);
let parser = new DOMParser();
let doc = parser.parseFromString(INPUTS.HTML, "text/html");
assert_equals(doc.body.innerText, RESULTS.HTML);

View file

@ -56,7 +56,7 @@
// After default policy creation string assignment implicitly calls createScript.
test(t => {
let policy = window.TrustedTypes.createPolicy("default", { createScript: createScriptJS }, true);
let policy = window.trustedTypes.createPolicy("default", { createScript: createScriptJS }, true);
setTimeout(INPUTS.SCRIPT);
setInterval(INPUTS.SCRIPT);
}, "`setTimeout(string)`, `setInterval(string)` via default policy (successful Script transformation).");

View file

@ -62,7 +62,7 @@
assert_equals(document.body.innerText, old);
}, "`document.writeln(null)` throws");
let default_policy = TrustedTypes.createPolicy('default',
let default_policy = trustedTypes.createPolicy('default',
{ createHTML: createHTMLJS }, true );
// Default policy works.

View file

@ -93,7 +93,7 @@
// After default policy creation string assignment implicitly calls createHTML.
test(t => {
let p = window.TrustedTypes.createPolicy("default", { createHTML: createHTMLJS }, true);
let p = window.trustedTypes.createPolicy("default", { createHTML: createHTMLJS }, true);
var d = document.createElement('div');
container.appendChild(d);

View file

@ -52,7 +52,7 @@
// After default policy creation string assignment implicitly calls createHTML.
test(t => {
let p = window.TrustedTypes.createPolicy("default", { createHTML: createHTMLJS }, true);
let p = window.trustedTypes.createPolicy("default", { createHTML: createHTMLJS }, true);
var d = document.createElement('div');
document.querySelector('#container').appendChild(d);

View file

@ -9,7 +9,7 @@
</head>
<body>
<script>
const nullPolicy = TrustedTypes.createPolicy('NullPolicy', {createScript: s => s});
const nullPolicy = trustedTypes.createPolicy('NullPolicy', {createScript: s => s});
// TrustedURL Assignments
const URLTestCases = [
@ -93,7 +93,7 @@
}, "`Element.prototype.setAttribute.SrC = string` throws.");
// After default policy creation string and null assignments implicitly call createXYZ
let p = window.TrustedTypes.createPolicy("default", { createURL: createURLJS, createScriptURL: createScriptURLJS, createHTML: createHTMLJS, createScript: createScriptJS }, true);
let p = window.trustedTypes.createPolicy("default", { createURL: createURLJS, createScriptURL: createScriptURLJS, createHTML: createHTMLJS, createScript: createScriptJS }, true);
URLTestCases.forEach(c => {
test(t => {
assert_element_accepts_trusted_type(c[0], c[1], INPUTS.URL, RESULTS.URL);

View file

@ -69,7 +69,7 @@
});
// After default policy creation string and null assignments implicitly call createHTML
let p = window.TrustedTypes.createPolicy("default", { createURL: createURLJS, createScriptURL: createScriptURLJS, createHTML: createHTMLJS }, true);
let p = window.trustedTypes.createPolicy("default", { createURL: createURLJS, createScriptURL: createScriptURLJS, createHTML: createHTMLJS }, true);
URLTestCases.forEach(c => {
test(t => {

View file

@ -36,7 +36,7 @@
}, "`location.assign = null` throws");
// Create default policy. Applies to all subsequent tests.
let p = window.TrustedTypes.createPolicy("default",
let p = window.trustedTypes.createPolicy("default",
{ createURL: createLocationURLJS }, true);
// After default policy creation string assignment implicitly calls createURL.

View file

@ -36,7 +36,7 @@
}, "`location.href = null` throws");
// Create default policy. Applies to all subsequent tests.
let p = window.TrustedTypes.createPolicy("default",
let p = window.trustedTypes.createPolicy("default",
{ createURL: createLocationURLJS }, true);
// After default policy creation string assignment implicitly calls createURL.

View file

@ -36,7 +36,7 @@
}, "`location.replace = null` throws");
// Create default policy. Applies to all subsequent tests.
let p = window.TrustedTypes.createPolicy("default",
let p = window.trustedTypes.createPolicy("default",
{ createURL: createLocationURLJS }, true);
// After default policy creation string assignment implicitly calls createURL.

View file

@ -36,7 +36,7 @@
// After default policy creation string assignment implicitly calls createHTML
test(t => {
let p = window.TrustedTypes.createPolicy("default", { createHTML: createHTMLJS }, true);
let p = window.trustedTypes.createPolicy("default", { createHTML: createHTMLJS }, true);
var range = document.createRange();
range.selectNodeContents(document.documentElement);
var result = range.createContextualFragment(INPUTS.HTML);

View file

@ -64,7 +64,7 @@
}, "`document.open(null)` throws.");
// After default policy creation string assignment implicitly calls createURL.
let p = window.TrustedTypes.createPolicy("default", { createURL: createURLJS }, true);
let p = window.trustedTypes.createPolicy("default", { createURL: createURLJS }, true);
test(t => {
testWindowDoesntThrow(t, INPUTS.URL, RESULTS.URL, window);
}, "'window.open(string)' assigned via default policy (successful URL transformation).");

View file

@ -70,7 +70,7 @@ function policy(str) {
return "sanitized: " + str;
}
TrustedTypes.createPolicy("default", {
trustedTypes.createPolicy("default", {
createURL: policy,
createScriptURL: policy,
createHTML: policy,

View file

@ -70,7 +70,7 @@ function policy(str) {
return "sanitized: " + str;
}
TrustedTypes.createPolicy("default", {
trustedTypes.createPolicy("default", {
createURL: policy,
createScriptURL: policy,
createHTML: policy,

View file

@ -25,7 +25,7 @@
assert_equals("" + s, "Hello a cat string");
}, "eval with TrustedScript and permissive CSP works.");
TrustedTypes.createPolicy("default", { createScript: createScriptJS }, true);
trustedTypes.createPolicy("default", { createScript: createScriptJS }, true);
test(t => {
let s = eval('"Hello transformed untrusted string"');
assert_equals(s, "Hello a cat untrusted string");

View file

@ -6,12 +6,12 @@ idl_test(
['dom', 'html'],
idl_array => {
idl_array.add_objects({
TrustedTypePolicyFactory: ['window.TrustedTypes'],
TrustedTypePolicy: ['window.TrustedTypes.createPolicy("SomeName", { createHTML: s => s })'],
TrustedHTML: ['window.TrustedTypes.createPolicy("SomeName1", { createHTML: s => s }).createHTML("A string")'],
TrustedScript: ['window.TrustedTypes.createPolicy("SomeName2", { createScript: s => s }).createScript("A string")'],
TrustedScriptURL: ['window.TrustedTypes.createPolicy("SomeName3", { createScriptURL: s => s }).createScriptURL("A string")'],
TrustedURL: ['window.TrustedTypes.createPolicy("SomeName4", { createURL: s => s }).createURL("A string")']
TrustedTypePolicyFactory: ['window.trustedTypes'],
TrustedTypePolicy: ['window.trustedTypes.createPolicy("SomeName", { createHTML: s => s })'],
TrustedHTML: ['window.trustedTypes.createPolicy("SomeName1", { createHTML: s => s }).createHTML("A string")'],
TrustedScript: ['window.trustedTypes.createPolicy("SomeName2", { createScript: s => s }).createScript("A string")'],
TrustedScriptURL: ['window.trustedTypes.createPolicy("SomeName3", { createScriptURL: s => s }).createScriptURL("A string")'],
TrustedURL: ['window.trustedTypes.createPolicy("SomeName4", { createURL: s => s }).createURL("A string")']
});
},
'Trusted Types'

View file

@ -1,4 +1,4 @@
let test_setup_policy = TrustedTypes.createPolicy("hurrayanythinggoes", {
let test_setup_policy = trustedTypes.createPolicy("hurrayanythinggoes", {
createScriptURL: x => x
});
importScripts(test_setup_policy.createScriptURL("/resources/testharness.js"));
@ -13,14 +13,14 @@ if (this.DedicatedWorkerGlobalScope !== undefined) {
worker_type = "service worker";
}
let test_policy = TrustedTypes.createPolicy("xxx", {
let test_policy = trustedTypes.createPolicy("xxx", {
createScriptURL: url => url.replace("play", "work")
});
test(t => {
self.result = "Fail";
let trusted_url = test_policy.createScriptURL("player.js");
assert_true(this.TrustedTypes.isScriptURL(trusted_url));
assert_true(this.trustedTypes.isScriptURL(trusted_url));
importScripts(trusted_url); // worker.js modifies self.result.
assert_equals(self.result, "Pass");
}, "importScripts with TrustedScriptURL works in " + worker_type);
@ -63,7 +63,7 @@ test(t => {
}, "importScripts with two URLs, one trusted, in " + worker_type);
// Test default policy application:
TrustedTypes.createPolicy("default", {
trustedTypes.createPolicy("default", {
createScriptURL: url => url.replace("play", "work")
}, true);
test(t => {

View file

@ -40,19 +40,19 @@ function createLocationURLJS(value) {
}
function createHTML_policy(win, c) {
return win.TrustedTypes.createPolicy('SomeHTMLPolicyName' + c, { createHTML: createHTMLJS });
return win.trustedTypes.createPolicy('SomeHTMLPolicyName' + c, { createHTML: createHTMLJS });
}
function createScript_policy(win, c) {
return win.TrustedTypes.createPolicy('SomeScriptPolicyName' + c, { createScript: createScriptJS });
return win.trustedTypes.createPolicy('SomeScriptPolicyName' + c, { createScript: createScriptJS });
}
function createScriptURL_policy(win, c) {
return win.TrustedTypes.createPolicy('SomeScriptURLPolicyName' + c, { createScriptURL: createScriptURLJS });
return win.trustedTypes.createPolicy('SomeScriptURLPolicyName' + c, { createScriptURL: createScriptURLJS });
}
function createURL_policy(win, c) {
return win.TrustedTypes.createPolicy('SomeURLPolicyName' + c, { createURL: createURLJS });
return win.trustedTypes.createPolicy('SomeURLPolicyName' + c, { createURL: createURLJS });
}
function assert_element_accepts_trusted_html(win, c, t, tag, attribute, expected) {

View file

@ -48,7 +48,7 @@
try { fn(); assert_unreached(); } catch (err) { /* ignore */ }
}
// A sample policy we use to test TrustedTypes.createPolicy behaviour.
// A sample policy we use to test trustedTypes.createPolicy behaviour.
const id = x => x;
const a_policy = {
createHTML: id,
@ -57,7 +57,7 @@
createScript: id,
};
const scriptyPolicy = TrustedTypes.createPolicy('allowEval', a_policy);
const scriptyPolicy = trustedTypes.createPolicy('allowEval', a_policy);
// Provoke/wait for a CSP violation, in order to be sure that all previous
// CSP violations have been delivered.
@ -96,7 +96,7 @@
}, "Trusted Type violation report: evaluating a Trusted Script violates script-src.");
promise_test(t => {
TrustedTypes.createPolicy('default', {
trustedTypes.createPolicy('default', {
createScript: s => s.replace('payload', 'default policy'),
}, true);
let p = Promise.resolve()

View file

@ -48,7 +48,7 @@
try { fn(); assert_unreached(); } catch (err) { /* ignore */ }
}
// A sample policy we use to test TrustedTypes.createPolicy behaviour.
// A sample policy we use to test trustedTypes.createPolicy behaviour.
const id = x => x;
const a_policy = {
createHTML: id,
@ -57,7 +57,7 @@
createScript: id,
};
const scriptyPolicy = TrustedTypes.createPolicy('allowEval', a_policy);
const scriptyPolicy = trustedTypes.createPolicy('allowEval', a_policy);
// Provoke/wait for a CSP violation, in order to be sure that all previous
// CSP violations have been delivered.
@ -93,7 +93,7 @@
}, "Trusted Type violation report: evaluating a Trusted Script.");
promise_test(t => {
TrustedTypes.createPolicy('default', {
trustedTypes.createPolicy('default', {
createScript: s => s.replace('payload', 'default policy'),
}, true);
let p = promise_flush()();

View file

@ -42,7 +42,7 @@
try { fn(); assert_unreached(); } catch (err) { /* ignore */ }
}
// A sample policy we use to test TrustedTypes.createPolicy behaviour.
// A sample policy we use to test trustedTypes.createPolicy behaviour.
const id = x => x;
const a_policy = {
createHTML: id,
@ -50,7 +50,7 @@
createURL: id,
createScript: id,
};
const scriptyPolicy = TrustedTypes.createPolicy('allowEval', a_policy);
const scriptyPolicy = trustedTypes.createPolicy('allowEval', a_policy);
// Provoke/wait for a CSP violation, in order to be sure that all previous
// CSP violations have been delivered.
@ -88,7 +88,7 @@
promise_test(t => {
let beacon = 'never_overwritten';
TrustedTypes.createPolicy('default', {
trustedTypes.createPolicy('default', {
createScript: s => s.replace('payload', 'default policy'),
}, true);
let p = promise_flush()();

View file

@ -34,9 +34,9 @@
});
}
// A sample policy we use to test TrustedTypes.createPolicy behaviour.
// A sample policy we use to test trustedTypes.createPolicy behaviour.
const id = x => x;
const policy = TrustedTypes.createPolicy("two", {
const policy = trustedTypes.createPolicy("two", {
createHTML: id,
createScriptURL: id,
createURL: id,

View file

@ -15,7 +15,7 @@
</head>
<body>
<script>
TrustedTypes.createPolicy("three", {});
trustedTypes.createPolicy("three", {});
</script>
<script async defer src='../content-security-policy/support/checkReport.sub.js?reportField=violated-directive&reportValue=trusted-types'></script>
</body>

View file

@ -72,7 +72,7 @@
return e;
} }
// A sample policy we use to test TrustedTypes.createPolicy behaviour.
// A sample policy we use to test trustedTypes.createPolicy behaviour.
const id = x => x;
const a_policy = {
createHTML: id,
@ -101,14 +101,14 @@
.then(expect_sample("three"))
.then(expect_blocked_uri("trusted-types-policy"))
.then(promise_flush());
expect_throws(_ => TrustedTypes.createPolicy("three", a_policy));
expect_throws(_ => trustedTypes.createPolicy("three", a_policy));
flush();
return p;
}, "Trusted Type violation report: creating a forbidden policy.");
promise_test(t => {
let p = promise_flush()();
expect_throws(_ => TrustedTypes.createPolicy("two", a_policy));
expect_throws(_ => trustedTypes.createPolicy("two", a_policy));
flush();
return p;
}, "Trusted Type violation report: creating a report-only-forbidden policy.");
@ -120,7 +120,7 @@
let p = Promise.resolve()
.then(promise_violation("trusted-types two"))
.then(promise_flush());
policy_one = TrustedTypes.createPolicy("one", a_policy);
policy_one = trustedTypes.createPolicy("one", a_policy);
flush();
return p;
}, "Trusted Type violation report: creating a forbidden-but-not-reported policy.");

View file

@ -63,7 +63,7 @@
'Modifying the original buffer does not affect toArrayBuffer() content');
assert_array_equals(new Uint8Array(data_3), original_data,
'Modifying the original buffer does not affect toArrayBuffer() content');
}, 'NDEFRecord constructor with opaque data');
}, 'NDEFRecord constructor with opaque record type');
test(() => {
const record = new NDEFRecord(createJsonRecord(test_json_data));
@ -82,7 +82,40 @@
'toJSON() again returns another new object');
assert_object_equals(data_2, test_json_data,
'toJSON() has the same content with the original dictionary');
}, 'NDEFRecord constructor with json data');
}, 'NDEFRecord constructor with JSON record type');
test(() => {
let buffer = new ArrayBuffer(4);
let buffer_view = new Uint8Array(buffer);
let original_data = new Uint8Array([1, 2, 3, 4]);
buffer_view.set(original_data);
const record = new NDEFRecord(createRecord('foo.eXamPle.coM:bAr*-', undefined, buffer));
assert_equals(record.recordType, 'foo.example.com:bAr*-', 'recordType');
assert_equals(record.mediaType, 'application/octet-stream', 'mediaType');
const data_1 = record.toArrayBuffer();
assert_true(data_1 instanceof ArrayBuffer);
assert_not_equals(data_1, buffer, 'toArrayBuffer() returns a new object');
assert_array_equals(new Uint8Array(data_1), original_data,
'toArrayBuffer() has the same content with the original buffer');
const data_2 = record.toArrayBuffer();
assert_true(data_2 instanceof ArrayBuffer);
assert_not_equals(data_2, data_1,
'toArrayBuffer() again returns another new object');
assert_array_equals(new Uint8Array(data_2), original_data,
'toArrayBuffer() has the same content with the original buffer');
buffer_view.set([4, 3, 2, 1]);
const data_3 = record.toArrayBuffer();
assert_true(data_3 instanceof ArrayBuffer);
assert_array_equals(new Uint8Array(data_1), original_data,
'Modifying the original buffer does not affect toArrayBuffer() content');
assert_array_equals(new Uint8Array(data_2), original_data,
'Modifying the original buffer does not affect toArrayBuffer() content');
assert_array_equals(new Uint8Array(data_3), original_data,
'Modifying the original buffer does not affect toArrayBuffer() content');
}, 'NDEFRecord constructor with external record type');
test(() => {
assert_throws(new TypeError, () => new NDEFRecord(createRecord('EMptY')),
@ -99,4 +132,17 @@
'Unknown record type.');
}, 'NDEFRecord constructor with record type string being treated as case sensitive');
test(() => {
assert_throws(new TypeError, () => new NDEFRecord(createRecord(
':xyz', '', test_buffer_data)), 'The domain should not be empty.');
assert_throws(new TypeError, () => new NDEFRecord(createRecord(
'[:xyz', '', test_buffer_data)), '"[" is not a valid FQDN.');
assert_throws(new TypeError, () => new NDEFRecord(createRecord(
'example.com:', '', test_buffer_data)), 'The type should not be empty.');
assert_throws(new TypeError, () => new NDEFRecord(createRecord(
'example.com:xyz~', '', test_buffer_data)), 'The type should not contain \'~\'.');
assert_throws(new TypeError, () => new NDEFRecord(createRecord(
'example.com:xyz/', '', test_buffer_data)), 'The type should not contain \'/\'.');
}, 'NDEFRecord constructor with invalid external record type');
</script>

View file

@ -47,6 +47,14 @@ const NFCReaderOptionTests =
unmatchedScanOptions: {recordType: "json"},
message: createMessage([createUrlRecord(test_url_data)])
},
{
desc: "Test that reading data succeed when NFCScanOptions'" +
" recordType is set to a custom type for external type records.",
scanOptions: {recordType: "w3.org:xyz"},
unmatchedScanOptions: {recordType: "opaque"},
message: createMessage([createRecord('w3.org:xyz', 'application/octet-stream',
test_buffer_data)])
},
{
desc: "Test that the url of NFCScanOptions filters relevant data" +
" sources correctly.",
@ -101,6 +109,14 @@ const ReadMultiMessagesTests =
message: createMessage([createUrlRecord(test_url_data)]),
unmatchedMessage: createMessage([createTextRecord(test_text_data)])
},
{
desc: "Test that filtering external record from different messages" +
" correctly with NFCScanOptions' recordType is set to the custom type.",
scanOptions: {recordType: "w3.org:xyz"},
message: createMessage([createRecord('w3.org:xyz', 'application/octet-stream',
test_buffer_data)]),
unmatchedMessage: createMessage([createTextRecord(test_text_data)])
},
{
desc: "Test that filtering 'text' record from different messages" +
" correctly with NFCScanOptions' url set.",

View file

@ -48,7 +48,21 @@ const invalid_type_messages =
// NDEFRecord.data for 'opaque' record must be ArrayBuffer.
createMessage([createOpaqueRecord(test_text_data)]),
createMessage([createOpaqueRecord(test_number_data)]),
createMessage([createOpaqueRecord(test_json_data)])
createMessage([createOpaqueRecord(test_json_data)]),
// https://w3c.github.io/web-nfc/#dfn-map-external-data-to-ndef
// NDEFRecord must have data.
createMessage([createRecord('w3.org:xyz', '', undefined)]),
// NDEFRecord.data for external record must be ArrayBuffer.
createMessage([createRecord('w3.org:xyz', '', test_text_data)]),
createMessage([createRecord('w3.org:xyz', '', test_number_data)]),
createMessage([createRecord('w3.org:xyz', '', test_json_data)]),
// https://w3c.github.io/web-nfc/#the-ndefrecordtype-string
// The record type is neither a known type ('text', 'json' etc.) nor a
// valid custom type for an external type record.
createMessage([createRecord('unmatched_type', '', test_buffer_data)])
];
const invalid_syntax_messages =
@ -266,11 +280,12 @@ nfc_test(async (t, mockNFC) => {
createJsonRecord(test_json_data),
createJsonRecord(test_number_data),
createOpaqueRecord(test_buffer_data),
createUrlRecord(test_url_data)],
createUrlRecord(test_url_data),
createRecord('w3.org:xyz', '', test_buffer_data)],
test_message_origin);
await writer.push(message);
assertNDEFMessagesEqual(message, mockNFC.pushedMessage());
}, "NFCWriter.push NDEFMessage containing text, json, opaque and url records \
}, "NFCWriter.push NDEFMessage containing text, json, opaque, url and external records \
with default NFCPushOptions.");
nfc_test(async (t, mockNFC) => {