From c5c325d8bbe79bcc6ae071e94224ac653ce73a8f Mon Sep 17 00:00:00 2001 From: WPT Sync Bot Date: Thu, 18 Apr 2019 21:48:35 -0400 Subject: [PATCH] Update web-platform-tests to revision e3cf1284464a4a3e46fd15e4138f8e32c6cecdd8 --- .../url/url-in-tags-revoke.window.js.ini | 4 + tests/wpt/metadata/MANIFEST.json | 228 ++++++++++++------ .../at-font-face-font-matching.html.ini | 24 -- ...offsetTopLeft-empty-inline-offset.html.ini | 19 ++ .../offsetTopLeft-empty-inline.html.ini | 10 + .../cssom-view/offsetTopLeft-inline.html.ini | 2 + ...ffsetTopLeft-leading-space-inline.html.ini | 10 + ...fsetTopLeft-trailing-space-inline.html.ini | 10 + .../metadata/encoding/encodeInto.any.js.ini | 180 ++++++++++++++ .../encoding/single-byte-decoder.html.ini | 2 +- .../api/redirect/redirect-mode.any.js.ini | 1 - .../fetch/content-type/response.window.js.ini | 9 - .../nosniff/parsing-nosniff.window.js.ini | 3 - .../traverse_the_history_3.html.ini | 4 - .../traverse_the_history_5.html.ini | 4 - .../noopener-noreferrer-BarProp.window.js.ini | 10 + .../script-onerror-insertion-point-2.html.ini | 2 + .../realtimeanalyser-fft-scaling.html.ini | 1 - .../webstorage/storage_setitem.html.ini | 36 +++ .../{ => events}/copy-event-manual.html | 0 .../{ => events}/cut-event-manual.html | 0 .../{ => events}/paste-event-manual.html | 0 .../async-write-read-manual.https.html} | 0 .../async-write-readText-manual.https.html} | 0 .../async-writeText-read-manual.https.html} | 0 ...sync-writeText-readText-manual.https.html} | 0 .../common/get-host-info.sub.js | 2 +- .../security-features/resources/common.js | 130 ++++++++++ .../scroll-snap-stop-always.html | 25 ++ .../scrollTo-scrollBy-snaps.html | 4 +- ...=> offsetTopLeft-empty-inline-offset.html} | 0 .../offsetTopLeft-empty-inline.html | 32 +++ ...tInline.html => offsetTopLeft-inline.html} | 0 .../offsetTopLeft-leading-space-inline.html | 32 +++ .../offsetTopLeft-trailing-space-inline.html | 36 +++ .../noopener-noreferrer-BarProp.window.js | 23 ++ .../support/BarProp-target.html | 17 ++ .../the-img-element/relevant-mutations.html | 97 ++++++-- ...-click-two-child-frames.sub.tentative.html | 90 +++++++ .../user-activation/resources/child-five.html | 15 ++ .../user-activation/resources/child-four.html | 2 +- .../generic/mixed-content-test-case.js | 207 +++++----------- .../portals/portal-activate-data.html | 3 +- .../portals/portals-activate-resolution.html | 21 ++ .../portals/portals-adopt-predecessor.html | 2 - .../portals/portals-create-orphaned.html | 19 -- .../resources/portal-create-orphaned.html | 28 --- .../portals-adopt-predecessor-portal.html | 11 +- .../resources/portals-adopt-predecessor.html | 15 +- .../generic/referrer-policy-test-case.js | 196 +++++++-------- .../referrer-policy/generic/sanity-checker.js | 29 +-- .../test/tests/unit/unpaired-surrogates.html | 138 +++++++++++ .../resources/testharness.js | 41 ++++ .../wpt/web-platform-tests/tools/wpt/utils.py | 7 +- .../webrtc-quic/RTCQuicTransport.https.html | 117 ++++++++- .../xhr/send-redirect-post-upload.htm | 8 + .../misc/texture-upload-size.html.ini | 3 + 57 files changed, 1419 insertions(+), 490 deletions(-) create mode 100644 tests/wpt/metadata/css/cssom-view/offsetTopLeft-empty-inline-offset.html.ini create mode 100644 tests/wpt/metadata/css/cssom-view/offsetTopLeft-empty-inline.html.ini create mode 100644 tests/wpt/metadata/css/cssom-view/offsetTopLeft-inline.html.ini create mode 100644 tests/wpt/metadata/css/cssom-view/offsetTopLeft-leading-space-inline.html.ini create mode 100644 tests/wpt/metadata/css/cssom-view/offsetTopLeft-trailing-space-inline.html.ini delete mode 100644 tests/wpt/metadata/html/browsers/history/the-history-interface/traverse_the_history_3.html.ini delete mode 100644 tests/wpt/metadata/html/browsers/history/the-history-interface/traverse_the_history_5.html.ini create mode 100644 tests/wpt/metadata/html/browsers/the-window-object/noopener-noreferrer-BarProp.window.js.ini create mode 100644 tests/wpt/metadata/html/semantics/scripting-1/the-script-element/script-onerror-insertion-point-2.html.ini rename tests/wpt/web-platform-tests/clipboard-apis/{ => events}/copy-event-manual.html (100%) rename tests/wpt/web-platform-tests/clipboard-apis/{ => events}/cut-event-manual.html (100%) rename tests/wpt/web-platform-tests/clipboard-apis/{ => events}/paste-event-manual.html (100%) rename tests/wpt/web-platform-tests/clipboard-apis/{async-write-blobtext-read-blobtext-manual.https.html => text-write-read/async-write-read-manual.https.html} (100%) rename tests/wpt/web-platform-tests/clipboard-apis/{async-write-blobtext-read-text-manual.https.html => text-write-read/async-write-readText-manual.https.html} (100%) rename tests/wpt/web-platform-tests/clipboard-apis/{async-write-text-read-blobtext-manual.https.html => text-write-read/async-writeText-read-manual.https.html} (100%) rename tests/wpt/web-platform-tests/clipboard-apis/{async-write-text-read-text-manual.https.html => text-write-read/async-writeText-readText-manual.https.html} (100%) rename tests/wpt/web-platform-tests/css/cssom-view/{offsetTopLeftEmptyInline.html => offsetTopLeft-empty-inline-offset.html} (100%) create mode 100644 tests/wpt/web-platform-tests/css/cssom-view/offsetTopLeft-empty-inline.html rename tests/wpt/web-platform-tests/css/cssom-view/{offsetTopLeftInline.html => offsetTopLeft-inline.html} (100%) create mode 100644 tests/wpt/web-platform-tests/css/cssom-view/offsetTopLeft-leading-space-inline.html create mode 100644 tests/wpt/web-platform-tests/css/cssom-view/offsetTopLeft-trailing-space-inline.html create mode 100644 tests/wpt/web-platform-tests/html/browsers/the-window-object/noopener-noreferrer-BarProp.window.js create mode 100644 tests/wpt/web-platform-tests/html/browsers/the-window-object/support/BarProp-target.html create mode 100644 tests/wpt/web-platform-tests/html/user-activation/activation-transfer-cross-origin-with-click-two-child-frames.sub.tentative.html create mode 100644 tests/wpt/web-platform-tests/html/user-activation/resources/child-five.html create mode 100644 tests/wpt/web-platform-tests/portals/portals-activate-resolution.html delete mode 100644 tests/wpt/web-platform-tests/portals/portals-create-orphaned.html delete mode 100644 tests/wpt/web-platform-tests/portals/resources/portal-create-orphaned.html create mode 100644 tests/wpt/web-platform-tests/resources/test/tests/unit/unpaired-surrogates.html diff --git a/tests/wpt/metadata/FileAPI/url/url-in-tags-revoke.window.js.ini b/tests/wpt/metadata/FileAPI/url/url-in-tags-revoke.window.js.ini index dd4ffcf4345b..76b398963aee 100644 --- a/tests/wpt/metadata/FileAPI/url/url-in-tags-revoke.window.js.ini +++ b/tests/wpt/metadata/FileAPI/url/url-in-tags-revoke.window.js.ini @@ -1,4 +1,5 @@ [url-in-tags-revoke.window.html] + expected: TIMEOUT [Fetching a blob URL immediately before revoking it works in an iframe.] expected: FAIL @@ -14,3 +15,6 @@ [Opening a blob URL in a new window by clicking an tag works immediately before revoking the URL.] expected: FAIL + [Fetching a blob URL immediately before revoking it works in diff --git a/tests/wpt/web-platform-tests/css/css-scroll-snap/scrollTo-scrollBy-snaps.html b/tests/wpt/web-platform-tests/css/css-scroll-snap/scrollTo-scrollBy-snaps.html index 3e022f0a1214..fba38cb703ba 100644 --- a/tests/wpt/web-platform-tests/css/css-scroll-snap/scrollTo-scrollBy-snaps.html +++ b/tests/wpt/web-platform-tests/css/css-scroll-snap/scrollTo-scrollBy-snaps.html @@ -74,7 +74,9 @@ [ [{left: 800}, 1000, 0], [{top: 900}, 0, 1000], - [{left: 900, top: 800}, 1000, 1000] + [{left: 900, top: 800}, 1000, 1000], + [{left: 800, top: -100}, 1000, 0], /* outside bounds on y axis */ + [{left: 10000, top: -100}, 1000, 0] /* outside bounds on both axes */ ].forEach(([input, expectedX, expectedY]) => { test(() => { divScroller.scrollTo(0, 0); diff --git a/tests/wpt/web-platform-tests/css/cssom-view/offsetTopLeftEmptyInline.html b/tests/wpt/web-platform-tests/css/cssom-view/offsetTopLeft-empty-inline-offset.html similarity index 100% rename from tests/wpt/web-platform-tests/css/cssom-view/offsetTopLeftEmptyInline.html rename to tests/wpt/web-platform-tests/css/cssom-view/offsetTopLeft-empty-inline-offset.html diff --git a/tests/wpt/web-platform-tests/css/cssom-view/offsetTopLeft-empty-inline.html b/tests/wpt/web-platform-tests/css/cssom-view/offsetTopLeft-empty-inline.html new file mode 100644 index 000000000000..d553cb150d9c --- /dev/null +++ b/tests/wpt/web-platform-tests/css/cssom-view/offsetTopLeft-empty-inline.html @@ -0,0 +1,32 @@ + + + + + +
+
ref +
+
+
ref +
+
+
ref +
+ diff --git a/tests/wpt/web-platform-tests/css/cssom-view/offsetTopLeftInline.html b/tests/wpt/web-platform-tests/css/cssom-view/offsetTopLeft-inline.html similarity index 100% rename from tests/wpt/web-platform-tests/css/cssom-view/offsetTopLeftInline.html rename to tests/wpt/web-platform-tests/css/cssom-view/offsetTopLeft-inline.html diff --git a/tests/wpt/web-platform-tests/css/cssom-view/offsetTopLeft-leading-space-inline.html b/tests/wpt/web-platform-tests/css/cssom-view/offsetTopLeft-leading-space-inline.html new file mode 100644 index 000000000000..a121cdf86a12 --- /dev/null +++ b/tests/wpt/web-platform-tests/css/cssom-view/offsetTopLeft-leading-space-inline.html @@ -0,0 +1,32 @@ + + + + + +
+
ref +
+
+
ref +
+
+
ref +
+ diff --git a/tests/wpt/web-platform-tests/css/cssom-view/offsetTopLeft-trailing-space-inline.html b/tests/wpt/web-platform-tests/css/cssom-view/offsetTopLeft-trailing-space-inline.html new file mode 100644 index 000000000000..3e50b78b9a26 --- /dev/null +++ b/tests/wpt/web-platform-tests/css/cssom-view/offsetTopLeft-trailing-space-inline.html @@ -0,0 +1,36 @@ + + + + + +
+
ref +
+
+
ref +
+
+
ref +
+ diff --git a/tests/wpt/web-platform-tests/html/browsers/the-window-object/noopener-noreferrer-BarProp.window.js b/tests/wpt/web-platform-tests/html/browsers/the-window-object/noopener-noreferrer-BarProp.window.js new file mode 100644 index 000000000000..a75a0346501a --- /dev/null +++ b/tests/wpt/web-platform-tests/html/browsers/the-window-object/noopener-noreferrer-BarProp.window.js @@ -0,0 +1,23 @@ +const barProps = ["locationbar", "menubar", "personalbar", "scrollbars", "statusbar", "toolbar"]; + +test(() => { + for(const prop of barProps) { + assert_true(window[prop].visible); + } +}, "All bars visible"); + +["noopener", "noreferrer"].forEach(openerStyle => { + async_test(t => { + const channelName = "5454" + openerStyle + "34324"; + const channel = new BroadcastChannel(channelName); + window.open("support/BarProp-target.html?" + channelName, "", openerStyle); + channel.onmessage = t.step_func_done(e => { + // Send message first so if asserts throw the popup is still closed + channel.postMessage(null); + + for(const prop of barProps) { + assert_true(e.data[prop]); + } + }); + }, `window.open() with ${openerStyle} should have all bars visible`); +}); diff --git a/tests/wpt/web-platform-tests/html/browsers/the-window-object/support/BarProp-target.html b/tests/wpt/web-platform-tests/html/browsers/the-window-object/support/BarProp-target.html new file mode 100644 index 000000000000..9921e7a5773d --- /dev/null +++ b/tests/wpt/web-platform-tests/html/browsers/the-window-object/support/BarProp-target.html @@ -0,0 +1,17 @@ + + diff --git a/tests/wpt/web-platform-tests/html/semantics/embedded-content/the-img-element/relevant-mutations.html b/tests/wpt/web-platform-tests/html/semantics/embedded-content/the-img-element/relevant-mutations.html index 0ce7a01078f7..76fdb641dffa 100644 --- a/tests/wpt/web-platform-tests/html/semantics/embedded-content/the-img-element/relevant-mutations.html +++ b/tests/wpt/web-platform-tests/html/semantics/embedded-content/the-img-element/relevant-mutations.html @@ -21,16 +21,27 @@ - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + @@ -165,46 +176,92 @@ img.src = '/images/green-2x2.png'; }, 'load'); - t('crossorigin absent to empty', function(img) { + // When src is absent, changing the crossorigin attribute state MUST NOT + // generate events. + + t('crossorigin absent to empty, src absent', function(img) { img.crossOrigin = ''; }, 'timeout'); - t('crossorigin absent to anonymous', function(img) { + t('crossorigin absent to anonymous, src absent', function(img) { img.crossOrigin = 'anonymous'; }, 'timeout'); - t('crossorigin absent to use-credentials', function(img) { + t('crossorigin absent to use-credentials, src absent', function(img) { img.crossOrigin = 'use-credentials'; }, 'timeout'); - t('crossorigin empty to absent', function(img) { + t('crossorigin empty to absent, src absent', function(img) { img.removeAttribute('crossorigin'); }, 'timeout'); - t('crossorigin empty to use-credentials', function(img) { + t('crossorigin empty to use-credentials, src absent', function(img) { img.crossOrigin = 'use-credentials'; }, 'timeout'); - t('crossorigin anonymous to absent', function(img) { + t('crossorigin anonymous to absent, src absent', function(img) { img.removeAttribute('crossorigin'); }, 'timeout'); - t('crossorigin anonymous to use-credentials', function(img) { + t('crossorigin anonymous to use-credentials, src absent', function(img) { img.crossOrigin = 'use-credentials'; }, 'timeout'); - t('crossorigin use-credentials to absent', function(img) { + t('crossorigin use-credentials to absent, src absent', function(img) { img.removeAttribute('crossorigin'); }, 'timeout'); - t('crossorigin use-credentials to empty', function(img) { + t('crossorigin use-credentials to empty, src absent', function(img) { img.crossOrigin = ''; }, 'timeout'); - t('crossorigin use-credentials to anonymous', function(img) { + t('crossorigin use-credentials to anonymous, src absent', function(img) { img.crossOrigin = 'anonymous'; }, 'timeout'); + // When src is set, changing the crossorigin attribute state MUST generate + // events. + + t('crossorigin absent to empty, src already set', function(img) { + img.crossOrigin = ''; + }, 'load'); + + t('crossorigin absent to anonymous, src already set', function(img) { + img.crossOrigin = 'anonymous'; + }, 'load'); + + t('crossorigin absent to use-credentials, src already set', function(img) { + img.crossOrigin = 'use-credentials'; + }, 'load'); + + t('crossorigin empty to absent, src already set', function(img) { + img.removeAttribute('crossorigin'); + }, 'load'); + + t('crossorigin empty to use-credentials, src already set', function(img) { + img.crossOrigin = 'use-credentials'; + }, 'load'); + + t('crossorigin anonymous to absent, src already set', function(img) { + img.removeAttribute('crossorigin'); + }, 'load'); + + t('crossorigin anonymous to use-credentials, src already set', function(img) { + img.crossOrigin = 'use-credentials'; + }, 'load'); + + t('crossorigin use-credentials to absent, src already set', function(img) { + img.removeAttribute('crossorigin'); + }, 'load'); + + t('crossorigin use-credentials to empty, src already set', function(img) { + img.crossOrigin = ''; + }, 'load'); + + t('crossorigin use-credentials to anonymous, src already set', function(img) { + img.crossOrigin = 'anonymous'; + }, 'load'); + t('inserted into picture', function(img) { img.nextSibling.appendChild(img); }, 'load'); diff --git a/tests/wpt/web-platform-tests/html/user-activation/activation-transfer-cross-origin-with-click-two-child-frames.sub.tentative.html b/tests/wpt/web-platform-tests/html/user-activation/activation-transfer-cross-origin-with-click-two-child-frames.sub.tentative.html new file mode 100644 index 000000000000..edaad2614785 --- /dev/null +++ b/tests/wpt/web-platform-tests/html/user-activation/activation-transfer-cross-origin-with-click-two-child-frames.sub.tentative.html @@ -0,0 +1,90 @@ + + + + + + + + + + +

User activation can be transferred to a cross-origin child frame + via a postMessage option.

+
    +
  1. Click this instruction text. +
+ + + + + diff --git a/tests/wpt/web-platform-tests/html/user-activation/resources/child-five.html b/tests/wpt/web-platform-tests/html/user-activation/resources/child-five.html new file mode 100644 index 000000000000..9260a300a1bd --- /dev/null +++ b/tests/wpt/web-platform-tests/html/user-activation/resources/child-five.html @@ -0,0 +1,15 @@ + + + + diff --git a/tests/wpt/web-platform-tests/html/user-activation/resources/child-four.html b/tests/wpt/web-platform-tests/html/user-activation/resources/child-four.html index d31280341196..4811edb7ef0b 100644 --- a/tests/wpt/web-platform-tests/html/user-activation/resources/child-four.html +++ b/tests/wpt/web-platform-tests/html/user-activation/resources/child-four.html @@ -1,6 +1,6 @@ - + + diff --git a/tests/wpt/web-platform-tests/portals/portals-adopt-predecessor.html b/tests/wpt/web-platform-tests/portals/portals-adopt-predecessor.html index 99c44f0bfc3c..27e4052a67ec 100644 --- a/tests/wpt/web-platform-tests/portals/portals-adopt-predecessor.html +++ b/tests/wpt/web-platform-tests/portals/portals-adopt-predecessor.html @@ -10,7 +10,6 @@ assert_equals(e.data, "passed"); bc.close(); }); - var portalUrl = encodeURIComponent(`portal-activate-event-portal.html?test=${test}`); window.open(`resources/portals-adopt-predecessor.html?test=${test}`); }, "Tests that a portal can adopt its predecessor."); @@ -21,7 +20,6 @@ assert_equals(e.data, "passed"); bc.close(); }); - var portalUrl = encodeURIComponent(`portal-activate-event-portal.html?test=${test}`); window.open(`resources/portals-adopt-predecessor.html?test=${test}`); }, "Tests that trying to adopt the predecessor twice will throw an exception."); diff --git a/tests/wpt/web-platform-tests/portals/portals-create-orphaned.html b/tests/wpt/web-platform-tests/portals/portals-create-orphaned.html deleted file mode 100644 index 903186ff6c69..000000000000 --- a/tests/wpt/web-platform-tests/portals/portals-create-orphaned.html +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - diff --git a/tests/wpt/web-platform-tests/portals/resources/portal-create-orphaned.html b/tests/wpt/web-platform-tests/portals/resources/portal-create-orphaned.html deleted file mode 100644 index 89b927f649b9..000000000000 --- a/tests/wpt/web-platform-tests/portals/resources/portal-create-orphaned.html +++ /dev/null @@ -1,28 +0,0 @@ - - - - diff --git a/tests/wpt/web-platform-tests/portals/resources/portals-adopt-predecessor-portal.html b/tests/wpt/web-platform-tests/portals/resources/portals-adopt-predecessor-portal.html index 96de3b7e4a40..14d1018b906e 100644 --- a/tests/wpt/web-platform-tests/portals/resources/portals-adopt-predecessor-portal.html +++ b/tests/wpt/web-platform-tests/portals/resources/portals-adopt-predecessor-portal.html @@ -2,7 +2,6 @@ diff --git a/tests/wpt/web-platform-tests/portals/resources/portals-adopt-predecessor.html b/tests/wpt/web-platform-tests/portals/resources/portals-adopt-predecessor.html index b92ad8a17c19..287ba2c35727 100644 --- a/tests/wpt/web-platform-tests/portals/resources/portals-adopt-predecessor.html +++ b/tests/wpt/web-platform-tests/portals/resources/portals-adopt-predecessor.html @@ -5,18 +5,15 @@ var searchParams = new URL(location).searchParams; var test = searchParams.get("test"); var bc = new BroadcastChannel(`portal-${test}`); - bc.onmessage = function(e) { - switch (e.data) { - case "loaded": - document.querySelector("portal").activate(); - break; - - case "passed": - bc.close(); + bc.onmessage = e => { + bc.close(); + document.querySelector("portal").activate().then(() => { + window.portalHost.addEventListener("message", () => { var bc_test = new BroadcastChannel(`test-${test}`); bc_test.postMessage("passed"); bc_test.close(); - } + }); + }); } var portal = document.createElement("portal"); diff --git a/tests/wpt/web-platform-tests/referrer-policy/generic/referrer-policy-test-case.js b/tests/wpt/web-platform-tests/referrer-policy/generic/referrer-policy-test-case.js index 6d570f1dc0fd..8bdbd3961b9d 100644 --- a/tests/wpt/web-platform-tests/referrer-policy/generic/referrer-policy-test-case.js +++ b/tests/wpt/web-platform-tests/referrer-policy/generic/referrer-policy-test-case.js @@ -1,3 +1,36 @@ +// TODO: This function is currently placed and duplicated at: +// - mixed-content/generic/mixed-content-test-case.js +// - referrer-policy/generic/referrer-policy-test-case.js +// but should be moved to /common/security-features/resources/common.js. +function getSubresourceOrigin(originType) { + const httpProtocol = "http"; + const httpsProtocol = "https"; + const wsProtocol = "ws"; + const wssProtocol = "wss"; + + const sameOriginHost = "{{host}}"; + const crossOriginHost = "{{domains[www1]}}"; + + // These values can evaluate to either empty strings or a ":port" string. + const httpPort = getNormalizedPort(parseInt("{{ports[http][0]}}", 10)); + const httpsPort = getNormalizedPort(parseInt("{{ports[https][0]}}", 10)); + const wsPort = getNormalizedPort(parseInt("{{ports[ws][0]}}", 10)); + const wssPort = getNormalizedPort(parseInt("{{ports[wss][0]}}", 10)); + + const originMap = { + "same-https": httpsProtocol + "://" + sameOriginHost + httpsPort, + "same-http": httpProtocol + "://" + sameOriginHost + httpPort, + "cross-https": httpsProtocol + "://" + crossOriginHost + httpsPort, + "cross-http": httpProtocol + "://" + crossOriginHost + httpPort, + "same-wss": wssProtocol + "://" + sameOriginHost + wssPort, + "same-ws": wsProtocol + "://" + sameOriginHost + wsPort, + "cross-wss": wssProtocol + "://" + crossOriginHost + wssPort, + "cross-ws": wsProtocol + "://" + crossOriginHost + wsPort, + }; + + return originMap[originType]; +} + // NOTE: This method only strips the fragment and is not in accordance to the // recommended draft specification: // https://w3c.github.io/webappsec/specs/referrer-policy/#null @@ -7,14 +40,6 @@ function stripUrlForUseAsReferrer(url) { return url.replace(/#.*$/, ""); } -function normalizePort(targetPort) { - var defaultPorts = [80, 443]; - var isDefaultPortForProtocol = (defaultPorts.indexOf(targetPort) >= 0); - - return (targetPort == "" || isDefaultPortForProtocol) ? - "" : ":" + targetPort; -} - function ReferrerPolicyTestCase(scenario, testDescription, sanityChecker) { // Pass and skip rest of the test if browser does not support fetch. if (scenario.subresource == "fetch-request" && !window.fetch) { @@ -30,120 +55,65 @@ function ReferrerPolicyTestCase(scenario, testDescription, sanityChecker) { // This check is A NOOP in release. sanityChecker.checkScenario(scenario); - var subresourceInvoker = { - "a-tag": requestViaAnchor, - "area-tag": requestViaArea, - "fetch-request": requestViaFetch, - "iframe-tag": requestViaIframe, - "img-tag": requestViaImageForReferrerPolicy, - "script-tag": requestViaScript, - "worker-request": url => requestViaDedicatedWorker(url, {}), - "module-worker": url => requestViaDedicatedWorker(url, {type: "module"}), - "shared-worker": requestViaSharedWorker, - "xhr-request": requestViaXhr - }; - - const subresourcePath = { - "a-tag": "/common/security-features/subresource/document.py", - "area-tag": "/common/security-features/subresource/document.py", - "fetch-request": "/common/security-features/subresource/xhr.py", - "iframe-tag": "/common/security-features/subresource/document.py", - "img-tag": "/common/security-features/subresource/image.py", - "script-tag": "/common/security-features/subresource/script.py", - "worker-request": "/common/security-features/subresource/worker.py", - "module-worker": "/common/security-features/subresource/worker.py", - "shared-worker": "/common/security-features/subresource/shared-worker.py", - "xhr-request": "/common/security-features/subresource/xhr.py" + const originTypeConversion = { + "same-origin-http": "same-http", + "same-origin-https": "same-https", + "cross-origin-http": "cross-http", + "cross-origin-https": "cross-https" }; - - var referrerUrlResolver = { - "omitted": function() { - return undefined; - }, - "origin": function() { - return self.origin + "/"; - }, - "stripped-referrer": function() { - return stripUrlForUseAsReferrer(location.toString()); - } - }; - - var t = { - _scenario: scenario, - _testDescription: testDescription, - _constructSubresourceUrl: function() { - // TODO(kristijanburnik): We should assert that these two domains are - // different. E.g. If someone runs the tets over www, this would fail. - var domainForOrigin = { - "cross-origin":"{{domains[www1]}}", - "same-origin": location.hostname - }; - - // Values obtained and replaced by the wptserve pipeline: - // http://wptserve.readthedocs.org/en/latest/pipes.html#built-in-pipes - var portForProtocol = { - "http": parseInt("{{ports[http][0]}}"), - "https": parseInt("{{ports[https][0]}}") + const urls = getRequestURLs( + scenario.subresource, + originTypeConversion[scenario.origin + '-' + scenario.target_protocol], + scenario.redirection); + const invoker = + subresourceMap[scenario.subresource].invokerForReferrerPolicy || + subresourceMap[scenario.subresource].invoker; + const checkResult = result => { + const referrerUrlResolver = { + "omitted": function() { + return undefined; + }, + "origin": function() { + return self.origin + "/"; + }, + "stripped-referrer": function() { + return stripUrlForUseAsReferrer(location.toString()); } + }; + const expectedReferrerUrl = + referrerUrlResolver[scenario.referrer_url](); + + // Check if the result is in valid format. NOOP in release. + sanityChecker.checkSubresourceResult(scenario, urls.testUrl, result); + + // Check the reported URL. + assert_equals(result.referrer, + expectedReferrerUrl, + "Reported Referrer URL is '" + + scenario.referrer_url + "'."); + assert_equals(result.headers.referer, + expectedReferrerUrl, + "Reported Referrer URL from HTTP header is '" + + expectedReferrerUrl + "'"); + }; - var targetPort = portForProtocol[t._scenario.target_protocol]; - - return t._scenario.target_protocol + "://" + - domainForOrigin[t._scenario.origin] + - normalizePort(targetPort) + - subresourcePath[t._scenario.subresource] + - "?redirection=" + t._scenario["redirection"] + - "&cache_destroyer=" + (new Date()).getTime(); - }, - - _constructExpectedReferrerUrl: function() { - return referrerUrlResolver[t._scenario.referrer_url](); - }, - - // Returns a promise. - _invokeSubresource: function(resourceRequestUrl) { - var invoker = subresourceInvoker[t._scenario.subresource]; + function runTest() { + promise_test(_ => { // Depending on the delivery method, extend the subresource element with // these attributes. var elementAttributesForDeliveryMethod = { - "attr-referrer": {referrerPolicy: t._scenario.referrer_policy}, + "attr-referrer": {referrerPolicy: scenario.referrer_policy}, "rel-noreferrer": {rel: "noreferrer"} }; - - var delivery_method = t._scenario.delivery_method; - - if (delivery_method in elementAttributesForDeliveryMethod) { - return invoker(resourceRequestUrl, - elementAttributesForDeliveryMethod[delivery_method], - t._scenario.referrer_policy); - } else { - return invoker(resourceRequestUrl, {}, t._scenario.referrer_policy); + var deliveryMethod = scenario.delivery_method; + let elementAttributes = {}; + if (deliveryMethod in elementAttributesForDeliveryMethod) { + elementAttributes = elementAttributesForDeliveryMethod[deliveryMethod]; } - }, - - start: function() { - promise_test(test => { - const resourceRequestUrl = t._constructSubresourceUrl(); - const expectedReferrerUrl = t._constructExpectedReferrerUrl(); - return t._invokeSubresource(resourceRequestUrl) - .then(result => { - // Check if the result is in valid format. NOOP in release. - sanityChecker.checkSubresourceResult( - test, t._scenario, resourceRequestUrl, result); - - // Check the reported URL. - assert_equals(result.referrer, - expectedReferrerUrl, - "Reported Referrer URL is '" + - t._scenario.referrer_url + "'."); - assert_equals(result.headers.referer, - expectedReferrerUrl, - "Reported Referrer URL from HTTP header is '" + - expectedReferrerUrl + "'"); - }); - }, t._testDescription); - } + return invoker(urls.testUrl, elementAttributes, scenario.referrer_policy) + .then(checkResult); + }, testDescription); } - return t; + return {start: runTest}; } diff --git a/tests/wpt/web-platform-tests/referrer-policy/generic/sanity-checker.js b/tests/wpt/web-platform-tests/referrer-policy/generic/sanity-checker.js index 5c01c36f3582..e296ce93b965 100644 --- a/tests/wpt/web-platform-tests/referrer-policy/generic/sanity-checker.js +++ b/tests/wpt/web-platform-tests/referrer-policy/generic/sanity-checker.js @@ -28,22 +28,19 @@ SanityChecker.prototype.checkScenario = function(scenario) { }, "[ReferrerPolicyTestCase] The test scenario is valid."); } -SanityChecker.prototype.checkSubresourceResult = function(test, - scenario, +SanityChecker.prototype.checkSubresourceResult = function(scenario, subresourceUrl, result) { - test.step(function() { - assert_equals(Object.keys(result).length, 3); - assert_own_property(result, "location"); - assert_own_property(result, "referrer"); - assert_own_property(result, "headers"); - - // Skip location check for scripts. - if (scenario.subresource == "script-tag") - return; - - // Sanity check: location of sub-resource matches reported location. - assert_equals(result.location, subresourceUrl, - "Subresource reported location."); - }, "Running a valid test scenario."); + assert_equals(Object.keys(result).length, 3); + assert_own_property(result, "location"); + assert_own_property(result, "referrer"); + assert_own_property(result, "headers"); + + // Skip location check for scripts. + if (scenario.subresource == "script-tag") + return; + + // Sanity check: location of sub-resource matches reported location. + assert_equals(result.location, subresourceUrl, + "Subresource reported location."); }; diff --git a/tests/wpt/web-platform-tests/resources/test/tests/unit/unpaired-surrogates.html b/tests/wpt/web-platform-tests/resources/test/tests/unit/unpaired-surrogates.html new file mode 100644 index 000000000000..1b162fe71d28 --- /dev/null +++ b/tests/wpt/web-platform-tests/resources/test/tests/unit/unpaired-surrogates.html @@ -0,0 +1,138 @@ + + + + + + Restrictions on return value from `test` + + + + + diff --git a/tests/wpt/web-platform-tests/resources/testharness.js b/tests/wpt/web-platform-tests/resources/testharness.js index d40817c7d419..cb341db2050e 100644 --- a/tests/wpt/web-platform-tests/resources/testharness.js +++ b/tests/wpt/web-platform-tests/resources/testharness.js @@ -2383,6 +2383,42 @@ policies and contribution forms [3]. return duplicates; }; + function code_unit_str(char) { + return 'U+' + char.charCodeAt(0).toString(16); + } + + function sanitize_unpaired_surrogates(str) { + return str.replace(/([\ud800-\udbff])(?![\udc00-\udfff])/g, + function(_, unpaired) + { + return code_unit_str(unpaired); + }) + // This replacement is intentionally implemented without an + // ES2018 negative lookbehind assertion to support runtimes + // which do not yet implement that language feature. + .replace(/(^|[^\ud800-\udbff])([\udc00-\udfff])/g, + function(_, previous, unpaired) { + if (/[\udc00-\udfff]/.test(previous)) { + previous = code_unit_str(previous); + } + + return previous + code_unit_str(unpaired); + }); + } + + function sanitize_all_unpaired_surrogates(tests) { + forEach (tests, + function (test) + { + var sanitized = sanitize_unpaired_surrogates(test.name); + + if (test.name !== sanitized) { + test.name = sanitized; + delete test._structured_clone; + } + }); + } + Tests.prototype.notify_complete = function() { var this_obj = this; var duplicates; @@ -2390,6 +2426,11 @@ policies and contribution forms [3]. if (this.status.status === null) { duplicates = this.find_duplicates(); + // Some transports adhere to UTF-8's restriction on unpaired + // surrogates. Sanitize the titles so that the results can be + // consistently sent via all transports. + sanitize_all_unpaired_surrogates(this.tests); + // Test names are presumed to be unique within test files--this // allows consumers to use them for identification purposes. // Duplicated names violate this expectation and should therefore diff --git a/tests/wpt/web-platform-tests/tools/wpt/utils.py b/tests/wpt/web-platform-tests/tools/wpt/utils.py index f98687feb517..2d427713e4e8 100644 --- a/tests/wpt/web-platform-tests/tools/wpt/utils.py +++ b/tests/wpt/web-platform-tests/tools/wpt/utils.py @@ -6,7 +6,7 @@ from io import BytesIO try: - from typing import Any + from typing import Any, Callable except ImportError: pass @@ -17,10 +17,11 @@ class Kwargs(dict): def set_if_none(self, name, # type: str value, # type: Any - err_fn=None, # type: (Kwargs, str) -> Any + err_fn=None, # type: Callable[[Kwargs, str], Any] desc=None, # type: str - extra_cond=None # type: (Kwargs) -> bool + extra_cond=None # type: Callable[[Kwargs], Any] ): + # type: (...) -> Any if desc is None: desc = name diff --git a/tests/wpt/web-platform-tests/webrtc-quic/RTCQuicTransport.https.html b/tests/wpt/web-platform-tests/webrtc-quic/RTCQuicTransport.https.html index 82427e67cb4a..12c2371f8e21 100644 --- a/tests/wpt/web-platform-tests/webrtc-quic/RTCQuicTransport.https.html +++ b/tests/wpt/web-platform-tests/webrtc-quic/RTCQuicTransport.https.html @@ -261,8 +261,123 @@ localQuicTransport.transport.stop(); const promise = localQuicTransport.getStats(); promise_rejects(t, 'InvalidStateError', promise); -}, 'getStats() promises immediately rejected if called after' + +}, 'getStats() promises immediately rejected if called after ' + `'closed' state.`); +test(t => { + const quicTransport = makeStandaloneQuicTransport(t); + assert_throws('InvalidStateError', + () => quicTransport.sendDatagram(new Uint8Array([1]))); +}, `sendDatagram() throws InvalidStateError if called before 'connected'.`); + +test(t => { + const quicTransport = makeStandaloneQuicTransport(t); + quicTransport.stop(); + assert_equals(quicTransport.state, 'closed'); + assert_throws('InvalidStateError', + () => quicTransport.sendDatagram(new Uint8Array([1]))); +}, `sendDatagram() throws InvalidStateError if called when 'closed'.`); + +test(t => { + const quicTransport = makeStandaloneQuicTransport(t); + assert_equals(quicTransport.maxDatagramLength, null); +}, 'maxDatagramLength 0 before connected.'); + +promise_test(async t => { + const [ localQuicTransport, remoteQuicTransport ] = + await makeTwoConnectedQuicTransports(t); + assert_greater_than(localQuicTransport.maxDatagramLength, 0); +}, 'maxDatagramLength larger than 0 after connected.'); + +promise_test(async t => { + const [ localQuicTransport, remoteQuicTransport ] = + await makeTwoConnectedQuicTransports(t); + const bigData = new Uint8Array(localQuicTransport.maxDatagramLength + 1); + assert_throws('InvalidStateError', + () => localQuicTransport.sendDatagram(bigData)); +}, 'sendDatagram() throws InvalidStateError if called with data larger ' + + 'than maxDatagramLength()'); + +promise_test(async t => { + const [ localQuicTransport, remoteQuicTransport ] = + await makeTwoConnectedQuicTransports(t); + const datagram = new Uint8Array([42]); + await localQuicTransport.readyToSendDatagram(); + localQuicTransport.sendDatagram(datagram); + const receiveDatagrams = await remoteQuicTransport.receiveDatagrams(); + assert_equals(receiveDatagrams.length, 1); + const receiveDatagram = new Uint8Array(receiveDatagrams[0]); + assert_array_equals(receiveDatagram, datagram); +}, 'sendDatagram() sends a datagram to remote side'); + +promise_test(async t => { + const [ localQuicTransport, remoteQuicTransport ] = + await makeTwoConnectedQuicTransports(t); + const datagram = new Uint8Array([42]); + const datagram2 = new Uint8Array([43]); + await localQuicTransport.readyToSendDatagram(); + localQuicTransport.sendDatagram(datagram); + const receiveDatagrams = await remoteQuicTransport.receiveDatagrams(); + assert_equals(receiveDatagrams.length, 1); + const receiveDatagram = new Uint8Array(receiveDatagrams[0]); + assert_array_equals(receiveDatagram, datagram); + await localQuicTransport.readyToSendDatagram(); + localQuicTransport.sendDatagram(datagram2); + const receiveDatagrams2 = await remoteQuicTransport.receiveDatagrams(); + assert_equals(receiveDatagrams2.length, 1); + const receiveDatagram2 = new Uint8Array(receiveDatagrams2[0]); + assert_array_equals(receiveDatagram2, datagram2); +}, 'sendDatagram() sends a multiple datagrams to remote side'); + +test(t => { + const quicTransport = makeStandaloneQuicTransport(t); + const promise = quicTransport.readyToSendDatagram(); + promise_rejects(t, 'InvalidStateError', promise); +}, 'readyToSendDatagram() promise immediately rejected if called before ' + + 'connecting'); + +promise_test(async t => { + const [ localQuicTransport, remoteQuicTransport ] = + await makeTwoConnectedQuicTransports(t); + localQuicTransport.stop(); + const promise = localQuicTransport.readyToSendDatagram(); + promise_rejects(t, 'InvalidStateError', promise); +}, 'readyToSendDatagram() promise immediately rejected if called after ' + + `'closed' state.`); + +test(t => { + const quicTransport = makeStandaloneQuicTransport(t); + const promise = quicTransport.receiveDatagrams(); + promise_rejects(t, 'InvalidStateError', promise); +}, 'receiveDatagrams() promise immediately rejected if called before ' + + 'connecting.'); + +promise_test(async t => { + const [ localQuicTransport, remoteQuicTransport ] = + await makeTwoConnectedQuicTransports(t); + localQuicTransport.stop(); + const promise = localQuicTransport.receiveDatagrams(); + promise_rejects(t, 'InvalidStateError', promise); +}, 'receiveDatagrams() promise immediately rejected if called after ' + + `'closed' state.`); + +promise_test(async t => { + const [ localQuicTransport, remoteQuicTransport ] = + await makeTwoConnectedQuicTransports(t); + const promise = localQuicTransport.receiveDatagrams(); + localQuicTransport.stop(); + promise_rejects(t, 'InvalidStateError', promise); +}, 'receiveDatagrams() promise rejected with InvalidStateError if stop() ' + + 'is called before being fulfilled.'); + +promise_test(async t => { + const [ localQuicTransport, remoteQuicTransport ] = + await makeTwoConnectedQuicTransports(t); + const promise = localQuicTransport.receiveDatagrams(); + localQuicTransport.transport.stop(); + promise_rejects(t, 'InvalidStateError', promise); +}, 'receiveDatagrams() promises rejected with InvalidStateError if ' + + 'RTCIceTransport calls stop() before being fulfilled.'); + diff --git a/tests/wpt/web-platform-tests/xhr/send-redirect-post-upload.htm b/tests/wpt/web-platform-tests/xhr/send-redirect-post-upload.htm index 5c1c6387adb7..b1db8ec2ac94 100644 --- a/tests/wpt/web-platform-tests/xhr/send-redirect-post-upload.htm +++ b/tests/wpt/web-platform-tests/xhr/send-redirect-post-upload.htm @@ -91,6 +91,14 @@ if(xhr.readyState >= xhr.HEADERS_RECEIVED) { assert_equals(xhr.status, 200, "JS never gets to see the 30x status code"); } + + // The UA may fire multiple "readystatechange" events while in + // the "loading" state. + // https://xhr.spec.whatwg.org/#the-send()-method + if (xhr.readyState === 3 && actual[actual.length - 1] === "xhr onreadystatechange 3") { + return; + } + actual.push("xhr onreadystatechange " + xhr.readyState); }); xhr.onload = test.step_func(function(e) diff --git a/tests/wpt/webgl/meta/conformance/textures/misc/texture-upload-size.html.ini b/tests/wpt/webgl/meta/conformance/textures/misc/texture-upload-size.html.ini index 772b6425f610..9f39841e3e8b 100644 --- a/tests/wpt/webgl/meta/conformance/textures/misc/texture-upload-size.html.ini +++ b/tests/wpt/webgl/meta/conformance/textures/misc/texture-upload-size.html.ini @@ -35,3 +35,6 @@ [WebGL test #124: could not create image (SVG)] expected: FAIL + [WebGL test #132: could not create image (SVG)] + expected: FAIL +