From 287381881bee6eee8fc878eb0d29164ceb5e1456 Mon Sep 17 00:00:00 2001 From: WPT Sync Bot Date: Sat, 20 Jun 2020 08:20:10 +0000 Subject: [PATCH] Update web-platform-tests to revision 4877e40ba4bc993de5ccbd206845b63ceb07a892 --- .../CSS2/floats/hit-test-floats-002.html.ini | 4 - .../CSS2/floats/hit-test-floats-003.html.ini | 4 - ...space-separators-break-spaces-008.html.ini | 2 + .../css/cssom-view/CaretPosition-001.html.ini | 4 - ...ediaQueryList-extends-EventTarget.html.ini | 12 +- .../cssom-view/elementFromPoint-001.html.ini | 4 - .../cssom-view/elementFromPosition.html.ini | 3 - .../elementsFromPoint-invalid-cases.html.ini | 4 - .../reactions/HTMLMediaElement.html.ini | 2 + .../fetch/content-type/response.window.js.ini | 24 +- .../nosniff/parsing-nosniff.window.js.ini | 3 - .../traverse_the_history_2.html.ini | 4 - .../traverse_the_history_3.html.ini | 4 - ...ross-origin-objects-on-new-window.html.ini | 2 + .../embedded-opener-remove-frame.html.ini | 2 +- .../supported-elements.html.ini | 3 +- .../iframe_sandbox_popups_escaping-1.html.ini | 2 +- .../iframe_sandbox_popups_escaping-2.html.ini | 2 +- .../iframe_sandbox_popups_escaping-3.html.ini | 3 +- ...rame_sandbox_popups_nonescaping-3.html.ini | 3 +- .../form-double-submit-2.html.ini | 4 - .../form-double-submit-3.html.ini | 4 + ...le-event-handler-settings-objects.html.ini | 3 - .../realtimeanalyser-fft-scaling.html.ini | 1 + .../webmessaging/with-ports/018.html.ini | 5 + .../semantics/run-a-worker/003.html.ini | 1 + tests/wpt/metadata/MANIFEST.json | 444 ++++++++++++++++-- .../CSS2/floats/hit-test-floats-002.html.ini | 4 - .../CSS2/floats/hit-test-floats-003.html.ini | 4 - ...space-separators-break-spaces-008.html.ini | 2 + .../css/cssom-view/CaretPosition-001.html.ini | 4 - ...ediaQueryList-extends-EventTarget.html.ini | 3 + .../cssom-view/elementFromPoint-001.html.ini | 4 - .../cssom-view/elementFromPosition.html.ini | 3 - .../elementsFromPoint-invalid-cases.html.ini | 4 - .../reactions/HTMLMediaElement.html.ini | 2 + .../fetch/content-type/response.window.js.ini | 24 +- .../nosniff/parsing-nosniff.window.js.ini | 3 - .../traverse_the_history_2.html.ini | 4 - .../traverse_the_history_3.html.ini | 4 - ...ross-origin-objects-on-new-window.html.ini | 2 + .../embedded-opener-remove-frame.html.ini | 2 +- .../supported-elements.html.ini | 3 +- .../iframe_sandbox_popups_escaping-1.html.ini | 2 +- .../iframe_sandbox_popups_escaping-2.html.ini | 2 +- .../iframe_sandbox_popups_escaping-3.html.ini | 3 +- ...rame_sandbox_popups_nonescaping-3.html.ini | 3 +- .../form-double-submit-2.html.ini | 4 - .../form-double-submit-3.html.ini | 4 + ...le-event-handler-settings-objects.html.ini | 3 - .../realtimeanalyser-fft-scaling.html.ini | 1 + .../webmessaging/with-ports/018.html.ini | 5 + .../semantics/run-a-worker/003.html.ini | 1 + ...spos-inline-container-in-inline-block.html | 18 + .../flex-aspect-ratio-img-row-005.html | 53 +++ .../openee-accessed_openee-coop-ro.https.html | 50 +- .../openee-accessed_openee-coop.https.html | 50 +- .../opener-accessed_openee-coop-ro.https.html | 49 +- .../opener-accessed_openee-coop.https.html | 49 +- .../access-reporting/resources/dispatcher.js | 4 +- tests/wpt/web-platform-tests/lint.ignore | 1 + .../detached.tentative.window.js | 108 +++++ .../iframe.cross-origin.tentative.window.js | 40 ++ .../iframe.cross-site.tentative.window.js | 40 ++ .../iframe.same-origin.tentative.window.js | 37 ++ ...ndow.js => main-frame.tentative.window.js} | 9 +- ...ry-cross-origin-iframe.tentative.window.js | 30 -- ...gin-redirecting-iframe.tentative.window.js | 30 -- ...ory-same-origin-iframe.tentative.window.js | 31 -- .../redirect.client.tentative.window.js | 58 +++ .../redirect.server.tentative.window.js | 58 +++ .../measure-memory/resources/child.sub.html | 17 - .../measure-memory/resources/common.js | 167 ++++++- .../resources/grandchild.sub.html | 12 - ...hild.sub.html => iframe.redirect.sub.html} | 6 +- .../resources/iframe.secret.sub.html | 14 + .../measure-memory/resources/iframe.sub.html | 14 + .../resources/window.redirect.sub.html | 12 + .../resources/window.secret.sub.html | 14 + .../measure-memory/resources/window.sub.html | 14 + ...ndow-open.cross-origin.tentative.window.js | 41 ++ ...window-open.cross-site.tentative.window.js | 41 ++ .../window-open.mix.tentative.window.js | 99 ++++ ...indow-open.same-origin.tentative.window.js | 44 ++ .../rename_async_basic.tentative.https.any.js | 23 + ...nc_failure_handling.tentative.https.any.js | 127 +++++ .../rename_sync_basic.tentative.https.any.js | 24 + ...nc_failure_handling.tentative.https.any.js | 118 +++++ .../native-io/resources/support.js | 7 + .../portals-activate-while-unloading.html | 70 +++ .../resources/portal-activate-in-handler.html | 51 ++ 91 files changed, 1890 insertions(+), 393 deletions(-) delete mode 100644 tests/wpt/metadata-layout-2020/css/CSS2/floats/hit-test-floats-002.html.ini delete mode 100644 tests/wpt/metadata-layout-2020/css/CSS2/floats/hit-test-floats-003.html.ini create mode 100644 tests/wpt/metadata-layout-2020/css/css-text/white-space/trailing-other-space-separators-break-spaces-008.html.ini delete mode 100644 tests/wpt/metadata-layout-2020/css/cssom-view/CaretPosition-001.html.ini delete mode 100644 tests/wpt/metadata-layout-2020/css/cssom-view/elementFromPoint-001.html.ini delete mode 100644 tests/wpt/metadata-layout-2020/css/cssom-view/elementsFromPoint-invalid-cases.html.ini create mode 100644 tests/wpt/metadata-layout-2020/custom-elements/reactions/HTMLMediaElement.html.ini delete mode 100644 tests/wpt/metadata-layout-2020/html/browsers/history/the-history-interface/traverse_the_history_2.html.ini delete mode 100644 tests/wpt/metadata-layout-2020/html/browsers/history/the-history-interface/traverse_the_history_3.html.ini create mode 100644 tests/wpt/metadata-layout-2020/html/browsers/origin/cross-origin-objects/cross-origin-objects-on-new-window.html.ini delete mode 100644 tests/wpt/metadata-layout-2020/html/semantics/forms/form-submission-0/form-double-submit-2.html.ini create mode 100644 tests/wpt/metadata-layout-2020/html/semantics/forms/form-submission-0/form-double-submit-3.html.ini create mode 100644 tests/wpt/metadata-layout-2020/webmessaging/with-ports/018.html.ini delete mode 100644 tests/wpt/metadata/css/CSS2/floats/hit-test-floats-002.html.ini delete mode 100644 tests/wpt/metadata/css/CSS2/floats/hit-test-floats-003.html.ini create mode 100644 tests/wpt/metadata/css/css-text/white-space/trailing-other-space-separators-break-spaces-008.html.ini delete mode 100644 tests/wpt/metadata/css/cssom-view/CaretPosition-001.html.ini delete mode 100644 tests/wpt/metadata/css/cssom-view/elementFromPoint-001.html.ini delete mode 100644 tests/wpt/metadata/css/cssom-view/elementsFromPoint-invalid-cases.html.ini create mode 100644 tests/wpt/metadata/custom-elements/reactions/HTMLMediaElement.html.ini delete mode 100644 tests/wpt/metadata/html/browsers/history/the-history-interface/traverse_the_history_2.html.ini delete mode 100644 tests/wpt/metadata/html/browsers/history/the-history-interface/traverse_the_history_3.html.ini create mode 100644 tests/wpt/metadata/html/browsers/origin/cross-origin-objects/cross-origin-objects-on-new-window.html.ini delete mode 100644 tests/wpt/metadata/html/semantics/forms/form-submission-0/form-double-submit-2.html.ini create mode 100644 tests/wpt/metadata/html/semantics/forms/form-submission-0/form-double-submit-3.html.ini create mode 100644 tests/wpt/metadata/webmessaging/with-ports/018.html.ini create mode 100644 tests/wpt/web-platform-tests/css/CSS2/positioning/abspos-inline-container-in-inline-block.html create mode 100644 tests/wpt/web-platform-tests/css/css-flexbox/flex-aspect-ratio-img-row-005.html create mode 100644 tests/wpt/web-platform-tests/measure-memory/detached.tentative.window.js create mode 100644 tests/wpt/web-platform-tests/measure-memory/iframe.cross-origin.tentative.window.js create mode 100644 tests/wpt/web-platform-tests/measure-memory/iframe.cross-site.tentative.window.js create mode 100644 tests/wpt/web-platform-tests/measure-memory/iframe.same-origin.tentative.window.js rename tests/wpt/web-platform-tests/measure-memory/{measure-memory.tentative.window.js => main-frame.tentative.window.js} (65%) delete mode 100644 tests/wpt/web-platform-tests/measure-memory/measure-memory-cross-origin-iframe.tentative.window.js delete mode 100644 tests/wpt/web-platform-tests/measure-memory/measure-memory-cross-origin-redirecting-iframe.tentative.window.js delete mode 100644 tests/wpt/web-platform-tests/measure-memory/measure-memory-same-origin-iframe.tentative.window.js create mode 100644 tests/wpt/web-platform-tests/measure-memory/redirect.client.tentative.window.js create mode 100644 tests/wpt/web-platform-tests/measure-memory/redirect.server.tentative.window.js delete mode 100644 tests/wpt/web-platform-tests/measure-memory/resources/child.sub.html delete mode 100644 tests/wpt/web-platform-tests/measure-memory/resources/grandchild.sub.html rename tests/wpt/web-platform-tests/measure-memory/resources/{redirecting-child.sub.html => iframe.redirect.sub.html} (61%) create mode 100644 tests/wpt/web-platform-tests/measure-memory/resources/iframe.secret.sub.html create mode 100644 tests/wpt/web-platform-tests/measure-memory/resources/iframe.sub.html create mode 100644 tests/wpt/web-platform-tests/measure-memory/resources/window.redirect.sub.html create mode 100644 tests/wpt/web-platform-tests/measure-memory/resources/window.secret.sub.html create mode 100644 tests/wpt/web-platform-tests/measure-memory/resources/window.sub.html create mode 100644 tests/wpt/web-platform-tests/measure-memory/window-open.cross-origin.tentative.window.js create mode 100644 tests/wpt/web-platform-tests/measure-memory/window-open.cross-site.tentative.window.js create mode 100644 tests/wpt/web-platform-tests/measure-memory/window-open.mix.tentative.window.js create mode 100644 tests/wpt/web-platform-tests/measure-memory/window-open.same-origin.tentative.window.js create mode 100644 tests/wpt/web-platform-tests/native-io/rename_async_basic.tentative.https.any.js create mode 100644 tests/wpt/web-platform-tests/native-io/rename_async_failure_handling.tentative.https.any.js create mode 100644 tests/wpt/web-platform-tests/native-io/rename_sync_basic.tentative.https.any.js create mode 100644 tests/wpt/web-platform-tests/native-io/rename_sync_failure_handling.tentative.https.any.js create mode 100644 tests/wpt/web-platform-tests/native-io/resources/support.js create mode 100644 tests/wpt/web-platform-tests/portals/portals-activate-while-unloading.html create mode 100644 tests/wpt/web-platform-tests/portals/resources/portal-activate-in-handler.html diff --git a/tests/wpt/metadata-layout-2020/css/CSS2/floats/hit-test-floats-002.html.ini b/tests/wpt/metadata-layout-2020/css/CSS2/floats/hit-test-floats-002.html.ini deleted file mode 100644 index f64b45fea6b..00000000000 --- a/tests/wpt/metadata-layout-2020/css/CSS2/floats/hit-test-floats-002.html.ini +++ /dev/null @@ -1,4 +0,0 @@ -[hit-test-floats-002.html] - [Hit test float] - expected: FAIL - diff --git a/tests/wpt/metadata-layout-2020/css/CSS2/floats/hit-test-floats-003.html.ini b/tests/wpt/metadata-layout-2020/css/CSS2/floats/hit-test-floats-003.html.ini deleted file mode 100644 index f29da48a2a0..00000000000 --- a/tests/wpt/metadata-layout-2020/css/CSS2/floats/hit-test-floats-003.html.ini +++ /dev/null @@ -1,4 +0,0 @@ -[hit-test-floats-003.html] - [Miss float below something else] - expected: FAIL - diff --git a/tests/wpt/metadata-layout-2020/css/css-text/white-space/trailing-other-space-separators-break-spaces-008.html.ini b/tests/wpt/metadata-layout-2020/css/css-text/white-space/trailing-other-space-separators-break-spaces-008.html.ini new file mode 100644 index 00000000000..f6bf6aa789e --- /dev/null +++ b/tests/wpt/metadata-layout-2020/css/css-text/white-space/trailing-other-space-separators-break-spaces-008.html.ini @@ -0,0 +1,2 @@ +[trailing-other-space-separators-break-spaces-008.html] + expected: FAIL diff --git a/tests/wpt/metadata-layout-2020/css/cssom-view/CaretPosition-001.html.ini b/tests/wpt/metadata-layout-2020/css/cssom-view/CaretPosition-001.html.ini deleted file mode 100644 index 4c79907309b..00000000000 --- a/tests/wpt/metadata-layout-2020/css/cssom-view/CaretPosition-001.html.ini +++ /dev/null @@ -1,4 +0,0 @@ -[CaretPosition-001.html] - [Element at (400, 100)] - expected: FAIL - diff --git a/tests/wpt/metadata-layout-2020/css/cssom-view/MediaQueryList-extends-EventTarget.html.ini b/tests/wpt/metadata-layout-2020/css/cssom-view/MediaQueryList-extends-EventTarget.html.ini index 283a5d6fbca..2dc7f159319 100644 --- a/tests/wpt/metadata-layout-2020/css/cssom-view/MediaQueryList-extends-EventTarget.html.ini +++ b/tests/wpt/metadata-layout-2020/css/cssom-view/MediaQueryList-extends-EventTarget.html.ini @@ -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 diff --git a/tests/wpt/metadata-layout-2020/css/cssom-view/elementFromPoint-001.html.ini b/tests/wpt/metadata-layout-2020/css/cssom-view/elementFromPoint-001.html.ini deleted file mode 100644 index e38782d8c85..00000000000 --- a/tests/wpt/metadata-layout-2020/css/cssom-view/elementFromPoint-001.html.ini +++ /dev/null @@ -1,4 +0,0 @@ -[elementFromPoint-001.html] - [CSSOM View - 5 - extensions to the Document interface] - expected: FAIL - diff --git a/tests/wpt/metadata-layout-2020/css/cssom-view/elementFromPosition.html.ini b/tests/wpt/metadata-layout-2020/css/cssom-view/elementFromPosition.html.ini index 23c61ede1a1..c131078eace 100644 --- a/tests/wpt/metadata-layout-2020/css/cssom-view/elementFromPosition.html.ini +++ b/tests/wpt/metadata-layout-2020/css/cssom-view/elementFromPosition.html.ini @@ -17,6 +17,3 @@ [test the top of layer] expected: FAIL - [test some point of the element: top left corner] - expected: FAIL - diff --git a/tests/wpt/metadata-layout-2020/css/cssom-view/elementsFromPoint-invalid-cases.html.ini b/tests/wpt/metadata-layout-2020/css/cssom-view/elementsFromPoint-invalid-cases.html.ini deleted file mode 100644 index e181af5397f..00000000000 --- a/tests/wpt/metadata-layout-2020/css/cssom-view/elementsFromPoint-invalid-cases.html.ini +++ /dev/null @@ -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 - diff --git a/tests/wpt/metadata-layout-2020/custom-elements/reactions/HTMLMediaElement.html.ini b/tests/wpt/metadata-layout-2020/custom-elements/reactions/HTMLMediaElement.html.ini new file mode 100644 index 00000000000..2ca05f57bb0 --- /dev/null +++ b/tests/wpt/metadata-layout-2020/custom-elements/reactions/HTMLMediaElement.html.ini @@ -0,0 +1,2 @@ +[HTMLMediaElement.html] + expected: TIMEOUT diff --git a/tests/wpt/metadata-layout-2020/fetch/content-type/response.window.js.ini b/tests/wpt/metadata-layout-2020/fetch/content-type/response.window.js.ini index 9dbce8f31d4..283e37fa1d0 100644 --- a/tests/wpt/metadata-layout-2020/fetch/content-type/response.window.js.ini +++ b/tests/wpt/metadata-layout-2020/fetch/content-type/response.window.js.ini @@ -312,27 +312,21 @@ [Response: combined response Content-Type: text/html;" \\" text/plain ";charset=GBK] expected: NOTRUN - [ - - diff --git a/tests/wpt/web-platform-tests/measure-memory/resources/common.js b/tests/wpt/web-platform-tests/measure-memory/resources/common.js index 1347c5bdb73..6da98746ecd 100644 --- a/tests/wpt/web-platform-tests/measure-memory/resources/common.js +++ b/tests/wpt/web-platform-tests/measure-memory/resources/common.js @@ -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; } \ No newline at end of file diff --git a/tests/wpt/web-platform-tests/measure-memory/resources/grandchild.sub.html b/tests/wpt/web-platform-tests/measure-memory/resources/grandchild.sub.html deleted file mode 100644 index 0f11bce0e02..00000000000 --- a/tests/wpt/web-platform-tests/measure-memory/resources/grandchild.sub.html +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - Hello from grandchild iframe. - - diff --git a/tests/wpt/web-platform-tests/measure-memory/resources/redirecting-child.sub.html b/tests/wpt/web-platform-tests/measure-memory/resources/iframe.redirect.sub.html similarity index 61% rename from tests/wpt/web-platform-tests/measure-memory/resources/redirecting-child.sub.html rename to tests/wpt/web-platform-tests/measure-memory/resources/iframe.redirect.sub.html index 732c5410966..6eaf557422c 100644 --- a/tests/wpt/web-platform-tests/measure-memory/resources/redirecting-child.sub.html +++ b/tests/wpt/web-platform-tests/measure-memory/resources/iframe.redirect.sub.html @@ -1,12 +1,12 @@ - + - Hello from child iframe. + Hello from the redirecting iframe: diff --git a/tests/wpt/web-platform-tests/measure-memory/resources/iframe.secret.sub.html b/tests/wpt/web-platform-tests/measure-memory/resources/iframe.secret.sub.html new file mode 100644 index 00000000000..55caa347fbf --- /dev/null +++ b/tests/wpt/web-platform-tests/measure-memory/resources/iframe.secret.sub.html @@ -0,0 +1,14 @@ + + + + + + + + Hello from the secrect iframe: + + diff --git a/tests/wpt/web-platform-tests/measure-memory/resources/iframe.sub.html b/tests/wpt/web-platform-tests/measure-memory/resources/iframe.sub.html new file mode 100644 index 00000000000..96b7b1a8398 --- /dev/null +++ b/tests/wpt/web-platform-tests/measure-memory/resources/iframe.sub.html @@ -0,0 +1,14 @@ + + + + + + + + Hello from the iframe: + + diff --git a/tests/wpt/web-platform-tests/measure-memory/resources/window.redirect.sub.html b/tests/wpt/web-platform-tests/measure-memory/resources/window.redirect.sub.html new file mode 100644 index 00000000000..b339abc54f7 --- /dev/null +++ b/tests/wpt/web-platform-tests/measure-memory/resources/window.redirect.sub.html @@ -0,0 +1,12 @@ + + + + + + Hello from the redirecting widnow: + + diff --git a/tests/wpt/web-platform-tests/measure-memory/resources/window.secret.sub.html b/tests/wpt/web-platform-tests/measure-memory/resources/window.secret.sub.html new file mode 100644 index 00000000000..99d9d1251b2 --- /dev/null +++ b/tests/wpt/web-platform-tests/measure-memory/resources/window.secret.sub.html @@ -0,0 +1,14 @@ + + + + + + + + Hello from the secrect window: + + diff --git a/tests/wpt/web-platform-tests/measure-memory/resources/window.sub.html b/tests/wpt/web-platform-tests/measure-memory/resources/window.sub.html new file mode 100644 index 00000000000..c2540943828 --- /dev/null +++ b/tests/wpt/web-platform-tests/measure-memory/resources/window.sub.html @@ -0,0 +1,14 @@ + + + + + + + + Hello from the window: + + diff --git a/tests/wpt/web-platform-tests/measure-memory/window-open.cross-origin.tentative.window.js b/tests/wpt/web-platform-tests/measure-memory/window-open.cross-origin.tentative.window.js new file mode 100644 index 00000000000..d067b2c175b --- /dev/null +++ b/tests/wpt/web-platform-tests/measure-memory/window-open.cross-origin.tentative.window.js @@ -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.'); diff --git a/tests/wpt/web-platform-tests/measure-memory/window-open.cross-site.tentative.window.js b/tests/wpt/web-platform-tests/measure-memory/window-open.cross-site.tentative.window.js new file mode 100644 index 00000000000..7fa49f5facc --- /dev/null +++ b/tests/wpt/web-platform-tests/measure-memory/window-open.cross-site.tentative.window.js @@ -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.'); diff --git a/tests/wpt/web-platform-tests/measure-memory/window-open.mix.tentative.window.js b/tests/wpt/web-platform-tests/measure-memory/window-open.mix.tentative.window.js new file mode 100644 index 00000000000..5bb9d29c61d --- /dev/null +++ b/tests/wpt/web-platform-tests/measure-memory/window-open.mix.tentative.window.js @@ -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.'); diff --git a/tests/wpt/web-platform-tests/measure-memory/window-open.same-origin.tentative.window.js b/tests/wpt/web-platform-tests/measure-memory/window-open.same-origin.tentative.window.js new file mode 100644 index 00000000000..7ec3cc436f1 --- /dev/null +++ b/tests/wpt/web-platform-tests/measure-memory/window-open.same-origin.tentative.window.js @@ -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.'); diff --git a/tests/wpt/web-platform-tests/native-io/rename_async_basic.tentative.https.any.js b/tests/wpt/web-platform-tests/native-io/rename_async_basic.tentative.https.any.js new file mode 100644 index 00000000000..8829b5b3104 --- /dev/null +++ b/tests/wpt/web-platform-tests/native-io/rename_async_basic.tentative.https.any.js @@ -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.'); diff --git a/tests/wpt/web-platform-tests/native-io/rename_async_failure_handling.tentative.https.any.js b/tests/wpt/web-platform-tests/native-io/rename_async_failure_handling.tentative.https.any.js new file mode 100644 index 00000000000..5e0f96408bb --- /dev/null +++ b/tests/wpt/web-platform-tests/native-io/rename_async_failure_handling.tentative.https.any.js @@ -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.'); diff --git a/tests/wpt/web-platform-tests/native-io/rename_sync_basic.tentative.https.any.js b/tests/wpt/web-platform-tests/native-io/rename_sync_basic.tentative.https.any.js new file mode 100644 index 00000000000..af04885dfd7 --- /dev/null +++ b/tests/wpt/web-platform-tests/native-io/rename_sync_basic.tentative.https.any.js @@ -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.'); diff --git a/tests/wpt/web-platform-tests/native-io/rename_sync_failure_handling.tentative.https.any.js b/tests/wpt/web-platform-tests/native-io/rename_sync_failure_handling.tentative.https.any.js new file mode 100644 index 00000000000..92c42c7d3cd --- /dev/null +++ b/tests/wpt/web-platform-tests/native-io/rename_sync_failure_handling.tentative.https.any.js @@ -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.'); diff --git a/tests/wpt/web-platform-tests/native-io/resources/support.js b/tests/wpt/web-platform-tests/native-io/resources/support.js new file mode 100644 index 00000000000..adbfbc45d19 --- /dev/null +++ b/tests/wpt/web-platform-tests/native-io/resources/support.js @@ -0,0 +1,7 @@ +// Names disallowed by NativeIO +const kBadNativeIoNames = [ + "Uppercase", + "has-dash", + "has.dot", + "has/slash", +]; diff --git a/tests/wpt/web-platform-tests/portals/portals-activate-while-unloading.html b/tests/wpt/web-platform-tests/portals/portals-activate-while-unloading.html new file mode 100644 index 00000000000..5abb164b3ba --- /dev/null +++ b/tests/wpt/web-platform-tests/portals/portals-activate-while-unloading.html @@ -0,0 +1,70 @@ + + + + + + + + + + + + diff --git a/tests/wpt/web-platform-tests/portals/resources/portal-activate-in-handler.html b/tests/wpt/web-platform-tests/portals/resources/portal-activate-in-handler.html new file mode 100644 index 00000000000..746ffa2b395 --- /dev/null +++ b/tests/wpt/web-platform-tests/portals/resources/portal-activate-in-handler.html @@ -0,0 +1,51 @@ + + + + + + + + + + + +