Update web-platform-tests to revision 4877e40ba4bc993de5ccbd206845b63ceb07a892

This commit is contained in:
WPT Sync Bot 2020-06-20 08:20:10 +00:00
parent 0b61cfc3ae
commit 287381881b
91 changed files with 1890 additions and 393 deletions

View file

@ -1,4 +0,0 @@
[hit-test-floats-002.html]
[Hit test float]
expected: FAIL

View file

@ -1,4 +0,0 @@
[hit-test-floats-003.html]
[Miss float below something else]
expected: FAIL

View file

@ -0,0 +1,2 @@
[trailing-other-space-separators-break-spaces-008.html]
expected: FAIL

View file

@ -1,4 +0,0 @@
[CaretPosition-001.html]
[Element at (400, 100)]
expected: FAIL

View file

@ -1,13 +1,11 @@
[MediaQueryList-extends-EventTarget.html]
[onchange removes listener]
expected: FAIL
[onchange adds listener]
expected: FAIL
expected: TIMEOUT
[listeners for "change" type are called]
expected: FAIL
[addEventListener "once" option is respected]
expected: FAIL
expected: TIMEOUT
[removeEventListener removes listener]
expected: NOTRUN

View file

@ -1,4 +0,0 @@
[elementFromPoint-001.html]
[CSSOM View - 5 - extensions to the Document interface]
expected: FAIL

View file

@ -17,6 +17,3 @@
[test the top of layer]
expected: FAIL
[test some point of the element: top left corner]
expected: FAIL

View file

@ -1,4 +0,0 @@
[elementsFromPoint-invalid-cases.html]
[The root element is the last element returned for otherwise empty queries within the viewport]
expected: FAIL

View file

@ -0,0 +1,2 @@
[HTMLMediaElement.html]
expected: TIMEOUT

View file

@ -312,27 +312,21 @@
[Response: combined response Content-Type: text/html;" \\" text/plain ";charset=GBK]
expected: NOTRUN
[<iframe>: separate response Content-Type: text/plain */*;charset=gbk]
expected: FAIL
[<iframe>: combined response Content-Type: text/html;" text/plain]
expected: FAIL
[<iframe>: combined response Content-Type: text/html;charset=gbk text/plain text/html]
expected: FAIL
[<iframe>: separate response Content-Type: text/html */*]
expected: FAIL
[<iframe>: combined response Content-Type: text/html */*;charset=gbk]
expected: FAIL
[<iframe>: combined response Content-Type: text/html */*]
expected: FAIL
[<iframe>: separate 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/plain */*]
expected: FAIL
[<iframe>: combined response Content-Type: text/html;" \\" text/plain]
expected: FAIL
[<iframe>: combined response Content-Type: text/html;x=" text/plain]
expected: FAIL

View file

@ -11,6 +11,3 @@
[X-Content-Type-Options%3A%20nosniff%2C%2C%40%23%24%23%25%25%26%5E%26%5E*()()11!]
expected: FAIL
[X-Content-Type-Options%3A%20'NosniFF']
expected: FAIL

View file

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

View file

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

View file

@ -0,0 +1,2 @@
[cross-origin-objects-on-new-window.html]
expected: TIMEOUT

View file

@ -1,5 +1,5 @@
[embedded-opener-remove-frame.html]
expected: TIMEOUT
expected: CRASH
[opener of discarded nested browsing context]
expected: FAIL

View file

@ -1,5 +1,4 @@
[supported-elements.html]
expected: TIMEOUT
[Contenteditable element should support autofocus]
expected: FAIL
@ -10,7 +9,7 @@
expected: FAIL
[Area element should support autofocus]
expected: TIMEOUT
expected: FAIL
[Host element with delegatesFocus should support autofocus]
expected: FAIL

View file

@ -1,5 +1,5 @@
[iframe_sandbox_popups_escaping-1.html]
expected: TIMEOUT
expected: CRASH
[Check that popups from a sandboxed iframe escape the sandbox if\n allow-popups-to-escape-sandbox is used]
expected: TIMEOUT

View file

@ -1,5 +1,5 @@
[iframe_sandbox_popups_escaping-2.html]
expected: CRASH
expected: TIMEOUT
[Check that popups from a sandboxed iframe escape the sandbox if\n allow-popups-to-escape-sandbox is used]
expected: TIMEOUT

View file

@ -1,4 +1,5 @@
[iframe_sandbox_popups_escaping-3.html]
expected: TIMEOUT
[Check that popups from a sandboxed iframe escape the sandbox if\n allow-popups-to-escape-sandbox is used]
expected: FAIL
expected: TIMEOUT

View file

@ -1,4 +1,5 @@
[iframe_sandbox_popups_nonescaping-3.html]
expected: TIMEOUT
[Check that popups from a sandboxed iframe do not escape the sandbox]
expected: FAIL
expected: NOTRUN

View file

@ -1,4 +0,0 @@
[form-double-submit-2.html]
[preventDefault should allow onclick submit() to succeed]
expected: FAIL

View file

@ -0,0 +1,4 @@
[form-double-submit-3.html]
[<button> should have the same double-submit protection as <input type=submit>]
expected: FAIL

View file

@ -3,6 +3,3 @@
[The incumbent settings object while executing the compiled callback via Web IDL's invoke must be that of the node document]
expected: TIMEOUT
[The entry settings object while executing the compiled callback via Web IDL's invoke must be that of the node document]
expected: FAIL

View file

@ -1,4 +1,5 @@
[realtimeanalyser-fft-scaling.html]
expected: TIMEOUT
[X 2048-point FFT peak position is not equal to 64. Got 0.]
expected: FAIL

View file

@ -0,0 +1,5 @@
[018.html]
expected: TIMEOUT
[origin of the script that invoked the method, javascript:]
expected: TIMEOUT

View file

@ -1,4 +1,5 @@
[003.html]
expected: ERROR
[shared]
expected: FAIL

View file

@ -327067,7 +327067,7 @@
],
"resources": {
"dispatcher.js": [
"b6e29e26bfe15350e990ff56258d22561aab7298",
"53109400f807b7aa82e0dc948ca701ece7638719",
[]
],
"dispatcher.py": [
@ -337405,7 +337405,7 @@
]
},
"lint.ignore": [
"c6ec444f6cc4c968871e51e256170247e287aa43",
"8d0ac45b8c88ab625cca30770488c9a4d0a3def8",
[]
],
"loading": {
@ -338140,20 +338140,32 @@
[]
],
"resources": {
"child.sub.html": [
"a0d10e13554b6b0928220ba400e53bcbe0e26d57",
[]
],
"common.js": [
"1347c5bdb73cc3280a1270167bfbbac3bc3098ea",
"6da98746ecd0939295e4463ef7af580f29111efa",
[]
],
"grandchild.sub.html": [
"0f11bce0e025a11aac9b8b6f8df480246a5ab4df",
"iframe.redirect.sub.html": [
"6eaf557422c18e9f0d7a27870102227267af81c1",
[]
],
"redirecting-child.sub.html": [
"732c54109660fc09f7c04578ce8965b1c5307f9c",
"iframe.secret.sub.html": [
"55caa347fbfdb2b182bd6d2e1e22088eb78e0d3a",
[]
],
"iframe.sub.html": [
"96b7b1a83982e2f38bc4e9cc4288a3708611bb30",
[]
],
"window.redirect.sub.html": [
"b339abc54f7a3e72184b434de85231763b1734c4",
[]
],
"window.secret.sub.html": [
"99d9d1251b28e0a91633a0f162ffc6bfc306ec26",
[]
],
"window.sub.html": [
"c2540943828ce9fd9db463ad4f33c643c6f1eadf",
[]
]
}
@ -339094,7 +339106,13 @@
"README.md": [
"eb1a8d268cebf1f308925cbc1fe30a2478b9fa2c",
[]
]
],
"resources": {
"support.js": [
"adbfbc45d1977a05657dc3fddfa7344ed91b1371",
[]
]
}
},
"navigation-timing": {
"META.yml": [
@ -339956,6 +339974,10 @@
"63c2e6e8b92b0af9cdf0e3814133b0fe4b68a169",
[]
],
"portal-activate-in-handler.html": [
"746ffa2b395743bafdebf125815ea9f14c4d63de",
[]
],
"portal-activate-inside-portal.html": [
"517c9a47e516124c2602607f5a3b01d3acb0e971",
[]
@ -384413,6 +384435,13 @@
]
},
"positioning": {
"abspos-inline-container-in-inline-block.html": [
"04eb1416f701872d56d7ad370a377779654d792d",
[
null,
{}
]
],
"inline-static-position-001.html": [
"b627fbcab58d0a988de8ef572f64a67c2929536b",
[
@ -388168,6 +388197,13 @@
{}
]
],
"flex-aspect-ratio-img-row-005.html": [
"451099614c23a28ef8dac4d4c7e162c9efc1955b",
[
null,
{}
]
],
"flex-basis-009.html": [
"3e2026958fdd899349126ebe4778fb62a692d631",
[
@ -452704,7 +452740,7 @@
"cross-origin-opener-policy": {
"access-reporting": {
"openee-accessed_openee-coop-ro.https.html": [
"1cb8e763b96d7c6362bdf5df60b36d074ab8e61f",
"7385550222abb152daa0f3bf3410278dc486977a",
[
null,
{
@ -452713,7 +452749,7 @@
]
],
"openee-accessed_openee-coop.https.html": [
"3c091275cc24f82e7800fd6d8068cad8e0978b16",
"2c94253bcecb7c64b0ad56e285db4a739bc9d44a",
[
null,
{
@ -452722,7 +452758,7 @@
]
],
"opener-accessed_openee-coop-ro.https.html": [
"9019b72c54a3221bf48c12b7e3281b258c30efc1",
"8d07e27bb7c7e4c6e78190605d7eb5f3d07eaf76",
[
null,
{
@ -452731,7 +452767,7 @@
]
],
"opener-accessed_openee-coop.https.html": [
"6dfb067a4159c0766421e409307b13a52b2cf3f1",
"ae5bea87680f668439b775badcda3d20a1d51341",
[
null,
{
@ -473604,10 +473640,10 @@
}
},
"measure-memory": {
"measure-memory-cross-origin-iframe.tentative.window.js": [
"c65173fe8a0e55143fcb5745f0c456e2aa60da46",
"detached.tentative.window.js": [
"87c93160526ec37699c062fea4ab935616b5ee5d",
[
"measure-memory/measure-memory-cross-origin-iframe.tentative.window.html",
"measure-memory/detached.tentative.window.html",
{
"script_metadata": [
[
@ -473627,10 +473663,10 @@
}
]
],
"measure-memory-cross-origin-redirecting-iframe.tentative.window.js": [
"435477d7f4d758b7d78486f2f001f7ee81767147",
"iframe.cross-origin.tentative.window.js": [
"a9dccc8d80f9de314f59a05da521621a8038fe0d",
[
"measure-memory/measure-memory-cross-origin-redirecting-iframe.tentative.window.html",
"measure-memory/iframe.cross-origin.tentative.window.html",
{
"script_metadata": [
[
@ -473650,10 +473686,10 @@
}
]
],
"measure-memory-same-origin-iframe.tentative.window.js": [
"05a55c7b3136d2c7099c3b13faf039590d9f77c5",
"iframe.cross-site.tentative.window.js": [
"e40ce59fa4d25741155fe637d1b18fce58a37245",
[
"measure-memory/measure-memory-same-origin-iframe.tentative.window.html",
"measure-memory/iframe.cross-site.tentative.window.html",
{
"script_metadata": [
[
@ -473673,10 +473709,171 @@
}
]
],
"measure-memory.tentative.window.js": [
"0c595eda73a2d8e5dd1b8749e40e120f651dffb4",
"iframe.same-origin.tentative.window.js": [
"7fc02036117a152ffeb945fb4ad32ab2bdf97215",
[
"measure-memory/measure-memory.tentative.window.html",
"measure-memory/iframe.same-origin.tentative.window.html",
{
"script_metadata": [
[
"script",
"/common/get-host-info.sub.js"
],
[
"script",
"./resources/common.js"
],
[
"timeout",
"long"
]
],
"timeout": "long"
}
]
],
"main-frame.tentative.window.js": [
"0a34abb9246f0c218c26cedd99bebbf2f01aeaf0",
[
"measure-memory/main-frame.tentative.window.html",
{
"script_metadata": [
[
"script",
"/common/get-host-info.sub.js"
],
[
"script",
"./resources/common.js"
],
[
"timeout",
"long"
]
],
"timeout": "long"
}
]
],
"redirect.client.tentative.window.js": [
"e38a325c7122833c0a05bda9b4c8d027a407ead0",
[
"measure-memory/redirect.client.tentative.window.html",
{
"script_metadata": [
[
"script",
"/common/get-host-info.sub.js"
],
[
"script",
"./resources/common.js"
],
[
"timeout",
"long"
]
],
"timeout": "long"
}
]
],
"redirect.server.tentative.window.js": [
"740abca167829087fbd8bf5d8373cf4f2646f3f7",
[
"measure-memory/redirect.server.tentative.window.html",
{
"script_metadata": [
[
"script",
"/common/get-host-info.sub.js"
],
[
"script",
"./resources/common.js"
],
[
"timeout",
"long"
]
],
"timeout": "long"
}
]
],
"window-open.cross-origin.tentative.window.js": [
"d067b2c175bd995898c7ded32297d5bfa543c57a",
[
"measure-memory/window-open.cross-origin.tentative.window.html",
{
"script_metadata": [
[
"script",
"/common/get-host-info.sub.js"
],
[
"script",
"./resources/common.js"
],
[
"timeout",
"long"
]
],
"timeout": "long"
}
]
],
"window-open.cross-site.tentative.window.js": [
"7fa49f5facc21f73818a726d4547cc0ba5581e30",
[
"measure-memory/window-open.cross-site.tentative.window.html",
{
"script_metadata": [
[
"script",
"/common/get-host-info.sub.js"
],
[
"script",
"./resources/common.js"
],
[
"timeout",
"long"
]
],
"timeout": "long"
}
]
],
"window-open.mix.tentative.window.js": [
"5bb9d29c61d86c67f654f77827d7dc07c31b2508",
[
"measure-memory/window-open.mix.tentative.window.html",
{
"script_metadata": [
[
"script",
"/common/get-host-info.sub.js"
],
[
"script",
"./resources/common.js"
],
[
"timeout",
"long"
]
],
"timeout": "long"
}
]
],
"window-open.same-origin.tentative.window.js": [
"7ec3cc436f1c3a250c18c6bcc369241241b2b081",
[
"measure-memory/window-open.same-origin.tentative.window.html",
{
"script_metadata": [
[
@ -477907,6 +478104,188 @@
]
}
]
],
"rename_async_basic.tentative.https.any.js": [
"8829b5b3104df0139afccb580758eab135e253ff",
[
"native-io/rename_async_basic.tentative.https.any.html",
{
"script_metadata": [
[
"title",
"NativeIO API: File renaming is reflected in listing."
],
[
"global",
"window,worker"
]
]
}
],
[
"native-io/rename_async_basic.tentative.https.any.serviceworker.html",
{
"script_metadata": [
[
"title",
"NativeIO API: File renaming is reflected in listing."
],
[
"global",
"window,worker"
]
]
}
],
[
"native-io/rename_async_basic.tentative.https.any.sharedworker.html",
{
"script_metadata": [
[
"title",
"NativeIO API: File renaming is reflected in listing."
],
[
"global",
"window,worker"
]
]
}
],
[
"native-io/rename_async_basic.tentative.https.any.worker.html",
{
"script_metadata": [
[
"title",
"NativeIO API: File renaming is reflected in listing."
],
[
"global",
"window,worker"
]
]
}
]
],
"rename_async_failure_handling.tentative.https.any.js": [
"5e0f96408bb7ba3c9d6d75bc21f1cc1d6242f98e",
[
"native-io/rename_async_failure_handling.tentative.https.any.html",
{
"script_metadata": [
[
"title",
"NativeIO API: Failures of rename are properly handled."
],
[
"global",
"window,worker"
],
[
"script",
"resources/support.js"
]
]
}
],
[
"native-io/rename_async_failure_handling.tentative.https.any.serviceworker.html",
{
"script_metadata": [
[
"title",
"NativeIO API: Failures of rename are properly handled."
],
[
"global",
"window,worker"
],
[
"script",
"resources/support.js"
]
]
}
],
[
"native-io/rename_async_failure_handling.tentative.https.any.sharedworker.html",
{
"script_metadata": [
[
"title",
"NativeIO API: Failures of rename are properly handled."
],
[
"global",
"window,worker"
],
[
"script",
"resources/support.js"
]
]
}
],
[
"native-io/rename_async_failure_handling.tentative.https.any.worker.html",
{
"script_metadata": [
[
"title",
"NativeIO API: Failures of rename are properly handled."
],
[
"global",
"window,worker"
],
[
"script",
"resources/support.js"
]
]
}
]
],
"rename_sync_basic.tentative.https.any.js": [
"af04885dfd72cd864f192d8f96602bc4c2fed206",
[
"native-io/rename_sync_basic.tentative.https.any.worker.html",
{
"script_metadata": [
[
"title",
"Synchronous NativeIO API: File renaming is reflected in listing."
],
[
"global",
"dedicatedworker"
]
]
}
]
],
"rename_sync_failure_handling.tentative.https.any.js": [
"92c42c7d3cd254dbf49e328de993fe222d30fc82",
[
"native-io/rename_sync_failure_handling.tentative.https.any.worker.html",
{
"script_metadata": [
[
"title",
"Synchronous NativeIO API: Failures of rename are properly handled."
],
[
"global",
"dedicatedworker"
],
[
"script",
"resources/support.js"
]
]
}
]
]
},
"navigation-timing": {
@ -482326,6 +482705,15 @@
{}
]
],
"portals-activate-while-unloading.html": [
"5abb164b3ba1bda8ebcbd1f27da50a85134aced1",
[
null,
{
"testdriver": true
}
]
],
"portals-adopt-predecessor.html": [
"04c61960627836b54e1a04da168c075b1ba93723",
[

View file

@ -1,4 +0,0 @@
[hit-test-floats-002.html]
[Hit test float]
expected: FAIL

View file

@ -1,4 +0,0 @@
[hit-test-floats-003.html]
[Miss float below something else]
expected: FAIL

View file

@ -0,0 +1,2 @@
[trailing-other-space-separators-break-spaces-008.html]
expected: FAIL

View file

@ -1,4 +0,0 @@
[CaretPosition-001.html]
[Element at (400, 100)]
expected: FAIL

View file

@ -6,3 +6,6 @@
[addEventListener "once" option is respected]
expected: TIMEOUT
[listeners for "change" type are called]
expected: FAIL

View file

@ -1,4 +0,0 @@
[elementFromPoint-001.html]
[CSSOM View - 5 - extensions to the Document interface]
expected: FAIL

View file

@ -21,6 +21,3 @@
[test the top of layer]
expected: FAIL
[test some point of the element: top left corner]
expected: FAIL

View file

@ -1,4 +0,0 @@
[elementsFromPoint-invalid-cases.html]
[The root element is the last element returned for otherwise empty queries within the viewport]
expected: FAIL

View file

@ -0,0 +1,2 @@
[HTMLMediaElement.html]
expected: TIMEOUT

View file

@ -312,27 +312,21 @@
[fetch(): separate response Content-Type: text/plain ]
expected: NOTRUN
[<iframe>: separate response Content-Type: text/plain */*;charset=gbk]
expected: FAIL
[<iframe>: combined response Content-Type: text/html;" text/plain]
expected: FAIL
[<iframe>: combined response Content-Type: text/html;charset=gbk text/plain text/html]
expected: FAIL
[<iframe>: separate response Content-Type: text/html */*]
expected: FAIL
[<iframe>: combined response Content-Type: text/html */*;charset=gbk]
expected: FAIL
[<iframe>: combined response Content-Type: text/html */*]
expected: FAIL
[<iframe>: separate 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/plain */*]
expected: FAIL
[<iframe>: combined response Content-Type: text/html;" \\" text/plain]
expected: FAIL
[<iframe>: combined response Content-Type: text/html;x=" text/plain]
expected: FAIL

View file

@ -11,6 +11,3 @@
[X-Content-Type-Options%3A%20nosniff%2C%2C%40%23%24%23%25%25%26%5E%26%5E*()()11!]
expected: FAIL
[X-Content-Type-Options%3A%20'NosniFF']
expected: FAIL

View file

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

View file

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

View file

@ -0,0 +1,2 @@
[cross-origin-objects-on-new-window.html]
expected: TIMEOUT

View file

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

View file

@ -1,5 +1,4 @@
[supported-elements.html]
expected: TIMEOUT
[Contenteditable element should support autofocus]
expected: FAIL
@ -10,7 +9,7 @@
expected: FAIL
[Area element should support autofocus]
expected: TIMEOUT
expected: FAIL
[Host element with delegatesFocus should support autofocus]
expected: FAIL

View file

@ -1,6 +1,6 @@
[iframe_sandbox_popups_escaping-1.html]
type: testharness
expected: TIMEOUT
expected: CRASH
[Check that popups from a sandboxed iframe escape the sandbox if\n allow-popups-to-escape-sandbox is used]
expected: TIMEOUT

View file

@ -1,5 +1,5 @@
[iframe_sandbox_popups_escaping-2.html]
expected: CRASH
expected: TIMEOUT
[Check that popups from a sandboxed iframe escape the sandbox if\n allow-popups-to-escape-sandbox is used]
expected: TIMEOUT

View file

@ -1,5 +1,6 @@
[iframe_sandbox_popups_escaping-3.html]
type: testharness
expected: TIMEOUT
[Check that popups from a sandboxed iframe escape the sandbox if\n allow-popups-to-escape-sandbox is used]
expected: FAIL
expected: TIMEOUT

View file

@ -1,5 +1,6 @@
[iframe_sandbox_popups_nonescaping-3.html]
type: testharness
expected: TIMEOUT
[Check that popups from a sandboxed iframe do not escape the sandbox]
expected: FAIL
expected: NOTRUN

View file

@ -1,4 +0,0 @@
[form-double-submit-2.html]
[preventDefault should allow onclick submit() to succeed]
expected: FAIL

View file

@ -0,0 +1,4 @@
[form-double-submit-3.html]
[<button> should have the same double-submit protection as <input type=submit>]
expected: FAIL

View file

@ -4,6 +4,3 @@
[The incumbent settings object while executing the compiled callback via Web IDL's invoke must be that of the node document]
expected: TIMEOUT
[The entry settings object while executing the compiled callback via Web IDL's invoke must be that of the node document]
expected: FAIL

View file

@ -1,4 +1,5 @@
[realtimeanalyser-fft-scaling.html]
expected: TIMEOUT
[X 2048-point FFT peak position is not equal to 64. Got 0.]
expected: FAIL

View file

@ -0,0 +1,5 @@
[018.html]
expected: TIMEOUT
[origin of the script that invoked the method, javascript:]
expected: TIMEOUT

View file

@ -1,5 +1,6 @@
[003.html]
type: testharness
expected: ERROR
[shared]
expected: FAIL

View file

@ -0,0 +1,18 @@
<!DOCTYPE html>
<link rel="help" href="https://drafts.csswg.org/css2/visuren.html#propdef-position">
<link rel="author" title="Koji Ishii" href="mailto:kojii@chromium.org">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div>
<span style="border: 1px solid blue">
<span style="position: relative">
<span style="display: inline-block">
<span style="position: absolute; background: orange; width: 100px; height: 100px"></span>
</span>
</span>
</span>
</div>
<script>
// Test pass if it does not crash.
test(() => {});
</script>

View file

@ -0,0 +1,53 @@
<!doctype html>
<title>Aspect-ratio items with borders</title>
<link rel="author" title="David Grogan" href="mailto:dgrogan@chromium.org">
<link rel="help" href="https://drafts.csswg.org/css-flexbox/#algo-main-item" title="Section B">
<link rel="help" href="https://drafts.csswg.org/css-flexbox/#transferred-size-suggestion">
<link rel="help" href="https://drafts.csswg.org/css-flexbox/#content-size-suggestion">
<meta name="assert" content="Multiplying cross size by aspect ratio should operate on content box only.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/check-layout-th.js"></script>
<style>
img {
border-top: 50px solid blue;
border-left: 10px solid orange;
}
.flexbox {
display: flex;
margin-bottom: 20px;
}
</style>
<!-- script after body was flakily triggering before images were loaded, so wait for onload -->
<body onload="checkLayout('img')">
<p>
The green boxes should all be 100x100.
</p>
Section B of flex base size + transferred size suggestion:
<div class=flexbox>
<img style="height: 100px;" src="support/200x200-green.png" data-expected-client-width=100 data-expected-client-height=100 />
</div>
Section B of flex base size + transferred size suggestion, with box-sizing: border-box:
<!-- Chrome 83 fails the border-box version. -->
<div class=flexbox>
<img style="height: 150px; box-sizing: border-box;" src="support/200x200-green.png" data-expected-client-width=100 data-expected-client-height=100 />
</div>
content size suggestion
<div class=flexbox>
<img style="max-height: 100px;" src="support/200x200-green.png" data-expected-client-width=100 data-expected-client-height=100 />
</div>
content size suggestion
<div class=flexbox>
<img style="min-height: 100px;" src="support/60x60-green.png" data-expected-client-width=100 data-expected-client-height=100 />
</div>
</body>

View file

@ -16,28 +16,29 @@ const cross_origin = get_host_info().HTTPS_REMOTE_ORIGIN;
const coep_header = '|header(Cross-Origin-Embedder-Policy,require-corp)';
let operation = [
//[type , property , operation ] ,
["Call" , "blur" , w => w.blur() ] ,
["Call" , "foo" , w => w.foo() ] ,
["Call" , "location" , w => w.location() ] ,
["Call" , "opener" , w => w.opener() ] ,
["Call" , "postMessage" , w => w.postMessage() ] ,
["Call" , "window" , w => w.window() ] ,
["Read" , "blur" , w => w.blur ] ,
["Read" , "foo" , w => w.foo ] ,
["Read" , "location" , w => w.location ] ,
["Read" , "opener" , w => w.opener ] ,
["Read" , "postMessage" , w => w.postMessage ] ,
["Read" , "window" , w => w.window ] ,
["Write" , "blur" , w => w.blur = "test" ] ,
["Write" , "foo" , w => w.foo = "test" ] ,
["Write" , "location" , w => w.location = "test" ] ,
["Write" , "opener" , w => w.opener = "test" ] ,
["Write" , "postMessage" , w => w.postMessage = "test" ] ,
["Write" , "window" , w => w.window = "test" ] ,
//[property , operation ] ,
["blur" , w => w.blur() ] ,
["close" , w => w.close() ] ,
["closed" , w => w.closed ] ,
["focus" , w => w.focus() ] ,
["frames" , w => w.frames ] ,
["indexed" , w => w[0] ] ,
["indexed" , w => w[0] = "" ] ,
["length" , w => w.length ] ,
["location" , w => w.location ] ,
["location" , w => w.location = "#" ] ,
["named" , w => w["test"] ] ,
["named" , w => w["test"] = "" ] ,
["opener" , w => w.opener ] ,
["opener" , w => w.opener = "" ] ,
["postMessage" , w => w.postMessage("") ] ,
["postMessage" , w => w.postMessage("", "")] ,
["self" , w => w.self ] ,
["top" , w => w.top ] ,
["window" , w => w.window ] ,
];
operation.forEach(([type, property, op]) => {
operation.forEach(([property, op]) => {
promise_test(async t => {
const report_token = token();
const executor_token = token();
@ -59,7 +60,8 @@ operation.forEach(([type, property, op]) => {
// 2. Skip the first report about the opener breakage.
let report_1 = await receive(report_token);
assert_not_equals(report_1, "timeout");
assert_not_equals(report_1, "timeout",
"Receive navigation-to-document report");
report_1 = JSON.parse(report_1);
assert_equals(report_1.length, 1);
assert_equals(report_1[0].type, "coop");
@ -71,11 +73,11 @@ operation.forEach(([type, property, op]) => {
// 4. A COOP access reports must be sent as a result of (3).
let report_2 = await receive(report_token);
assert_not_equals(report_1, "timeout");
assert_not_equals(report_2, "timeout", "Receive access report");
report_2 = JSON.parse(report_2);
assert_equals(report_2.length, 1);
assert_equals(report_2[0].type, "coop");
assert_equals(report_2[0].url, openee_url);
assert_equals(report_2[0].url, openee_url.replace(/"/g, '%22'));
assert_equals(report_2[0].body["violation-type"], "access-to-coop-page");
assert_equals(report_2[0].body["disposition"], "reporting");
assert_equals(report_2[0].body["effective-policy"], "same-origin-plus-coep");
@ -84,7 +86,7 @@ operation.forEach(([type, property, op]) => {
assert_equals(report_2[0].body["lineno"], undefined);
assert_equals(report_2[0].body["colno"], undefined);
// TODO(arthursonzogni): Add check for report > body > blocked-window-url
}, `${type} ${property}`);
}, `${op}`);
});
</script>

View file

@ -16,28 +16,29 @@ const cross_origin = get_host_info().HTTPS_REMOTE_ORIGIN;
const coep_header = '|header(Cross-Origin-Embedder-Policy,require-corp)';
let operation = [
//[type , property , operation ] ,
["Call" , "blur" , w => w.blur() ] ,
["Call" , "foo" , w => w.foo() ] ,
["Call" , "location" , w => w.location() ] ,
["Call" , "opener" , w => w.opener() ] ,
["Call" , "postMessage" , w => w.postMessage() ] ,
["Call" , "window" , w => w.window() ] ,
["Read" , "blur" , w => w.blur ] ,
["Read" , "foo" , w => w.foo ] ,
["Read" , "location" , w => w.location ] ,
["Read" , "opener" , w => w.opener ] ,
["Read" , "postMessage" , w => w.postMessage ] ,
["Read" , "window" , w => w.window ] ,
["Write" , "blur" , w => w.blur = "test" ] ,
["Write" , "foo" , w => w.foo = "test" ] ,
["Write" , "location" , w => w.location = "test" ] ,
["Write" , "opener" , w => w.opener = "test" ] ,
["Write" , "postMessage" , w => w.postMessage = "test" ] ,
["Write" , "window" , w => w.window = "test" ] ,
//[property , operation ] ,
["blur" , w => w.blur() ] ,
["close" , w => w.close() ] ,
["closed" , w => w.closed ] ,
["focus" , w => w.focus() ] ,
["frames" , w => w.frames ] ,
["indexed" , w => w[0] ] ,
["indexed" , w => w[0] = "" ] ,
["length" , w => w.length ] ,
["location" , w => w.location ] ,
["location" , w => w.location = "#" ] ,
["named" , w => w["test"] ] ,
["named" , w => w["test"] = "" ] ,
["opener" , w => w.opener ] ,
["opener" , w => w.opener = "" ] ,
["postMessage" , w => w.postMessage("") ] ,
["postMessage" , w => w.postMessage("", "")] ,
["self" , w => w.self ] ,
["top" , w => w.top ] ,
["window" , w => w.window ] ,
];
operation.forEach(([type, property, op]) => {
operation.forEach(([property, op]) => {
promise_test(async t => {
const report_token = token();
const executor_token = token();
@ -59,7 +60,8 @@ operation.forEach(([type, property, op]) => {
// 2. Skip the first report about the opener breakage.
let report_1 = await receive(report_token);
assert_not_equals(report_1, "timeout");
assert_not_equals(report_1, "timeout",
"Receive navigation-to-document report");
report_1 = JSON.parse(report_1);
assert_equals(report_1.length, 1);
assert_equals(report_1[0].type, "coop");
@ -71,11 +73,11 @@ operation.forEach(([type, property, op]) => {
// 4. A COOP access reports must be sent as a result of (3).
let report_2 = await receive(report_token);
assert_not_equals(report_2, "timeout");
assert_not_equals(report_2, "timeout", "Receive access report");
report_2 = JSON.parse(report_2);
assert_equals(report_2.length, 1);
assert_equals(report_2[0].type, "coop");
assert_equals(report_2[0].url, openee_url);
assert_equals(report_2[0].url, openee_url.replace(/"/g, '%22'));
assert_equals(report_2[0].body["violation-type"], "access-to-coop-page");
assert_equals(report_2[0].body["disposition"], "enforce");
assert_equals(report_2[0].body["effective-policy"], "same-origin-plus-coep");
@ -85,7 +87,7 @@ operation.forEach(([type, property, op]) => {
assert_equals(report_2[0].body["colno"], undefined);
// TODO(arthursonzogni): Add check for report > body > blocked-window-url
}, `${type} ${property}`);
}, `${op}`);
});
</script>

View file

@ -16,28 +16,29 @@ const cross_origin = get_host_info().HTTPS_REMOTE_ORIGIN;
const coep_header = '|header(Cross-Origin-Embedder-Policy,require-corp)';
let operation = [
//[type , property , operation ] ,
["Call" , "blur" , "opener.blur()" ] ,
["Call" , "foo" , "opener.foo()" ] ,
["Call" , "location" , "opener.location()" ] ,
["Call" , "opener" , "opener.opener()" ] ,
["Call" , "postMessage" , "opener.postMessage()" ] ,
["Call" , "window" , "opener.window()" ] ,
["Read" , "blur" , "opener.blur" ] ,
["Read" , "foo" , "opener.foo" ] ,
["Read" , "location" , "opener.location" ] ,
["Read" , "opener" , "opener.opener" ] ,
["Read" , "postMessage" , "opener.postMessage" ] ,
["Read" , "window" , "opener.window" ] ,
["Write" , "blur" , "opener.blur = 'test'" ] ,
["Write" , "foo" , "opener.foo = 'test'" ] ,
["Write" , "location" , "opener.location = 'test'" ] ,
["Write" , "opener" , "opener.opener = 'test'" ] ,
["Write" , "postMessage" , "opener.postMessage = 'test'" ] ,
["Write" , "window" , "opener.window = 'test'" ] ,
//[property , operation ] ,
["blur" , 'opener.blur()' ] ,
["close" , 'opener.close()' ] ,
["closed" , 'opener.closed' ] ,
["focus" , 'opener.focus()' ] ,
["frames" , 'opener.frames' ] ,
["indexed" , 'opener[0]' ] ,
["indexed" , 'opener[0] = ""' ] ,
["length" , 'opener.length' ] ,
["location" , 'opener.location' ] ,
["location" , 'opener.location = "#"' ] ,
["named" , 'opener["test"]' ] ,
["named" , 'opener["test"] = ""' ] ,
["opener" , 'opener.opener' ] ,
["opener" , 'opener.opener = ""' ] ,
["postMessage" , 'opener.postMessage("")' ] ,
["postMessage" , 'opener.postMessage("", "")'] ,
["self" , 'opener.self' ] ,
["top" , 'opener.top' ] ,
["window" , 'opener.window' ] ,
];
operation.forEach(([type, property, op]) => {
operation.forEach(([property, op]) => {
promise_test(async t => {
const report_token = token();
const executor_token = token();
@ -52,7 +53,8 @@ operation.forEach(([type, property, op]) => {
// 1. Skip the first report about the opener breakage.
let report_1 = await receive(report_token);
assert_not_equals(report_1, "timeout");
assert_not_equals(report_1, "timeout",
"Receive navigation-to-document report");
report_1 = JSON.parse(report_1);
assert_equals(report_1.length, 1);
assert_equals(report_1[0].type, "coop");
@ -69,11 +71,12 @@ operation.forEach(([type, property, op]) => {
// 4. A COOP access reports must be sent as a result of (3).
let report_2 = await receive(report_token);
assert_not_equals(report_2, "timeout");
assert_not_equals(report_2, "timeout", "Receive access report");
report_2 = JSON.parse(report_2);
assert_equals(report_2.length, 1);
assert_equals(report_2[0].type, "coop");
assert_equals(report_2[0].url, openee_url.replace(/"/g, '%22'));
assert_equals(report_2[0].body["violation-type"], "access-from-coop-page");
assert_equals(report_2[0].body["disposition"], "reporting");
assert_equals(report_2[0].body["effective-policy"], "same-origin-plus-coep");
@ -81,7 +84,7 @@ operation.forEach(([type, property, op]) => {
assert_equals(report_2[0].body["source-file"], undefined);
assert_equals(report_2[0].body["lineno"], undefined);
assert_equals(report_2[0].body["colno"], undefined);
}, `${type} ${property}`);
}, `${op})`);
});
</script>

View file

@ -16,28 +16,29 @@ const cross_origin = get_host_info().HTTPS_REMOTE_ORIGIN;
const coep_header = '|header(Cross-Origin-Embedder-Policy,require-corp)';
let operation = [
//[type , property , operation ] ,
["Call" , "blur" , "opener.blur()" ] ,
["Call" , "foo" , "opener.foo()" ] ,
["Call" , "location" , "opener.location()" ] ,
["Call" , "opener" , "opener.opener()" ] ,
["Call" , "postMessage" , "opener.postMessage()" ] ,
["Call" , "window" , "opener.window()" ] ,
["Read" , "blur" , "opener.blur" ] ,
["Read" , "foo" , "opener.foo" ] ,
["Read" , "location" , "opener.location" ] ,
["Read" , "opener" , "opener.opener" ] ,
["Read" , "postMessage" , "opener.postMessage" ] ,
["Read" , "window" , "opener.window" ] ,
["Write" , "blur" , "opener.blur = 'test'" ] ,
["Write" , "foo" , "opener.foo = 'test'" ] ,
["Write" , "location" , "opener.location = 'test'" ] ,
["Write" , "opener" , "opener.opener = 'test'" ] ,
["Write" , "postMessage" , "opener.postMessage = 'test'" ] ,
["Write" , "window" , "opener.window = 'test'" ] ,
//[property , operation ] ,
["blur" , 'opener.blur()' ] ,
["close" , 'opener.close()' ] ,
["closed" , 'opener.closed' ] ,
["focus" , 'opener.focus()' ] ,
["frames" , 'opener.frames' ] ,
["indexed" , 'opener[0]' ] ,
["indexed" , 'opener[0] = ""' ] ,
["length" , 'opener.length' ] ,
["location" , 'opener.location' ] ,
["location" , 'opener.location = "#"' ] ,
["named" , 'opener["test"]' ] ,
["named" , 'opener["test"] = ""' ] ,
["opener" , 'opener.opener' ] ,
["opener" , 'opener.opener = ""' ] ,
["postMessage" , 'opener.postMessage("")' ] ,
["postMessage" , 'opener.postMessage("", "")'] ,
["self" , 'opener.self' ] ,
["top" , 'opener.top' ] ,
["window" , 'opener.window' ] ,
];
operation.forEach(([type, property, op]) => {
operation.forEach(([property, op]) => {
promise_test(async t => {
const report_token = token();
const executor_token = token();
@ -52,7 +53,8 @@ operation.forEach(([type, property, op]) => {
// 1. Skip the first report about the opener breakage.
let report_1 = await receive(report_token);
assert_not_equals(report_1, "timeout");
assert_not_equals(report_1, "timeout",
"Receive navigation-to-document report");
report_1 = JSON.parse(report_1);
assert_equals(report_1.length, 1);
assert_equals(report_1[0].type, "coop");
@ -69,11 +71,12 @@ operation.forEach(([type, property, op]) => {
// 4. A COOP access reports must be sent as a result of (3).
let report_2 = await receive(report_token);
assert_not_equals(report_2, "timeout");
assert_not_equals(report_2, "timeout", "Received access report");
report_2 = JSON.parse(report_2);
assert_equals(report_2.length, 1);
assert_equals(report_2[0].type, "coop");
assert_equals(report_2[0].url, openee_url.replace(/"/g, '%22'));
assert_equals(report_2[0].body["violation-type"], "access-from-coop-page");
assert_equals(report_2[0].body["disposition"], "enforce");
assert_equals(report_2[0].body["effective-policy"], "same-origin-plus-coep");
@ -81,7 +84,7 @@ operation.forEach(([type, property, op]) => {
assert_equals(report_2[0].body["source-file"], undefined);
assert_equals(report_2[0].body["lineno"], undefined);
assert_equals(report_2[0].body["colno"], undefined);
}, `${type} ${property}`);
}, `${op}`);
});
</script>

View file

@ -49,7 +49,7 @@ const reportToHeaders = function(uuid) {
return {
header: `|header(report-to,${reportToJSON})`,
coopSameOriginHeader: `|header(Cross-Origin-Opener-Policy, same-origin%3Breport-to="${uuid}")`,
coopReportOnlySameOriginHeader: `|header(Cross-Origin-Opener-Policy-Report-Only, same-origin%3Breport-to="${uuid}")`,
coopSameOriginHeader: `|header(Cross-Origin-Opener-Policy,same-origin%3Breport-to="${uuid}")`,
coopReportOnlySameOriginHeader: `|header(Cross-Origin-Opener-Policy-Report-Only,same-origin%3Breport-to="${uuid}")`,
};
};

View file

@ -172,6 +172,7 @@ SET TIMEOUT: IndexedDB/*
SET TIMEOUT: infrastructure/*
SET TIMEOUT: intersection-observer/resources/*
SET TIMEOUT: intersection-observer/target-in-different-window.html
SET TIMEOUT: measure-memory/*
SET TIMEOUT: media-source/mediasource-util.js
SET TIMEOUT: media-source/URL-createObjectURL-revoke.html
SET TIMEOUT: mixed-content/generic/sanity-checker.js

View file

@ -0,0 +1,108 @@
// META: script=/common/get-host-info.sub.js
// META: script=./resources/common.js
// META: timeout=long
'use strict';
promise_test(async testCase => {
const {iframes, windows} = await build([
{
id: 'cross-site-1',
children: [
{
id: 'same-origin-2',
},
{
id: 'same-origin-11',
window_open: true,
},
],
},
{
id: 'same-origin-3',
children: [
{
id: 'same-origin-4',
},
{
id: 'same-origin-12',
window_open: true,
},
],
},
{
id: 'cross-origin-5',
children: [
{
id: 'same-origin-6',
},
{
id: 'same-origin-13',
window_open: true,
},
],
},
{
id: 'same-origin-7',
window_open: true,
children: [
{
id: 'same-origin-8',
}
],
},
{
id: 'cross-origin-9',
window_open: true,
children: [
{
id: 'same-origin-10',
}
],
},
]);
const allowed = [
window.location.href,
iframes['cross-site-1'].src,
iframes['same-origin-3'].src,
iframes['same-origin-4'].src,
iframes['cross-origin-5'].src,
windows['same-origin-7'].location.href,
windows['same-origin-12'].location.href,
];
const keep = sameOriginContexts(frames).concat(sameOriginContexts(windows));
// Detach iframes:
// 1) By setting src attribute:
iframes['cross-site-1'].src =
iframes['cross-site-1'].src.replace('iframe.sub', 'iframe.secret.sub');
// 2) By setting location attribute:
let url = iframes['same-origin-3'].contentWindow.location.href;
url = url.replace('iframe.sub', 'iframe.secret.sub');
iframes['same-origin-3'].contentWindow.location.href = url;
// 3) By removing from the DOM tree:
iframes['cross-origin-5'].parentNode.removeChild(iframes['cross-origin-5']);
// Detach windows:
// 1) By setting document.location attribute:
url = windows['same-origin-7'].location.href;
url = url.replace('window.sub', 'window.secret.sub');
windows['same-origin-7'].location.href = url;
// 2) By closing the window:
windows['cross-origin-9'].close();
try {
const result = await performance.measureMemory();
checkMeasureMemory(result, {
allowed: allowed.concat([
iframes['cross-site-1'].src,
]),
required: [
window.location.href,
],
});
} catch (error) {
if (!(error instanceof DOMException)) {
throw error;
}
assert_equals(error.name, 'SecurityError');
}
}, 'performance.measureMemory URLs within a cross-site iframe.');

View file

@ -0,0 +1,40 @@
// META: script=/common/get-host-info.sub.js
// META: script=./resources/common.js
// META: timeout=long
'use strict';
promise_test(async testCase => {
const {iframes} = await build([
{
id: 'cross-origin-1',
children: [
{
id: 'same-origin-2',
},
{
id: 'cross-origin-3',
},
{
id: 'cross-site-4',
}
],
},
]);
try {
const result = await performance.measureMemory();
checkMeasureMemory(result, {
allowed: [
window.location.href,
iframes['cross-origin-1'].src,
],
required: [
window.location.href,
],
});
} catch (error) {
if (!(error instanceof DOMException)) {
throw error;
}
assert_equals(error.name, 'SecurityError');
}
}, 'performance.measureMemory URLs within a cross-origin iframe.');

View file

@ -0,0 +1,40 @@
// META: script=/common/get-host-info.sub.js
// META: script=./resources/common.js
// META: timeout=long
'use strict';
promise_test(async testCase => {
const {iframes} = await build([
{
id: 'cross-site-1',
children: [
{
id: 'same-origin-2',
},
{
id: 'cross-origin-3',
},
{
id: 'cross-site-4',
}
],
},
]);
try {
const result = await performance.measureMemory();
checkMeasureMemory(result, {
allowed: [
window.location.href,
iframes['cross-site-1'].src,
],
required: [
window.location.href,
],
});
} catch (error) {
if (!(error instanceof DOMException)) {
throw error;
}
assert_equals(error.name, 'SecurityError');
}
}, 'performance.measureMemory URLs within a cross-site iframe.');

View file

@ -0,0 +1,37 @@
// META: script=/common/get-host-info.sub.js
// META: script=./resources/common.js
// META: timeout=long
'use strict';
promise_test(async testCase => {
const {iframes} = await build([
{
id: 'same-origin-1',
children: [
{
id: 'same-origin-2',
}
],
},
]);
try {
const result = await performance.measureMemory();
checkMeasureMemory(result, {
allowed: [
window.location.href,
iframes['same-origin-1'].src,
iframes['same-origin-2'].src,
],
required: [
window.location.href,
iframes['same-origin-1'].src,
iframes['same-origin-2'].src,
]
});
} catch (error) {
if (!(error instanceof DOMException)) {
throw error;
}
assert_equals(error.name, 'SecurityError');
}
}, 'Well-formed result of performance.measureMemory with same-origin iframes.');

View file

@ -4,9 +4,12 @@
'use strict';
promise_test(async testCase => {
try {
let result = await performance.measureMemory();
checkMeasureMemory(result, {allowed: [window.location.href]});
try {
const result = await performance.measureMemory();
checkMeasureMemory(result, {
allowed: [window.location.href],
required: [window.location.href],
});
} catch (error) {
if (!(error instanceof DOMException)) {
throw error;

View file

@ -1,30 +0,0 @@
// META: script=/common/get-host-info.sub.js
// META: script=./resources/common.js
// META: timeout=long
'use strict';
promise_test(async testCase => {
const grandchildLoaded = new Promise(resolve => {
window.onmessage = function(message) {
if (message.data === 'grandchild-loaded') {
resolve(message);
}
}
});
const frame = document.createElement('iframe');
const child = getUrl(CROSS_ORIGIN, 'resources/child.sub.html');
frame.src = child;
document.body.append(frame);
await grandchildLoaded;
try {
let result = await performance.measureMemory();
checkMeasureMemory(result, {
allowed: [window.location.href, child]
});
} catch (error) {
if (!(error instanceof DOMException)) {
throw error;
}
assert_equals(error.name, 'SecurityError');
}
}, 'Well-formed result of performance.measureMemory with cross-origin iframe.');

View file

@ -1,30 +0,0 @@
// META: script=/common/get-host-info.sub.js
// META: script=./resources/common.js
// META: timeout=long
'use strict';
promise_test(async testCase => {
const grandchildLoaded = new Promise(resolve => {
window.onmessage = function(message) {
if (message.data === 'grandchild-loaded') {
resolve(message);
}
}
});
const frame = document.createElement('iframe');
const redirecting_child = getUrl(CROSS_ORIGIN, 'resources/redirecting-child.sub.html');
frame.src = redirecting_child;
document.body.append(frame);
await grandchildLoaded;
try {
let result = await performance.measureMemory();
checkMeasureMemory(result, {
allowed: [window.location.href, redirecting_child]
});
} catch (error) {
if (!(error instanceof DOMException)) {
throw error;
}
assert_equals(error.name, 'SecurityError');
}
}, 'Well-formed result of performance.measureMemory with cross-origin iframe.');

View file

@ -1,31 +0,0 @@
// META: script=/common/get-host-info.sub.js
// META: script=./resources/common.js
// META: timeout=long
'use strict';
promise_test(async testCase => {
const grandchildLoaded = new Promise(resolve => {
window.onmessage = function(message) {
if (message.data === 'grandchild-loaded') {
resolve(message);
}
}
});
const frame = document.createElement('iframe');
const child = getUrl(SAME_ORIGIN, 'resources/child.sub.html');
const grandchild = getUrl(SAME_ORIGIN, 'resources/grandchild.sub.html');
frame.src = child;
document.body.append(frame);
await grandchildLoaded;
try {
let result = await performance.measureMemory();
checkMeasureMemory(result, {
allowed: [window.location.href, child, grandchild],
});
} catch (error) {
if (!(error instanceof DOMException)) {
throw error;
}
assert_equals(error.name, 'SecurityError');
}
}, 'Well-formed result of performance.measureMemory with same-origin iframe.');

View file

@ -0,0 +1,58 @@
// META: script=/common/get-host-info.sub.js
// META: script=./resources/common.js
// META: timeout=long
'use strict';
promise_test(async testCase => {
const {iframes, windows} = await build([
{
id: 'cross-origin-1',
redirect: 'client',
children: [
{
id: 'same-origin-2',
},
{
id: 'cross-origin-3',
},
{
id: 'cross-site-4',
}
],
},
{
id: 'cross-origin-5',
redirect: 'client',
window_open: true,
children: [
{
id: 'same-origin-6',
},
{
id: 'cross-origin-7',
},
{
id: 'cross-site-8',
}
],
},
]);
const keep = sameOriginContexts(frames).concat(sameOriginContexts(windows));
try {
const result = await performance.measureMemory();
checkMeasureMemory(result, {
allowed: [
window.location.href,
iframes['cross-origin-1'].src,
],
required: [
window.location.href,
],
});
} catch (error) {
if (!(error instanceof DOMException)) {
throw error;
}
assert_equals(error.name, 'SecurityError');
}
}, 'performance.measureMemory does not leak client redirected URL.');

View file

@ -0,0 +1,58 @@
// META: script=/common/get-host-info.sub.js
// META: script=./resources/common.js
// META: timeout=long
'use strict';
promise_test(async testCase => {
const {iframes, windows} = await build([
{
id: 'cross-origin-1',
redirect: 'server',
children: [
{
id: 'same-origin-2',
},
{
id: 'cross-origin-3',
},
{
id: 'cross-site-4',
}
],
},
{
id: 'cross-origin-5',
redirect: 'server',
window_open: true,
children: [
{
id: 'same-origin-6',
},
{
id: 'cross-origin-7',
},
{
id: 'cross-site-8',
}
],
},
]);
const keep = sameOriginContexts(frames).concat(sameOriginContexts(windows));
try {
const result = await performance.measureMemory();
checkMeasureMemory(result, {
allowed: [
window.location.href,
iframes['cross-origin-1'].src,
],
required: [
window.location.href,
],
});
} catch (error) {
if (!(error instanceof DOMException)) {
throw error;
}
assert_equals(error.name, 'SecurityError');
}
}, 'performance.measureMemory does not leak server redirected URL.');

View file

@ -1,17 +0,0 @@
<!doctype html>
<meta charset=utf-8>
<html>
<script>
window.onmessage = function (message) {
// Forward the message to the parent.
window.parent.postMessage(message.data, '*');
}
window.onload = function () {
window.parent.postMessage('grandchild-loaded', '*');
}
</script>
<body>
Hello from child iframe.
<iframe src="grandchild.sub.html"></iframe>
</body>
</html>

View file

@ -1,35 +1,182 @@
const SAME_ORIGIN = {origin: get_host_info().HTTP_ORIGIN, name: "SAME_ORIGIN"};
const CROSS_ORIGIN = {origin: get_host_info().HTTP_REMOTE_ORIGIN, name: "CROSS_ORIGIN"}
const ORIGINS = {
'same-origin': get_host_info().HTTP_ORIGIN,
'cross-origin': get_host_info().HTTP_REMOTE_ORIGIN,
'cross-site': get_host_info().HTTP_NOTSAMESITE_ORIGIN,
}
function checkMeasureMemoryBreakdown(breakdown, options) {
let allowed = new Set(options.allowed);
function checkMeasureMemoryBreakdown(breakdown, options, required) {
const allowed = new Set(options.allowed);
assert_own_property(breakdown, 'bytes');
assert_greater_than_equal(breakdown.bytes, 0);
assert_own_property(breakdown, 'userAgentSpecificTypes');
for (let userAgentSpecificType of breakdown.userAgentSpecificTypes) {
for (const userAgentSpecificType of breakdown.userAgentSpecificTypes) {
assert_equals(typeof userAgentSpecificType, 'string');
}
assert_own_property(breakdown, 'attribution');
for (let attribution of breakdown.attribution) {
for (const attribution of breakdown.attribution) {
assert_equals(typeof attribution, 'string');
assert_true(
allowed.has(attribution),
`${attribution} must be in ${JSON.stringify(options.allowed)}`);
if (required.has(attribution)) {
required.delete(attribution);
}
}
}
function checkMeasureMemory(result, options) {
assert_own_property(result, 'bytes');
assert_own_property(result, 'breakdown');
const required = new Set(options.required);
let bytes = 0;
for (let breakdown of result.breakdown) {
checkMeasureMemoryBreakdown(breakdown, options);
checkMeasureMemoryBreakdown(breakdown, options, required);
bytes += breakdown.bytes;
}
assert_equals(bytes, result.bytes);
assert_equals(required.size, 0, JSON.stringify(result.breakdown) +
' does not include ' + JSON.stringify(required.values()));
}
function getUrl(host, relativePath) {
const path = new URL(relativePath, window.location).pathname;
return `${host.origin}${path}`;
function url(params) {
let origin = null;
for (const key of Object.keys(ORIGINS)) {
if (params.id.startsWith(key)) {
origin = ORIGINS[key];
}
}
const child = params.window_open ? 'window' : 'iframe';
let file = `measure-memory/resources/${child}.sub.html`;
if (params.redirect) {
file = `measure-memory/resources/${child}.redirect.sub.html`;
}
let url = `${origin}/${file}?id=${params.id}`;
if (params.redirect === 'server') {
url = `${origin}/common/redirect.py?location=${encodeURIComponent(url)}`;
}
return url;
}
// A simple multiplexor of messages based on iframe ids.
let waitForMessage = (function () {
class Inbox {
constructor() {
this.queue = [];
this.resolve = null;
}
push(value) {
if (this.resolve) {
this.resolve(value);
this.resolve = null;
} else {
this.queue.push(value);
}
}
pop() {
let promise = new Promise(resolve => this.resolve = resolve);
if (this.queue.length > 0) {
this.resolve(this.queue.shift());
this.resolve = null;
}
return promise;
}
}
const inbox = {};
window.onmessage = function (message) {
const id = message.data.id;
const payload = message.data.payload;
inbox[id] = inbox[id] || new Inbox();
inbox[id].push(payload);
}
return function (id) {
inbox[id] = inbox[id] || new Inbox();
return inbox[id].pop();
}
})();
// Constructs iframes based on their descriptoin.
async function build(children) {
window.accessible_children = {iframes: {}, windows: {}};
await Promise.all(children.map(buildChild));
const result = window.accessible_children;
delete window.accessible_children;
return result;
}
async function buildChild(params) {
let child = null;
function target() {
return params.window_open ? child : child.contentWindow;
}
if (params.window_open) {
child = window.open(url(params));
} else {
child = document.createElement('iframe');
child.src = url(params);
child.id = params.id;
document.body.appendChild(child);
}
const ready = await waitForMessage(params.id);
target().postMessage({id: 'parent', payload: params.children}, '*');
const done = await waitForMessage(params.id);
let main = window;
while (true) {
if (main === main.parent) {
if (!main.opener) {
break;
} else {
main = main.opener;
}
} else {
main = main.parent;
}
}
try {
main.accessible_children;
} catch (e) {
// Cross-origin iframe that cannot access the main frame.
return;
}
if (params.window_open) {
main.accessible_children.windows[params.id] = child;
} else {
main.accessible_children.iframes[params.id] = child;
}
}
function getId() {
const params = new URLSearchParams(document.location.search);
return params.get('id');
}
function getParent() {
if (window.parent == window && window.opener) {
return window.opener;
}
return window.parent;
}
// This function runs within an iframe.
// It gets the children descriptions from the parent and constructs them.
async function setupChild() {
const id = getId();
document.getElementById('title').textContent = id;
getParent().postMessage({id : id, payload: 'ready'}, '*');
const children = await waitForMessage('parent');
if (children) {
await build(children);
}
getParent().postMessage({id: id, payload: 'done'}, '*');
}
function sameOriginContexts(children) {
const result = [];
for (const [id, child] of Object.entries(children)) {
if (id.includes('same-origin')) {
result.push(child.contentWindow
? child.contentWindow.performance : child.performance);
}
}
return result;
}

View file

@ -1,12 +0,0 @@
<!doctype html>
<meta charset=utf-8>
<html>
<script>
window.onload = function () {
window.parent.postMessage('grandchild-loaded', '*');
}
</script>
<body>
Hello from grandchild iframe.
</body>
</html>

View file

@ -1,12 +1,12 @@
<!doctype html>
<meta charset=utf-8>
<meta charset="utf-8">
<html>
<script>
window.onload = function () {
document.location.href = document.location.href.replace('redirecting-child', 'child');
document.location.href = document.location.href.replace('redirect', 'secret');
}
</script>
<body>
Hello from child iframe.
Hello from the redirecting iframe: <span id="title"></span>
</body>
</html>

View file

@ -0,0 +1,14 @@
<!doctype html>
<meta charset="utf-8">
<html>
<script src="/common/get-host-info.sub.js"></script>
<script src="./common.js"></script>
<script>
window.onload = function () {
setTimeout(setupChild, 0);
}
</script>
<body>
Hello from the secrect iframe: <span id="title"></span>
</body>
</html>

View file

@ -0,0 +1,14 @@
<!doctype html>
<meta charset="utf-8">
<html>
<script src="/common/get-host-info.sub.js"></script>
<script src="./common.js"></script>
<script>
window.onload = function() {
setTimeout(setupChild, 0);
}
</script>
<body>
Hello from the iframe: <span id="title"></span>
</body>
</html>

View file

@ -0,0 +1,12 @@
<!doctype html>
<meta charset="utf-8">
<html>
<script>
window.onload = function () {
document.location.href = document.location.href.replace('redirect', 'secret');
}
</script>
<body>
Hello from the redirecting widnow: <span id="title"></span>
</body>
</html>

View file

@ -0,0 +1,14 @@
<!doctype html>
<meta charset="utf-8">
<html>
<script src="/common/get-host-info.sub.js"></script>
<script src="./common.js"></script>
<script>
window.onload = function () {
setTimeout(setupChild, 0);
}
</script>
<body>
Hello from the secrect window: <span id="title"></span>
</body>
</html>

View file

@ -0,0 +1,14 @@
<!doctype html>
<meta charset="utf-8">
<html>
<script src="/common/get-host-info.sub.js"></script>
<script src="./common.js"></script>
<script>
window.onload = function() {
setTimeout(setupChild, 0);
}
</script>
<body>
Hello from the window: <span id="title"></span>
</body>
</html>

View file

@ -0,0 +1,41 @@
// META: script=/common/get-host-info.sub.js
// META: script=./resources/common.js
// META: timeout=long
'use strict';
promise_test(async testCase => {
const {windows, iframes} = await build([
{
id: 'cross-origin-1',
window_open: true,
children: [
{
id: 'same-origin-2',
window_open: true,
},
{
id: 'same-origin-3',
},
{
id: 'cross-origin-4',
},
]
},
]);
try {
const result = await performance.measureMemory();
checkMeasureMemory(result, {
allowed: [
window.location.href,
],
required: [
window.location.href,
],
});
} catch (error) {
if (!(error instanceof DOMException)) {
throw error;
}
assert_equals(error.name, 'SecurityError');
}
}, 'performance.measureMemory does not leak URL of cross-origin window.open.');

View file

@ -0,0 +1,41 @@
// META: script=/common/get-host-info.sub.js
// META: script=./resources/common.js
// META: timeout=long
'use strict';
promise_test(async testCase => {
const {windows, iframes} = await build([
{
id: 'cross-site-1',
window_open: true,
children: [
{
id: 'same-origin-2',
window_open: true,
},
{
id: 'same-origin-3',
},
{
id: 'cross-origin-4',
},
]
},
]);
try {
const result = await performance.measureMemory();
checkMeasureMemory(result, {
allowed: [
window.location.href,
],
required: [
window.location.href,
],
});
} catch (error) {
if (!(error instanceof DOMException)) {
throw error;
}
assert_equals(error.name, 'SecurityError');
}
}, 'performance.measureMemory does not leak URL of cross-site window.open.');

View file

@ -0,0 +1,99 @@
// META: script=/common/get-host-info.sub.js
// META: script=./resources/common.js
// META: timeout=long
'use strict';
promise_test(async testCase => {
const {windows, iframes} = await build([
{
id: 'same-origin-1',
children: [
{
id: 'same-origin-2',
window_open: true,
children: [
{
id: 'same-origin-3',
window_open: true,
},
],
},
{
id: 'cross-origin-4',
children: [
{
id: 'same-origin-5',
window_open: true,
},
],
},
{
id: 'cross-site-6',
children: [
{
id: 'same-origin-7',
window_open: true,
},
],
},
{
id: 'same-origin-8',
children: [
{
id: 'cross-origin-9',
window_open: true,
children: [
{
id: 'same-origin-10',
},
{
id: 'same-origin-11',
window_open: true,
},
],
},
{
id: 'cross-site-12',
window_open: true,
children: [
{
id: 'same-origin-13',
},
{
id: 'same-origin-14',
window_open: true,
},
],
},
],
},
]
},
]);
try {
const result = await performance.measureMemory();
checkMeasureMemory(result, {
allowed: [
window.location.href,
iframes['same-origin-1'].src,
windows['same-origin-2'].location.href,
windows['same-origin-3'].location.href,
iframes['cross-origin-4'].src,
iframes['cross-site-6'].src,
iframes['same-origin-8'].src,
],
required: [
window.location.href,
iframes['same-origin-1'].src,
windows['same-origin-2'].location.href,
windows['same-origin-3'].location.href,
iframes['same-origin-8'].src,
],
});
} catch (error) {
if (!(error instanceof DOMException)) {
throw error;
}
assert_equals(error.name, 'SecurityError');
}
}, 'performance.measureMemory does not leak URLs in cross-origin iframes and windows.');

View file

@ -0,0 +1,44 @@
// META: script=/common/get-host-info.sub.js
// META: script=./resources/common.js
// META: timeout=long
'use strict';
promise_test(async testCase => {
const {windows, iframes} = await build([
{
id: 'same-origin-1',
window_open: true,
children: [
{
id: 'same-origin-2',
window_open: true,
},
{
id: 'same-origin-3',
},
]
},
]);
try {
const result = await performance.measureMemory();
checkMeasureMemory(result, {
allowed: [
window.location.href,
windows['same-origin-1'].location.href,
windows['same-origin-2'].location.href,
iframes['same-origin-3'].src,
],
required: [
window.location.href,
windows['same-origin-1'].location.href,
windows['same-origin-2'].location.href,
iframes['same-origin-3'].src,
],
});
} catch (error) {
if (!(error instanceof DOMException)) {
throw error;
}
assert_equals(error.name, 'SecurityError');
}
}, 'Well-formed result of performance.measureMemory with same-origin window.open.');

View file

@ -0,0 +1,23 @@
// META: title=NativeIO API: File renaming is reflected in listing.
// META: global=window,worker
'use strict';
promise_test(async testCase => {
const file = await nativeIO.open('test_file');
await file.close();
const fileNamesBeforeRename = await nativeIO.getAll();
assert_in_array('test_file', fileNamesBeforeRename);
await nativeIO.rename('test_file', 'renamed_test_file');
testCase.add_cleanup(async () => {
await nativeIO.delete('test_file');
await nativeIO.delete('renamed_test_file');
});
const fileNamesAfterRename = await nativeIO.getAll();
assert_false(fileNamesAfterRename.includes('test_file'));
assert_in_array('renamed_test_file', fileNamesAfterRename);
}, 'nativeIO.getAll returns a file renamed by nativeIO.rename' +
' with its new name.');

View file

@ -0,0 +1,127 @@
// META: title=NativeIO API: Failures of rename are properly handled.
// META: global=window,worker
// META: script=resources/support.js
'use strict';
promise_test(async testCase => {
const file1 = await nativeIO.open('test_file_1');
const file2 = await nativeIO.open('test_file_2');
testCase.add_cleanup(async () => {
await file1.close();
await file2.close();
});
const writeSharedArrayBuffer1 = new SharedArrayBuffer(4);
const writtenBytes1 = new Uint8Array(writeSharedArrayBuffer1);
writtenBytes1.set([64, 65, 66, 67]);
const writeSharedArrayBuffer2 = new SharedArrayBuffer(4);
const writtenBytes2 = new Uint8Array(writeSharedArrayBuffer2);
writtenBytes2.set([96, 97, 98, 99]);
await file1.write(writtenBytes1, 0);
await file2.write(writtenBytes2, 0);
await file1.close();
await file2.close();
await promise_rejects_dom(testCase, "UnknownError",
nativeIO.rename('test_file_1', 'test_file_2'));
const fileNamesAfterRename = await nativeIO.getAll();
assert_in_array('test_file_1', fileNamesAfterRename);
assert_in_array('test_file_2', fileNamesAfterRename);
// Make sure that a failed rename does not modify file contents.
const file1_after = await nativeIO.open('test_file_1');
const file2_after = await nativeIO.open('test_file_2');
testCase.add_cleanup(async () => {
await file1_after.close();
await file2_after.close();
await nativeIO.delete('test_file_1');
await nativeIO.delete('test_file_2');
});
const readSharedArrayBuffer1 = new SharedArrayBuffer(writtenBytes1.length);
const readBytes1 = new Uint8Array(readSharedArrayBuffer1);
await file1_after.read(readBytes1, 0);
const readSharedArrayBuffer2 = new SharedArrayBuffer(writtenBytes2.length);
const readBytes2 = new Uint8Array(readSharedArrayBuffer2);
await file2_after.read(readBytes2, 0);
assert_array_equals(readBytes1, writtenBytes1,
'the bytes read should match the bytes written');
assert_array_equals(readBytes2, writtenBytes2,
'the bytes read should match the bytes written');
}, 'nativeIO.rename does not overwrite an existing file.');
promise_test(async testCase => {
const file = await nativeIO.open('test_file');
testCase.add_cleanup(async () => {
await file.close();
await nativeIO.delete('test_file');
});
await promise_rejects_dom(testCase, "UnknownError",
nativeIO.rename('test_file', 'renamed_test_file'));
await file.close();
const fileNamesAfterRename = await nativeIO.getAll();
assert_false(fileNamesAfterRename.includes('renamed_test_file'));
assert_in_array('test_file', fileNamesAfterRename);
}, 'nativeIO.rename does not allow renaming an open file.');
promise_test(async testCase => {
testCase.add_cleanup(async () => {
await file.close();
await nativeIO.delete('test_file');
for (let name of await nativeIO.getAll()) {
await nativeIO.delete(name);
}
});
const file = await nativeIO.open('test_file');
await file.close();
for (let name of kBadNativeIoNames) {
await promise_rejects_js(testCase, TypeError,
nativeIO.rename('test_file', name));
await promise_rejects_js(testCase, TypeError,
nativeIO.rename(name, 'test_file_2'));
}
}, 'nativeIO.rename does not allow renaming from or to invalid names.');
promise_test(async testCase => {
const closed_file = await nativeIO.open('closed_file');
closed_file.close();
const opened_file = await nativeIO.open('opened_file');
testCase.add_cleanup(async () => {
closed_file.close();
opened_file.close();
await nativeIO.delete('closed_file');
await nativeIO.delete('opened_file');
});
// First rename fails, as source is still open.
await promise_rejects_dom(testCase, "UnknownError",
nativeIO.rename('opened_file', 'closed_file'));
// First rename fails again, as source has not been unlocked.
await promise_rejects_dom(testCase, "UnknownError",
nativeIO.rename('opened_file', 'closed_file'));
}, 'Failed nativeIO.rename does not unlock the source.');
promise_test(async testCase => {
const closed_file = await nativeIO.open('closed_file');
await closed_file.close();
const opened_file = await nativeIO.open('opened_file');
testCase.add_cleanup(async () => {
await closed_file.close();
await opened_file.close();
await nativeIO.delete('closed_file');
await nativeIO.delete('opened_file');
});
// First rename fails, as destination is still open.
await promise_rejects_dom(testCase, "UnknownError",
nativeIO.rename('closed_file', 'opened_file'));
// First rename fails again, as destination has not been unlocked.
await promise_rejects_dom(testCase, "UnknownError",
nativeIO.rename('closed_file', 'opened_file'));
}, 'Failed nativeIO.rename does not unlock the destination.');

View file

@ -0,0 +1,24 @@
// META: title=Synchronous NativeIO API: File renaming is reflected in listing.
// META: global=dedicatedworker
'use strict';
test(testCase => {
const file = nativeIO.openSync('test_file');
file.close();
const fileNamesBeforeRename = nativeIO.getAllSync();
assert_in_array('test_file', fileNamesBeforeRename);
nativeIO.renameSync('test_file', 'renamed_test_file');
testCase.add_cleanup(() => {
file.close();
nativeIO.deleteSync('test_file');
nativeIO.deleteSync('renamed_test_file');
});
const fileNamesAfterRename = nativeIO.getAllSync();
assert_equals(fileNamesAfterRename.indexOf('test_file'), -1);
assert_in_array('renamed_test_file', fileNamesAfterRename);
}, 'nativeIO.getAllSync returns a file renamed' +
' by nativeIOFile.renameSync with its new name.');

View file

@ -0,0 +1,118 @@
// META: title=Synchronous NativeIO API: Failures of rename are properly handled.
// META: global=dedicatedworker
// META: script=resources/support.js
'use strict';
test(testCase => {
const file1 = nativeIO.openSync('test_file_1');
const file2 = nativeIO.openSync('test_file_2');
testCase.add_cleanup(() => {
file1.close();
file2.close();
});
const writtenBytes1 = Uint8Array.from([64, 65, 66, 67]);
file1.write(writtenBytes1, 0);
const writtenBytes2 = Uint8Array.from([96, 97, 98, 99]);
file2.write(writtenBytes2, 0);
file1.close();
file2.close();
assert_throws_dom("UnknownError",
() => nativeIO.renameSync('test_file_1', 'test_file_2'));
const fileNamesAfterRename = nativeIO.getAllSync();
assert_in_array('test_file_1', fileNamesAfterRename);
assert_in_array('test_file_2', fileNamesAfterRename);
// Make sure that a failed rename does not modify file contents.
const file1_after = nativeIO.openSync('test_file_1');
const file2_after = nativeIO.openSync('test_file_2');
testCase.add_cleanup(() => {
file1_after.close();
file2_after.close();
nativeIO.deleteSync('test_file_1');
nativeIO.deleteSync('test_file_2');
});
const readBytes1 = new Uint8Array(writtenBytes1.length);
file1_after.read(readBytes1, 0);
assert_array_equals(readBytes1, writtenBytes1,
'the bytes read should match the bytes written');
const readBytes2 = new Uint8Array(writtenBytes2.length);
file2_after.read(readBytes2, 0);
assert_array_equals(readBytes2, writtenBytes2,
'the bytes read should match the bytes written');
}, 'nativeIO.renameSync does not overwrite an existing file.');
test(testCase => {
const file = nativeIO.openSync('test_file');
testCase.add_cleanup(() => {
file.close();
nativeIO.deleteSync('test_file');
});
assert_throws_dom("UnknownError", () =>
nativeIO.renameSync('test_file', 'renamed_test_file'));
file.close();
const fileNamesAfterRename = nativeIO.getAllSync();
assert_equals(fileNamesAfterRename.indexOf('renamed_test_file'), -1);
assert_in_array('test_file', fileNamesAfterRename);
}, 'nativeIO.renameSync allows renaming an open file.');
test(testCase => {
testCase.add_cleanup(() => {
file.close();
nativeIO.deleteSync('test_file');
for (let name of nativeIO.getAllSync()) {
nativeIO.deleteSync(name);
}
});
const file = nativeIO.openSync('test_file');
file.close();
for (let name of kBadNativeIoNames) {
assert_throws_js(TypeError, () => nativeIO.renameSync('test_file', name));
assert_throws_js(TypeError, () => nativeIO.renameSync(name, 'test_file_2'));
}
}, 'nativeIO.renameSync does not allow renaming from or to invalid names.');
test(testCase => {
const closed_file = nativeIO.openSync('closed_file');
closed_file.close();
const opened_file = nativeIO.openSync('opened_file');
testCase.add_cleanup(() => {
closed_file.close();
opened_file.close();
nativeIO.deleteSync('closed_file');
nativeIO.deleteSync('opened_file');
});
// First rename fails, as source is still open.
assert_throws_dom("UnknownError",
() => nativeIO.renameSync('opened_file', 'closed_file'));
// First rename fails again, as source has not been unlocked.
assert_throws_dom("UnknownError",
() => nativeIO.renameSync('opened_file', 'closed_file'));
}, 'Failed nativeIO.renameSync does not unlock the source.');
test(testCase => {
const closed_file = nativeIO.openSync('closed_file');
closed_file.close();
const opened_file = nativeIO.openSync('opened_file');
testCase.add_cleanup(() => {
closed_file.close();
opened_file.close();
nativeIO.deleteSync('closed_file');
nativeIO.deleteSync('opened_file');
});
// First rename fails, as destination is still open.
assert_throws_dom("UnknownError",
() => nativeIO.renameSync('closed_file', 'opened_file'));
// First rename fails again, as destination has not been unlocked.
assert_throws_dom("UnknownError",
() => nativeIO.renameSync('closed_file', 'opened_file'));
}, 'Failed nativeIO.renameSync does not unlock the destination.');

View file

@ -0,0 +1,7 @@
// Names disallowed by NativeIO
const kBadNativeIoNames = [
"Uppercase",
"has-dash",
"has.dot",
"has/slash",
];

View file

@ -0,0 +1,70 @@
<!DOCTYPE html>
<html>
<head>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/testdriver.js"></script>
<script src="/resources/testdriver-vendor.js"></script>
<script>
function childReady() {
return new Promise((resolve) => {
window.onmessage = resolve;
});
}
const handlers = ['beforeunload', 'pagehide', 'unload'];
for (let handler of handlers) {
promise_test(async (test) => {
let popup;
// Open a popup that has a portal, wait for both to be loaded.
{
await test_driver.bless('Open a popup', () => {
popup = open(`resources/portal-activate-in-handler.html?${handler}`,
'_blank');
});
await childReady();
}
// We need the exception type below to ensure the activate() call
// throws but the popup global may be gone by then so stash it here.
const exception_type = popup.DOMException;
// Navigate the popup away.
const cur_path = popup.location.pathname;
popup.location = 'resources/blank-host.html';
// We need to wait until the handler is called but because of the
// nature of these handlers, we can't reliably communicate with the
// popup while they're running so we use a promise established
// earlier to wait until a time we know the portal has been activated
// and the returned promise stored on this global.
await window.handler_called_promise;
assert_not_equals(typeof(window.portal_promise), 'undefined',
'Portal.activate() must be called');
// The popup should have called activate from the handler, and placed
// the promise returned from that call into this window in the
// |portal_promise| variable. We expect that this call should reject,
// however, if it does activate, it's timing dependent whether the
// handler will be run to completion so we may never fulfil the
// promise. In that case timeout and fail the test.
{
test.step_timeout(() => {
assert_unreached('Activation didn\'t fulfil.');
}, 3000);
await promise_rejects_dom(test,
"InvalidStateError",
exception_type,
window.portal_promise,
"Portal activation must fail.");
}
popup.close();
}, `cannot activate portal from ${handler}`);
}
</script>
</head>
<body>
</body>
</html>

View file

@ -0,0 +1,51 @@
<!DOCTYPE html>
<html>
<head>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/testdriver.js"></script>
<script src="/resources/testdriver-vendor.js"></script>
</head>
<body>
</body>
<script>
// This page is reused with a different query parameter indicating which
// handler to register and activate a portal from.
const handler_name = window.location.search.substring(1);
const portal_element = document.createElement('portal');
portal_element.src = 'simple-portal.html';
document.body.appendChild(portal_element);
let page_loaded = false;
let portal_loaded = false;
function notifyReady() {
if (page_loaded && portal_loaded) {
window.opener.postMessage('done', '*');
}
}
portal_element.addEventListener('load', () => {
portal_loaded = true;
notifyReady();
});
window.addEventListener('load', () => {
page_loaded = true;
notifyReady();
});
// This will be used to let the parent page know the handler has run and
// |portal_promise| is now valid.
window.opener.handler_called_promise = new Promise((resolve) => {
window.addEventListener(handler_name, () => {
window.opener.portal_promise = portal_element.activate();
// Let the parent page know it can now look at |portal_promise|.
resolve();
}, {once: true});
});
</script>
</html>