WebKit Bugzilla
Attachment 358279 Details for
Bug 193125
: Resync WPT fetch tests to 834eac4
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-193125-20190103144910.patch (text/plain), 884.21 KB, created by
youenn fablet
on 2019-01-03 14:49:12 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
youenn fablet
Created:
2019-01-03 14:49:12 PST
Size:
884.21 KB
patch
obsolete
>Subversion Revision: 239594 >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index 20a5d6205b2f00f11ee0edf39a2547dc4e56b1fb..5567ab5c5be5bfe9b7cad00eabcb879cfb18a470 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,30 @@ >+2019-01-03 Youenn Fablet <youenn@apple.com> >+ >+ Resync WPT fetch tests to 834eac4 >+ https://bugs.webkit.org/show_bug.cgi?id=193125 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * TestExpectations: >+ * platform/gtk/TestExpectations: >+ * platform/ios-simulator/imported/w3c/web-platform-tests/fetch/content-type/response.window-expected.txt: Added. >+ * platform/ios-wk1/TestExpectations: >+ * platform/ios/TestExpectations: >+ * platform/mac-wk1/imported/w3c/web-platform-tests/fetch/api/abort/serviceworker-intercepted.https-expected.txt: >+ * platform/mac-wk1/imported/w3c/web-platform-tests/fetch/api/request/request-init-stream.any-expected.txt: Added. >+ * platform/mac-wk1/imported/w3c/web-platform-tests/fetch/api/request/request-reset-attributes.https-expected.txt: Added. >+ * platform/mac-wk1/imported/w3c/web-platform-tests/fetch/content-type/script.window-expected.txt: Added. >+ * platform/mac-wk1/imported/w3c/web-platform-tests/fetch/http-cache/304-update-expected.txt: >+ * platform/mac-wk1/imported/w3c/web-platform-tests/fetch/http-cache/cc-request-expected.txt: >+ * platform/mac-wk1/imported/w3c/web-platform-tests/fetch/http-cache/heuristic-expected.txt: >+ * platform/mac-wk1/imported/w3c/web-platform-tests/fetch/http-cache/invalidate-expected.txt: >+ * platform/mac-wk1/imported/w3c/web-platform-tests/fetch/http-cache/status-expected.txt: >+ * platform/mac-wk1/imported/w3c/web-platform-tests/fetch/sec-metadata/embed.tentative.https.sub-expected.txt: Added. >+ * platform/mac-wk1/imported/w3c/web-platform-tests/fetch/sec-metadata/object.tentative.https.sub-expected.txt: Added. >+ * platform/mac-wk1/imported/w3c/web-platform-tests/fetch/sec-metadata/serviceworker.tentative.https.sub-expected.txt: Added. >+ * platform/mac/TestExpectations: >+ * tests-options.json: >+ > 2019-01-03 Brent Fulgham <bfulgham@apple.com> > > Remove logic handling DNT header during redirects >diff --git a/LayoutTests/imported/w3c/ChangeLog b/LayoutTests/imported/w3c/ChangeLog >index 6a43ef63a38c01ff956aa50713ad65484e05eff5..0873fb25197838c7863ef4ed0e7ad22d2554cc92 100644 >--- a/LayoutTests/imported/w3c/ChangeLog >+++ b/LayoutTests/imported/w3c/ChangeLog >@@ -1,3 +1,12 @@ >+2019-01-03 Youenn Fablet <youenn@apple.com> >+ >+ Resync WPT fetch tests to 834eac4 >+ https://bugs.webkit.org/show_bug.cgi?id=193125 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * web-platform-tests/fetch: Resynced. >+ > 2019-01-02 Simon Fraser <simon.fraser@apple.com> > > Support css-color-4 rgb functions >diff --git a/LayoutTests/TestExpectations b/LayoutTests/TestExpectations >index 23018bc2921d41600b98bb6cef164b9c74ad7665..f052f6956d6bc17ba1e081367dc1f40c027d8101 100644 >--- a/LayoutTests/TestExpectations >+++ b/LayoutTests/TestExpectations >@@ -211,7 +211,6 @@ imported/w3c/web-platform-tests/service-workers/service-worker/worker-client-id. > imported/w3c/web-platform-tests/cors/remote-origin.htm [ Skip ] > > # Skip service worker tests that are timing out. >-imported/w3c/web-platform-tests/fetch/api/abort/general-serviceworker.https.html [ Skip ] > imported/w3c/web-platform-tests/service-workers/service-worker/performance-timeline.https.html [ Skip ] > imported/w3c/web-platform-tests/service-workers/service-worker/respond-with-body-accessed-response.https.html [ Skip ] > imported/w3c/web-platform-tests/service-workers/service-worker/sandboxed-iframe-fetch-event.https.html [ Skip ] >@@ -262,8 +261,6 @@ http/tests/security/frame-loading-via-document-write-async-delegates.html [ Dump > imported/w3c/web-platform-tests/fetch/api/basic/mode-same-origin.any.html [ DumpJSConsoleLogInStdErr ] > imported/w3c/web-platform-tests/fetch/api/basic/scheme-about.any.html [ DumpJSConsoleLogInStdErr ] > imported/w3c/web-platform-tests/fetch/api/basic/scheme-about.any.worker.html [ DumpJSConsoleLogInStdErr ] >-imported/w3c/web-platform-tests/fetch/api/redirect/redirect-mode-worker.html [ DumpJSConsoleLogInStdErr ] >-imported/w3c/web-platform-tests/fetch/api/redirect/redirect-to-dataurl.html [ DumpJSConsoleLogInStdErr ] > > imported/w3c/web-platform-tests/service-workers/service-worker/fetch-response-taint.https.html [ DumpJSConsoleLogInStdErr ] > imported/w3c/web-platform-tests/service-workers/service-worker/register-closed-window.https.html [ DumpJSConsoleLogInStdErr ] >@@ -303,7 +300,6 @@ imported/w3c/web-platform-tests/workers/constructors/SharedWorker [ Skip ] > imported/w3c/web-platform-tests/workers/SharedWorker_blobUrl.html [ Skip ] > > imported/w3c/web-platform-tests/beacon/beacon-basic-blob.html [ DumpJSConsoleLogInStdErr ] >-imported/w3c/web-platform-tests/fetch/api/redirect/redirect-mode.html [ DumpJSConsoleLogInStdErr ] > imported/w3c/web-platform-tests/fetch/api/cors/cors-preflight-redirect.any.worker.html [ DumpJSConsoleLogInStdErr ] > imported/w3c/web-platform-tests/xhr/access-control-and-redirects.htm [ DumpJSConsoleLogInStdErr ] > imported/w3c/web-platform-tests/xhr/access-control-basic-cors-safelisted-request-headers.htm [ DumpJSConsoleLogInStdErr ] >@@ -383,6 +379,15 @@ webkit.org/b/189905 imported/w3c/web-platform-tests/resource-timing/resource_ini > webkit.org/b/189910 imported/w3c/web-platform-tests/resource-timing/resource_timing_store_and_clear_during_callback.html [ Pass Failure ] > webkit.org/b/190523 imported/w3c/web-platform-tests/resource-timing/resource_timing_cross_origin_redirect_chain.html [ Pass Failure ] > >+imported/w3c/web-platform-tests/fetch/api/redirect/redirect-count.any.html [ Pass Failure ] >+imported/w3c/web-platform-tests/fetch/api/redirect/redirect-count.any.worker.html [ Pass Failure ] >+imported/w3c/web-platform-tests/fetch/content-encoding/bad-gzip-body.any.html [ Pass Failure ] >+imported/w3c/web-platform-tests/fetch/content-encoding/bad-gzip-body.any.worker.html [ Pass Failure ] >+imported/w3c/web-platform-tests/fetch/corb/img-html-correctly-labeled.sub.html [ ImageOnlyFailure ] >+imported/w3c/web-platform-tests/fetch/corb/img-png-mislabeled-as-html-nosniff.tentative.sub.html [ ImageOnlyFailure ] >+imported/w3c/web-platform-tests/fetch/corb/img-png-mislabeled-as-html.sub.html [ ImageOnlyFailure ] >+imported/w3c/web-platform-tests/fetch/http-cache/basic-auth-cache-test.html [ ImageOnlyFailure ] >+ > # The follow two tests change their output each run > imported/w3c/web-platform-tests/fetch/api/abort/general.any.html [ Skip ] > imported/w3c/web-platform-tests/fetch/api/abort/general.any.worker.html [ Skip ] >@@ -390,6 +395,7 @@ imported/w3c/web-platform-tests/fetch/api/abort/general.any.worker.html [ Skip ] > # These tests time out > imported/w3c/web-platform-tests/fetch/api/request/destination/fetch-destination-no-load-event.https.html [ Skip ] > imported/w3c/web-platform-tests/fetch/api/request/destination/fetch-destination.https.html [ Skip ] >+imported/w3c/web-platform-tests/fetch/range/sw.https.window.html [ Skip ] > > # Not supported > imported/w3c/web-platform-tests/background-fetch [ Skip ] >@@ -755,6 +761,8 @@ imported/w3c/web-platform-tests/fetch/api/cors/cors-preflight-status.any.html [ > imported/w3c/web-platform-tests/fetch/api/cors/cors-preflight.any.html [ DumpJSConsoleLogInStdErr ] > imported/w3c/web-platform-tests/fetch/api/cors/cors-redirect-preflight.any.html [ DumpJSConsoleLogInStdErr ] > imported/w3c/web-platform-tests/fetch/api/request/request-cache-only-if-cached.html [ DumpJSConsoleLogInStdErr ] >+imported/w3c/web-platform-tests/fetch/content-type/script.window.html [ DumpJSConsoleLogInStdErr ] >+imported/w3c/web-platform-tests/fetch/api/request/request-init-stream.any.html [ DumpJSConsoleLogInStdErr ] > > webkit.org/b/161088 imported/w3c/web-platform-tests/resource-timing/resource-timing.html [ Pass Failure ] > imported/w3c/web-platform-tests/resource-timing/test_resource_timing.html [ Pass Failure ] >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/META.yml b/LayoutTests/imported/w3c/web-platform-tests/fetch/META.yml >new file mode 100644 >index 0000000000000000000000000000000000000000..43f9dc51cfd31e70601a186a9b91e8f3d7afd462 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/META.yml >@@ -0,0 +1,8 @@ >+spec: https://fetch.spec.whatwg.org/ >+suggested_reviewers: >+ - jdm >+ - youennf >+ - annevk >+ - mnot >+ - yutakahirano >+ - domfarolino >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/OWNERS b/LayoutTests/imported/w3c/web-platform-tests/fetch/OWNERS >deleted file mode 100644 >index e2f2428209f3aa8f39f1b769094f7e91beb04393..0000000000000000000000000000000000000000 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/OWNERS >+++ /dev/null >@@ -1,5 +0,0 @@ >-@jdm >-@youennf >-@annevk >-@mnot >-@yutakahirano >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/abort/destroyed-context-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/abort/destroyed-context-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..429865108099ffe521fba2c9ffb54741262befd2 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/abort/destroyed-context-expected.txt >@@ -0,0 +1,3 @@ >+ >+PASS aborting a fetch in a destroyed context should not crash >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/abort/destroyed-context.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/abort/destroyed-context.html >new file mode 100644 >index 0000000000000000000000000000000000000000..161d39bd9ce3db0e979aeb1087e7c38899669c0d >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/abort/destroyed-context.html >@@ -0,0 +1,27 @@ >+<!DOCTYPE html> >+<meta charset="utf-8"> >+<script src="/resources/testharness.js"></script> >+<script src="/resources/testharnessreport.js"></script> >+<script> >+// This is a regression test for crbug.com/860063. >+window.controller = new AbortController(); >+async_test(t => { >+ onmessage = t.step_func(event => { >+ assert_equals(event.data, 'started'); >+ const iframe = document.querySelector('iframe'); >+ document.body.removeChild(iframe); >+ controller.abort(); >+ t.done(); >+ }); >+}, 'aborting a fetch in a destroyed context should not crash'); >+</script> >+<iframe srcdoc=" >+ <!DOCTYPE html> >+ <meta charset=utf-8> >+ <script> >+ fetch('../resources/infinite-slow-response.py', { signal: parent.controller.signal }).then(() => { >+ parent.postMessage('started', '*'); >+ }); >+ </script> >+ "> >+</iframe> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/abort/general-serviceworker.https-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/abort/general-serviceworker.https-expected.txt >deleted file mode 100644 >index 9ee4d9c1b7352c0c4b1fa15db47840d7657e5deb..0000000000000000000000000000000000000000 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/abort/general-serviceworker.https-expected.txt >+++ /dev/null >@@ -1,52 +0,0 @@ >- >-Harness Error (TIMEOUT), message = null >- >-FAIL Aborting rejects with AbortError assert_unreached: Should have rejected: undefined Reached unreachable code >-FAIL Aborting rejects with AbortError - no-cors assert_throws: function "function () { throw e }" threw object "TypeError: A server with the specified hostname could not be found." that is not a DOMException AbortError: property "code" is equal to undefined, expected 20 >-PASS TypeError from request constructor takes priority - RequestInit's window is not null >-PASS TypeError from request constructor takes priority - Input URL is not valid >-PASS TypeError from request constructor takes priority - Input URL has credentials >-PASS TypeError from request constructor takes priority - RequestInit's mode is navigate >-PASS TypeError from request constructor takes priority - RequestInit's referrer is invalid >-PASS TypeError from request constructor takes priority - RequestInit's method is invalid >-PASS TypeError from request constructor takes priority - RequestInit's method is forbidden >-PASS TypeError from request constructor takes priority - RequestInit's mode is no-cors and method is not simple >-PASS TypeError from request constructor takes priority - RequestInit's cache mode is only-if-cached and mode is not same-origin >-PASS TypeError from request constructor takes priority - Request with cache mode: only-if-cached and fetch mode cors >-PASS TypeError from request constructor takes priority - Request with cache mode: only-if-cached and fetch mode no-cors >-PASS TypeError from request constructor takes priority - Bad referrerPolicy init parameter value >-PASS TypeError from request constructor takes priority - Bad mode init parameter value >-PASS TypeError from request constructor takes priority - Bad credentials init parameter value >-PASS TypeError from request constructor takes priority - Bad cache init parameter value >-PASS TypeError from request constructor takes priority - Bad redirect init parameter value >-FAIL Request objects have a signal property assert_true: Signal member is present & truthy expected true got false >-FAIL Signal on request object assert_true: Signal member is present & truthy expected true got false >-FAIL Signal on request object created from request object assert_unreached: Should have rejected: undefined Reached unreachable code >-FAIL Signal on request object created from request object, with signal on second request assert_unreached: Should have rejected: undefined Reached unreachable code >-FAIL Signal on request object created from request object, with signal on second request overriding another assert_unreached: Should have rejected: undefined Reached unreachable code >-FAIL Signal retained after unrelated properties are overridden by fetch assert_unreached: Should have rejected: undefined Reached unreachable code >-PASS Signal removed by setting to null >-FAIL Already aborted signal rejects immediately assert_unreached: Fetch must not resolve Reached unreachable code >-PASS Request is still 'used' if signal is aborted before fetching >-FAIL response.arrayBuffer() rejects if already aborted assert_unreached: Should have rejected: undefined Reached unreachable code >-FAIL response.blob() rejects if already aborted assert_unreached: Should have rejected: undefined Reached unreachable code >-FAIL response.formData() rejects if already aborted assert_throws: function "function () { throw e }" threw object "NotSupportedError: The operation is not supported." that is not a DOMException AbortError: property "code" is equal to 9, expected 20 >-FAIL response.json() rejects if already aborted assert_unreached: Should have rejected: undefined Reached unreachable code >-FAIL response.text() rejects if already aborted assert_unreached: Should have rejected: undefined Reached unreachable code >-FAIL Already aborted signal does not make request assert_equals: Request hasn't been made to the server expected (object) null but got (string) "open" >-FAIL Already aborted signal can be used for many fetches assert_unreached: Should have rejected: undefined Reached unreachable code >-FAIL Signal can be used to abort other fetches, even if another fetch succeeded before aborting assert_unreached: Should have rejected: undefined Reached unreachable code >-FAIL Underlying connection is closed when aborting after receiving response promise_test: Unhandled rejection with value: object "Error: Timed out" >-FAIL Underlying connection is closed when aborting after receiving response - no-cors promise_test: Unhandled rejection with value: object "TypeError: A server with the specified hostname could not be found." >-TIMEOUT Fetch aborted & connection closed when aborted after calling response.arrayBuffer() Test timed out >-NOTRUN Fetch aborted & connection closed when aborted after calling response.blob() >-NOTRUN Fetch aborted & connection closed when aborted after calling response.formData() >-NOTRUN Fetch aborted & connection closed when aborted after calling response.json() >-NOTRUN Fetch aborted & connection closed when aborted after calling response.text() >-NOTRUN Stream errors once aborted. Underlying connection closed. >-NOTRUN Stream errors once aborted, after reading. Underlying connection closed. >-NOTRUN Stream will not error if body is empty. It's closed with an empty queue before it errors. >-NOTRUN Readable stream synchronously cancels with AbortError if aborted before reading >-FAIL Signal state is cloned undefined is not an object (evaluating 'request.signal.aborted') >-FAIL Clone aborts with original controller undefined is not an object (evaluating 'request.signal.addEventListener') >- >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/abort/general-serviceworker.https.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/abort/general-serviceworker.https.html >deleted file mode 100644 >index 74de2874a903c11e79a459aa62fae8fba9458bae..0000000000000000000000000000000000000000 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/abort/general-serviceworker.https.html >+++ /dev/null >@@ -1,23 +0,0 @@ >-<!DOCTYPE html> >-<html> >-<head> >- <meta charset="utf-8"> >- <title>General fetch abort tests in a service worker</title> >- <script src="/resources/testharness.js"></script> >- <script src="/resources/testharnessreport.js"></script> >-</head> >-<body> >-<script> >- (async function() { >- const scope = 'does/not/exist'; >- >- let reg = await navigator.serviceWorker.getRegistration(scope); >- if (reg) await reg.unregister(); >- >- reg = await navigator.serviceWorker.register('general.any.worker.js', {scope}); >- >- fetch_tests_from_worker(reg.installing); >- })(); >-</script> >-</body> >-</html> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/abort/general-sharedworker-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/abort/general-sharedworker-expected.txt >deleted file mode 100644 >index ad1d34e83cc80c1ef9e2a1c02b128f272f471386..0000000000000000000000000000000000000000 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/abort/general-sharedworker-expected.txt >+++ /dev/null >@@ -1,4 +0,0 @@ >-CONSOLE MESSAGE: line 11: ReferenceError: Can't find variable: SharedWorker >- >-FAIL General fetch abort tests - shared worker ReferenceError: Can't find variable: SharedWorker >- >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/abort/general-sharedworker.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/abort/general-sharedworker.html >deleted file mode 100644 >index 9378e166eade195482a63af27df0f17c620008b5..0000000000000000000000000000000000000000 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/abort/general-sharedworker.html >+++ /dev/null >@@ -1,14 +0,0 @@ >-<!DOCTYPE html> >-<html> >-<head> >- <meta charset="utf-8"> >- <title>General fetch abort tests - shared worker</title> >- <script src="/resources/testharness.js"></script> >- <script src="/resources/testharnessreport.js"></script> >-</head> >-<body> >-<script> >- fetch_tests_from_worker(new SharedWorker("general.any.worker.js")); >-</script> >-</body> >-</html> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/abort/general.any.js b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/abort/general.any.js >index eb5979756fe8ad27698c1c43103652113c2fb337..2b3641b998de8f193c5b134f69f8816e3d2b5691 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/abort/general.any.js >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/abort/general.any.js >@@ -1,4 +1,5 @@ > // META: script=/common/utils.js >+// META: script=/common/get-host-info.sub.js > // META: script=../request/request-error.js > > const BODY_METHODS = ['arrayBuffer', 'blob', 'formData', 'json', 'text']; >@@ -15,6 +16,9 @@ function abortRequests() { > ); > } > >+const hostInfo = get_host_info(); >+const urlHostname = hostInfo.REMOTE_HOST; >+ > promise_test(async t => { > const controller = new AbortController(); > const signal = controller.signal; >@@ -31,7 +35,7 @@ promise_test(async t => { > controller.abort(); > > const url = new URL('../resources/data.json', location); >- url.hostname = 'www1.' + url.hostname; >+ url.hostname = urlHostname; > > const fetchPromise = fetch(url, { > signal, >@@ -314,7 +318,7 @@ promise_test(async t => { > requestAbortKeys.push(abortKey); > > const url = new URL(`../resources/infinite-slow-response.py?stateKey=${stateKey}&abortKey=${abortKey}`, location); >- url.hostname = 'www1.' + url.hostname; >+ url.hostname = urlHostname; > > await fetch(url, { > signal, >@@ -322,7 +326,7 @@ promise_test(async t => { > }); > > const stashTakeURL = new URL(`../resources/stash-take.py?key=${stateKey}`, location); >- stashTakeURL.hostname = 'www1.' + stashTakeURL.hostname; >+ stashTakeURL.hostname = urlHostname; > > const beforeAbortResult = await fetch(stashTakeURL).then(r => r.json()); > assert_equals(beforeAbortResult, "open", "Connection is open"); >@@ -440,7 +444,7 @@ promise_test(async t => { > const controller = new AbortController(); > const signal = controller.signal; > >- const response = await fetch(`../resources/empty.txt`, { signal }); >+ const response = await fetch(`../resources/method.py`, { signal }); > > // Read whole response to ensure close signal has sent. > await response.clone().text(); >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/abort/keepalive-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/abort/keepalive-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..8c891291964fc4207fbc18b8d486849e0548d425 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/abort/keepalive-expected.txt >@@ -0,0 +1,7 @@ >+ >+ >+Harness Error (TIMEOUT), message = null >+ >+TIMEOUT aborting a keepalive fetch should work Test timed out >+NOTRUN aborting a detached keepalive fetch should not do anything >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/abort/keepalive.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/abort/keepalive.html >new file mode 100644 >index 0000000000000000000000000000000000000000..db12df0d289be971cc26cd35dcbffc2f98d489e7 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/abort/keepalive.html >@@ -0,0 +1,85 @@ >+<!DOCTYPE html> >+<meta charset="utf-8"> >+<script src="/resources/testharness.js"></script> >+<script src="/resources/testharnessreport.js"></script> >+<script src="/common/utils.js"></script> >+<script> >+// This controller must be on the window so it is visible to the iframe. >+window.sharedController = new AbortController(); >+ >+async function fetchJson(url) { >+ const response = await fetch(url); >+ assert_true(response.ok, 'response should be ok'); >+ return response.json(); >+} >+ >+promise_test(async () => { >+ const stateKey = token(); >+ const controller = new AbortController(); >+ await fetch(`../resources/infinite-slow-response.py?stateKey=${stateKey}`, >+ { >+ signal: controller.signal, >+ keepalive: true >+ }); >+ const before = await fetchJson(`../resources/stash-take.py?key=${stateKey}`); >+ assert_equals(before, 'open', 'connection should be open'); >+ >+ controller.abort(); >+ >+ // Spin until the abort completes. >+ while (true) { >+ const after = await fetchJson(`../resources/stash-take.py?key=${stateKey}`); >+ if (after) { >+ // stateKey='open' was removed from the dictionary by the first fetch of >+ // stash-take.py, so we should only ever see the value 'closed' here. >+ assert_equals(after, 'closed', 'connection should have closed'); >+ break; >+ } >+ } >+}, 'aborting a keepalive fetch should work'); >+ >+promise_test(async t => { >+ const key = token(); >+ const iframeEl = document.querySelector('iframe'); >+ >+ // Tell the iframe to start the fetch, and wait until it says it has. >+ await new Promise(resolve => { >+ onmessage = t.step_func(event => { >+ assert_equals(event.data, 'started', 'event data should be "started"'); >+ resolve(); >+ }); >+ iframeEl.contentWindow.postMessage(key, '*'); >+ }); >+ >+ // Detach the context of the fetch. >+ iframeEl.remove(); >+ >+ sharedController.abort(); >+ >+ // The abort should not do anything. The connection should stay open. Wait 1 >+ // second to give time for the fetch to complete. >+ await new Promise(resolve => t.step_timeout(resolve, 1000)); >+ >+ const after = await fetchJson(`../resources/stash-take.py?key=${key}`); >+ assert_equals(after, 'on', 'fetch should have completed'); >+}, 'aborting a detached keepalive fetch should not do anything'); >+</script> >+ >+<iframe srcdoc=" >+ <!DOCTYPE html> >+ <meta charset=utf-8> >+ <script> >+ onmessage = async event => { >+ const key = event.data; >+ await fetch( >+ `../resources/redirect.py?delay=500&location=` + >+ `../resources/stash-put.py%3fkey=${key}%26value=on`, >+ { >+ signal: parent.sharedController.signal, >+ keepalive: true >+ }); >+ parent.postMessage('started', '*'); >+ }; >+ </script> >+ "> >+</iframe> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/abort/serviceworker-intercepted.https-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/abort/serviceworker-intercepted.https-expected.txt >index 114cf8a0cd9e5f313e2986a43a2a86597e1f8785..43817714bf87f077011cbd9139864fbbd4d42359 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/abort/serviceworker-intercepted.https-expected.txt >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/abort/serviceworker-intercepted.https-expected.txt >@@ -1,9 +1,9 @@ > >-FAIL Already aborted request does not land in service worker assert_unreached: Should have rejected: undefined Reached unreachable code >-FAIL response.arrayBuffer() rejects if already aborted promise_test: Unhandled rejection with value: object "Error: wait_for_state must be passed a ServiceWorker" >-FAIL response.blob() rejects if already aborted promise_test: Unhandled rejection with value: object "Error: wait_for_state must be passed a ServiceWorker" >-FAIL response.formData() rejects if already aborted promise_test: Unhandled rejection with value: object "Error: wait_for_state must be passed a ServiceWorker" >-FAIL response.json() rejects if already aborted promise_test: Unhandled rejection with value: object "Error: wait_for_state must be passed a ServiceWorker" >-FAIL response.text() rejects if already aborted promise_test: Unhandled rejection with value: object "Error: wait_for_state must be passed a ServiceWorker" >-FAIL Stream errors once aborted. promise_test: Unhandled rejection with value: object "Error: wait_for_state must be passed a ServiceWorker" >+PASS Already aborted request does not land in service worker >+PASS response.arrayBuffer() rejects if already aborted >+PASS response.blob() rejects if already aborted >+PASS response.formData() rejects if already aborted >+PASS response.json() rejects if already aborted >+PASS response.text() rejects if already aborted >+FAIL Stream errors once aborted. assert_unreached: Should have rejected: undefined Reached unreachable code > >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/abort/serviceworker-intercepted.https.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/abort/serviceworker-intercepted.https.html >index 6df6aef2cdaa1a95c40ffd1dd22dc5cd0928b44e..a88aa896c90bd30dde2800ad5fe428b2410bdec9 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/abort/serviceworker-intercepted.https.html >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/abort/serviceworker-intercepted.https.html >@@ -13,25 +13,19 @@ > const SCOPE = '../resources/basic.html'; > const BODY_METHODS = ['arrayBuffer', 'blob', 'formData', 'json', 'text']; > >- async function cleanup() { >- for (const iframe of document.querySelectorAll('.test-iframe')) { >- iframe.parentNode.removeChild(iframe); >- } >- >- const reg = await navigator.serviceWorker.getRegistration(SCOPE); >- if (reg) await reg.unregister(); >- } >- >- async function setupRegistration(t) { >- await cleanup(); >- const reg = await navigator.serviceWorker.register('../resources/sw-intercept.js', { scope: SCOPE }); >+ async function setupRegistration(t, scope) { >+ const reg = await navigator.serviceWorker.register('../resources/sw-intercept.js', { scope }); > await wait_for_state(t, reg.installing, 'activated'); >+ add_completion_callback(_ => reg.unregister()); > return reg; > } > > promise_test(async t => { >- await setupRegistration(t); >- const iframe = await with_iframe(SCOPE); >+ const suffix = "?q=aborted-not-intercepted"; >+ const scope = SCOPE + suffix; >+ await setupRegistration(t, scope); >+ const iframe = await with_iframe(scope); >+ add_completion_callback(_ => iframe.remove()); > const w = iframe.contentWindow; > > const controller = new w.AbortController(); >@@ -40,8 +34,13 @@ > > const nextData = new Promise(resolve => { > w.navigator.serviceWorker.addEventListener('message', function once(event) { >- w.navigator.serviceWorker.removeEventListener('message', once); >- resolve(event.data); >+ // The message triggered by the iframe's document's fetch >+ // request cannot get dispatched by the time we add the event >+ // listener, so we have to guard against it. >+ if (!event.data.endsWith(suffix)) { >+ w.navigator.serviceWorker.removeEventListener('message', once); >+ resolve(event.data); >+ } > }) > }); > >@@ -56,8 +55,10 @@ > > for (const bodyMethod of BODY_METHODS) { > promise_test(async t => { >- await setupRegistration(t); >- const iframe = await with_iframe(SCOPE); >+ const scope = SCOPE + "?q=aborted-" + bodyMethod + "-rejects"; >+ await setupRegistration(t, scope); >+ const iframe = await with_iframe(scope); >+ add_completion_callback(_ => iframe.remove()); > const w = iframe.contentWindow; > > const controller = new w.AbortController(); >@@ -82,8 +83,10 @@ > } > > promise_test(async t => { >- await setupRegistration(t); >- const iframe = await with_iframe(SCOPE); >+ const scope = SCOPE + "?q=aborted-stream-errors"; >+ await setupRegistration(t, scope); >+ const iframe = await with_iframe(scope); >+ add_completion_callback(_ => iframe.remove()); > const w = iframe.contentWindow; > > const controller = new w.AbortController(); >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/abort/w3c-import.log b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/abort/w3c-import.log >index 4eabdb2779d9fecd4a0997240eeb21c7e3ffebfe..6eb1f72ece54b35f0d9fae142a0a48f75d8bfd5c 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/abort/w3c-import.log >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/abort/w3c-import.log >@@ -1,7 +1,7 @@ > The tests in this directory were imported from the W3C repository. > Do NOT modify these tests directly in WebKit. > Instead, create a pull request on the WPT github: >- https://github.com/w3c/web-platform-tests >+ https://github.com/web-platform-tests/wpt > > Then run the Tools/Scripts/import-w3c-tests in WebKit to reimport > >@@ -15,7 +15,7 @@ None > ------------------------------------------------------------------------ > List of files: > /LayoutTests/imported/w3c/web-platform-tests/fetch/api/abort/cache.https.html >-/LayoutTests/imported/w3c/web-platform-tests/fetch/api/abort/general-serviceworker.https.html >-/LayoutTests/imported/w3c/web-platform-tests/fetch/api/abort/general-sharedworker.html >+/LayoutTests/imported/w3c/web-platform-tests/fetch/api/abort/destroyed-context.html > /LayoutTests/imported/w3c/web-platform-tests/fetch/api/abort/general.any.js >+/LayoutTests/imported/w3c/web-platform-tests/fetch/api/abort/keepalive.html > /LayoutTests/imported/w3c/web-platform-tests/fetch/api/abort/serviceworker-intercepted.https.html >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/header-value-combining.any-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/header-value-combining.any-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..693caab396b1dd1f65531cbc770bfa5bda3bbffe >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/header-value-combining.any-expected.txt >@@ -0,0 +1,8 @@ >+ >+PASS response.headers.get('content-length') expects 0 >+PASS response.headers.get('content-length') expects 0, 0 >+FAIL response.headers.get('double-trouble') expects , assert_equals: expected (string) ", " but got (object) null >+PASS response.headers.get('foo-test') expects 1, 2, 3 >+FAIL response.headers.get('heya') expects , , 1, , , 2 assert_equals: expected ", \v\f, 1, , , 2" but got ", , 1, , , 2" >+PASS response.headers.get('www-authenticate') expects 1, 2, 3, 4 >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/header-value-combining.any.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/header-value-combining.any.html >new file mode 100644 >index 0000000000000000000000000000000000000000..2382913528e693b3a5d56c660a45060980b548c3 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/header-value-combining.any.html >@@ -0,0 +1 @@ >+<!-- This file is required for WebKit test infrastructure to run the templated test --> >\ No newline at end of file >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/header-value-combining.any.js b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/header-value-combining.any.js >new file mode 100644 >index 0000000000000000000000000000000000000000..bb70d87d250cda383e1155be3838a7b97160b025 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/header-value-combining.any.js >@@ -0,0 +1,15 @@ >+// META: global=window,worker >+ >+[ >+ ["content-length", "0", "header-content-length"], >+ ["content-length", "0, 0", "header-content-length-twice"], >+ ["double-trouble", ", ", "headers-double-empty"], >+ ["foo-test", "1, 2, 3", "headers-basic"], >+ ["heya", ", \u000B\u000C, 1, , , 2", "headers-some-are-empty"], >+ ["www-authenticate", "1, 2, 3, 4", "headers-www-authenticate"], >+].forEach(testValues => { >+ promise_test(async t => { >+ const response = await fetch("../../../xhr/resources/" + testValues[2] + ".asis"); >+ assert_equals(response.headers.get(testValues[0]), testValues[1]); >+ }, "response.headers.get('" + testValues[0] + "') expects " + testValues[1]); >+}); >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/header-value-combining.any.worker-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/header-value-combining.any.worker-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..693caab396b1dd1f65531cbc770bfa5bda3bbffe >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/header-value-combining.any.worker-expected.txt >@@ -0,0 +1,8 @@ >+ >+PASS response.headers.get('content-length') expects 0 >+PASS response.headers.get('content-length') expects 0, 0 >+FAIL response.headers.get('double-trouble') expects , assert_equals: expected (string) ", " but got (object) null >+PASS response.headers.get('foo-test') expects 1, 2, 3 >+FAIL response.headers.get('heya') expects , , 1, , , 2 assert_equals: expected ", \v\f, 1, , , 2" but got ", , 1, , , 2" >+PASS response.headers.get('www-authenticate') expects 1, 2, 3, 4 >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/header-value-combining.any.worker.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/header-value-combining.any.worker.html >new file mode 100644 >index 0000000000000000000000000000000000000000..2382913528e693b3a5d56c660a45060980b548c3 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/header-value-combining.any.worker.html >@@ -0,0 +1 @@ >+<!-- This file is required for WebKit test infrastructure to run the templated test --> >\ No newline at end of file >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/header-value-null-byte.any-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/header-value-null-byte.any-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..7db454dac25606ccfd59099c183b91b06314d6ab >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/header-value-null-byte.any-expected.txt >@@ -0,0 +1,3 @@ >+ >+FAIL Ensure fetch() rejects null bytes in headers assert_unreached: Should have rejected: undefined Reached unreachable code >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/header-value-null-byte.any.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/header-value-null-byte.any.html >new file mode 100644 >index 0000000000000000000000000000000000000000..2382913528e693b3a5d56c660a45060980b548c3 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/header-value-null-byte.any.html >@@ -0,0 +1 @@ >+<!-- This file is required for WebKit test infrastructure to run the templated test --> >\ No newline at end of file >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/header-value-null-byte.any.js b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/header-value-null-byte.any.js >new file mode 100644 >index 0000000000000000000000000000000000000000..9c223740c7807b43a6595ba81ef4f5b3c74c60b4 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/header-value-null-byte.any.js >@@ -0,0 +1,5 @@ >+// META: global=window,worker >+ >+promise_test(t => { >+ return promise_rejects(t, new TypeError(), fetch("../../../xhr/resources/parse-headers.py?my-custom-header="+encodeURIComponent("x\0x"))); >+}, "Ensure fetch() rejects null bytes in headers"); >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/header-value-null-byte.any.worker-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/header-value-null-byte.any.worker-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..7db454dac25606ccfd59099c183b91b06314d6ab >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/header-value-null-byte.any.worker-expected.txt >@@ -0,0 +1,3 @@ >+ >+FAIL Ensure fetch() rejects null bytes in headers assert_unreached: Should have rejected: undefined Reached unreachable code >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/header-value-null-byte.any.worker.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/header-value-null-byte.any.worker.html >new file mode 100644 >index 0000000000000000000000000000000000000000..2382913528e693b3a5d56c660a45060980b548c3 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/header-value-null-byte.any.worker.html >@@ -0,0 +1 @@ >+<!-- This file is required for WebKit test infrastructure to run the templated test --> >\ No newline at end of file >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/integrity-sharedworker-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/integrity-sharedworker-expected.txt >deleted file mode 100644 >index 38e7c2084312edccb0293f7888ad1ff46925eee3..0000000000000000000000000000000000000000 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/integrity-sharedworker-expected.txt >+++ /dev/null >@@ -1,4 +0,0 @@ >-CONSOLE MESSAGE: line 12: ReferenceError: Can't find variable: SharedWorker >- >-FAIL Fetch in sharedworker: integrity handling ReferenceError: Can't find variable: SharedWorker >- >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/integrity-sharedworker.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/integrity-sharedworker.html >deleted file mode 100644 >index fa90a60ce98269606f3d2bb7bb6ae73d9828afdd..0000000000000000000000000000000000000000 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/integrity-sharedworker.html >+++ /dev/null >@@ -1,15 +0,0 @@ >-<!doctype html> >-<html> >- <head> >- <meta charset="utf-8"> >- <title>Fetch in sharedworker: integrity handling</title> >- <meta name="help" href="https://fetch.spec.whatwg.org/#main-fetch"> >- <script src="/resources/testharness.js"></script> >- <script src="/resources/testharnessreport.js"></script> >- </head> >- <body> >- <script> >- fetch_tests_from_worker(new SharedWorker("integrity.js?pipe=sub")); >- </script> >- </body> >-</html> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/integrity-worker-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/integrity-worker-expected.txt >deleted file mode 100644 >index 5c2a40034f124d368b5847fe5e0ccaa6bf334b66..0000000000000000000000000000000000000000 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/integrity-worker-expected.txt >+++ /dev/null >@@ -1,17 +0,0 @@ >- >-PASS Empty string integrity >-PASS SHA-256 integrity >-PASS SHA-384 integrity >-PASS SHA-512 integrity >-PASS Invalid integrity >-PASS Multiple integrities: valid stronger than invalid >-PASS Multiple integrities: invalid stronger than valid >-PASS Multiple integrities: invalid as strong as valid >-PASS Multiple integrities: both are valid >-PASS Multiple integrities: both are invalid >-PASS CORS empty integrity >-PASS CORS SHA-512 integrity >-PASS CORS invalid integrity >-PASS Empty string integrity for opaque response >-PASS SHA-* integrity for opaque response >- >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/integrity-worker.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/integrity-worker.html >deleted file mode 100644 >index 9240bc6325ad4ff7f717034f2c024cc751928773..0000000000000000000000000000000000000000 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/integrity-worker.html >+++ /dev/null >@@ -1,16 +0,0 @@ >-<!doctype html> >-<html> >- <head> >- <meta charset="utf-8"> >- <title>Fetch in worker: integrity handling</title> >- <meta name="author" title="Canon Research France" href="https://www.crf.canon.fr"> >- <meta name="help" href="https://fetch.spec.whatwg.org/#main-fetch"> >- <script src="/resources/testharness.js"></script> >- <script src="/resources/testharnessreport.js"></script> >- </head> >- <body> >- <script> >- fetch_tests_from_worker(new Worker("integrity.js?pipe=sub")); >- </script> >- </body> >-</html> >\ No newline at end of file >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/integrity.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/integrity.html >deleted file mode 100644 >index 150c9b71d542e84792a48f17d7314b842c6d1d4e..0000000000000000000000000000000000000000 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/integrity.html >+++ /dev/null >@@ -1,15 +0,0 @@ >-<!doctype html> >-<html> >- <head> >- <meta charset="utf-8"> >- <title>Fetch: integrity handling</title> >- <meta name="author" title="Canon Research France" href="https://www.crf.canon.fr"> >- <meta name="help" href="https://fetch.spec.whatwg.org/#main-fetch"> >- <script src="/resources/testharness.js"></script> >- <script src="/resources/testharnessreport.js"></script> >- </head> >- <body> >- <script src="../resources/utils.js"></script> >- <script src="integrity.js?pipe=sub"></script> >- </body> >-</html> >\ No newline at end of file >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/integrity.js b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/integrity.js >deleted file mode 100644 >index fb3f252ea68ef834e43f0b4951f4882b28e1afd6..0000000000000000000000000000000000000000 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/integrity.js >+++ /dev/null >@@ -1,79 +0,0 @@ >-if (this.document === undefined) { >- importScripts("/resources/testharness.js"); >- importScripts("../resources/utils.js"); >-} >- >-function integrity(desc, url, integrity, initRequestMode, shouldPass) { >- var fetchRequestInit = {'integrity': integrity} >- if (!!initRequestMode && initRequestMode !== "") { >- fetchRequestInit.mode = initRequestMode; >- } >- >- if (shouldPass) { >- promise_test(function(test) { >- return fetch(url, fetchRequestInit).then(function(resp) { >- if (initRequestMode !== "no-cors") { >- assert_equals(resp.status, 200, "Response's status is 200"); >- } else { >- assert_equals(resp.status, 0, "Opaque response's status is 0"); >- assert_equals(resp.type, "opaque"); >- } >- }); >- }, desc); >- } else { >- promise_test(function(test) { >- return promise_rejects(test, new TypeError(), fetch(url, fetchRequestInit)); >- }, desc); >- } >-} >- >-const topSha256 = "sha256-KHIDZcXnR2oBHk9DrAA+5fFiR6JjudYjqoXtMR1zvzk="; >-const topSha384 = "sha384-MgZYnnAzPM/MjhqfOIMfQK5qcFvGZsGLzx4Phd7/A8fHTqqLqXqKo8cNzY3xEPTL"; >-const topSha512 = "sha512-D6yns0qxG0E7+TwkevZ4Jt5t7Iy3ugmAajG/dlf6Pado1JqTyneKXICDiqFIkLMRExgtvg8PlxbKTkYfRejSOg=="; >-const invalidSha256 = "sha256-dKUcPOn/AlUjWIwcHeHNqYXPlvyGiq+2dWOdFcE+24I="; >-const invalidSha512 = "sha512-oUceBRNxPxnY60g/VtPCj2syT4wo4EZh2CgYdWy9veW8+OsReTXoh7dizMGZafvx9+QhMS39L/gIkxnPIn41Zg=="; >- >-const path = dirname(location.pathname) + RESOURCES_DIR + "top.txt"; >-const url = path; >-const corsUrl = >- `http://{{host}}:{{ports[http][1]}}${path}?pipe=header(Access-Control-Allow-Origin,*)`; >-const corsUrl2 = `https://{{host}}:{{ports[https][0]}}${path}` >- >-integrity("Empty string integrity", url, "", /* initRequestMode */ undefined, >- /* shouldPass */ true); >-integrity("SHA-256 integrity", url, topSha256, /* initRequestMode */ undefined, >- /* shouldPass */ true); >-integrity("SHA-384 integrity", url, topSha384, /* initRequestMode */ undefined, >- /* shouldPass */ true); >-integrity("SHA-512 integrity", url, topSha512, /* initRequestMode */ undefined, >- /* shouldPass */ true); >-integrity("Invalid integrity", url, invalidSha256, >- /* initRequestMode */ undefined, /* shouldPass */ false); >-integrity("Multiple integrities: valid stronger than invalid", url, >- invalidSha256 + " " + topSha384, /* initRequestMode */ undefined, >- /* shouldPass */ true); >-integrity("Multiple integrities: invalid stronger than valid", >- url, invalidSha512 + " " + topSha384, /* initRequestMode */ undefined, >- /* shouldPass */ false); >-integrity("Multiple integrities: invalid as strong as valid", url, >- invalidSha512 + " " + topSha512, /* initRequestMode */ undefined, >- /* shouldPass */ true); >-integrity("Multiple integrities: both are valid", url, >- topSha384 + " " + topSha512, /* initRequestMode */ undefined, >- /* shouldPass */ true); >-integrity("Multiple integrities: both are invalid", url, >- invalidSha256 + " " + invalidSha512, /* initRequestMode */ undefined, >- /* shouldPass */ false); >-integrity("CORS empty integrity", corsUrl, "", /* initRequestMode */ undefined, >- /* shouldPass */ true); >-integrity("CORS SHA-512 integrity", corsUrl, topSha512, >- /* initRequestMode */ undefined, /* shouldPass */ true); >-integrity("CORS invalid integrity", corsUrl, invalidSha512, >- /* initRequestMode */ undefined, /* shouldPass */ false); >- >-integrity("Empty string integrity for opaque response", corsUrl2, "", >- /* initRequestMode */ "no-cors", /* shouldPass */ true); >-integrity("SHA-* integrity for opaque response", corsUrl2, topSha512, >- /* initRequestMode */ "no-cors", /* shouldPass */ false); >- >-done(); >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/integrity.sub.any-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/integrity.sub.any-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..42e5fd830f4b55397995bb2a4619654af809edbc >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/integrity.sub.any-expected.txt >@@ -0,0 +1,22 @@ >+CONSOLE MESSAGE: Fetch API cannot load http://localhost:8800/fetch/api/resources/top.txt. >+CONSOLE MESSAGE: Fetch API cannot load http://localhost:8800/fetch/api/resources/top.txt. >+CONSOLE MESSAGE: Fetch API cannot load http://localhost:8800/fetch/api/resources/top.txt. >+CONSOLE MESSAGE: Fetch API cannot load http://localhost:8801/fetch/api/resources/top.txt?pipe=header(Access-Control-Allow-Origin,*). >+CONSOLE MESSAGE: Fetch API cannot load https://localhost:9443/fetch/api/resources/top.txt. >+ >+PASS Empty string integrity >+PASS SHA-256 integrity >+PASS SHA-384 integrity >+PASS SHA-512 integrity >+PASS Invalid integrity >+PASS Multiple integrities: valid stronger than invalid >+PASS Multiple integrities: invalid stronger than valid >+PASS Multiple integrities: invalid as strong as valid >+PASS Multiple integrities: both are valid >+PASS Multiple integrities: both are invalid >+PASS CORS empty integrity >+PASS CORS SHA-512 integrity >+PASS CORS invalid integrity >+PASS Empty string integrity for opaque response >+PASS SHA-* integrity for opaque response >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/integrity.sub.any.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/integrity.sub.any.html >new file mode 100644 >index 0000000000000000000000000000000000000000..2382913528e693b3a5d56c660a45060980b548c3 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/integrity.sub.any.html >@@ -0,0 +1 @@ >+<!-- This file is required for WebKit test infrastructure to run the templated test --> >\ No newline at end of file >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/integrity.sub.any.js b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/integrity.sub.any.js >new file mode 100644 >index 0000000000000000000000000000000000000000..d487c3738ac498f4b936e269c093ca2bad581cb0 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/integrity.sub.any.js >@@ -0,0 +1,77 @@ >+// META: global=sharedworker >+// META: script=../resources/utils.js >+ >+function integrity(desc, url, integrity, initRequestMode, shouldPass) { >+ var fetchRequestInit = {'integrity': integrity} >+ if (!!initRequestMode && initRequestMode !== "") { >+ fetchRequestInit.mode = initRequestMode; >+ } >+ >+ if (shouldPass) { >+ promise_test(function(test) { >+ return fetch(url, fetchRequestInit).then(function(resp) { >+ if (initRequestMode !== "no-cors") { >+ assert_equals(resp.status, 200, "Response's status is 200"); >+ } else { >+ assert_equals(resp.status, 0, "Opaque response's status is 0"); >+ assert_equals(resp.type, "opaque"); >+ } >+ }); >+ }, desc); >+ } else { >+ promise_test(function(test) { >+ return promise_rejects(test, new TypeError(), fetch(url, fetchRequestInit)); >+ }, desc); >+ } >+} >+ >+const topSha256 = "sha256-KHIDZcXnR2oBHk9DrAA+5fFiR6JjudYjqoXtMR1zvzk="; >+const topSha384 = "sha384-MgZYnnAzPM/MjhqfOIMfQK5qcFvGZsGLzx4Phd7/A8fHTqqLqXqKo8cNzY3xEPTL"; >+const topSha512 = "sha512-D6yns0qxG0E7+TwkevZ4Jt5t7Iy3ugmAajG/dlf6Pado1JqTyneKXICDiqFIkLMRExgtvg8PlxbKTkYfRejSOg=="; >+const invalidSha256 = "sha256-dKUcPOn/AlUjWIwcHeHNqYXPlvyGiq+2dWOdFcE+24I="; >+const invalidSha512 = "sha512-oUceBRNxPxnY60g/VtPCj2syT4wo4EZh2CgYdWy9veW8+OsReTXoh7dizMGZafvx9+QhMS39L/gIkxnPIn41Zg=="; >+ >+const path = dirname(location.pathname) + RESOURCES_DIR + "top.txt"; >+const url = path; >+const corsUrl = >+ `http://{{host}}:{{ports[http][1]}}${path}?pipe=header(Access-Control-Allow-Origin,*)`; >+const corsUrl2 = `https://{{host}}:{{ports[https][0]}}${path}` >+ >+integrity("Empty string integrity", url, "", /* initRequestMode */ undefined, >+ /* shouldPass */ true); >+integrity("SHA-256 integrity", url, topSha256, /* initRequestMode */ undefined, >+ /* shouldPass */ true); >+integrity("SHA-384 integrity", url, topSha384, /* initRequestMode */ undefined, >+ /* shouldPass */ true); >+integrity("SHA-512 integrity", url, topSha512, /* initRequestMode */ undefined, >+ /* shouldPass */ true); >+integrity("Invalid integrity", url, invalidSha256, >+ /* initRequestMode */ undefined, /* shouldPass */ false); >+integrity("Multiple integrities: valid stronger than invalid", url, >+ invalidSha256 + " " + topSha384, /* initRequestMode */ undefined, >+ /* shouldPass */ true); >+integrity("Multiple integrities: invalid stronger than valid", >+ url, invalidSha512 + " " + topSha384, /* initRequestMode */ undefined, >+ /* shouldPass */ false); >+integrity("Multiple integrities: invalid as strong as valid", url, >+ invalidSha512 + " " + topSha512, /* initRequestMode */ undefined, >+ /* shouldPass */ true); >+integrity("Multiple integrities: both are valid", url, >+ topSha384 + " " + topSha512, /* initRequestMode */ undefined, >+ /* shouldPass */ true); >+integrity("Multiple integrities: both are invalid", url, >+ invalidSha256 + " " + invalidSha512, /* initRequestMode */ undefined, >+ /* shouldPass */ false); >+integrity("CORS empty integrity", corsUrl, "", /* initRequestMode */ undefined, >+ /* shouldPass */ true); >+integrity("CORS SHA-512 integrity", corsUrl, topSha512, >+ /* initRequestMode */ undefined, /* shouldPass */ true); >+integrity("CORS invalid integrity", corsUrl, invalidSha512, >+ /* initRequestMode */ undefined, /* shouldPass */ false); >+ >+integrity("Empty string integrity for opaque response", corsUrl2, "", >+ /* initRequestMode */ "no-cors", /* shouldPass */ true); >+integrity("SHA-* integrity for opaque response", corsUrl2, topSha512, >+ /* initRequestMode */ "no-cors", /* shouldPass */ false); >+ >+done(); >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/integrity.sub.any.worker-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/integrity.sub.any.worker-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..5c2a40034f124d368b5847fe5e0ccaa6bf334b66 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/integrity.sub.any.worker-expected.txt >@@ -0,0 +1,17 @@ >+ >+PASS Empty string integrity >+PASS SHA-256 integrity >+PASS SHA-384 integrity >+PASS SHA-512 integrity >+PASS Invalid integrity >+PASS Multiple integrities: valid stronger than invalid >+PASS Multiple integrities: invalid stronger than valid >+PASS Multiple integrities: invalid as strong as valid >+PASS Multiple integrities: both are valid >+PASS Multiple integrities: both are invalid >+PASS CORS empty integrity >+PASS CORS SHA-512 integrity >+PASS CORS invalid integrity >+PASS Empty string integrity for opaque response >+PASS SHA-* integrity for opaque response >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/integrity.sub.any.worker.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/integrity.sub.any.worker.html >new file mode 100644 >index 0000000000000000000000000000000000000000..2382913528e693b3a5d56c660a45060980b548c3 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/integrity.sub.any.worker.html >@@ -0,0 +1 @@ >+<!-- This file is required for WebKit test infrastructure to run the templated test --> >\ No newline at end of file >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/keepalive-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/keepalive-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..d5a2db9b0125b5a001b46da46eb8eaeb115c6927 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/keepalive-expected.txt >@@ -0,0 +1,3 @@ >+ >+FAIL Fetch API: keepalive handling assert_equals: expected (string) "on" but got (object) null >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/keepalive.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/keepalive.html >new file mode 100644 >index 0000000000000000000000000000000000000000..5316410004a7880ff4d24234d4508680c29a6720 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/keepalive.html >@@ -0,0 +1,31 @@ >+<!doctype html> >+<html> >+<meta charset="utf-8"> >+<title>Fetch API: keepalive handling</title> >+<script src="/resources/testharness.js"></script> >+<script src="/resources/testharnessreport.js"></script> >+<script src="/common/get-host-info.sub.js"></script> >+<body> >+<script> >+const host_info = get_host_info(); >+promise_test(async (test) => { >+ const iframe = document.createElement('iframe'); >+ iframe.src = host_info.HTTP_REMOTE_ORIGIN + >+ '/fetch/api/resources/keepalive-iframe.html'; >+ document.body.appendChild(iframe); >+ const uuid_promise = new Promise((resolve) => { >+ window.addEventListener('message', (event) => { >+ resolve(event.data); >+ }); >+ }); >+ await (new Promise((resolve) => iframe.addEventListener('load', resolve))); >+ const uuid = await uuid_promise; >+ iframe.remove(); >+ await (new Promise((resolve) => test.step_timeout(resolve, 1000))); >+ const response = await fetch(`../resources/stash-take.py?key=${uuid}`); >+ const json = await response.json(); >+ assert_equals(json, 'on'); >+}); >+</script> >+</body> >+</html> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/mediasource.window-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/mediasource.window-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..efcb8f81c2be04e289b860fa9915ba27d94cd17c >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/mediasource.window-expected.txt >@@ -0,0 +1,3 @@ >+ >+PASS Cannot fetch blob: URL from a MediaSource >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/mediasource.window.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/mediasource.window.html >new file mode 100644 >index 0000000000000000000000000000000000000000..2382913528e693b3a5d56c660a45060980b548c3 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/mediasource.window.html >@@ -0,0 +1 @@ >+<!-- This file is required for WebKit test infrastructure to run the templated test --> >\ No newline at end of file >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/mediasource.window.js b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/mediasource.window.js >new file mode 100644 >index 0000000000000000000000000000000000000000..ff58a5295ff79db28296ec4fe41bb13b69c90c9b >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/mediasource.window.js >@@ -0,0 +1,5 @@ >+promise_test(t => { >+ const mediaSource = new MediaSource(), >+ mediaSourceURL = URL.createObjectURL(mediaSource); >+ return promise_rejects(t, new TypeError(), fetch(mediaSourceURL)); >+}, "Cannot fetch blob: URL from a MediaSource"); >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/mode-no-cors-worker-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/mode-no-cors-worker-expected.txt >deleted file mode 100644 >index 3e9fe85ab7137b9520e54bbce3736061eea8c904..0000000000000000000000000000000000000000 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/mode-no-cors-worker-expected.txt >+++ /dev/null >@@ -1,6 +0,0 @@ >- >-PASS Fetch ../resources/top.txt with no-cors mode >-PASS Fetch http://localhost:8800/fetch/api/resources/top.txt with no-cors mode >-PASS Fetch https://localhost:9443/fetch/api/resources/top.txt with no-cors mode >-PASS Fetch http://localhost:8801/fetch/api/resources/top.txt with no-cors mode >- >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/mode-no-cors-worker.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/mode-no-cors-worker.html >deleted file mode 100644 >index 87376a130f8ad76c04decdafb385e66cfcdce294..0000000000000000000000000000000000000000 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/mode-no-cors-worker.html >+++ /dev/null >@@ -1,17 +0,0 @@ >-<!doctype html> >-<html> >- <head> >- <meta charset="utf-8"> >- <title>Fetch in worker: no-cors mode and opaque filtering</title> >- <meta name="help" href="https://fetch.spec.whatwg.org/#main-fetch"> >- <meta name="help" href="https://fetch.spec.whatwg.org/#concept-filtered-response-opaque"> >- <meta name="author" title="Canon Research France" href="https://www.crf.canon.fr"> >- <script src="/resources/testharness.js"></script> >- <script src="/resources/testharnessreport.js"></script> >- </head> >- <body> >- <script> >- fetch_tests_from_worker(new Worker("mode-no-cors.js?pipe=sub")); >- </script> >- </body> >-</html> >\ No newline at end of file >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/mode-no-cors.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/mode-no-cors.html >deleted file mode 100644 >index 7aee3790933e126e8ee3667de1d351950f1dea1d..0000000000000000000000000000000000000000 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/mode-no-cors.html >+++ /dev/null >@@ -1,16 +0,0 @@ >-<!doctype html> >-<html> >- <head> >- <meta charset="utf-8"> >- <title>Fetch: no-cors mode and opaque filtering</title> >- <meta name="help" href="https://fetch.spec.whatwg.org/#main-fetch"> >- <meta name="help" href="https://fetch.spec.whatwg.org/#concept-filtered-response-opaque"> >- <meta name="author" title="Canon Research France" href="https://www.crf.canon.fr"> >- <script src="/resources/testharness.js"></script> >- <script src="/resources/testharnessreport.js"></script> >- </head> >- <body> >- <script src="../resources/utils.js"></script> >- <script src="mode-no-cors.js?pipe=sub"></script> >- </body> >-</html> >\ No newline at end of file >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/mode-no-cors.js b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/mode-no-cors.js >deleted file mode 100644 >index 53e849051efd35554477007b9596c0fa36954ea6..0000000000000000000000000000000000000000 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/mode-no-cors.js >+++ /dev/null >@@ -1,31 +0,0 @@ >-if (this.document === undefined) { >- importScripts("/resources/testharness.js"); >- importScripts("../resources/utils.js"); >-} >- >-function fetchNoCors(url, isOpaqueFiltered) { >- var urlQuery = "?pipe=header(x-is-filtered,value)" >- promise_test(function(test) { >- if (isOpaqueFiltered) >- return fetch(url + urlQuery, {"mode": "no-cors"}).then(function(resp) { >- assert_equals(resp.status, 0, "Opaque filter: status is 0"); >- assert_equals(resp.statusText, "", "Opaque filter: statusText is \"\""); >- assert_equals(resp.type , "opaque", "Opaque filter: response's type is opaque"); >- assert_equals(resp.headers.get("x-is-filtered"), null, "Header x-is-filtered is filtered"); >- }); >- else >- return fetch(url + urlQuery, {"mode": "no-cors"}).then(function(resp) { >- assert_equals(resp.status, 200, "HTTP status is 200"); >- assert_equals(resp.type , "basic", "Response's type is basic"); >- assert_equals(resp.headers.get("x-is-filtered"), "value", "Header x-is-filtered is not filtered"); >- }); >- }, "Fetch "+ url + " with no-cors mode"); >-} >- >-fetchNoCors(RESOURCES_DIR + "top.txt", false); >-fetchNoCors("http://{{host}}:{{ports[http][0]}}/fetch/api/resources/top.txt", false); >-fetchNoCors("https://{{host}}:{{ports[https][0]}}/fetch/api/resources/top.txt", true); >-fetchNoCors("http://{{host}}:{{ports[http][1]}}/fetch/api/resources/top.txt", true); >- >-done(); >- >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/mode-no-cors.sub.any-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/mode-no-cors.sub.any-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..3e9fe85ab7137b9520e54bbce3736061eea8c904 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/mode-no-cors.sub.any-expected.txt >@@ -0,0 +1,6 @@ >+ >+PASS Fetch ../resources/top.txt with no-cors mode >+PASS Fetch http://localhost:8800/fetch/api/resources/top.txt with no-cors mode >+PASS Fetch https://localhost:9443/fetch/api/resources/top.txt with no-cors mode >+PASS Fetch http://localhost:8801/fetch/api/resources/top.txt with no-cors mode >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/mode-no-cors.sub.any.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/mode-no-cors.sub.any.html >new file mode 100644 >index 0000000000000000000000000000000000000000..2382913528e693b3a5d56c660a45060980b548c3 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/mode-no-cors.sub.any.html >@@ -0,0 +1 @@ >+<!-- This file is required for WebKit test infrastructure to run the templated test --> >\ No newline at end of file >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/mode-no-cors.sub.any.js b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/mode-no-cors.sub.any.js >new file mode 100644 >index 0000000000000000000000000000000000000000..709eef5bf1dbd85600ba88ca4abb5fd1003358d4 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/mode-no-cors.sub.any.js >@@ -0,0 +1,28 @@ >+// META: script=../resources/utils.js >+ >+function fetchNoCors(url, isOpaqueFiltered) { >+ var urlQuery = "?pipe=header(x-is-filtered,value)" >+ promise_test(function(test) { >+ if (isOpaqueFiltered) >+ return fetch(url + urlQuery, {"mode": "no-cors"}).then(function(resp) { >+ assert_equals(resp.status, 0, "Opaque filter: status is 0"); >+ assert_equals(resp.statusText, "", "Opaque filter: statusText is \"\""); >+ assert_equals(resp.type , "opaque", "Opaque filter: response's type is opaque"); >+ assert_equals(resp.headers.get("x-is-filtered"), null, "Header x-is-filtered is filtered"); >+ }); >+ else >+ return fetch(url + urlQuery, {"mode": "no-cors"}).then(function(resp) { >+ assert_equals(resp.status, 200, "HTTP status is 200"); >+ assert_equals(resp.type , "basic", "Response's type is basic"); >+ assert_equals(resp.headers.get("x-is-filtered"), "value", "Header x-is-filtered is not filtered"); >+ }); >+ }, "Fetch "+ url + " with no-cors mode"); >+} >+ >+fetchNoCors(RESOURCES_DIR + "top.txt", false); >+fetchNoCors("http://{{host}}:{{ports[http][0]}}/fetch/api/resources/top.txt", false); >+fetchNoCors("https://{{host}}:{{ports[https][0]}}/fetch/api/resources/top.txt", true); >+fetchNoCors("http://{{host}}:{{ports[http][1]}}/fetch/api/resources/top.txt", true); >+ >+done(); >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/mode-no-cors.sub.any.worker-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/mode-no-cors.sub.any.worker-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..3e9fe85ab7137b9520e54bbce3736061eea8c904 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/mode-no-cors.sub.any.worker-expected.txt >@@ -0,0 +1,6 @@ >+ >+PASS Fetch ../resources/top.txt with no-cors mode >+PASS Fetch http://localhost:8800/fetch/api/resources/top.txt with no-cors mode >+PASS Fetch https://localhost:9443/fetch/api/resources/top.txt with no-cors mode >+PASS Fetch http://localhost:8801/fetch/api/resources/top.txt with no-cors mode >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/mode-no-cors.sub.any.worker.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/mode-no-cors.sub.any.worker.html >new file mode 100644 >index 0000000000000000000000000000000000000000..2382913528e693b3a5d56c660a45060980b548c3 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/mode-no-cors.sub.any.worker.html >@@ -0,0 +1 @@ >+<!-- This file is required for WebKit test infrastructure to run the templated test --> >\ No newline at end of file >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/request-headers-case.any-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/request-headers-case.any-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..dd7cc5b5c0f4171c1e2814724c465ae0a7e8f8e5 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/request-headers-case.any-expected.txt >@@ -0,0 +1,4 @@ >+ >+PASS Multiple headers with the same name, different case (THIS-is-A-test first) >+PASS Multiple headers with the same name, different case (THIS-IS-A-TEST first) >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/request-headers-case.any.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/request-headers-case.any.html >new file mode 100644 >index 0000000000000000000000000000000000000000..2382913528e693b3a5d56c660a45060980b548c3 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/request-headers-case.any.html >@@ -0,0 +1 @@ >+<!-- This file is required for WebKit test infrastructure to run the templated test --> >\ No newline at end of file >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/request-headers-case.any.js b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/request-headers-case.any.js >new file mode 100644 >index 0000000000000000000000000000000000000000..067eabb13329b1caab7f5159b29bbe8a66e0ff85 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/request-headers-case.any.js >@@ -0,0 +1,11 @@ >+promise_test(() => { >+ return fetch("/xhr/resources/echo-headers.py", {headers: [["THIS-is-A-test", 1], ["THIS-IS-A-TEST", 2]] }).then(res => res.text()).then(body => { >+ assert_regexp_match(body, /THIS-is-A-test: 1, 2/) >+ }) >+}, "Multiple headers with the same name, different case (THIS-is-A-test first)") >+ >+promise_test(() => { >+ return fetch("/xhr/resources/echo-headers.py", {headers: [["THIS-IS-A-TEST", 1], ["THIS-is-A-test", 2]] }).then(res => res.text()).then(body => { >+ assert_regexp_match(body, /THIS-IS-A-TEST: 1, 2/) >+ }) >+}, "Multiple headers with the same name, different case (THIS-IS-A-TEST first)") >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/request-headers-case.any.worker-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/request-headers-case.any.worker-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..dd7cc5b5c0f4171c1e2814724c465ae0a7e8f8e5 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/request-headers-case.any.worker-expected.txt >@@ -0,0 +1,4 @@ >+ >+PASS Multiple headers with the same name, different case (THIS-is-A-test first) >+PASS Multiple headers with the same name, different case (THIS-IS-A-TEST first) >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/request-headers-case.any.worker.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/request-headers-case.any.worker.html >new file mode 100644 >index 0000000000000000000000000000000000000000..2382913528e693b3a5d56c660a45060980b548c3 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/request-headers-case.any.worker.html >@@ -0,0 +1 @@ >+<!-- This file is required for WebKit test infrastructure to run the templated test --> >\ No newline at end of file >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/response-url-worker-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/response-url-worker-expected.txt >deleted file mode 100644 >index 0bc8609cf4b8de9b107a152b05d29906fec11388..0000000000000000000000000000000000000000 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/response-url-worker-expected.txt >+++ /dev/null >@@ -1,6 +0,0 @@ >- >-PASS Testing response url getter with http://localhost:8800/ada >-PASS Testing response url getter with http://localhost:8800/# >-PASS Testing response url getter with http://localhost:8800/#ada >-PASS Testing response url getter with http://localhost:8800#ada >- >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/response-url-worker.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/response-url-worker.html >deleted file mode 100644 >index 03374e0f63572b6cbef1f0b62f9dc3d3bc868d48..0000000000000000000000000000000000000000 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/response-url-worker.html >+++ /dev/null >@@ -1,15 +0,0 @@ >-<!doctype html> >-<html> >- <head> >- <meta charset="utf-8"> >- <title>Fetch in worker: response url getter</title> >- <meta name="help" href="https://fetch.spec.whatwg.org/#response-class"> >- <script src="/resources/testharness.js"></script> >- <script src="/resources/testharnessreport.js"></script> >- </head> >- <body> >- <script> >- fetch_tests_from_worker(new Worker("response-url.js?pipe=sub")); >- </script> >- </body> >-</html> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/response-url.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/response-url.html >deleted file mode 100644 >index dfe9d96c7a48b6a3a0413286102b2e065bdec5a4..0000000000000000000000000000000000000000 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/response-url.html >+++ /dev/null >@@ -1,13 +0,0 @@ >-<!doctype html> >-<html> >- <head> >- <meta charset="utf-8"> >- <title>Fetch: response url getter</title> >- <meta name="help" href="https://fetch.spec.whatwg.org/#response-class"> >- <script src="/resources/testharness.js"></script> >- <script src="/resources/testharnessreport.js"></script> >- </head> >- <body> >- <script src="response-url.js?pipe=sub"></script> >- </body> >-</html> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/response-url.js b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/response-url.js >deleted file mode 100644 >index 91b553aaef0987df09cbde3dab7508fa53366390..0000000000000000000000000000000000000000 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/response-url.js >+++ /dev/null >@@ -1,21 +0,0 @@ >-if (this.document === undefined) { >- importScripts("/resources/testharness.js"); >-} >- >-function checkResponseURL(fetchedURL, expectedURL) >-{ >- promise_test(function() { >- return fetch(fetchedURL).then(function(response) { >- assert_equals(response.url, expectedURL); >- }); >- }, "Testing response url getter with " +fetchedURL); >-} >- >-var baseURL = "http://{{host}}:{{ports[http][0]}}"; >-checkResponseURL(baseURL + "/ada", baseURL + "/ada"); >-checkResponseURL(baseURL + "/#", baseURL + "/"); >-checkResponseURL(baseURL + "/#ada", baseURL + "/"); >-checkResponseURL(baseURL + "#ada", baseURL + "/"); >- >-done(); >- >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/response-url.sub.any-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/response-url.sub.any-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..0bc8609cf4b8de9b107a152b05d29906fec11388 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/response-url.sub.any-expected.txt >@@ -0,0 +1,6 @@ >+ >+PASS Testing response url getter with http://localhost:8800/ada >+PASS Testing response url getter with http://localhost:8800/# >+PASS Testing response url getter with http://localhost:8800/#ada >+PASS Testing response url getter with http://localhost:8800#ada >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/response-url.sub.any.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/response-url.sub.any.html >new file mode 100644 >index 0000000000000000000000000000000000000000..2382913528e693b3a5d56c660a45060980b548c3 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/response-url.sub.any.html >@@ -0,0 +1 @@ >+<!-- This file is required for WebKit test infrastructure to run the templated test --> >\ No newline at end of file >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/response-url.sub.any.js b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/response-url.sub.any.js >new file mode 100644 >index 0000000000000000000000000000000000000000..0d123c429445f1e750db7d901fabd096ff0eb473 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/response-url.sub.any.js >@@ -0,0 +1,16 @@ >+function checkResponseURL(fetchedURL, expectedURL) >+{ >+ promise_test(function() { >+ return fetch(fetchedURL).then(function(response) { >+ assert_equals(response.url, expectedURL); >+ }); >+ }, "Testing response url getter with " +fetchedURL); >+} >+ >+var baseURL = "http://{{host}}:{{ports[http][0]}}"; >+checkResponseURL(baseURL + "/ada", baseURL + "/ada"); >+checkResponseURL(baseURL + "/#", baseURL + "/"); >+checkResponseURL(baseURL + "/#ada", baseURL + "/"); >+checkResponseURL(baseURL + "#ada", baseURL + "/"); >+ >+done(); >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/response-url.sub.any.worker-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/response-url.sub.any.worker-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..0bc8609cf4b8de9b107a152b05d29906fec11388 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/response-url.sub.any.worker-expected.txt >@@ -0,0 +1,6 @@ >+ >+PASS Testing response url getter with http://localhost:8800/ada >+PASS Testing response url getter with http://localhost:8800/# >+PASS Testing response url getter with http://localhost:8800/#ada >+PASS Testing response url getter with http://localhost:8800#ada >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/response-url.sub.any.worker.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/response-url.sub.any.worker.html >new file mode 100644 >index 0000000000000000000000000000000000000000..2382913528e693b3a5d56c660a45060980b548c3 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/response-url.sub.any.worker.html >@@ -0,0 +1 @@ >+<!-- This file is required for WebKit test infrastructure to run the templated test --> >\ No newline at end of file >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-about.any-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-about.any-expected.txt >index 9944d1bd5afb4cfab04eb7e9c20bf4af31b1f24c..9a629e4bff23d4234fe75884ccea639c26058eb6 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-about.any-expected.txt >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-about.any-expected.txt >@@ -1,8 +1,8 @@ > >-FAIL Fetching about:blank (GET) is OK promise_test: Unhandled rejection with value: object "TypeError: Cross origin requests are only supported for HTTP." >-FAIL Fetching about:blank (PUT) is OK promise_test: Unhandled rejection with value: object "TypeError: Cross origin requests are only supported for HTTP." >-FAIL Fetching about:blank (POST) is OK promise_test: Unhandled rejection with value: object "TypeError: Cross origin requests are only supported for HTTP." >-PASS Fetching about:invalid.com is KO >-PASS Fetching about:config is KO >-PASS Fetching about:unicorn is KO >+PASS Fetching about:blank with method GET is KO >+PASS Fetching about:blank with method PUT is KO >+PASS Fetching about:blank with method POST is KO >+PASS Fetching about:invalid.com with method GET is KO >+PASS Fetching about:config with method GET is KO >+PASS Fetching about:unicorn with method GET is KO > >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-about.any.js b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-about.any.js >index ee0572f361d3a8a0365cfa30eab5293bed01418a..aae7146a5a17b996e38ec08f56691a88046bba73 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-about.any.js >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-about.any.js >@@ -1,34 +1,17 @@ > // META: script=../resources/utils.js > >-function checkFetchResponse(url, method, desc) { >- if (!desc) { >- var cut = (url.length >= 40) ? "[...]" : ""; >- cut += " (" + method + ")" >- desc = "Fetching " + url.substring(0, 40) + cut + " is OK" >- } >+function checkNetworkError(url, method) { >+ method = method || "GET"; >+ const desc = "Fetching " + url.substring(0, 45) + " with method " + method + " is KO" > promise_test(function(test) { >- return fetch(url, { method: method }).then(function(resp) { >- assert_equals(resp.status, 200, "HTTP status is 200"); >- assert_equals(resp.type, "basic", "response type is basic"); >- assert_equals(resp.headers.get("Content-Type"), "text/html;charset=utf-8", "Content-Type is " + resp.headers.get("Content-Type")); >- return resp.text(); >- }) >- }, desc); >-} >- >-checkFetchResponse("about:blank", "GET"); >-checkFetchResponse("about:blank", "PUT"); >-checkFetchResponse("about:blank", "POST"); >- >-function checkKoUrl(url, desc) { >- if (!desc) >- desc = "Fetching " + url.substring(0, 45) + " is KO" >- promise_test(function(test) { >- var promise = fetch(url); >+ var promise = fetch(url, { method: method }); > return promise_rejects(test, new TypeError(), promise); > }, desc); > } > >-checkKoUrl("about:invalid.com"); >-checkKoUrl("about:config"); >-checkKoUrl("about:unicorn"); >+checkNetworkError("about:blank", "GET"); >+checkNetworkError("about:blank", "PUT"); >+checkNetworkError("about:blank", "POST"); >+checkNetworkError("about:invalid.com"); >+checkNetworkError("about:config"); >+checkNetworkError("about:unicorn"); >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-about.any.worker-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-about.any.worker-expected.txt >index 9944d1bd5afb4cfab04eb7e9c20bf4af31b1f24c..9a629e4bff23d4234fe75884ccea639c26058eb6 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-about.any.worker-expected.txt >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-about.any.worker-expected.txt >@@ -1,8 +1,8 @@ > >-FAIL Fetching about:blank (GET) is OK promise_test: Unhandled rejection with value: object "TypeError: Cross origin requests are only supported for HTTP." >-FAIL Fetching about:blank (PUT) is OK promise_test: Unhandled rejection with value: object "TypeError: Cross origin requests are only supported for HTTP." >-FAIL Fetching about:blank (POST) is OK promise_test: Unhandled rejection with value: object "TypeError: Cross origin requests are only supported for HTTP." >-PASS Fetching about:invalid.com is KO >-PASS Fetching about:config is KO >-PASS Fetching about:unicorn is KO >+PASS Fetching about:blank with method GET is KO >+PASS Fetching about:blank with method PUT is KO >+PASS Fetching about:blank with method POST is KO >+PASS Fetching about:invalid.com with method GET is KO >+PASS Fetching about:config with method GET is KO >+PASS Fetching about:unicorn with method GET is KO > >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-blob-worker-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-blob-worker-expected.txt >deleted file mode 100644 >index a769ec635083c6f1edde877105f96d2531dea688..0000000000000000000000000000000000000000 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-blob-worker-expected.txt >+++ /dev/null >@@ -1,10 +0,0 @@ >- >-PASS Fetching [GET] URL.createObjectURL(blob) is OK >-PASS Fetching [GET] blob:http://www.localhost:8800/ is KO >-PASS Fetching [POST] URL.createObjectURL(blob) is KO >-PASS Fetching [OPTIONS] URL.createObjectURL(blob) is KO >-PASS Fetching [HEAD] URL.createObjectURL(blob) is KO >-PASS Fetching [PUT] URL.createObjectURL(blob) is KO >-PASS Fetching [DELETE] URL.createObjectURL(blob) is KO >-PASS Fetching [INVALID] URL.createObjectURL(blob) is KO >- >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-blob-worker.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-blob-worker.html >deleted file mode 100644 >index 961ecbd525b23749302431d04cb79730767ca5b8..0000000000000000000000000000000000000000 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-blob-worker.html >+++ /dev/null >@@ -1,17 +0,0 @@ >-<!doctype html> >-<html> >- <head> >- <meta charset="utf-8"> >- <title>Fetch in worker: blob scheme</title> >- <meta name="help" href="https://fetch.spec.whatwg.org/#main-fetch"> >- <meta name="help" href="https://fetch.spec.whatwg.org/#basic-fetch"> >- <meta name="author" title="Canon Research France" href="https://www.crf.canon.fr"> >- <script src="/resources/testharness.js"></script> >- <script src="/resources/testharnessreport.js"></script> >- </head> >- <body> >- <script> >- fetch_tests_from_worker(new Worker("scheme-blob.js?pipe=sub")); >- </script> >- </body> >-</html> >\ No newline at end of file >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-blob.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-blob.html >deleted file mode 100644 >index 7787c3710f65e4bd41c6c929e2a2caaa4d62c1b8..0000000000000000000000000000000000000000 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-blob.html >+++ /dev/null >@@ -1,16 +0,0 @@ >-<!doctype html> >-<html> >- <head> >- <meta charset="utf-8"> >- <title>Fetch: blob scheme</title> >- <meta name="help" href="https://fetch.spec.whatwg.org/#main-fetch"> >- <meta name="help" href="https://fetch.spec.whatwg.org/#basic-fetch"> >- <meta name="author" title="Canon Research France" href="https://www.crf.canon.fr"> >- <script src="/resources/testharness.js"></script> >- <script src="/resources/testharnessreport.js"></script> >- </head> >- <body> >- <script src="../resources/utils.js"></script> >- <script src="scheme-blob.js?pipe=sub"></script> >- </body> >-</html> >\ No newline at end of file >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-blob.js b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-blob.js >deleted file mode 100644 >index 9bf73a6936517c2a4cb2423cfc8e8d2e13c04f0e..0000000000000000000000000000000000000000 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-blob.js >+++ /dev/null >@@ -1,48 +0,0 @@ >-if (this.document === undefined) { >- importScripts("/resources/testharness.js"); >- importScripts("../resources/utils.js"); >-} >- >-function checkFetchResponse(url, data, mime, size, desc) { >- promise_test(function(test) { >- size = size.toString(); >- return fetch(url).then(function(resp) { >- assert_equals(resp.status, 200, "HTTP status is 200"); >- assert_equals(resp.type, "basic", "response type is basic"); >- assert_equals(resp.headers.get("Content-Type"), mime, "Content-Type is " + resp.headers.get("Content-Type")); >- assert_equals(resp.headers.get("Content-Length"), size, "Content-Length is " + resp.headers.get("Content-Length")); >- return resp.text(); >- }).then(function(bodyAsText) { >- assert_equals(bodyAsText, data, "Response's body is " + data); >- }); >- }, desc); >-} >- >-var blob = new Blob(["Blob's data"], { "type" : "text/plain" }); >-checkFetchResponse(URL.createObjectURL(blob), "Blob's data", "text/plain", blob.size, >- "Fetching [GET] URL.createObjectURL(blob) is OK"); >- >-function checkKoUrl(url, method, desc) { >- promise_test(function(test) { >- var promise = fetch(url, {"method": method}); >- return promise_rejects(test, new TypeError(), promise); >- }, desc); >-} >- >-var blob2 = new Blob(["Blob's data"], { "type" : "text/plain" }); >-checkKoUrl("blob:http://{{domains[www]}}:{{ports[http][0]}}/", "GET", >- "Fetching [GET] blob:http://{{domains[www]}}:{{ports[http][0]}}/ is KO"); >- >-var invalidRequestMethods = [ >- "POST", >- "OPTIONS", >- "HEAD", >- "PUT", >- "DELETE", >- "INVALID", >-]; >-invalidRequestMethods.forEach(function(method) { >- checkKoUrl(URL.createObjectURL(blob2), method, "Fetching [" + method + "] URL.createObjectURL(blob) is KO"); >-}); >- >-done(); >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-blob.sub.any-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-blob.sub.any-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..eb2d69b3c390e178c24ce32ba6296026c4f2f048 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-blob.sub.any-expected.txt >@@ -0,0 +1,12 @@ >+CONSOLE MESSAGE: line 24: Cross origin requests are only supported for HTTP. >+CONSOLE MESSAGE: line 24: Fetch API cannot load blob:http://www.localhost:8800/ due to access control checks. >+ >+PASS Fetching [GET] URL.createObjectURL(blob) is OK >+PASS Fetching [GET] blob:http://www.localhost:8800/ is KO >+PASS Fetching [POST] URL.createObjectURL(blob) is KO >+PASS Fetching [OPTIONS] URL.createObjectURL(blob) is KO >+PASS Fetching [HEAD] URL.createObjectURL(blob) is KO >+PASS Fetching [PUT] URL.createObjectURL(blob) is KO >+PASS Fetching [DELETE] URL.createObjectURL(blob) is KO >+PASS Fetching [INVALID] URL.createObjectURL(blob) is KO >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-blob.sub.any.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-blob.sub.any.html >new file mode 100644 >index 0000000000000000000000000000000000000000..2382913528e693b3a5d56c660a45060980b548c3 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-blob.sub.any.html >@@ -0,0 +1 @@ >+<!-- This file is required for WebKit test infrastructure to run the templated test --> >\ No newline at end of file >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-blob.sub.any.js b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-blob.sub.any.js >new file mode 100644 >index 0000000000000000000000000000000000000000..fb1357eaf294b8973f44af30c2fafc40100d8eaf >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-blob.sub.any.js >@@ -0,0 +1,45 @@ >+// META: script=../resources/utils.js >+ >+function checkFetchResponse(url, data, mime, size, desc) { >+ promise_test(function(test) { >+ size = size.toString(); >+ return fetch(url).then(function(resp) { >+ assert_equals(resp.status, 200, "HTTP status is 200"); >+ assert_equals(resp.type, "basic", "response type is basic"); >+ assert_equals(resp.headers.get("Content-Type"), mime, "Content-Type is " + resp.headers.get("Content-Type")); >+ assert_equals(resp.headers.get("Content-Length"), size, "Content-Length is " + resp.headers.get("Content-Length")); >+ return resp.text(); >+ }).then(function(bodyAsText) { >+ assert_equals(bodyAsText, data, "Response's body is " + data); >+ }); >+ }, desc); >+} >+ >+var blob = new Blob(["Blob's data"], { "type" : "text/plain" }); >+checkFetchResponse(URL.createObjectURL(blob), "Blob's data", "text/plain", blob.size, >+ "Fetching [GET] URL.createObjectURL(blob) is OK"); >+ >+function checkKoUrl(url, method, desc) { >+ promise_test(function(test) { >+ var promise = fetch(url, {"method": method}); >+ return promise_rejects(test, new TypeError(), promise); >+ }, desc); >+} >+ >+var blob2 = new Blob(["Blob's data"], { "type" : "text/plain" }); >+checkKoUrl("blob:http://{{domains[www]}}:{{ports[http][0]}}/", "GET", >+ "Fetching [GET] blob:http://{{domains[www]}}:{{ports[http][0]}}/ is KO"); >+ >+var invalidRequestMethods = [ >+ "POST", >+ "OPTIONS", >+ "HEAD", >+ "PUT", >+ "DELETE", >+ "INVALID", >+]; >+invalidRequestMethods.forEach(function(method) { >+ checkKoUrl(URL.createObjectURL(blob2), method, "Fetching [" + method + "] URL.createObjectURL(blob) is KO"); >+}); >+ >+done(); >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-blob.sub.any.worker-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-blob.sub.any.worker-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..a769ec635083c6f1edde877105f96d2531dea688 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-blob.sub.any.worker-expected.txt >@@ -0,0 +1,10 @@ >+ >+PASS Fetching [GET] URL.createObjectURL(blob) is OK >+PASS Fetching [GET] blob:http://www.localhost:8800/ is KO >+PASS Fetching [POST] URL.createObjectURL(blob) is KO >+PASS Fetching [OPTIONS] URL.createObjectURL(blob) is KO >+PASS Fetching [HEAD] URL.createObjectURL(blob) is KO >+PASS Fetching [PUT] URL.createObjectURL(blob) is KO >+PASS Fetching [DELETE] URL.createObjectURL(blob) is KO >+PASS Fetching [INVALID] URL.createObjectURL(blob) is KO >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-blob.sub.any.worker.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-blob.sub.any.worker.html >new file mode 100644 >index 0000000000000000000000000000000000000000..2382913528e693b3a5d56c660a45060980b548c3 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-blob.sub.any.worker.html >@@ -0,0 +1 @@ >+<!-- This file is required for WebKit test infrastructure to run the templated test --> >\ No newline at end of file >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-others-worker-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-others-worker-expected.txt >deleted file mode 100644 >index c1b695a5a6b5e844f4de37d7531ed6baaff6772b..0000000000000000000000000000000000000000 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-others-worker-expected.txt >+++ /dev/null >@@ -1,18 +0,0 @@ >- >-PASS Fetching aaa://localhost:8800/ is KO >-PASS Fetching cap://localhost:8800/ is KO >-PASS Fetching cid://localhost:8800/ is KO >-PASS Fetching dav://localhost:8800/ is KO >-PASS Fetching dict://localhost:8800/ is KO >-PASS Fetching dns://localhost:8800/ is KO >-PASS Fetching geo://localhost:8800/ is KO >-PASS Fetching im://localhost:8800/ is KO >-PASS Fetching imap://localhost:8800/ is KO >-PASS Fetching ipp://localhost:8800/ is KO >-PASS Fetching ldap://localhost:8800/ is KO >-PASS Fetching mailto://localhost:8800/ is KO >-PASS Fetching nfs://localhost:8800/ is KO >-PASS Fetching pop://localhost:8800/ is KO >-PASS Fetching rtsp://localhost:8800/ is KO >-PASS Fetching snmp://localhost:8800/ is KO >- >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-others-worker.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-others-worker.html >deleted file mode 100644 >index 397d9257b1b131073bcc8ab62b41e58da9039181..0000000000000000000000000000000000000000 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-others-worker.html >+++ /dev/null >@@ -1,17 +0,0 @@ >-<!doctype html> >-<html> >- <head> >- <meta charset="utf-8"> >- <title>Fetch in worker: urls with unsupported schemes</title> >- <meta name="help" href="https://fetch.spec.whatwg.org/#main-fetch"> >- <meta name="help" href="https://fetch.spec.whatwg.org/#basic-fetch"> >- <meta name="author" title="Canon Research France" href="https://www.crf.canon.fr"> >- <script src="/resources/testharness.js"></script> >- <script src="/resources/testharnessreport.js"></script> >- </head> >- <body> >- <script> >- fetch_tests_from_worker(new Worker("scheme-others.js?pipe=sub")); >- </script> >- </body> >-</html> >\ No newline at end of file >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-others.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-others.html >deleted file mode 100644 >index dd37143b0f136e7fe9546671915d6af8f941bd90..0000000000000000000000000000000000000000 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-others.html >+++ /dev/null >@@ -1,16 +0,0 @@ >-<!doctype html> >-<html> >- <head> >- <meta charset="utf-8"> >- <title>Fetch: urls with unsupported schemes</title> >- <meta name="help" href="https://fetch.spec.whatwg.org/#main-fetch"> >- <meta name="help" href="https://fetch.spec.whatwg.org/#basic-fetch"> >- <meta name="author" title="Canon Research France" href="https://www.crf.canon.fr"> >- <script src="/resources/testharness.js"></script> >- <script src="/resources/testharnessreport.js"></script> >- </head> >- <body> >- <script src="../resources/utils.js"></script> >- <script src="scheme-others.js?pipe=sub"></script> >- </body> >-</html> >\ No newline at end of file >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-others.js b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-others.js >deleted file mode 100644 >index ce02ec1340a4c57a6e34fffe8f2c5917818a13c9..0000000000000000000000000000000000000000 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-others.js >+++ /dev/null >@@ -1,33 +0,0 @@ >-if (this.document === undefined) { >- importScripts("/resources/testharness.js"); >- importScripts("../resources/utils.js"); >-} >- >-function checkKoUrl(url, desc) { >- if (!desc) >- desc = "Fetching " + url.substring(0, 45) + " is KO" >- promise_test(function(test) { >- var promise = fetch(url); >- return promise_rejects(test, new TypeError(), promise); >- }, desc); >-} >- >-var urlWithoutScheme = "://{{host}}:{{ports[http][0]}}/"; >-checkKoUrl("aaa" + urlWithoutScheme); >-checkKoUrl("cap" + urlWithoutScheme); >-checkKoUrl("cid" + urlWithoutScheme); >-checkKoUrl("dav" + urlWithoutScheme); >-checkKoUrl("dict" + urlWithoutScheme); >-checkKoUrl("dns" + urlWithoutScheme); >-checkKoUrl("geo" + urlWithoutScheme); >-checkKoUrl("im" + urlWithoutScheme); >-checkKoUrl("imap" + urlWithoutScheme); >-checkKoUrl("ipp" + urlWithoutScheme); >-checkKoUrl("ldap" + urlWithoutScheme); >-checkKoUrl("mailto" + urlWithoutScheme); >-checkKoUrl("nfs" + urlWithoutScheme); >-checkKoUrl("pop" + urlWithoutScheme); >-checkKoUrl("rtsp" + urlWithoutScheme); >-checkKoUrl("snmp" + urlWithoutScheme); >- >-done(); >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-others.sub.any-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-others.sub.any-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..655bc9818c32623fd35660528e84cbfb037f7fa5 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-others.sub.any-expected.txt >@@ -0,0 +1,50 @@ >+CONSOLE MESSAGE: line 7: Cross origin requests are only supported for HTTP. >+CONSOLE MESSAGE: line 7: Fetch API cannot load aaa://localhost:8800/ due to access control checks. >+CONSOLE MESSAGE: line 7: Cross origin requests are only supported for HTTP. >+CONSOLE MESSAGE: line 7: Fetch API cannot load cap://localhost:8800/ due to access control checks. >+CONSOLE MESSAGE: line 7: Cross origin requests are only supported for HTTP. >+CONSOLE MESSAGE: line 7: Fetch API cannot load cid://localhost:8800/ due to access control checks. >+CONSOLE MESSAGE: line 7: Cross origin requests are only supported for HTTP. >+CONSOLE MESSAGE: line 7: Fetch API cannot load dav://localhost:8800/ due to access control checks. >+CONSOLE MESSAGE: line 7: Cross origin requests are only supported for HTTP. >+CONSOLE MESSAGE: line 7: Fetch API cannot load dict://localhost:8800/ due to access control checks. >+CONSOLE MESSAGE: line 7: Cross origin requests are only supported for HTTP. >+CONSOLE MESSAGE: line 7: Fetch API cannot load dns://localhost:8800/ due to access control checks. >+CONSOLE MESSAGE: line 7: Cross origin requests are only supported for HTTP. >+CONSOLE MESSAGE: line 7: Fetch API cannot load geo://localhost:8800/ due to access control checks. >+CONSOLE MESSAGE: line 7: Cross origin requests are only supported for HTTP. >+CONSOLE MESSAGE: line 7: Fetch API cannot load im://localhost:8800/ due to access control checks. >+CONSOLE MESSAGE: line 7: Cross origin requests are only supported for HTTP. >+CONSOLE MESSAGE: line 7: Fetch API cannot load imap://localhost:8800/ due to access control checks. >+CONSOLE MESSAGE: line 7: Cross origin requests are only supported for HTTP. >+CONSOLE MESSAGE: line 7: Fetch API cannot load ipp://localhost:8800/ due to access control checks. >+CONSOLE MESSAGE: line 7: Cross origin requests are only supported for HTTP. >+CONSOLE MESSAGE: line 7: Fetch API cannot load ldap://localhost:8800/ due to access control checks. >+CONSOLE MESSAGE: line 7: Cross origin requests are only supported for HTTP. >+CONSOLE MESSAGE: line 7: Fetch API cannot load mailto://localhost:8800/ due to access control checks. >+CONSOLE MESSAGE: line 7: Cross origin requests are only supported for HTTP. >+CONSOLE MESSAGE: line 7: Fetch API cannot load nfs://localhost:8800/ due to access control checks. >+CONSOLE MESSAGE: line 7: Cross origin requests are only supported for HTTP. >+CONSOLE MESSAGE: line 7: Fetch API cannot load pop://localhost:8800/ due to access control checks. >+CONSOLE MESSAGE: line 7: Cross origin requests are only supported for HTTP. >+CONSOLE MESSAGE: line 7: Fetch API cannot load rtsp://localhost:8800/ due to access control checks. >+CONSOLE MESSAGE: line 7: Cross origin requests are only supported for HTTP. >+CONSOLE MESSAGE: line 7: Fetch API cannot load snmp://localhost:8800/ due to access control checks. >+ >+PASS Fetching aaa://localhost:8800/ is KO >+PASS Fetching cap://localhost:8800/ is KO >+PASS Fetching cid://localhost:8800/ is KO >+PASS Fetching dav://localhost:8800/ is KO >+PASS Fetching dict://localhost:8800/ is KO >+PASS Fetching dns://localhost:8800/ is KO >+PASS Fetching geo://localhost:8800/ is KO >+PASS Fetching im://localhost:8800/ is KO >+PASS Fetching imap://localhost:8800/ is KO >+PASS Fetching ipp://localhost:8800/ is KO >+PASS Fetching ldap://localhost:8800/ is KO >+PASS Fetching mailto://localhost:8800/ is KO >+PASS Fetching nfs://localhost:8800/ is KO >+PASS Fetching pop://localhost:8800/ is KO >+PASS Fetching rtsp://localhost:8800/ is KO >+PASS Fetching snmp://localhost:8800/ is KO >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-others.sub.any.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-others.sub.any.html >new file mode 100644 >index 0000000000000000000000000000000000000000..2382913528e693b3a5d56c660a45060980b548c3 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-others.sub.any.html >@@ -0,0 +1 @@ >+<!-- This file is required for WebKit test infrastructure to run the templated test --> >\ No newline at end of file >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-others.sub.any.js b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-others.sub.any.js >new file mode 100644 >index 0000000000000000000000000000000000000000..5f9848ff4c297d662a82aa9e847f548371c33d19 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-others.sub.any.js >@@ -0,0 +1,30 @@ >+// META: script=../resources/utils.js >+ >+function checkKoUrl(url, desc) { >+ if (!desc) >+ desc = "Fetching " + url.substring(0, 45) + " is KO" >+ promise_test(function(test) { >+ var promise = fetch(url); >+ return promise_rejects(test, new TypeError(), promise); >+ }, desc); >+} >+ >+var urlWithoutScheme = "://{{host}}:{{ports[http][0]}}/"; >+checkKoUrl("aaa" + urlWithoutScheme); >+checkKoUrl("cap" + urlWithoutScheme); >+checkKoUrl("cid" + urlWithoutScheme); >+checkKoUrl("dav" + urlWithoutScheme); >+checkKoUrl("dict" + urlWithoutScheme); >+checkKoUrl("dns" + urlWithoutScheme); >+checkKoUrl("geo" + urlWithoutScheme); >+checkKoUrl("im" + urlWithoutScheme); >+checkKoUrl("imap" + urlWithoutScheme); >+checkKoUrl("ipp" + urlWithoutScheme); >+checkKoUrl("ldap" + urlWithoutScheme); >+checkKoUrl("mailto" + urlWithoutScheme); >+checkKoUrl("nfs" + urlWithoutScheme); >+checkKoUrl("pop" + urlWithoutScheme); >+checkKoUrl("rtsp" + urlWithoutScheme); >+checkKoUrl("snmp" + urlWithoutScheme); >+ >+done(); >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-others.sub.any.worker-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-others.sub.any.worker-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..c1b695a5a6b5e844f4de37d7531ed6baaff6772b >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-others.sub.any.worker-expected.txt >@@ -0,0 +1,18 @@ >+ >+PASS Fetching aaa://localhost:8800/ is KO >+PASS Fetching cap://localhost:8800/ is KO >+PASS Fetching cid://localhost:8800/ is KO >+PASS Fetching dav://localhost:8800/ is KO >+PASS Fetching dict://localhost:8800/ is KO >+PASS Fetching dns://localhost:8800/ is KO >+PASS Fetching geo://localhost:8800/ is KO >+PASS Fetching im://localhost:8800/ is KO >+PASS Fetching imap://localhost:8800/ is KO >+PASS Fetching ipp://localhost:8800/ is KO >+PASS Fetching ldap://localhost:8800/ is KO >+PASS Fetching mailto://localhost:8800/ is KO >+PASS Fetching nfs://localhost:8800/ is KO >+PASS Fetching pop://localhost:8800/ is KO >+PASS Fetching rtsp://localhost:8800/ is KO >+PASS Fetching snmp://localhost:8800/ is KO >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-others.sub.any.worker.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-others.sub.any.worker.html >new file mode 100644 >index 0000000000000000000000000000000000000000..2382913528e693b3a5d56c660a45060980b548c3 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-others.sub.any.worker.html >@@ -0,0 +1 @@ >+<!-- This file is required for WebKit test infrastructure to run the templated test --> >\ No newline at end of file >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/stream-safe-creation.any-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/stream-safe-creation.any-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..39ce7dad7a8ab3ec068eadd3eaa04ec36271d992 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/stream-safe-creation.any-expected.txt >@@ -0,0 +1,65 @@ >+ >+PASS throwing Object.prototype.start accessor should not affect stream creation by 'fetch' >+PASS Object.prototype.start accessor returning invalid value should not affect stream creation by 'fetch' >+PASS throwing Object.prototype.type accessor should not affect stream creation by 'fetch' >+PASS Object.prototype.type accessor returning invalid value should not affect stream creation by 'fetch' >+PASS throwing Object.prototype.size accessor should not affect stream creation by 'fetch' >+PASS Object.prototype.size accessor returning invalid value should not affect stream creation by 'fetch' >+PASS throwing Object.prototype.highWaterMark accessor should not affect stream creation by 'fetch' >+PASS Object.prototype.highWaterMark accessor returning invalid value should not affect stream creation by 'fetch' >+PASS Object.prototype.start function which errors the stream should not affect stream creation by 'fetch' >+PASS throwing Object.prototype.start accessor should not affect stream creation by 'request' >+PASS Object.prototype.start accessor returning invalid value should not affect stream creation by 'request' >+PASS throwing Object.prototype.type accessor should not affect stream creation by 'request' >+PASS Object.prototype.type accessor returning invalid value should not affect stream creation by 'request' >+PASS throwing Object.prototype.size accessor should not affect stream creation by 'request' >+PASS Object.prototype.size accessor returning invalid value should not affect stream creation by 'request' >+PASS throwing Object.prototype.highWaterMark accessor should not affect stream creation by 'request' >+PASS Object.prototype.highWaterMark accessor returning invalid value should not affect stream creation by 'request' >+PASS Object.prototype.start function which errors the stream should not affect stream creation by 'request' >+PASS throwing Object.prototype.start accessor should not affect stream creation by 'response' >+PASS Object.prototype.start accessor returning invalid value should not affect stream creation by 'response' >+PASS throwing Object.prototype.type accessor should not affect stream creation by 'response' >+PASS Object.prototype.type accessor returning invalid value should not affect stream creation by 'response' >+PASS throwing Object.prototype.size accessor should not affect stream creation by 'response' >+PASS Object.prototype.size accessor returning invalid value should not affect stream creation by 'response' >+PASS throwing Object.prototype.highWaterMark accessor should not affect stream creation by 'response' >+PASS Object.prototype.highWaterMark accessor returning invalid value should not affect stream creation by 'response' >+PASS Object.prototype.start function which errors the stream should not affect stream creation by 'response' >+PASS throwing Object.prototype.start accessor should not affect stream creation by 'consumeEmptyResponse' >+PASS Object.prototype.start accessor returning invalid value should not affect stream creation by 'consumeEmptyResponse' >+PASS throwing Object.prototype.type accessor should not affect stream creation by 'consumeEmptyResponse' >+PASS Object.prototype.type accessor returning invalid value should not affect stream creation by 'consumeEmptyResponse' >+PASS throwing Object.prototype.size accessor should not affect stream creation by 'consumeEmptyResponse' >+PASS Object.prototype.size accessor returning invalid value should not affect stream creation by 'consumeEmptyResponse' >+PASS throwing Object.prototype.highWaterMark accessor should not affect stream creation by 'consumeEmptyResponse' >+PASS Object.prototype.highWaterMark accessor returning invalid value should not affect stream creation by 'consumeEmptyResponse' >+PASS Object.prototype.start function which errors the stream should not affect stream creation by 'consumeEmptyResponse' >+PASS throwing Object.prototype.start accessor should not affect stream creation by 'consumeNonEmptyResponse' >+PASS Object.prototype.start accessor returning invalid value should not affect stream creation by 'consumeNonEmptyResponse' >+PASS throwing Object.prototype.type accessor should not affect stream creation by 'consumeNonEmptyResponse' >+PASS Object.prototype.type accessor returning invalid value should not affect stream creation by 'consumeNonEmptyResponse' >+PASS throwing Object.prototype.size accessor should not affect stream creation by 'consumeNonEmptyResponse' >+PASS Object.prototype.size accessor returning invalid value should not affect stream creation by 'consumeNonEmptyResponse' >+PASS throwing Object.prototype.highWaterMark accessor should not affect stream creation by 'consumeNonEmptyResponse' >+PASS Object.prototype.highWaterMark accessor returning invalid value should not affect stream creation by 'consumeNonEmptyResponse' >+PASS Object.prototype.start function which errors the stream should not affect stream creation by 'consumeNonEmptyResponse' >+PASS throwing Object.prototype.start accessor should not affect stream creation by 'consumeEmptyRequest' >+PASS Object.prototype.start accessor returning invalid value should not affect stream creation by 'consumeEmptyRequest' >+PASS throwing Object.prototype.type accessor should not affect stream creation by 'consumeEmptyRequest' >+PASS Object.prototype.type accessor returning invalid value should not affect stream creation by 'consumeEmptyRequest' >+PASS throwing Object.prototype.size accessor should not affect stream creation by 'consumeEmptyRequest' >+PASS Object.prototype.size accessor returning invalid value should not affect stream creation by 'consumeEmptyRequest' >+PASS throwing Object.prototype.highWaterMark accessor should not affect stream creation by 'consumeEmptyRequest' >+PASS Object.prototype.highWaterMark accessor returning invalid value should not affect stream creation by 'consumeEmptyRequest' >+PASS Object.prototype.start function which errors the stream should not affect stream creation by 'consumeEmptyRequest' >+PASS throwing Object.prototype.start accessor should not affect stream creation by 'consumeNonEmptyRequest' >+PASS Object.prototype.start accessor returning invalid value should not affect stream creation by 'consumeNonEmptyRequest' >+PASS throwing Object.prototype.type accessor should not affect stream creation by 'consumeNonEmptyRequest' >+PASS Object.prototype.type accessor returning invalid value should not affect stream creation by 'consumeNonEmptyRequest' >+PASS throwing Object.prototype.size accessor should not affect stream creation by 'consumeNonEmptyRequest' >+PASS Object.prototype.size accessor returning invalid value should not affect stream creation by 'consumeNonEmptyRequest' >+PASS throwing Object.prototype.highWaterMark accessor should not affect stream creation by 'consumeNonEmptyRequest' >+PASS Object.prototype.highWaterMark accessor returning invalid value should not affect stream creation by 'consumeNonEmptyRequest' >+PASS Object.prototype.start function which errors the stream should not affect stream creation by 'consumeNonEmptyRequest' >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/stream-safe-creation.any.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/stream-safe-creation.any.html >new file mode 100644 >index 0000000000000000000000000000000000000000..2382913528e693b3a5d56c660a45060980b548c3 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/stream-safe-creation.any.html >@@ -0,0 +1 @@ >+<!-- This file is required for WebKit test infrastructure to run the templated test --> >\ No newline at end of file >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/stream-safe-creation.any.js b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/stream-safe-creation.any.js >new file mode 100644 >index 0000000000000000000000000000000000000000..180d338659021fed3d29e08ccea415cc5852fed2 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/stream-safe-creation.any.js >@@ -0,0 +1,54 @@ >+// META: global=worker >+ >+// These tests verify that stream creation is not affected by changes to >+// Object.prototype. >+ >+const creationCases = { >+ fetch: async () => fetch(location.href), >+ request: () => new Request(location.href, {method: 'POST', body: 'hi'}), >+ response: () => new Response('bye'), >+ consumeEmptyResponse: () => new Response().text(), >+ consumeNonEmptyResponse: () => new Response(new Uint8Array([64])).text(), >+ consumeEmptyRequest: () => new Request(location.href).text(), >+ consumeNonEmptyRequest: () => new Request(location.href, >+ {method: 'POST', body: 'yes'}).arrayBuffer(), >+}; >+ >+for (creationCase of Object.keys(creationCases)) { >+ for (accessorName of ['start', 'type', 'size', 'highWaterMark']) { >+ promise_test(async t => { >+ Object.defineProperty(Object.prototype, accessorName, { >+ get() { throw Error(`Object.prototype.${accessorName} was accessed`); }, >+ configurable: true >+ }); >+ t.add_cleanup(() => { >+ delete Object.prototype[accessorName]; >+ return Promise.resolve(); >+ }); >+ await creationCases[creationCase](); >+ }, `throwing Object.prototype.${accessorName} accessor should not affect ` + >+ `stream creation by '${creationCase}'`); >+ >+ promise_test(async t => { >+ // -1 is a convenient value which is invalid, and should cause the >+ // constructor to throw, for all four fields. >+ Object.prototype[accessorName] = -1; >+ t.add_cleanup(() => { >+ delete Object.prototype[accessorName]; >+ return Promise.resolve(); >+ }); >+ await creationCases[creationCase](); >+ }, `Object.prototype.${accessorName} accessor returning invalid value ` + >+ `should not affect stream creation by '${creationCase}'`); >+ } >+ >+ promise_test(async t => { >+ Object.prototype.start = controller => controller.error(new Error('start')); >+ t.add_cleanup(() => { >+ delete Object.prototype.start; >+ return Promise.resolve(); >+ }); >+ await creationCases[creationCase](); >+ }, `Object.prototype.start function which errors the stream should not ` + >+ `affect stream creation by '${creationCase}'`); >+} >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/stream-safe-creation.any.worker-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/stream-safe-creation.any.worker-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..1011f47cbee8eb4d44d6948d594f1c177926cec4 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/stream-safe-creation.any.worker-expected.txt >@@ -0,0 +1,67 @@ >+ >+Harness Error (TIMEOUT), message = null >+ >+PASS throwing Object.prototype.start accessor should not affect stream creation by 'fetch' >+PASS Object.prototype.start accessor returning invalid value should not affect stream creation by 'fetch' >+PASS throwing Object.prototype.type accessor should not affect stream creation by 'fetch' >+PASS Object.prototype.type accessor returning invalid value should not affect stream creation by 'fetch' >+PASS throwing Object.prototype.size accessor should not affect stream creation by 'fetch' >+PASS Object.prototype.size accessor returning invalid value should not affect stream creation by 'fetch' >+PASS throwing Object.prototype.highWaterMark accessor should not affect stream creation by 'fetch' >+PASS Object.prototype.highWaterMark accessor returning invalid value should not affect stream creation by 'fetch' >+PASS Object.prototype.start function which errors the stream should not affect stream creation by 'fetch' >+PASS throwing Object.prototype.start accessor should not affect stream creation by 'request' >+PASS Object.prototype.start accessor returning invalid value should not affect stream creation by 'request' >+PASS throwing Object.prototype.type accessor should not affect stream creation by 'request' >+PASS Object.prototype.type accessor returning invalid value should not affect stream creation by 'request' >+PASS throwing Object.prototype.size accessor should not affect stream creation by 'request' >+PASS Object.prototype.size accessor returning invalid value should not affect stream creation by 'request' >+PASS throwing Object.prototype.highWaterMark accessor should not affect stream creation by 'request' >+PASS Object.prototype.highWaterMark accessor returning invalid value should not affect stream creation by 'request' >+PASS Object.prototype.start function which errors the stream should not affect stream creation by 'request' >+PASS throwing Object.prototype.start accessor should not affect stream creation by 'response' >+PASS Object.prototype.start accessor returning invalid value should not affect stream creation by 'response' >+PASS throwing Object.prototype.type accessor should not affect stream creation by 'response' >+PASS Object.prototype.type accessor returning invalid value should not affect stream creation by 'response' >+PASS throwing Object.prototype.size accessor should not affect stream creation by 'response' >+PASS Object.prototype.size accessor returning invalid value should not affect stream creation by 'response' >+PASS throwing Object.prototype.highWaterMark accessor should not affect stream creation by 'response' >+PASS Object.prototype.highWaterMark accessor returning invalid value should not affect stream creation by 'response' >+PASS Object.prototype.start function which errors the stream should not affect stream creation by 'response' >+PASS throwing Object.prototype.start accessor should not affect stream creation by 'consumeEmptyResponse' >+PASS Object.prototype.start accessor returning invalid value should not affect stream creation by 'consumeEmptyResponse' >+PASS throwing Object.prototype.type accessor should not affect stream creation by 'consumeEmptyResponse' >+PASS Object.prototype.type accessor returning invalid value should not affect stream creation by 'consumeEmptyResponse' >+PASS throwing Object.prototype.size accessor should not affect stream creation by 'consumeEmptyResponse' >+PASS Object.prototype.size accessor returning invalid value should not affect stream creation by 'consumeEmptyResponse' >+PASS throwing Object.prototype.highWaterMark accessor should not affect stream creation by 'consumeEmptyResponse' >+PASS Object.prototype.highWaterMark accessor returning invalid value should not affect stream creation by 'consumeEmptyResponse' >+PASS Object.prototype.start function which errors the stream should not affect stream creation by 'consumeEmptyResponse' >+PASS throwing Object.prototype.start accessor should not affect stream creation by 'consumeNonEmptyResponse' >+PASS Object.prototype.start accessor returning invalid value should not affect stream creation by 'consumeNonEmptyResponse' >+PASS throwing Object.prototype.type accessor should not affect stream creation by 'consumeNonEmptyResponse' >+PASS Object.prototype.type accessor returning invalid value should not affect stream creation by 'consumeNonEmptyResponse' >+PASS throwing Object.prototype.size accessor should not affect stream creation by 'consumeNonEmptyResponse' >+PASS Object.prototype.size accessor returning invalid value should not affect stream creation by 'consumeNonEmptyResponse' >+PASS throwing Object.prototype.highWaterMark accessor should not affect stream creation by 'consumeNonEmptyResponse' >+PASS Object.prototype.highWaterMark accessor returning invalid value should not affect stream creation by 'consumeNonEmptyResponse' >+PASS Object.prototype.start function which errors the stream should not affect stream creation by 'consumeNonEmptyResponse' >+PASS throwing Object.prototype.start accessor should not affect stream creation by 'consumeEmptyRequest' >+PASS Object.prototype.start accessor returning invalid value should not affect stream creation by 'consumeEmptyRequest' >+PASS throwing Object.prototype.type accessor should not affect stream creation by 'consumeEmptyRequest' >+PASS Object.prototype.type accessor returning invalid value should not affect stream creation by 'consumeEmptyRequest' >+PASS throwing Object.prototype.size accessor should not affect stream creation by 'consumeEmptyRequest' >+PASS Object.prototype.size accessor returning invalid value should not affect stream creation by 'consumeEmptyRequest' >+PASS throwing Object.prototype.highWaterMark accessor should not affect stream creation by 'consumeEmptyRequest' >+PASS Object.prototype.highWaterMark accessor returning invalid value should not affect stream creation by 'consumeEmptyRequest' >+PASS Object.prototype.start function which errors the stream should not affect stream creation by 'consumeEmptyRequest' >+PASS throwing Object.prototype.start accessor should not affect stream creation by 'consumeNonEmptyRequest' >+PASS Object.prototype.start accessor returning invalid value should not affect stream creation by 'consumeNonEmptyRequest' >+PASS throwing Object.prototype.type accessor should not affect stream creation by 'consumeNonEmptyRequest' >+PASS Object.prototype.type accessor returning invalid value should not affect stream creation by 'consumeNonEmptyRequest' >+PASS throwing Object.prototype.size accessor should not affect stream creation by 'consumeNonEmptyRequest' >+PASS Object.prototype.size accessor returning invalid value should not affect stream creation by 'consumeNonEmptyRequest' >+PASS throwing Object.prototype.highWaterMark accessor should not affect stream creation by 'consumeNonEmptyRequest' >+PASS Object.prototype.highWaterMark accessor returning invalid value should not affect stream creation by 'consumeNonEmptyRequest' >+PASS Object.prototype.start function which errors the stream should not affect stream creation by 'consumeNonEmptyRequest' >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/stream-safe-creation.any.worker.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/stream-safe-creation.any.worker.html >new file mode 100644 >index 0000000000000000000000000000000000000000..2382913528e693b3a5d56c660a45060980b548c3 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/stream-safe-creation.any.worker.html >@@ -0,0 +1 @@ >+<!-- This file is required for WebKit test infrastructure to run the templated test --> >\ No newline at end of file >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/w3c-import.log b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/w3c-import.log >index 88e29f9662a60527d55684ac144cb9200ed5d546..213b593f9c9e06909eacec5dca3d16d963526d62 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/w3c-import.log >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/w3c-import.log >@@ -1,7 +1,7 @@ > The tests in this directory were imported from the W3C repository. > Do NOT modify these tests directly in WebKit. > Instead, create a pull request on the WPT github: >- https://github.com/w3c/web-platform-tests >+ https://github.com/web-platform-tests/wpt > > Then run the Tools/Scripts/import-w3c-tests in WebKit to reimport > >@@ -18,31 +18,26 @@ List of files: > /LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/block-mime-as-script.html > /LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/conditional-get.html > /LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/error-after-response.html >-/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/integrity-sharedworker.html >-/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/integrity-worker.html >-/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/integrity.html >-/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/integrity.js >-/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/mode-no-cors-worker.html >-/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/mode-no-cors.html >-/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/mode-no-cors.js >+/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/header-value-combining.any.js >+/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/header-value-null-byte.any.js >+/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/integrity.sub.any.js >+/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/keepalive.html >+/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/mediasource.window.js >+/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/mode-no-cors.sub.any.js > /LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/mode-same-origin.any.js > /LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/referrer.any.js > /LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/request-forbidden-headers.any.js > /LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/request-head.any.js >+/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/request-headers-case.any.js > /LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/request-headers.any.js > /LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/request-referrer-redirected-worker.html > /LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/request-referrer.any.js > /LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/request-upload.any.js >-/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/response-url-worker.html >-/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/response-url.html >-/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/response-url.js >+/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/response-url.sub.any.js > /LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-about.any.js >-/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-blob-worker.html >-/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-blob.html >-/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-blob.js >+/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-blob.sub.any.js > /LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-data.any.js >-/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-others-worker.html >-/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-others.html >-/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-others.js >+/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-others.sub.any.js > /LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/stream-response.any.js >+/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/stream-safe-creation.any.js > /LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/text-utf8.html >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/sandboxed-iframe-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/sandboxed-iframe-expected.txt >index 8aaf9c4b234b4ff4d3f1203812124d1b75549598..6e7aa021cb29cdb379a8c2d8e34ff25291b5040e 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/sandboxed-iframe-expected.txt >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/sandboxed-iframe-expected.txt >@@ -1,6 +1,6 @@ >+CONSOLE MESSAGE: Origin null is not allowed by Access-Control-Allow-Origin. >+CONSOLE MESSAGE: Fetch API cannot load http://localhost:8800/fetch/api/resources/top.txt due to access control checks. > > >-Harness Error (TIMEOUT), message = null >- >-TIMEOUT CORS with sandboxed iframe Test timed out >+PASS CORS with sandboxed iframe > >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/credentials/w3c-import.log b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/credentials/w3c-import.log >index fbdf075a39c055cc6710fed50adcb40e17e469db..4c0fdb180a40bd3e55e7f0e0c3faa13e8b204d51 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/credentials/w3c-import.log >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/credentials/w3c-import.log >@@ -1,7 +1,7 @@ > The tests in this directory were imported from the W3C repository. > Do NOT modify these tests directly in WebKit. > Instead, create a pull request on the WPT github: >- https://github.com/w3c/web-platform-tests >+ https://github.com/web-platform-tests/wpt > > Then run the Tools/Scripts/import-w3c-tests in WebKit to reimport > >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/headers/header-values-normalize.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/headers/header-values-normalize.html >index 616d83acb7ebc1b5b72246bfc52e0348590fcb06..64be98af934eb0d1656cfb53376d7cbf4c0eff6a 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/headers/header-values-normalize.html >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/headers/header-values-normalize.html >@@ -10,7 +10,7 @@ for(let i = 0; i < 0x21; i++) { > let fail = false, > strip = false > >- // REMOVE 0x0B/0x0C exception once https://github.com/w3c/wptserve/issues/111 is fixed >+ // REMOVE 0x0B/0x0C exception once https://github.com/web-platform-tests/wpt/issues/8372 is fixed > if(i === 0x0B || i === 0x0C) > continue > >@@ -56,9 +56,9 @@ for(let i = 0; i < 0x21; i++) { > promise_test((t) => { > if(fail) { > return Promise.all([ >- promise_rejects(t, new TypeError(), fetch("about:blank", { headers: {"val1": val1} })), >- promise_rejects(t, new TypeError(), fetch("about:blank", { headers: {"val2": val2} })), >- promise_rejects(t, new TypeError(), fetch("about:blank", { headers: {"val3": val3} })) >+ promise_rejects(t, new TypeError(), fetch(url, { headers: {"val1": val1} })), >+ promise_rejects(t, new TypeError(), fetch(url, { headers: {"val2": val2} })), >+ promise_rejects(t, new TypeError(), fetch(url, { headers: {"val3": val3} })) > ]) > } else { > return fetch(url, { headers: {"val1": val1, "val2": val2, "val3": val3} }).then((res) => { >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/headers/header-values.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/headers/header-values.html >index 35e7b7e46a95a369322bb18a2aa2e3e536a7af3d..6dfe0d3a78988eef77690f04b3e36e3076e33a7d 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/headers/header-values.html >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/headers/header-values.html >@@ -15,7 +15,7 @@ > assert_throws("SyntaxError", () => xhr.setRequestHeader("value-test", val)) > }, "XMLHttpRequest with value " + encodeURI(val) + " needs to throw") > >- promise_test(t => promise_rejects(t, new TypeError(), fetch("about:blank", { headers: {"value-test": val} })), "fetch() with value " + encodeURI(val) + " needs to throw") >+ promise_test(t => promise_rejects(t, new TypeError(), fetch("/", { headers: {"value-test": val} })), "fetch() with value " + encodeURI(val) + " needs to throw") > }) > > // Valid values >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/headers/headers-idl-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/headers/headers-idl-expected.txt >deleted file mode 100644 >index 71976aff731ab55d2bba48695837852ed16253f7..0000000000000000000000000000000000000000 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/headers/headers-idl-expected.txt >+++ /dev/null >@@ -1,36 +0,0 @@ >- >-PASS Headers interface: existence and properties of interface object >-PASS Headers interface object length >-PASS Headers interface object name >-PASS Headers interface: existence and properties of interface prototype object >-PASS Headers interface: existence and properties of interface prototype object's "constructor" property >-PASS Headers interface: existence and properties of interface prototype object's @@unscopables property >-PASS Headers interface: operation append(ByteString, ByteString) >-PASS Headers interface: operation delete(ByteString) >-PASS Headers interface: operation get(ByteString) >-PASS Headers interface: operation has(ByteString) >-PASS Headers interface: operation set(ByteString, ByteString) >-PASS Testing Symbol.iterator property of iterable interface Headers >-PASS Testing pair iterable interface Headers >-PASS Headers interface: operation entries() >-PASS Headers interface: operation keys() >-PASS Headers interface: operation values() >-PASS Headers interface: operation forEach(function, any) >-PASS Headers must be primary interface of new Headers() >-PASS Stringification of new Headers() >-PASS Headers interface: new Headers() must inherit property "append(ByteString, ByteString)" with the proper type >-PASS Headers interface: calling append(ByteString, ByteString) on new Headers() with too few arguments must throw TypeError >-PASS Headers interface: new Headers() must inherit property "delete(ByteString)" with the proper type >-PASS Headers interface: calling delete(ByteString) on new Headers() with too few arguments must throw TypeError >-PASS Headers interface: new Headers() must inherit property "get(ByteString)" with the proper type >-PASS Headers interface: calling get(ByteString) on new Headers() with too few arguments must throw TypeError >-PASS Headers interface: new Headers() must inherit property "has(ByteString)" with the proper type >-PASS Headers interface: calling has(ByteString) on new Headers() with too few arguments must throw TypeError >-PASS Headers interface: new Headers() must inherit property "set(ByteString, ByteString)" with the proper type >-PASS Headers interface: calling set(ByteString, ByteString) on new Headers() with too few arguments must throw TypeError >-PASS Headers interface: new Headers() must inherit property "entries()" with the proper type >-PASS Headers interface: new Headers() must inherit property "keys()" with the proper type >-PASS Headers interface: new Headers() must inherit property "values()" with the proper type >-PASS Headers interface: new Headers() must inherit property "forEach(function, any)" with the proper type >-PASS Headers interface: calling forEach(function, any) on new Headers() with too few arguments must throw TypeError >- >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/headers/headers-idl.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/headers/headers-idl.html >deleted file mode 100644 >index 078c9d014951eb4758f84ba570ef0b487400cf58..0000000000000000000000000000000000000000 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/headers/headers-idl.html >+++ /dev/null >@@ -1,36 +0,0 @@ >-<!doctype html> >-<html> >- <head> >- <meta charset="utf-8"> >- <title>Headers idl interface</title> >- <meta name="help" href="https://fetch.spec.whatwg.org/#response"> >- <meta name="author" title="Canon Research France" href="https://www.crf.canon.fr"> >- <script src="/resources/testharness.js"></script> >- <script src="/resources/testharnessreport.js"></script> >- <script src="/resources/WebIDLParser.js"></script> >- <script src="/resources/idlharness.js"></script> >- </head> >- <body> >- <script id="headers-idl" type="text/plain"> >- typedef (sequence<sequence<ByteString>> or record<ByteString, ByteString>) HeadersInit; >- >- [Constructor(optional HeadersInit init), >- Exposed=(Window,Worker)] >- interface Headers { >- void append(ByteString name, ByteString value); >- void delete(ByteString name); >- ByteString? get(ByteString name); >- boolean has(ByteString name); >- void set(ByteString name, ByteString value); >- iterable<ByteString, ByteString>; >- }; >- </script> >- <script> >- var idlsArray = new IdlArray(); >- var idl = document.getElementById("headers-idl").textContent >- idlsArray.add_idls(idl); >- idlsArray.add_objects({ Headers: ['new Headers()'] }); >- idlsArray.test(); >- </script> >- </body> >-</html> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/headers/headers-no-cors.window-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/headers/headers-no-cors.window-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..b7bc9dcd649ed1366a33c7c704d590f30e4e84fc >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/headers/headers-no-cors.window-expected.txt >@@ -0,0 +1,24 @@ >+ >+PASS Loading data⦠>+FAIL "no-cors" Headers object cannot have accept set to sssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss, , sssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss assert_equals: 1 expected "sssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss" but got "sssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss, " >+FAIL "no-cors" Headers object cannot have accept-language set to sssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss, , sssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss assert_equals: 1 expected "sssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss" but got "sssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss, " >+FAIL "no-cors" Headers object cannot have content-language set to sssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss, , sssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss assert_equals: 1 expected "sssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss" but got "sssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss, " >+FAIL "no-cors" Headers object cannot have accept set to , sssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss assert_equals: 1 expected "" but got ", sssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss" >+FAIL "no-cors" Headers object cannot have accept-language set to , sssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss assert_equals: 1 expected "" but got ", sssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss" >+FAIL "no-cors" Headers object cannot have content-language set to , sssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss assert_equals: 1 expected "" but got ", sssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss" >+FAIL "no-cors" Headers object cannot have content-type set to text/plain;ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss, text/plain assert_equals: 1 expected "text/plain;ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss" but got "text/plain;ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss, text/plain" >+PASS "no-cors" Headers object cannot have accept/" as header >+FAIL "no-cors" Headers object cannot have accept/012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678 as header assert_false: expected false got true >+PASS "no-cors" Headers object cannot have accept-language/ as header >+PASS "no-cors" Headers object cannot have accept-language/@ as header >+PASS "no-cors" Headers object cannot have content-language/ as header >+PASS "no-cors" Headers object cannot have content-language/@ as header >+PASS "no-cors" Headers object cannot have content-type/text/html as header >+FAIL "no-cors" Headers object cannot have content-type/text/plain; long=0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901 as header assert_false: expected false got true >+PASS "no-cors" Headers object cannot have test/hi as header >+PASS "no-cors" Headers object cannot have dpr/2 as header >+PASS "no-cors" Headers object cannot have downlink/1 as header >+PASS "no-cors" Headers object cannot have save-data/on as header >+PASS "no-cors" Headers object cannot have viewport-width/100 as header >+PASS "no-cors" Headers object cannot have width/100 as header >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/headers/headers-no-cors.window.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/headers/headers-no-cors.window.html >new file mode 100644 >index 0000000000000000000000000000000000000000..2382913528e693b3a5d56c660a45060980b548c3 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/headers/headers-no-cors.window.html >@@ -0,0 +1 @@ >+<!-- This file is required for WebKit test infrastructure to run the templated test --> >\ No newline at end of file >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/headers/headers-no-cors.window.js b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/headers/headers-no-cors.window.js >new file mode 100644 >index 0000000000000000000000000000000000000000..9ea76e03e138f1604053771bb1a75130758726f7 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/headers/headers-no-cors.window.js >@@ -0,0 +1,52 @@ >+promise_test(() => fetch("../cors/resources/not-cors-safelisted.json").then(res => res.json().then(runTests)), "Loading dataâ¦"); >+ >+const longValue = "s".repeat(127); >+ >+[ >+ { >+ "headers": ["accept", "accept-language", "content-language"], >+ "values": [longValue, "", longValue] >+ }, >+ { >+ "headers": ["accept", "accept-language", "content-language"], >+ "values": ["", longValue] >+ }, >+ { >+ "headers": ["content-type"], >+ "values": ["text/plain;" + "s".repeat(116), "text/plain"] >+ } >+].forEach(testItem => { >+ testItem.headers.forEach(header => { >+ test(() => { >+ const noCorsHeaders = new Request("about:blank", { mode: "no-cors" }).headers; >+ testItem.values.forEach((value) => { >+ noCorsHeaders.append(header, value); >+ assert_equals(noCorsHeaders.get(header), testItem.values[0], '1'); >+ }); >+ noCorsHeaders.set(header, testItem.values.join(", ")); >+ assert_equals(noCorsHeaders.get(header), testItem.values[0], '2'); >+ noCorsHeaders.delete(header); >+ assert_false(noCorsHeaders.has(header)); >+ }, "\"no-cors\" Headers object cannot have " + header + " set to " + testItem.values.join(", ")); >+ }); >+}); >+ >+function runTests(testArray) { >+ testArray = testArray.concat([ >+ ["dpr", "2"], >+ ["downlink", "1"], // https://wicg.github.io/netinfo/ >+ ["save-data", "on"], >+ ["viewport-width", "100"], >+ ["width", "100"] >+ ]); >+ testArray.forEach(testItem => { >+ const [headerName, headerValue] = testItem; >+ test(() => { >+ const noCorsHeaders = new Request("about:blank", { mode: "no-cors" }).headers; >+ noCorsHeaders.append(headerName, headerValue); >+ assert_false(noCorsHeaders.has(headerName)); >+ noCorsHeaders.set(headerName, headerValue); >+ assert_false(noCorsHeaders.has(headerName)); >+ }, "\"no-cors\" Headers object cannot have " + headerName + "/" + headerValue + " as header"); >+ }); >+} >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/headers/w3c-import.log b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/headers/w3c-import.log >index 0ab0b7e481adebd0a8451678ac8cff50c419b659..e5b7c20fa2d34d15488848056b34401e9f7ef2e4 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/headers/w3c-import.log >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/headers/w3c-import.log >@@ -1,7 +1,7 @@ > The tests in this directory were imported from the W3C repository. > Do NOT modify these tests directly in WebKit. > Instead, create a pull request on the WPT github: >- https://github.com/w3c/web-platform-tests >+ https://github.com/web-platform-tests/wpt > > Then run the Tools/Scripts/import-w3c-tests in WebKit to reimport > >@@ -20,7 +20,7 @@ List of files: > /LayoutTests/imported/w3c/web-platform-tests/fetch/api/headers/headers-casing.html > /LayoutTests/imported/w3c/web-platform-tests/fetch/api/headers/headers-combine.html > /LayoutTests/imported/w3c/web-platform-tests/fetch/api/headers/headers-errors.html >-/LayoutTests/imported/w3c/web-platform-tests/fetch/api/headers/headers-idl.html >+/LayoutTests/imported/w3c/web-platform-tests/fetch/api/headers/headers-no-cors.window.js > /LayoutTests/imported/w3c/web-platform-tests/fetch/api/headers/headers-normalize.html > /LayoutTests/imported/w3c/web-platform-tests/fetch/api/headers/headers-record.html > /LayoutTests/imported/w3c/web-platform-tests/fetch/api/headers/headers-structure.html >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/idl.any-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/idl.any-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..a7ea32791cb00693f3794a23d3284a92679c52ff >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/idl.any-expected.txt >@@ -0,0 +1,30 @@ >+ >+FAIL idl_test setup promise_test: Unhandled rejection with value: object "Got an error before parsing any named definition: Unrecognised tokens, line 1 (tokens: "{\"error\": {\"message\"") >+[ >+ { >+ "type": "{", >+ "value": "{", >+ "trivia": "" >+ }, >+ { >+ "type": "string", >+ "value": "\"error\"", >+ "trivia": "" >+ }, >+ { >+ "type": ":", >+ "value": ":", >+ "trivia": "" >+ }, >+ { >+ "type": "{", >+ "value": "{", >+ "trivia": " " >+ }, >+ { >+ "type": "string", >+ "value": "\"message\"", >+ "trivia": "" >+ } >+]" >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/idl.any.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/idl.any.html >new file mode 100644 >index 0000000000000000000000000000000000000000..2382913528e693b3a5d56c660a45060980b548c3 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/idl.any.html >@@ -0,0 +1 @@ >+<!-- This file is required for WebKit test infrastructure to run the templated test --> >\ No newline at end of file >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/idl.any.js b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/idl.any.js >new file mode 100644 >index 0000000000000000000000000000000000000000..ccd4d2c0b46234c40f2ff452c8ead112e32539de >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/idl.any.js >@@ -0,0 +1,20 @@ >+// META: global=window,worker >+// META: script=/resources/WebIDLParser.js >+// META: script=/resources/idlharness.js >+ >+idl_test( >+ ['fetch'], >+ ['referrer-policy', 'html', 'dom'], >+ idl_array => { >+ idl_array.add_objects({ >+ Headers: ["new Headers()"], >+ Request: ["new Request('about:blank')"], >+ Response: ["new Response()"], >+ }); >+ if (self.GLOBAL.isWindow()) { >+ idl_array.add_objects({ Window: ['window'] }); >+ } else if (self.GLOBAL.isWorker()) { >+ idl_array.add_objects({ WorkerGlobalScope: ['self'] }); >+ } >+ } >+); >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/idl.any.worker-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/idl.any.worker-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..a7ea32791cb00693f3794a23d3284a92679c52ff >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/idl.any.worker-expected.txt >@@ -0,0 +1,30 @@ >+ >+FAIL idl_test setup promise_test: Unhandled rejection with value: object "Got an error before parsing any named definition: Unrecognised tokens, line 1 (tokens: "{\"error\": {\"message\"") >+[ >+ { >+ "type": "{", >+ "value": "{", >+ "trivia": "" >+ }, >+ { >+ "type": "string", >+ "value": "\"error\"", >+ "trivia": "" >+ }, >+ { >+ "type": ":", >+ "value": ":", >+ "trivia": "" >+ }, >+ { >+ "type": "{", >+ "value": "{", >+ "trivia": " " >+ }, >+ { >+ "type": "string", >+ "value": "\"message\"", >+ "trivia": "" >+ } >+]" >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/idl.any.worker.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/idl.any.worker.html >new file mode 100644 >index 0000000000000000000000000000000000000000..2382913528e693b3a5d56c660a45060980b548c3 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/idl.any.worker.html >@@ -0,0 +1 @@ >+<!-- This file is required for WebKit test infrastructure to run the templated test --> >\ No newline at end of file >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/policies/w3c-import.log b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/policies/w3c-import.log >index 60fcd8ce53dff4591aa2a803ae87f77010c88fd3..b40e2e3d23990d4d1f9e19bcc4a853d54b8d5ce8 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/policies/w3c-import.log >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/policies/w3c-import.log >@@ -1,7 +1,7 @@ > The tests in this directory were imported from the W3C repository. > Do NOT modify these tests directly in WebKit. > Instead, create a pull request on the WPT github: >- https://github.com/w3c/web-platform-tests >+ https://github.com/web-platform-tests/wpt > > Then run the Tools/Scripts/import-w3c-tests in WebKit to reimport > >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-back-to-original-origin.any-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-back-to-original-origin.any-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..79a402efffe1f85a0b5e65335270df75a0e8e05a >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-back-to-original-origin.any-expected.txt >@@ -0,0 +1,4 @@ >+ >+PASS original => remote => original with mode: "no-cors" >+PASS original => remote => original with mode: "cors" >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-back-to-original-origin.any.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-back-to-original-origin.any.html >new file mode 100644 >index 0000000000000000000000000000000000000000..2382913528e693b3a5d56c660a45060980b548c3 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-back-to-original-origin.any.html >@@ -0,0 +1 @@ >+<!-- This file is required for WebKit test infrastructure to run the templated test --> >\ No newline at end of file >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-back-to-original-origin.any.js b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-back-to-original-origin.any.js >new file mode 100644 >index 0000000000000000000000000000000000000000..32d413cb2f16db6753bd71cfa0395ff8bd7efea9 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-back-to-original-origin.any.js >@@ -0,0 +1,37 @@ >+// META: script=/common/get-host-info.sub.js >+ >+const BASE = location.href; >+const IS_HTTPS = new URL(BASE).protocol === 'https:'; >+const REMOTE_HOST = get_host_info()['REMOTE_HOST']; >+const REMOTE_PORT = >+ IS_HTTPS ? get_host_info()['HTTPS_PORT'] : get_host_info()['HTTP_PORT']; >+ >+const REMOTE_ORIGIN = >+ new URL(`//${REMOTE_HOST}:${REMOTE_PORT}`, BASE).origin; >+const DESTINATION = new URL('../resources/cors-top.txt', BASE); >+ >+function CreateURL(url, BASE, params) { >+ const u = new URL(url, BASE); >+ for (const {name, value} of params) { >+ u.searchParams.append(name, value); >+ } >+ return u; >+} >+ >+const redirect = >+ CreateURL('/fetch/api/resources/redirect.py', REMOTE_ORIGIN, >+ [{name: 'redirect_status', value: 303}, >+ {name: 'location', value: DESTINATION.href}]); >+ >+promise_test(async (test) => { >+ const res = await fetch(redirect.href, {mode: 'no-cors'}); >+ // This is discussed at https://github.com/whatwg/fetch/issues/737. >+ assert_equals(res.type, 'opaque'); >+}, 'original => remote => original with mode: "no-cors"'); >+ >+promise_test(async (test) => { >+ const res = await fetch(redirect.href, {mode: 'cors'}); >+ assert_equals(res.type, 'cors'); >+}, 'original => remote => original with mode: "cors"'); >+ >+done(); >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-back-to-original-origin.any.worker-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-back-to-original-origin.any.worker-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..79a402efffe1f85a0b5e65335270df75a0e8e05a >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-back-to-original-origin.any.worker-expected.txt >@@ -0,0 +1,4 @@ >+ >+PASS original => remote => original with mode: "no-cors" >+PASS original => remote => original with mode: "cors" >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-back-to-original-origin.any.worker.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-back-to-original-origin.any.worker.html >new file mode 100644 >index 0000000000000000000000000000000000000000..2382913528e693b3a5d56c660a45060980b548c3 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-back-to-original-origin.any.worker.html >@@ -0,0 +1 @@ >+<!-- This file is required for WebKit test infrastructure to run the templated test --> >\ No newline at end of file >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-count-worker-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-count-worker-expected.txt >deleted file mode 100644 >index cadf78d0c348ee98f4dc772530fdd9d9510bf75a..0000000000000000000000000000000000000000 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-count-worker-expected.txt >+++ /dev/null >@@ -1,12 +0,0 @@ >- >-FAIL Redirect 301 20 times assert_equals: Response's status is 200 expected 200 but got 301 >-FAIL Redirect 301 21 times assert_unreached: Should have rejected: undefined Reached unreachable code >-FAIL Redirect 302 20 times assert_equals: Response's status is 200 expected 200 but got 302 >-FAIL Redirect 302 21 times assert_unreached: Should have rejected: undefined Reached unreachable code >-FAIL Redirect 303 20 times assert_equals: Response's status is 200 expected 200 but got 303 >-FAIL Redirect 303 21 times assert_unreached: Should have rejected: undefined Reached unreachable code >-FAIL Redirect 307 20 times assert_equals: Response's status is 200 expected 200 but got 307 >-PASS Redirect 307 21 times >-FAIL Redirect 308 20 times assert_equals: Response's status is 200 expected 200 but got 308 >-FAIL Redirect 308 21 times assert_unreached: Should have rejected: undefined Reached unreachable code >- >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-count-worker.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-count-worker.html >deleted file mode 100644 >index 0f624e82626ac7e2c64d87da7f617b4510d52820..0000000000000000000000000000000000000000 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-count-worker.html >+++ /dev/null >@@ -1,17 +0,0 @@ >-<!doctype html> >-<html> >- <head> >- <meta charset="utf-8"> >- <title>Fetch in worker: rediraction loop</title> >- <meta name="timeout" content="long"> >- <meta name="author" title="Canon Research France" href="https://www.crf.canon.fr"> >- <meta name="help" href="https://fetch.spec.whatwg.org/#http-network-or-cache-fetch"> >- <script src="/resources/testharness.js"></script> >- <script src="/resources/testharnessreport.js"></script> >- </head> >- <body> >- <script> >- fetch_tests_from_worker(new Worker("redirect-count.js")); >- </script> >- </body> >-</html> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-count.any-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-count.any-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..eaf7029dafab1f8be4bba1766e85689649c23616 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-count.any-expected.txt >@@ -0,0 +1,12 @@ >+ >+FAIL Redirect 301 20 times assert_equals: Response's status is 200 expected 200 but got 301 >+FAIL Redirect 301 21 times assert_unreached: Should have rejected: undefined Reached unreachable code >+FAIL Redirect 302 20 times assert_equals: Response's status is 200 expected 200 but got 302 >+FAIL Redirect 302 21 times assert_unreached: Should have rejected: undefined Reached unreachable code >+FAIL Redirect 303 20 times assert_equals: Response's status is 200 expected 200 but got 303 >+FAIL Redirect 303 21 times assert_unreached: Should have rejected: undefined Reached unreachable code >+FAIL Redirect 307 20 times assert_equals: Response's status is 200 expected 200 but got 307 >+FAIL Redirect 307 21 times assert_unreached: Should have rejected: undefined Reached unreachable code >+FAIL Redirect 308 20 times assert_equals: Response's status is 200 expected 200 but got 308 >+PASS Redirect 308 21 times >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-count.any.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-count.any.html >new file mode 100644 >index 0000000000000000000000000000000000000000..2382913528e693b3a5d56c660a45060980b548c3 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-count.any.html >@@ -0,0 +1 @@ >+<!-- This file is required for WebKit test infrastructure to run the templated test --> >\ No newline at end of file >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-count.any.js b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-count.any.js >new file mode 100644 >index 0000000000000000000000000000000000000000..0c45d8d87ce44e0ebdde4d10d974681384d47c09 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-count.any.js >@@ -0,0 +1,41 @@ >+// META: script=../resources/utils.js >+// META: script=/common/utils.js >+// META: timeout=long >+ >+function redirectCount(desc, redirectUrl, redirectLocation, redirectStatus, maxCount, shouldPass) { >+ var uuid_token = token(); >+ >+ var urlParameters = "?token=" + uuid_token + "&max_age=0"; >+ urlParameters += "&redirect_status=" + redirectStatus; >+ urlParameters += "&max_count=" + maxCount; >+ if (redirectLocation) >+ urlParameters += "&location=" + encodeURIComponent(redirectLocation); >+ >+ var url = redirectUrl; >+ var requestInit = {"redirect": "follow"}; >+ >+ promise_test(function(test) { >+ return fetch(RESOURCES_DIR + "clean-stash.py?token=" + uuid_token).then(function(resp) { >+ assert_equals(resp.status, 200, "Clean stash response's status is 200"); >+ >+ if (!shouldPass) >+ return promise_rejects(test, new TypeError(), fetch(url + urlParameters, requestInit)); >+ >+ return fetch(url + urlParameters, requestInit).then(function(resp) { >+ assert_equals(resp.status, 200, "Response's status is 200"); >+ return resp.text(); >+ }).then(function(body) { >+ assert_equals(body, maxCount.toString(), "Redirected " + maxCount + " times"); >+ }); >+ }); >+ }, desc); >+} >+ >+var redirUrl = RESOURCES_DIR + "redirect.py"; >+ >+for (var statusCode of [301, 302, 303, 307, 308]) { >+ redirectCount("Redirect " + statusCode + " 20 times", redirUrl, redirUrl, statusCode, 20, true); >+ redirectCount("Redirect " + statusCode + " 21 times", redirUrl, redirUrl, statusCode, 21, false); >+} >+ >+done(); >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-count.any.worker-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-count.any.worker-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..d003d4a2b7f7e560639ac5263a619060c3b478dc >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-count.any.worker-expected.txt >@@ -0,0 +1,12 @@ >+ >+FAIL Redirect 301 20 times assert_equals: Response's status is 200 expected 200 but got 301 >+FAIL Redirect 301 21 times assert_unreached: Should have rejected: undefined Reached unreachable code >+FAIL Redirect 302 20 times assert_equals: Response's status is 200 expected 200 but got 302 >+FAIL Redirect 302 21 times assert_unreached: Should have rejected: undefined Reached unreachable code >+FAIL Redirect 303 20 times assert_equals: Response's status is 200 expected 200 but got 303 >+FAIL Redirect 303 21 times assert_unreached: Should have rejected: undefined Reached unreachable code >+FAIL Redirect 307 20 times promise_test: Unhandled rejection with value: object "TypeError: too many HTTP redirects" >+FAIL Redirect 307 21 times assert_unreached: Should have rejected: undefined Reached unreachable code >+FAIL Redirect 308 20 times assert_equals: Response's status is 200 expected 200 but got 308 >+FAIL Redirect 308 21 times assert_unreached: Should have rejected: undefined Reached unreachable code >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-count.any.worker.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-count.any.worker.html >new file mode 100644 >index 0000000000000000000000000000000000000000..2382913528e693b3a5d56c660a45060980b548c3 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-count.any.worker.html >@@ -0,0 +1 @@ >+<!-- This file is required for WebKit test infrastructure to run the templated test --> >\ No newline at end of file >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-count.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-count.html >deleted file mode 100644 >index d6a66e6eb9e2ec4d7732dcb86bfe5ce9686f4f04..0000000000000000000000000000000000000000 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-count.html >+++ /dev/null >@@ -1,17 +0,0 @@ >-<!doctype html> >-<html> >- <head> >- <meta charset="utf-8"> >- <title>Fetch: redirection loop</title> >- <meta name="timeout" content="long"> >- <meta name="author" title="Canon Research France" href="https://www.crf.canon.fr"> >- <meta name="help" href="https://fetch.spec.whatwg.org/#http-network-or-cache-fetch"> >- <script src="/resources/testharness.js"></script> >- <script src="/resources/testharnessreport.js"></script> >- </head> >- <body> >- <script src="/common/utils.js"></script> >- <script src="../resources/utils.js"></script> >- <script src="redirect-count.js"></script> >- </body> >-</html> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-count.js b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-count.js >deleted file mode 100644 >index 0103280f6e2319f2dd4cccf1834b9d815130db40..0000000000000000000000000000000000000000 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-count.js >+++ /dev/null >@@ -1,43 +0,0 @@ >-if (this.document === undefined) { >- importScripts("/resources/testharness.js"); >- importScripts("../resources/utils.js"); >- importScripts("/common/utils.js"); >-} >- >-function redirectCount(desc, redirectUrl, redirectLocation, redirectStatus, maxCount, shouldPass) { >- var uuid_token = token(); >- >- var urlParameters = "?token=" + uuid_token + "&max_age=0"; >- urlParameters += "&redirect_status=" + redirectStatus; >- urlParameters += "&max_count=" + maxCount; >- if (redirectLocation) >- urlParameters += "&location=" + encodeURIComponent(redirectLocation); >- >- var url = redirectUrl; >- var requestInit = {"redirect": "follow"}; >- >- promise_test(function(test) { >- return fetch(RESOURCES_DIR + "clean-stash.py?token=" + uuid_token).then(function(resp) { >- assert_equals(resp.status, 200, "Clean stash response's status is 200"); >- >- if (!shouldPass) >- return promise_rejects(test, new TypeError(), fetch(url + urlParameters, requestInit)); >- >- return fetch(url + urlParameters, requestInit).then(function(resp) { >- assert_equals(resp.status, 200, "Response's status is 200"); >- return resp.text(); >- }).then(function(body) { >- assert_equals(body, maxCount.toString(), "Redirected " + maxCount + " times"); >- }); >- }); >- }, desc); >-} >- >-var redirUrl = RESOURCES_DIR + "redirect.py"; >- >-for (var statusCode of [301, 302, 303, 307, 308]) { >- redirectCount("Redirect " + statusCode + " 20 times", redirUrl, redirUrl, statusCode, 20, true); >- redirectCount("Redirect " + statusCode + " 21 times", redirUrl, redirUrl, statusCode, 21, false); >-} >- >-done(); >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-empty-location.any-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-empty-location.any-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..4777f06a59c36786102d6a26c05df0ec30e01862 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-empty-location.any-expected.txt >@@ -0,0 +1,4 @@ >+ >+FAIL redirect response with empty Location, follow mode assert_unreached: Should have rejected: undefined Reached unreachable code >+FAIL redirect response with empty Location, manual mode assert_equals: expected "opaqueredirect" but got "basic" >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-empty-location.any.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-empty-location.any.html >new file mode 100644 >index 0000000000000000000000000000000000000000..2382913528e693b3a5d56c660a45060980b548c3 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-empty-location.any.html >@@ -0,0 +1 @@ >+<!-- This file is required for WebKit test infrastructure to run the templated test --> >\ No newline at end of file >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-empty-location.any.js b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-empty-location.any.js >new file mode 100644 >index 0000000000000000000000000000000000000000..ace8f221c09af1fbcb33a57426c3324d8ac6ea9b >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-empty-location.any.js >@@ -0,0 +1,20 @@ >+// META: script=../resources/utils.js >+ >+// Tests receiving a redirect response with a Location header with an empty >+// value. >+ >+const url = RESOURCES_DIR + 'redirect-empty-location.py'; >+ >+promise_test(t => { >+ return promise_rejects(t, new TypeError(), fetch(url, {redirect:'follow'})); >+}, 'redirect response with empty Location, follow mode'); >+ >+promise_test(t => { >+ return fetch(url, {redirect:'manual'}) >+ .then(resp => { >+ assert_equals(resp.type, 'opaqueredirect'); >+ assert_equals(resp.status, 0); >+ }); >+}, 'redirect response with empty Location, manual mode'); >+ >+done(); >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-empty-location.any.worker-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-empty-location.any.worker-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..4777f06a59c36786102d6a26c05df0ec30e01862 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-empty-location.any.worker-expected.txt >@@ -0,0 +1,4 @@ >+ >+FAIL redirect response with empty Location, follow mode assert_unreached: Should have rejected: undefined Reached unreachable code >+FAIL redirect response with empty Location, manual mode assert_equals: expected "opaqueredirect" but got "basic" >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-empty-location.any.worker.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-empty-location.any.worker.html >new file mode 100644 >index 0000000000000000000000000000000000000000..2382913528e693b3a5d56c660a45060980b548c3 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-empty-location.any.worker.html >@@ -0,0 +1 @@ >+<!-- This file is required for WebKit test infrastructure to run the templated test --> >\ No newline at end of file >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-location-worker-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-location-worker-expected.txt >deleted file mode 100644 >index 5e0fc37e8b5ea11001c4f8b3c2c6be042b696b8b..0000000000000000000000000000000000000000 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-location-worker-expected.txt >+++ /dev/null >@@ -1,42 +0,0 @@ >-CONSOLE MESSAGE: Cross-origin redirection to invalidurl: denied by Cross-Origin Resource Sharing policy: URL is either a non-HTTP URL or contains credentials. >-CONSOLE MESSAGE: Cross-origin redirection to data:,data%20url denied by Cross-Origin Resource Sharing policy: URL is either a non-HTTP URL or contains credentials. >-CONSOLE MESSAGE: Cross-origin redirection to invalidurl: denied by Cross-Origin Resource Sharing policy: URL is either a non-HTTP URL or contains credentials. >-CONSOLE MESSAGE: Cross-origin redirection to data:,data%20url denied by Cross-Origin Resource Sharing policy: URL is either a non-HTTP URL or contains credentials. >-CONSOLE MESSAGE: Cross-origin redirection to invalidurl: denied by Cross-Origin Resource Sharing policy: URL is either a non-HTTP URL or contains credentials. >-CONSOLE MESSAGE: Cross-origin redirection to data:,data%20url denied by Cross-Origin Resource Sharing policy: URL is either a non-HTTP URL or contains credentials. >-CONSOLE MESSAGE: Cross-origin redirection to invalidurl: denied by Cross-Origin Resource Sharing policy: URL is either a non-HTTP URL or contains credentials. >-CONSOLE MESSAGE: Cross-origin redirection to data:,data%20url denied by Cross-Origin Resource Sharing policy: URL is either a non-HTTP URL or contains credentials. >-CONSOLE MESSAGE: Cross-origin redirection to invalidurl: denied by Cross-Origin Resource Sharing policy: URL is either a non-HTTP URL or contains credentials. >-CONSOLE MESSAGE: Cross-origin redirection to data:,data%20url denied by Cross-Origin Resource Sharing policy: URL is either a non-HTTP URL or contains credentials. >- >-PASS Redirect 301 in "follow" mode without location >-FAIL Redirect 301 in "manual" mode without location assert_equals: Response's status is 0 expected 0 but got 301 >-PASS Redirect 301 in "follow" mode with invalid location >-PASS Redirect 301 in "manual" mode with invalid location >-PASS Redirect 301 in "follow" mode with data location >-PASS Redirect 301 in "manual" mode with data location >-PASS Redirect 302 in "follow" mode without location >-FAIL Redirect 302 in "manual" mode without location assert_equals: Response's status is 0 expected 0 but got 302 >-PASS Redirect 302 in "follow" mode with invalid location >-PASS Redirect 302 in "manual" mode with invalid location >-PASS Redirect 302 in "follow" mode with data location >-PASS Redirect 302 in "manual" mode with data location >-PASS Redirect 303 in "follow" mode without location >-FAIL Redirect 303 in "manual" mode without location assert_equals: Response's status is 0 expected 0 but got 303 >-PASS Redirect 303 in "follow" mode with invalid location >-PASS Redirect 303 in "manual" mode with invalid location >-PASS Redirect 303 in "follow" mode with data location >-PASS Redirect 303 in "manual" mode with data location >-PASS Redirect 307 in "follow" mode without location >-FAIL Redirect 307 in "manual" mode without location assert_equals: Response's status is 0 expected 0 but got 307 >-PASS Redirect 307 in "follow" mode with invalid location >-PASS Redirect 307 in "manual" mode with invalid location >-PASS Redirect 307 in "follow" mode with data location >-PASS Redirect 307 in "manual" mode with data location >-PASS Redirect 308 in "follow" mode without location >-FAIL Redirect 308 in "manual" mode without location assert_equals: Response's status is 0 expected 0 but got 308 >-PASS Redirect 308 in "follow" mode with invalid location >-PASS Redirect 308 in "manual" mode with invalid location >-PASS Redirect 308 in "follow" mode with data location >-PASS Redirect 308 in "manual" mode with data location >- >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-location-worker.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-location-worker.html >deleted file mode 100644 >index e2970811c0710c1950ba818df8f9605b441ad105..0000000000000000000000000000000000000000 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-location-worker.html >+++ /dev/null >@@ -1,16 +0,0 @@ >-<!doctype html> >-<html> >- <head> >- <meta charset="utf-8"> >- <title>Fetch in worker: handling Location header during redirection</title> >- <meta name="author" title="Canon Research France" href="https://www.crf.canon.fr"> >- <meta name="help" href="https://fetch.spec.whatwg.org/#http-network-or-cache-fetch"> >- <script src="/resources/testharness.js"></script> >- <script src="/resources/testharnessreport.js"></script> >- </head> >- <body> >- <script> >- fetch_tests_from_worker(new Worker("redirect-location.js")); >- </script> >- </body> >-</html> >\ No newline at end of file >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-location.any-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-location.any-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..731ee23362f8026d2036263b5f030bf348901a9d >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-location.any-expected.txt >@@ -0,0 +1,52 @@ >+CONSOLE MESSAGE: Cross-origin redirection to invalidurl: denied by Cross-Origin Resource Sharing policy: URL is either a non-HTTP URL or contains credentials. >+CONSOLE MESSAGE: Fetch API cannot load http://localhost:8800/fetch/api/resources/redirect.py?redirect_status=301&location=invalidurl%3A due to access control checks. >+CONSOLE MESSAGE: Cross-origin redirection to data:,data%20url denied by Cross-Origin Resource Sharing policy: URL is either a non-HTTP URL or contains credentials. >+CONSOLE MESSAGE: Fetch API cannot load http://localhost:8800/fetch/api/resources/redirect.py?redirect_status=301&location=data%3A%2Cdata%2520url due to access control checks. >+CONSOLE MESSAGE: Cross-origin redirection to invalidurl: denied by Cross-Origin Resource Sharing policy: URL is either a non-HTTP URL or contains credentials. >+CONSOLE MESSAGE: Fetch API cannot load http://localhost:8800/fetch/api/resources/redirect.py?redirect_status=302&location=invalidurl%3A due to access control checks. >+CONSOLE MESSAGE: Cross-origin redirection to data:,data%20url denied by Cross-Origin Resource Sharing policy: URL is either a non-HTTP URL or contains credentials. >+CONSOLE MESSAGE: Fetch API cannot load http://localhost:8800/fetch/api/resources/redirect.py?redirect_status=302&location=data%3A%2Cdata%2520url due to access control checks. >+CONSOLE MESSAGE: Cross-origin redirection to invalidurl: denied by Cross-Origin Resource Sharing policy: URL is either a non-HTTP URL or contains credentials. >+CONSOLE MESSAGE: Fetch API cannot load http://localhost:8800/fetch/api/resources/redirect.py?redirect_status=303&location=invalidurl%3A due to access control checks. >+CONSOLE MESSAGE: Cross-origin redirection to data:,data%20url denied by Cross-Origin Resource Sharing policy: URL is either a non-HTTP URL or contains credentials. >+CONSOLE MESSAGE: Fetch API cannot load http://localhost:8800/fetch/api/resources/redirect.py?redirect_status=303&location=data%3A%2Cdata%2520url due to access control checks. >+CONSOLE MESSAGE: Cross-origin redirection to invalidurl: denied by Cross-Origin Resource Sharing policy: URL is either a non-HTTP URL or contains credentials. >+CONSOLE MESSAGE: Fetch API cannot load http://localhost:8800/fetch/api/resources/redirect.py?redirect_status=307&location=invalidurl%3A due to access control checks. >+CONSOLE MESSAGE: Cross-origin redirection to data:,data%20url denied by Cross-Origin Resource Sharing policy: URL is either a non-HTTP URL or contains credentials. >+CONSOLE MESSAGE: Fetch API cannot load http://localhost:8800/fetch/api/resources/redirect.py?redirect_status=307&location=data%3A%2Cdata%2520url due to access control checks. >+CONSOLE MESSAGE: Cross-origin redirection to invalidurl: denied by Cross-Origin Resource Sharing policy: URL is either a non-HTTP URL or contains credentials. >+CONSOLE MESSAGE: Fetch API cannot load http://localhost:8800/fetch/api/resources/redirect.py?redirect_status=308&location=invalidurl%3A due to access control checks. >+CONSOLE MESSAGE: Cross-origin redirection to data:,data%20url denied by Cross-Origin Resource Sharing policy: URL is either a non-HTTP URL or contains credentials. >+CONSOLE MESSAGE: Fetch API cannot load http://localhost:8800/fetch/api/resources/redirect.py?redirect_status=308&location=data%3A%2Cdata%2520url due to access control checks. >+ >+PASS Redirect 301 in "follow" mode without location >+FAIL Redirect 301 in "manual" mode without location assert_equals: Response's status is 0 expected 0 but got 301 >+PASS Redirect 301 in "follow" mode with invalid location >+PASS Redirect 301 in "manual" mode with invalid location >+PASS Redirect 301 in "follow" mode with data location >+PASS Redirect 301 in "manual" mode with data location >+PASS Redirect 302 in "follow" mode without location >+FAIL Redirect 302 in "manual" mode without location assert_equals: Response's status is 0 expected 0 but got 302 >+PASS Redirect 302 in "follow" mode with invalid location >+PASS Redirect 302 in "manual" mode with invalid location >+PASS Redirect 302 in "follow" mode with data location >+PASS Redirect 302 in "manual" mode with data location >+PASS Redirect 303 in "follow" mode without location >+FAIL Redirect 303 in "manual" mode without location assert_equals: Response's status is 0 expected 0 but got 303 >+PASS Redirect 303 in "follow" mode with invalid location >+PASS Redirect 303 in "manual" mode with invalid location >+PASS Redirect 303 in "follow" mode with data location >+PASS Redirect 303 in "manual" mode with data location >+PASS Redirect 307 in "follow" mode without location >+FAIL Redirect 307 in "manual" mode without location assert_equals: Response's status is 0 expected 0 but got 307 >+PASS Redirect 307 in "follow" mode with invalid location >+PASS Redirect 307 in "manual" mode with invalid location >+PASS Redirect 307 in "follow" mode with data location >+PASS Redirect 307 in "manual" mode with data location >+PASS Redirect 308 in "follow" mode without location >+FAIL Redirect 308 in "manual" mode without location assert_equals: Response's status is 0 expected 0 but got 308 >+PASS Redirect 308 in "follow" mode with invalid location >+PASS Redirect 308 in "manual" mode with invalid location >+PASS Redirect 308 in "follow" mode with data location >+PASS Redirect 308 in "manual" mode with data location >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-location.any.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-location.any.html >new file mode 100644 >index 0000000000000000000000000000000000000000..2382913528e693b3a5d56c660a45060980b548c3 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-location.any.html >@@ -0,0 +1 @@ >+<!-- This file is required for WebKit test infrastructure to run the templated test --> >\ No newline at end of file >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-location.any.js b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-location.any.js >new file mode 100644 >index 0000000000000000000000000000000000000000..27baefc91587d8cc93d03a31ce74f9a8d16314c4 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-location.any.js >@@ -0,0 +1,47 @@ >+// META: script=../resources/utils.js >+ >+function redirectLocation(desc, redirectUrl, redirectLocation, redirectStatus, redirectMode, shouldPass) { >+ var url = redirectUrl; >+ var urlParameters = "?redirect_status=" + redirectStatus; >+ if (redirectLocation) >+ urlParameters += "&location=" + encodeURIComponent(redirectLocation); >+ >+ var requestInit = {"redirect": redirectMode}; >+ >+ promise_test(function(test) { >+ if (redirectMode === "error" || !shouldPass) >+ return promise_rejects(test, new TypeError(), fetch(url + urlParameters, requestInit)); >+ if (redirectMode === "manual") >+ return fetch(url + urlParameters, requestInit).then(function(resp) { >+ assert_equals(resp.status, 0, "Response's status is 0"); >+ assert_equals(resp.type, "opaqueredirect", "Response's type is opaqueredirect"); >+ assert_equals(resp.statusText, "", "Response's statusText is \"\""); >+ assert_true(resp.headers.entries().next().done, "Headers should be empty"); >+ }); >+ >+ if (redirectMode === "follow") >+ return fetch(url + urlParameters, requestInit).then(function(resp) { >+ assert_equals(resp.status, redirectStatus, "Response's status is " + redirectStatus); >+ }); >+ assert_unreached(redirectMode + " is not a valid redirect mode"); >+ }, desc); >+} >+ >+var redirUrl = RESOURCES_DIR + "redirect.py"; >+var locationUrl = "top.txt"; >+var invalidLocationUrl = "invalidurl:"; >+var dataLocationUrl = "data:,data%20url"; >+// FIXME: We may want to mix redirect-mode and cors-mode. >+// FIXME: Add tests for "error" redirect-mode. >+for (var statusCode of [301, 302, 303, 307, 308]) { >+ redirectLocation("Redirect " + statusCode + " in \"follow\" mode without location", redirUrl, undefined, statusCode, "follow", true); >+ redirectLocation("Redirect " + statusCode + " in \"manual\" mode without location", redirUrl, undefined, statusCode, "manual", true); >+ >+ redirectLocation("Redirect " + statusCode + " in \"follow\" mode with invalid location", redirUrl, invalidLocationUrl, statusCode, "follow", false); >+ redirectLocation("Redirect " + statusCode + " in \"manual\" mode with invalid location", redirUrl, invalidLocationUrl, statusCode, "manual", true); >+ >+ redirectLocation("Redirect " + statusCode + " in \"follow\" mode with data location", redirUrl, dataLocationUrl, statusCode, "follow", false); >+ redirectLocation("Redirect " + statusCode + " in \"manual\" mode with data location", redirUrl, dataLocationUrl, statusCode, "manual", true); >+} >+ >+done(); >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-location.any.worker-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-location.any.worker-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..5e0fc37e8b5ea11001c4f8b3c2c6be042b696b8b >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-location.any.worker-expected.txt >@@ -0,0 +1,42 @@ >+CONSOLE MESSAGE: Cross-origin redirection to invalidurl: denied by Cross-Origin Resource Sharing policy: URL is either a non-HTTP URL or contains credentials. >+CONSOLE MESSAGE: Cross-origin redirection to data:,data%20url denied by Cross-Origin Resource Sharing policy: URL is either a non-HTTP URL or contains credentials. >+CONSOLE MESSAGE: Cross-origin redirection to invalidurl: denied by Cross-Origin Resource Sharing policy: URL is either a non-HTTP URL or contains credentials. >+CONSOLE MESSAGE: Cross-origin redirection to data:,data%20url denied by Cross-Origin Resource Sharing policy: URL is either a non-HTTP URL or contains credentials. >+CONSOLE MESSAGE: Cross-origin redirection to invalidurl: denied by Cross-Origin Resource Sharing policy: URL is either a non-HTTP URL or contains credentials. >+CONSOLE MESSAGE: Cross-origin redirection to data:,data%20url denied by Cross-Origin Resource Sharing policy: URL is either a non-HTTP URL or contains credentials. >+CONSOLE MESSAGE: Cross-origin redirection to invalidurl: denied by Cross-Origin Resource Sharing policy: URL is either a non-HTTP URL or contains credentials. >+CONSOLE MESSAGE: Cross-origin redirection to data:,data%20url denied by Cross-Origin Resource Sharing policy: URL is either a non-HTTP URL or contains credentials. >+CONSOLE MESSAGE: Cross-origin redirection to invalidurl: denied by Cross-Origin Resource Sharing policy: URL is either a non-HTTP URL or contains credentials. >+CONSOLE MESSAGE: Cross-origin redirection to data:,data%20url denied by Cross-Origin Resource Sharing policy: URL is either a non-HTTP URL or contains credentials. >+ >+PASS Redirect 301 in "follow" mode without location >+FAIL Redirect 301 in "manual" mode without location assert_equals: Response's status is 0 expected 0 but got 301 >+PASS Redirect 301 in "follow" mode with invalid location >+PASS Redirect 301 in "manual" mode with invalid location >+PASS Redirect 301 in "follow" mode with data location >+PASS Redirect 301 in "manual" mode with data location >+PASS Redirect 302 in "follow" mode without location >+FAIL Redirect 302 in "manual" mode without location assert_equals: Response's status is 0 expected 0 but got 302 >+PASS Redirect 302 in "follow" mode with invalid location >+PASS Redirect 302 in "manual" mode with invalid location >+PASS Redirect 302 in "follow" mode with data location >+PASS Redirect 302 in "manual" mode with data location >+PASS Redirect 303 in "follow" mode without location >+FAIL Redirect 303 in "manual" mode without location assert_equals: Response's status is 0 expected 0 but got 303 >+PASS Redirect 303 in "follow" mode with invalid location >+PASS Redirect 303 in "manual" mode with invalid location >+PASS Redirect 303 in "follow" mode with data location >+PASS Redirect 303 in "manual" mode with data location >+PASS Redirect 307 in "follow" mode without location >+FAIL Redirect 307 in "manual" mode without location assert_equals: Response's status is 0 expected 0 but got 307 >+PASS Redirect 307 in "follow" mode with invalid location >+PASS Redirect 307 in "manual" mode with invalid location >+PASS Redirect 307 in "follow" mode with data location >+PASS Redirect 307 in "manual" mode with data location >+PASS Redirect 308 in "follow" mode without location >+FAIL Redirect 308 in "manual" mode without location assert_equals: Response's status is 0 expected 0 but got 308 >+PASS Redirect 308 in "follow" mode with invalid location >+PASS Redirect 308 in "manual" mode with invalid location >+PASS Redirect 308 in "follow" mode with data location >+PASS Redirect 308 in "manual" mode with data location >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-location.any.worker.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-location.any.worker.html >new file mode 100644 >index 0000000000000000000000000000000000000000..2382913528e693b3a5d56c660a45060980b548c3 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-location.any.worker.html >@@ -0,0 +1 @@ >+<!-- This file is required for WebKit test infrastructure to run the templated test --> >\ No newline at end of file >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-location.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-location.html >deleted file mode 100644 >index ac35dea54c479646a796c80ecee738d561e8469e..0000000000000000000000000000000000000000 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-location.html >+++ /dev/null >@@ -1,15 +0,0 @@ >-<!doctype html> >-<html> >- <head> >- <meta charset="utf-8"> >- <title>Fetch: handling Location header during redirection</title> >- <meta name="author" title="Canon Research France" href="https://www.crf.canon.fr"> >- <meta name="help" href="https://fetch.spec.whatwg.org/#http-network-or-cache-fetch"> >- <script src="/resources/testharness.js"></script> >- <script src="/resources/testharnessreport.js"></script> >- </head> >- <body> >- <script src="../resources/utils.js"></script> >- <script src="redirect-location.js"></script> >- </body> >-</html> >\ No newline at end of file >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-location.js b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-location.js >deleted file mode 100644 >index 5b9a4fe454abfbedfefd330ce8bdca5c3b4f7d52..0000000000000000000000000000000000000000 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-location.js >+++ /dev/null >@@ -1,50 +0,0 @@ >-if (this.document === undefined) { >- importScripts("/resources/testharness.js"); >- importScripts("../resources/utils.js"); >-} >- >-function redirectLocation(desc, redirectUrl, redirectLocation, redirectStatus, redirectMode, shouldPass) { >- var url = redirectUrl; >- var urlParameters = "?redirect_status=" + redirectStatus; >- if (redirectLocation) >- urlParameters += "&location=" + encodeURIComponent(redirectLocation); >- >- var requestInit = {"redirect": redirectMode}; >- >- promise_test(function(test) { >- if (redirectMode === "error" || !shouldPass) >- return promise_rejects(test, new TypeError(), fetch(url + urlParameters, requestInit)); >- if (redirectMode === "manual") >- return fetch(url + urlParameters, requestInit).then(function(resp) { >- assert_equals(resp.status, 0, "Response's status is 0"); >- assert_equals(resp.type, "opaqueredirect", "Response's type is opaqueredirect"); >- assert_equals(resp.statusText, "", "Response's statusText is \"\""); >- assert_true(resp.headers.entries().next().done, "Headers should be empty"); >- }); >- >- if (redirectMode === "follow") >- return fetch(url + urlParameters, requestInit).then(function(resp) { >- assert_equals(resp.status, redirectStatus, "Response's status is " + redirectStatus); >- }); >- assert_unreached(redirectMode + " is not a valid redirect mode"); >- }, desc); >-} >- >-var redirUrl = RESOURCES_DIR + "redirect.py"; >-var locationUrl = "top.txt"; >-var invalidLocationUrl = "invalidurl:"; >-var dataLocationUrl = "data:,data%20url"; >-// FIXME: We may want to mix redirect-mode and cors-mode. >-// FIXME: Add tests for "error" redirect-mode. >-for (var statusCode of [301, 302, 303, 307, 308]) { >- redirectLocation("Redirect " + statusCode + " in \"follow\" mode without location", redirUrl, undefined, statusCode, "follow", true); >- redirectLocation("Redirect " + statusCode + " in \"manual\" mode without location", redirUrl, undefined, statusCode, "manual", true); >- >- redirectLocation("Redirect " + statusCode + " in \"follow\" mode with invalid location", redirUrl, invalidLocationUrl, statusCode, "follow", false); >- redirectLocation("Redirect " + statusCode + " in \"manual\" mode with invalid location", redirUrl, invalidLocationUrl, statusCode, "manual", true); >- >- redirectLocation("Redirect " + statusCode + " in \"follow\" mode with data location", redirUrl, dataLocationUrl, statusCode, "follow", false); >- redirectLocation("Redirect " + statusCode + " in \"manual\" mode with data location", redirUrl, dataLocationUrl, statusCode, "manual", true); >-} >- >-done(); >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-method-worker-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-method-worker-expected.txt >deleted file mode 100644 >index ae32d5146630f4ab54bb46487700646d606dd68f..0000000000000000000000000000000000000000 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-method-worker-expected.txt >+++ /dev/null >@@ -1,16 +0,0 @@ >- >-PASS Response.redirected should be false on not-redirected responses >-PASS Redirect 301 with GET >-PASS Redirect 301 with POST >-PASS Redirect 301 with HEAD >-PASS Redirect 302 with GET >-PASS Redirect 302 with POST >-PASS Redirect 302 with HEAD >-PASS Redirect 303 with GET >-PASS Redirect 303 with POST >-PASS Redirect 303 with HEAD >-PASS Redirect 307 with GET >-PASS Redirect 307 with POST (string body) >-PASS Redirect 307 with POST (blob body) >-PASS Redirect 307 with HEAD >- >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-method-worker.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-method-worker.html >deleted file mode 100644 >index fc0bc5e529dd85e19f4028a62232243023a4b89c..0000000000000000000000000000000000000000 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-method-worker.html >+++ /dev/null >@@ -1,16 +0,0 @@ >-<!doctype html> >-<html> >- <head> >- <meta charset="utf-8"> >- <title>Fetch in worker: request method handling when redirected</title> >- <meta name="author" title="Canon Research France" href="https://www.crf.canon.fr"> >- <meta name="help" href="https://fetch.spec.whatwg.org/#http-network-or-cache-fetch"> >- <script src="/resources/testharness.js"></script> >- <script src="/resources/testharnessreport.js"></script> >- </head> >- <body> >- <script> >- fetch_tests_from_worker(new Worker("redirect-method.js")); >- </script> >- </body> >-</html> >\ No newline at end of file >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-method.any-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-method.any-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..ae32d5146630f4ab54bb46487700646d606dd68f >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-method.any-expected.txt >@@ -0,0 +1,16 @@ >+ >+PASS Response.redirected should be false on not-redirected responses >+PASS Redirect 301 with GET >+PASS Redirect 301 with POST >+PASS Redirect 301 with HEAD >+PASS Redirect 302 with GET >+PASS Redirect 302 with POST >+PASS Redirect 302 with HEAD >+PASS Redirect 303 with GET >+PASS Redirect 303 with POST >+PASS Redirect 303 with HEAD >+PASS Redirect 307 with GET >+PASS Redirect 307 with POST (string body) >+PASS Redirect 307 with POST (blob body) >+PASS Redirect 307 with HEAD >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-method.any.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-method.any.html >new file mode 100644 >index 0000000000000000000000000000000000000000..2382913528e693b3a5d56c660a45060980b548c3 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-method.any.html >@@ -0,0 +1 @@ >+<!-- This file is required for WebKit test infrastructure to run the templated test --> >\ No newline at end of file >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-method.any.js b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-method.any.js >new file mode 100644 >index 0000000000000000000000000000000000000000..056ccf847bbeffa21b705739b48d3322b13247fa >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-method.any.js >@@ -0,0 +1,68 @@ >+// META: script=../resources/utils.js >+ >+// Creates a promise_test that fetches a URL that returns a redirect response. >+// >+// |opts| has additional options: >+// |opts.body|: the request body as a string or blob (default is empty body) >+// |opts.expectedBodyAsString|: the expected response body as a string. The >+// server is expected to echo the request body. The default is the empty string >+// if the request after redirection isn't POST; otherwise it's |opts.body|. >+function redirectMethod(desc, redirectUrl, redirectLocation, redirectStatus, method, expectedMethod, opts) { >+ var url = redirectUrl; >+ var urlParameters = "?redirect_status=" + redirectStatus; >+ urlParameters += "&location=" + encodeURIComponent(redirectLocation); >+ >+ var requestInit = {"method": method, "redirect": "follow"}; >+ opts = opts || {}; >+ if (opts.body) >+ requestInit.body = opts.body; >+ >+ promise_test(function(test) { >+ return fetch(url + urlParameters, requestInit).then(function(resp) { >+ assert_equals(resp.status, 200, "Response's status is 200"); >+ assert_equals(resp.type, "basic", "Response's type basic"); >+ assert_equals(resp.headers.get("x-request-method"), expectedMethod, "Request method after redirection is " + expectedMethod); >+ assert_true(resp.redirected); >+ return resp.text().then(function(text) { >+ let expectedBody = ""; >+ if (expectedMethod == "POST") >+ expectedBody = opts.expectedBodyAsString || requestInit.body; >+ assert_equals(text, expectedBody, "request body"); >+ }); >+ }); >+ }, desc); >+} >+ >+promise_test(function(test) { >+ assert_false(new Response().redirected); >+ return fetch(RESOURCES_DIR + "method.py").then(function(resp) { >+ assert_equals(resp.status, 200, "Response's status is 200"); >+ assert_false(resp.redirected); >+ }); >+}, "Response.redirected should be false on not-redirected responses"); >+ >+var redirUrl = RESOURCES_DIR + "redirect.py"; >+var locationUrl = "method.py"; >+ >+const stringBody = "this is my body"; >+const blobBody = new Blob(["it's me the blob!", " ", "and more blob!"]); >+const blobBodyAsString = "it's me the blob! and more blob!"; >+ >+redirectMethod("Redirect 301 with GET", redirUrl, locationUrl, 301, "GET", "GET"); >+redirectMethod("Redirect 301 with POST", redirUrl, locationUrl, 301, "POST", "GET", { body: stringBody }); >+redirectMethod("Redirect 301 with HEAD", redirUrl, locationUrl, 301, "HEAD", "HEAD"); >+ >+redirectMethod("Redirect 302 with GET", redirUrl, locationUrl, 302, "GET", "GET"); >+redirectMethod("Redirect 302 with POST", redirUrl, locationUrl, 302, "POST", "GET", { body: stringBody }); >+redirectMethod("Redirect 302 with HEAD", redirUrl, locationUrl, 302, "HEAD", "HEAD"); >+ >+redirectMethod("Redirect 303 with GET", redirUrl, locationUrl, 303, "GET", "GET"); >+redirectMethod("Redirect 303 with POST", redirUrl, locationUrl, 303, "POST", "GET", { body: stringBody }); >+redirectMethod("Redirect 303 with HEAD", redirUrl, locationUrl, 303, "HEAD", "HEAD"); >+ >+redirectMethod("Redirect 307 with GET", redirUrl, locationUrl, 307, "GET", "GET"); >+redirectMethod("Redirect 307 with POST (string body)", redirUrl, locationUrl, 307, "POST", "POST", { body: stringBody }); >+redirectMethod("Redirect 307 with POST (blob body)", redirUrl, locationUrl, 307, "POST", "POST", { body: blobBody, expectedBodyAsString: blobBodyAsString }); >+redirectMethod("Redirect 307 with HEAD", redirUrl, locationUrl, 307, "HEAD", "HEAD"); >+ >+done(); >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-method.any.worker-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-method.any.worker-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..ae32d5146630f4ab54bb46487700646d606dd68f >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-method.any.worker-expected.txt >@@ -0,0 +1,16 @@ >+ >+PASS Response.redirected should be false on not-redirected responses >+PASS Redirect 301 with GET >+PASS Redirect 301 with POST >+PASS Redirect 301 with HEAD >+PASS Redirect 302 with GET >+PASS Redirect 302 with POST >+PASS Redirect 302 with HEAD >+PASS Redirect 303 with GET >+PASS Redirect 303 with POST >+PASS Redirect 303 with HEAD >+PASS Redirect 307 with GET >+PASS Redirect 307 with POST (string body) >+PASS Redirect 307 with POST (blob body) >+PASS Redirect 307 with HEAD >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-method.any.worker.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-method.any.worker.html >new file mode 100644 >index 0000000000000000000000000000000000000000..2382913528e693b3a5d56c660a45060980b548c3 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-method.any.worker.html >@@ -0,0 +1 @@ >+<!-- This file is required for WebKit test infrastructure to run the templated test --> >\ No newline at end of file >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-method.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-method.html >deleted file mode 100644 >index 028842dbe07db595339975c4bcdba7dc0f393255..0000000000000000000000000000000000000000 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-method.html >+++ /dev/null >@@ -1,15 +0,0 @@ >-<!doctype html> >-<html> >- <head> >- <meta charset="utf-8"> >- <title>Fetch: request method handling when redirected</title> >- <meta name="author" title="Canon Research France" href="https://www.crf.canon.fr"> >- <meta name="help" href="https://fetch.spec.whatwg.org/#http-network-or-cache-fetch"> >- <script src="/resources/testharness.js"></script> >- <script src="/resources/testharnessreport.js"></script> >- </head> >- <body> >- <script src="../resources/utils.js"></script> >- <script src="redirect-method.js"></script> >- </body> >-</html> >\ No newline at end of file >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-method.js b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-method.js >deleted file mode 100644 >index 0a7f2df2c2bdd7a5ff17f9a0062789590ee9e03b..0000000000000000000000000000000000000000 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-method.js >+++ /dev/null >@@ -1,71 +0,0 @@ >-if (this.document === undefined) { >- importScripts("/resources/testharness.js"); >- importScripts("../resources/utils.js"); >-} >- >-// Creates a promise_test that fetches a URL that returns a redirect response. >-// >-// |opts| has additional options: >-// |opts.body|: the request body as a string or blob (default is empty body) >-// |opts.expectedBodyAsString|: the expected response body as a string. The >-// server is expected to echo the request body. The default is the empty string >-// if the request after redirection isn't POST; otherwise it's |opts.body|. >-function redirectMethod(desc, redirectUrl, redirectLocation, redirectStatus, method, expectedMethod, opts) { >- var url = redirectUrl; >- var urlParameters = "?redirect_status=" + redirectStatus; >- urlParameters += "&location=" + encodeURIComponent(redirectLocation); >- >- var requestInit = {"method": method, "redirect": "follow"}; >- opts = opts || {}; >- if (opts.body) >- requestInit.body = opts.body; >- >- promise_test(function(test) { >- return fetch(url + urlParameters, requestInit).then(function(resp) { >- assert_equals(resp.status, 200, "Response's status is 200"); >- assert_equals(resp.type, "basic", "Response's type basic"); >- assert_equals(resp.headers.get("x-request-method"), expectedMethod, "Request method after redirection is " + expectedMethod); >- assert_true(resp.redirected); >- return resp.text().then(function(text) { >- let expectedBody = ""; >- if (expectedMethod == "POST") >- expectedBody = opts.expectedBodyAsString || requestInit.body; >- assert_equals(text, expectedBody, "request body"); >- }); >- }); >- }, desc); >-} >- >-promise_test(function(test) { >- assert_false(new Response().redirected); >- return fetch(RESOURCES_DIR + "method.py").then(function(resp) { >- assert_equals(resp.status, 200, "Response's status is 200"); >- assert_false(resp.redirected); >- }); >-}, "Response.redirected should be false on not-redirected responses"); >- >-var redirUrl = RESOURCES_DIR + "redirect.py"; >-var locationUrl = "method.py"; >- >-const stringBody = "this is my body"; >-const blobBody = new Blob(["it's me the blob!", " ", "and more blob!"]); >-const blobBodyAsString = "it's me the blob! and more blob!"; >- >-redirectMethod("Redirect 301 with GET", redirUrl, locationUrl, 301, "GET", "GET"); >-redirectMethod("Redirect 301 with POST", redirUrl, locationUrl, 301, "POST", "GET", { body: stringBody }); >-redirectMethod("Redirect 301 with HEAD", redirUrl, locationUrl, 301, "HEAD", "HEAD"); >- >-redirectMethod("Redirect 302 with GET", redirUrl, locationUrl, 302, "GET", "GET"); >-redirectMethod("Redirect 302 with POST", redirUrl, locationUrl, 302, "POST", "GET", { body: stringBody }); >-redirectMethod("Redirect 302 with HEAD", redirUrl, locationUrl, 302, "HEAD", "HEAD"); >- >-redirectMethod("Redirect 303 with GET", redirUrl, locationUrl, 303, "GET", "GET"); >-redirectMethod("Redirect 303 with POST", redirUrl, locationUrl, 303, "POST", "GET", { body: stringBody }); >-redirectMethod("Redirect 303 with HEAD", redirUrl, locationUrl, 303, "HEAD", "HEAD"); >- >-redirectMethod("Redirect 307 with GET", redirUrl, locationUrl, 307, "GET", "GET"); >-redirectMethod("Redirect 307 with POST (string body)", redirUrl, locationUrl, 307, "POST", "POST", { body: stringBody }); >-redirectMethod("Redirect 307 with POST (blob body)", redirUrl, locationUrl, 307, "POST", "POST", { body: blobBody, expectedBodyAsString: blobBodyAsString }); >-redirectMethod("Redirect 307 with HEAD", redirUrl, locationUrl, 307, "HEAD", "HEAD"); >- >-done(); >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-mode-worker-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-mode-worker-expected.txt >deleted file mode 100644 >index dddda6908fb4606f9fab9c065b43dc450690102a..0000000000000000000000000000000000000000 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-mode-worker-expected.txt >+++ /dev/null >@@ -1,17 +0,0 @@ >- >-PASS Redirect 301 in "error" mode >-PASS Redirect 301 in "follow" mode >-PASS Redirect 301 in "manual" mode >-PASS Redirect 302 in "error" mode >-PASS Redirect 302 in "follow" mode >-PASS Redirect 302 in "manual" mode >-PASS Redirect 303 in "error" mode >-PASS Redirect 303 in "follow" mode >-PASS Redirect 303 in "manual" mode >-PASS Redirect 307 in "error" mode >-PASS Redirect 307 in "follow" mode >-PASS Redirect 307 in "manual" mode >-PASS Redirect 308 in "error" mode >-PASS Redirect 308 in "follow" mode >-PASS Redirect 308 in "manual" mode >- >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-mode-worker.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-mode-worker.html >deleted file mode 100644 >index 32d219f7678d73079657ef343c900f053e9bc169..0000000000000000000000000000000000000000 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-mode-worker.html >+++ /dev/null >@@ -1,17 +0,0 @@ >-<!doctype html> >-<html> >- <head> >- <meta charset="utf-8"> >- <title>Fetch in worker: redirect mode handling</title> >- <meta name="author" title="Canon Research France" href="https://www.crf.canon.fr"> >- <meta name="help" href="https://fetch.spec.whatwg.org/#concept-filtered-response-opaque-redirect"> >- <meta name="help" href="https://fetch.spec.whatwg.org/#http-network-or-cache-fetch"> >- <script src="/resources/testharness.js"></script> >- <script src="/resources/testharnessreport.js"></script> >- </head> >- <body> >- <script> >- fetch_tests_from_worker(new Worker("redirect-mode.js")); >- </script> >- </body> >-</html> >\ No newline at end of file >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-mode.any-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-mode.any-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..7915060938bd3008229defb26003f0784fa7aa57 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-mode.any-expected.txt >@@ -0,0 +1,132 @@ >+CONSOLE MESSAGE: Not allowed to follow a redirection while loading http://localhost:8800/fetch/api/resources/redirect.py?redirect_status=301&location=cors-top.txt >+CONSOLE MESSAGE: Fetch API cannot load http://localhost:8800/fetch/api/resources/redirect.py?redirect_status=301&location=cors-top.txt due to access control checks. >+CONSOLE MESSAGE: line 19: No-Cors mode requires follow redirect mode >+CONSOLE MESSAGE: line 19: Not allowed to request resource >+CONSOLE MESSAGE: line 19: Fetch API cannot load http://localhost:8800/fetch/api/resources/redirect.py?redirect_status=301&location=cors-top.txt due to access control checks. >+CONSOLE MESSAGE: line 21: No-Cors mode requires follow redirect mode >+CONSOLE MESSAGE: line 21: Not allowed to request resource >+CONSOLE MESSAGE: line 21: Fetch API cannot load http://localhost:8800/fetch/api/resources/redirect.py?redirect_status=301&location=cors-top.txt due to access control checks. >+CONSOLE MESSAGE: Not allowed to follow a redirection while loading http://localhost:8800/fetch/api/resources/redirect.py?redirect_status=302&location=cors-top.txt >+CONSOLE MESSAGE: Fetch API cannot load http://localhost:8800/fetch/api/resources/redirect.py?redirect_status=302&location=cors-top.txt due to access control checks. >+CONSOLE MESSAGE: line 19: No-Cors mode requires follow redirect mode >+CONSOLE MESSAGE: line 19: Not allowed to request resource >+CONSOLE MESSAGE: line 19: Fetch API cannot load http://localhost:8800/fetch/api/resources/redirect.py?redirect_status=302&location=cors-top.txt due to access control checks. >+CONSOLE MESSAGE: line 21: No-Cors mode requires follow redirect mode >+CONSOLE MESSAGE: line 21: Not allowed to request resource >+CONSOLE MESSAGE: line 21: Fetch API cannot load http://localhost:8800/fetch/api/resources/redirect.py?redirect_status=302&location=cors-top.txt due to access control checks. >+CONSOLE MESSAGE: Not allowed to follow a redirection while loading http://localhost:8800/fetch/api/resources/redirect.py?redirect_status=303&location=cors-top.txt >+CONSOLE MESSAGE: Fetch API cannot load http://localhost:8800/fetch/api/resources/redirect.py?redirect_status=303&location=cors-top.txt due to access control checks. >+CONSOLE MESSAGE: line 19: No-Cors mode requires follow redirect mode >+CONSOLE MESSAGE: line 19: Not allowed to request resource >+CONSOLE MESSAGE: line 19: Fetch API cannot load http://localhost:8800/fetch/api/resources/redirect.py?redirect_status=303&location=cors-top.txt due to access control checks. >+CONSOLE MESSAGE: line 21: No-Cors mode requires follow redirect mode >+CONSOLE MESSAGE: line 21: Not allowed to request resource >+CONSOLE MESSAGE: line 21: Fetch API cannot load http://localhost:8800/fetch/api/resources/redirect.py?redirect_status=303&location=cors-top.txt due to access control checks. >+CONSOLE MESSAGE: Not allowed to follow a redirection while loading http://localhost:8800/fetch/api/resources/redirect.py?redirect_status=307&location=cors-top.txt >+CONSOLE MESSAGE: Fetch API cannot load http://localhost:8800/fetch/api/resources/redirect.py?redirect_status=307&location=cors-top.txt due to access control checks. >+CONSOLE MESSAGE: line 19: No-Cors mode requires follow redirect mode >+CONSOLE MESSAGE: line 19: Not allowed to request resource >+CONSOLE MESSAGE: line 19: Fetch API cannot load http://localhost:8800/fetch/api/resources/redirect.py?redirect_status=307&location=cors-top.txt due to access control checks. >+CONSOLE MESSAGE: line 21: No-Cors mode requires follow redirect mode >+CONSOLE MESSAGE: line 21: Not allowed to request resource >+CONSOLE MESSAGE: line 21: Fetch API cannot load http://localhost:8800/fetch/api/resources/redirect.py?redirect_status=307&location=cors-top.txt due to access control checks. >+CONSOLE MESSAGE: Not allowed to follow a redirection while loading http://localhost:8800/fetch/api/resources/redirect.py?redirect_status=308&location=cors-top.txt >+CONSOLE MESSAGE: Fetch API cannot load http://localhost:8800/fetch/api/resources/redirect.py?redirect_status=308&location=cors-top.txt due to access control checks. >+CONSOLE MESSAGE: line 19: No-Cors mode requires follow redirect mode >+CONSOLE MESSAGE: line 19: Not allowed to request resource >+CONSOLE MESSAGE: line 19: Fetch API cannot load http://localhost:8800/fetch/api/resources/redirect.py?redirect_status=308&location=cors-top.txt due to access control checks. >+CONSOLE MESSAGE: line 21: No-Cors mode requires follow redirect mode >+CONSOLE MESSAGE: line 21: Not allowed to request resource >+CONSOLE MESSAGE: line 21: Fetch API cannot load http://localhost:8800/fetch/api/resources/redirect.py?redirect_status=308&location=cors-top.txt due to access control checks. >+CONSOLE MESSAGE: line 19: No-Cors mode requires follow redirect mode >+CONSOLE MESSAGE: line 19: Not allowed to request resource >+CONSOLE MESSAGE: line 19: Fetch API cannot load http://127.0.0.1/fetch/api/resources/redirect.py?redirect_status=301&location=cors-top.txt due to access control checks. >+CONSOLE MESSAGE: line 19: No-Cors mode requires follow redirect mode >+CONSOLE MESSAGE: line 19: Not allowed to request resource >+CONSOLE MESSAGE: line 19: Fetch API cannot load http://127.0.0.1/fetch/api/resources/redirect.py?redirect_status=301&location=cors-top.txt due to access control checks. >+CONSOLE MESSAGE: line 19: No-Cors mode requires follow redirect mode >+CONSOLE MESSAGE: line 19: Not allowed to request resource >+CONSOLE MESSAGE: line 19: Fetch API cannot load http://127.0.0.1/fetch/api/resources/redirect.py?redirect_status=302&location=cors-top.txt due to access control checks. >+CONSOLE MESSAGE: line 19: No-Cors mode requires follow redirect mode >+CONSOLE MESSAGE: line 19: Not allowed to request resource >+CONSOLE MESSAGE: line 19: Fetch API cannot load http://127.0.0.1/fetch/api/resources/redirect.py?redirect_status=302&location=cors-top.txt due to access control checks. >+CONSOLE MESSAGE: line 19: No-Cors mode requires follow redirect mode >+CONSOLE MESSAGE: line 19: Not allowed to request resource >+CONSOLE MESSAGE: line 19: Fetch API cannot load http://127.0.0.1/fetch/api/resources/redirect.py?redirect_status=303&location=cors-top.txt due to access control checks. >+CONSOLE MESSAGE: line 19: No-Cors mode requires follow redirect mode >+CONSOLE MESSAGE: line 19: Not allowed to request resource >+CONSOLE MESSAGE: line 19: Fetch API cannot load http://127.0.0.1/fetch/api/resources/redirect.py?redirect_status=303&location=cors-top.txt due to access control checks. >+CONSOLE MESSAGE: line 19: No-Cors mode requires follow redirect mode >+CONSOLE MESSAGE: line 19: Not allowed to request resource >+CONSOLE MESSAGE: line 19: Fetch API cannot load http://127.0.0.1/fetch/api/resources/redirect.py?redirect_status=307&location=cors-top.txt due to access control checks. >+CONSOLE MESSAGE: line 19: No-Cors mode requires follow redirect mode >+CONSOLE MESSAGE: line 19: Not allowed to request resource >+CONSOLE MESSAGE: line 19: Fetch API cannot load http://127.0.0.1/fetch/api/resources/redirect.py?redirect_status=307&location=cors-top.txt due to access control checks. >+CONSOLE MESSAGE: line 19: No-Cors mode requires follow redirect mode >+CONSOLE MESSAGE: line 19: Not allowed to request resource >+CONSOLE MESSAGE: line 19: Fetch API cannot load http://127.0.0.1/fetch/api/resources/redirect.py?redirect_status=308&location=cors-top.txt due to access control checks. >+CONSOLE MESSAGE: line 19: No-Cors mode requires follow redirect mode >+CONSOLE MESSAGE: line 19: Not allowed to request resource >+CONSOLE MESSAGE: line 19: Fetch API cannot load http://127.0.0.1/fetch/api/resources/redirect.py?redirect_status=308&location=cors-top.txt due to access control checks. >+ >+PASS same-origin redirect 301 in error redirect and cors mode >+PASS same-origin redirect 301 in error redirect and no-cors mode >+PASS same-origin redirect 301 in manual redirect and cors mode >+FAIL same-origin redirect 301 in manual redirect and no-cors mode promise_test: Unhandled rejection with value: object "TypeError: Not allowed to request resource" >+PASS same-origin redirect 301 in follow redirect and cors mode >+PASS same-origin redirect 301 in follow redirect and no-cors mode >+PASS same-origin redirect 302 in error redirect and cors mode >+PASS same-origin redirect 302 in error redirect and no-cors mode >+PASS same-origin redirect 302 in manual redirect and cors mode >+FAIL same-origin redirect 302 in manual redirect and no-cors mode promise_test: Unhandled rejection with value: object "TypeError: Not allowed to request resource" >+PASS same-origin redirect 302 in follow redirect and cors mode >+PASS same-origin redirect 302 in follow redirect and no-cors mode >+PASS same-origin redirect 303 in error redirect and cors mode >+PASS same-origin redirect 303 in error redirect and no-cors mode >+PASS same-origin redirect 303 in manual redirect and cors mode >+FAIL same-origin redirect 303 in manual redirect and no-cors mode promise_test: Unhandled rejection with value: object "TypeError: Not allowed to request resource" >+PASS same-origin redirect 303 in follow redirect and cors mode >+PASS same-origin redirect 303 in follow redirect and no-cors mode >+PASS same-origin redirect 307 in error redirect and cors mode >+PASS same-origin redirect 307 in error redirect and no-cors mode >+PASS same-origin redirect 307 in manual redirect and cors mode >+FAIL same-origin redirect 307 in manual redirect and no-cors mode promise_test: Unhandled rejection with value: object "TypeError: Not allowed to request resource" >+PASS same-origin redirect 307 in follow redirect and cors mode >+PASS same-origin redirect 307 in follow redirect and no-cors mode >+PASS same-origin redirect 308 in error redirect and cors mode >+PASS same-origin redirect 308 in error redirect and no-cors mode >+PASS same-origin redirect 308 in manual redirect and cors mode >+FAIL same-origin redirect 308 in manual redirect and no-cors mode promise_test: Unhandled rejection with value: object "TypeError: Not allowed to request resource" >+PASS same-origin redirect 308 in follow redirect and cors mode >+PASS same-origin redirect 308 in follow redirect and no-cors mode >+PASS cross-origin redirect 301 in error redirect and cors mode >+PASS cross-origin redirect 301 in error redirect and no-cors mode >+FAIL cross-origin redirect 301 in manual redirect and cors mode promise_test: Unhandled rejection with value: object "TypeError: Could not connect to the server." >+PASS cross-origin redirect 301 in manual redirect and no-cors mode >+FAIL cross-origin redirect 301 in follow redirect and cors mode promise_test: Unhandled rejection with value: object "TypeError: Could not connect to the server." >+FAIL cross-origin redirect 301 in follow redirect and no-cors mode promise_test: Unhandled rejection with value: object "TypeError: Could not connect to the server." >+PASS cross-origin redirect 302 in error redirect and cors mode >+PASS cross-origin redirect 302 in error redirect and no-cors mode >+FAIL cross-origin redirect 302 in manual redirect and cors mode promise_test: Unhandled rejection with value: object "TypeError: Could not connect to the server." >+PASS cross-origin redirect 302 in manual redirect and no-cors mode >+FAIL cross-origin redirect 302 in follow redirect and cors mode promise_test: Unhandled rejection with value: object "TypeError: Could not connect to the server." >+FAIL cross-origin redirect 302 in follow redirect and no-cors mode promise_test: Unhandled rejection with value: object "TypeError: Could not connect to the server." >+PASS cross-origin redirect 303 in error redirect and cors mode >+PASS cross-origin redirect 303 in error redirect and no-cors mode >+FAIL cross-origin redirect 303 in manual redirect and cors mode promise_test: Unhandled rejection with value: object "TypeError: Could not connect to the server." >+PASS cross-origin redirect 303 in manual redirect and no-cors mode >+FAIL cross-origin redirect 303 in follow redirect and cors mode promise_test: Unhandled rejection with value: object "TypeError: Could not connect to the server." >+FAIL cross-origin redirect 303 in follow redirect and no-cors mode promise_test: Unhandled rejection with value: object "TypeError: Could not connect to the server." >+PASS cross-origin redirect 307 in error redirect and cors mode >+PASS cross-origin redirect 307 in error redirect and no-cors mode >+FAIL cross-origin redirect 307 in manual redirect and cors mode promise_test: Unhandled rejection with value: object "TypeError: Could not connect to the server." >+PASS cross-origin redirect 307 in manual redirect and no-cors mode >+FAIL cross-origin redirect 307 in follow redirect and cors mode promise_test: Unhandled rejection with value: object "TypeError: Could not connect to the server." >+FAIL cross-origin redirect 307 in follow redirect and no-cors mode promise_test: Unhandled rejection with value: object "TypeError: Could not connect to the server." >+PASS cross-origin redirect 308 in error redirect and cors mode >+PASS cross-origin redirect 308 in error redirect and no-cors mode >+FAIL cross-origin redirect 308 in manual redirect and cors mode promise_test: Unhandled rejection with value: object "TypeError: Could not connect to the server." >+PASS cross-origin redirect 308 in manual redirect and no-cors mode >+FAIL cross-origin redirect 308 in follow redirect and cors mode promise_test: Unhandled rejection with value: object "TypeError: Could not connect to the server." >+FAIL cross-origin redirect 308 in follow redirect and no-cors mode promise_test: Unhandled rejection with value: object "TypeError: Could not connect to the server." >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-mode.any.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-mode.any.html >new file mode 100644 >index 0000000000000000000000000000000000000000..2382913528e693b3a5d56c660a45060980b548c3 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-mode.any.html >@@ -0,0 +1 @@ >+<!-- This file is required for WebKit test infrastructure to run the templated test --> >\ No newline at end of file >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-mode.any.js b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-mode.any.js >new file mode 100644 >index 0000000000000000000000000000000000000000..7d34fa61a96bf6e92b39451e073044ef194a7cbf >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-mode.any.js >@@ -0,0 +1,49 @@ >+// META: script=/common/get-host-info.sub.js >+ >+var redirectLocation = "cors-top.txt"; >+ >+function testRedirect(origin, redirectStatus, redirectMode, corsMode) { >+ var url = new URL("../resources/redirect.py", self.location); >+ if (origin === "cross-origin") { >+ url.host = get_host_info().REMOTE_HOST; >+ } >+ >+ var urlParameters = "?redirect_status=" + redirectStatus; >+ urlParameters += "&location=" + encodeURIComponent(redirectLocation); >+ >+ var requestInit = {redirect: redirectMode, mode: corsMode}; >+ >+ promise_test(function(test) { >+ if (redirectMode === "error" || >+ (corsMode === "no-cors" && redirectMode !== "follow" && origin !== "same-origin")) >+ return promise_rejects(test, new TypeError(), fetch(url + urlParameters, requestInit)); >+ if (redirectMode === "manual") >+ return fetch(url + urlParameters, requestInit).then(function(resp) { >+ assert_equals(resp.status, 0, "Response's status is 0"); >+ assert_equals(resp.type, "opaqueredirect", "Response's type is opaqueredirect"); >+ assert_equals(resp.statusText, "", "Response's statusText is \"\""); >+ assert_equals(resp.url, url + urlParameters, "Response URL should be the original one"); >+ }); >+ if (redirectMode === "follow") >+ return fetch(url + urlParameters, requestInit).then(function(resp) { >+ if (corsMode !== "no-cors" || origin === "same-origin") { >+ assert_true(new URL(resp.url).pathname.endsWith(redirectLocation), "Response's url should be the redirected one"); >+ assert_equals(resp.status, 200, "Response's status is 200"); >+ } else { >+ assert_equals(resp.type, "opaque", "Response is opaque"); >+ } >+ }); >+ assert_unreached(redirectMode + " is no a valid redirect mode"); >+ }, origin + " redirect " + redirectStatus + " in " + redirectMode + " redirect and " + corsMode + " mode"); >+} >+ >+for (var origin of ["same-origin", "cross-origin"]) { >+ for (var statusCode of [301, 302, 303, 307, 308]) { >+ for (var redirect of ["error", "manual", "follow"]) { >+ for (var mode of ["cors", "no-cors"]) >+ testRedirect(origin, statusCode, redirect, mode); >+ } >+ } >+} >+ >+done(); >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-mode.any.worker-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-mode.any.worker-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..c979af140ae30439bc3ce9077e111b0197a04961 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-mode.any.worker-expected.txt >@@ -0,0 +1,87 @@ >+CONSOLE MESSAGE: Not allowed to follow a redirection while loading http://localhost:8800/fetch/api/resources/redirect.py?redirect_status=301&location=cors-top.txt >+CONSOLE MESSAGE: No-Cors mode requires follow redirect mode >+CONSOLE MESSAGE: No-Cors mode requires follow redirect mode >+CONSOLE MESSAGE: Not allowed to follow a redirection while loading http://localhost:8800/fetch/api/resources/redirect.py?redirect_status=302&location=cors-top.txt >+CONSOLE MESSAGE: No-Cors mode requires follow redirect mode >+CONSOLE MESSAGE: No-Cors mode requires follow redirect mode >+CONSOLE MESSAGE: Not allowed to follow a redirection while loading http://localhost:8800/fetch/api/resources/redirect.py?redirect_status=303&location=cors-top.txt >+CONSOLE MESSAGE: No-Cors mode requires follow redirect mode >+CONSOLE MESSAGE: No-Cors mode requires follow redirect mode >+CONSOLE MESSAGE: Not allowed to follow a redirection while loading http://localhost:8800/fetch/api/resources/redirect.py?redirect_status=307&location=cors-top.txt >+CONSOLE MESSAGE: No-Cors mode requires follow redirect mode >+CONSOLE MESSAGE: No-Cors mode requires follow redirect mode >+CONSOLE MESSAGE: Not allowed to follow a redirection while loading http://localhost:8800/fetch/api/resources/redirect.py?redirect_status=308&location=cors-top.txt >+CONSOLE MESSAGE: No-Cors mode requires follow redirect mode >+CONSOLE MESSAGE: No-Cors mode requires follow redirect mode >+CONSOLE MESSAGE: No-Cors mode requires follow redirect mode >+CONSOLE MESSAGE: No-Cors mode requires follow redirect mode >+CONSOLE MESSAGE: No-Cors mode requires follow redirect mode >+CONSOLE MESSAGE: No-Cors mode requires follow redirect mode >+CONSOLE MESSAGE: No-Cors mode requires follow redirect mode >+CONSOLE MESSAGE: No-Cors mode requires follow redirect mode >+CONSOLE MESSAGE: No-Cors mode requires follow redirect mode >+CONSOLE MESSAGE: No-Cors mode requires follow redirect mode >+CONSOLE MESSAGE: No-Cors mode requires follow redirect mode >+CONSOLE MESSAGE: No-Cors mode requires follow redirect mode >+ >+PASS same-origin redirect 301 in error redirect and cors mode >+PASS same-origin redirect 301 in error redirect and no-cors mode >+PASS same-origin redirect 301 in manual redirect and cors mode >+FAIL same-origin redirect 301 in manual redirect and no-cors mode promise_test: Unhandled rejection with value: object "TypeError: Not allowed to request resource" >+PASS same-origin redirect 301 in follow redirect and cors mode >+PASS same-origin redirect 301 in follow redirect and no-cors mode >+PASS same-origin redirect 302 in error redirect and cors mode >+PASS same-origin redirect 302 in error redirect and no-cors mode >+PASS same-origin redirect 302 in manual redirect and cors mode >+FAIL same-origin redirect 302 in manual redirect and no-cors mode promise_test: Unhandled rejection with value: object "TypeError: Not allowed to request resource" >+PASS same-origin redirect 302 in follow redirect and cors mode >+PASS same-origin redirect 302 in follow redirect and no-cors mode >+PASS same-origin redirect 303 in error redirect and cors mode >+PASS same-origin redirect 303 in error redirect and no-cors mode >+PASS same-origin redirect 303 in manual redirect and cors mode >+FAIL same-origin redirect 303 in manual redirect and no-cors mode promise_test: Unhandled rejection with value: object "TypeError: Not allowed to request resource" >+PASS same-origin redirect 303 in follow redirect and cors mode >+PASS same-origin redirect 303 in follow redirect and no-cors mode >+PASS same-origin redirect 307 in error redirect and cors mode >+PASS same-origin redirect 307 in error redirect and no-cors mode >+PASS same-origin redirect 307 in manual redirect and cors mode >+FAIL same-origin redirect 307 in manual redirect and no-cors mode promise_test: Unhandled rejection with value: object "TypeError: Not allowed to request resource" >+PASS same-origin redirect 307 in follow redirect and cors mode >+PASS same-origin redirect 307 in follow redirect and no-cors mode >+PASS same-origin redirect 308 in error redirect and cors mode >+PASS same-origin redirect 308 in error redirect and no-cors mode >+PASS same-origin redirect 308 in manual redirect and cors mode >+FAIL same-origin redirect 308 in manual redirect and no-cors mode promise_test: Unhandled rejection with value: object "TypeError: Not allowed to request resource" >+PASS same-origin redirect 308 in follow redirect and cors mode >+PASS same-origin redirect 308 in follow redirect and no-cors mode >+PASS cross-origin redirect 301 in error redirect and cors mode >+PASS cross-origin redirect 301 in error redirect and no-cors mode >+FAIL cross-origin redirect 301 in manual redirect and cors mode promise_test: Unhandled rejection with value: object "TypeError: Could not connect to the server." >+PASS cross-origin redirect 301 in manual redirect and no-cors mode >+FAIL cross-origin redirect 301 in follow redirect and cors mode promise_test: Unhandled rejection with value: object "TypeError: Could not connect to the server." >+FAIL cross-origin redirect 301 in follow redirect and no-cors mode promise_test: Unhandled rejection with value: object "TypeError: Could not connect to the server." >+PASS cross-origin redirect 302 in error redirect and cors mode >+PASS cross-origin redirect 302 in error redirect and no-cors mode >+FAIL cross-origin redirect 302 in manual redirect and cors mode promise_test: Unhandled rejection with value: object "TypeError: Could not connect to the server." >+PASS cross-origin redirect 302 in manual redirect and no-cors mode >+FAIL cross-origin redirect 302 in follow redirect and cors mode promise_test: Unhandled rejection with value: object "TypeError: Could not connect to the server." >+FAIL cross-origin redirect 302 in follow redirect and no-cors mode promise_test: Unhandled rejection with value: object "TypeError: Could not connect to the server." >+PASS cross-origin redirect 303 in error redirect and cors mode >+PASS cross-origin redirect 303 in error redirect and no-cors mode >+FAIL cross-origin redirect 303 in manual redirect and cors mode promise_test: Unhandled rejection with value: object "TypeError: Could not connect to the server." >+PASS cross-origin redirect 303 in manual redirect and no-cors mode >+FAIL cross-origin redirect 303 in follow redirect and cors mode promise_test: Unhandled rejection with value: object "TypeError: Could not connect to the server." >+FAIL cross-origin redirect 303 in follow redirect and no-cors mode promise_test: Unhandled rejection with value: object "TypeError: Could not connect to the server." >+PASS cross-origin redirect 307 in error redirect and cors mode >+PASS cross-origin redirect 307 in error redirect and no-cors mode >+FAIL cross-origin redirect 307 in manual redirect and cors mode promise_test: Unhandled rejection with value: object "TypeError: Could not connect to the server." >+PASS cross-origin redirect 307 in manual redirect and no-cors mode >+FAIL cross-origin redirect 307 in follow redirect and cors mode promise_test: Unhandled rejection with value: object "TypeError: Could not connect to the server." >+FAIL cross-origin redirect 307 in follow redirect and no-cors mode promise_test: Unhandled rejection with value: object "TypeError: Could not connect to the server." >+PASS cross-origin redirect 308 in error redirect and cors mode >+PASS cross-origin redirect 308 in error redirect and no-cors mode >+FAIL cross-origin redirect 308 in manual redirect and cors mode promise_test: Unhandled rejection with value: object "TypeError: Could not connect to the server." >+PASS cross-origin redirect 308 in manual redirect and no-cors mode >+FAIL cross-origin redirect 308 in follow redirect and cors mode promise_test: Unhandled rejection with value: object "TypeError: Could not connect to the server." >+FAIL cross-origin redirect 308 in follow redirect and no-cors mode promise_test: Unhandled rejection with value: object "TypeError: Could not connect to the server." >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-mode.any.worker.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-mode.any.worker.html >new file mode 100644 >index 0000000000000000000000000000000000000000..2382913528e693b3a5d56c660a45060980b548c3 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-mode.any.worker.html >@@ -0,0 +1 @@ >+<!-- This file is required for WebKit test infrastructure to run the templated test --> >\ No newline at end of file >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-mode.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-mode.html >deleted file mode 100644 >index 20a0cd68a6cf6b6a19474db7462acf0877158441..0000000000000000000000000000000000000000 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-mode.html >+++ /dev/null >@@ -1,16 +0,0 @@ >-<!doctype html> >-<html> >- <head> >- <meta charset="utf-8"> >- <title>Fetch: redirect mode handling</title> >- <meta name="author" title="Canon Research France" href="https://www.crf.canon.fr"> >- <meta name="help" href="https://fetch.spec.whatwg.org/#concept-filtered-response-opaque-redirect"> >- <meta name="help" href="https://fetch.spec.whatwg.org/#http-network-or-cache-fetch"> >- <script src="/resources/testharness.js"></script> >- <script src="/resources/testharnessreport.js"></script> >- </head> >- <body> >- <script src="/common/get-host-info.sub.js"></script> >- <script src="redirect-mode.js"></script> >- </body> >-</html> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-mode.js b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-mode.js >deleted file mode 100644 >index b59a8d57b0df7bacb12f2e13e4337e3c5d469e4b..0000000000000000000000000000000000000000 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-mode.js >+++ /dev/null >@@ -1,41 +0,0 @@ >-if (this.document === undefined) { >- importScripts("/resources/testharness.js"); >- importScripts("/common/get-host-info.sub.js") >-} >- >-function redirectMode(desc, redirectUrl, redirectLocation, redirectStatus, redirectMode) { >- var url = redirectUrl; >- var urlParameters = "?redirect_status=" + redirectStatus; >- urlParameters += "&location=" + encodeURIComponent(redirectLocation); >- >- var requestInit = {"redirect": redirectMode}; >- >- promise_test(function(test) { >- if (redirectMode === "error") >- return promise_rejects(test, new TypeError(), fetch(url + urlParameters, requestInit)); >- if (redirectMode === "manual") >- return fetch(url + urlParameters, requestInit).then(function(resp) { >- assert_equals(resp.status, 0, "Response's status is 0"); >- assert_equals(resp.type, "opaqueredirect", "Response's type is opaqueredirect"); >- assert_equals(resp.statusText, "", "Response's statusText is \"\""); >- assert_equals(resp.url, url + urlParameters, "Response URL should be the original one"); >- }); >- if (redirectMode === "follow") >- return fetch(url + urlParameters, requestInit).then(function(resp) { >- assert_true(new URL(resp.url).pathname.endsWith(locationUrl), "Response's url should be the redirected one"); >- assert_equals(resp.status, 200, "Response's status is 200"); >- }); >- assert_unreached(redirectMode + " is no a valid redirect mode"); >- }, desc); >-} >- >-var redirUrl = get_host_info().HTTP_ORIGIN + "/fetch/api/resources/redirect.py"; >-var locationUrl = "top.txt"; >- >-for (var statusCode of [301, 302, 303, 307, 308]) { >- redirectMode("Redirect " + statusCode + " in \"error\" mode ", redirUrl, locationUrl, statusCode, "error"); >- redirectMode("Redirect " + statusCode + " in \"follow\" mode ", redirUrl, locationUrl, statusCode, "follow"); >- redirectMode("Redirect " + statusCode + " in \"manual\" mode ", redirUrl, locationUrl, statusCode, "manual"); >-} >- >-done(); >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-origin-worker-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-origin-worker-expected.txt >deleted file mode 100644 >index 2c76b620856b4c5884029e20884e8823f918c966..0000000000000000000000000000000000000000 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-origin-worker-expected.txt >+++ /dev/null >@@ -1,22 +0,0 @@ >- >-PASS Same origin to same origin redirection 301 >-PASS Same origin to other origin redirection 301 >-PASS Other origin to other origin redirection 301 >-PASS Other origin to same origin redirection 301 >-PASS Same origin to same origin redirection 302 >-PASS Same origin to other origin redirection 302 >-PASS Other origin to other origin redirection 302 >-PASS Other origin to same origin redirection 302 >-PASS Same origin to same origin redirection 303 >-PASS Same origin to other origin redirection 303 >-PASS Other origin to other origin redirection 303 >-PASS Other origin to same origin redirection 303 >-PASS Same origin to same origin redirection 307 >-PASS Same origin to other origin redirection 307 >-PASS Other origin to other origin redirection 307 >-PASS Other origin to same origin redirection 307 >-PASS Same origin to same origin redirection 308 >-PASS Same origin to other origin redirection 308 >-PASS Other origin to other origin redirection 308 >-PASS Other origin to same origin redirection 308 >- >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-origin-worker.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-origin-worker.html >deleted file mode 100644 >index fdb542237d9df056d819d28f8574d492fc901650..0000000000000000000000000000000000000000 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-origin-worker.html >+++ /dev/null >@@ -1,17 +0,0 @@ >-<!doctype html> >-<html> >- <head> >- <meta charset="utf-8"> >- <title>Fetch in worker: redirect mode handling</title> >- <meta name="author" title="Canon Research France" href="https://www.crf.canon.fr"> >- <meta name="help" href="https://fetch.spec.whatwg.org/#concept-filtered-response-opaque-redirect"> >- <meta name="help" href="https://fetch.spec.whatwg.org/#http-network-or-cache-fetch"> >- <script src="/resources/testharness.js"></script> >- <script src="/resources/testharnessreport.js"></script> >- </head> >- <body> >- <script> >- fetch_tests_from_worker(new Worker("redirect-origin.js")); >- </script> >- </body> >-</html> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-origin.any-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-origin.any-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..2c76b620856b4c5884029e20884e8823f918c966 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-origin.any-expected.txt >@@ -0,0 +1,22 @@ >+ >+PASS Same origin to same origin redirection 301 >+PASS Same origin to other origin redirection 301 >+PASS Other origin to other origin redirection 301 >+PASS Other origin to same origin redirection 301 >+PASS Same origin to same origin redirection 302 >+PASS Same origin to other origin redirection 302 >+PASS Other origin to other origin redirection 302 >+PASS Other origin to same origin redirection 302 >+PASS Same origin to same origin redirection 303 >+PASS Same origin to other origin redirection 303 >+PASS Other origin to other origin redirection 303 >+PASS Other origin to same origin redirection 303 >+PASS Same origin to same origin redirection 307 >+PASS Same origin to other origin redirection 307 >+PASS Other origin to other origin redirection 307 >+PASS Other origin to same origin redirection 307 >+PASS Same origin to same origin redirection 308 >+PASS Same origin to other origin redirection 308 >+PASS Other origin to other origin redirection 308 >+PASS Other origin to same origin redirection 308 >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-origin.any.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-origin.any.html >new file mode 100644 >index 0000000000000000000000000000000000000000..2382913528e693b3a5d56c660a45060980b548c3 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-origin.any.html >@@ -0,0 +1 @@ >+<!-- This file is required for WebKit test infrastructure to run the templated test --> >\ No newline at end of file >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-origin.any.js b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-origin.any.js >new file mode 100644 >index 0000000000000000000000000000000000000000..3edb1bd03e891672e0939dfb0b797950d8a9aacb >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-origin.any.js >@@ -0,0 +1,37 @@ >+// META: script=/common/utils.js >+// META: script=../resources/utils.js >+// META: script=/common/get-host-info.sub.js >+ >+function testOriginAfterRedirection(desc, redirectUrl, redirectLocation, redirectStatus, expectedOrigin) { >+ var uuid_token = token(); >+ var url = redirectUrl; >+ var urlParameters = "?token=" + uuid_token + "&max_age=0"; >+ urlParameters += "&redirect_status=" + redirectStatus; >+ urlParameters += "&location=" + encodeURIComponent(redirectLocation); >+ >+ var requestInit = {"mode": "cors", "redirect": "follow"}; >+ >+ promise_test(function(test) { >+ return fetch(RESOURCES_DIR + "clean-stash.py?token=" + uuid_token).then(function(resp) { >+ assert_equals(resp.status, 200, "Clean stash response's status is 200"); >+ return fetch(url + urlParameters, requestInit).then(function(response) { >+ assert_equals(response.status, 200, "Inspect header response's status is 200"); >+ assert_equals(response.headers.get("x-request-origin"), expectedOrigin, "Check origin header"); >+ }); >+ }); >+ }, desc); >+} >+ >+var redirectUrl = RESOURCES_DIR + "redirect.py"; >+var corsRedirectUrl = get_host_info().HTTP_REMOTE_ORIGIN + dirname(location.pathname) + RESOURCES_DIR + "redirect.py"; >+var locationUrl = get_host_info().HTTP_ORIGIN + dirname(location.pathname) + RESOURCES_DIR + "inspect-headers.py?headers=origin"; >+var corsLocationUrl = get_host_info().HTTP_REMOTE_ORIGIN + dirname(location.pathname) + RESOURCES_DIR + "inspect-headers.py?cors&headers=origin"; >+ >+for (var code of [301, 302, 303, 307, 308]) { >+ testOriginAfterRedirection("Same origin to same origin redirection " + code, redirectUrl, locationUrl, code, null); >+ testOriginAfterRedirection("Same origin to other origin redirection " + code, redirectUrl, corsLocationUrl, code, get_host_info().HTTP_ORIGIN); >+ testOriginAfterRedirection("Other origin to other origin redirection " + code, corsRedirectUrl, corsLocationUrl, code, get_host_info().HTTP_ORIGIN); >+ testOriginAfterRedirection("Other origin to same origin redirection " + code, corsRedirectUrl, locationUrl + "&cors", code, "null"); >+} >+ >+done(); >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-origin.any.worker-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-origin.any.worker-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..2c76b620856b4c5884029e20884e8823f918c966 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-origin.any.worker-expected.txt >@@ -0,0 +1,22 @@ >+ >+PASS Same origin to same origin redirection 301 >+PASS Same origin to other origin redirection 301 >+PASS Other origin to other origin redirection 301 >+PASS Other origin to same origin redirection 301 >+PASS Same origin to same origin redirection 302 >+PASS Same origin to other origin redirection 302 >+PASS Other origin to other origin redirection 302 >+PASS Other origin to same origin redirection 302 >+PASS Same origin to same origin redirection 303 >+PASS Same origin to other origin redirection 303 >+PASS Other origin to other origin redirection 303 >+PASS Other origin to same origin redirection 303 >+PASS Same origin to same origin redirection 307 >+PASS Same origin to other origin redirection 307 >+PASS Other origin to other origin redirection 307 >+PASS Other origin to same origin redirection 307 >+PASS Same origin to same origin redirection 308 >+PASS Same origin to other origin redirection 308 >+PASS Other origin to other origin redirection 308 >+PASS Other origin to same origin redirection 308 >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-origin.any.worker.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-origin.any.worker.html >new file mode 100644 >index 0000000000000000000000000000000000000000..2382913528e693b3a5d56c660a45060980b548c3 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-origin.any.worker.html >@@ -0,0 +1 @@ >+<!-- This file is required for WebKit test infrastructure to run the templated test --> >\ No newline at end of file >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-origin.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-origin.html >deleted file mode 100644 >index 4cbe1c07d002aef1930f3aee62a7b279f1ebaf71..0000000000000000000000000000000000000000 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-origin.html >+++ /dev/null >@@ -1,18 +0,0 @@ >-<!doctype html> >-<html> >- <head> >- <meta charset="utf-8"> >- <title>Fetch: redirect mode handling</title> >- <meta name="author" title="Canon Research France" href="https://www.crf.canon.fr"> >- <meta name="help" href="https://fetch.spec.whatwg.org/#concept-filtered-response-opaque-redirect"> >- <meta name="help" href="https://fetch.spec.whatwg.org/#http-network-or-cache-fetch"> >- <script src="/resources/testharness.js"></script> >- <script src="/resources/testharnessreport.js"></script> >- </head> >- <body> >- <script src="/common/utils.js"></script> >- <script src="../resources/utils.js"></script> >- <script src="/common/get-host-info.sub.js"></script> >- <script src="redirect-origin.js"></script> >- </body> >-</html> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-origin.js b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-origin.js >deleted file mode 100644 >index 77f841e94b588a8efb52c28431dc906186e8468c..0000000000000000000000000000000000000000 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-origin.js >+++ /dev/null >@@ -1,40 +0,0 @@ >-if (this.document === undefined) { >- importScripts("/common/utils.js"); >- importScripts("/resources/testharness.js"); >- importScripts("../resources/utils.js"); >- importScripts("/common/get-host-info.sub.js"); >-} >- >-function testOriginAfterRedirection(desc, redirectUrl, redirectLocation, redirectStatus, expectedOrigin) { >- var uuid_token = token(); >- var url = redirectUrl; >- var urlParameters = "?token=" + uuid_token + "&max_age=0"; >- urlParameters += "&redirect_status=" + redirectStatus; >- urlParameters += "&location=" + encodeURIComponent(redirectLocation); >- >- var requestInit = {"mode": "cors", "redirect": "follow"}; >- >- promise_test(function(test) { >- return fetch(RESOURCES_DIR + "clean-stash.py?token=" + uuid_token).then(function(resp) { >- assert_equals(resp.status, 200, "Clean stash response's status is 200"); >- return fetch(url + urlParameters, requestInit).then(function(response) { >- assert_equals(response.status, 200, "Inspect header response's status is 200"); >- assert_equals(response.headers.get("x-request-origin"), expectedOrigin, "Check origin header"); >- }); >- }); >- }, desc); >-} >- >-var redirectUrl = RESOURCES_DIR + "redirect.py"; >-var corsRedirectUrl = get_host_info().HTTP_REMOTE_ORIGIN + dirname(location.pathname) + RESOURCES_DIR + "redirect.py"; >-var locationUrl = get_host_info().HTTP_ORIGIN + dirname(location.pathname) + RESOURCES_DIR + "inspect-headers.py?headers=origin"; >-var corsLocationUrl = get_host_info().HTTP_REMOTE_ORIGIN + dirname(location.pathname) + RESOURCES_DIR + "inspect-headers.py?cors&headers=origin"; >- >-for (var code of [301, 302, 303, 307, 308]) { >- testOriginAfterRedirection("Same origin to same origin redirection " + code, redirectUrl, locationUrl, code, null); >- testOriginAfterRedirection("Same origin to other origin redirection " + code, redirectUrl, corsLocationUrl, code, get_host_info().HTTP_ORIGIN); >- testOriginAfterRedirection("Other origin to other origin redirection " + code, corsRedirectUrl, corsLocationUrl, code, get_host_info().HTTP_ORIGIN); >- testOriginAfterRedirection("Other origin to same origin redirection " + code, corsRedirectUrl, locationUrl + "&cors", code, "null"); >-} >- >-done(); >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-referrer-worker-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-referrer-worker-expected.txt >deleted file mode 100644 >index 8e97d4963937f45383ff6467c1516855bb5926e1..0000000000000000000000000000000000000000 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-referrer-worker-expected.txt >+++ /dev/null >@@ -1,34 +0,0 @@ >- >-PASS Same origin redirection, empty init, unsafe-url redirect header >-PASS Same origin redirection, empty init, no-referrer-when-downgrade redirect header >-PASS Same origin redirection, empty init, same-origin redirect header >-PASS Same origin redirection, empty init, origin redirect header >-PASS Same origin redirection, empty init, origin-when-cross-origin redirect header >-PASS Same origin redirection, empty init, no-referrer redirect header >-PASS Same origin redirection, empty init, strict-origin redirect header >-PASS Same origin redirection, empty init, strict-origin-when-cross-origin redirect header >-PASS Same origin redirection, empty redirect header, unsafe-url init >-PASS Same origin redirection, empty redirect header, no-referrer-when-downgrade init >-PASS Same origin redirection, empty redirect header, same-origin init >-PASS Same origin redirection, empty redirect header, origin init >-PASS Same origin redirection, empty redirect header, origin-when-cross-origin init >-PASS Same origin redirection, empty redirect header, no-referrer init >-PASS Same origin redirection, empty redirect header, strict-origin init >-PASS Same origin redirection, empty redirect header, strict-origin-when-cross-origin init >-PASS Cross origin redirection, empty init, unsafe-url redirect header >-PASS Cross origin redirection, empty init, no-referrer-when-downgrade redirect header >-PASS Cross origin redirection, empty init, same-origin redirect header >-PASS Cross origin redirection, empty init, origin redirect header >-PASS Cross origin redirection, empty init, origin-when-cross-origin redirect header >-PASS Cross origin redirection, empty init, no-referrer redirect header >-PASS Cross origin redirection, empty init, strict-origin redirect header >-PASS Cross origin redirection, empty init, strict-origin-when-cross-origin redirect header >-PASS Cross origin redirection, empty redirect header, unsafe-url init >-PASS Cross origin redirection, empty redirect header, no-referrer-when-downgrade init >-PASS Cross origin redirection, empty redirect header, same-origin init >-PASS Cross origin redirection, empty redirect header, origin init >-PASS Cross origin redirection, empty redirect header, origin-when-cross-origin init >-PASS Cross origin redirection, empty redirect header, no-referrer init >-PASS Cross origin redirection, empty redirect header, strict-origin init >-PASS Cross origin redirection, empty redirect header, strict-origin-when-cross-origin init >- >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-referrer-worker.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-referrer-worker.html >deleted file mode 100644 >index 6e5cd45b85ae1c9c3cdabc55143b9a9b3221476e..0000000000000000000000000000000000000000 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-referrer-worker.html >+++ /dev/null >@@ -1,17 +0,0 @@ >-<!doctype html> >-<html> >- <head> >- <meta charset="utf-8"> >- <title>Fetch in worker: redirect referrer handling</title> >- <meta name="author" title="Canon Research France" href="https://www.crf.canon.fr"> >- <meta name="help" href="https://fetch.spec.whatwg.org/#main-fetch"> >- <meta name="help" href="https://fetch.spec.whatwg.org/#http-redirect-fetch"> >- <script src="/resources/testharness.js"></script> >- <script src="/resources/testharnessreport.js"></script> >- </head> >- <body> >- <script> >- fetch_tests_from_worker(new Worker("redirect-referrer.js")); >- </script> >- </body> >-</html> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-referrer.any-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-referrer.any-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..8e97d4963937f45383ff6467c1516855bb5926e1 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-referrer.any-expected.txt >@@ -0,0 +1,34 @@ >+ >+PASS Same origin redirection, empty init, unsafe-url redirect header >+PASS Same origin redirection, empty init, no-referrer-when-downgrade redirect header >+PASS Same origin redirection, empty init, same-origin redirect header >+PASS Same origin redirection, empty init, origin redirect header >+PASS Same origin redirection, empty init, origin-when-cross-origin redirect header >+PASS Same origin redirection, empty init, no-referrer redirect header >+PASS Same origin redirection, empty init, strict-origin redirect header >+PASS Same origin redirection, empty init, strict-origin-when-cross-origin redirect header >+PASS Same origin redirection, empty redirect header, unsafe-url init >+PASS Same origin redirection, empty redirect header, no-referrer-when-downgrade init >+PASS Same origin redirection, empty redirect header, same-origin init >+PASS Same origin redirection, empty redirect header, origin init >+PASS Same origin redirection, empty redirect header, origin-when-cross-origin init >+PASS Same origin redirection, empty redirect header, no-referrer init >+PASS Same origin redirection, empty redirect header, strict-origin init >+PASS Same origin redirection, empty redirect header, strict-origin-when-cross-origin init >+PASS Cross origin redirection, empty init, unsafe-url redirect header >+PASS Cross origin redirection, empty init, no-referrer-when-downgrade redirect header >+PASS Cross origin redirection, empty init, same-origin redirect header >+PASS Cross origin redirection, empty init, origin redirect header >+PASS Cross origin redirection, empty init, origin-when-cross-origin redirect header >+PASS Cross origin redirection, empty init, no-referrer redirect header >+PASS Cross origin redirection, empty init, strict-origin redirect header >+PASS Cross origin redirection, empty init, strict-origin-when-cross-origin redirect header >+PASS Cross origin redirection, empty redirect header, unsafe-url init >+PASS Cross origin redirection, empty redirect header, no-referrer-when-downgrade init >+PASS Cross origin redirection, empty redirect header, same-origin init >+PASS Cross origin redirection, empty redirect header, origin init >+PASS Cross origin redirection, empty redirect header, origin-when-cross-origin init >+PASS Cross origin redirection, empty redirect header, no-referrer init >+PASS Cross origin redirection, empty redirect header, strict-origin init >+PASS Cross origin redirection, empty redirect header, strict-origin-when-cross-origin init >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-referrer.any.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-referrer.any.html >new file mode 100644 >index 0000000000000000000000000000000000000000..2382913528e693b3a5d56c660a45060980b548c3 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-referrer.any.html >@@ -0,0 +1 @@ >+<!-- This file is required for WebKit test infrastructure to run the templated test --> >\ No newline at end of file >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-referrer.any.js b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-referrer.any.js >new file mode 100644 >index 0000000000000000000000000000000000000000..92f0b9be515b540133aa616d643eb9347e774425 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-referrer.any.js >@@ -0,0 +1,65 @@ >+// META: script=/common/utils.js >+// META: script=../resources/utils.js >+// META: script=/common/get-host-info.sub.js >+ >+function testReferrerAfterRedirection(desc, redirectUrl, redirectLocation, referrerPolicy, redirectReferrerPolicy, expectedReferrer) { >+ var url = redirectUrl; >+ var urlParameters = "?location=" + encodeURIComponent(redirectLocation); >+ >+ if (redirectReferrerPolicy) >+ urlParameters += "&redirect_referrerpolicy=" + redirectReferrerPolicy; >+ >+ var requestInit = {"redirect": "follow", "referrerPolicy": referrerPolicy}; >+ >+ promise_test(function(test) { >+ return fetch(url + urlParameters, requestInit).then(function(response) { >+ assert_equals(response.status, 200, "Inspect header response's status is 200"); >+ assert_equals(response.headers.get("x-request-referer"), expectedReferrer ? expectedReferrer : null, "Check referrer header"); >+ }); >+ }, desc); >+} >+ >+var referrerOrigin = get_host_info().HTTP_ORIGIN + "/"; >+var referrerUrl = location.href; >+ >+var redirectUrl = RESOURCES_DIR + "redirect.py"; >+var locationUrl = get_host_info().HTTP_ORIGIN + dirname(location.pathname) + RESOURCES_DIR + "inspect-headers.py?headers=referer"; >+var crossLocationUrl = get_host_info().HTTP_REMOTE_ORIGIN + dirname(location.pathname) + RESOURCES_DIR + "inspect-headers.py?cors&headers=referer"; >+ >+testReferrerAfterRedirection("Same origin redirection, empty init, unsafe-url redirect header ", redirectUrl, locationUrl, "", "unsafe-url", referrerUrl); >+testReferrerAfterRedirection("Same origin redirection, empty init, no-referrer-when-downgrade redirect header ", redirectUrl, locationUrl, "", "no-referrer-when-downgrade", referrerUrl); >+testReferrerAfterRedirection("Same origin redirection, empty init, same-origin redirect header ", redirectUrl, locationUrl, "", "same-origin", referrerUrl); >+testReferrerAfterRedirection("Same origin redirection, empty init, origin redirect header ", redirectUrl, locationUrl, "", "origin", referrerOrigin); >+testReferrerAfterRedirection("Same origin redirection, empty init, origin-when-cross-origin redirect header ", redirectUrl, locationUrl, "", "origin-when-cross-origin", referrerUrl); >+testReferrerAfterRedirection("Same origin redirection, empty init, no-referrer redirect header ", redirectUrl, locationUrl, "", "no-referrer", null); >+testReferrerAfterRedirection("Same origin redirection, empty init, strict-origin redirect header ", redirectUrl, locationUrl, "", "strict-origin", referrerOrigin); >+testReferrerAfterRedirection("Same origin redirection, empty init, strict-origin-when-cross-origin redirect header ", redirectUrl, locationUrl, "", "strict-origin-when-cross-origin", referrerUrl); >+ >+testReferrerAfterRedirection("Same origin redirection, empty redirect header, unsafe-url init ", redirectUrl, locationUrl, "unsafe-url", "", referrerUrl); >+testReferrerAfterRedirection("Same origin redirection, empty redirect header, no-referrer-when-downgrade init ", redirectUrl, locationUrl, "no-referrer-when-downgrade", "", referrerUrl); >+testReferrerAfterRedirection("Same origin redirection, empty redirect header, same-origin init ", redirectUrl, locationUrl, "same-origin", "", referrerUrl); >+testReferrerAfterRedirection("Same origin redirection, empty redirect header, origin init ", redirectUrl, locationUrl, "origin", "", referrerOrigin); >+testReferrerAfterRedirection("Same origin redirection, empty redirect header, origin-when-cross-origin init ", redirectUrl, locationUrl, "origin-when-cross-origin", "", referrerUrl); >+testReferrerAfterRedirection("Same origin redirection, empty redirect header, no-referrer init ", redirectUrl, locationUrl, "no-referrer", "", null); >+testReferrerAfterRedirection("Same origin redirection, empty redirect header, strict-origin init ", redirectUrl, locationUrl, "strict-origin", "", referrerOrigin); >+testReferrerAfterRedirection("Same origin redirection, empty redirect header, strict-origin-when-cross-origin init ", redirectUrl, locationUrl, "strict-origin-when-cross-origin", "", referrerUrl); >+ >+testReferrerAfterRedirection("Cross origin redirection, empty init, unsafe-url redirect header ", redirectUrl, crossLocationUrl, "", "unsafe-url", referrerUrl); >+testReferrerAfterRedirection("Cross origin redirection, empty init, no-referrer-when-downgrade redirect header ", redirectUrl, crossLocationUrl, "", "no-referrer-when-downgrade", referrerUrl); >+testReferrerAfterRedirection("Cross origin redirection, empty init, same-origin redirect header ", redirectUrl, crossLocationUrl, "", "same-origin", null); >+testReferrerAfterRedirection("Cross origin redirection, empty init, origin redirect header ", redirectUrl, crossLocationUrl, "", "origin", referrerOrigin); >+testReferrerAfterRedirection("Cross origin redirection, empty init, origin-when-cross-origin redirect header ", redirectUrl, crossLocationUrl, "", "origin-when-cross-origin", referrerOrigin); >+testReferrerAfterRedirection("Cross origin redirection, empty init, no-referrer redirect header ", redirectUrl, crossLocationUrl, "", "no-referrer", null); >+testReferrerAfterRedirection("Cross origin redirection, empty init, strict-origin redirect header ", redirectUrl, crossLocationUrl, "", "strict-origin", referrerOrigin); >+testReferrerAfterRedirection("Cross origin redirection, empty init, strict-origin-when-cross-origin redirect header ", redirectUrl, crossLocationUrl, "", "strict-origin-when-cross-origin", referrerOrigin); >+ >+testReferrerAfterRedirection("Cross origin redirection, empty redirect header, unsafe-url init ", redirectUrl, crossLocationUrl, "unsafe-url", "", referrerUrl); >+testReferrerAfterRedirection("Cross origin redirection, empty redirect header, no-referrer-when-downgrade init ", redirectUrl, crossLocationUrl, "no-referrer-when-downgrade", "", referrerUrl); >+testReferrerAfterRedirection("Cross origin redirection, empty redirect header, same-origin init ", redirectUrl, crossLocationUrl, "same-origin", "", null); >+testReferrerAfterRedirection("Cross origin redirection, empty redirect header, origin init ", redirectUrl, crossLocationUrl, "origin", "", referrerOrigin); >+testReferrerAfterRedirection("Cross origin redirection, empty redirect header, origin-when-cross-origin init ", redirectUrl, crossLocationUrl, "origin-when-cross-origin", "", referrerOrigin); >+testReferrerAfterRedirection("Cross origin redirection, empty redirect header, no-referrer init ", redirectUrl, crossLocationUrl, "no-referrer", "", null); >+testReferrerAfterRedirection("Cross origin redirection, empty redirect header, strict-origin init ", redirectUrl, crossLocationUrl, "strict-origin", "", referrerOrigin); >+testReferrerAfterRedirection("Cross origin redirection, empty redirect header, strict-origin-when-cross-origin init ", redirectUrl, crossLocationUrl, "strict-origin-when-cross-origin", "", referrerOrigin); >+ >+done(); >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-referrer.any.worker-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-referrer.any.worker-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..8e97d4963937f45383ff6467c1516855bb5926e1 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-referrer.any.worker-expected.txt >@@ -0,0 +1,34 @@ >+ >+PASS Same origin redirection, empty init, unsafe-url redirect header >+PASS Same origin redirection, empty init, no-referrer-when-downgrade redirect header >+PASS Same origin redirection, empty init, same-origin redirect header >+PASS Same origin redirection, empty init, origin redirect header >+PASS Same origin redirection, empty init, origin-when-cross-origin redirect header >+PASS Same origin redirection, empty init, no-referrer redirect header >+PASS Same origin redirection, empty init, strict-origin redirect header >+PASS Same origin redirection, empty init, strict-origin-when-cross-origin redirect header >+PASS Same origin redirection, empty redirect header, unsafe-url init >+PASS Same origin redirection, empty redirect header, no-referrer-when-downgrade init >+PASS Same origin redirection, empty redirect header, same-origin init >+PASS Same origin redirection, empty redirect header, origin init >+PASS Same origin redirection, empty redirect header, origin-when-cross-origin init >+PASS Same origin redirection, empty redirect header, no-referrer init >+PASS Same origin redirection, empty redirect header, strict-origin init >+PASS Same origin redirection, empty redirect header, strict-origin-when-cross-origin init >+PASS Cross origin redirection, empty init, unsafe-url redirect header >+PASS Cross origin redirection, empty init, no-referrer-when-downgrade redirect header >+PASS Cross origin redirection, empty init, same-origin redirect header >+PASS Cross origin redirection, empty init, origin redirect header >+PASS Cross origin redirection, empty init, origin-when-cross-origin redirect header >+PASS Cross origin redirection, empty init, no-referrer redirect header >+PASS Cross origin redirection, empty init, strict-origin redirect header >+PASS Cross origin redirection, empty init, strict-origin-when-cross-origin redirect header >+PASS Cross origin redirection, empty redirect header, unsafe-url init >+PASS Cross origin redirection, empty redirect header, no-referrer-when-downgrade init >+PASS Cross origin redirection, empty redirect header, same-origin init >+PASS Cross origin redirection, empty redirect header, origin init >+PASS Cross origin redirection, empty redirect header, origin-when-cross-origin init >+PASS Cross origin redirection, empty redirect header, no-referrer init >+PASS Cross origin redirection, empty redirect header, strict-origin init >+PASS Cross origin redirection, empty redirect header, strict-origin-when-cross-origin init >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-referrer.any.worker.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-referrer.any.worker.html >new file mode 100644 >index 0000000000000000000000000000000000000000..2382913528e693b3a5d56c660a45060980b548c3 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-referrer.any.worker.html >@@ -0,0 +1 @@ >+<!-- This file is required for WebKit test infrastructure to run the templated test --> >\ No newline at end of file >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-referrer.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-referrer.html >deleted file mode 100644 >index 473b5e6471bcf4ba234032d34e2961a1b41f8184..0000000000000000000000000000000000000000 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-referrer.html >+++ /dev/null >@@ -1,18 +0,0 @@ >-<!doctype html> >-<html> >- <head> >- <meta charset="utf-8"> >- <title>Fetch: redirect referrer handling</title> >- <meta name="author" title="Canon Research France" href="https://www.crf.canon.fr"> >- <meta name="help" href="https://fetch.spec.whatwg.org/#main-fetch"> >- <meta name="help" href="https://fetch.spec.whatwg.org/#http-redirect-fetch"> >- <script src="/resources/testharness.js"></script> >- <script src="/resources/testharnessreport.js"></script> >- </head> >- <body> >- <script src="/common/utils.js"></script> >- <script src="../resources/utils.js"></script> >- <script src="/common/get-host-info.sub.js"></script> >- <script src="redirect-referrer.js"></script> >- </body> >-</html> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-referrer.js b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-referrer.js >deleted file mode 100644 >index fabeceaef4f966393964afdb2e5292b307955faf..0000000000000000000000000000000000000000 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-referrer.js >+++ /dev/null >@@ -1,68 +0,0 @@ >-if (this.document === undefined) { >- importScripts("/common/utils.js"); >- importScripts("/resources/testharness.js"); >- importScripts("../resources/utils.js"); >- importScripts("/common/get-host-info.sub.js"); >-} >- >-function testReferrerAfterRedirection(desc, redirectUrl, redirectLocation, referrerPolicy, redirectReferrerPolicy, expectedReferrer) { >- var url = redirectUrl; >- var urlParameters = "?location=" + encodeURIComponent(redirectLocation); >- >- if (redirectReferrerPolicy) >- urlParameters += "&redirect_referrerpolicy=" + redirectReferrerPolicy; >- >- var requestInit = {"redirect": "follow", "referrerPolicy": referrerPolicy}; >- >- promise_test(function(test) { >- return fetch(url + urlParameters, requestInit).then(function(response) { >- assert_equals(response.status, 200, "Inspect header response's status is 200"); >- assert_equals(response.headers.get("x-request-referer"), expectedReferrer ? expectedReferrer : null, "Check referrer header"); >- }); >- }, desc); >-} >- >-var referrerOrigin = get_host_info().HTTP_ORIGIN + "/"; >-var referrerUrl = location.href; >- >-var redirectUrl = RESOURCES_DIR + "redirect.py"; >-var locationUrl = get_host_info().HTTP_ORIGIN + dirname(location.pathname) + RESOURCES_DIR + "inspect-headers.py?headers=referer"; >-var crossLocationUrl = get_host_info().HTTP_REMOTE_ORIGIN + dirname(location.pathname) + RESOURCES_DIR + "inspect-headers.py?cors&headers=referer"; >- >-testReferrerAfterRedirection("Same origin redirection, empty init, unsafe-url redirect header ", redirectUrl, locationUrl, "", "unsafe-url", referrerUrl); >-testReferrerAfterRedirection("Same origin redirection, empty init, no-referrer-when-downgrade redirect header ", redirectUrl, locationUrl, "", "no-referrer-when-downgrade", referrerUrl); >-testReferrerAfterRedirection("Same origin redirection, empty init, same-origin redirect header ", redirectUrl, locationUrl, "", "same-origin", referrerUrl); >-testReferrerAfterRedirection("Same origin redirection, empty init, origin redirect header ", redirectUrl, locationUrl, "", "origin", referrerOrigin); >-testReferrerAfterRedirection("Same origin redirection, empty init, origin-when-cross-origin redirect header ", redirectUrl, locationUrl, "", "origin-when-cross-origin", referrerUrl); >-testReferrerAfterRedirection("Same origin redirection, empty init, no-referrer redirect header ", redirectUrl, locationUrl, "", "no-referrer", null); >-testReferrerAfterRedirection("Same origin redirection, empty init, strict-origin redirect header ", redirectUrl, locationUrl, "", "strict-origin", referrerOrigin); >-testReferrerAfterRedirection("Same origin redirection, empty init, strict-origin-when-cross-origin redirect header ", redirectUrl, locationUrl, "", "strict-origin-when-cross-origin", referrerUrl); >- >-testReferrerAfterRedirection("Same origin redirection, empty redirect header, unsafe-url init ", redirectUrl, locationUrl, "unsafe-url", "", referrerUrl); >-testReferrerAfterRedirection("Same origin redirection, empty redirect header, no-referrer-when-downgrade init ", redirectUrl, locationUrl, "no-referrer-when-downgrade", "", referrerUrl); >-testReferrerAfterRedirection("Same origin redirection, empty redirect header, same-origin init ", redirectUrl, locationUrl, "same-origin", "", referrerUrl); >-testReferrerAfterRedirection("Same origin redirection, empty redirect header, origin init ", redirectUrl, locationUrl, "origin", "", referrerOrigin); >-testReferrerAfterRedirection("Same origin redirection, empty redirect header, origin-when-cross-origin init ", redirectUrl, locationUrl, "origin-when-cross-origin", "", referrerUrl); >-testReferrerAfterRedirection("Same origin redirection, empty redirect header, no-referrer init ", redirectUrl, locationUrl, "no-referrer", "", null); >-testReferrerAfterRedirection("Same origin redirection, empty redirect header, strict-origin init ", redirectUrl, locationUrl, "strict-origin", "", referrerOrigin); >-testReferrerAfterRedirection("Same origin redirection, empty redirect header, strict-origin-when-cross-origin init ", redirectUrl, locationUrl, "strict-origin-when-cross-origin", "", referrerUrl); >- >-testReferrerAfterRedirection("Cross origin redirection, empty init, unsafe-url redirect header ", redirectUrl, crossLocationUrl, "", "unsafe-url", referrerUrl); >-testReferrerAfterRedirection("Cross origin redirection, empty init, no-referrer-when-downgrade redirect header ", redirectUrl, crossLocationUrl, "", "no-referrer-when-downgrade", referrerUrl); >-testReferrerAfterRedirection("Cross origin redirection, empty init, same-origin redirect header ", redirectUrl, crossLocationUrl, "", "same-origin", null); >-testReferrerAfterRedirection("Cross origin redirection, empty init, origin redirect header ", redirectUrl, crossLocationUrl, "", "origin", referrerOrigin); >-testReferrerAfterRedirection("Cross origin redirection, empty init, origin-when-cross-origin redirect header ", redirectUrl, crossLocationUrl, "", "origin-when-cross-origin", referrerOrigin); >-testReferrerAfterRedirection("Cross origin redirection, empty init, no-referrer redirect header ", redirectUrl, crossLocationUrl, "", "no-referrer", null); >-testReferrerAfterRedirection("Cross origin redirection, empty init, strict-origin redirect header ", redirectUrl, crossLocationUrl, "", "strict-origin", referrerOrigin); >-testReferrerAfterRedirection("Cross origin redirection, empty init, strict-origin-when-cross-origin redirect header ", redirectUrl, crossLocationUrl, "", "strict-origin-when-cross-origin", referrerOrigin); >- >-testReferrerAfterRedirection("Cross origin redirection, empty redirect header, unsafe-url init ", redirectUrl, crossLocationUrl, "unsafe-url", "", referrerUrl); >-testReferrerAfterRedirection("Cross origin redirection, empty redirect header, no-referrer-when-downgrade init ", redirectUrl, crossLocationUrl, "no-referrer-when-downgrade", "", referrerUrl); >-testReferrerAfterRedirection("Cross origin redirection, empty redirect header, same-origin init ", redirectUrl, crossLocationUrl, "same-origin", "", null); >-testReferrerAfterRedirection("Cross origin redirection, empty redirect header, origin init ", redirectUrl, crossLocationUrl, "origin", "", referrerOrigin); >-testReferrerAfterRedirection("Cross origin redirection, empty redirect header, origin-when-cross-origin init ", redirectUrl, crossLocationUrl, "origin-when-cross-origin", "", referrerOrigin); >-testReferrerAfterRedirection("Cross origin redirection, empty redirect header, no-referrer init ", redirectUrl, crossLocationUrl, "no-referrer", "", null); >-testReferrerAfterRedirection("Cross origin redirection, empty redirect header, strict-origin init ", redirectUrl, crossLocationUrl, "strict-origin", "", referrerOrigin); >-testReferrerAfterRedirection("Cross origin redirection, empty redirect header, strict-origin-when-cross-origin init ", redirectUrl, crossLocationUrl, "strict-origin-when-cross-origin", "", referrerOrigin); >- >-done(); >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-to-dataurl-worker-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-to-dataurl-worker-expected.txt >deleted file mode 100644 >index b16c54d9d509ae9d40cea6610b492e48cff284f1..0000000000000000000000000000000000000000 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-to-dataurl-worker-expected.txt >+++ /dev/null >@@ -1,11 +0,0 @@ >-CONSOLE MESSAGE: Cross-origin redirection to data:text/plain;base64,cmVzcG9uc2UncyBib2R5 denied by Cross-Origin Resource Sharing policy: URL is either a non-HTTP URL or contains credentials. >-CONSOLE MESSAGE: Unsafe attempt to load URL data:text/plain;base64,cmVzcG9uc2UncyBib2R5 from origin http://localhost:8800. Domains, protocols and ports must match. >- >-CONSOLE MESSAGE: Cross-origin redirection to data:text/plain;base64,cmVzcG9uc2UncyBib2R5 denied by Cross-Origin Resource Sharing policy: URL is either a non-HTTP URL or contains credentials. >- >-PASS Testing data URL loading after same-origin redirection (cors mode) >-PASS Testing data URL loading after same-origin redirection (no-cors mode) >-PASS Testing data URL loading after same-origin redirection (same-origin mode) >-PASS Testing data URL loading after cross-origin redirection (cors mode) >-PASS Testing data URL loading after cross-origin redirection (no-cors mode) >- >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-to-dataurl-worker.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-to-dataurl-worker.html >deleted file mode 100644 >index 428f5135e948e58320b698e2b985700e0d00db5e..0000000000000000000000000000000000000000 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-to-dataurl-worker.html >+++ /dev/null >@@ -1,14 +0,0 @@ >-<!doctype html> >-<html> >- <head> >- <meta charset="utf-8"> >- <title>Fetch in worker: data URL loading after redirections</title> >- <script src="/resources/testharness.js"></script> >- <script src="/resources/testharnessreport.js"></script> >- </head> >- <body> >- <script> >- fetch_tests_from_worker(new Worker("redirect-to-dataurl.js")); >- </script> >- </body> >-</html> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-to-dataurl.any-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-to-dataurl.any-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..96d0eae77c6354e08beb60ab62be18c110224064 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-to-dataurl.any-expected.txt >@@ -0,0 +1,17 @@ >+CONSOLE MESSAGE: Cross-origin redirection to data:text/plain;base64,cmVzcG9uc2UncyBib2R5 denied by Cross-Origin Resource Sharing policy: URL is either a non-HTTP URL or contains credentials. >+CONSOLE MESSAGE: Fetch API cannot load http://localhost:8800/fetch/api/resources/redirect.py?cors&location=data%3Atext%2Fplain%3Bbase64%2CcmVzcG9uc2UncyBib2R5 due to access control checks. >+CONSOLE MESSAGE: Redirection to URL with a scheme that is not HTTP(S). >+CONSOLE MESSAGE: Fetch API cannot load data:text/plain;base64,cmVzcG9uc2UncyBib2R5 due to access control checks. >+CONSOLE MESSAGE: Unsafe attempt to load URL data:text/plain;base64,cmVzcG9uc2UncyBib2R5 from origin http://localhost:8800. Domains, protocols and ports must match. >+ >+CONSOLE MESSAGE: Cross-origin redirection to data:text/plain;base64,cmVzcG9uc2UncyBib2R5 denied by Cross-Origin Resource Sharing policy: URL is either a non-HTTP URL or contains credentials. >+CONSOLE MESSAGE: Fetch API cannot load http://127.0.0.1:8800/fetch/api/resources/redirect.py?cors&location=data%3Atext%2Fplain%3Bbase64%2CcmVzcG9uc2UncyBib2R5 due to access control checks. >+CONSOLE MESSAGE: Redirection to URL with a scheme that is not HTTP(S). >+CONSOLE MESSAGE: Fetch API cannot load data:text/plain;base64,cmVzcG9uc2UncyBib2R5 due to access control checks. >+ >+PASS Testing data URL loading after same-origin redirection (cors mode) >+PASS Testing data URL loading after same-origin redirection (no-cors mode) >+PASS Testing data URL loading after same-origin redirection (same-origin mode) >+PASS Testing data URL loading after cross-origin redirection (cors mode) >+PASS Testing data URL loading after cross-origin redirection (no-cors mode) >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-to-dataurl.any.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-to-dataurl.any.html >new file mode 100644 >index 0000000000000000000000000000000000000000..2382913528e693b3a5d56c660a45060980b548c3 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-to-dataurl.any.html >@@ -0,0 +1 @@ >+<!-- This file is required for WebKit test infrastructure to run the templated test --> >\ No newline at end of file >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-to-dataurl.any.js b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-to-dataurl.any.js >new file mode 100644 >index 0000000000000000000000000000000000000000..68ff2c5bcf2d85e6930196b8b1a3a2005ea54094 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-to-dataurl.any.js >@@ -0,0 +1,27 @@ >+// META: script=/common/get-host-info.sub.js >+ >+var dataURL = "data:text/plain;base64,cmVzcG9uc2UncyBib2R5"; >+var body = "response's body"; >+var contentType = "text/plain"; >+ >+function redirectDataURL(desc, redirectUrl, mode) { >+ var url = redirectUrl + "?cors&location=" + encodeURIComponent(dataURL); >+ >+ var requestInit = {"mode": mode}; >+ >+ promise_test(function(test) { >+ return promise_rejects(test, new TypeError(), fetch(url, requestInit)); >+ }, desc); >+} >+ >+var redirUrl = get_host_info().HTTP_ORIGIN + "/fetch/api/resources/redirect.py"; >+var corsRedirUrl = get_host_info().HTTP_REMOTE_ORIGIN + "/fetch/api/resources/redirect.py"; >+ >+redirectDataURL("Testing data URL loading after same-origin redirection (cors mode)", redirUrl, "cors"); >+redirectDataURL("Testing data URL loading after same-origin redirection (no-cors mode)", redirUrl, "no-cors"); >+redirectDataURL("Testing data URL loading after same-origin redirection (same-origin mode)", redirUrl, "same-origin"); >+ >+redirectDataURL("Testing data URL loading after cross-origin redirection (cors mode)", corsRedirUrl, "cors"); >+redirectDataURL("Testing data URL loading after cross-origin redirection (no-cors mode)", corsRedirUrl, "no-cors"); >+ >+done(); >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-to-dataurl.any.worker-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-to-dataurl.any.worker-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..b16c54d9d509ae9d40cea6610b492e48cff284f1 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-to-dataurl.any.worker-expected.txt >@@ -0,0 +1,11 @@ >+CONSOLE MESSAGE: Cross-origin redirection to data:text/plain;base64,cmVzcG9uc2UncyBib2R5 denied by Cross-Origin Resource Sharing policy: URL is either a non-HTTP URL or contains credentials. >+CONSOLE MESSAGE: Unsafe attempt to load URL data:text/plain;base64,cmVzcG9uc2UncyBib2R5 from origin http://localhost:8800. Domains, protocols and ports must match. >+ >+CONSOLE MESSAGE: Cross-origin redirection to data:text/plain;base64,cmVzcG9uc2UncyBib2R5 denied by Cross-Origin Resource Sharing policy: URL is either a non-HTTP URL or contains credentials. >+ >+PASS Testing data URL loading after same-origin redirection (cors mode) >+PASS Testing data URL loading after same-origin redirection (no-cors mode) >+PASS Testing data URL loading after same-origin redirection (same-origin mode) >+PASS Testing data URL loading after cross-origin redirection (cors mode) >+PASS Testing data URL loading after cross-origin redirection (no-cors mode) >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-to-dataurl.any.worker.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-to-dataurl.any.worker.html >new file mode 100644 >index 0000000000000000000000000000000000000000..2382913528e693b3a5d56c660a45060980b548c3 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-to-dataurl.any.worker.html >@@ -0,0 +1 @@ >+<!-- This file is required for WebKit test infrastructure to run the templated test --> >\ No newline at end of file >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-to-dataurl.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-to-dataurl.html >deleted file mode 100644 >index ed7159f4121c1e13b5459a265377e16e0cbdbdcb..0000000000000000000000000000000000000000 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-to-dataurl.html >+++ /dev/null >@@ -1,13 +0,0 @@ >-<!doctype html> >-<html> >- <head> >- <meta charset="utf-8"> >- <title>Fetch: data URL loading after redirections</title> >- <script src="/resources/testharness.js"></script> >- <script src="/resources/testharnessreport.js"></script> >- </head> >- <body> >- <script src="/common/get-host-info.sub.js"></script> >- <script src="redirect-to-dataurl.js"></script> >- </body> >-</html> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-to-dataurl.js b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-to-dataurl.js >deleted file mode 100644 >index c3bae3f6bb0847b7d4e4da929b9fa83abd49aab6..0000000000000000000000000000000000000000 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-to-dataurl.js >+++ /dev/null >@@ -1,30 +0,0 @@ >-if (this.document === undefined) { >- importScripts("/common/get-host-info.sub.js") >- importScripts("/resources/testharness.js"); >-} >- >-var dataURL = "data:text/plain;base64,cmVzcG9uc2UncyBib2R5"; >-var body = "response's body"; >-var contentType = "text/plain"; >- >-function redirectDataURL(desc, redirectUrl, mode) { >- var url = redirectUrl + "?cors&location=" + encodeURIComponent(dataURL); >- >- var requestInit = {"mode": mode}; >- >- promise_test(function(test) { >- return promise_rejects(test, new TypeError(), fetch(url, requestInit)); >- }, desc); >-} >- >-var redirUrl = get_host_info().HTTP_ORIGIN + "/fetch/api/resources/redirect.py"; >-var corsRedirUrl = get_host_info().HTTP_REMOTE_ORIGIN + "/fetch/api/resources/redirect.py"; >- >-redirectDataURL("Testing data URL loading after same-origin redirection (cors mode)", redirUrl, "cors"); >-redirectDataURL("Testing data URL loading after same-origin redirection (no-cors mode)", redirUrl, "no-cors"); >-redirectDataURL("Testing data URL loading after same-origin redirection (same-origin mode)", redirUrl, "same-origin"); >- >-redirectDataURL("Testing data URL loading after cross-origin redirection (cors mode)", corsRedirUrl, "cors"); >-redirectDataURL("Testing data URL loading after cross-origin redirection (no-cors mode)", corsRedirUrl, "no-cors"); >- >-done(); >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/w3c-import.log b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/w3c-import.log >index 2e7d1f49e438b918bd4f802f0ff86d952185cf77..489d68a96c046c3f2ac9592f4cfe4fbbcf3b1412 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/w3c-import.log >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/w3c-import.log >@@ -1,7 +1,7 @@ > The tests in this directory were imported from the W3C repository. > Do NOT modify these tests directly in WebKit. > Instead, create a pull request on the WPT github: >- https://github.com/w3c/web-platform-tests >+ https://github.com/web-platform-tests/wpt > > Then run the Tools/Scripts/import-w3c-tests in WebKit to reimport > >@@ -14,25 +14,13 @@ Property values requiring vendor prefixes: > None > ------------------------------------------------------------------------ > List of files: >-/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-count-worker.html >-/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-count.html >-/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-count.js >-/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-location-worker.html >-/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-location.html >-/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-location.js >-/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-method-worker.html >-/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-method.html >-/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-method.js >-/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-mode-worker.html >-/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-mode.html >-/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-mode.js >-/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-origin-worker.html >-/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-origin.html >-/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-origin.js >-/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-referrer-worker.html >-/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-referrer.html >-/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-referrer.js >+/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-back-to-original-origin.any.js >+/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-count.any.js >+/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-empty-location.any.js >+/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-location.any.js >+/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-method.any.js >+/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-mode.any.js >+/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-origin.any.js >+/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-referrer.any.js > /LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-schemes.html >-/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-to-dataurl-worker.html >-/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-to-dataurl.html >-/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-to-dataurl.js >+/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-to-dataurl.any.js >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/destination/fetch-destination-prefetch.https-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/destination/fetch-destination-prefetch.https-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..601f5651d716e85eb2e139d7bb7500fb53d5b70e >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/destination/fetch-destination-prefetch.https-expected.txt >@@ -0,0 +1,6 @@ >+ >+Harness Error (TIMEOUT), message = null >+ >+PASS Initialize global state >+TIMEOUT HTMLLinkElement with rel=prefetch fetches with an empty string Request.destination Test timed out >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/destination/fetch-destination-prefetch.https.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/destination/fetch-destination-prefetch.https.html >new file mode 100644 >index 0000000000000000000000000000000000000000..db99202df87af6d6d8d5565eb4c5f3486d55f72a >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/destination/fetch-destination-prefetch.https.html >@@ -0,0 +1,46 @@ >+<!DOCTYPE html> >+<title>Fetch destination test for prefetching</title> >+<script src="/resources/testharness.js"></script> >+<script src="/resources/testharnessreport.js"></script> >+<script src="/common/get-host-info.sub.js"></script> >+<script src="/common/media.js"></script> >+<script src="/service-workers/service-worker/resources/test-helpers.sub.js"></script> >+<script> >+let frame; >+ >+// Set up the service worker and the frame. >+promise_test(t => { >+ const kScope = 'resources/empty.https.html'; >+ const kScript = 'resources/fetch-destination-worker.js'; >+ return service_worker_unregister_and_register(t, kScript, kScope) >+ .then(registration => { >+ add_completion_callback(() => { >+ registration.unregister(); >+ }); >+ >+ return wait_for_state(t, registration.installing, 'activated'); >+ }) >+ .then(() => { >+ return with_iframe(kScope); >+ }) >+ .then(f => { >+ frame = f; >+ add_completion_callback(() => { f.remove(); }); >+ }); >+ }, 'Initialize global state'); >+ >+// HTMLLinkElement with rel=prefetch - empty string destination >+promise_test(async t => { >+ await new Promise((resolve, reject) => { >+ let node = frame.contentWindow.document.createElement("link"); >+ node.rel = "prefetch"; >+ node.onload = resolve; >+ node.onerror = reject; >+ node.href = "dummy?dest="; >+ frame.contentWindow.document.body.appendChild(node); >+ }).catch(() => { >+ assert_unreached("Fetch errored."); >+ }); >+}, 'HTMLLinkElement with rel=prefetch fetches with an empty string Request.destination'); >+ >+</script> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/destination/fetch-destination.https.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/destination/fetch-destination.https.html >index 5d9f71735913e95db014ee4c2555b94dde70f368..27b510268dde9f24b2500756f5d55940cd98d884 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/destination/fetch-destination.https.html >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/destination/fetch-destination.https.html >@@ -425,18 +425,4 @@ promise_test(async t => { > }); > }, 'HTMLLinkElement with rel=preload and as=manifest fetches with a "manifest" Request.destination'); > >-// HTMLLinkElement with rel=prefetch - empty string destination >-promise_test(async t => { >- await new Promise((resolve, reject) => { >- let node = frame.contentWindow.document.createElement("link"); >- node.rel = "prefetch"; >- node.onload = resolve; >- node.onerror = reject; >- node.href = "dummy?dest="; >- frame.contentWindow.document.body.appendChild(node); >- }).catch(() => { >- assert_unreached("Fetch errored."); >- }); >-}, 'HTMLLinkElement with rel=prefetch fetches with an empty string Request.destination'); >- > </script> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/destination/resources/fetch-destination-worker-no-load-event.js b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/destination/resources/fetch-destination-worker-no-load-event.js >index 5a3c679cc03e4694e92051f32b1e7c797ecaff05..c1b6c506e957198c97db679c7d25e93952af3376 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/destination/resources/fetch-destination-worker-no-load-event.js >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/destination/resources/fetch-destination-worker-no-load-event.js >@@ -1,7 +1,8 @@ > self.addEventListener('fetch', function(event) { >- if (event.request.url.includes('dummy')) { >+ const url = event.request.url; >+ if (url.includes('dummy') && url.includes('?')) { > event.waitUntil(async function() { >- let destination = new URL(event.request.url).searchParams.get("dest"); >+ let destination = new URL(url).searchParams.get("dest"); > var result = "FAIL"; > if (event.request.destination == destination) { > result = "PASS"; >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/destination/w3c-import.log b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/destination/w3c-import.log >index fea0a100f1db9a13e79d8ecd6ac4aeaf70ccfcce..b634a7ce7a8a3ab069318975158996b54a86c42a 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/destination/w3c-import.log >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/destination/w3c-import.log >@@ -16,5 +16,6 @@ None > List of files: > /LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/destination/fetch-destination-iframe.https.html > /LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/destination/fetch-destination-no-load-event.https.html >+/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/destination/fetch-destination-prefetch.https.html > /LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/destination/fetch-destination-worker.https.html > /LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/destination/fetch-destination.https.html >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/multi-globals/current/w3c-import.log b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/multi-globals/current/w3c-import.log >index e0033a1db88c2e396c0e26b126dd982d95f103e9..3d0cddec200fbbacff003f80ea58d0a008d57db0 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/multi-globals/current/w3c-import.log >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/multi-globals/current/w3c-import.log >@@ -1,7 +1,7 @@ > The tests in this directory were imported from the W3C repository. > Do NOT modify these tests directly in WebKit. > Instead, create a pull request on the WPT github: >- https://github.com/w3c/web-platform-tests >+ https://github.com/web-platform-tests/wpt > > Then run the Tools/Scripts/import-w3c-tests in WebKit to reimport > >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/multi-globals/incumbent/w3c-import.log b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/multi-globals/incumbent/w3c-import.log >index 54e77696b888ed0ea05fe1cb9a6b98c0d826f34f..729c8d2d703c1553f5f05fc2c1af39e1e9ecf749 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/multi-globals/incumbent/w3c-import.log >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/multi-globals/incumbent/w3c-import.log >@@ -1,7 +1,7 @@ > The tests in this directory were imported from the W3C repository. > Do NOT modify these tests directly in WebKit. > Instead, create a pull request on the WPT github: >- https://github.com/w3c/web-platform-tests >+ https://github.com/web-platform-tests/wpt > > Then run the Tools/Scripts/import-w3c-tests in WebKit to reimport > >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/multi-globals/w3c-import.log b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/multi-globals/w3c-import.log >index 9f43e53c489d21025dc3355fbaa8253de50ed227..384b5077c9766183ea3a3f086ff72223da1a4d79 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/multi-globals/w3c-import.log >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/multi-globals/w3c-import.log >@@ -1,7 +1,7 @@ > The tests in this directory were imported from the W3C repository. > Do NOT modify these tests directly in WebKit. > Instead, create a pull request on the WPT github: >- https://github.com/w3c/web-platform-tests >+ https://github.com/web-platform-tests/wpt > > Then run the Tools/Scripts/import-w3c-tests in WebKit to reimport > >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-bad-port-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-bad-port-expected.txt >index ace1e34c36dc11751a95802b040a5176edb5e879..5883c906cc89af2656caa0dc2b901dbf62a9a76a 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-bad-port-expected.txt >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-bad-port-expected.txt >@@ -1,137 +1,137 @@ > Blocked access to external URL http://example.com:1/ >-CONSOLE MESSAGE: line 80: Fetch API cannot load http://example.com:1/ due to access control checks. >+CONSOLE MESSAGE: line 82: Fetch API cannot load http://example.com:1/ due to access control checks. > Blocked access to external URL http://example.com:7/ >-CONSOLE MESSAGE: line 80: Fetch API cannot load http://example.com:7/ due to access control checks. >+CONSOLE MESSAGE: line 82: Fetch API cannot load http://example.com:7/ due to access control checks. > Blocked access to external URL http://example.com:9/ >-CONSOLE MESSAGE: line 80: Fetch API cannot load http://example.com:9/ due to access control checks. >+CONSOLE MESSAGE: line 82: Fetch API cannot load http://example.com:9/ due to access control checks. > Blocked access to external URL http://example.com:11/ >-CONSOLE MESSAGE: line 80: Fetch API cannot load http://example.com:11/ due to access control checks. >+CONSOLE MESSAGE: line 82: Fetch API cannot load http://example.com:11/ due to access control checks. > Blocked access to external URL http://example.com:13/ >-CONSOLE MESSAGE: line 80: Fetch API cannot load http://example.com:13/ due to access control checks. >+CONSOLE MESSAGE: line 82: Fetch API cannot load http://example.com:13/ due to access control checks. > Blocked access to external URL http://example.com:15/ >-CONSOLE MESSAGE: line 80: Fetch API cannot load http://example.com:15/ due to access control checks. >+CONSOLE MESSAGE: line 82: Fetch API cannot load http://example.com:15/ due to access control checks. > Blocked access to external URL http://example.com:17/ >-CONSOLE MESSAGE: line 80: Fetch API cannot load http://example.com:17/ due to access control checks. >+CONSOLE MESSAGE: line 82: Fetch API cannot load http://example.com:17/ due to access control checks. > Blocked access to external URL http://example.com:19/ >-CONSOLE MESSAGE: line 80: Fetch API cannot load http://example.com:19/ due to access control checks. >+CONSOLE MESSAGE: line 82: Fetch API cannot load http://example.com:19/ due to access control checks. > Blocked access to external URL http://example.com:20/ >-CONSOLE MESSAGE: line 80: Fetch API cannot load http://example.com:20/ due to access control checks. >+CONSOLE MESSAGE: line 82: Fetch API cannot load http://example.com:20/ due to access control checks. > Blocked access to external URL http://example.com:21/ >-CONSOLE MESSAGE: line 80: Fetch API cannot load http://example.com:21/ due to access control checks. >+CONSOLE MESSAGE: line 82: Fetch API cannot load http://example.com:21/ due to access control checks. > Blocked access to external URL http://example.com:22/ >-CONSOLE MESSAGE: line 80: Fetch API cannot load http://example.com:22/ due to access control checks. >+CONSOLE MESSAGE: line 82: Fetch API cannot load http://example.com:22/ due to access control checks. > Blocked access to external URL http://example.com:23/ >-CONSOLE MESSAGE: line 80: Fetch API cannot load http://example.com:23/ due to access control checks. >+CONSOLE MESSAGE: line 82: Fetch API cannot load http://example.com:23/ due to access control checks. > Blocked access to external URL http://example.com:25/ >-CONSOLE MESSAGE: line 80: Fetch API cannot load http://example.com:25/ due to access control checks. >+CONSOLE MESSAGE: line 82: Fetch API cannot load http://example.com:25/ due to access control checks. > Blocked access to external URL http://example.com:37/ >-CONSOLE MESSAGE: line 80: Fetch API cannot load http://example.com:37/ due to access control checks. >+CONSOLE MESSAGE: line 82: Fetch API cannot load http://example.com:37/ due to access control checks. > Blocked access to external URL http://example.com:42/ >-CONSOLE MESSAGE: line 80: Fetch API cannot load http://example.com:42/ due to access control checks. >+CONSOLE MESSAGE: line 82: Fetch API cannot load http://example.com:42/ due to access control checks. > Blocked access to external URL http://example.com:43/ >-CONSOLE MESSAGE: line 80: Fetch API cannot load http://example.com:43/ due to access control checks. >+CONSOLE MESSAGE: line 82: Fetch API cannot load http://example.com:43/ due to access control checks. > Blocked access to external URL http://example.com:53/ >-CONSOLE MESSAGE: line 80: Fetch API cannot load http://example.com:53/ due to access control checks. >+CONSOLE MESSAGE: line 82: Fetch API cannot load http://example.com:53/ due to access control checks. > Blocked access to external URL http://example.com:77/ >-CONSOLE MESSAGE: line 80: Fetch API cannot load http://example.com:77/ due to access control checks. >+CONSOLE MESSAGE: line 82: Fetch API cannot load http://example.com:77/ due to access control checks. > Blocked access to external URL http://example.com:79/ >-CONSOLE MESSAGE: line 80: Fetch API cannot load http://example.com:79/ due to access control checks. >+CONSOLE MESSAGE: line 82: Fetch API cannot load http://example.com:79/ due to access control checks. > Blocked access to external URL http://example.com:87/ >-CONSOLE MESSAGE: line 80: Fetch API cannot load http://example.com:87/ due to access control checks. >+CONSOLE MESSAGE: line 82: Fetch API cannot load http://example.com:87/ due to access control checks. > Blocked access to external URL http://example.com:95/ >-CONSOLE MESSAGE: line 80: Fetch API cannot load http://example.com:95/ due to access control checks. >+CONSOLE MESSAGE: line 82: Fetch API cannot load http://example.com:95/ due to access control checks. > Blocked access to external URL http://example.com:101/ >-CONSOLE MESSAGE: line 80: Fetch API cannot load http://example.com:101/ due to access control checks. >+CONSOLE MESSAGE: line 82: Fetch API cannot load http://example.com:101/ due to access control checks. > Blocked access to external URL http://example.com:102/ >-CONSOLE MESSAGE: line 80: Fetch API cannot load http://example.com:102/ due to access control checks. >+CONSOLE MESSAGE: line 82: Fetch API cannot load http://example.com:102/ due to access control checks. > Blocked access to external URL http://example.com:103/ >-CONSOLE MESSAGE: line 80: Fetch API cannot load http://example.com:103/ due to access control checks. >+CONSOLE MESSAGE: line 82: Fetch API cannot load http://example.com:103/ due to access control checks. > Blocked access to external URL http://example.com:104/ >-CONSOLE MESSAGE: line 80: Fetch API cannot load http://example.com:104/ due to access control checks. >+CONSOLE MESSAGE: line 82: Fetch API cannot load http://example.com:104/ due to access control checks. > Blocked access to external URL http://example.com:109/ >-CONSOLE MESSAGE: line 80: Fetch API cannot load http://example.com:109/ due to access control checks. >+CONSOLE MESSAGE: line 82: Fetch API cannot load http://example.com:109/ due to access control checks. > Blocked access to external URL http://example.com:110/ >-CONSOLE MESSAGE: line 80: Fetch API cannot load http://example.com:110/ due to access control checks. >+CONSOLE MESSAGE: line 82: Fetch API cannot load http://example.com:110/ due to access control checks. > Blocked access to external URL http://example.com:111/ >-CONSOLE MESSAGE: line 80: Fetch API cannot load http://example.com:111/ due to access control checks. >+CONSOLE MESSAGE: line 82: Fetch API cannot load http://example.com:111/ due to access control checks. > Blocked access to external URL http://example.com:113/ >-CONSOLE MESSAGE: line 80: Fetch API cannot load http://example.com:113/ due to access control checks. >+CONSOLE MESSAGE: line 82: Fetch API cannot load http://example.com:113/ due to access control checks. > Blocked access to external URL http://example.com:115/ >-CONSOLE MESSAGE: line 80: Fetch API cannot load http://example.com:115/ due to access control checks. >+CONSOLE MESSAGE: line 82: Fetch API cannot load http://example.com:115/ due to access control checks. > Blocked access to external URL http://example.com:117/ >-CONSOLE MESSAGE: line 80: Fetch API cannot load http://example.com:117/ due to access control checks. >+CONSOLE MESSAGE: line 82: Fetch API cannot load http://example.com:117/ due to access control checks. > Blocked access to external URL http://example.com:119/ >-CONSOLE MESSAGE: line 80: Fetch API cannot load http://example.com:119/ due to access control checks. >+CONSOLE MESSAGE: line 82: Fetch API cannot load http://example.com:119/ due to access control checks. > Blocked access to external URL http://example.com:123/ >-CONSOLE MESSAGE: line 80: Fetch API cannot load http://example.com:123/ due to access control checks. >+CONSOLE MESSAGE: line 82: Fetch API cannot load http://example.com:123/ due to access control checks. > Blocked access to external URL http://example.com:135/ >-CONSOLE MESSAGE: line 80: Fetch API cannot load http://example.com:135/ due to access control checks. >+CONSOLE MESSAGE: line 82: Fetch API cannot load http://example.com:135/ due to access control checks. > Blocked access to external URL http://example.com:139/ >-CONSOLE MESSAGE: line 80: Fetch API cannot load http://example.com:139/ due to access control checks. >+CONSOLE MESSAGE: line 82: Fetch API cannot load http://example.com:139/ due to access control checks. > Blocked access to external URL http://example.com:143/ >-CONSOLE MESSAGE: line 80: Fetch API cannot load http://example.com:143/ due to access control checks. >+CONSOLE MESSAGE: line 82: Fetch API cannot load http://example.com:143/ due to access control checks. > Blocked access to external URL http://example.com:179/ >-CONSOLE MESSAGE: line 80: Fetch API cannot load http://example.com:179/ due to access control checks. >+CONSOLE MESSAGE: line 82: Fetch API cannot load http://example.com:179/ due to access control checks. > Blocked access to external URL http://example.com:389/ >-CONSOLE MESSAGE: line 80: Fetch API cannot load http://example.com:389/ due to access control checks. >+CONSOLE MESSAGE: line 82: Fetch API cannot load http://example.com:389/ due to access control checks. > Blocked access to external URL http://example.com:427/ >-CONSOLE MESSAGE: line 80: Fetch API cannot load http://example.com:427/ due to access control checks. >+CONSOLE MESSAGE: line 82: Fetch API cannot load http://example.com:427/ due to access control checks. > Blocked access to external URL http://example.com:465/ >-CONSOLE MESSAGE: line 80: Fetch API cannot load http://example.com:465/ due to access control checks. >+CONSOLE MESSAGE: line 82: Fetch API cannot load http://example.com:465/ due to access control checks. > Blocked access to external URL http://example.com:512/ >-CONSOLE MESSAGE: line 80: Fetch API cannot load http://example.com:512/ due to access control checks. >+CONSOLE MESSAGE: line 82: Fetch API cannot load http://example.com:512/ due to access control checks. > Blocked access to external URL http://example.com:513/ >-CONSOLE MESSAGE: line 80: Fetch API cannot load http://example.com:513/ due to access control checks. >+CONSOLE MESSAGE: line 82: Fetch API cannot load http://example.com:513/ due to access control checks. > Blocked access to external URL http://example.com:514/ >-CONSOLE MESSAGE: line 80: Fetch API cannot load http://example.com:514/ due to access control checks. >+CONSOLE MESSAGE: line 82: Fetch API cannot load http://example.com:514/ due to access control checks. > Blocked access to external URL http://example.com:515/ >-CONSOLE MESSAGE: line 80: Fetch API cannot load http://example.com:515/ due to access control checks. >+CONSOLE MESSAGE: line 82: Fetch API cannot load http://example.com:515/ due to access control checks. > Blocked access to external URL http://example.com:526/ >-CONSOLE MESSAGE: line 80: Fetch API cannot load http://example.com:526/ due to access control checks. >+CONSOLE MESSAGE: line 82: Fetch API cannot load http://example.com:526/ due to access control checks. > Blocked access to external URL http://example.com:530/ >-CONSOLE MESSAGE: line 80: Fetch API cannot load http://example.com:530/ due to access control checks. >+CONSOLE MESSAGE: line 82: Fetch API cannot load http://example.com:530/ due to access control checks. > Blocked access to external URL http://example.com:531/ >-CONSOLE MESSAGE: line 80: Fetch API cannot load http://example.com:531/ due to access control checks. >+CONSOLE MESSAGE: line 82: Fetch API cannot load http://example.com:531/ due to access control checks. > Blocked access to external URL http://example.com:532/ >-CONSOLE MESSAGE: line 80: Fetch API cannot load http://example.com:532/ due to access control checks. >+CONSOLE MESSAGE: line 82: Fetch API cannot load http://example.com:532/ due to access control checks. > Blocked access to external URL http://example.com:540/ >-CONSOLE MESSAGE: line 80: Fetch API cannot load http://example.com:540/ due to access control checks. >+CONSOLE MESSAGE: line 82: Fetch API cannot load http://example.com:540/ due to access control checks. > Blocked access to external URL http://example.com:548/ >-CONSOLE MESSAGE: line 80: Fetch API cannot load http://example.com:548/ due to access control checks. >+CONSOLE MESSAGE: line 82: Fetch API cannot load http://example.com:548/ due to access control checks. > Blocked access to external URL http://example.com:556/ >-CONSOLE MESSAGE: line 80: Fetch API cannot load http://example.com:556/ due to access control checks. >+CONSOLE MESSAGE: line 82: Fetch API cannot load http://example.com:556/ due to access control checks. > Blocked access to external URL http://example.com:563/ >-CONSOLE MESSAGE: line 80: Fetch API cannot load http://example.com:563/ due to access control checks. >+CONSOLE MESSAGE: line 82: Fetch API cannot load http://example.com:563/ due to access control checks. > Blocked access to external URL http://example.com:587/ >-CONSOLE MESSAGE: line 80: Fetch API cannot load http://example.com:587/ due to access control checks. >+CONSOLE MESSAGE: line 82: Fetch API cannot load http://example.com:587/ due to access control checks. > Blocked access to external URL http://example.com:601/ >-CONSOLE MESSAGE: line 80: Fetch API cannot load http://example.com:601/ due to access control checks. >+CONSOLE MESSAGE: line 82: Fetch API cannot load http://example.com:601/ due to access control checks. > Blocked access to external URL http://example.com:636/ >-CONSOLE MESSAGE: line 80: Fetch API cannot load http://example.com:636/ due to access control checks. >+CONSOLE MESSAGE: line 82: Fetch API cannot load http://example.com:636/ due to access control checks. > Blocked access to external URL http://example.com:993/ >-CONSOLE MESSAGE: line 80: Fetch API cannot load http://example.com:993/ due to access control checks. >+CONSOLE MESSAGE: line 82: Fetch API cannot load http://example.com:993/ due to access control checks. > Blocked access to external URL http://example.com:995/ >-CONSOLE MESSAGE: line 80: Fetch API cannot load http://example.com:995/ due to access control checks. >+CONSOLE MESSAGE: line 82: Fetch API cannot load http://example.com:995/ due to access control checks. > Blocked access to external URL http://example.com:2049/ >-CONSOLE MESSAGE: line 80: Fetch API cannot load http://example.com:2049/ due to access control checks. >+CONSOLE MESSAGE: line 82: Fetch API cannot load http://example.com:2049/ due to access control checks. > Blocked access to external URL http://example.com:3659/ >-CONSOLE MESSAGE: line 80: Fetch API cannot load http://example.com:3659/ due to access control checks. >+CONSOLE MESSAGE: line 82: Fetch API cannot load http://example.com:3659/ due to access control checks. > Blocked access to external URL http://example.com:4045/ >-CONSOLE MESSAGE: line 80: Fetch API cannot load http://example.com:4045/ due to access control checks. >+CONSOLE MESSAGE: line 82: Fetch API cannot load http://example.com:4045/ due to access control checks. > Blocked access to external URL http://example.com:6000/ >-CONSOLE MESSAGE: line 80: Fetch API cannot load http://example.com:6000/ due to access control checks. >+CONSOLE MESSAGE: line 82: Fetch API cannot load http://example.com:6000/ due to access control checks. > Blocked access to external URL http://example.com:6665/ >-CONSOLE MESSAGE: line 80: Fetch API cannot load http://example.com:6665/ due to access control checks. >+CONSOLE MESSAGE: line 82: Fetch API cannot load http://example.com:6665/ due to access control checks. > Blocked access to external URL http://example.com:6666/ >-CONSOLE MESSAGE: line 80: Fetch API cannot load http://example.com:6666/ due to access control checks. >+CONSOLE MESSAGE: line 82: Fetch API cannot load http://example.com:6666/ due to access control checks. > Blocked access to external URL http://example.com:6667/ >-CONSOLE MESSAGE: line 80: Fetch API cannot load http://example.com:6667/ due to access control checks. >+CONSOLE MESSAGE: line 82: Fetch API cannot load http://example.com:6667/ due to access control checks. > Blocked access to external URL http://example.com:6668/ >-CONSOLE MESSAGE: line 80: Fetch API cannot load http://example.com:6668/ due to access control checks. >+CONSOLE MESSAGE: line 82: Fetch API cannot load http://example.com:6668/ due to access control checks. > Blocked access to external URL http://example.com:6669/ >-CONSOLE MESSAGE: line 80: Fetch API cannot load http://example.com:6669/ due to access control checks. >+CONSOLE MESSAGE: line 82: Fetch API cannot load http://example.com:6669/ due to access control checks. > Blocked access to external URL http://example.com:6697/ >-CONSOLE MESSAGE: line 80: Fetch API cannot load http://example.com:6697/ due to access control checks. >+CONSOLE MESSAGE: line 82: Fetch API cannot load http://example.com:6697/ due to access control checks. > > PASS Request on bad port 1 should throw TypeError. > PASS Request on bad port 7 should throw TypeError. >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-bad-port.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-bad-port.html >index 63ac6dee9580c075fc71c1a28a470a5e7993e5c6..33610381b6e4e3334691d23b75479dae5e8ed920 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-bad-port.html >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-bad-port.html >@@ -4,6 +4,7 @@ > <script src="/resources/testharness.js"></script> > <script src="/resources/testharnessreport.js"></script> > <script> >+ > // list of bad ports according to > // https://fetch.spec.whatwg.org/#port-blocking > var BLOCKED_PORTS_LIST = [ >@@ -75,6 +76,7 @@ > 6669, // irc (alternate) > 6697, // irc+tls > ]; >+ > BLOCKED_PORTS_LIST.map(function(a){ > promise_test(function(t){ > return promise_rejects(t, new TypeError(), fetch("http://example.com:" + a)) >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache-only-if-cached-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache-only-if-cached-expected.txt >index 55be39d4e43e2371652134f9ce24325dbe1e0e3e..172b5744de0a279c322b48559210b3337bebdca4 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache-only-if-cached-expected.txt >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-cache-only-if-cached-expected.txt >@@ -1,11 +1,15 @@ >-CONSOLE MESSAGE: Unsafe attempt to load URL http://127.0.0.1:8800/fetch/api/request/resources/cache.py?token=ce6ffac1-30ee-4599-9a21-3c3bc8dd3811&content=0.7587677494390418&tag=0.6071735683284318&expires=Sat,%2004%20May%202019%2022:00:00%20GMT from origin http://localhost:8800. Domains, protocols and ports must match. >+CONSOLE MESSAGE: Unsafe attempt to load URL http://127.0.0.1:8800/fetch/api/request/resources/cache.py?token=d01dbadc-e50c-4ac9-af14-d4e81b602fdb&content=0.804209027234067&tag=0.036638426229378296&expires=Sat,%2004%20Jan%202020%2008:00:00%20GMT from origin http://localhost:8800. Domains, protocols and ports must match. > >-CONSOLE MESSAGE: Unsafe attempt to load URL http://127.0.0.1:8800/fetch/api/request/resources/cache.py?token=eee4af0a-4608-4633-a2c6-b20c8a201f2e&content=0.6883609857104735&date=Fri,%2011%20May%202018%2009:04:04%20GMT&expires=Sat,%2004%20May%202019%2022:00:00%20GMT from origin http://localhost:8800. Domains, protocols and ports must match. >+CONSOLE MESSAGE: Fetch API cannot load http://127.0.0.1:8800/fetch/api/request/resources/cache.py?token=d01dbadc-e50c-4ac9-af14-d4e81b602fdb&content=0.804209027234067&tag=0.036638426229378296&expires=Sat,%2004%20Jan%202020%2008:00:00%20GMT due to access control checks. >+CONSOLE MESSAGE: Unsafe attempt to load URL http://127.0.0.1:8800/fetch/api/request/resources/cache.py?token=83aa557c-5c51-4440-921b-4ca337c302ff&content=0.24542566599674265&date=Thu,%2003%20Jan%202019%2020:33:31%20GMT&expires=Sat,%2004%20Jan%202020%2008:00:00%20GMT from origin http://localhost:8800. Domains, protocols and ports must match. > >-CONSOLE MESSAGE: Unsafe attempt to load URL http://127.0.0.1:8800/fetch/api/request/resources/cache.py?token=98e0687c-a6ad-43a7-b5d5-1f5d0b8f0f84&content=0.4297484792527445&tag=0.5302996298721283&expires=Thu,%2004%20May%202017%2022:00:00%20GMT from origin http://localhost:8800. Domains, protocols and ports must match. >+CONSOLE MESSAGE: Fetch API cannot load http://127.0.0.1:8800/fetch/api/request/resources/cache.py?token=83aa557c-5c51-4440-921b-4ca337c302ff&content=0.24542566599674265&date=Thu,%2003%20Jan%202019%2020:33:31%20GMT&expires=Sat,%2004%20Jan%202020%2008:00:00%20GMT due to access control checks. >+CONSOLE MESSAGE: Unsafe attempt to load URL http://127.0.0.1:8800/fetch/api/request/resources/cache.py?token=43898b6b-9c40-4a61-895e-30b5d5e7ebcf&content=0.9709631928702825&tag=0.04895515532690764&expires=Thu,%2004%20Jan%202018%2008:00:00%20GMT from origin http://localhost:8800. Domains, protocols and ports must match. > >-CONSOLE MESSAGE: Unsafe attempt to load URL http://127.0.0.1:8800/fetch/api/request/resources/cache.py?token=15558b2a-19d7-4424-b537-e7f8ea393309&content=0.60391288329165&date=Fri,%2011%20May%202018%2009:04:04%20GMT&expires=Thu,%2004%20May%202017%2022:00:00%20GMT from origin http://localhost:8800. Domains, protocols and ports must match. >+CONSOLE MESSAGE: Fetch API cannot load http://127.0.0.1:8800/fetch/api/request/resources/cache.py?token=43898b6b-9c40-4a61-895e-30b5d5e7ebcf&content=0.9709631928702825&tag=0.04895515532690764&expires=Thu,%2004%20Jan%202018%2008:00:00%20GMT due to access control checks. >+CONSOLE MESSAGE: Unsafe attempt to load URL http://127.0.0.1:8800/fetch/api/request/resources/cache.py?token=42997c41-bbe2-42d2-aba8-1b1b7b661f8c&content=0.15570209656970524&date=Thu,%2003%20Jan%202019%2020:33:31%20GMT&expires=Thu,%2004%20Jan%202018%2008:00:00%20GMT from origin http://localhost:8800. Domains, protocols and ports must match. > >+CONSOLE MESSAGE: Fetch API cannot load http://127.0.0.1:8800/fetch/api/request/resources/cache.py?token=42997c41-bbe2-42d2-aba8-1b1b7b661f8c&content=0.15570209656970524&date=Thu,%2003%20Jan%202019%2020:33:31%20GMT&expires=Thu,%2004%20Jan%202018%2008:00:00%20GMT due to access control checks. > > PASS RequestCache "only-if-cached" mode checks the cache for previously cached content and avoids revalidation for stale responses with Etag and stale response > PASS RequestCache "only-if-cached" mode checks the cache for previously cached content and avoids revalidation for stale responses with Last-Modified and stale response >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-consume-empty.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-consume-empty.html >index c84d2cecd3799967d6a1e371a5142d28a927c4b5..c3b8bc4f54bd4dcdbc3c8b2eeea8799d1c60ea05 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-consume-empty.html >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-consume-empty.html >@@ -106,7 +106,7 @@ > checkRequestWithEmptyBody("blob", new Blob([], { "type" : "text/plain" }), true); > checkRequestWithEmptyBody("text", "", true); > checkRequestWithEmptyBody("URLSearchParams", new URLSearchParams(""), true); >- // FIXME: This test assumes that the empty string be returned but it is not clear whether that is right. See https://github.com/w3c/web-platform-tests/pull/3950. >+ // FIXME: This test assumes that the empty string be returned but it is not clear whether that is right. See https://github.com/web-platform-tests/wpt/pull/3950. > checkRequestWithEmptyBody("FormData", new FormData(), true); > checkRequestWithEmptyBody("ArrayBuffer", new ArrayBuffer(), true); > </script> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-idl-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-idl-expected.txt >deleted file mode 100644 >index 60a779c9ee49832c401ce3086b625bc7aa998943..0000000000000000000000000000000000000000 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-idl-expected.txt >+++ /dev/null >@@ -1,48 +0,0 @@ >- >-PASS Request interface: existence and properties of interface object >-PASS Request interface object length >-PASS Request interface object name >-PASS Request interface: existence and properties of interface prototype object >-PASS Request interface: existence and properties of interface prototype object's "constructor" property >-PASS Request interface: existence and properties of interface prototype object's @@unscopables property >-PASS Request interface: attribute method >-PASS Request interface: attribute url >-PASS Request interface: attribute headers >-PASS Request interface: attribute destination >-PASS Request interface: attribute referrer >-PASS Request interface: attribute referrerPolicy >-PASS Request interface: attribute mode >-PASS Request interface: attribute credentials >-PASS Request interface: attribute cache >-PASS Request interface: attribute redirect >-PASS Request interface: attribute integrity >-PASS Request interface: operation clone() >-PASS Request interface: attribute body >-PASS Request interface: attribute bodyUsed >-PASS Request interface: operation arrayBuffer() >-PASS Request interface: operation blob() >-PASS Request interface: operation formData() >-PASS Request interface: operation json() >-PASS Request interface: operation text() >-PASS Request must be primary interface of new Request("") >-PASS Stringification of new Request("") >-PASS Request interface: new Request("") must inherit property "method" with the proper type >-PASS Request interface: new Request("") must inherit property "url" with the proper type >-PASS Request interface: new Request("") must inherit property "headers" with the proper type >-PASS Request interface: new Request("") must inherit property "destination" with the proper type >-PASS Request interface: new Request("") must inherit property "referrer" with the proper type >-PASS Request interface: new Request("") must inherit property "referrerPolicy" with the proper type >-PASS Request interface: new Request("") must inherit property "mode" with the proper type >-PASS Request interface: new Request("") must inherit property "credentials" with the proper type >-PASS Request interface: new Request("") must inherit property "cache" with the proper type >-PASS Request interface: new Request("") must inherit property "redirect" with the proper type >-PASS Request interface: new Request("") must inherit property "integrity" with the proper type >-PASS Request interface: new Request("") must inherit property "clone()" with the proper type >-PASS Request interface: new Request("") must inherit property "body" with the proper type >-PASS Request interface: new Request("") must inherit property "bodyUsed" with the proper type >-PASS Request interface: new Request("") must inherit property "arrayBuffer()" with the proper type >-PASS Request interface: new Request("") must inherit property "blob()" with the proper type >-PASS Request interface: new Request("") must inherit property "formData()" with the proper type >-PASS Request interface: new Request("") must inherit property "json()" with the proper type >-PASS Request interface: new Request("") must inherit property "text()" with the proper type >- >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-idl.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-idl.html >deleted file mode 100644 >index f7833779ce25acc942dda9abc3c54123b33e442a..0000000000000000000000000000000000000000 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-idl.html >+++ /dev/null >@@ -1,88 +0,0 @@ >-<!doctype html> >-<html> >- <head> >- <meta charset="utf-8"> >- <title>Request idl interface</title> >- <meta name="help" href="https://fetch.spec.whatwg.org/#response"> >- <meta name="author" title="Canon Research France" href="https://www.crf.canon.fr"> >- <script src="/resources/testharness.js"></script> >- <script src="/resources/testharnessreport.js"></script> >- <script src="/resources/WebIDLParser.js"></script> >- <script src="/resources/idlharness.js"></script> >- </head> >- <body> >- <script id="body-idl" type="text/plain"> >- typedef any JSON; >- typedef (Blob or BufferSource or FormData or URLSearchParams or USVString) BodyInit; >- >- interface mixin Body { >- readonly attribute ReadableStream? body; >- readonly attribute boolean bodyUsed; >- [NewObject] Promise<ArrayBuffer> arrayBuffer(); >- [NewObject] Promise<Blob> blob(); >- [NewObject] Promise<FormData> formData(); >- [NewObject] Promise<JSON> json(); >- [NewObject] Promise<USVString> text(); >- }; >- </script> >- <script id="request-idl" type="text/plain"> >- typedef (Request or USVString) RequestInfo; >- >- [Constructor(RequestInfo input, optional RequestInit init), >- Exposed=(Window,Worker)] >- interface Request { >- readonly attribute ByteString method; >- readonly attribute USVString url; >- [SameObject] readonly attribute Headers headers; >- >- readonly attribute RequestDestination destination; >- readonly attribute USVString referrer; >- readonly attribute ReferrerPolicy referrerPolicy; >- readonly attribute RequestMode mode; >- readonly attribute RequestCredentials credentials; >- readonly attribute RequestCache cache; >- readonly attribute RequestRedirect redirect; >- readonly attribute DOMString integrity; >- >- [NewObject] Request clone(); >- }; >- Request includes Body; >- >- dictionary RequestInit { >- ByteString method; >- HeadersInit headers; >- BodyInit? body; >- USVString referrer; >- ReferrerPolicy referrerPolicy; >- RequestMode mode; >- RequestCredentials credentials; >- RequestCache cache; >- RequestRedirect redirect; >- DOMString integrity; >- any window; // can only be set to null >- }; >- >- enum RequestType { "", "audio", "font", "image", "script", "style", "track", "video" }; >- enum RequestDestination { "", "document", "sharedworker", "subresource", "unknown", "worker" }; >- enum RequestMode { "navigate", "same-origin", "no-cors", "cors" }; >- enum RequestCredentials { "omit", "same-origin", "include" }; >- enum RequestCache { "default", "no-store", "reload", "no-cache", "force-cache", "only-if-cached" }; >- enum RequestRedirect { "follow", "error", "manual" }; >- enum ReferrerPolicy { >- "", "no-referrer", "no-referrer-when-downgrade", "origin", >- "origin-when-cross-origin", "unsafe-url", "same-origin", "strict-origin", >- "strict-origin-when-cross-origin" >- }; >- </script> >- <script> >- var idlsArray = new IdlArray(); >- var idl = document.getElementById("body-idl").textContent >- idl += document.getElementById("request-idl").textContent >- >- idlsArray.add_idls(idl); >- idlsArray.add_untested_idls("interface Headers {};"); >- idlsArray.add_objects({ Request: ['new Request("")'] }); >- idlsArray.test(); >- </script> >- </body> >-</html> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-init-002-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-init-002-expected.txt >index 009a00dd4c10a8e7032f6134382fd5d3d77494cc..d6480524733653798ea30f7dddc76c1e565dbadd 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-init-002-expected.txt >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-init-002-expected.txt >@@ -1,9 +1,10 @@ > > PASS Initialize Request with headers values >-PASS Initialize Request's body with undefined >-PASS Initialize Request's body with null >-PASS Initialize Request's body with application/octet-binary >-FAIL Initialize Request's body with multipart/form-data promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported." >-PASS Initialize Request's body with text/plain;charset=UTF-8 >-PASS Initialize Request's body with application/x-www-form-urlencoded;charset=UTF-8 >+PASS Initialize Request's body with "undefined", undefined >+PASS Initialize Request's body with "null", null >+PASS Initialize Request's body with "[object Blob]", application/octet-binary >+FAIL Initialize Request's body with "[object FormData]", multipart/form-data promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported." >+PASS Initialize Request's body with "This is a USVString", text/plain;charset=UTF-8 >+PASS Initialize Request's body with "hi!", text/plain;charset=UTF-8 >+PASS Initialize Request's body with "name=value", application/x-www-form-urlencoded;charset=UTF-8 > >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-init-002.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-init-002.html >index 5d92b09c568ef4f3f65bf963897b24c5456f998a..221b415a3c182fba064a13b631c1af887461ea33 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-init-002.html >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-init-002.html >@@ -43,7 +43,7 @@ > //not equals: cannot guess formData exact value > assert_true( bodyAsText.search(expectedTextBody) > -1, "Retrieve and verify request body"); > }); >- }, "Initialize Request's body with " + bodyType); >+ }, `Initialize Request's body with "${body}", ${bodyType}`); > } > > var blob = new Blob(["This is a blob"], {type: "application/octet-binary"}); >@@ -56,6 +56,7 @@ > checkRequestInit(blob, "application/octet-binary", "This is a blob"); > checkRequestInit(formaData, "multipart/form-data", "name=\"name\"\r\n\r\nvalue"); > checkRequestInit(usvString, "text/plain;charset=UTF-8", "This is a USVString"); >+ checkRequestInit({toString: () => "hi!"}, "text/plain;charset=UTF-8", "hi!"); > > // Ensure test does not time out in case of missing URLSearchParams support. > if (window.URLSearchParams) { >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-init-stream.any-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-init-stream.any-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..0959731637cf1103d25212637bf879ce42297343 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-init-stream.any-expected.txt >@@ -0,0 +1,8 @@ >+ >+FAIL Constructing a Request with a stream on which getReader() is called assert_throws: new Request() function "() => new Request(input, init)" did not throw >+FAIL Constructing a Request with a stream on which read() is called assert_throws: new Request() function "() => new Request(input, init)" did not throw >+FAIL Constructing a Request with a stream on which read() and releaseLock() are called assert_throws: new Request() function "() => new Request(input, init)" did not throw >+FAIL Constructing a Request with a Request on which body.getReader() is called assert_throws: fetch() function "async () => await fetch(input, init)" did not throw >+FAIL Constructing a Request with a Request on which body.getReader().read() is called assert_throws: fetch() function "async () => await fetch(input, init)" did not throw >+FAIL Constructing a Request with a Request on which read() and releaseLock() are called assert_throws: fetch() function "async () => await fetch(input, init)" did not throw >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-init-stream.any.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-init-stream.any.html >new file mode 100644 >index 0000000000000000000000000000000000000000..2382913528e693b3a5d56c660a45060980b548c3 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-init-stream.any.html >@@ -0,0 +1 @@ >+<!-- This file is required for WebKit test infrastructure to run the templated test --> >\ No newline at end of file >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-init-stream.any.js b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-init-stream.any.js >new file mode 100644 >index 0000000000000000000000000000000000000000..22e3f41bc2d8a38dd097e61145e213e3febbd108 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-init-stream.any.js >@@ -0,0 +1,51 @@ >+// META: global=window,worker >+ >+"use strict"; >+ >+async function assert_request(input, init) { >+ assert_throws(new TypeError(), () => new Request(input, init), "new Request()"); >+ assert_throws(new TypeError(), async () => await fetch(input, init), "fetch()"); >+} >+ >+promise_test(async () => { >+ const stream = new ReadableStream(); >+ stream.getReader(); >+ await assert_request("...", { method:"POST", body: stream }); >+}, "Constructing a Request with a stream on which getReader() is called"); >+ >+promise_test(async () => { >+ const stream = new ReadableStream(); >+ stream.getReader().read(); >+ await assert_request("...", { method:"POST", body: stream }); >+}, "Constructing a Request with a stream on which read() is called"); >+ >+promise_test(async () => { >+ const stream = new ReadableStream({ pull: c => c.enqueue(new Uint8Array()) }), >+ reader = stream.getReader(); >+ await reader.read(); >+ reader.releaseLock(); >+ await assert_request("...", { method:"POST", body: stream }); >+}, "Constructing a Request with a stream on which read() and releaseLock() are called"); >+ >+promise_test(async () => { >+ const request = new Request("...", { method: "POST", body: "..." }); >+ request.body.getReader(); >+ await assert_request(request); >+ assert_class_string(new Request(request, { body: "..." }), "Request"); >+}, "Constructing a Request with a Request on which body.getReader() is called"); >+ >+promise_test(async () => { >+ const request = new Request("...", { method: "POST", body: "..." }); >+ request.body.getReader().read(); >+ await assert_request(request); >+ assert_class_string(new Request(request, { body: "..." }), "Request"); >+}, "Constructing a Request with a Request on which body.getReader().read() is called"); >+ >+promise_test(async () => { >+ const request = new Request("...", { method: "POST", body: "..." }), >+ reader = request.body.getReader(); >+ await reader.read(); >+ reader.releaseLock(); >+ await assert_request(request); >+ assert_class_string(new Request(request, { body: "..." }), "Request"); >+}, "Constructing a Request with a Request on which read() and releaseLock() are called"); >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-init-stream.any.worker-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-init-stream.any.worker-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..0959731637cf1103d25212637bf879ce42297343 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-init-stream.any.worker-expected.txt >@@ -0,0 +1,8 @@ >+ >+FAIL Constructing a Request with a stream on which getReader() is called assert_throws: new Request() function "() => new Request(input, init)" did not throw >+FAIL Constructing a Request with a stream on which read() is called assert_throws: new Request() function "() => new Request(input, init)" did not throw >+FAIL Constructing a Request with a stream on which read() and releaseLock() are called assert_throws: new Request() function "() => new Request(input, init)" did not throw >+FAIL Constructing a Request with a Request on which body.getReader() is called assert_throws: fetch() function "async () => await fetch(input, init)" did not throw >+FAIL Constructing a Request with a Request on which body.getReader().read() is called assert_throws: fetch() function "async () => await fetch(input, init)" did not throw >+FAIL Constructing a Request with a Request on which read() and releaseLock() are called assert_throws: fetch() function "async () => await fetch(input, init)" did not throw >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-init-stream.any.worker.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-init-stream.any.worker.html >new file mode 100644 >index 0000000000000000000000000000000000000000..2382913528e693b3a5d56c660a45060980b548c3 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-init-stream.any.worker.html >@@ -0,0 +1 @@ >+<!-- This file is required for WebKit test infrastructure to run the templated test --> >\ No newline at end of file >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-keepalive-quota-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-keepalive-quota-expected.txt >index 283ff48d069c508992c350cad60424ac44c0a233..e936ef4a7299c29dc8d6b71ba90bba1ffd443836 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-keepalive-quota-expected.txt >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-keepalive-quota-expected.txt >@@ -1,14 +1,4 @@ >-CONSOLE MESSAGE: line 33: Reached maximum amount of queued data of 64Kb for keepalive requests >-CONSOLE MESSAGE: line 33: Fetch API cannot load http://localhost:8800/fetch/api/resources/trickle.py?count=1&ms=0 due to access control checks. >-CONSOLE MESSAGE: line 33: Reached maximum amount of queued data of 64Kb for keepalive requests >-CONSOLE MESSAGE: line 33: Fetch API cannot load http://localhost:8800/fetch/api/resources/trickle.py?count=1&ms=0 due to access control checks. >-CONSOLE MESSAGE: line 33: Reached maximum amount of queued data of 64Kb for keepalive requests >-CONSOLE MESSAGE: line 33: Fetch API cannot load http://localhost:8800/fetch/api/resources/trickle.py?count=1&ms=0 due to access control checks. >+CONSOLE MESSAGE: line 45: ReferenceError: Can't find variable: subsetTestByKey > >-PASS A Keep-Alive fetch() with a small body should succeed. >-PASS A Keep-Alive fetch() with a body at the Quota Limit should succeed. >-PASS A Keep-Alive fetch() with a body over the Quota Limit should reject. >-PASS A Keep-Alive fetch() should return its allocated Quota upon promise resolution. >-PASS A Keep-Alive fetch() should return only its allocated Quota upon promise resolution. >-PASS A Keep-Alive fetch() should not be allowed if the Quota is used up. >+FAIL Request Keepalive Quota Tests ReferenceError: Can't find variable: subsetTestByKey > >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-keepalive-quota.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-keepalive-quota.html >index 19596cea2c8fe2ff006b22f100b76c2634591801..f71b1b2996a388367a4c89d7613f788f57376c4a 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-keepalive-quota.html >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-keepalive-quota.html >@@ -6,9 +6,13 @@ > <meta name="help" href="https://fetch.spec.whatwg.org/#request"> > <meta name="help" href="https://fetch.spec.whatwg.org/#body-mixin"> > <meta name="author" title="Microsoft Edge" href="https://www.microsoft.com"> >- <meta name="timeout" content="long"> >+ <meta name="variant" content="?include=fast"> >+ <meta name="variant" content="?include=slow-1"> >+ <meta name="variant" content="?include=slow-2"> >+ <meta name="variant" content="?include=slow-3"> > <script src="/resources/testharness.js"></script> > <script src="/resources/testharnessreport.js"></script> >+ <script src="/common/subset-tests-by-key.js"></script> > </head> > <body> > <script> >@@ -38,22 +42,22 @@ > } > > // Test 1 Byte >- promise_test(function(test) { >+ subsetTestByKey("fast", promise_test, function(test) { > return fetchKeepAliveRequest(noDelay, 1 /* bodySize */); > }, 'A Keep-Alive fetch() with a small body should succeed.'); > > // Test Quota full limit >- promise_test(function(test) { >+ subsetTestByKey("fast", promise_test, function(test) { > return fetchKeepAliveRequest(noDelay, expectedQuota /* bodySize */); > }, 'A Keep-Alive fetch() with a body at the Quota Limit should succeed.'); > > // Test Quota + 1 Byte >- promise_test(function(test) { >+ subsetTestByKey("fast", promise_test, function(test) { > return promise_rejects(test, TypeError(), fetchKeepAliveRequest(noDelay, expectedQuota + 1)); > }, 'A Keep-Alive fetch() with a body over the Quota Limit should reject.'); > > // Test the Quota becomes available upon promise completion. >- promise_test(function (test) { >+ subsetTestByKey("slow-1", promise_test, function (test) { > // Fill our Quota then try to send a second fetch. > return fetchKeepAliveRequest(standardDelay, expectedQuota).then(() => { > // Now validate that we can send another Keep-Alive fetch for the full size of the quota. >@@ -62,7 +66,7 @@ > }, 'A Keep-Alive fetch() should return its allocated Quota upon promise resolution.'); > > // Ensure only the correct amount of Quota becomes available when a fetch completes. >- promise_test(function(test) { >+ subsetTestByKey("slow-2", promise_test, function(test) { > // Create a fetch that uses all but 1 Byte of the Quota and runs for 2x as long as the other requests. > const first = fetchKeepAliveRequest(standardDelay * 2, expectedQuota - 1); > >@@ -79,7 +83,7 @@ > }, 'A Keep-Alive fetch() should return only its allocated Quota upon promise resolution.'); > > // Test rejecting a fetch() after the quota is used up. >- promise_test(function (test) { >+ subsetTestByKey("slow-3", promise_test, function (test) { > // Fill our Quota then try to send a second fetch. > const p = fetchKeepAliveRequest(standardDelay, expectedQuota); > >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-reset-attributes.https-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-reset-attributes.https-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..627ed07474c5ae41839601d51debffd5348cfdc0 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-reset-attributes.https-expected.txt >@@ -0,0 +1,5 @@ >+ >+FAIL Request.isReloadNavigation is reset with non-empty RequestInit assert_equals: expected "old: false, new: false" but got "old: undefined, new: undefined" >+FAIL Request.isHistoryNavigation is reset with non-empty RequestInit assert_equals: expected "old: false, new: false" but got "old: undefined, new: undefined" >+PASS Request.mode is reset with non-empty RequestInit when it's "navigate" >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-reset-attributes.https.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-reset-attributes.https.html >new file mode 100644 >index 0000000000000000000000000000000000000000..7be3608d737c34a599795621f107ae5243d2ab13 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-reset-attributes.https.html >@@ -0,0 +1,96 @@ >+<!DOCTYPE html> >+<script src="/resources/testharness.js"></script> >+<script src="/resources/testharnessreport.js"></script> >+<script src="/common/get-host-info.sub.js"></script> >+<script src="/service-workers/service-worker/resources/test-helpers.sub.js"></script> >+<body> >+<script> >+const worker = 'resources/request-reset-attributes-worker.js'; >+ >+function wait(ms) { >+ return new Promise(resolve => step_timeout(resolve, ms)); >+} >+ >+promise_test(async (t) => { >+ const scope = 'resources/hello.txt?name=isReloadNavigation'; >+ let frame; >+ let reg; >+ >+ try { >+ reg = await service_worker_unregister_and_register(t, worker, scope); >+ await wait_for_state(t, reg.installing, 'activated'); >+ frame = await with_iframe(scope); >+ assert_equals(frame.contentDocument.body.textContent, >+ 'old: false, new: false'); >+ await new Promise((resolve) => { >+ frame.onload = resolve; >+ frame.contentWindow.location.reload(); >+ }); >+ assert_equals(frame.contentDocument.body.textContent, >+ 'old: true, new: false'); >+ } finally { >+ if (frame) { >+ frame.remove(); >+ } >+ if (reg) { >+ await reg.unregister(); >+ } >+ } >+ }, 'Request.isReloadNavigation is reset with non-empty RequestInit'); >+ >+promise_test(async (t) => { >+ const scope = 'resources/hello.html?name=isHistoryNavigation'; >+ let frame; >+ let reg; >+ >+ try { >+ reg = await service_worker_unregister_and_register(t, worker, scope); >+ await wait_for_state(t, reg.installing, 'activated'); >+ frame = await with_iframe(scope); >+ assert_equals(frame.contentDocument.body.textContent, >+ 'old: false, new: false'); >+ // Use step_timeout(0) to ensure the history entry is created for Blink >+ // and WebKit. See https://bugs.webkit.org/show_bug.cgi?id=42861. >+ await wait(0); >+ await new Promise((resolve) => { >+ frame.onload = resolve; >+ frame.src = 'resources/hello.html?ignore'; >+ }); >+ await wait(0); >+ await new Promise((resolve) => { >+ frame.onload = resolve; >+ frame.contentWindow.history.go(-1); >+ }); >+ assert_equals(frame.contentDocument.body.textContent, >+ 'old: true, new: false'); >+ } finally { >+ if (frame) { >+ frame.remove(); >+ } >+ if (reg) { >+ await reg.unregister(); >+ } >+ } >+}, 'Request.isHistoryNavigation is reset with non-empty RequestInit'); >+ >+promise_test(async (t) => { >+ const scope = 'resources/hello.txt?name=mode'; >+ let frame; >+ let reg; >+ >+ try { >+ reg = await service_worker_unregister_and_register(t, worker, scope); >+ await wait_for_state(t, reg.installing, 'activated'); >+ frame = await with_iframe(scope); >+ assert_equals(frame.contentDocument.body.textContent, >+ 'old: navigate, new: same-origin'); >+ } finally { >+ if (frame) { >+ frame.remove(); >+ } >+ if (reg) { >+ await reg.unregister(); >+ } >+ } >+ }, 'Request.mode is reset with non-empty RequestInit when it\'s "navigate"'); >+</script> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-structure-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-structure-expected.txt >index a51f8f44535b94efecced1b7a593c61e91b97110..c84a59a48e0d53f4907c926a139c2743e007366a 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-structure-expected.txt >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-structure-expected.txt >@@ -16,5 +16,7 @@ PASS Check credentials attribute > PASS Check cache attribute > PASS Check redirect attribute > PASS Check integrity attribute >+FAIL Check isReloadNavigation attribute assert_true: request has isReloadNavigation attribute expected true got false >+FAIL Check isHistoryNavigation attribute assert_true: request has isHistoryNavigation attribute expected true got false > PASS Check bodyUsed attribute > >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-structure.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-structure.html >index ccdb707795c16e6e283597ddfc1961ba44722539..e137a7ea5120ff24de310020fe330a6725cdb9d7 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-structure.html >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-structure.html >@@ -30,6 +30,8 @@ > "cache", > "redirect", > "integrity", >+ "isReloadNavigation", >+ "isHistoryNavigation", > //Request implements Body > "bodyUsed" > ]; >@@ -45,7 +47,7 @@ > > case "url": > //default value is base url >- //i.e http://web-platform.test:8000/fetch/api/request-structure.html >+ //i.e http://example.com/fetch/api/request-structure.html > newValue = "http://url.test"; > break; > >@@ -99,6 +101,16 @@ > newValue = true; > break; > >+ case "isReloadNavigation": >+ defaultValue = false; >+ newValue = true; >+ break; >+ >+ case "isHistoryNavigation": >+ defaultValue = false; >+ newValue = true; >+ break; >+ > default: > return; > } >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/resources/cache.py b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/resources/cache.py >index e0b058bddf6fb405047016e9fd3d66bbc92c3aea..10122f6439615c840e33d52314bdc14bfb443420 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/resources/cache.py >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/resources/cache.py >@@ -49,10 +49,10 @@ def main(request, response): > > # The only-if-cached redirect tests wants CORS to be okay, the other tests > # are all same-origin anyways and don't care. >- response.headers.set("Access-Control-Allow-Origin", "*"); >+ response.headers.set("Access-Control-Allow-Origin", "*") > > if redirect: >- response.headers.set("Location", redirect); >+ response.headers.set("Location", redirect) > response.status = (302, "Redirect") > return "" > elif ((inm is not None and inm == tag) or >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/resources/hello.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/resources/hello.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..ce013625030ba8dba906f756967f9e9ca394464a >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/resources/hello.txt >@@ -0,0 +1 @@ >+hello >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/resources/request-reset-attributes-worker.js b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/resources/request-reset-attributes-worker.js >new file mode 100644 >index 0000000000000000000000000000000000000000..4b264ca2fec3ba38c66dac23938525faa9708d59 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/resources/request-reset-attributes-worker.js >@@ -0,0 +1,19 @@ >+self.addEventListener('fetch', (event) => { >+ const params = new URL(event.request.url).searchParams; >+ if (params.has('ignore')) { >+ return; >+ } >+ if (!params.has('name')) { >+ event.respondWith(Promise.reject(TypeError('No name is provided.'))); >+ return; >+ } >+ >+ const name = params.get('name'); >+ const old_attribute = event.request[name]; >+ // If any of |init|'s member is present... >+ const init = {cache: 'no-store'} >+ const new_attribute = (new Request(event.request, init))[name]; >+ >+ event.respondWith( >+ new Response(`old: ${old_attribute}, new: ${new_attribute}`)); >+ }); >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/resources/w3c-import.log b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/resources/w3c-import.log >index 2708642d37f0c206016ed1d72266452b7aa77fb4..7dfc84d9cfd1a9f228261f1e19924b328300c1ac 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/resources/w3c-import.log >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/resources/w3c-import.log >@@ -1,7 +1,7 @@ > The tests in this directory were imported from the W3C repository. > Do NOT modify these tests directly in WebKit. > Instead, create a pull request on the WPT github: >- https://github.com/w3c/web-platform-tests >+ https://github.com/web-platform-tests/wpt > > Then run the Tools/Scripts/import-w3c-tests in WebKit to reimport > >@@ -15,3 +15,5 @@ None > ------------------------------------------------------------------------ > List of files: > /LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/resources/cache.py >+/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/resources/hello.txt >+/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/resources/request-reset-attributes-worker.js >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/w3c-import.log b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/w3c-import.log >index ced8c612b72a2dbcc702c3c7f37a94eb94c9674f..9dca0abf70254abb4ad5959bb524f829787c1076 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/w3c-import.log >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/w3c-import.log >@@ -1,7 +1,7 @@ > The tests in this directory were imported from the W3C repository. > Do NOT modify these tests directly in WebKit. > Instead, create a pull request on the WPT github: >- https://github.com/w3c/web-platform-tests >+ https://github.com/web-platform-tests/wpt > > Then run the Tools/Scripts/import-w3c-tests in WebKit to reimport > >@@ -30,11 +30,13 @@ List of files: > /LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-error.html > /LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-error.js > /LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-headers.html >-/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-idl.html > /LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-init-001.sub.html > /LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-init-002.html > /LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-init-003.sub.html >+/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-init-stream.any.js > /LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-keepalive-quota.html >+/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-keepalive.html >+/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-reset-attributes.https.html > /LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-structure.html > /LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-type-attribute-historical.html > /LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/url-encoding.html >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/resources/authentication.py b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/resources/authentication.py >index a06d179e58ebbbb0b4b97f71c475d4927d3a5cf8..b65047d765703b8e4400396a306b026316fc6d09 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/resources/authentication.py >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/resources/authentication.py >@@ -12,4 +12,3 @@ def main(request, response): > return ((401, "Unauthorized"), > [("WWW-Authenticate", 'Basic realm="' + realm + '"')], > "Please login with credentials 'user' and 'password'") >- >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/resources/bad-chunk-encoding.py b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/resources/bad-chunk-encoding.py >index 3135403863b89359d9a61a128d36f2373bb3030c..23c7b3f47c4d11f51c5174b86541efc5988ba155 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/resources/bad-chunk-encoding.py >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/resources/bad-chunk-encoding.py >@@ -6,7 +6,7 @@ def main(request, response): > time.sleep(delay) > response.headers.set("Transfer-Encoding", "chunked") > response.write_status_headers() >- time.sleep(delay); >+ time.sleep(delay) > for i in xrange(count): > response.writer.write_content("a\r\nTEST_CHUNK\r\n") > time.sleep(delay) >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/resources/cors-top.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/resources/cors-top.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..83a3157d14d9081ed01cd799287899822e19523a >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/resources/cors-top.txt >@@ -0,0 +1 @@ >+top >\ No newline at end of file >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/resources/cors-top.txt.headers b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/resources/cors-top.txt.headers >new file mode 100644 >index 0000000000000000000000000000000000000000..cb762eff806849df46dc758ef7b98b63f27f54c9 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/resources/cors-top.txt.headers >@@ -0,0 +1 @@ >+Access-Control-Allow-Origin: * >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/resources/echo-content.py b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/resources/echo-content.py >index 5c39e838181f0ec6d5afeb30931789f0ed53fb77..9a038f329c87e4e9dab96caa8d6fda973880d732 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/resources/echo-content.py >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/resources/echo-content.py >@@ -2,8 +2,9 @@ def main(request, response): > > headers = [("X-Request-Method", request.method), > ("X-Request-Content-Length", request.headers.get("Content-Length", "NO")), >- ("X-Request-Content-Type", request.headers.get("Content-Type", "NO"))] >- >+ ("X-Request-Content-Type", request.headers.get("Content-Type", "NO")), >+ # Avoid any kind of content sniffing on the response. >+ ("Content-Type", "text/plain")] > content = request.body > > return headers, content >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/resources/empty.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/resources/empty.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/resources/inspect-headers.py b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/resources/inspect-headers.py >index d53038cee0bd79ee5d1de2732a47145cb6eecaef..10a12eb883a17c701d909cde650799f21ec898c1 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/resources/inspect-headers.py >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/resources/inspect-headers.py >@@ -1,11 +1,10 @@ > def main(request, response): > headers = [] >- request_headers = [] > if "headers" in request.GET: > checked_headers = request.GET.first("headers").split("|") > for header in checked_headers: >- if header in request.headers: >- headers.append(("x-request-" + header, request.headers.get(header, "") )) >+ if header in request.headers: >+ headers.append(("x-request-" + header, request.headers.get(header, ""))) > > if "cors" in request.GET: > if "Origin" in request.headers: >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/resources/keepalive-iframe.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/resources/keepalive-iframe.html >new file mode 100644 >index 0000000000000000000000000000000000000000..742309ab4d238404b3ad66f8160c24fd5d16ef66 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/resources/keepalive-iframe.html >@@ -0,0 +1,17 @@ >+<!doctype html> >+<html> >+<meta charset="utf-8"> >+<script src="/common/utils.js"></script> >+<script> >+const uuid = token(); >+const URL = >+ `../resources/redirect.py?` + >+ `delay=100&` + >+ `location=../resources/stash-put.py?key=${uuid}%26value=on`; >+ >+addEventListener('load', () => { >+ let p = fetch(URL, {keepalive: true}); >+ window.parent.postMessage(uuid, '*'); >+}); >+</script> >+</html> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/resources/preflight.py b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/resources/preflight.py >index 4345647c212c35bedfaee09723b09dab16046d51..1843c74c88e200986af1ac0ecf5921456020ffe0 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/resources/preflight.py >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/resources/preflight.py >@@ -63,12 +63,12 @@ def main(request, response): > headers.append(("Access-Control-Expose-Headers", "x-did-preflight, x-control-request-headers, x-referrer, x-preflight-referrer, x-origin")) > headers.append(("x-did-preflight", stashed_data['preflight'])) > if stashed_data['control_request_headers'] != None: >- headers.append(("x-control-request-headers", stashed_data['control_request_headers'])) >+ headers.append(("x-control-request-headers", stashed_data['control_request_headers'])) > headers.append(("x-preflight-referrer", stashed_data['preflight_referrer'])) >- headers.append(("x-referrer", request.headers.get("Referer", "") )) >- headers.append(("x-origin", request.headers.get("Origin", "") )) >+ headers.append(("x-referrer", request.headers.get("Referer", ""))) >+ headers.append(("x-origin", request.headers.get("Origin", ""))) > > if token: >- request.server.stash.put(token, stashed_data) >+ request.server.stash.put(token, stashed_data) > > return headers, "" >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/resources/redirect-empty-location.py b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/resources/redirect-empty-location.py >new file mode 100644 >index 0000000000000000000000000000000000000000..2baabae03b0bf368bbcd9b26a01d22ecd8e86470 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/resources/redirect-empty-location.py >@@ -0,0 +1,3 @@ >+def main(request, response): >+ headers = [("Location", "")] >+ return 302, headers, "" >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/resources/redirect.py b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/resources/redirect.py >index 40c1b99961aad3c3f551a016c530caa0d9fb9d3b..8e6f9c24b77f7850ea5e8045e8ce276f204f61f4 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/resources/redirect.py >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/resources/redirect.py >@@ -28,7 +28,7 @@ def main(request, response): > #Preflight is not redirected: return 200 > if not "redirect_preflight" in request.GET: > if token: >- request.server.stash.put(request.GET.first("token"), stashed_data) >+ request.server.stash.put(request.GET.first("token"), stashed_data) > return 200, headers, "" > > if "redirect_status" in request.GET: >@@ -59,7 +59,7 @@ def main(request, response): > if token: > request.server.stash.put(request.GET.first("token"), stashed_data) > if "max_count" in request.GET: >- max_count = int(request.GET['max_count']) >+ max_count = int(request.GET['max_count']) > #stop redirecting and return count > if stashed_data['count'] > max_count: > # -1 because the last is not a redirection >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/resources/sandboxed-iframe.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/resources/sandboxed-iframe.html >new file mode 100644 >index 0000000000000000000000000000000000000000..6e5d5065474d47d34bab3959ae5d0e8f0dc7d072 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/resources/sandboxed-iframe.html >@@ -0,0 +1,34 @@ >+<!doctype html> >+<html> >+<script> >+async function no_cors_should_be_rejected() { >+ let thrown = false; >+ try { >+ const resp = await fetch('top.txt'); >+ } catch (e) { >+ thrown = true; >+ } >+ if (!thrown) { >+ throw Error('fetching "top.txt" should be rejected.'); >+ } >+} >+ >+async function null_origin_should_be_accepted() { >+ const url = 'top.txt?pipe=header(access-control-allow-origin,null)|' + >+ 'header(cache-control,no-store)'; >+ const resp = await fetch(url); >+} >+ >+async function test() { >+ try { >+ await no_cors_should_be_rejected(); >+ await null_origin_should_be_accepted(); >+ parent.postMessage('PASS', '*'); >+ } catch (e) { >+ parent.postMessage(e.message, '*'); >+ } >+} >+ >+test(); >+</script> >+</html> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/resources/trickle.py b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/resources/trickle.py >index 319ecd21f4503ccf2f9326bdf53c010089eee5d2..e2c9beec1e077c67b0d83202ba644c018cbace94 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/resources/trickle.py >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/resources/trickle.py >@@ -8,7 +8,7 @@ def main(request, response): > time.sleep(delay) > response.headers.set("Content-type", "text/plain") > response.write_status_headers() >- time.sleep(delay); >+ time.sleep(delay) > for i in xrange(count): > response.writer.write_content("TEST_TRICKLE\n") > time.sleep(delay) >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/resources/w3c-import.log b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/resources/w3c-import.log >index 94083939fcc99a75536dc81fb4912337292e45e6..274dc481ce90eb37d06de44a70df0a14bde2ce11 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/resources/w3c-import.log >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/resources/w3c-import.log >@@ -1,7 +1,7 @@ > The tests in this directory were imported from the W3C repository. > Do NOT modify these tests directly in WebKit. > Instead, create a pull request on the WPT github: >- https://github.com/w3c/web-platform-tests >+ https://github.com/web-platform-tests/wpt > > Then run the Tools/Scripts/import-w3c-tests in WebKit to reimport > >@@ -19,14 +19,19 @@ List of files: > /LayoutTests/imported/w3c/web-platform-tests/fetch/api/resources/basic.html > /LayoutTests/imported/w3c/web-platform-tests/fetch/api/resources/cache.py > /LayoutTests/imported/w3c/web-platform-tests/fetch/api/resources/clean-stash.py >+/LayoutTests/imported/w3c/web-platform-tests/fetch/api/resources/cors-top.txt >+/LayoutTests/imported/w3c/web-platform-tests/fetch/api/resources/cors-top.txt.headers > /LayoutTests/imported/w3c/web-platform-tests/fetch/api/resources/data.json > /LayoutTests/imported/w3c/web-platform-tests/fetch/api/resources/echo-content.py > /LayoutTests/imported/w3c/web-platform-tests/fetch/api/resources/empty.txt > /LayoutTests/imported/w3c/web-platform-tests/fetch/api/resources/infinite-slow-response.py > /LayoutTests/imported/w3c/web-platform-tests/fetch/api/resources/inspect-headers.py >+/LayoutTests/imported/w3c/web-platform-tests/fetch/api/resources/keepalive-iframe.html > /LayoutTests/imported/w3c/web-platform-tests/fetch/api/resources/method.py > /LayoutTests/imported/w3c/web-platform-tests/fetch/api/resources/preflight.py >+/LayoutTests/imported/w3c/web-platform-tests/fetch/api/resources/redirect-empty-location.py > /LayoutTests/imported/w3c/web-platform-tests/fetch/api/resources/redirect.py >+/LayoutTests/imported/w3c/web-platform-tests/fetch/api/resources/sandboxed-iframe.html > /LayoutTests/imported/w3c/web-platform-tests/fetch/api/resources/script-with-header.py > /LayoutTests/imported/w3c/web-platform-tests/fetch/api/resources/stash-put.py > /LayoutTests/imported/w3c/web-platform-tests/fetch/api/resources/stash-take.py >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/multi-globals/current/w3c-import.log b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/multi-globals/current/w3c-import.log >index 35129c4a2d48122d7fad3512b51acb83e003bca2..c0ce1a7930efe92ecc02877c0ad3b28078987851 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/multi-globals/current/w3c-import.log >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/multi-globals/current/w3c-import.log >@@ -1,7 +1,7 @@ > The tests in this directory were imported from the W3C repository. > Do NOT modify these tests directly in WebKit. > Instead, create a pull request on the WPT github: >- https://github.com/w3c/web-platform-tests >+ https://github.com/web-platform-tests/wpt > > Then run the Tools/Scripts/import-w3c-tests in WebKit to reimport > >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/multi-globals/incumbent/w3c-import.log b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/multi-globals/incumbent/w3c-import.log >index d94b7e66c7533c69e7727a63dfa9f0959a1c48d3..d117ff1b9bee9d18133692ef4fe26c1af5166de7 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/multi-globals/incumbent/w3c-import.log >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/multi-globals/incumbent/w3c-import.log >@@ -1,7 +1,7 @@ > The tests in this directory were imported from the W3C repository. > Do NOT modify these tests directly in WebKit. > Instead, create a pull request on the WPT github: >- https://github.com/w3c/web-platform-tests >+ https://github.com/web-platform-tests/wpt > > Then run the Tools/Scripts/import-w3c-tests in WebKit to reimport > >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/multi-globals/relevant/w3c-import.log b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/multi-globals/relevant/w3c-import.log >index a0d9e5e2c8d4469d03b34799e05985d3a1427969..ac6d74b1cf774aededfd0bbc333eb2a813db4cbe 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/multi-globals/relevant/w3c-import.log >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/multi-globals/relevant/w3c-import.log >@@ -1,7 +1,7 @@ > The tests in this directory were imported from the W3C repository. > Do NOT modify these tests directly in WebKit. > Instead, create a pull request on the WPT github: >- https://github.com/w3c/web-platform-tests >+ https://github.com/web-platform-tests/wpt > > Then run the Tools/Scripts/import-w3c-tests in WebKit to reimport > >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/multi-globals/w3c-import.log b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/multi-globals/w3c-import.log >index b711e68db2d5f35400f036b0bc5244d03b02a7fa..fe0a8e58114eb1c33895fba35b1a26526b43c59e 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/multi-globals/w3c-import.log >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/multi-globals/w3c-import.log >@@ -1,7 +1,7 @@ > The tests in this directory were imported from the W3C repository. > Do NOT modify these tests directly in WebKit. > Instead, create a pull request on the WPT github: >- https://github.com/w3c/web-platform-tests >+ https://github.com/web-platform-tests/wpt > > Then run the Tools/Scripts/import-w3c-tests in WebKit to reimport > >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-cancel-stream.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-cancel-stream.html >index 58d6745a12a03d9069d8a6835803539c7ba28fe0..fcaed04d83e31a437695b55b50beb7425a5a3fb8 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-cancel-stream.html >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-cancel-stream.html >@@ -30,7 +30,9 @@ promise_test(function(test) { > var closedPromise = reader.closed.then(function() { > return reader.cancel(); > }); >- reader.read(); >+ reader.read().then(function readMore({done, value}) { >+ if (!done) return reader.read().then(readMore); >+ }); > return closedPromise; > }, "Cancelling a closed blob Response stream"); > >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-clone-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-clone-expected.txt >index d28f3a6abdbeee73f8e2ba8903502ea32217832f..979792bf6f711117be1b5474175630daa509580c 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-clone-expected.txt >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-clone-expected.txt >@@ -1,5 +1,5 @@ > >-PASS Check Response's clone with default values, without body >+FAIL Check Response's clone with default values, without body assert_equals: Expect default response.statusText is expected "" but got "OK" > PASS Check Response's clone has the expected attribute values > PASS Check orginal response's body after cloning > PASS Check cloned response's body >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-clone.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-clone.html >index 2eeb78c4c24e56b5d9064380d1d8e6e25bcf8dc3..cc35550797e00c89e4489e470321e812b1668bdb 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-clone.html >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-clone.html >@@ -15,7 +15,7 @@ > "url" : "", > "ok" : true, > "status" : 200, >- "statusText" : "OK" >+ "statusText" : "" > }; > > var response = new Response(); >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-error-from-stream-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-error-from-stream-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..bcddee033f6d462a75b5a4cd81799c6131f9c4e0 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-error-from-stream-expected.txt >@@ -0,0 +1,14 @@ >+ >+PASS ReadableStreamDefaultReader Promise receives ReadableStream start() Error >+PASS ReadableStreamDefaultReader Promise receives ReadableStream pull() Error >+FAIL ReadableStream start() Error propagates to Response.arrayBuffer() Promise assert_throws: CustomTestError should propagate function "function () { throw e }" threw object "TypeError: custom-test-error" ("TypeError") expected object "custom-test-error" ("custom-test-error") >+FAIL ReadableStream start() Error propagates to Response.blob() Promise assert_throws: CustomTestError should propagate function "function () { throw e }" threw object "TypeError: custom-test-error" ("TypeError") expected object "custom-test-error" ("custom-test-error") >+FAIL ReadableStream start() Error propagates to Response.formData() Promise assert_throws: CustomTestError should propagate function "function () { throw e }" threw object "NotSupportedError: The operation is not supported." ("NotSupportedError") expected object "custom-test-error" ("custom-test-error") >+FAIL ReadableStream start() Error propagates to Response.json() Promise assert_throws: CustomTestError should propagate function "function () { throw e }" threw object "TypeError: custom-test-error" ("TypeError") expected object "custom-test-error" ("custom-test-error") >+FAIL ReadableStream start() Error propagates to Response.text() Promise assert_throws: CustomTestError should propagate function "function () { throw e }" threw object "TypeError: custom-test-error" ("TypeError") expected object "custom-test-error" ("custom-test-error") >+FAIL ReadableStream pull() Error propagates to Response.arrayBuffer() Promise assert_throws: CustomTestError should propagate function "function () { throw e }" threw object "TypeError: custom-test-error" ("TypeError") expected object "custom-test-error" ("custom-test-error") >+FAIL ReadableStream pull() Error propagates to Response.blob() Promise assert_throws: CustomTestError should propagate function "function () { throw e }" threw object "TypeError: custom-test-error" ("TypeError") expected object "custom-test-error" ("custom-test-error") >+FAIL ReadableStream pull() Error propagates to Response.formData() Promise assert_throws: CustomTestError should propagate function "function () { throw e }" threw object "NotSupportedError: The operation is not supported." ("NotSupportedError") expected object "custom-test-error" ("custom-test-error") >+FAIL ReadableStream pull() Error propagates to Response.json() Promise assert_throws: CustomTestError should propagate function "function () { throw e }" threw object "TypeError: custom-test-error" ("TypeError") expected object "custom-test-error" ("custom-test-error") >+FAIL ReadableStream pull() Error propagates to Response.text() Promise assert_throws: CustomTestError should propagate function "function () { throw e }" threw object "TypeError: custom-test-error" ("TypeError") expected object "custom-test-error" ("custom-test-error") >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-error-from-stream.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-error-from-stream.html >new file mode 100644 >index 0000000000000000000000000000000000000000..392bc77a6c046ec746763dd22a1c6d3135bca2e7 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-error-from-stream.html >@@ -0,0 +1,69 @@ >+<!doctype html> >+<html> >+ <head> >+ <meta charset="utf-8"> >+ <title>Response Receives Propagated Error from ReadableStream</title> >+ <script src="/resources/testharness.js"></script> >+ <script src="/resources/testharnessreport.js"></script> >+ </head> >+ <body> >+ <script> >+ function CustomTestError() { >+ const error = Error(); >+ error.name = 'custom-test-error'; >+ return error; >+ } >+ >+ function newStreamWithStartError() { >+ return new ReadableStream({ >+ start(controller) { >+ controller.error(CustomTestError()); >+ } >+ }) >+ } >+ >+ function newStreamWithPullError() { >+ return new ReadableStream({ >+ pull(controller) { >+ controller.error(CustomTestError()); >+ } >+ }) >+ } >+ >+ function runRequestPromiseTest(stream, responseReaderMethod, testDescription) { >+ promise_test(test => { >+ return promise_rejects( >+ test, >+ CustomTestError(), >+ new Response(stream)[responseReaderMethod](), >+ 'CustomTestError should propagate' >+ ) >+ }, testDescription) >+ } >+ >+ >+ promise_test(test => { >+ return promise_rejects(test, CustomTestError(), newStreamWithStartError().getReader().read(), 'CustomTestError should propagate') >+ }, "ReadableStreamDefaultReader Promise receives ReadableStream start() Error") >+ >+ promise_test(test => { >+ return promise_rejects(test, CustomTestError(), newStreamWithPullError().getReader().read(), 'CustomTestError should propagate') >+ }, "ReadableStreamDefaultReader Promise receives ReadableStream pull() Error") >+ >+ >+ // test start() errors for all Body reader methods >+ runRequestPromiseTest(newStreamWithStartError(), 'arrayBuffer', 'ReadableStream start() Error propagates to Response.arrayBuffer() Promise'); >+ runRequestPromiseTest(newStreamWithStartError(), 'blob', 'ReadableStream start() Error propagates to Response.blob() Promise'); >+ runRequestPromiseTest(newStreamWithStartError(), 'formData', 'ReadableStream start() Error propagates to Response.formData() Promise'); >+ runRequestPromiseTest(newStreamWithStartError(), 'json', 'ReadableStream start() Error propagates to Response.json() Promise'); >+ runRequestPromiseTest(newStreamWithStartError(), 'text', 'ReadableStream start() Error propagates to Response.text() Promise'); >+ >+ // test pull() errors for all Body reader methods >+ runRequestPromiseTest(newStreamWithPullError(), 'arrayBuffer', 'ReadableStream pull() Error propagates to Response.arrayBuffer() Promise'); >+ runRequestPromiseTest(newStreamWithPullError(), 'blob', 'ReadableStream pull() Error propagates to Response.blob() Promise'); >+ runRequestPromiseTest(newStreamWithPullError(), 'formData', 'ReadableStream pull() Error propagates to Response.formData() Promise'); >+ runRequestPromiseTest(newStreamWithPullError(), 'json', 'ReadableStream pull() Error propagates to Response.json() Promise'); >+ runRequestPromiseTest(newStreamWithPullError(), 'text', 'ReadableStream pull() Error propagates to Response.text() Promise'); >+ </script> >+ </body> >+</html> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-from-stream.any-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-from-stream.any-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..10695a0e24ad60214f2967ed55d6760d420fa5d1 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-from-stream.any-expected.txt >@@ -0,0 +1,5 @@ >+ >+FAIL Constructing a Response with a stream on which getReader() is called assert_throws: function "() => new Response(stream)" did not throw >+FAIL Constructing a Response with a stream on which read() is called assert_throws: function "() => new Response(stream)" did not throw >+FAIL Constructing a Response with a stream on which read() and releaseLock() are called assert_throws: function "() => new Response(stream)" did not throw >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-from-stream.any.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-from-stream.any.html >new file mode 100644 >index 0000000000000000000000000000000000000000..2382913528e693b3a5d56c660a45060980b548c3 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-from-stream.any.html >@@ -0,0 +1 @@ >+<!-- This file is required for WebKit test infrastructure to run the templated test --> >\ No newline at end of file >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-from-stream.any.js b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-from-stream.any.js >new file mode 100644 >index 0000000000000000000000000000000000000000..93b29b42867f47f4472c6820ff9d4a1a343e84cf >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-from-stream.any.js >@@ -0,0 +1,23 @@ >+// META: global=window,worker >+ >+"use strict"; >+ >+test(() => { >+ const stream = new ReadableStream(); >+ stream.getReader(); >+ assert_throws(new TypeError(), () => new Response(stream)); >+}, "Constructing a Response with a stream on which getReader() is called"); >+ >+test(() => { >+ const stream = new ReadableStream(); >+ stream.getReader().read(); >+ assert_throws(new TypeError(), () => new Response(stream)); >+}, "Constructing a Response with a stream on which read() is called"); >+ >+promise_test(async () => { >+ const stream = new ReadableStream({ pull: c => c.enqueue(new Uint8Array()) }), >+ reader = stream.getReader(); >+ await reader.read(); >+ reader.releaseLock(); >+ assert_throws(new TypeError(), () => new Response(stream)); >+}, "Constructing a Response with a stream on which read() and releaseLock() are called"); >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-from-stream.any.worker-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-from-stream.any.worker-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..10695a0e24ad60214f2967ed55d6760d420fa5d1 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-from-stream.any.worker-expected.txt >@@ -0,0 +1,5 @@ >+ >+FAIL Constructing a Response with a stream on which getReader() is called assert_throws: function "() => new Response(stream)" did not throw >+FAIL Constructing a Response with a stream on which read() is called assert_throws: function "() => new Response(stream)" did not throw >+FAIL Constructing a Response with a stream on which read() and releaseLock() are called assert_throws: function "() => new Response(stream)" did not throw >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-from-stream.any.worker.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-from-stream.any.worker.html >new file mode 100644 >index 0000000000000000000000000000000000000000..2382913528e693b3a5d56c660a45060980b548c3 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-from-stream.any.worker.html >@@ -0,0 +1 @@ >+<!-- This file is required for WebKit test infrastructure to run the templated test --> >\ No newline at end of file >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-idl-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-idl-expected.txt >deleted file mode 100644 >index 4afab0229e4e982577cf276758a3a9c91dfabead..0000000000000000000000000000000000000000 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-idl-expected.txt >+++ /dev/null >@@ -1,45 +0,0 @@ >- >-PASS Response interface: existence and properties of interface object >-PASS Response interface object length >-PASS Response interface object name >-PASS Response interface: existence and properties of interface prototype object >-PASS Response interface: existence and properties of interface prototype object's "constructor" property >-PASS Response interface: existence and properties of interface prototype object's @@unscopables property >-PASS Response interface: operation error() >-PASS Response interface: operation redirect(USVString, unsigned short) >-PASS Response interface: attribute type >-PASS Response interface: attribute url >-PASS Response interface: attribute status >-PASS Response interface: attribute ok >-PASS Response interface: attribute statusText >-PASS Response interface: attribute headers >-FAIL Response interface: attribute trailer assert_true: The prototype object must have a property "trailer" expected true got false >-PASS Response interface: operation clone() >-PASS Response interface: attribute body >-PASS Response interface: attribute bodyUsed >-PASS Response interface: operation arrayBuffer() >-PASS Response interface: operation blob() >-PASS Response interface: operation formData() >-PASS Response interface: operation json() >-PASS Response interface: operation text() >-PASS Response must be primary interface of new Response() >-PASS Stringification of new Response() >-PASS Response interface: new Response() must inherit property "error()" with the proper type >-PASS Response interface: new Response() must inherit property "redirect(USVString, unsigned short)" with the proper type >-PASS Response interface: calling redirect(USVString, unsigned short) on new Response() with too few arguments must throw TypeError >-PASS Response interface: new Response() must inherit property "type" with the proper type >-PASS Response interface: new Response() must inherit property "url" with the proper type >-PASS Response interface: new Response() must inherit property "status" with the proper type >-PASS Response interface: new Response() must inherit property "ok" with the proper type >-PASS Response interface: new Response() must inherit property "statusText" with the proper type >-PASS Response interface: new Response() must inherit property "headers" with the proper type >-FAIL Response interface: new Response() must inherit property "trailer" with the proper type assert_inherits: property "trailer" not found in prototype chain >-PASS Response interface: new Response() must inherit property "clone()" with the proper type >-PASS Response interface: new Response() must inherit property "body" with the proper type >-PASS Response interface: new Response() must inherit property "bodyUsed" with the proper type >-PASS Response interface: new Response() must inherit property "arrayBuffer()" with the proper type >-PASS Response interface: new Response() must inherit property "blob()" with the proper type >-PASS Response interface: new Response() must inherit property "formData()" with the proper type >-PASS Response interface: new Response() must inherit property "json()" with the proper type >-PASS Response interface: new Response() must inherit property "text()" with the proper type >- >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-idl.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-idl.html >deleted file mode 100644 >index bd265fa203dccf3bf853d6aa09cf18844a08e419..0000000000000000000000000000000000000000 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-idl.html >+++ /dev/null >@@ -1,68 +0,0 @@ >-<!doctype html> >-<html> >- <head> >- <meta charset="utf-8"> >- <title>Response idl interface</title> >- <meta name="help" href="https://fetch.spec.whatwg.org/#response"> >- <meta name="author" title="Canon Research France" href="https://www.crf.canon.fr"> >- <script src="/resources/testharness.js"></script> >- <script src="/resources/testharnessreport.js"></script> >- <script src="/resources/WebIDLParser.js"></script> >- <script src="/resources/idlharness.js"></script> >- </head> >- <body> >- <script id="body-idl" type="text/plain"> >- typedef any JSON; >- typedef (Blob or BufferSource or FormData or URLSearchParams or USVString) BodyInit; >- >- interface mixin Body { >- readonly attribute ReadableStream? body; >- readonly attribute boolean bodyUsed; >- [NewObject] Promise<ArrayBuffer> arrayBuffer(); >- [NewObject] Promise<Blob> blob(); >- [NewObject] Promise<FormData> formData(); >- [NewObject] Promise<JSON> json(); >- [NewObject] Promise<USVString> text(); >- }; >- </script> >- <script id="response-idl" type="text/plain"> >- [Constructor(optional BodyInit body, optional ResponseInit init), >- Exposed=(Window,Worker)] >- interface Response { >- [NewObject] static Response error(); >- [NewObject] static Response redirect(USVString url, optional unsigned short status = 302); >- >- readonly attribute ResponseType type; >- >- readonly attribute USVString url; >- readonly attribute unsigned short status; >- readonly attribute boolean ok; >- readonly attribute ByteString statusText; >- [SameObject] readonly attribute Headers headers; >- readonly attribute Promise<Headers> trailer; >- >- [NewObject] Response clone(); >- }; >- Response includes Body; >- >- dictionary ResponseInit { >- unsigned short status = 200; >- ByteString statusText = "OK"; >- HeadersInit headers; >- }; >- >- enum ResponseType { "basic", "cors", "default", "error", "opaque", "opaqueredirect" }; >- </script> >- <script> >- var idlsArray = new IdlArray(); >- var idl = document.getElementById("body-idl").textContent >- idl += document.getElementById("response-idl").textContent >- >- idlsArray.add_idls(idl); >- idlsArray.add_untested_idls("interface Headers {};"); >- idlsArray.add_untested_idls("interface ReadableStream {};"); >- idlsArray.add_objects({ Response: ['new Response()'] }); >- idlsArray.test(); >- </script> >- </body> >-</html> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-init-001-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-init-001-expected.txt >index eea9794955eebf332702a4251dde11681a8e1ea8..52485bd982ea47cf1be2fc5ac2111b5685d84b6e 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-init-001-expected.txt >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-init-001-expected.txt >@@ -3,7 +3,7 @@ PASS Check default value for type attribute > PASS Check default value for url attribute > PASS Check default value for ok attribute > PASS Check default value for status attribute >-PASS Check default value for statusText attribute >+FAIL Check default value for statusText attribute assert_equals: Expect default response.statusText is expected "" but got "OK" > PASS Check default value for body attribute > PASS Check status init values and associated getter > PASS Check statusText init values and associated getter >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-init-001.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-init-001.html >index cd89448bbbef388e69a2ef4b2aecf04bafb728f2..7af23d310f1ace9ad9827b8dd4e9e5ca17d26b5e 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-init-001.html >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-init-001.html >@@ -15,15 +15,15 @@ > "url" : "", > "ok" : true, > "status" : 200, >- "statusText" : "OK", >+ "statusText" : "", > "body" : null > }; > > var statusCodes = { "givenValues" : [200, 300, 400, 500, 599], >- "expectedValues" : [200, 300, 400, 500, 599] >+ "expectedValues" : [200, 300, 400, 500, 599] > }; >- var statusTexts = { "givenValues" : ["OK", "with space", String.fromCharCode(0x80)], >- "expectedValues" : ["OK", "with space", String.fromCharCode(0x80)] >+ var statusTexts = { "givenValues" : ["", "OK", "with space", String.fromCharCode(0x80)], >+ "expectedValues" : ["", "OK", "with space", String.fromCharCode(0x80)] > }; > var initValuesDict = { "status" : statusCodes, > "statusText" : statusTexts >@@ -42,7 +42,7 @@ > }, "Check default value for " + attributeName + " attribute"); > } > >- for (var attributeName in initValuesDict) >+ for (var attributeName in initValuesDict) { > test(function() { > var valuesToTest = initValuesDict[attributeName]; > for (var valueIdx in valuesToTest["givenValues"]) { >@@ -58,19 +58,20 @@ > "Expect response.ok is " + isOkStatus(response.status)); > } > }, "Check " + attributeName + " init values and associated getter"); >+ } > >- test(function() { >- const response1 = new Response(""); >- assert_equals(response1.headers, response1.headers); >+ test(function() { >+ const response1 = new Response(""); >+ assert_equals(response1.headers, response1.headers); > >- const response2 = new Response("", {"headers": {"X-Foo": "bar"}}); >- assert_equals(response2.headers, response2.headers); >- const headers = response2.headers; >- response2.headers.set("X-Foo", "quux"); >- assert_equals(headers, response2.headers); >- headers.set("X-Other-Header", "baz"); >- assert_equals(headers, response2.headers); >- }, "Test that Response.headers has the [SameObject] extended attribute"); >+ const response2 = new Response("", {"headers": {"X-Foo": "bar"}}); >+ assert_equals(response2.headers, response2.headers); >+ const headers = response2.headers; >+ response2.headers.set("X-Foo", "quux"); >+ assert_equals(headers, response2.headers); >+ headers.set("X-Other-Header", "baz"); >+ assert_equals(headers, response2.headers); >+ }, "Test that Response.headers has the [SameObject] extended attribute"); > </script> > </body> > </html> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-static-redirect.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-static-redirect.html >index e09c6661193403da1504f09e7639356cb0012e8f..a7492229fd06b6952347e4b61639b402106cb97b 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-static-redirect.html >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-static-redirect.html >@@ -14,16 +14,24 @@ > var url = "http://test.url:1234/"; > test(function() { > redirectResponse = Response.redirect(url); >+ assert_equals(redirectResponse.type, "default"); >+ assert_false(redirectResponse.redirected); >+ assert_false(redirectResponse.ok); > assert_equals(redirectResponse.status, 302, "Default redirect status is 302"); > assert_equals(redirectResponse.headers.get("Location"), url, > "redirected response has Location header with the correct url"); >+ assert_equals(redirectResponse.statusText, ""); > }, "Check default redirect response"); > >- var redirectStatus = [301, 302, 303, 307, 308]; >- redirectStatus.forEach(function(status) { >+ [301, 302, 303, 307, 308].forEach(function(status) { > test(function() { > redirectResponse = Response.redirect(url, status); >+ assert_equals(redirectResponse.type, "default"); >+ assert_false(redirectResponse.redirected); >+ assert_false(redirectResponse.ok); > assert_equals(redirectResponse.status, status, "Redirect status is " + status); >+ assert_equals(redirectResponse.headers.get("Location"), url); >+ assert_equals(redirectResponse.statusText, ""); > }, "Check response returned by static method redirect(), status = " + status); > }); > >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-stream-with-broken-then.any-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-stream-with-broken-then.any-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..9817e5b036a56d9380b507284cf1e5f25c6b2f7a >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-stream-with-broken-then.any-expected.txt >@@ -0,0 +1,11 @@ >+CONSOLE MESSAGE: Unhandled Promise Rejection: TypeError: undefined is not an object >+ >+Harness Error (FAIL), message = undefined is not an object >+ >+FAIL Attempt to inject {done: false, value: bye} via Object.prototype.then. assert_equals: The value should be "hello". expected "hello" but got "bye" >+FAIL Attempt to inject value: undefined via Object.prototype.then. promise_test: Unhandled rejection with value: object "TypeError: ReadableStream chunk enqueueing in the sink failed" >+TIMEOUT Attempt to inject undefined via Object.prototype.then. Test timed out >+NOTRUN Attempt to inject 8.2 via Object.prototype.then. >+NOTRUN intercepting arraybuffer to text conversion via Object.prototype.then should not be possible >+NOTRUN intercepting arraybuffer to body readable stream conversion via Object.prototype.then should not be possible >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-stream-with-broken-then.any.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-stream-with-broken-then.any.html >new file mode 100644 >index 0000000000000000000000000000000000000000..2382913528e693b3a5d56c660a45060980b548c3 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-stream-with-broken-then.any.html >@@ -0,0 +1 @@ >+<!-- This file is required for WebKit test infrastructure to run the templated test --> >\ No newline at end of file >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-stream-with-broken-then.any.js b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-stream-with-broken-then.any.js >new file mode 100644 >index 0000000000000000000000000000000000000000..b83365d73af5f430e589adbe4e1ea165419f047c >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-stream-with-broken-then.any.js >@@ -0,0 +1,116 @@ >+// META: script=../resources/utils.js >+ >+promise_test(async () => { >+ // t.add_cleanup doesn't work when Object.prototype.then is overwritten, so >+ // these tests use add_completion_callback for cleanup instead. >+ add_completion_callback(() => delete Object.prototype.then); >+ const hello = new TextEncoder().encode('hello'); >+ const bye = new TextEncoder().encode('bye'); >+ const rs = new ReadableStream({ >+ start(controller) { >+ controller.enqueue(hello); >+ controller.close(); >+ } >+ }); >+ const resp = new Response(rs); >+ Object.prototype.then = (onFulfilled) => { >+ delete Object.prototype.then; >+ onFulfilled({done: false, value: bye}); >+ }; >+ const text = await resp.text(); >+ delete Object.prototype.then; >+ assert_equals(text, 'hello', 'The value should be "hello".'); >+}, 'Attempt to inject {done: false, value: bye} via Object.prototype.then.'); >+ >+promise_test(async (t) => { >+ add_completion_callback(() => delete Object.prototype.then); >+ const hello = new TextEncoder().encode('hello'); >+ const rs = new ReadableStream({ >+ start(controller) { >+ controller.enqueue(hello); >+ controller.close(); >+ } >+ }); >+ const resp = new Response(rs); >+ Object.prototype.then = (onFulfilled) => { >+ delete Object.prototype.then; >+ onFulfilled({done: false, value: undefined}); >+ }; >+ const text = await resp.text(); >+ delete Object.prototype.then; >+ assert_equals(text, 'hello', 'The value should be "hello".'); >+}, 'Attempt to inject value: undefined via Object.prototype.then.'); >+ >+promise_test(async (t) => { >+ add_completion_callback(() => delete Object.prototype.then); >+ const hello = new TextEncoder().encode('hello'); >+ const rs = new ReadableStream({ >+ start(controller) { >+ controller.enqueue(hello); >+ controller.close(); >+ } >+ }); >+ const resp = new Response(rs); >+ Object.prototype.then = (onFulfilled) => { >+ delete Object.prototype.then; >+ onFulfilled(undefined); >+ }; >+ const text = await resp.text(); >+ delete Object.prototype.then; >+ assert_equals(text, 'hello', 'The value should be "hello".'); >+}, 'Attempt to inject undefined via Object.prototype.then.'); >+ >+promise_test(async (t) => { >+ add_completion_callback(() => delete Object.prototype.then); >+ const hello = new TextEncoder().encode('hello'); >+ const rs = new ReadableStream({ >+ start(controller) { >+ controller.enqueue(hello); >+ controller.close(); >+ } >+ }); >+ const resp = new Response(rs); >+ Object.prototype.then = (onFulfilled) => { >+ delete Object.prototype.then; >+ onFulfilled(8.2); >+ }; >+ const text = await resp.text(); >+ delete Object.prototype.then; >+ assert_equals(text, 'hello', 'The value should be "hello".'); >+}, 'Attempt to inject 8.2 via Object.prototype.then.'); >+ >+promise_test(async () => { >+ add_completion_callback(() => delete Object.prototype.then); >+ const hello = new TextEncoder().encode('hello'); >+ const bye = new TextEncoder().encode('bye'); >+ const resp = new Response(hello); >+ Object.prototype.then = (onFulfilled) => { >+ delete Object.prototype.then; >+ onFulfilled({done: false, value: bye}); >+ }; >+ const text = await resp.text(); >+ delete Object.prototype.then; >+ assert_equals(text, 'hello', 'The value should be "hello".'); >+}, 'intercepting arraybuffer to text conversion via Object.prototype.then ' + >+ 'should not be possible'); >+ >+promise_test(async () => { >+ add_completion_callback(() => delete Object.prototype.then); >+ const u8a123 = new Uint8Array([1, 2, 3]); >+ const u8a456 = new Uint8Array([4, 5, 6]); >+ const resp = new Response(u8a123); >+ const writtenBytes = []; >+ const ws = new WritableStream({ >+ write(chunk) { >+ writtenBytes.push(...Array.from(chunk)); >+ } >+ }); >+ Object.prototype.then = (onFulfilled) => { >+ delete Object.prototype.then; >+ onFulfilled({done: false, value: u8a456}); >+ }; >+ await resp.body.pipeTo(ws); >+ delete Object.prototype.then; >+ assert_array_equals(writtenBytes, u8a123, 'The value should be [1, 2, 3]'); >+}, 'intercepting arraybuffer to body readable stream conversion via ' + >+ 'Object.prototype.then should not be possible'); >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-stream-with-broken-then.any.worker-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-stream-with-broken-then.any.worker-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..753651f22d27b6006e5b6a2c28b53f60cbd52593 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-stream-with-broken-then.any.worker-expected.txt >@@ -0,0 +1,10 @@ >+ >+Harness Error (TIMEOUT), message = null >+ >+FAIL Attempt to inject {done: false, value: bye} via Object.prototype.then. assert_equals: The value should be "hello". expected "hello" but got "bye" >+FAIL Attempt to inject value: undefined via Object.prototype.then. promise_test: Unhandled rejection with value: object "TypeError: ReadableStream chunk enqueueing in the sink failed" >+TIMEOUT Attempt to inject undefined via Object.prototype.then. Test timed out >+NOTRUN Attempt to inject 8.2 via Object.prototype.then. >+NOTRUN intercepting arraybuffer to text conversion via Object.prototype.then should not be possible >+NOTRUN intercepting arraybuffer to body readable stream conversion via Object.prototype.then should not be possible >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-stream-with-broken-then.any.worker.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-stream-with-broken-then.any.worker.html >new file mode 100644 >index 0000000000000000000000000000000000000000..2382913528e693b3a5d56c660a45060980b548c3 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-stream-with-broken-then.any.worker.html >@@ -0,0 +1 @@ >+<!-- This file is required for WebKit test infrastructure to run the templated test --> >\ No newline at end of file >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/w3c-import.log b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/w3c-import.log >index 305a9ab1eea14a37f2157bb4cd7ee491ffd40295..092df2e435a001fe228e024587c8bc4de8fad6b4 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/w3c-import.log >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/w3c-import.log >@@ -1,7 +1,7 @@ > The tests in this directory were imported from the W3C repository. > Do NOT modify these tests directly in WebKit. > Instead, create a pull request on the WPT github: >- https://github.com/w3c/web-platform-tests >+ https://github.com/web-platform-tests/wpt > > Then run the Tools/Scripts/import-w3c-tests in WebKit to reimport > >@@ -19,8 +19,9 @@ List of files: > /LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-consume-empty.html > /LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-consume-stream.html > /LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-consume.html >+/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-error-from-stream.html > /LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-error.html >-/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-idl.html >+/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-from-stream.any.js > /LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-init-001.html > /LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-init-002.html > /LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-static-error.html >@@ -31,4 +32,5 @@ List of files: > /LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-stream-disturbed-4.html > /LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-stream-disturbed-5.html > /LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-stream-disturbed-6.html >+/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-stream-with-broken-then.any.js > /LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-trailer.html >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/w3c-import.log b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/w3c-import.log >new file mode 100644 >index 0000000000000000000000000000000000000000..90af7b02b2c717889d34bc4ce06e97efbbb9346f >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/w3c-import.log >@@ -0,0 +1,17 @@ >+The tests in this directory were imported from the W3C repository. >+Do NOT modify these tests directly in WebKit. >+Instead, create a pull request on the WPT github: >+ https://github.com/web-platform-tests/wpt >+ >+Then run the Tools/Scripts/import-w3c-tests in WebKit to reimport >+ >+Do NOT modify or remove this file. >+ >+------------------------------------------------------------------------ >+Properties requiring vendor prefixes: >+None >+Property values requiring vendor prefixes: >+None >+------------------------------------------------------------------------ >+List of files: >+/LayoutTests/imported/w3c/web-platform-tests/fetch/api/idl.any.js >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/content-encoding/bad-gzip-body.any-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/content-encoding/bad-gzip-body.any-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..5cbae2d125b27b6f0560a043ff01730bb5b9036c >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/content-encoding/bad-gzip-body.any-expected.txt >@@ -0,0 +1,8 @@ >+ >+PASS Fetching a resource with bad gzip content should still resolve >+PASS Consuming the body of a resource with bad gzip content with arrayBuffer() should reject >+PASS Consuming the body of a resource with bad gzip content with blob() should reject >+PASS Consuming the body of a resource with bad gzip content with formData() should reject >+PASS Consuming the body of a resource with bad gzip content with json() should reject >+PASS Consuming the body of a resource with bad gzip content with text() should reject >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/content-encoding/bad-gzip-body.any.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/content-encoding/bad-gzip-body.any.html >new file mode 100644 >index 0000000000000000000000000000000000000000..2382913528e693b3a5d56c660a45060980b548c3 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/content-encoding/bad-gzip-body.any.html >@@ -0,0 +1 @@ >+<!-- This file is required for WebKit test infrastructure to run the templated test --> >\ No newline at end of file >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/content-encoding/bad-gzip-body.any.js b/LayoutTests/imported/w3c/web-platform-tests/fetch/content-encoding/bad-gzip-body.any.js >new file mode 100644 >index 0000000000000000000000000000000000000000..34557de90f51e01456c9cded2b19902375238b3b >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/content-encoding/bad-gzip-body.any.js >@@ -0,0 +1,20 @@ >+promise_test((test) => { >+ return fetch("resources/bad-gzip-body.py").then(res => { >+ assert_equals(res.status, 200); >+ }); >+}, "Fetching a resource with bad gzip content should still resolve"); >+ >+[ >+ "arrayBuffer", >+ "blob", >+ "formData", >+ "json", >+ "text" >+].forEach(method => { >+ promise_test(t => { >+ return fetch("resources/bad-gzip-body.py").then(res => { >+ assert_equals(res.status, 200); >+ return promise_rejects(t, new TypeError(), res[method]()); >+ }); >+ }, "Consuming the body of a resource with bad gzip content with " + method + "() should reject"); >+}); >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/content-encoding/bad-gzip-body.any.worker-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/content-encoding/bad-gzip-body.any.worker-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..481fc4da80bcedd4d492a68a32706360be144e18 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/content-encoding/bad-gzip-body.any.worker-expected.txt >@@ -0,0 +1,10 @@ >+ >+Harness Error (TIMEOUT), message = null >+ >+PASS Fetching a resource with bad gzip content should still resolve >+TIMEOUT Consuming the body of a resource with bad gzip content with arrayBuffer() should reject Test timed out >+NOTRUN Consuming the body of a resource with bad gzip content with blob() should reject >+NOTRUN Consuming the body of a resource with bad gzip content with formData() should reject >+NOTRUN Consuming the body of a resource with bad gzip content with json() should reject >+NOTRUN Consuming the body of a resource with bad gzip content with text() should reject >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/content-encoding/bad-gzip-body.any.worker.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/content-encoding/bad-gzip-body.any.worker.html >new file mode 100644 >index 0000000000000000000000000000000000000000..2382913528e693b3a5d56c660a45060980b548c3 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/content-encoding/bad-gzip-body.any.worker.html >@@ -0,0 +1 @@ >+<!-- This file is required for WebKit test infrastructure to run the templated test --> >\ No newline at end of file >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/content-encoding/resources/bad-gzip-body.py b/LayoutTests/imported/w3c/web-platform-tests/fetch/content-encoding/resources/bad-gzip-body.py >new file mode 100644 >index 0000000000000000000000000000000000000000..b2f8cfefd7e491260648e33adfe9fbd3f8f72fe6 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/content-encoding/resources/bad-gzip-body.py >@@ -0,0 +1,3 @@ >+def main(request, response): >+ headers = [("Content-Encoding", "gzip")] >+ return headers, "not actually gzip" >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/content-encoding/resources/w3c-import.log b/LayoutTests/imported/w3c/web-platform-tests/fetch/content-encoding/resources/w3c-import.log >new file mode 100644 >index 0000000000000000000000000000000000000000..d67bb0161c140e29b93625131eee5b92f03c8294 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/content-encoding/resources/w3c-import.log >@@ -0,0 +1,17 @@ >+The tests in this directory were imported from the W3C repository. >+Do NOT modify these tests directly in WebKit. >+Instead, create a pull request on the WPT github: >+ https://github.com/web-platform-tests/wpt >+ >+Then run the Tools/Scripts/import-w3c-tests in WebKit to reimport >+ >+Do NOT modify or remove this file. >+ >+------------------------------------------------------------------------ >+Properties requiring vendor prefixes: >+None >+Property values requiring vendor prefixes: >+None >+------------------------------------------------------------------------ >+List of files: >+/LayoutTests/imported/w3c/web-platform-tests/fetch/content-encoding/resources/bad-gzip-body.py >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/content-encoding/w3c-import.log b/LayoutTests/imported/w3c/web-platform-tests/fetch/content-encoding/w3c-import.log >new file mode 100644 >index 0000000000000000000000000000000000000000..0472bcfb6f8f8ca177a6df8080232ff9398ab0f8 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/content-encoding/w3c-import.log >@@ -0,0 +1,17 @@ >+The tests in this directory were imported from the W3C repository. >+Do NOT modify these tests directly in WebKit. >+Instead, create a pull request on the WPT github: >+ https://github.com/web-platform-tests/wpt >+ >+Then run the Tools/Scripts/import-w3c-tests in WebKit to reimport >+ >+Do NOT modify or remove this file. >+ >+------------------------------------------------------------------------ >+Properties requiring vendor prefixes: >+None >+Property values requiring vendor prefixes: >+None >+------------------------------------------------------------------------ >+List of files: >+/LayoutTests/imported/w3c/web-platform-tests/fetch/content-encoding/bad-gzip-body.any.js >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/content-length/content-length-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/content-length/content-length-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..1779f5d25e58fcb134f88d01a8a4c8faefef059d >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/content-length/content-length-expected.txt >@@ -0,0 +1,4 @@ >+PASS >+ >+PASS Content-Length Test >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/content-length/content-length.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/content-length/content-length.html >new file mode 100644 >index 0000000000000000000000000000000000000000..af8ea44eeefa6d797ac69623aaedb11a09161a0e >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/content-length/content-length.html >@@ -0,0 +1,13 @@ >+<!DOCTYPE html> >+<!-- CAUTION: if updating this test also update the expected content-length in the .headers file --> >+<title>Content-Length Test</title> >+<script src="/resources/testharness.js"></script> >+<script src="/resources/testharnessreport.js"></script> >+<script> >+onload = function() { >+ assert_equals(document.body.textContent, "PASS"); >+ done(); >+} >+</script> >+<body>PASS >+but FAIL if this is in the body. >\ No newline at end of file >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/content-length/content-length.html.headers b/LayoutTests/imported/w3c/web-platform-tests/fetch/content-length/content-length.html.headers >new file mode 100644 >index 0000000000000000000000000000000000000000..385ea556d7a1da0d9a0507ec3633550e4bd82060 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/content-length/content-length.html.headers >@@ -0,0 +1 @@ >+Content-Length: 373 >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/content-length/w3c-import.log b/LayoutTests/imported/w3c/web-platform-tests/fetch/content-length/w3c-import.log >new file mode 100644 >index 0000000000000000000000000000000000000000..5a102efc5574e88103739dd192e17b58cbc8e9e4 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/content-length/w3c-import.log >@@ -0,0 +1,18 @@ >+The tests in this directory were imported from the W3C repository. >+Do NOT modify these tests directly in WebKit. >+Instead, create a pull request on the WPT github: >+ https://github.com/web-platform-tests/wpt >+ >+Then run the Tools/Scripts/import-w3c-tests in WebKit to reimport >+ >+Do NOT modify or remove this file. >+ >+------------------------------------------------------------------------ >+Properties requiring vendor prefixes: >+None >+Property values requiring vendor prefixes: >+None >+------------------------------------------------------------------------ >+List of files: >+/LayoutTests/imported/w3c/web-platform-tests/fetch/content-length/content-length.html >+/LayoutTests/imported/w3c/web-platform-tests/fetch/content-length/content-length.html.headers >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/content-type/README.md b/LayoutTests/imported/w3c/web-platform-tests/fetch/content-type/README.md >new file mode 100644 >index 0000000000000000000000000000000000000000..3a9d1bd7266baaaaf74c29954debcd0187511ca4 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/content-type/README.md >@@ -0,0 +1,20 @@ >+# `resources/content-types.json` >+ >+An array of tests. Each test has these fields: >+ >+* `contentType`: an array of values for the `Content-Type` header. A harness needs to run the test twice if there are multiple values. One time with the values concatenated with `,` followed by a space and one time with multiple `Content-Type` declarations, each on their own line with one of the values, in order. >+* `encoding`: the expected encoding, null for the default. >+* `mimeType`: the result of extracing a MIME type and serializing it. >+* `documentContentType`: the MIME type expected to be exposed in DOM documents. >+ >+(These tests are currently somewhat geared towards browser use, but could be generalized easily enough if someone wanted to contribute tests for MIME types that would cause downloads in the browser or some such.) >+ >+# `resources/script-content-types.json` >+ >+An array of tests, surprise. Each test has these fields: >+ >+* `contentType`: see above. >+* `executes`: whether the script is expected to execute. >+* `encoding`: how the script is expected to be decoded. >+ >+These tests are expected to be loaded through `<script src>` and the server is expected to set `X-Content-Type-Options: nosniff`. >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/content-type/resources/content-type.py b/LayoutTests/imported/w3c/web-platform-tests/fetch/content-type/resources/content-type.py >new file mode 100644 >index 0000000000000000000000000000000000000000..0b5e93b937c293250b33ae2cb2e5cbe43e381a86 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/content-type/resources/content-type.py >@@ -0,0 +1,15 @@ >+def main(request, response): >+ values = request.GET.get_list("value") >+ content = request.GET.first("content", "<b>hi</b>\n") >+ output = "HTTP/1.1 200 OK\r\n" >+ output += "X-Content-Type-Options: nosniff\r\n" >+ if "single_header" in request.GET: >+ output += "Content-Type: " + ",".join(values) + "\r\n" >+ else: >+ for value in values: >+ output += "Content-Type: " + value + "\r\n" >+ output += "Content-Length: " + str(len(content)) + "\r\n" >+ output += "\r\n" >+ output += content >+ response.writer.write(output) >+ response.close_connection = True >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/content-type/resources/content-types.json b/LayoutTests/imported/w3c/web-platform-tests/fetch/content-type/resources/content-types.json >new file mode 100644 >index 0000000000000000000000000000000000000000..9578fc503cf73707488b81e027f6ab5ddf7c5983 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/content-type/resources/content-types.json >@@ -0,0 +1,122 @@ >+[ >+ { >+ "contentType": ["", "text/plain"], >+ "encoding": null, >+ "mimeType": "text/plain", >+ "documentContentType": "text/plain" >+ }, >+ { >+ "contentType": ["text/plain", ""], >+ "encoding": null, >+ "mimeType": "text/plain", >+ "documentContentType": "text/plain" >+ }, >+ { >+ "contentType": ["text/html", "text/plain"], >+ "encoding": null, >+ "mimeType": "text/plain", >+ "documentContentType": "text/plain" >+ }, >+ { >+ "contentType": ["text/plain;charset=gbk", "text/html"], >+ "encoding": null, >+ "mimeType": "text/html", >+ "documentContentType": "text/html" >+ }, >+ { >+ "contentType": ["text/plain;charset=gbk", "text/html;charset=windows-1254"], >+ "encoding": "windows-1254", >+ "mimeType": "text/html;charset=windows-1254", >+ "documentContentType": "text/html" >+ }, >+ { >+ "contentType": ["text/plain;charset=gbk", "text/plain"], >+ "encoding": "GBK", >+ "mimeType": "text/plain;charset=gbk", >+ "documentContentType": "text/plain" >+ }, >+ { >+ "contentType": ["text/plain;charset=gbk", "text/plain;charset=windows-1252"], >+ "encoding": "windows-1252", >+ "mimeType": "text/plain;charset=windows-1252", >+ "documentContentType": "text/plain" >+ }, >+ { >+ "contentType": ["text/html;charset=gbk", "text/html;x=\",text/plain"], >+ "encoding": "GBK", >+ "mimeType": "text/html;x=\",text/plain\";charset=gbk", >+ "documentContentType": "text/html" >+ }, >+ { >+ "contentType": ["text/plain;charset=gbk;x=foo", "text/plain"], >+ "encoding": "GBK", >+ "mimeType": "text/plain;charset=gbk", >+ "documentContentType": "text/plain" >+ }, >+ { >+ "contentType": ["text/html;charset=gbk", "text/plain", "text/html"], >+ "encoding": null, >+ "mimeType": "text/html", >+ "documentContentType": "text/html" >+ }, >+ { >+ "contentType": ["text/plain", "*/*"], >+ "encoding": null, >+ "mimeType": "text/plain", >+ "documentContentType": "text/plain" >+ }, >+ { >+ "contentType": ["text/html", "*/*"], >+ "encoding": null, >+ "mimeType": "text/html", >+ "documentContentType": "text/html" >+ }, >+ { >+ "contentType": ["*/*", "text/html"], >+ "encoding": null, >+ "mimeType": "text/html", >+ "documentContentType": "text/html" >+ }, >+ { >+ "contentType": ["text/plain", "*/*;charset=gbk"], >+ "encoding": null, >+ "mimeType": "text/plain", >+ "documentContentType": "text/plain" >+ }, >+ { >+ "contentType": ["text/html", "*/*;charset=gbk"], >+ "encoding": null, >+ "mimeType": "text/html", >+ "documentContentType": "text/html" >+ }, >+ { >+ "contentType": ["text/html;x=\"", "text/plain"], >+ "encoding": null, >+ "mimeType": "text/html;x=\", text/plain\"", >+ "documentContentType": "text/html" >+ }, >+ { >+ "contentType": ["text/html;\"", "text/plain"], >+ "encoding": null, >+ "mimeType": "text/html", >+ "documentContentType": "text/html" >+ }, >+ { >+ "contentType": ["text/html;\"", "\\\"", "text/plain"], >+ "encoding": null, >+ "mimeType": "text/html", >+ "documentContentType": "text/html" >+ }, >+ { >+ "contentType": ["text/html;\"", "\\\"", "text/plain", "\";charset=GBK"], >+ "encoding": "GBK", >+ "mimeType": "text/html;charset=GBK", >+ "documentContentType": "text/html" >+ }, >+ { >+ "contentType": ["text/html;\"", "\"", "text/plain"], >+ "encoding": null, >+ "mimeType": "text/plain", >+ "documentContentType": "text/plain" >+ } >+] >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/content-type/resources/script-content-types.json b/LayoutTests/imported/w3c/web-platform-tests/fetch/content-type/resources/script-content-types.json >new file mode 100644 >index 0000000000000000000000000000000000000000..b8a843bcd82ed48966e4ceacc8f46a520877a017 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/content-type/resources/script-content-types.json >@@ -0,0 +1,92 @@ >+[ >+ { >+ "contentType": ["text/javascript;charset=windows-1252"], >+ "executes": true, >+ "encoding": "windows-1252" >+ }, >+ { >+ "contentType": ["text/javascript;\";charset=windows-1252"], >+ "executes": true, >+ "encoding": "windows-1252" >+ }, >+ { >+ "contentType": ["text/javascript\u000C"], >+ "executes": false, >+ "encoding": null >+ }, >+ { >+ "contentType": ["\"text/javascript\""], >+ "executes": false, >+ "encoding": null >+ }, >+ { >+ "contentType": ["text/ javascript"], >+ "executes": false, >+ "encoding": null >+ }, >+ { >+ "contentType": ["text /javascript"], >+ "executes": false, >+ "encoding": null >+ }, >+ { >+ "contentType": ["x/x", "text/javascript"], >+ "executes": true, >+ "encoding": null >+ }, >+ { >+ "contentType": ["x/x;charset=windows-1252", "text/javascript"], >+ "executes": true, >+ "encoding": null >+ }, >+ { >+ "contentType": ["text/javascript", "x/x"], >+ "executes": false, >+ "encoding": null >+ }, >+ { >+ "contentType": ["text/javascript; charset=windows-1252", "text/javascript"], >+ "executes": true, >+ "encoding": "windows-1252" >+ }, >+ { >+ "contentType": ["text/javascript;\"", "x/x"], >+ "executes": true, >+ "encoding": null >+ }, >+ { >+ "contentType": ["text/javascript", ""], >+ "executes": true, >+ "encoding": null >+ }, >+ { >+ "contentType": ["text/javascript", "error"], >+ "executes": true, >+ "encoding": null >+ }, >+ { >+ "contentType": ["text/javascript;charset=windows-1252", "x/x", "text/javascript"], >+ "executes": true, >+ "encoding": null >+ }, >+ { >+ "contentType": ["text/javascript;charset=windows-1252", "error", "text/javascript"], >+ "executes": true, >+ "encoding": "windows-1252" >+ }, >+ { >+ "contentType": ["text/javascript;charset=windows-1252", "", "text/javascript"], >+ "executes": true, >+ "encoding": "windows-1252" >+ }, >+ { >+ "contentType": ["text/javascript;charset=windows-1252;\"", "\\\"", "x/x"], >+ "executes": true, >+ "encoding": "windows-1252" >+ }, >+ { >+ "contentType": ["x/x;\"", "x/y;\\\"", "text/javascript;charset=windows-1252;\"", "text/javascript"], >+ "executes": true, >+ "encoding": null >+ } >+] >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/content-type/resources/w3c-import.log b/LayoutTests/imported/w3c/web-platform-tests/fetch/content-type/resources/w3c-import.log >new file mode 100644 >index 0000000000000000000000000000000000000000..97989fb7b0bd352ce659962b95f808a188794041 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/content-type/resources/w3c-import.log >@@ -0,0 +1,19 @@ >+The tests in this directory were imported from the W3C repository. >+Do NOT modify these tests directly in WebKit. >+Instead, create a pull request on the WPT github: >+ https://github.com/web-platform-tests/wpt >+ >+Then run the Tools/Scripts/import-w3c-tests in WebKit to reimport >+ >+Do NOT modify or remove this file. >+ >+------------------------------------------------------------------------ >+Properties requiring vendor prefixes: >+None >+Property values requiring vendor prefixes: >+None >+------------------------------------------------------------------------ >+List of files: >+/LayoutTests/imported/w3c/web-platform-tests/fetch/content-type/resources/content-type.py >+/LayoutTests/imported/w3c/web-platform-tests/fetch/content-type/resources/content-types.json >+/LayoutTests/imported/w3c/web-platform-tests/fetch/content-type/resources/script-content-types.json >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/content-type/response.window-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/content-type/response.window-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..266752ef40b45aa4d61accf8eb6fb8b3eb02a304 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/content-type/response.window-expected.txt >@@ -0,0 +1,125 @@ >+ >+Harness Error (TIMEOUT), message = null >+ >+PASS Loading JSON⦠>+PASS <iframe>: separate response Content-Type: text/plain >+PASS <iframe>: combined response Content-Type: text/plain >+PASS fetch(): separate response Content-Type: text/plain >+FAIL fetch(): combined response Content-Type: text/plain assert_equals: expected "text/plain" but got "" >+FAIL Request: combined response Content-Type: text/plain assert_equals: expected "text/plain" but got "" >+FAIL Response: combined response Content-Type: text/plain assert_equals: expected "text/plain" but got "" >+TIMEOUT <iframe>: separate response Content-Type: text/plain Test timed out >+PASS <iframe>: combined response Content-Type: text/plain >+FAIL fetch(): separate response Content-Type: text/plain assert_equals: expected "text/plain" but got "" >+PASS fetch(): combined response Content-Type: text/plain >+FAIL Request: combined response Content-Type: text/plain assert_equals: expected "text/plain" but got "" >+FAIL Response: combined response Content-Type: text/plain assert_equals: expected "text/plain" but got "" >+PASS <iframe>: separate response Content-Type: text/html text/plain >+FAIL <iframe>: combined response Content-Type: text/html text/plain assert_equals: expected "<b>hi</b>\n" but got "hi\n" >+PASS fetch(): separate response Content-Type: text/html text/plain >+FAIL fetch(): combined response Content-Type: text/html text/plain assert_equals: expected "text/plain" but got "text/html" >+FAIL Request: combined response Content-Type: text/html text/plain assert_equals: expected "text/plain" but got "" >+FAIL Response: combined response Content-Type: text/html text/plain assert_equals: expected "text/plain" but got "" >+PASS <iframe>: separate response Content-Type: text/plain;charset=gbk text/html >+FAIL <iframe>: combined response Content-Type: text/plain;charset=gbk text/html assert_equals: expected "UTF-8" but got "GBK" >+PASS fetch(): separate response Content-Type: text/plain;charset=gbk text/html >+FAIL fetch(): combined response Content-Type: text/plain;charset=gbk text/html assert_equals: expected "text/html" but got "text/plain" >+FAIL Request: combined response Content-Type: text/plain;charset=gbk text/html assert_equals: expected "text/html" but got "" >+FAIL Response: combined response Content-Type: text/plain;charset=gbk text/html assert_equals: expected "text/html" but got "" >+PASS <iframe>: separate response Content-Type: text/plain;charset=gbk text/html;charset=windows-1254 >+FAIL <iframe>: combined response Content-Type: text/plain;charset=gbk text/html;charset=windows-1254 assert_equals: expected "WINDOWS-1254" but got "GBK" >+FAIL fetch(): separate response Content-Type: text/plain;charset=gbk text/html;charset=windows-1254 assert_equals: expected "text/html;charset=windows-1254" but got "text/html" >+FAIL fetch(): combined response Content-Type: text/plain;charset=gbk text/html;charset=windows-1254 assert_equals: expected "text/html;charset=windows-1254" but got "text/plain" >+FAIL Request: combined response Content-Type: text/plain;charset=gbk text/html;charset=windows-1254 assert_equals: expected "text/html;charset=windows-1254" but got "" >+FAIL Response: combined response Content-Type: text/plain;charset=gbk text/html;charset=windows-1254 assert_equals: expected "text/html;charset=windows-1254" but got "" >+FAIL <iframe>: separate response Content-Type: text/plain;charset=gbk text/plain assert_equals: expected "GBK" but got "UTF-8" >+PASS <iframe>: combined response Content-Type: text/plain;charset=gbk text/plain >+FAIL fetch(): separate response Content-Type: text/plain;charset=gbk text/plain assert_equals: expected "text/plain;charset=gbk" but got "text/plain" >+FAIL fetch(): combined response Content-Type: text/plain;charset=gbk text/plain assert_equals: expected "text/plain;charset=gbk" but got "text/plain" >+FAIL Request: combined response Content-Type: text/plain;charset=gbk text/plain assert_equals: expected "text/plain;charset=gbk" but got "" >+FAIL Response: combined response Content-Type: text/plain;charset=gbk text/plain assert_equals: expected "text/plain;charset=gbk" but got "" >+PASS <iframe>: separate response Content-Type: text/plain;charset=gbk text/plain;charset=windows-1252 >+FAIL <iframe>: combined response Content-Type: text/plain;charset=gbk text/plain;charset=windows-1252 assert_equals: expected "WINDOWS-1252" but got "GBK" >+FAIL fetch(): separate response Content-Type: text/plain;charset=gbk text/plain;charset=windows-1252 assert_equals: expected "text/plain;charset=windows-1252" but got "text/plain" >+FAIL fetch(): combined response Content-Type: text/plain;charset=gbk text/plain;charset=windows-1252 assert_equals: expected "text/plain;charset=windows-1252" but got "text/plain" >+FAIL Request: combined response Content-Type: text/plain;charset=gbk text/plain;charset=windows-1252 assert_equals: expected "text/plain;charset=windows-1252" but got "" >+FAIL Response: combined response Content-Type: text/plain;charset=gbk text/plain;charset=windows-1252 assert_equals: expected "text/plain;charset=windows-1252" but got "" >+FAIL <iframe>: separate response Content-Type: text/html;charset=gbk text/html;x=",text/plain assert_equals: expected "GBK" but got "UTF-8" >+PASS <iframe>: combined response Content-Type: text/html;charset=gbk text/html;x=",text/plain >+FAIL fetch(): separate response Content-Type: text/html;charset=gbk text/html;x=",text/plain assert_equals: expected "text/html;x=\",text/plain\";charset=gbk" but got "text/html" >+FAIL fetch(): combined response Content-Type: text/html;charset=gbk text/html;x=",text/plain assert_equals: expected "text/html;x=\",text/plain\";charset=gbk" but got "text/html" >+FAIL Request: combined response Content-Type: text/html;charset=gbk text/html;x=",text/plain assert_equals: expected "text/html;x=\",text/plain\";charset=gbk" but got "" >+FAIL Response: combined response Content-Type: text/html;charset=gbk text/html;x=",text/plain assert_equals: expected "text/html;x=\",text/plain\";charset=gbk" but got "" >+FAIL <iframe>: separate response Content-Type: text/plain;charset=gbk;x=foo text/plain assert_equals: expected "GBK" but got "UTF-8" >+PASS <iframe>: combined response Content-Type: text/plain;charset=gbk;x=foo text/plain >+FAIL fetch(): separate response Content-Type: text/plain;charset=gbk;x=foo text/plain assert_equals: expected "text/plain;charset=gbk" but got "text/plain" >+FAIL fetch(): combined response Content-Type: text/plain;charset=gbk;x=foo text/plain assert_equals: expected "text/plain;charset=gbk" but got "text/plain" >+FAIL Request: combined response Content-Type: text/plain;charset=gbk;x=foo text/plain assert_equals: expected "text/plain;charset=gbk" but got "" >+FAIL Response: combined response Content-Type: text/plain;charset=gbk;x=foo text/plain assert_equals: expected "text/plain;charset=gbk" but got "" >+PASS <iframe>: separate response Content-Type: text/html;charset=gbk text/plain text/html >+FAIL <iframe>: combined response Content-Type: text/html;charset=gbk text/plain text/html assert_equals: expected "UTF-8" but got "GBK" >+PASS fetch(): separate response Content-Type: text/html;charset=gbk text/plain text/html >+PASS fetch(): combined response Content-Type: text/html;charset=gbk text/plain text/html >+FAIL Request: combined response Content-Type: text/html;charset=gbk text/plain text/html assert_equals: expected "text/html" but got "" >+FAIL Response: combined response Content-Type: text/html;charset=gbk text/plain text/html assert_equals: expected "text/html" but got "" >+TIMEOUT <iframe>: separate response Content-Type: text/plain */* Test timed out >+TIMEOUT <iframe>: combined response Content-Type: text/plain */* Test timed out >+FAIL fetch(): separate response Content-Type: text/plain */* assert_equals: expected "text/plain" but got "*/*" >+PASS fetch(): combined response Content-Type: text/plain */* >+FAIL Request: combined response Content-Type: text/plain */* assert_equals: expected "text/plain" but got "" >+FAIL Response: combined response Content-Type: text/plain */* assert_equals: expected "text/plain" but got "" >+TIMEOUT <iframe>: separate response Content-Type: text/html */* Test timed out >+TIMEOUT <iframe>: combined response Content-Type: text/html */* Test timed out >+FAIL fetch(): separate response Content-Type: text/html */* assert_equals: expected "text/html" but got "*/*" >+PASS fetch(): combined response Content-Type: text/html */* >+FAIL Request: combined response Content-Type: text/html */* assert_equals: expected "text/html" but got "" >+FAIL Response: combined response Content-Type: text/html */* assert_equals: expected "text/html" but got "" >+PASS <iframe>: separate response Content-Type: */* text/html >+TIMEOUT <iframe>: combined response Content-Type: */* text/html Test timed out >+PASS fetch(): separate response Content-Type: */* text/html >+FAIL fetch(): combined response Content-Type: */* text/html assert_equals: expected "text/html" but got "*/*" >+FAIL Request: combined response Content-Type: */* text/html assert_equals: expected "text/html" but got "" >+FAIL Response: combined response Content-Type: */* text/html assert_equals: expected "text/html" but got "" >+TIMEOUT <iframe>: separate response Content-Type: text/plain */*;charset=gbk Test timed out >+TIMEOUT <iframe>: combined response Content-Type: text/plain */*;charset=gbk Test timed out >+FAIL fetch(): separate response Content-Type: text/plain */*;charset=gbk assert_equals: expected "text/plain" but got "*/*" >+PASS fetch(): combined response Content-Type: text/plain */*;charset=gbk >+FAIL Request: combined response Content-Type: text/plain */*;charset=gbk assert_equals: expected "text/plain" but got "" >+FAIL Response: combined response Content-Type: text/plain */*;charset=gbk assert_equals: expected "text/plain" but got "" >+TIMEOUT <iframe>: separate response Content-Type: text/html */*;charset=gbk Test timed out >+TIMEOUT <iframe>: combined response Content-Type: text/html */*;charset=gbk Test timed out >+FAIL fetch(): separate response Content-Type: text/html */*;charset=gbk assert_equals: expected "text/html" but got "*/*" >+PASS fetch(): combined response Content-Type: text/html */*;charset=gbk >+FAIL Request: combined response Content-Type: text/html */*;charset=gbk assert_equals: expected "text/html" but got "" >+FAIL Response: combined response Content-Type: text/html */*;charset=gbk assert_equals: expected "text/html" but got "" >+FAIL <iframe>: separate response Content-Type: text/html;x=" text/plain assert_equals: expected "b" but got "pre" >+PASS <iframe>: combined response Content-Type: text/html;x=" text/plain >+FAIL fetch(): separate response Content-Type: text/html;x=" text/plain assert_equals: expected "text/html;x=\", text/plain\"" but got "text/plain" >+FAIL fetch(): combined response Content-Type: text/html;x=" text/plain assert_equals: expected "text/html;x=\", text/plain\"" but got "text/html" >+FAIL Request: combined response Content-Type: text/html;x=" text/plain assert_equals: expected "text/html;x=\", text/plain\"" but got "" >+FAIL Response: combined response Content-Type: text/html;x=" text/plain assert_equals: expected "text/html;x=\", text/plain\"" but got "" >+FAIL <iframe>: separate response Content-Type: text/html;" text/plain assert_equals: expected "b" but got "pre" >+PASS <iframe>: combined response Content-Type: text/html;" text/plain >+FAIL fetch(): separate response Content-Type: text/html;" text/plain assert_equals: expected "text/html" but got "text/plain" >+PASS fetch(): combined response Content-Type: text/html;" text/plain >+FAIL Request: combined response Content-Type: text/html;" text/plain assert_equals: expected "text/html" but got "" >+FAIL Response: combined response Content-Type: text/html;" text/plain assert_equals: expected "text/html" but got "" >+FAIL <iframe>: separate response Content-Type: text/html;" \" text/plain assert_equals: expected "b" but got "pre" >+PASS <iframe>: combined response Content-Type: text/html;" \" text/plain >+FAIL fetch(): separate response Content-Type: text/html;" \" text/plain assert_equals: expected "text/html" but got "text/plain" >+PASS fetch(): combined response Content-Type: text/html;" \" text/plain >+FAIL Request: combined response Content-Type: text/html;" \" text/plain assert_equals: expected "text/html" but got "" >+FAIL Response: combined response Content-Type: text/html;" \" text/plain assert_equals: expected "text/html" but got "" >+TIMEOUT <iframe>: separate response Content-Type: text/html;" \" text/plain ";charset=GBK Test timed out >+PASS <iframe>: combined response Content-Type: text/html;" \" text/plain ";charset=GBK >+FAIL fetch(): separate response Content-Type: text/html;" \" text/plain ";charset=GBK assert_equals: expected "text/html;charset=GBK" but got "\"" >+FAIL fetch(): combined response Content-Type: text/html;" \" text/plain ";charset=GBK assert_equals: expected "text/html;charset=GBK" but got "text/html" >+FAIL Request: combined response Content-Type: text/html;" \" text/plain ";charset=GBK assert_equals: expected "text/html;charset=GBK" but got "" >+FAIL Response: combined response Content-Type: text/html;" \" text/plain ";charset=GBK assert_equals: expected "text/html;charset=GBK" but got "" >+PASS <iframe>: separate response Content-Type: text/html;" " text/plain >+FAIL <iframe>: combined response Content-Type: text/html;" " text/plain assert_equals: expected "<b>hi</b>\n" but got "hi\n" >+PASS fetch(): separate response Content-Type: text/html;" " text/plain >+FAIL fetch(): combined response Content-Type: text/html;" " text/plain assert_equals: expected "text/plain" but got "text/html" >+FAIL Request: combined response Content-Type: text/html;" " text/plain assert_equals: expected "text/plain" but got "" >+FAIL Response: combined response Content-Type: text/html;" " text/plain assert_equals: expected "text/plain" but got "" >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/content-type/response.window.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/content-type/response.window.html >new file mode 100644 >index 0000000000000000000000000000000000000000..2382913528e693b3a5d56c660a45060980b548c3 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/content-type/response.window.html >@@ -0,0 +1 @@ >+<!-- This file is required for WebKit test infrastructure to run the templated test --> >\ No newline at end of file >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/content-type/response.window.js b/LayoutTests/imported/w3c/web-platform-tests/fetch/content-type/response.window.js >new file mode 100644 >index 0000000000000000000000000000000000000000..746f51c9bb511841e1edcb25db7afa8e5efd44b1 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/content-type/response.window.js >@@ -0,0 +1,72 @@ >+promise_test(() => { >+ return fetch("resources/content-types.json").then(res => res.json()).then(runTests); >+}, "Loading JSONâ¦"); >+ >+function runTests(tests) { >+ tests.forEach(testUnit => { >+ runFrameTest(testUnit, false); >+ runFrameTest(testUnit, true); >+ runFetchTest(testUnit, false); >+ runFetchTest(testUnit, true); >+ runRequestResponseTest(testUnit, "Request"); >+ runRequestResponseTest(testUnit, "Response"); >+ }); >+} >+ >+function runFrameTest(testUnit, singleHeader) { >+ // Note: window.js is always UTF-8 >+ const encoding = testUnit.encoding !== null ? testUnit.encoding : "UTF-8"; >+ async_test(t => { >+ const frame = document.body.appendChild(document.createElement("iframe")); >+ t.add_cleanup(() => frame.remove()); >+ frame.src = getURL(testUnit.contentType, singleHeader); >+ frame.onload = t.step_func_done(() => { >+ // Edge requires toUpperCase() >+ const doc = frame.contentDocument; >+ assert_equals(doc.characterSet.toUpperCase(), encoding.toUpperCase()); >+ if (testUnit.documentContentType === "text/plain") { >+ assert_equals(doc.body.textContent, "<b>hi</b>\n"); >+ } else if (testUnit.documentContentType === "text/html") { >+ assert_equals(doc.body.firstChild.localName, "b"); >+ assert_equals(doc.body.firstChild.textContent, "hi"); >+ } >+ assert_equals(doc.contentType, testUnit.documentContentType); >+ }); >+ }, getDesc("<iframe>", testUnit.contentType, singleHeader)); >+} >+ >+function getDesc(type, input, singleHeader) { >+ return type + ": " + (singleHeader ? "combined" : "separate") + " response Content-Type: " + input.join(" "); >+} >+ >+function getURL(input, singleHeader) { >+ // Edge does not support URLSearchParams >+ let url = "resources/content-type.py?" >+ if (singleHeader) { >+ url += "single_header&" >+ } >+ input.forEach(val => { >+ url += "value=" + encodeURIComponent(val) + "&"; >+ }); >+ return url; >+} >+ >+function runFetchTest(testUnit, singleHeader) { >+ promise_test(async t => { >+ const blob = await (await fetch(getURL(testUnit.contentType, singleHeader))).blob(); >+ assert_equals(blob.type, testUnit.mimeType); >+ }, getDesc("fetch()", testUnit.contentType, singleHeader)); >+} >+ >+function runRequestResponseTest(testUnit, stringConstructor) { >+ promise_test(async t => { >+ // Cannot give Response a body as that will set Content-Type, but Request needs a URL >+ const constructorArgument = stringConstructor === "Request" ? "about:blank" : undefined; >+ const r = new self[stringConstructor](constructorArgument); >+ testUnit.contentType.forEach(val => { >+ r.headers.append("Content-Type", val); >+ }); >+ const blob = await r.blob(); >+ assert_equals(blob.type, testUnit.mimeType); >+ }, getDesc(stringConstructor, testUnit.contentType, true)); >+} >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/content-type/script.window-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/content-type/script.window-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..c99a487c1feb39b89c63da008a8f098596694db5 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/content-type/script.window-expected.txt >@@ -0,0 +1,33 @@ >+ >+PASS Loading JSON⦠>+PASS separate text/javascript;charset=windows-1252 >+PASS separate text/javascript;";charset=windows-1252 >+FAIL separate text/javascript assert_unreached: Reached unreachable code >+PASS separate "text/javascript" >+PASS separate text/ javascript >+PASS separate text /javascript >+PASS separate x/x text/javascript >+FAIL combined x/x text/javascript assert_unreached: Reached unreachable code >+PASS separate x/x;charset=windows-1252 text/javascript >+FAIL combined x/x;charset=windows-1252 text/javascript assert_unreached: Reached unreachable code >+PASS separate text/javascript x/x >+FAIL combined text/javascript x/x assert_unreached: Reached unreachable code >+FAIL separate text/javascript; charset=windows-1252 text/javascript assert_equals: expected "ââ¬" but got "â¬" >+PASS combined text/javascript; charset=windows-1252 text/javascript >+FAIL separate text/javascript;" x/x assert_unreached: Reached unreachable code >+PASS combined text/javascript;" x/x >+FAIL separate text/javascript assert_unreached: Reached unreachable code >+PASS combined text/javascript >+FAIL separate text/javascript error assert_unreached: Reached unreachable code >+PASS combined text/javascript error >+PASS separate text/javascript;charset=windows-1252 x/x text/javascript >+FAIL combined text/javascript;charset=windows-1252 x/x text/javascript assert_equals: expected "â¬" but got "ââ¬" >+FAIL separate text/javascript;charset=windows-1252 error text/javascript assert_equals: expected "ââ¬" but got "â¬" >+PASS combined text/javascript;charset=windows-1252 error text/javascript >+FAIL separate text/javascript;charset=windows-1252 text/javascript assert_equals: expected "ââ¬" but got "â¬" >+PASS combined text/javascript;charset=windows-1252 text/javascript >+FAIL separate text/javascript;charset=windows-1252;" \" x/x assert_unreached: Reached unreachable code >+PASS combined text/javascript;charset=windows-1252;" \" x/x >+PASS separate x/x;" x/y;\" text/javascript;charset=windows-1252;" text/javascript >+FAIL combined x/x;" x/y;\" text/javascript;charset=windows-1252;" text/javascript assert_unreached: Reached unreachable code >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/content-type/script.window.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/content-type/script.window.html >new file mode 100644 >index 0000000000000000000000000000000000000000..2382913528e693b3a5d56c660a45060980b548c3 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/content-type/script.window.html >@@ -0,0 +1 @@ >+<!-- This file is required for WebKit test infrastructure to run the templated test --> >\ No newline at end of file >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/content-type/script.window.js b/LayoutTests/imported/w3c/web-platform-tests/fetch/content-type/script.window.js >new file mode 100644 >index 0000000000000000000000000000000000000000..88584ce9c21be273745d5774a13e25bbdc2e74ab >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/content-type/script.window.js >@@ -0,0 +1,48 @@ >+promise_test(() => { >+ return fetch("resources/script-content-types.json").then(res => res.json()).then(runTests); >+}, "Loading JSONâ¦"); >+ >+self.stringFromExecutedScript = undefined; >+ >+function runTests(allTestData) { >+ allTestData.forEach(testData => { >+ runScriptTest(testData, false); >+ if (testData.contentType.length > 1) { >+ runScriptTest(testData, true); >+ } >+ }); >+} >+ >+function runScriptTest(testData, singleHeader) { >+ async_test(t => { >+ const script = document.createElement("script"); >+ t.add_cleanup(() => { >+ script.remove() >+ self.stringFromExecutedScript = undefined; >+ }); >+ script.src = getURL(testData.contentType, singleHeader); >+ document.head.appendChild(script); >+ if (testData.executes) { >+ script.onload = t.step_func_done(() => { >+ assert_equals(self.stringFromExecutedScript, testData.encoding === "windows-1252" ? "ââ¬" : "â¬"); >+ }); >+ script.onerror = t.unreached_func(); >+ } else { >+ script.onerror = t.step_func_done(); >+ script.onload = t.unreached_func(); >+ } >+ }, (singleHeader ? "combined" : "separate") + " " + testData.contentType.join(" ")); >+} >+ >+function getURL(input, singleHeader) { >+ // Edge does not support URLSearchParams >+ let url = "resources/content-type.py?" >+ if (singleHeader) { >+ url += "single_header&" >+ } >+ input.forEach(val => { >+ url += "value=" + encodeURIComponent(val) + "&"; >+ }); >+ url += "&content=" + encodeURIComponent("self.stringFromExecutedScript = \"â¬\""); >+ return url; >+} >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/content-type/w3c-import.log b/LayoutTests/imported/w3c/web-platform-tests/fetch/content-type/w3c-import.log >new file mode 100644 >index 0000000000000000000000000000000000000000..77e1792ce2b7ba54bbe248809b7497ce4182621d >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/content-type/w3c-import.log >@@ -0,0 +1,19 @@ >+The tests in this directory were imported from the W3C repository. >+Do NOT modify these tests directly in WebKit. >+Instead, create a pull request on the WPT github: >+ https://github.com/web-platform-tests/wpt >+ >+Then run the Tools/Scripts/import-w3c-tests in WebKit to reimport >+ >+Do NOT modify or remove this file. >+ >+------------------------------------------------------------------------ >+Properties requiring vendor prefixes: >+None >+Property values requiring vendor prefixes: >+None >+------------------------------------------------------------------------ >+List of files: >+/LayoutTests/imported/w3c/web-platform-tests/fetch/content-type/README.md >+/LayoutTests/imported/w3c/web-platform-tests/fetch/content-type/response.window.js >+/LayoutTests/imported/w3c/web-platform-tests/fetch/content-type/script.window.js >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/README.md b/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/README.md >new file mode 100644 >index 0000000000000000000000000000000000000000..f131b5a1da986a2041aa526ab2dd449733e3dc4c >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/README.md >@@ -0,0 +1,67 @@ >+# Tests related to Cross-Origin Resource Blocking (CORB). >+ >+### Summary >+ >+This directory contains tests related to the >+[Cross-Origin Resource Blocking (CORB)](https://chromium.googlesource.com/chromium/src/+/master/services/network/cross_origin_read_blocking_explainer.md) >+algorithm. >+ >+The tests in this directory interact with various, random features, >+but the tests have been grouped together into the `fetch/corb` directory, >+because all of these tests verify behavior that is important to the CORB >+algorithm. >+ >+ >+### CORB is not universally implemented yet >+ >+CORB has been included >+in the [Fetch spec](https://fetch.spec.whatwg.org/#corb) >+since [May 2018](https://github.com/whatwg/fetch/pull/686). >+ >+Some tests in this directory (e.g. >+`css-with-json-parser-breaker`) cover behavior spec-ed outside of CORB (making >+sure that CORB doesn't change the existing web behavior) and therefore are >+valuable independently from CORB's standardization efforts and should already >+be passing across all browsers. >+ >+Tests that cover behavior that is changed by CORB are currently marked as >+[tentative](https://web-platform-tests.org/writing-tests/file-names.html) >+(using `.tentative` substring in their filename). >+Such tests may fail unless CORB is enabled. In practice this means that: >+* Such tests will pass in Chromium >+ (where CORB is enabled by default [since M68](https://crrev.com/553830)). >+* Such tests may fail in other browsers. >+ >+ >+### Limitations of WPT test coverage >+ >+CORB is a defense-in-depth and in general should not cause changes in behavior >+that can be observed by web features or by end users. This makes CORB difficult >+or even impossible to test via WPT. >+ >+WPT tests can cover the following: >+ >+* Helping verify CORB has no observable impact in specific scenarios. >+ Examples: >+ * image rendering of (an empty response of) a html document blocked by CORB >+ should be indistinguishable from rendering such html document without CORB - >+ `img-html-correctly-labeled.sub.html` >+ * CORB shouldn't block responses that don't sniff as a CORB-protected document >+ type - `img-png-mislabeled-as-html.sub.html` >+* Helping document cases where CORB causes observable changes in behavior. >+ Examples: >+ * blocking of nosniff images labeled as non-image, CORB-protected >+ Content-Type - `img-png-mislabeled-as-html-nosniff.tentative.sub.html` >+ * blocking of CORB-protected documents can prevent triggering >+ syntax errors in scripts - >+ `script-html-via-cross-origin-blob-url.tentative.sub.html` >+* Helping verify which MIME types are protected by CORB. >+ >+Examples of aspects that WPT tests cannot cover (these aspects have to be >+covered in other, browser-specific tests): >+* Verifying that CORB doesn't affect things that are only indirectly >+ observable by the web (like >+ [prefetch](https://html.spec.whatwg.org/#link-type-prefetch). >+* Verifying that CORB strips headers of blocked responses. >+* Verifying that CORB blocks responses before they reach the process hosting >+ a cross-origin execution context. >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/img-html-correctly-labeled.sub-expected.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/img-html-correctly-labeled.sub-expected.html >new file mode 100644 >index 0000000000000000000000000000000000000000..0e755969523e2abe0e40324d60b493eb93741a12 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/img-html-correctly-labeled.sub-expected.html >@@ -0,0 +1,4 @@ >+<!DOCTYPE html> >+<meta charset="utf-8"> >+<!-- Same-origin, so the HTTP response is not CORB-eligible --> >+<img src="resources/html-correctly-labeled.html"> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/img-html-correctly-labeled.sub.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/img-html-correctly-labeled.sub.html >new file mode 100644 >index 0000000000000000000000000000000000000000..844cd0c92709f209c056a5a510c0b3811c2b7ae0 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/img-html-correctly-labeled.sub.html >@@ -0,0 +1,11 @@ >+<!DOCTYPE html> >+<!-- Test verifies that html fed to an <img> tag doesn't have any observable >+ difference with and without CORB (in both cases the resource body cannot be >+ rendered as an image - html cannot be rendered as an image and the empty body >+ from a CORB-blocked response also cannot be rendered as an image). >+--> >+<meta charset="utf-8"> >+<!-- Reference page uses same-origin resources, which are not CORB-eligible. --> >+<link rel="match" href="img-html-correctly-labeled.sub-ref.html"> >+<!-- www1 is cross-origin, so the HTTP response is CORB-eligible --> >+<img src="http://{{domains[www1]}}:{{ports[http][0]}}/fetch/corb/resources/html-correctly-labeled.html"> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/img-mime-types-coverage.tentative.sub-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/img-mime-types-coverage.tentative.sub-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..22eff31def9839ad0840eae6c781c1273c20fc5c >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/img-mime-types-coverage.tentative.sub-expected.txt >@@ -0,0 +1,68 @@ >+Blocked access to external URL http://www1.localhost:8800/fetch/nosniff/resources/image.py >+Blocked access to external URL http://www1.localhost:8800/fetch/nosniff/resources/image.py?type= >+Blocked access to external URL http://www1.localhost:8800/fetch/nosniff/resources/image.py?type=x >+Blocked access to external URL http://www1.localhost:8800/fetch/nosniff/resources/image.py?type=x%2Fx >+Blocked access to external URL http://www1.localhost:8800/fetch/nosniff/resources/image.py?type=image%2Fgif >+Blocked access to external URL http://www1.localhost:8800/fetch/nosniff/resources/image.py?type=image%2Fpng >+Blocked access to external URL http://www1.localhost:8800/fetch/nosniff/resources/image.py?type=image%2Fpng%3Bblah >+Blocked access to external URL http://www1.localhost:8800/fetch/nosniff/resources/image.py?type=image%2Fsvg%2Bxml >+Blocked access to external URL http://www1.localhost:8800/fetch/nosniff/resources/image.py?type=application%2Fjavascript >+Blocked access to external URL http://www1.localhost:8800/fetch/nosniff/resources/image.py?type=application%2Fjsonp >+Blocked access to external URL http://www1.localhost:8800/fetch/nosniff/resources/image.py?type=image%2Fgif%3BHI%3DTHERE >+Blocked access to external URL http://www1.localhost:8800/fetch/nosniff/resources/image.py?type=text%2Fx-json >+Blocked access to external URL http://www1.localhost:8800/fetch/nosniff/resources/image.py?type=text%2Fjson%2Bblah >+Blocked access to external URL http://www1.localhost:8800/fetch/nosniff/resources/image.py?type=application%2Fjson%2Bblah >+Blocked access to external URL http://www1.localhost:8800/fetch/nosniff/resources/image.py?type=text%2Fxml%2Bblah >+Blocked access to external URL http://www1.localhost:8800/fetch/nosniff/resources/image.py?type=application%2Fxml%2Bblah >+Blocked access to external URL http://www1.localhost:8800/fetch/nosniff/resources/image.py?type=application%2Fblahjson >+Blocked access to external URL http://www1.localhost:8800/fetch/nosniff/resources/image.py?type=text%2Fblahxml >+Blocked access to external URL http://www1.localhost:8800/fetch/nosniff/resources/image.py?type=text%2Fhtml >+Blocked access to external URL http://www1.localhost:8800/fetch/nosniff/resources/image.py?type=text%2Fjson >+Blocked access to external URL http://www1.localhost:8800/fetch/nosniff/resources/image.py?type=application%2Fjson >+Blocked access to external URL http://www1.localhost:8800/fetch/nosniff/resources/image.py?type=text%2Fxml >+Blocked access to external URL http://www1.localhost:8800/fetch/nosniff/resources/image.py?type=application%2Fxml >+Blocked access to external URL http://www1.localhost:8800/fetch/nosniff/resources/image.py?type=application%2Fblah%2Bjson >+Blocked access to external URL http://www1.localhost:8800/fetch/nosniff/resources/image.py?type=text%2Fblah%2Bjson >+Blocked access to external URL http://www1.localhost:8800/fetch/nosniff/resources/image.py?type=application%2Fblah%2Bxml >+Blocked access to external URL http://www1.localhost:8800/fetch/nosniff/resources/image.py?type=text%2Fblah%2Bxml >+Blocked access to external URL http://www1.localhost:8800/fetch/nosniff/resources/image.py?type=TEXT%2FHTML >+Blocked access to external URL http://www1.localhost:8800/fetch/nosniff/resources/image.py?type=TEXT%2FJSON >+Blocked access to external URL http://www1.localhost:8800/fetch/nosniff/resources/image.py?type=TEXT%2FBLAH%2BJSON >+Blocked access to external URL http://www1.localhost:8800/fetch/nosniff/resources/image.py?type=APPLICATION%2FBLAH%2BXML >+Blocked access to external URL http://www1.localhost:8800/fetch/nosniff/resources/image.py?type=text%2Fjson%3Bdoes%3Dit%3Bmatter >+Blocked access to external URL http://www1.localhost:8800/fetch/nosniff/resources/image.py?type=text%2FHTML%3BNO%3Dit%3Bdoes%3DNOT >+ >+FAIL CORB should allow the response if Content-Type is: 'null'. assert_unreached: Unexpected error event Reached unreachable code >+FAIL CORB should allow the response if Content-Type is: ''. assert_unreached: Unexpected error event Reached unreachable code >+FAIL CORB should allow the response if Content-Type is: 'x'. assert_unreached: Unexpected error event Reached unreachable code >+FAIL CORB should allow the response if Content-Type is: 'x/x'. assert_unreached: Unexpected error event Reached unreachable code >+FAIL CORB should allow the response if Content-Type is: 'image/gif'. assert_unreached: Unexpected error event Reached unreachable code >+FAIL CORB should allow the response if Content-Type is: 'image/png'. assert_unreached: Unexpected error event Reached unreachable code >+FAIL CORB should allow the response if Content-Type is: 'image/png;blah'. assert_unreached: Unexpected error event Reached unreachable code >+FAIL CORB should allow the response if Content-Type is: 'image/svg+xml'. assert_unreached: Unexpected error event Reached unreachable code >+FAIL CORB should allow the response if Content-Type is: 'application/javascript'. assert_unreached: Unexpected error event Reached unreachable code >+FAIL CORB should allow the response if Content-Type is: 'application/jsonp'. assert_unreached: Unexpected error event Reached unreachable code >+FAIL CORB should allow the response if Content-Type is: 'image/gif;HI=THERE'. assert_unreached: Unexpected error event Reached unreachable code >+FAIL CORB should allow the response if Content-Type is: 'text/x-json'. assert_unreached: Unexpected error event Reached unreachable code >+FAIL CORB should allow the response if Content-Type is: 'text/json+blah'. assert_unreached: Unexpected error event Reached unreachable code >+FAIL CORB should allow the response if Content-Type is: 'application/json+blah'. assert_unreached: Unexpected error event Reached unreachable code >+FAIL CORB should allow the response if Content-Type is: 'text/xml+blah'. assert_unreached: Unexpected error event Reached unreachable code >+FAIL CORB should allow the response if Content-Type is: 'application/xml+blah'. assert_unreached: Unexpected error event Reached unreachable code >+FAIL CORB should allow the response if Content-Type is: 'application/blahjson'. assert_unreached: Unexpected error event Reached unreachable code >+FAIL CORB should allow the response if Content-Type is: 'text/blahxml'. assert_unreached: Unexpected error event Reached unreachable code >+PASS CORB should block the response if Content-Type is: 'text/html'. >+PASS CORB should block the response if Content-Type is: 'text/json'. >+PASS CORB should block the response if Content-Type is: 'application/json'. >+PASS CORB should block the response if Content-Type is: 'text/xml'. >+PASS CORB should block the response if Content-Type is: 'application/xml'. >+PASS CORB should block the response if Content-Type is: 'application/blah+json'. >+PASS CORB should block the response if Content-Type is: 'text/blah+json'. >+PASS CORB should block the response if Content-Type is: 'application/blah+xml'. >+PASS CORB should block the response if Content-Type is: 'text/blah+xml'. >+PASS CORB should block the response if Content-Type is: 'TEXT/HTML'. >+PASS CORB should block the response if Content-Type is: 'TEXT/JSON'. >+PASS CORB should block the response if Content-Type is: 'TEXT/BLAH+JSON'. >+PASS CORB should block the response if Content-Type is: 'APPLICATION/BLAH+XML'. >+PASS CORB should block the response if Content-Type is: 'text/json;does=it;matter'. >+PASS CORB should block the response if Content-Type is: 'text/HTML;NO=it;does=NOT'. >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/img-mime-types-coverage.tentative.sub.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/img-mime-types-coverage.tentative.sub.html >new file mode 100644 >index 0000000000000000000000000000000000000000..65c5b846d5348a065fb935cc9426fb07a5df1e77 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/img-mime-types-coverage.tentative.sub.html >@@ -0,0 +1,77 @@ >+<!-- Test verifies that cross-origin, nosniff images are 1) blocked when their >+ MIME type is covered by CORB and 2) allowed otherwise. >+ >+ This test is very similar to fetch/nosniff/images.html, except that >+ 1) it deals with cross-origin images (CORB ignores same-origin fetches), >+ 2) it focuses on MIME types relevant to CORB. >+ There are opportunities to unify the test here with nosniff tests *if* >+ we can also start blocking same-origin (or cors-allowed) images. We >+ should try to gather data to quantify the impact of such change. >+--> >+<script src=/resources/testharness.js></script> >+<script src=/resources/testharnessreport.js></script> >+<div id=log></div> >+<script> >+ var passes = [ >+ // Empty or non-sensical MIME types >+ null, "", "x", "x/x", >+ >+ // MIME-types not protected by CORB >+ "image/gif", "image/png", "image/png;blah", "image/svg+xml", >+ "application/javascript", "application/jsonp", >+ "image/gif;HI=THERE", >+ >+ // MIME types that may seem to be JSON or XML, but really aren't - i.e. >+ // these MIME types are not covered by: >+ // - https://mimesniff.spec.whatwg.org/#json-mime-type >+ // - https://mimesniff.spec.whatwg.org/#xml-mime-type >+ // - https://tools.ietf.org/html/rfc6839 >+ // - https://tools.ietf.org/html/rfc7303 >+ "text/x-json", "text/json+blah", "application/json+blah", >+ "text/xml+blah", "application/xml+blah", >+ "application/blahjson", "text/blahxml"] >+ >+ var fails = [ >+ // CORB-protected MIME-types - i.e. ones covered by: >+ // - https://mimesniff.spec.whatwg.org/#html-mime-type >+ // - https://mimesniff.spec.whatwg.org/#json-mime-type >+ // - https://mimesniff.spec.whatwg.org/#xml-mime-type >+ "text/html", >+ "text/json", "application/json", "text/xml", "application/xml", >+ "application/blah+json", "text/blah+json", >+ "application/blah+xml", "text/blah+xml", >+ "TEXT/HTML", "TEXT/JSON", "TEXT/BLAH+JSON", "APPLICATION/BLAH+XML", >+ "text/json;does=it;matter", "text/HTML;NO=it;does=NOT"] >+ >+ const get_url = (mime) => { >+ // www1 is cross-origin, so the HTTP response is CORB-eligible --> >+ url = "http://{{domains[www1]}}:{{ports[http][0]}}" >+ url = url + "/fetch/nosniff/resources/image.py" >+ if (mime != null) { >+ url += "?type=" + encodeURIComponent(mime) >+ } >+ return url >+ } >+ >+ passes.forEach(function(mime) { >+ async_test(function(t) { >+ var img = document.createElement("img") >+ img.onerror = t.unreached_func("Unexpected error event") >+ img.onload = t.step_func_done(function(){ >+ assert_equals(img.width, 96) >+ }) >+ img.src = get_url(mime) >+ document.body.appendChild(img) >+ }, "CORB should allow the response if Content-Type is: '" + mime + "'. ") >+ }) >+ >+ fails.forEach(function(mime) { >+ async_test(function(t) { >+ var img = document.createElement("img") >+ img.onerror = t.step_func_done() >+ img.onload = t.unreached_func("Unexpected load event") >+ img.src = get_url(mime) >+ document.body.appendChild(img) >+ }, "CORB should block the response if Content-Type is: '" + mime + "'. ") >+ }) >+</script> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/img-png-mislabeled-as-html-nosniff.tentative.sub-expected.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/img-png-mislabeled-as-html-nosniff.tentative.sub-expected.html >new file mode 100644 >index 0000000000000000000000000000000000000000..a771ed6a653eaabec5b65a4c2867e7f1aeb1f491 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/img-png-mislabeled-as-html-nosniff.tentative.sub-expected.html >@@ -0,0 +1,4 @@ >+<!DOCTYPE html> >+<meta charset="utf-8"> >+<!-- Same-origin, so the HTTP response is not CORB-eligible --> >+<img src="resources/empty-labeled-as-png.png"> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/img-png-mislabeled-as-html-nosniff.tentative.sub.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/img-png-mislabeled-as-html-nosniff.tentative.sub.html >new file mode 100644 >index 0000000000000000000000000000000000000000..82adc47b0cf31c779637d2a55f9c3b9b532aceca >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/img-png-mislabeled-as-html-nosniff.tentative.sub.html >@@ -0,0 +1,11 @@ >+<!DOCTYPE html> >+<!-- Test verifies that CORB blocks an image mislabeled as text/html if >+ sniffing is disabled via `X-Content-Type-Options: nosniff` response header. >+ This has an observable effect (the image stops rendering), compared to the >+ behavior with no CORB. >+--> >+<meta charset="utf-8"> >+<!-- Reference page uses same-origin resources, which are not CORB-eligible. --> >+<link rel="match" href="img-png-mislabeled-as-html-nosniff.tentative.sub-ref.html"> >+<!-- www1 is cross-origin, so the HTTP response is CORB-eligible --> >+<img src="http://{{domains[www1]}}:{{ports[http][0]}}/fetch/corb/resources/png-mislabeled-as-html-nosniff.png"> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/img-png-mislabeled-as-html.sub-expected.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/img-png-mislabeled-as-html.sub-expected.html >new file mode 100644 >index 0000000000000000000000000000000000000000..ebb337dba8056034689b0effb5fdfc8d7f7661bf >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/img-png-mislabeled-as-html.sub-expected.html >@@ -0,0 +1,4 @@ >+<!DOCTYPE html> >+<meta charset="utf-8"> >+<!-- Same-origin, so the HTTP response is not CORB-eligible --> >+<img src="resources/png-correctly-labeled.png"> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/img-png-mislabeled-as-html.sub.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/img-png-mislabeled-as-html.sub.html >new file mode 100644 >index 0000000000000000000000000000000000000000..1ae4cfcaa7ca24d6c121bfc7804bad642ec6fc13 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/img-png-mislabeled-as-html.sub.html >@@ -0,0 +1,10 @@ >+<!DOCTYPE html> >+<!-- Test verifies that CORB won't block an image after sniffing determines >+ that the text/html Content-Type response header doesn't match the response >+ body. >+--> >+<meta charset="utf-8"> >+<!-- Reference page uses same-origin resources, which are not CORB-eligible. --> >+<link rel="match" href="img-png-mislabeled-as-html.sub-ref.html"> >+<!-- www1 is cross-origin, so the HTTP response is CORB-eligible --> >+<img src="http://{{domains[www1]}}:{{ports[http][0]}}/fetch/corb/resources/png-mislabeled-as-html.png"> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/preload-image-png-mislabeled-as-html-nosniff.tentative.sub-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/preload-image-png-mislabeled-as-html-nosniff.tentative.sub-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..c2b3b2eb8bcb402839c5c395b869f73918bc1041 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/preload-image-png-mislabeled-as-html-nosniff.tentative.sub-expected.txt >@@ -0,0 +1,7 @@ >+Blocked access to external URL http://www1.localhost:8800/fetch/corb/resources/png-mislabeled-as-html-nosniff.png >+Blocked access to external URL http://www1.localhost:8800/fetch/corb/resources/png-mislabeled-as-html-nosniff.png >+ >+Harness Error (TIMEOUT), message = null >+ >+TIMEOUT Untitled Test timed out >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/preload-image-png-mislabeled-as-html-nosniff.tentative.sub.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/preload-image-png-mislabeled-as-html-nosniff.tentative.sub.html >new file mode 100644 >index 0000000000000000000000000000000000000000..cea80f2f89fac47e0ec8b3ac53f8b15d0ccfb76d >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/preload-image-png-mislabeled-as-html-nosniff.tentative.sub.html >@@ -0,0 +1,24 @@ >+<!DOCTYPE html> >+<!-- This test verifies observable CORB impact on <link rel="preload"> elements. >+--> >+<meta charset="utf-8"> >+<script src="/resources/testharness.js"></script> >+<script src="/resources/testharnessreport.js"></script> >+<div id=log></div> >+ >+<script> >+async_test(function(t) { >+ // With CORB the link.onerror event will be reached >+ // (because CORB will block the cross-origin preload). >+ window.preloadErrorEvent = t.step_func_done(); >+ >+ // Without CORB the link.onload event will be reached. >+ window.preloadLoadEvent = t.unreached_func("link/preload onload event reached."); >+}); >+</script> >+ >+<!-- www1 is cross-origin, so the HTTP response is CORB-eligible --> >+<link rel="preload" as="image" >+ onerror="window.preloadErrorEvent()" >+ onload="window.preloadLoadEvent()" >+ href="http://{{domains[www1]}}:{{ports[http][0]}}/fetch/corb/resources/png-mislabeled-as-html-nosniff.png"> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/resources/css-mislabeled-as-html-nosniff.css b/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/resources/css-mislabeled-as-html-nosniff.css >new file mode 100644 >index 0000000000000000000000000000000000000000..afd2b92975dc8aeab6fca469fa694cbf63ae4ce3 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/resources/css-mislabeled-as-html-nosniff.css >@@ -0,0 +1 @@ >+#header { color: red; } >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/resources/css-mislabeled-as-html-nosniff.css.headers b/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/resources/css-mislabeled-as-html-nosniff.css.headers >new file mode 100644 >index 0000000000000000000000000000000000000000..0f228f94ecb1bc4e8419a90a3be7ff4dfcc200b8 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/resources/css-mislabeled-as-html-nosniff.css.headers >@@ -0,0 +1,2 @@ >+Content-Type: text/html >+X-Content-Type-Options: nosniff >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/resources/css-mislabeled-as-html.css b/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/resources/css-mislabeled-as-html.css >new file mode 100644 >index 0000000000000000000000000000000000000000..afd2b92975dc8aeab6fca469fa694cbf63ae4ce3 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/resources/css-mislabeled-as-html.css >@@ -0,0 +1 @@ >+#header { color: red; } >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/resources/css-mislabeled-as-html.css.headers b/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/resources/css-mislabeled-as-html.css.headers >new file mode 100644 >index 0000000000000000000000000000000000000000..156209f9c81ff73b6aaf1a0734ef770ddf0a8e3e >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/resources/css-mislabeled-as-html.css.headers >@@ -0,0 +1 @@ >+Content-Type: text/html >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/resources/css-with-json-parser-breaker.css b/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/resources/css-with-json-parser-breaker.css >new file mode 100644 >index 0000000000000000000000000000000000000000..7db6f5c6d360425ed1e4a9dcd533a93c4b289c26 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/resources/css-with-json-parser-breaker.css >@@ -0,0 +1,3 @@ >+)]}' >+{} >+#header { color: red; } >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/resources/empty-labeled-as-png.png b/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/resources/empty-labeled-as-png.png >new file mode 100644 >index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/resources/empty-labeled-as-png.png.headers b/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/resources/empty-labeled-as-png.png.headers >new file mode 100644 >index 0000000000000000000000000000000000000000..e7be84a714bee61789eeb82ab67ce2114ee6e7b7 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/resources/empty-labeled-as-png.png.headers >@@ -0,0 +1 @@ >+Content-Type: image/png >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/resources/html-correctly-labeled.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/resources/html-correctly-labeled.html >new file mode 100644 >index 0000000000000000000000000000000000000000..7bad71bfbd850e7b1301d5ddc68390991b97ec37 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/resources/html-correctly-labeled.html >@@ -0,0 +1,10 @@ >+<!DOCTYPE html> >+<html> >+ <head> >+ <meta charset="utf-8"> >+ <title>Page Title</title> >+ </head> >+ <body> >+ <p>Page body</p> >+ </body> >+</html> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/resources/html-correctly-labeled.html.headers b/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/resources/html-correctly-labeled.html.headers >new file mode 100644 >index 0000000000000000000000000000000000000000..156209f9c81ff73b6aaf1a0734ef770ddf0a8e3e >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/resources/html-correctly-labeled.html.headers >@@ -0,0 +1 @@ >+Content-Type: text/html >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/resources/html-js-polyglot.js b/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/resources/html-js-polyglot.js >new file mode 100644 >index 0000000000000000000000000000000000000000..5b048d336443c809831bdc08d1d8b0a6e2aecddb >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/resources/html-js-polyglot.js >@@ -0,0 +1,9 @@ >+<!--/*--><html><body><script type="text/javascript"><!--//*/ >+ >+// This is a regression test for https://crbug.com/839425 >+// which found out that some script resources are served >+// with text/html content-type and with a body that is >+// both a valid html and a valid javascript. >+window.polyglot = "html-js-polyglot.js"; >+ >+//--></script></body></html> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/resources/html-js-polyglot.js.headers b/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/resources/html-js-polyglot.js.headers >new file mode 100644 >index 0000000000000000000000000000000000000000..156209f9c81ff73b6aaf1a0734ef770ddf0a8e3e >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/resources/html-js-polyglot.js.headers >@@ -0,0 +1 @@ >+Content-Type: text/html >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/resources/html-js-polyglot2.js b/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/resources/html-js-polyglot2.js >new file mode 100644 >index 0000000000000000000000000000000000000000..9443f8ed6c35efe7928249735b2faa0ef9bdf0a6 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/resources/html-js-polyglot2.js >@@ -0,0 +1,10 @@ >+<!-- comment --> <script type='text/javascript'> >+//<![CDATA[ >+ >+// This is a regression test for https://crbug.com/839945 >+// which found out that some script resources are served >+// with text/html content-type and with a body that is >+// both a valid html and a valid javascript. >+window.polyglot = "html-js-polyglot2.js"; >+ >+//]]>--></script> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/resources/html-js-polyglot2.js.headers b/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/resources/html-js-polyglot2.js.headers >new file mode 100644 >index 0000000000000000000000000000000000000000..156209f9c81ff73b6aaf1a0734ef770ddf0a8e3e >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/resources/html-js-polyglot2.js.headers >@@ -0,0 +1 @@ >+Content-Type: text/html >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/resources/js-mislabeled-as-html-nosniff.js b/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/resources/js-mislabeled-as-html-nosniff.js >new file mode 100644 >index 0000000000000000000000000000000000000000..a880a5bc724a8571459eef0fe9dc23b86ff3a01e >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/resources/js-mislabeled-as-html-nosniff.js >@@ -0,0 +1 @@ >+window.has_executed_script = true; >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/resources/js-mislabeled-as-html-nosniff.js.headers b/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/resources/js-mislabeled-as-html-nosniff.js.headers >new file mode 100644 >index 0000000000000000000000000000000000000000..0f228f94ecb1bc4e8419a90a3be7ff4dfcc200b8 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/resources/js-mislabeled-as-html-nosniff.js.headers >@@ -0,0 +1,2 @@ >+Content-Type: text/html >+X-Content-Type-Options: nosniff >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/resources/js-mislabeled-as-html.js b/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/resources/js-mislabeled-as-html.js >new file mode 100644 >index 0000000000000000000000000000000000000000..a880a5bc724a8571459eef0fe9dc23b86ff3a01e >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/resources/js-mislabeled-as-html.js >@@ -0,0 +1 @@ >+window.has_executed_script = true; >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/resources/js-mislabeled-as-html.js.headers b/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/resources/js-mislabeled-as-html.js.headers >new file mode 100644 >index 0000000000000000000000000000000000000000..156209f9c81ff73b6aaf1a0734ef770ddf0a8e3e >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/resources/js-mislabeled-as-html.js.headers >@@ -0,0 +1 @@ >+Content-Type: text/html >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/resources/png-correctly-labeled.png b/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/resources/png-correctly-labeled.png >new file mode 100644 >index 0000000000000000000000000000000000000000..820f8cace2143bfc45c0c301e84b6c29b8630068 >GIT binary patch >literal 1010 >zcmeAS@N?(olHy`uVBq!ia0vp^2_VeD3?#3*wSy!Wi-X*q7}lMWc?smOq&xaLGB9lH >z=l+w(3gjy!dj$D1FjT2AFf_C<F#G}vHN0S8C^cYUc$L7wU^Rn*LA+qju0R_G24;o; >zpAc6DhW|h{qhK@yMrH^cH_nOz`dp&KHKHUqKdq!Zu_%=xATcwqM9<GPM4`-B&)96` >z^GB*cH4dIGjv*P&Z!a{0g6i;spTY4DI9dY|4>T|`v++n6B;aK<+8d}OFfd9ReoF^w >N_jL7hS?83{1OVd{KuZ7s > >literal 0 >HcmV?d00001 > >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/resources/png-correctly-labeled.png.headers b/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/resources/png-correctly-labeled.png.headers >new file mode 100644 >index 0000000000000000000000000000000000000000..e7be84a714bee61789eeb82ab67ce2114ee6e7b7 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/resources/png-correctly-labeled.png.headers >@@ -0,0 +1 @@ >+Content-Type: image/png >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/resources/png-mislabeled-as-html-nosniff.png b/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/resources/png-mislabeled-as-html-nosniff.png >new file mode 100644 >index 0000000000000000000000000000000000000000..820f8cace2143bfc45c0c301e84b6c29b8630068 >GIT binary patch >literal 1010 >zcmeAS@N?(olHy`uVBq!ia0vp^2_VeD3?#3*wSy!Wi-X*q7}lMWc?smOq&xaLGB9lH >z=l+w(3gjy!dj$D1FjT2AFf_C<F#G}vHN0S8C^cYUc$L7wU^Rn*LA+qju0R_G24;o; >zpAc6DhW|h{qhK@yMrH^cH_nOz`dp&KHKHUqKdq!Zu_%=xATcwqM9<GPM4`-B&)96` >z^GB*cH4dIGjv*P&Z!a{0g6i;spTY4DI9dY|4>T|`v++n6B;aK<+8d}OFfd9ReoF^w >N_jL7hS?83{1OVd{KuZ7s > >literal 0 >HcmV?d00001 > >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/resources/png-mislabeled-as-html-nosniff.png.headers b/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/resources/png-mislabeled-as-html-nosniff.png.headers >new file mode 100644 >index 0000000000000000000000000000000000000000..0f228f94ecb1bc4e8419a90a3be7ff4dfcc200b8 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/resources/png-mislabeled-as-html-nosniff.png.headers >@@ -0,0 +1,2 @@ >+Content-Type: text/html >+X-Content-Type-Options: nosniff >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/resources/png-mislabeled-as-html.png b/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/resources/png-mislabeled-as-html.png >new file mode 100644 >index 0000000000000000000000000000000000000000..820f8cace2143bfc45c0c301e84b6c29b8630068 >GIT binary patch >literal 1010 >zcmeAS@N?(olHy`uVBq!ia0vp^2_VeD3?#3*wSy!Wi-X*q7}lMWc?smOq&xaLGB9lH >z=l+w(3gjy!dj$D1FjT2AFf_C<F#G}vHN0S8C^cYUc$L7wU^Rn*LA+qju0R_G24;o; >zpAc6DhW|h{qhK@yMrH^cH_nOz`dp&KHKHUqKdq!Zu_%=xATcwqM9<GPM4`-B&)96` >z^GB*cH4dIGjv*P&Z!a{0g6i;spTY4DI9dY|4>T|`v++n6B;aK<+8d}OFfd9ReoF^w >N_jL7hS?83{1OVd{KuZ7s > >literal 0 >HcmV?d00001 > >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/resources/png-mislabeled-as-html.png.headers b/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/resources/png-mislabeled-as-html.png.headers >new file mode 100644 >index 0000000000000000000000000000000000000000..156209f9c81ff73b6aaf1a0734ef770ddf0a8e3e >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/resources/png-mislabeled-as-html.png.headers >@@ -0,0 +1 @@ >+Content-Type: text/html >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/resources/sniffable-resource.py b/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/resources/sniffable-resource.py >new file mode 100644 >index 0000000000000000000000000000000000000000..7a649c224047a1a510f64a12a146c1e8bb5a0afa >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/resources/sniffable-resource.py >@@ -0,0 +1,11 @@ >+def main(request, response): >+ body = request.GET.first("body", None) >+ type = request.GET.first("type", None) >+ >+ response.add_required_headers = False >+ response.writer.write_status(200) >+ response.writer.write_header("content-length", len(body)) >+ response.writer.write_header("content-type", type) >+ response.writer.end_headers() >+ >+ response.writer.write(body) >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/resources/subframe-that-posts-html-containing-blob-url-to-parent.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/resources/subframe-that-posts-html-containing-blob-url-to-parent.html >new file mode 100644 >index 0000000000000000000000000000000000000000..67b3ad5a600bdaf201953cc18b9687e9314673a9 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/resources/subframe-that-posts-html-containing-blob-url-to-parent.html >@@ -0,0 +1,16 @@ >+<!DOCTYPE html> >+<meta charset="utf-8"> >+<script> >+fetch('html-correctly-labeled.html') >+ .then(response => response.blob()) >+ .then(blob => { >+ let msg = { blob_size: blob.size, >+ blob_type: blob.type, >+ blob_url: URL.createObjectURL(blob) }; >+ window.parent.postMessage(msg, '*'); >+ }) >+ .catch(error => { >+ let msg = { error: error }; >+ window.parent.postMessage(msg, '*'); >+ }); >+</script> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/resources/w3c-import.log b/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/resources/w3c-import.log >new file mode 100644 >index 0000000000000000000000000000000000000000..f574fbc3cdc31bda2ae9449587453541ad5e9e11 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/resources/w3c-import.log >@@ -0,0 +1,41 @@ >+The tests in this directory were imported from the W3C repository. >+Do NOT modify these tests directly in WebKit. >+Instead, create a pull request on the WPT github: >+ https://github.com/web-platform-tests/wpt >+ >+Then run the Tools/Scripts/import-w3c-tests in WebKit to reimport >+ >+Do NOT modify or remove this file. >+ >+------------------------------------------------------------------------ >+Properties requiring vendor prefixes: >+None >+Property values requiring vendor prefixes: >+None >+------------------------------------------------------------------------ >+List of files: >+/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/resources/css-mislabeled-as-html-nosniff.css >+/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/resources/css-mislabeled-as-html-nosniff.css.headers >+/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/resources/css-mislabeled-as-html.css >+/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/resources/css-mislabeled-as-html.css.headers >+/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/resources/css-with-json-parser-breaker.css >+/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/resources/empty-labeled-as-png.png >+/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/resources/empty-labeled-as-png.png.headers >+/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/resources/html-correctly-labeled.html >+/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/resources/html-correctly-labeled.html.headers >+/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/resources/html-js-polyglot.js >+/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/resources/html-js-polyglot.js.headers >+/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/resources/html-js-polyglot2.js >+/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/resources/html-js-polyglot2.js.headers >+/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/resources/js-mislabeled-as-html-nosniff.js >+/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/resources/js-mislabeled-as-html-nosniff.js.headers >+/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/resources/js-mislabeled-as-html.js >+/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/resources/js-mislabeled-as-html.js.headers >+/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/resources/png-correctly-labeled.png >+/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/resources/png-correctly-labeled.png.headers >+/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/resources/png-mislabeled-as-html-nosniff.png >+/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/resources/png-mislabeled-as-html-nosniff.png.headers >+/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/resources/png-mislabeled-as-html.png >+/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/resources/png-mislabeled-as-html.png.headers >+/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/resources/sniffable-resource.py >+/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/resources/subframe-that-posts-html-containing-blob-url-to-parent.html >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/script-html-correctly-labeled.tentative.sub-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/script-html-correctly-labeled.tentative.sub-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..16918ca0f25b364f7920b1f34237462f4f27f5e8 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/script-html-correctly-labeled.tentative.sub-expected.txt >@@ -0,0 +1,6 @@ >+Blocked access to external URL http://www1.localhost:8800/fetch/corb/resources/html-correctly-labeled.html >+ >+Harness Error (TIMEOUT), message = null >+ >+TIMEOUT CORB-blocked script has no syntax errors Test timed out >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/script-html-correctly-labeled.tentative.sub.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/script-html-correctly-labeled.tentative.sub.html >new file mode 100644 >index 0000000000000000000000000000000000000000..8f4d7679e3d749b3cd402997f607b7358fe98c28 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/script-html-correctly-labeled.tentative.sub.html >@@ -0,0 +1,30 @@ >+<!DOCTYPE html> >+<!-- Test verifies that html fed to a <script> tag won't report a syntax >+ error after CORB blocks the response (an empty response body injected >+ by CORB won't have any JavaScript syntax errors). >+--> >+<meta charset="utf-8"> >+<script src="/resources/testharness.js"></script> >+<script src="/resources/testharnessreport.js"></script> >+<div id=log></div> >+<script> >+setup({allow_uncaught_exception : true}); >+async_test(function(t) { >+ var script = document.createElement("script") >+ >+ // Without CORB, the html document would cause a syntax error when parsed as >+ // JavaScript, but with CORB there should be no errors (because CORB will >+ // replace the response body with an empty body). >+ script.onload = t.step_func_done(function(){}) >+ addEventListener("error",function(e) { >+ t.step(function() { >+ assert_unreached("Empty body of a CORS-blocked response shouldn't trigger syntax errors."); >+ t.done(); >+ }) >+ }); >+ >+ // www1 is cross-origin, so the HTTP response is CORB-eligible. >+ script.src = 'http://{{domains[www1]}}:{{ports[http][0]}}/fetch/corb/resources/html-correctly-labeled.html'; >+ document.body.appendChild(script) >+}, "CORB-blocked script has no syntax errors"); >+</script> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/script-html-js-polyglot.sub-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/script-html-js-polyglot.sub-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..3f20df80ae66523679dbbd19ae95990de87a4dcf >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/script-html-js-polyglot.sub-expected.txt >@@ -0,0 +1,8 @@ >+Blocked access to external URL http://www1.localhost:8800/fetch/corb/resources/html-js-polyglot.js >+Blocked access to external URL http://www1.localhost:8800/fetch/corb/resources/html-js-polyglot2.js >+ >+Harness Error (TIMEOUT), message = null >+ >+TIMEOUT CORB cannot block polyglot HTML/JS: html-js-polyglot.js Test timed out >+TIMEOUT CORB cannot block polyglot HTML/JS: html-js-polyglot2.js Test timed out >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/script-html-js-polyglot.sub.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/script-html-js-polyglot.sub.html >new file mode 100644 >index 0000000000000000000000000000000000000000..ec4103771fb243864bbd8855b5c949922f1f3939 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/script-html-js-polyglot.sub.html >@@ -0,0 +1,32 @@ >+<!DOCTYPE html> >+<!-- Test verifies that CORB won't block a polyglot script that is >+ both a valid HTML document and also valid Javascript. >+--> >+<meta charset="utf-8"> >+<script src=/resources/testharness.js></script> >+<script src=/resources/testharnessreport.js></script> >+<div id=log></div> >+<script> >+["html-js-polyglot.js", "html-js-polyglot2.js"].forEach(polyglot_name => { >+ async_test(function(t) { >+ window.polyglot = "not yet set by the script"; >+ var script = document.createElement("script"); >+ >+ script.onload = t.step_func_done(function(){ >+ // Verify that the script response wasn't blocked - that script >+ // should have set window.polyglot to |polyglot_name|. >+ assert_equals(window.polyglot, polyglot_name); >+ }) >+ addEventListener("error",function(e) { >+ t.step(function() { >+ assert_unreached("No errors are expected with or without CORB."); >+ t.done(); >+ }) >+ }); >+ >+ // www1 is cross-origin, so the HTTP response is CORB-eligible. >+ script.src = "http://{{domains[www1]}}:{{ports[http][0]}}/fetch/corb/resources/" + polyglot_name; >+ document.body.appendChild(script); >+ }, "CORB cannot block polyglot HTML/JS: " + polyglot_name); >+}); >+</script> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/script-html-via-cross-origin-blob-url.sub-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/script-html-via-cross-origin-blob-url.sub-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..9ba815f95ab9e517b159df7e137958dc476eedeb >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/script-html-via-cross-origin-blob-url.sub-expected.txt >@@ -0,0 +1,6 @@ >+Blocked access to external URL http://www1.localhost:8800/fetch/corb/resources/subframe-that-posts-html-containing-blob-url-to-parent.html >+ >+Harness Error (TIMEOUT), message = null >+ >+TIMEOUT Untitled Test timed out >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/script-html-via-cross-origin-blob-url.sub.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/script-html-via-cross-origin-blob-url.sub.html >new file mode 100644 >index 0000000000000000000000000000000000000000..c8a90c79b3f7f5136dbad30dd3299fc57365b272 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/script-html-via-cross-origin-blob-url.sub.html >@@ -0,0 +1,38 @@ >+<!DOCTYPE html> >+<!-- Test verifies that cross-origin blob URIs are blocked both with and >+ without CORB. >+--> >+<meta charset="utf-8"> >+<script src="/resources/testharness.js"></script> >+<script src="/resources/testharnessreport.js"></script> >+<div id=log></div> >+<script> >+async_test(function(t) { >+ function step1_createSubframe() { >+ addEventListener("message", function(e) { >+ t.step(function() { step2_processSubframeMsg(e.data); }) >+ }); >+ var subframe = document.createElement("iframe") >+ // www1 is cross-origin, to ensure that the received blob will be cross-origin. >+ subframe.src = 'http://{{domains[www1]}}:{{ports[http][0]}}/fetch/corb/resources/subframe-that-posts-html-containing-blob-url-to-parent.html'; >+ document.body.appendChild(subframe); >+ } >+ >+ function step2_processSubframeMsg(msg) { >+ assert_false(msg.hasOwnProperty('error'), 'unexpected property found: "error"'); >+ assert_equals(msg.blob_type, 'text/html'); >+ assert_equals(msg.blob_size, 147); >+ >+ // With and without CORB loading of a cross-origin blob should be blocked >+ // (this is verified by expecting |script.onerror|, but not |script.onload| >+ // below). >+ var script = document.createElement("script") >+ script.src = msg.blob_url; >+ script.onerror = t.step_func_done(function(){}) >+ script.onload = t.unreached_func("Unexpected load event") >+ document.body.appendChild(script) >+ } >+ >+ step1_createSubframe(); >+}); >+</script> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/script-js-mislabeled-as-html-nosniff.sub-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/script-js-mislabeled-as-html-nosniff.sub-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..67c6dc19040b33390bde18412c0b778141a785bc >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/script-js-mislabeled-as-html-nosniff.sub-expected.txt >@@ -0,0 +1,5 @@ >+Blocked access to external URL http://www1.localhost:8800/fetch/corb/resources/js-mislabeled-as-html-nosniff.js >+Blocked access to external URL http://www1.localhost:8800/fetch/corb/resources/js-mislabeled-as-html-nosniff.js >+ >+PASS Untitled >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/script-js-mislabeled-as-html-nosniff.sub.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/script-js-mislabeled-as-html-nosniff.sub.html >new file mode 100644 >index 0000000000000000000000000000000000000000..f155deff090e4352580847a2aaa41e462d97958a >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/script-js-mislabeled-as-html-nosniff.sub.html >@@ -0,0 +1,32 @@ >+<!DOCTYPE html> >+<!-- Test verifies that script mislabeled as html won't execute with and without CORB >+ if the nosniff response header is present. >+ >+ The expected behavior is covered by the Fetch spec at >+ https://fetch.spec.whatwg.org/#should-response-to-request-be-blocked-due-to-nosniff? >+ >+ See also the following tests: >+ - fetch/nosniff/importscripts.html >+ - fetch/nosniff/script.html >+ - fetch/nosniff/worker.html >+--> >+<meta charset="utf-8"> >+<script src="/resources/testharness.js"></script> >+<script src="/resources/testharnessreport.js"></script> >+<div id=log></div> >+ >+<script> >+window.has_executed_script = false; >+</script> >+ >+<!-- www1 is cross-origin, so the HTTP response is CORB-eligible --> >+<script src="http://{{domains[www1]}}:{{ports[http][0]}}/fetch/corb/resources/js-mislabeled-as-html-nosniff.js"> >+</script> >+ >+<script> >+// Verify what observable effects the <script> tag above had. >+// Assertion should hold with and without CORB: >+assert_false(window.has_executed_script, >+ 'The cross-origin script should not be executed'); >+done(); >+</script> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/script-js-mislabeled-as-html.sub-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/script-js-mislabeled-as-html.sub-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..65968f9b1d3294fad4c172aa666586faf282d5d0 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/script-js-mislabeled-as-html.sub-expected.txt >@@ -0,0 +1,6 @@ >+Blocked access to external URL http://www1.localhost:8800/fetch/corb/resources/js-mislabeled-as-html.js >+Blocked access to external URL http://www1.localhost:8800/fetch/corb/resources/js-mislabeled-as-html.js >+CONSOLE MESSAGE: line 2659: Error: assert_true: The cross-origin script should execute expected true got false >+ >+FAIL Untitled Error: assert_true: The cross-origin script should execute expected true got false >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/script-js-mislabeled-as-html.sub.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/script-js-mislabeled-as-html.sub.html >new file mode 100644 >index 0000000000000000000000000000000000000000..3a923e66356db1725b1de1b7e211df001cb6f2a5 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/script-js-mislabeled-as-html.sub.html >@@ -0,0 +1,24 @@ >+<!DOCTYPE html> >+<!-- Test verifies that script mislabeled as html will execute with and without >+ CORB (CORB should allow the script after sniffing). >+--> >+<meta charset="utf-8"> >+<script src="/resources/testharness.js"></script> >+<script src="/resources/testharnessreport.js"></script> >+<div id=log></div> >+ >+<script> >+window.has_executed_script = false; >+</script> >+ >+<!-- www1 is cross-origin, so the HTTP response is CORB-eligible --> >+<script src="http://{{domains[www1]}}:{{ports[http][0]}}/fetch/corb/resources/js-mislabeled-as-html.js"> >+</script> >+ >+<script> >+// Verify what observable effects the <script> tag above had. >+// Assertion should hold with and without CORB: >+assert_true(window.has_executed_script, >+ 'The cross-origin script should execute'); >+done(); >+</script> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/script-resource-with-json-parser-breaker.tentative.sub-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/script-resource-with-json-parser-breaker.tentative.sub-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..0dd507485bdff2fdf55f1933b2c70a22bb7758fe >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/script-resource-with-json-parser-breaker.tentative.sub-expected.txt >@@ -0,0 +1,58 @@ >+Blocked access to external URL http://www1.localhost:8800/fetch/corb/resources/sniffable-resource.py?type=text/html&body=)%5D%7D%27 >+Blocked access to external URL http://www1.localhost:8800/fetch/corb/resources/sniffable-resource.py?type=text/html&body=%7B%7D%26%26 >+Blocked access to external URL http://www1.localhost:8800/fetch/corb/resources/sniffable-resource.py?type=text/html&body=%7B%7D%20%26%26 >+Blocked access to external URL http://www1.localhost:8800/fetch/corb/resources/sniffable-resource.py?type=text/xml&body=)%5D%7D%27 >+Blocked access to external URL http://www1.localhost:8800/fetch/corb/resources/sniffable-resource.py?type=text/xml&body=%7B%7D%26%26 >+Blocked access to external URL http://www1.localhost:8800/fetch/corb/resources/sniffable-resource.py?type=text/xml&body=%7B%7D%20%26%26 >+Blocked access to external URL http://www1.localhost:8800/fetch/corb/resources/sniffable-resource.py?type=text/json&body=)%5D%7D%27 >+Blocked access to external URL http://www1.localhost:8800/fetch/corb/resources/sniffable-resource.py?type=text/json&body=%7B%7D%26%26 >+Blocked access to external URL http://www1.localhost:8800/fetch/corb/resources/sniffable-resource.py?type=text/json&body=%7B%7D%20%26%26 >+Blocked access to external URL http://www1.localhost:8800/fetch/corb/resources/sniffable-resource.py?type=text/plain&body=)%5D%7D%27 >+Blocked access to external URL http://www1.localhost:8800/fetch/corb/resources/sniffable-resource.py?type=text/plain&body=%7B%7D%26%26 >+Blocked access to external URL http://www1.localhost:8800/fetch/corb/resources/sniffable-resource.py?type=text/plain&body=%7B%7D%20%26%26 >+Blocked access to external URL http://www1.localhost:8800/fetch/corb/resources/sniffable-resource.py?type=application/javascript&body=)%5D%7D%27 >+Blocked access to external URL http://www1.localhost:8800/fetch/corb/resources/sniffable-resource.py?type=application/javascript&body=%7B%7D%26%26 >+Blocked access to external URL http://www1.localhost:8800/fetch/corb/resources/sniffable-resource.py?type=application/javascript&body=%7B%7D%20%26%26 >+Blocked access to external URL http://www1.localhost:8800/fetch/corb/resources/sniffable-resource.py?type=image/png&body=)%5D%7D%27 >+Blocked access to external URL http://www1.localhost:8800/fetch/corb/resources/sniffable-resource.py?type=image/png&body=%7B%7D%26%26 >+Blocked access to external URL http://www1.localhost:8800/fetch/corb/resources/sniffable-resource.py?type=image/png&body=%7B%7D%20%26%26 >+Blocked access to external URL http://www1.localhost:8800/fetch/corb/resources/sniffable-resource.py?type=image/svg+xml&body=)%5D%7D%27 >+Blocked access to external URL http://www1.localhost:8800/fetch/corb/resources/sniffable-resource.py?type=image/svg+xml&body=%7B%7D%26%26 >+Blocked access to external URL http://www1.localhost:8800/fetch/corb/resources/sniffable-resource.py?type=image/svg+xml&body=%7B%7D%20%26%26 >+Blocked access to external URL http://www1.localhost:8800/fetch/corb/resources/sniffable-resource.py?type=application/pdf&body=)%5D%7D%27 >+Blocked access to external URL http://www1.localhost:8800/fetch/corb/resources/sniffable-resource.py?type=application/pdf&body=%7B%7D%26%26 >+Blocked access to external URL http://www1.localhost:8800/fetch/corb/resources/sniffable-resource.py?type=application/pdf&body=%7B%7D%20%26%26 >+Blocked access to external URL http://www1.localhost:8800/fetch/corb/resources/sniffable-resource.py?type=application/zip&body=)%5D%7D%27 >+Blocked access to external URL http://www1.localhost:8800/fetch/corb/resources/sniffable-resource.py?type=application/zip&body=%7B%7D%26%26 >+Blocked access to external URL http://www1.localhost:8800/fetch/corb/resources/sniffable-resource.py?type=application/zip&body=%7B%7D%20%26%26 >+ >+Harness Error (TIMEOUT), message = null >+ >+TIMEOUT CORB-blocks 'text/html' that starts with the following JSON parser breaker: )]}' Test timed out >+TIMEOUT CORB-blocks 'text/html' that starts with the following JSON parser breaker: {}&& Test timed out >+TIMEOUT CORB-blocks 'text/html' that starts with the following JSON parser breaker: {} && Test timed out >+TIMEOUT CORB-blocks 'text/xml' that starts with the following JSON parser breaker: )]}' Test timed out >+TIMEOUT CORB-blocks 'text/xml' that starts with the following JSON parser breaker: {}&& Test timed out >+TIMEOUT CORB-blocks 'text/xml' that starts with the following JSON parser breaker: {} && Test timed out >+TIMEOUT CORB-blocks 'text/json' that starts with the following JSON parser breaker: )]}' Test timed out >+TIMEOUT CORB-blocks 'text/json' that starts with the following JSON parser breaker: {}&& Test timed out >+TIMEOUT CORB-blocks 'text/json' that starts with the following JSON parser breaker: {} && Test timed out >+TIMEOUT CORB-blocks 'text/plain' that starts with the following JSON parser breaker: )]}' Test timed out >+TIMEOUT CORB-blocks 'text/plain' that starts with the following JSON parser breaker: {}&& Test timed out >+TIMEOUT CORB-blocks 'text/plain' that starts with the following JSON parser breaker: {} && Test timed out >+TIMEOUT CORB-blocks 'application/javascript' that starts with the following JSON parser breaker: )]}' Test timed out >+TIMEOUT CORB-blocks 'application/javascript' that starts with the following JSON parser breaker: {}&& Test timed out >+TIMEOUT CORB-blocks 'application/javascript' that starts with the following JSON parser breaker: {} && Test timed out >+TIMEOUT CORB-blocks 'image/png' that starts with the following JSON parser breaker: )]}' Test timed out >+TIMEOUT CORB-blocks 'image/png' that starts with the following JSON parser breaker: {}&& Test timed out >+TIMEOUT CORB-blocks 'image/png' that starts with the following JSON parser breaker: {} && Test timed out >+TIMEOUT CORB-blocks 'image/svg+xml' that starts with the following JSON parser breaker: )]}' Test timed out >+TIMEOUT CORB-blocks 'image/svg+xml' that starts with the following JSON parser breaker: {}&& Test timed out >+TIMEOUT CORB-blocks 'image/svg+xml' that starts with the following JSON parser breaker: {} && Test timed out >+TIMEOUT CORB-blocks 'application/pdf' that starts with the following JSON parser breaker: )]}' Test timed out >+TIMEOUT CORB-blocks 'application/pdf' that starts with the following JSON parser breaker: {}&& Test timed out >+TIMEOUT CORB-blocks 'application/pdf' that starts with the following JSON parser breaker: {} && Test timed out >+TIMEOUT CORB-blocks 'application/zip' that starts with the following JSON parser breaker: )]}' Test timed out >+TIMEOUT CORB-blocks 'application/zip' that starts with the following JSON parser breaker: {}&& Test timed out >+TIMEOUT CORB-blocks 'application/zip' that starts with the following JSON parser breaker: {} && Test timed out >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/script-resource-with-json-parser-breaker.tentative.sub.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/script-resource-with-json-parser-breaker.tentative.sub.html >new file mode 100644 >index 0000000000000000000000000000000000000000..cabc7b09c458ca1f3852c633c9cd47680ab6e89d >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/script-resource-with-json-parser-breaker.tentative.sub.html >@@ -0,0 +1,83 @@ >+<!DOCTYPE html> >+<!-- Test verifies CORB will block responses beginning with a JSON parser >+ breaker regardless of their MIME type (excluding text/css - see below). >+ >+ A JSON parser breaker is a prefix added to resources with sensitive data to >+ prevent cross-site script inclusion (XSSI) and similar attacks. For example, >+ it may be included in JSON files to prevent them from leaking data via a >+ <script> tag, making the response only useful to a fetch or XmlHttpRequest. >+ See also https://chromium.googlesource.com/chromium/src/+/master/services/network/cross_origin_read_blocking_explainer.md#Protecting-JSON >+ >+ The assumption is that all images, other media, scripts, fonts and other >+ resources that may be embedded cross-origin will never begin with a JSON >+ parser breaker. For example an JPEG image should always being with FF D8 FF, >+ a PNG image with 89 50 4E 47 0D 0A 1A 0A bytes and an SVG image with "<?xml" >+ substring. >+ >+ The assumption above excludes text/css which (as shown by >+ style-css-with-json-parser-breaker.sub.html) can parse as valid stylesheet >+ even in presence of a JSON parser breaker. >+--> >+<meta charset="utf-8"> >+<script src="/resources/testharness.js"></script> >+<script src="/resources/testharnessreport.js"></script> >+<div id=log></div> >+<script> >+setup({allow_uncaught_exception : true}); >+ >+// A subset of JSON security prefixes (only ones that are parser breakers). >+json_parser_breakers = [ >+ ")]}'", >+ "{}&&", >+ "{} &&", >+] >+ >+// JSON parser breaker should trigger CORB blocking for any Content-Type - even >+// for resources that claim to be of a MIME type that is normally allowed to be >+// embedded in cross-origin documents (like images and/or scripts). >+mime_types = [ >+ // CORB-protected MIME types >+ "text/html", >+ "text/xml", >+ "text/json", >+ "text/plain", >+ >+ // MIME types that normally are allowed by CORB. >+ "application/javascript", >+ "image/png", >+ "image/svg+xml", >+ >+ // Other types. >+ "application/pdf", >+ "application/zip", >+] >+ >+function test(mime_type, body) { >+ async_test(function(t) { >+ var script = document.createElement("script") >+ >+ // Without CORB, the JSON parser breaker would cause a syntax error when >+ // parsed as JavaScript, but with CORB there should be no errors (because >+ // CORB will replace the response body with an empty body). >+ script.onload = t.step_func_done(function(){}) >+ addEventListener("error",function(e) { >+ t.step(function() { >+ assert_unreached("Empty body of a CORS-blocked response shouldn't trigger syntax errors."); >+ t.done(); >+ }) >+ }); >+ >+ // www1 is cross-origin, so the HTTP response is CORB-eligible. >+ var src_prefix = "http://{{domains[www1]}}:{{ports[http][0]}}/fetch/corb/resources/sniffable-resource.py"; >+ script.src = src_prefix + "?type=" + mime_type + "&body=" + encodeURIComponent(body); >+ document.body.appendChild(script) >+ }, "CORB-blocks '" + mime_type + "' that starts with the following JSON parser breaker: " + body); >+} >+ >+mime_types.forEach(function(type) { >+ json_parser_breakers.forEach(function(body) { >+ test(type, body); >+ }); >+}); >+ >+</script> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/style-css-mislabeled-as-html-nosniff.sub-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/style-css-mislabeled-as-html-nosniff.sub-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..ec92626af7d435499f5ca2cd26985cea041c551c >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/style-css-mislabeled-as-html-nosniff.sub-expected.txt >@@ -0,0 +1,9 @@ >+Blocked access to external URL http://www1.localhost:8800/fetch/corb/resources/css-mislabeled-as-html-nosniff.css >+Blocked access to external URL http://www1.localhost:8800/fetch/corb/resources/css-mislabeled-as-html-nosniff.css >+Header example >+ >+Paragraph body >+ >+ >+PASS Untitled >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/style-css-mislabeled-as-html-nosniff.sub.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/style-css-mislabeled-as-html-nosniff.sub.html >new file mode 100644 >index 0000000000000000000000000000000000000000..1d53621186d26edc447fb74e02b6630c69b03271 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/style-css-mislabeled-as-html-nosniff.sub.html >@@ -0,0 +1,41 @@ >+<!DOCTYPE html> >+<!-- Test verifies that a stylesheet mislabeled as html won't execute with and >+ without CORB if the nosniff response header is present. >+ >+ The expected behavior is covered by the Fetch spec at >+ https://fetch.spec.whatwg.org/#should-response-to-request-be-blocked-due-to-nosniff? >+ >+ See also the following tests: >+ - fetch/nosniff/stylesheet.html >+--> >+<meta charset="utf-8"> >+<script src=/resources/testharness.js></script> >+<script src=/resources/testharnessreport.js></script> >+ >+<!-- Default style that will be applied if the external stylesheet resource >+ below won't load for any reason. This stylesheet will set h1's >+ color to green (see |default_color| below). --> >+<style> >+h1 { color: green; } >+</style> >+ >+<!-- This stylesheet (if loaded) should set h1#header's color to red >+ (see |external_color| below). --> >+<!-- www1 is cross-origin, so the HTTP response is CORB-eligible --> >+<link rel="stylesheet" type="text/css" >+ href="http://{{domains[www1]}}:{{ports[http][0]}}/fetch/corb/resources/css-mislabeled-as-html-nosniff.css"> >+ >+<body> >+ <h1 id="header">Header example</h1> >+ <p>Paragraph body</p> >+</body> >+ >+<script> >+// Verify that CSS is not applied (because of nosniff + non-text/css headers). >+let style = getComputedStyle(document.getElementById('header')); >+const external_color = 'rgb(255, 0, 0)'; // red >+const default_color = 'rgb(0, 128, 0)'; // green >+assert_equals(style.getPropertyValue('color'), default_color); >+assert_not_equals(style.getPropertyValue('color'), external_color); >+done(); >+</script> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/style-css-mislabeled-as-html.sub-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/style-css-mislabeled-as-html.sub-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..df51193dd53e91d7e73689cadf1b785dc68e425e >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/style-css-mislabeled-as-html.sub-expected.txt >@@ -0,0 +1,9 @@ >+Blocked access to external URL http://www1.localhost:8800/fetch/corb/resources/css-mislabeled-as-html.css >+Blocked access to external URL http://www1.localhost:8800/fetch/corb/resources/css-mislabeled-as-html.css >+Header example >+ >+Paragraph body >+ >+ >+PASS Untitled >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/style-css-mislabeled-as-html.sub.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/style-css-mislabeled-as-html.sub.html >new file mode 100644 >index 0000000000000000000000000000000000000000..05f6fdb9fb955b610b4fc1032cd74bcb48292868 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/style-css-mislabeled-as-html.sub.html >@@ -0,0 +1,36 @@ >+<!DOCTYPE html> >+<!-- Test verifies that CORB won't impact a cross-origin stylesheet mislabeled >+ as text/html (because even without CORB mislabeled CSS will be rejected). >+--> >+<meta charset="utf-8"> >+<script src=/resources/testharness.js></script> >+<script src=/resources/testharnessreport.js></script> >+ >+<!-- Default style that will be applied if the external stylesheet resource >+ below won't load for any reason. This stylesheet will set h1's >+ color to green (see |default_color| below). --> >+<style> >+h1 { color: green; } >+</style> >+ >+<!-- This stylesheet (if loaded) should set h1#header's color to red >+ (see |external_color| below). --> >+<!-- www1 is cross-origin, so the HTTP response is CORB-eligible --> >+<link rel="stylesheet" type="text/css" >+ href="http://{{domains[www1]}}:{{ports[http][0]}}/fetch/corb/resources/css-mislabeled-as-html.css"> >+ >+<body> >+ <h1 id="header">Header example</h1> >+ <p>Paragraph body</p> >+</body> >+ >+<script> >+// Verify that CSS is not applied (because of strict content-type enforcement >+// for cross-origin stylesheets). >+let style = getComputedStyle(document.getElementById('header')); >+const external_color = 'rgb(255, 0, 0)'; // red >+const default_color = 'rgb(0, 128, 0)'; // green >+assert_equals(style.getPropertyValue('color'), default_color); >+assert_not_equals(style.getPropertyValue('color'), external_color); >+done(); >+</script> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/style-css-with-json-parser-breaker.sub-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/style-css-with-json-parser-breaker.sub-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..18c200568ea4ab3c460902e810a7d27d17bcd2c9 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/style-css-with-json-parser-breaker.sub-expected.txt >@@ -0,0 +1,10 @@ >+Blocked access to external URL http://www1.localhost:8800/fetch/corb/resources/css-with-json-parser-breaker.css >+Blocked access to external URL http://www1.localhost:8800/fetch/corb/resources/css-with-json-parser-breaker.css >+CONSOLE MESSAGE: line 2659: Error: assert_equals: expected "rgb(255, 0, 0)" but got "rgb(0, 128, 0)" >+Header example >+ >+Paragraph body >+ >+ >+FAIL Untitled Error: assert_equals: expected "rgb(255, 0, 0)" but got "rgb(0, 128, 0)" >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/style-css-with-json-parser-breaker.sub.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/style-css-with-json-parser-breaker.sub.html >new file mode 100644 >index 0000000000000000000000000000000000000000..c6b5889c331e22102f77d90f76efae200d051cd7 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/style-css-with-json-parser-breaker.sub.html >@@ -0,0 +1,36 @@ >+<!DOCTYPE html> >+<!-- Test verifies that CORB won't block a stylesheet that >+ 1) is correctly labeled with text/css Content-Type and parsing fine as text/css >+ 2) starts with a JSON parser breaker (like )]}') >+--> >+<meta charset="utf-8"> >+<script src=/resources/testharness.js></script> >+<script src=/resources/testharnessreport.js></script> >+ >+<!-- Default style that will be applied if the external stylesheet resource >+ below won't load for any reason. This stylesheet will set h1's >+ color to green (see |default_color| below). --> >+<style> >+h1 { color: green; } >+</style> >+ >+<!-- This stylesheet (if loaded) should set h1#header's color to red >+ (see |external_color| below). --> >+<!-- www1 is cross-origin, so the HTTP response is CORB-eligible --> >+<link rel="stylesheet" type="text/css" >+ href="http://{{domains[www1]}}:{{ports[http][0]}}/fetch/corb/resources/css-with-json-parser-breaker.css"> >+ >+<body> >+ <h1 id="header">Header example</h1> >+ <p>Paragraph body</p> >+</body> >+ >+<script> >+// Verify that CSS got applied / did not get blocked by CORB. >+let style = getComputedStyle(document.getElementById('header')); >+const external_color = 'rgb(255, 0, 0)'; // red >+const default_color = 'rgb(0, 128, 0)'; // green >+assert_equals(style.getPropertyValue('color'), external_color); >+assert_not_equals(style.getPropertyValue('color'), default_color); >+done(); >+</script> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/style-html-correctly-labeled.sub-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/style-html-correctly-labeled.sub-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..22fd0548e2cb90d2c4de49d623ad9e05d80561a9 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/style-html-correctly-labeled.sub-expected.txt >@@ -0,0 +1,9 @@ >+Blocked access to external URL http://www1.localhost:8800/fetch/corb/resources/html-correctly-labeled.html >+Blocked access to external URL http://www1.localhost:8800/fetch/corb/resources/html-correctly-labeled.html >+Header example >+ >+Paragraph body >+ >+ >+PASS Untitled >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/style-html-correctly-labeled.sub.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/style-html-correctly-labeled.sub.html >new file mode 100644 >index 0000000000000000000000000000000000000000..c99eb053d61862260891ebdf04338a841f49d2cf >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/style-html-correctly-labeled.sub.html >@@ -0,0 +1,40 @@ >+<!DOCTYPE html> >+<!-- Test verifies that using a HTML document as a stylesheet has no observable >+ differences with and without CORB: >+ - The cross-origin stylesheet requires a correct text/css Content-Type >+ and therefore won't render even without CORB. This aspect of this test >+ is similar to the style-css-mislabeled-as-html.sub.html test. >+ - Even if the Content-Type requirements were relaxed for cross-origin stylesheets, >+ the HTML document is unlikely to parse as a stylesheet (unless a polyglot >+ HTML/CSS document is crafted as part of an attack) and therefore the >+ observable behavior should be indistinguishable from parsing the empty, >+ CORB-blocked response as a stylesheet. >+--> >+<meta charset="utf-8"> >+<script src=/resources/testharness.js></script> >+<script src=/resources/testharnessreport.js></script> >+ >+<!-- Default style that will be applied if the external stylesheet resource >+ below won't load for any reason. This stylesheet will set h1's >+ color to green (see |default_color| below). --> >+<style> >+h1 { color: green; } >+</style> >+ >+<!-- This is not really a stylesheet... --> >+<!-- www1 is cross-origin, so the HTTP response is CORB-eligible --> >+<link rel="stylesheet" type="text/css" >+ href="http://{{domains[www1]}}:{{ports[http][0]}}/fetch/corb/resources/html-correctly-labeled.html"> >+ >+<body> >+ <h1 id="header">Header example</h1> >+ <p>Paragraph body</p> >+</body> >+ >+<script> >+// Verify that CSS is not applied (because of mismatched Content-Type header). >+var style = getComputedStyle(document.getElementById('header')); >+const default_color = 'rgb(0, 128, 0)'; // green >+assert_equals(style.getPropertyValue('color'), default_color); >+done(); >+</script> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/w3c-import.log b/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/w3c-import.log >new file mode 100644 >index 0000000000000000000000000000000000000000..e7132c5db0180f5af172bb138da45fa91da065bf >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/w3c-import.log >@@ -0,0 +1,35 @@ >+The tests in this directory were imported from the W3C repository. >+Do NOT modify these tests directly in WebKit. >+Instead, create a pull request on the WPT github: >+ https://github.com/web-platform-tests/wpt >+ >+Then run the Tools/Scripts/import-w3c-tests in WebKit to reimport >+ >+Do NOT modify or remove this file. >+ >+------------------------------------------------------------------------ >+Properties requiring vendor prefixes: >+None >+Property values requiring vendor prefixes: >+None >+------------------------------------------------------------------------ >+List of files: >+/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/README.md >+/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/img-html-correctly-labeled.sub-expected.html >+/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/img-html-correctly-labeled.sub.html >+/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/img-mime-types-coverage.tentative.sub.html >+/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/img-png-mislabeled-as-html-nosniff.tentative.sub-expected.html >+/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/img-png-mislabeled-as-html-nosniff.tentative.sub.html >+/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/img-png-mislabeled-as-html.sub-expected.html >+/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/img-png-mislabeled-as-html.sub.html >+/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/preload-image-png-mislabeled-as-html-nosniff.tentative.sub.html >+/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/script-html-correctly-labeled.tentative.sub.html >+/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/script-html-js-polyglot.sub.html >+/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/script-html-via-cross-origin-blob-url.sub.html >+/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/script-js-mislabeled-as-html-nosniff.sub.html >+/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/script-js-mislabeled-as-html.sub.html >+/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/script-resource-with-json-parser-breaker.tentative.sub.html >+/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/style-css-mislabeled-as-html-nosniff.sub.html >+/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/style-css-mislabeled-as-html.sub.html >+/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/style-css-with-json-parser-breaker.sub.html >+/LayoutTests/imported/w3c/web-platform-tests/fetch/corb/style-html-correctly-labeled.sub.html >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/cors-rfc1918/idlharness.tentative.any-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/cors-rfc1918/idlharness.tentative.any-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..a7ea32791cb00693f3794a23d3284a92679c52ff >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/cors-rfc1918/idlharness.tentative.any-expected.txt >@@ -0,0 +1,30 @@ >+ >+FAIL idl_test setup promise_test: Unhandled rejection with value: object "Got an error before parsing any named definition: Unrecognised tokens, line 1 (tokens: "{\"error\": {\"message\"") >+[ >+ { >+ "type": "{", >+ "value": "{", >+ "trivia": "" >+ }, >+ { >+ "type": "string", >+ "value": "\"error\"", >+ "trivia": "" >+ }, >+ { >+ "type": ":", >+ "value": ":", >+ "trivia": "" >+ }, >+ { >+ "type": "{", >+ "value": "{", >+ "trivia": " " >+ }, >+ { >+ "type": "string", >+ "value": "\"message\"", >+ "trivia": "" >+ } >+]" >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/cors-rfc1918/idlharness.tentative.any.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/cors-rfc1918/idlharness.tentative.any.html >new file mode 100644 >index 0000000000000000000000000000000000000000..2382913528e693b3a5d56c660a45060980b548c3 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/cors-rfc1918/idlharness.tentative.any.html >@@ -0,0 +1 @@ >+<!-- This file is required for WebKit test infrastructure to run the templated test --> >\ No newline at end of file >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/cors-rfc1918/idlharness.tentative.any.js b/LayoutTests/imported/w3c/web-platform-tests/fetch/cors-rfc1918/idlharness.tentative.any.js >new file mode 100644 >index 0000000000000000000000000000000000000000..88468dc19a38a64e6ebdb19b4e92ddf23a3247fc >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/cors-rfc1918/idlharness.tentative.any.js >@@ -0,0 +1,23 @@ >+// META: global=window,worker >+// META: script=/resources/WebIDLParser.js >+// META: script=/resources/idlharness.js >+ >+'use strict'; >+ >+// https://wicg.github.io/cors-rfc1918/ >+ >+idl_test( >+ ['cors-rfc1918'], >+ ['html', 'dom'], >+ idlArray => { >+ if (self.GLOBAL.isWorker()) { >+ idlArray.add_objects({ >+ WorkerGlobalScope: ['self'], >+ }); >+ } else { >+ idlArray.add_objects({ >+ Document: ['document'], >+ }); >+ } >+ } >+); >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/cors-rfc1918/idlharness.tentative.any.worker-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/cors-rfc1918/idlharness.tentative.any.worker-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..a7ea32791cb00693f3794a23d3284a92679c52ff >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/cors-rfc1918/idlharness.tentative.any.worker-expected.txt >@@ -0,0 +1,30 @@ >+ >+FAIL idl_test setup promise_test: Unhandled rejection with value: object "Got an error before parsing any named definition: Unrecognised tokens, line 1 (tokens: "{\"error\": {\"message\"") >+[ >+ { >+ "type": "{", >+ "value": "{", >+ "trivia": "" >+ }, >+ { >+ "type": "string", >+ "value": "\"error\"", >+ "trivia": "" >+ }, >+ { >+ "type": ":", >+ "value": ":", >+ "trivia": "" >+ }, >+ { >+ "type": "{", >+ "value": "{", >+ "trivia": " " >+ }, >+ { >+ "type": "string", >+ "value": "\"message\"", >+ "trivia": "" >+ } >+]" >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/cors-rfc1918/idlharness.tentative.any.worker.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/cors-rfc1918/idlharness.tentative.any.worker.html >new file mode 100644 >index 0000000000000000000000000000000000000000..2382913528e693b3a5d56c660a45060980b548c3 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/cors-rfc1918/idlharness.tentative.any.worker.html >@@ -0,0 +1 @@ >+<!-- This file is required for WebKit test infrastructure to run the templated test --> >\ No newline at end of file >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/cors-rfc1918/w3c-import.log b/LayoutTests/imported/w3c/web-platform-tests/fetch/cors-rfc1918/w3c-import.log >new file mode 100644 >index 0000000000000000000000000000000000000000..bf49ecb1326975ad22e3f617460db35e4d7f9a71 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/cors-rfc1918/w3c-import.log >@@ -0,0 +1,17 @@ >+The tests in this directory were imported from the W3C repository. >+Do NOT modify these tests directly in WebKit. >+Instead, create a pull request on the WPT github: >+ https://github.com/web-platform-tests/wpt >+ >+Then run the Tools/Scripts/import-w3c-tests in WebKit to reimport >+ >+Do NOT modify or remove this file. >+ >+------------------------------------------------------------------------ >+Properties requiring vendor prefixes: >+None >+Property values requiring vendor prefixes: >+None >+------------------------------------------------------------------------ >+List of files: >+/LayoutTests/imported/w3c/web-platform-tests/fetch/cors-rfc1918/idlharness.tentative.any.js >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/cross-origin-resource-policy/fetch-in-service-worker-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/cross-origin-resource-policy/fetch-in-service-worker-expected.txt >index 50a6a13b8c036a33fd3d9f8137511554812e7979..11db587aef52a25ccfed00444a132061d8dfbea4 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/cross-origin-resource-policy/fetch-in-service-worker-expected.txt >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/cross-origin-resource-policy/fetch-in-service-worker-expected.txt >@@ -6,7 +6,7 @@ PASS Cross-origin cors fetch with a 'Cross-Origin-Resource-Policy: same-origin' > PASS Cross-origin cors fetch with a 'Cross-Origin-Resource-Policy: same-site' response header. > PASS Cross-origin no-cors fetch with a 'Cross-Origin-Resource-Policy: same-origin' response header. > PASS Cross-origin no-cors fetch with a 'Cross-Origin-Resource-Policy: same-site' response header. >-PASS Cross-origin no-cors fetch to a same-site URL with a 'Cross-Origin-Resource-Policy: same-site' response header, HTTP context, HTTPS resource. >+FAIL Cross-origin no-cors fetch to a same-site URL with a 'Cross-Origin-Resource-Policy: same-site' response header. promise_test: Unhandled rejection with value: object "TypeError: Cancelled load to https://localhost:9443/fetch/cross-origin-resource-policy/resources/hello.py?corp=same-site because it violates the resource's Cross-Origin-Resource-Policy response header." > PASS Cross-origin no-cors fetch to a same-site URL with a 'Cross-Origin-Resource-Policy: same-origin' response header. > PASS Valid cross-origin no-cors fetch with a 'Cross-Origin-Resource-Policy: same-site' response header. > PASS Cross-origin no-cors fetch with a 'Cross-Origin-Resource-Policy: same-origin' response header after a redirection. >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/cross-origin-resource-policy/fetch.any-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/cross-origin-resource-policy/fetch.any-expected.txt >index 7d5f9443143efa723e799cc7e028858eeaa27aed..5cf1bf7c3e0d2d3ecf17753911fef7038d9a2c6f 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/cross-origin-resource-policy/fetch.any-expected.txt >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/cross-origin-resource-policy/fetch.any-expected.txt >@@ -19,7 +19,7 @@ PASS Cross-origin cors fetch with a 'Cross-Origin-Resource-Policy: same-origin' > PASS Cross-origin cors fetch with a 'Cross-Origin-Resource-Policy: same-site' response header. > PASS Cross-origin no-cors fetch with a 'Cross-Origin-Resource-Policy: same-origin' response header. > PASS Cross-origin no-cors fetch with a 'Cross-Origin-Resource-Policy: same-site' response header. >-PASS Cross-origin no-cors fetch to a same-site URL with a 'Cross-Origin-Resource-Policy: same-site' response header, HTTP context, HTTPS resource. >+FAIL Cross-origin no-cors fetch to a same-site URL with a 'Cross-Origin-Resource-Policy: same-site' response header. promise_test: Unhandled rejection with value: object "TypeError: Cancelled load to https://localhost:9443/fetch/cross-origin-resource-policy/resources/hello.py?corp=same-site because it violates the resource's Cross-Origin-Resource-Policy response header." > PASS Cross-origin no-cors fetch to a same-site URL with a 'Cross-Origin-Resource-Policy: same-origin' response header. > PASS Valid cross-origin no-cors fetch with a 'Cross-Origin-Resource-Policy: same-site' response header. > PASS Cross-origin no-cors fetch with a 'Cross-Origin-Resource-Policy: same-origin' response header after a redirection. >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/cross-origin-resource-policy/fetch.any.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/cross-origin-resource-policy/fetch.any.html >index 9ec70b26b7dd0fed6ae6a9a3112e76457598d0cd..2382913528e693b3a5d56c660a45060980b548c3 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/cross-origin-resource-policy/fetch.any.html >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/cross-origin-resource-policy/fetch.any.html >@@ -1 +1 @@ >-<!-- This file is required for WebKit test infrastructure to run the templated test --> >+<!-- This file is required for WebKit test infrastructure to run the templated test --> >\ No newline at end of file >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/cross-origin-resource-policy/fetch.any.js b/LayoutTests/imported/w3c/web-platform-tests/fetch/cross-origin-resource-policy/fetch.any.js >index 7104554e98bd5affa5c0da9847a5702af2de80af..ded3bdc5daee50fec9c970cd31f24f2bd6f2b60a 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/cross-origin-resource-policy/fetch.any.js >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/cross-origin-resource-policy/fetch.any.js >@@ -1,8 +1,6 @@ >+// META: global=window,worker > // META: script=/common/get-host-info.sub.js > >-if (!self.document) >- importScripts("/common/get-host-info.sub.js"); >- > const host = get_host_info(); > const path = "/fetch/cross-origin-resource-policy/"; > const localBaseURL = host.HTTP_ORIGIN + path; >@@ -42,8 +40,8 @@ promise_test((test) => { > > promise_test((test) => { > const remoteURL = httpsBaseURL + "resources/hello.py?corp=same-site"; >- return promise_rejects(test, new TypeError, fetch(remoteURL, { mode: "no-cors" })); >-}, "Cross-origin no-cors fetch to a same-site URL with a 'Cross-Origin-Resource-Policy: same-site' response header, HTTP context, HTTPS resource."); >+ return fetch(remoteURL, { mode: "no-cors" }); >+}, "Cross-origin no-cors fetch to a same-site URL with a 'Cross-Origin-Resource-Policy: same-site' response header."); > > promise_test((test) => { > const remoteURL = httpsBaseURL + "resources/hello.py?corp=same-origin"; >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/cross-origin-resource-policy/fetch.any.worker-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/cross-origin-resource-policy/fetch.any.worker-expected.txt >index 7c1cdee0c16a809c3c8edfedc3e2075f10ff69f9..deb6eb35ba49be25d3b5502ed0034403f8343c9d 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/cross-origin-resource-policy/fetch.any.worker-expected.txt >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/cross-origin-resource-policy/fetch.any.worker-expected.txt >@@ -12,7 +12,7 @@ PASS Cross-origin cors fetch with a 'Cross-Origin-Resource-Policy: same-origin' > PASS Cross-origin cors fetch with a 'Cross-Origin-Resource-Policy: same-site' response header. > PASS Cross-origin no-cors fetch with a 'Cross-Origin-Resource-Policy: same-origin' response header. > PASS Cross-origin no-cors fetch with a 'Cross-Origin-Resource-Policy: same-site' response header. >-PASS Cross-origin no-cors fetch to a same-site URL with a 'Cross-Origin-Resource-Policy: same-site' response header, HTTP context, HTTPS resource. >+FAIL Cross-origin no-cors fetch to a same-site URL with a 'Cross-Origin-Resource-Policy: same-site' response header. promise_test: Unhandled rejection with value: object "TypeError: Cancelled load to https://localhost:9443/fetch/cross-origin-resource-policy/resources/hello.py?corp=same-site because it violates the resource's Cross-Origin-Resource-Policy response header." > PASS Cross-origin no-cors fetch to a same-site URL with a 'Cross-Origin-Resource-Policy: same-origin' response header. > PASS Valid cross-origin no-cors fetch with a 'Cross-Origin-Resource-Policy: same-site' response header. > PASS Cross-origin no-cors fetch with a 'Cross-Origin-Resource-Policy: same-origin' response header after a redirection. >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/cross-origin-resource-policy/fetch.any.worker.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/cross-origin-resource-policy/fetch.any.worker.html >index 9ec70b26b7dd0fed6ae6a9a3112e76457598d0cd..2382913528e693b3a5d56c660a45060980b548c3 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/cross-origin-resource-policy/fetch.any.worker.html >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/cross-origin-resource-policy/fetch.any.worker.html >@@ -1 +1 @@ >-<!-- This file is required for WebKit test infrastructure to run the templated test --> >+<!-- This file is required for WebKit test infrastructure to run the templated test --> >\ No newline at end of file >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/cross-origin-resource-policy/scheme-restriction.https.window-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/cross-origin-resource-policy/scheme-restriction.https.window-expected.txt >index 193f719d73d4c4c3db11cb9795a68e4b84cb5b09..7ef02925ae9bccb0979818a0fa9af3ab6c3bc1aa 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/cross-origin-resource-policy/scheme-restriction.https.window-expected.txt >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/cross-origin-resource-policy/scheme-restriction.https.window-expected.txt >@@ -1,5 +1,7 @@ >-CONSOLE MESSAGE: line 1489: The page at https://localhost:9443/fetch/cross-origin-resource-policy/scheme-restriction.https.window.html was allowed to display insecure content from http://localhost:8800/fetch/cross-origin-resource-policy/resources/image.py?corp=same-site. >+CONSOLE MESSAGE: line 1489: The page at https://localhost:9443/fetch/cross-origin-resource-policy/scheme-restriction.https.window.html was allowed to display insecure content from http://127.0.0.1:8800/fetch/cross-origin-resource-policy/resources/image.py?corp=same-site. > >+CONSOLE MESSAGE: Cancelled load to http://127.0.0.1:8800/fetch/cross-origin-resource-policy/resources/image.py?corp=same-site because it violates the resource's Cross-Origin-Resource-Policy response header. >+CONSOLE MESSAGE: Cannot load image http://127.0.0.1:8800/fetch/cross-origin-resource-policy/resources/image.py?corp=same-site due to access control checks. > >-PASS Cross-Origin-Resource-Policy does not block Mixed Content <img> >+FAIL Cross-Origin-Resource-Policy does not block Mixed Content <img> promise_test: Unhandled rejection with value: object "[object Event]" > >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/cross-origin-resource-policy/scheme-restriction.https.window.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/cross-origin-resource-policy/scheme-restriction.https.window.html >index 9ec70b26b7dd0fed6ae6a9a3112e76457598d0cd..2382913528e693b3a5d56c660a45060980b548c3 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/cross-origin-resource-policy/scheme-restriction.https.window.html >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/cross-origin-resource-policy/scheme-restriction.https.window.html >@@ -1 +1 @@ >-<!-- This file is required for WebKit test infrastructure to run the templated test --> >+<!-- This file is required for WebKit test infrastructure to run the templated test --> >\ No newline at end of file >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/cross-origin-resource-policy/scheme-restriction.https.window.js b/LayoutTests/imported/w3c/web-platform-tests/fetch/cross-origin-resource-policy/scheme-restriction.https.window.js >index 66b609789ea2e8db803928c6e574d92ddddc9e6c..4c7457187419e059b016d5f2602b516d3382be7b 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/cross-origin-resource-policy/scheme-restriction.https.window.js >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/cross-origin-resource-policy/scheme-restriction.https.window.js >@@ -2,7 +2,7 @@ > > promise_test(t => { > const img = new Image(); >- img.src = get_host_info().HTTP_ORIGIN + "/fetch/cross-origin-resource-policy/resources/image.py?corp=same-site"; >+ img.src = get_host_info().HTTP_REMOTE_ORIGIN + "/fetch/cross-origin-resource-policy/resources/image.py?corp=same-site"; > return new Promise((resolve, reject) => { > img.onload = resolve; > img.onerror = reject; >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/cross-origin-resource-policy/w3c-import.log b/LayoutTests/imported/w3c/web-platform-tests/fetch/cross-origin-resource-policy/w3c-import.log >index 0b12aa6fd5bb9afc2a08b669d24688d793c5674b..5e7fefe85152b0c16e520e366696290991e1466b 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/cross-origin-resource-policy/w3c-import.log >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/cross-origin-resource-policy/w3c-import.log >@@ -15,7 +15,7 @@ None > ------------------------------------------------------------------------ > List of files: > /LayoutTests/imported/w3c/web-platform-tests/fetch/cross-origin-resource-policy/fetch-in-iframe.html >-/LayoutTests/imported/w3c/web-platform-tests/fetch/cross-origin-resource-policy/fetch.html >+/LayoutTests/imported/w3c/web-platform-tests/fetch/cross-origin-resource-policy/fetch.any.js > /LayoutTests/imported/w3c/web-platform-tests/fetch/cross-origin-resource-policy/iframe-loads.html > /LayoutTests/imported/w3c/web-platform-tests/fetch/cross-origin-resource-policy/image-loads.html > /LayoutTests/imported/w3c/web-platform-tests/fetch/cross-origin-resource-policy/scheme-restriction.any.js >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/data-urls/README.md b/LayoutTests/imported/w3c/web-platform-tests/fetch/data-urls/README.md >new file mode 100644 >index 0000000000000000000000000000000000000000..1ce5b18b53825079305fa325e53127ba4c9c7bdf >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/data-urls/README.md >@@ -0,0 +1,11 @@ >+## data: URLs >+ >+`resources/data-urls.json` contains `data:` URL tests. The tests are encoded as a JSON array. Each value in the array is an array of two or three values. The first value describes the input, the second value describes the expected MIME type, null if the input is expected to fail somehow, or the empty string if the expected value is `text/plain;charset=US-ASCII`. The third value, if present, describes the expected body as an array of integers representing bytes. >+ >+These tests are used for `data:` URLs in this directory (see `processing.any.js`). >+ >+## Forgiving-base64 decode >+ >+`resources/base64.json` contains [forgiving-base64 decode](https://infra.spec.whatwg.org/#forgiving-base64-decode) tests. The tests are encoded as a JSON array. Each value in the array is an array of two values. The first value describes the input, the second value describes the output as an array of integers representing bytes or null if the input cannot be decoded. >+ >+These tests are used for `data:` URLs in this directory (see `base64.any.js`) and `window.atob()` in `../../html/webappapis/atob/base64.html`. >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/data-urls/base64.any-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/data-urls/base64.any-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..a54c459a287ec076210bcd7ee57f4836f2d37b6b >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/data-urls/base64.any-expected.txt >@@ -0,0 +1,116 @@ >+CONSOLE MESSAGE: Fetch API cannot load data:;base64,a. >+CONSOLE MESSAGE: Fetch API cannot load data:;base64,abcde. >+CONSOLE MESSAGE: Fetch API cannot load data:;base64,%F0%90%80%80. >+CONSOLE MESSAGE: Fetch API cannot load data:;base64,=. >+CONSOLE MESSAGE: Fetch API cannot load data:;base64,==. >+CONSOLE MESSAGE: Fetch API cannot load data:;base64,===. >+CONSOLE MESSAGE: Fetch API cannot load data:;base64,====. >+CONSOLE MESSAGE: Fetch API cannot load data:;base64,=====. >+CONSOLE MESSAGE: Fetch API cannot load data:;base64,a=. >+CONSOLE MESSAGE: Fetch API cannot load data:;base64,a==. >+CONSOLE MESSAGE: Fetch API cannot load data:;base64,a===. >+CONSOLE MESSAGE: Fetch API cannot load data:;base64,a====. >+CONSOLE MESSAGE: Fetch API cannot load data:;base64,a=====. >+CONSOLE MESSAGE: Fetch API cannot load data:;base64,abcde=. >+CONSOLE MESSAGE: Fetch API cannot load data:;base64,abcde==. >+CONSOLE MESSAGE: Fetch API cannot load data:;base64,abcde===. >+CONSOLE MESSAGE: Fetch API cannot load data:;base64,abcde====. >+CONSOLE MESSAGE: Fetch API cannot load data:;base64,abcde=====. >+CONSOLE MESSAGE: Fetch API cannot load data:;base64,=a. >+CONSOLE MESSAGE: Fetch API cannot load data:;base64,=a=. >+CONSOLE MESSAGE: Fetch API cannot load data:;base64,a=b. >+CONSOLE MESSAGE: Fetch API cannot load data:;base64,a=b=. >+CONSOLE MESSAGE: Fetch API cannot load data:;base64,ab=c. >+CONSOLE MESSAGE: Fetch API cannot load data:;base64,ab=c=. >+CONSOLE MESSAGE: Fetch API cannot load data:;base64,abc=d. >+CONSOLE MESSAGE: Fetch API cannot load data:;base64,abc=d=. >+CONSOLE MESSAGE: Fetch API cannot load data:;base64,ab%C2%A0cd. >+CONSOLE MESSAGE: Fetch API cannot load data:;base64,A. >+CONSOLE MESSAGE: Fetch API cannot load data:;base64,////A. >+CONSOLE MESSAGE: Fetch API cannot load data:;base64,/. >+CONSOLE MESSAGE: Fetch API cannot load data:;base64,AAAA/. >+CONSOLE MESSAGE: Fetch API cannot load data:;base64,%00nonsense. >+CONSOLE MESSAGE: Fetch API cannot load data:;base64,abcd%00nonsense. >+CONSOLE MESSAGE: Fetch API cannot load data:;base64,~~. >+CONSOLE MESSAGE: Fetch API cannot load data:;base64,... >+ >+PASS Setup. >+PASS data: URL base64 handling: "" >+PASS data: URL base64 handling: "abcd" >+PASS data: URL base64 handling: " abcd" >+PASS data: URL base64 handling: "abcd " >+FAIL data: URL base64 handling: " abcd===" assert_unreached: Should have rejected: undefined Reached unreachable code >+FAIL data: URL base64 handling: "abcd=== " assert_unreached: Should have rejected: undefined Reached unreachable code >+FAIL data: URL base64 handling: "abcd ===" assert_unreached: Should have rejected: undefined Reached unreachable code >+PASS data: URL base64 handling: "a" >+PASS data: URL base64 handling: "ab" >+PASS data: URL base64 handling: "abc" >+PASS data: URL base64 handling: "abcde" >+PASS data: URL base64 handling: "ð" >+PASS data: URL base64 handling: "=" >+PASS data: URL base64 handling: "==" >+PASS data: URL base64 handling: "===" >+PASS data: URL base64 handling: "====" >+PASS data: URL base64 handling: "=====" >+PASS data: URL base64 handling: "a=" >+PASS data: URL base64 handling: "a==" >+PASS data: URL base64 handling: "a===" >+PASS data: URL base64 handling: "a====" >+PASS data: URL base64 handling: "a=====" >+FAIL data: URL base64 handling: "ab=" assert_unreached: Should have rejected: undefined Reached unreachable code >+PASS data: URL base64 handling: "ab==" >+FAIL data: URL base64 handling: "ab===" assert_unreached: Should have rejected: undefined Reached unreachable code >+FAIL data: URL base64 handling: "ab====" assert_unreached: Should have rejected: undefined Reached unreachable code >+FAIL data: URL base64 handling: "ab=====" assert_unreached: Should have rejected: undefined Reached unreachable code >+PASS data: URL base64 handling: "abc=" >+FAIL data: URL base64 handling: "abc==" assert_unreached: Should have rejected: undefined Reached unreachable code >+FAIL data: URL base64 handling: "abc===" assert_unreached: Should have rejected: undefined Reached unreachable code >+FAIL data: URL base64 handling: "abc====" assert_unreached: Should have rejected: undefined Reached unreachable code >+FAIL data: URL base64 handling: "abc=====" assert_unreached: Should have rejected: undefined Reached unreachable code >+FAIL data: URL base64 handling: "abcd=" assert_unreached: Should have rejected: undefined Reached unreachable code >+FAIL data: URL base64 handling: "abcd==" assert_unreached: Should have rejected: undefined Reached unreachable code >+FAIL data: URL base64 handling: "abcd===" assert_unreached: Should have rejected: undefined Reached unreachable code >+FAIL data: URL base64 handling: "abcd====" assert_unreached: Should have rejected: undefined Reached unreachable code >+FAIL data: URL base64 handling: "abcd=====" assert_unreached: Should have rejected: undefined Reached unreachable code >+PASS data: URL base64 handling: "abcde=" >+PASS data: URL base64 handling: "abcde==" >+PASS data: URL base64 handling: "abcde===" >+PASS data: URL base64 handling: "abcde====" >+PASS data: URL base64 handling: "abcde=====" >+PASS data: URL base64 handling: "=a" >+PASS data: URL base64 handling: "=a=" >+PASS data: URL base64 handling: "a=b" >+PASS data: URL base64 handling: "a=b=" >+PASS data: URL base64 handling: "ab=c" >+PASS data: URL base64 handling: "ab=c=" >+PASS data: URL base64 handling: "abc=d" >+PASS data: URL base64 handling: "abc=d=" >+FAIL data: URL base64 handling: "ab\vcd" assert_unreached: Should have rejected: undefined Reached unreachable code >+PASS data: URL base64 handling: "ab\tcd" >+PASS data: URL base64 handling: "ab\ncd" >+PASS data: URL base64 handling: "ab\fcd" >+PASS data: URL base64 handling: "ab\rcd" >+PASS data: URL base64 handling: "ab cd" >+PASS data: URL base64 handling: "ab cd" >+PASS data: URL base64 handling: "ab\t\n\f\r cd" >+PASS data: URL base64 handling: " \t\n\f\r ab\t\n\f\r cd\t\n\f\r " >+PASS data: URL base64 handling: "ab\t\n\f\r =\t\n\f\r =\t\n\f\r " >+PASS data: URL base64 handling: "A" >+PASS data: URL base64 handling: "/A" >+PASS data: URL base64 handling: "//A" >+PASS data: URL base64 handling: "///A" >+PASS data: URL base64 handling: "////A" >+PASS data: URL base64 handling: "/" >+PASS data: URL base64 handling: "A/" >+PASS data: URL base64 handling: "AA/" >+PASS data: URL base64 handling: "AAAA/" >+PASS data: URL base64 handling: "AAA/" >+PASS data: URL base64 handling: "\0nonsense" >+PASS data: URL base64 handling: "abcd\0nonsense" >+PASS data: URL base64 handling: "YQ" >+PASS data: URL base64 handling: "YR" >+PASS data: URL base64 handling: "~~" >+PASS data: URL base64 handling: ".." >+FAIL data: URL base64 handling: "--" assert_unreached: Should have rejected: undefined Reached unreachable code >+FAIL data: URL base64 handling: "__" assert_unreached: Should have rejected: undefined Reached unreachable code >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/data-urls/base64.any.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/data-urls/base64.any.html >new file mode 100644 >index 0000000000000000000000000000000000000000..2382913528e693b3a5d56c660a45060980b548c3 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/data-urls/base64.any.html >@@ -0,0 +1 @@ >+<!-- This file is required for WebKit test infrastructure to run the templated test --> >\ No newline at end of file >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/data-urls/base64.any.js b/LayoutTests/imported/w3c/web-platform-tests/fetch/data-urls/base64.any.js >new file mode 100644 >index 0000000000000000000000000000000000000000..48e4c530a86225e4c2b917ffe2ae1f88200901c1 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/data-urls/base64.any.js >@@ -0,0 +1,16 @@ >+promise_test(() => fetch("resources/base64.json").then(res => res.json()).then(runBase64Tests), "Setup."); >+function runBase64Tests(tests) { >+ for(let i = 0; i < tests.length; i++) { >+ const input = tests[i][0], >+ output = tests[i][1], >+ dataURL = "data:;base64," + input; >+ promise_test(t => { >+ if(output === null) { >+ return promise_rejects(t, new TypeError(), fetch(dataURL)); >+ } >+ return fetch(dataURL).then(res => res.arrayBuffer()).then(body => { >+ assert_array_equals(new Uint8Array(body), output); >+ }); >+ }, "data: URL base64 handling: " + format_value(input)); >+ } >+} >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/data-urls/base64.any.worker-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/data-urls/base64.any.worker-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..752ff7138189d95f7d2ca5169584962258c4dc67 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/data-urls/base64.any.worker-expected.txt >@@ -0,0 +1,81 @@ >+ >+PASS Setup. >+PASS data: URL base64 handling: "" >+PASS data: URL base64 handling: "abcd" >+PASS data: URL base64 handling: " abcd" >+PASS data: URL base64 handling: "abcd " >+FAIL data: URL base64 handling: " abcd===" assert_unreached: Should have rejected: undefined Reached unreachable code >+FAIL data: URL base64 handling: "abcd=== " assert_unreached: Should have rejected: undefined Reached unreachable code >+FAIL data: URL base64 handling: "abcd ===" assert_unreached: Should have rejected: undefined Reached unreachable code >+PASS data: URL base64 handling: "a" >+PASS data: URL base64 handling: "ab" >+PASS data: URL base64 handling: "abc" >+PASS data: URL base64 handling: "abcde" >+PASS data: URL base64 handling: "ð" >+PASS data: URL base64 handling: "=" >+PASS data: URL base64 handling: "==" >+PASS data: URL base64 handling: "===" >+PASS data: URL base64 handling: "====" >+PASS data: URL base64 handling: "=====" >+PASS data: URL base64 handling: "a=" >+PASS data: URL base64 handling: "a==" >+PASS data: URL base64 handling: "a===" >+PASS data: URL base64 handling: "a====" >+PASS data: URL base64 handling: "a=====" >+FAIL data: URL base64 handling: "ab=" assert_unreached: Should have rejected: undefined Reached unreachable code >+PASS data: URL base64 handling: "ab==" >+FAIL data: URL base64 handling: "ab===" assert_unreached: Should have rejected: undefined Reached unreachable code >+FAIL data: URL base64 handling: "ab====" assert_unreached: Should have rejected: undefined Reached unreachable code >+FAIL data: URL base64 handling: "ab=====" assert_unreached: Should have rejected: undefined Reached unreachable code >+PASS data: URL base64 handling: "abc=" >+FAIL data: URL base64 handling: "abc==" assert_unreached: Should have rejected: undefined Reached unreachable code >+FAIL data: URL base64 handling: "abc===" assert_unreached: Should have rejected: undefined Reached unreachable code >+FAIL data: URL base64 handling: "abc====" assert_unreached: Should have rejected: undefined Reached unreachable code >+FAIL data: URL base64 handling: "abc=====" assert_unreached: Should have rejected: undefined Reached unreachable code >+FAIL data: URL base64 handling: "abcd=" assert_unreached: Should have rejected: undefined Reached unreachable code >+FAIL data: URL base64 handling: "abcd==" assert_unreached: Should have rejected: undefined Reached unreachable code >+FAIL data: URL base64 handling: "abcd===" assert_unreached: Should have rejected: undefined Reached unreachable code >+FAIL data: URL base64 handling: "abcd====" assert_unreached: Should have rejected: undefined Reached unreachable code >+FAIL data: URL base64 handling: "abcd=====" assert_unreached: Should have rejected: undefined Reached unreachable code >+PASS data: URL base64 handling: "abcde=" >+PASS data: URL base64 handling: "abcde==" >+PASS data: URL base64 handling: "abcde===" >+PASS data: URL base64 handling: "abcde====" >+PASS data: URL base64 handling: "abcde=====" >+PASS data: URL base64 handling: "=a" >+PASS data: URL base64 handling: "=a=" >+PASS data: URL base64 handling: "a=b" >+PASS data: URL base64 handling: "a=b=" >+PASS data: URL base64 handling: "ab=c" >+PASS data: URL base64 handling: "ab=c=" >+PASS data: URL base64 handling: "abc=d" >+PASS data: URL base64 handling: "abc=d=" >+FAIL data: URL base64 handling: "ab\vcd" assert_unreached: Should have rejected: undefined Reached unreachable code >+PASS data: URL base64 handling: "ab\tcd" >+PASS data: URL base64 handling: "ab\ncd" >+PASS data: URL base64 handling: "ab\fcd" >+PASS data: URL base64 handling: "ab\rcd" >+PASS data: URL base64 handling: "ab cd" >+PASS data: URL base64 handling: "ab cd" >+PASS data: URL base64 handling: "ab\t\n\f\r cd" >+PASS data: URL base64 handling: " \t\n\f\r ab\t\n\f\r cd\t\n\f\r " >+PASS data: URL base64 handling: "ab\t\n\f\r =\t\n\f\r =\t\n\f\r " >+PASS data: URL base64 handling: "A" >+PASS data: URL base64 handling: "/A" >+PASS data: URL base64 handling: "//A" >+PASS data: URL base64 handling: "///A" >+PASS data: URL base64 handling: "////A" >+PASS data: URL base64 handling: "/" >+PASS data: URL base64 handling: "A/" >+PASS data: URL base64 handling: "AA/" >+PASS data: URL base64 handling: "AAAA/" >+PASS data: URL base64 handling: "AAA/" >+PASS data: URL base64 handling: "\0nonsense" >+PASS data: URL base64 handling: "abcd\0nonsense" >+PASS data: URL base64 handling: "YQ" >+PASS data: URL base64 handling: "YR" >+PASS data: URL base64 handling: "~~" >+PASS data: URL base64 handling: ".." >+FAIL data: URL base64 handling: "--" assert_unreached: Should have rejected: undefined Reached unreachable code >+FAIL data: URL base64 handling: "__" assert_unreached: Should have rejected: undefined Reached unreachable code >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/data-urls/base64.any.worker.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/data-urls/base64.any.worker.html >new file mode 100644 >index 0000000000000000000000000000000000000000..2382913528e693b3a5d56c660a45060980b548c3 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/data-urls/base64.any.worker.html >@@ -0,0 +1 @@ >+<!-- This file is required for WebKit test infrastructure to run the templated test --> >\ No newline at end of file >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/data-urls/processing.any-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/data-urls/processing.any-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..c878ab6750bc237125f850d9691c7086a25eb590 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/data-urls/processing.any-expected.txt >@@ -0,0 +1,76 @@ >+CONSOLE MESSAGE: Fetch API cannot load data:. >+CONSOLE MESSAGE: Fetch API cannot load data:text/html. >+CONSOLE MESSAGE: Fetch API cannot load data:text/html ;charset=x. >+ >+PASS Setup. >+FAIL "data://test/,X" assert_equals: expected "text/plain;charset=US-ASCII" but got "//test/" >+PASS "data://test:test/,X" >+PASS "data:,X" >+PASS "data:" >+PASS "data:text/html" >+PASS "data:text/html ;charset=x " >+PASS "data:," >+FAIL "data:,X#X" assert_array_equals: lengths differ, expected 1 got 3 >+PASS "data:,%FF" >+PASS "data:text/plain,X" >+FAIL "data:text/plain ,X" assert_equals: expected (string) "text/plain" but got (object) null >+PASS "data:text/plain%20,X" >+FAIL "data:text/plain\f,X" assert_equals: expected "text/plain%0c" but got "text/plain%0C" >+FAIL "data:text/plain%0C,X" assert_equals: expected "text/plain%0c" but got "text/plain%0C" >+FAIL "data:text/plain;,X" assert_equals: expected "text/plain" but got "text/plain;" >+FAIL "data:;x=x;charset=x,X" assert_equals: expected "text/plain;x=x;charset=x" but got ";x=x;charset=x" >+FAIL "data:;x=x,X" assert_equals: expected "text/plain;x=x" but got ";x=x" >+PASS "data:text/plain;charset=windows-1252,%C2%B1" >+FAIL "data:text/plain;Charset=UTF-8,%C2%B1" assert_equals: expected "text/plain;charset=UTF-8" but got "text/plain;Charset=UTF-8" >+PASS "data:image/gif,%C2%B1" >+FAIL "data:IMAGE/gif,%C2%B1" assert_equals: expected "image/gif" but got "IMAGE/gif" >+FAIL "data:IMAGE/gif;hi=x,%C2%B1" assert_equals: expected "image/gif;hi=x" but got "IMAGE/gif;hi=x" >+FAIL "data:IMAGE/gif;CHARSET=x,%C2%B1" assert_equals: expected "image/gif;charset=x" but got "IMAGE/gif;CHARSET=x" >+FAIL "data: ,%FF" assert_equals: expected (string) "text/plain;charset=US-ASCII" but got (object) null >+FAIL "data:%20,%FF" assert_equals: expected "text/plain;charset=US-ASCII" but got "%20" >+FAIL "data:\f,%FF" assert_equals: expected "text/plain;charset=US-ASCII" but got "%0C" >+FAIL "data:%1F,%FF" assert_equals: expected "text/plain;charset=US-ASCII" but got "%1F" >+FAIL "data:\0,%FF" assert_equals: expected "text/plain;charset=US-ASCII" but got "%00" >+FAIL "data:%00,%FF" assert_equals: expected "text/plain;charset=US-ASCII" but got "%00" >+FAIL "data:text/html ,X" assert_equals: expected (string) "text/html" but got (object) null >+FAIL "data:text / html,X" assert_equals: expected "text/plain;charset=US-ASCII" but got "text / html" >+FAIL "data:â ,X" assert_equals: expected "text/plain;charset=US-ASCII" but got "%E2%80%A0" >+FAIL "data:â /â ,X" assert_equals: expected "%e2%80%a0/%e2%80%a0" but got "%E2%80%A0/%E2%80%A0" >+FAIL "data:X,X" assert_equals: expected "text/plain;charset=US-ASCII" but got "X" >+PASS "data:image/png,X X" >+PASS "data:application/javascript,X X" >+PASS "data:application/xml,X X" >+PASS "data:text/javascript,X X" >+PASS "data:text/plain,X X" >+PASS "data:unknown/unknown,X X" >+FAIL "data:text/plain;a=\",\",X" assert_equals: expected "text/plain;a=\"\"" but got "text/plain;a=\"" >+PASS "data:text/plain;a=%2C,X" >+FAIL "data:;base64;base64,WA" assert_equals: expected "text/plain" but got ";base64" >+FAIL "data:x/x;base64;base64,WA" assert_equals: expected "x/x" but got "x/x;base64" >+FAIL "data:x/x;base64;charset=x,WA" assert_equals: expected "x/x;charset=x" but got "x/x;base64;charset=x" >+FAIL "data:x/x;base64;charset=x;base64,WA" assert_equals: expected "x/x;charset=x" but got "x/x;base64;charset=x" >+FAIL "data:x/x;base64;base64x,WA" assert_equals: expected "x/x" but got "x/x;base64;base64x" >+PASS "data:;base64,W%20A" >+PASS "data:;base64,W%0CA" >+FAIL "data:x;base64x,WA" assert_equals: expected "text/plain;charset=US-ASCII" but got "x;base64x" >+FAIL "data:x;base64;x,WA" assert_equals: expected "text/plain;charset=US-ASCII" but got "x;base64;x" >+FAIL "data:x;base64=x,WA" assert_equals: expected "text/plain;charset=US-ASCII" but got "x;base64=x" >+FAIL "data:; base64,WA" assert_array_equals: lengths differ, expected 1 got 2 >+FAIL "data:; base64,WA" assert_array_equals: lengths differ, expected 1 got 2 >+FAIL "data: ;charset=x ; base64,WA" assert_array_equals: lengths differ, expected 1 got 2 >+FAIL "data:;base64;,WA" assert_equals: expected "text/plain" but got ";base64;" >+FAIL "data:;base64 ,WA" assert_array_equals: lengths differ, expected 1 got 2 >+FAIL "data:;base64 ,WA" assert_array_equals: lengths differ, expected 1 got 2 >+FAIL "data:;base 64,WA" assert_equals: expected "text/plain" but got ";base 64" >+PASS "data:;BASe64,WA" >+FAIL "data:;%62ase64,WA" assert_equals: expected "text/plain" but got ";%62ase64" >+FAIL "data:%3Bbase64,WA" assert_equals: expected "text/plain;charset=US-ASCII" but got "%3Bbase64" >+FAIL "data:;charset=x,X" assert_equals: expected "text/plain;charset=x" but got ";charset=x" >+FAIL "data:; charset=x,X" assert_equals: expected "text/plain;charset=x" but got "; charset=x" >+FAIL "data:;charset =x,X" assert_equals: expected "text/plain" but got ";charset =x" >+FAIL "data:;charset= x,X" assert_equals: expected "text/plain;charset=\" x\"" but got ";charset= x" >+FAIL "data:;charset=,X" assert_equals: expected "text/plain" but got ";charset=" >+FAIL "data:;charset,X" assert_equals: expected "text/plain" but got ";charset" >+FAIL "data:;charset=\"x\",X" assert_equals: expected "text/plain;charset=x" but got ";charset=\"x\"" >+FAIL "data:;CHARSET=\"X\",X" assert_equals: expected "text/plain;charset=X" but got ";CHARSET=\"X\"" >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/data-urls/processing.any.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/data-urls/processing.any.html >new file mode 100644 >index 0000000000000000000000000000000000000000..2382913528e693b3a5d56c660a45060980b548c3 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/data-urls/processing.any.html >@@ -0,0 +1 @@ >+<!-- This file is required for WebKit test infrastructure to run the templated test --> >\ No newline at end of file >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/data-urls/processing.any.js b/LayoutTests/imported/w3c/web-platform-tests/fetch/data-urls/processing.any.js >new file mode 100644 >index 0000000000000000000000000000000000000000..b66a874f45ca30ddb776a27a947d7a95857e19d6 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/data-urls/processing.any.js >@@ -0,0 +1,20 @@ >+promise_test(() => fetch("resources/data-urls.json").then(res => res.json()).then(runDataURLTests), "Setup."); >+function runDataURLTests(tests) { >+ for(let i = 0; i < tests.length; i++) { >+ const input = tests[i][0], >+ expectedMimeType = tests[i][1], >+ expectedBody = expectedMimeType !== null ? tests[i][2] : null; >+ promise_test(t => { >+ if(expectedMimeType === null) { >+ return promise_rejects(t, new TypeError(), fetch(input)); >+ } else { >+ return fetch(input).then(res => { >+ return res.arrayBuffer().then(body => { >+ assert_array_equals(new Uint8Array(body), expectedBody); >+ assert_equals(res.headers.get("content-type"), expectedMimeType); // We could assert this earlier, but this fails often >+ }); >+ }); >+ } >+ }, format_value(input)); >+ } >+} >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/data-urls/processing.any.worker-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/data-urls/processing.any.worker-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..1c23aaadae8f3d5e97f221d22e75da13a2bfd58a >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/data-urls/processing.any.worker-expected.txt >@@ -0,0 +1,73 @@ >+ >+PASS Setup. >+FAIL "data://test/,X" assert_equals: expected "text/plain;charset=US-ASCII" but got "//test/" >+PASS "data://test:test/,X" >+PASS "data:,X" >+PASS "data:" >+PASS "data:text/html" >+PASS "data:text/html ;charset=x " >+PASS "data:," >+FAIL "data:,X#X" assert_array_equals: lengths differ, expected 1 got 3 >+PASS "data:,%FF" >+PASS "data:text/plain,X" >+FAIL "data:text/plain ,X" assert_equals: expected (string) "text/plain" but got (object) null >+PASS "data:text/plain%20,X" >+FAIL "data:text/plain\f,X" assert_equals: expected "text/plain%0c" but got "text/plain%0C" >+FAIL "data:text/plain%0C,X" assert_equals: expected "text/plain%0c" but got "text/plain%0C" >+FAIL "data:text/plain;,X" assert_equals: expected "text/plain" but got "text/plain;" >+FAIL "data:;x=x;charset=x,X" assert_equals: expected "text/plain;x=x;charset=x" but got ";x=x;charset=x" >+FAIL "data:;x=x,X" assert_equals: expected "text/plain;x=x" but got ";x=x" >+PASS "data:text/plain;charset=windows-1252,%C2%B1" >+FAIL "data:text/plain;Charset=UTF-8,%C2%B1" assert_equals: expected "text/plain;charset=UTF-8" but got "text/plain;Charset=UTF-8" >+PASS "data:image/gif,%C2%B1" >+FAIL "data:IMAGE/gif,%C2%B1" assert_equals: expected "image/gif" but got "IMAGE/gif" >+FAIL "data:IMAGE/gif;hi=x,%C2%B1" assert_equals: expected "image/gif;hi=x" but got "IMAGE/gif;hi=x" >+FAIL "data:IMAGE/gif;CHARSET=x,%C2%B1" assert_equals: expected "image/gif;charset=x" but got "IMAGE/gif;CHARSET=x" >+FAIL "data: ,%FF" assert_equals: expected (string) "text/plain;charset=US-ASCII" but got (object) null >+FAIL "data:%20,%FF" assert_equals: expected "text/plain;charset=US-ASCII" but got "%20" >+FAIL "data:\f,%FF" assert_equals: expected "text/plain;charset=US-ASCII" but got "%0C" >+FAIL "data:%1F,%FF" assert_equals: expected "text/plain;charset=US-ASCII" but got "%1F" >+FAIL "data:\0,%FF" assert_equals: expected "text/plain;charset=US-ASCII" but got "%00" >+FAIL "data:%00,%FF" assert_equals: expected "text/plain;charset=US-ASCII" but got "%00" >+FAIL "data:text/html ,X" assert_equals: expected (string) "text/html" but got (object) null >+FAIL "data:text / html,X" assert_equals: expected "text/plain;charset=US-ASCII" but got "text / html" >+FAIL "data:â ,X" assert_equals: expected "text/plain;charset=US-ASCII" but got "%E2%80%A0" >+FAIL "data:â /â ,X" assert_equals: expected "%e2%80%a0/%e2%80%a0" but got "%E2%80%A0/%E2%80%A0" >+FAIL "data:X,X" assert_equals: expected "text/plain;charset=US-ASCII" but got "X" >+PASS "data:image/png,X X" >+PASS "data:application/javascript,X X" >+PASS "data:application/xml,X X" >+PASS "data:text/javascript,X X" >+PASS "data:text/plain,X X" >+PASS "data:unknown/unknown,X X" >+FAIL "data:text/plain;a=\",\",X" assert_equals: expected "text/plain;a=\"\"" but got "text/plain;a=\"" >+PASS "data:text/plain;a=%2C,X" >+FAIL "data:;base64;base64,WA" assert_equals: expected "text/plain" but got ";base64" >+FAIL "data:x/x;base64;base64,WA" assert_equals: expected "x/x" but got "x/x;base64" >+FAIL "data:x/x;base64;charset=x,WA" assert_equals: expected "x/x;charset=x" but got "x/x;base64;charset=x" >+FAIL "data:x/x;base64;charset=x;base64,WA" assert_equals: expected "x/x;charset=x" but got "x/x;base64;charset=x" >+FAIL "data:x/x;base64;base64x,WA" assert_equals: expected "x/x" but got "x/x;base64;base64x" >+PASS "data:;base64,W%20A" >+PASS "data:;base64,W%0CA" >+FAIL "data:x;base64x,WA" assert_equals: expected "text/plain;charset=US-ASCII" but got "x;base64x" >+FAIL "data:x;base64;x,WA" assert_equals: expected "text/plain;charset=US-ASCII" but got "x;base64;x" >+FAIL "data:x;base64=x,WA" assert_equals: expected "text/plain;charset=US-ASCII" but got "x;base64=x" >+FAIL "data:; base64,WA" assert_array_equals: lengths differ, expected 1 got 2 >+FAIL "data:; base64,WA" assert_array_equals: lengths differ, expected 1 got 2 >+FAIL "data: ;charset=x ; base64,WA" assert_array_equals: lengths differ, expected 1 got 2 >+FAIL "data:;base64;,WA" assert_equals: expected "text/plain" but got ";base64;" >+FAIL "data:;base64 ,WA" assert_array_equals: lengths differ, expected 1 got 2 >+FAIL "data:;base64 ,WA" assert_array_equals: lengths differ, expected 1 got 2 >+FAIL "data:;base 64,WA" assert_equals: expected "text/plain" but got ";base 64" >+PASS "data:;BASe64,WA" >+FAIL "data:;%62ase64,WA" assert_equals: expected "text/plain" but got ";%62ase64" >+FAIL "data:%3Bbase64,WA" assert_equals: expected "text/plain;charset=US-ASCII" but got "%3Bbase64" >+FAIL "data:;charset=x,X" assert_equals: expected "text/plain;charset=x" but got ";charset=x" >+FAIL "data:; charset=x,X" assert_equals: expected "text/plain;charset=x" but got "; charset=x" >+FAIL "data:;charset =x,X" assert_equals: expected "text/plain" but got ";charset =x" >+FAIL "data:;charset= x,X" assert_equals: expected "text/plain;charset=\" x\"" but got ";charset= x" >+FAIL "data:;charset=,X" assert_equals: expected "text/plain" but got ";charset=" >+FAIL "data:;charset,X" assert_equals: expected "text/plain" but got ";charset" >+FAIL "data:;charset=\"x\",X" assert_equals: expected "text/plain;charset=x" but got ";charset=\"x\"" >+FAIL "data:;CHARSET=\"X\",X" assert_equals: expected "text/plain;charset=X" but got ";CHARSET=\"X\"" >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/data-urls/processing.any.worker.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/data-urls/processing.any.worker.html >new file mode 100644 >index 0000000000000000000000000000000000000000..2382913528e693b3a5d56c660a45060980b548c3 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/data-urls/processing.any.worker.html >@@ -0,0 +1 @@ >+<!-- This file is required for WebKit test infrastructure to run the templated test --> >\ No newline at end of file >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/data-urls/resources/base64.json b/LayoutTests/imported/w3c/web-platform-tests/fetch/data-urls/resources/base64.json >index 7de20b28286195a2cdcd6f7f999816eb731f0ac2..c4f79aafd9396691dabe67a2fce837591c96147c 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/data-urls/resources/base64.json >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/data-urls/resources/base64.json >@@ -49,6 +49,7 @@ > ["ab=c=", null], > ["abc=d", null], > ["abc=d=", null], >+ ["ab\u000Bcd", null], > ["ab\tcd", [105, 183, 29]], > ["ab\ncd", [105, 183, 29]], > ["ab\fcd", [105, 183, 29]], >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/data-urls/resources/data-urls.json b/LayoutTests/imported/w3c/web-platform-tests/fetch/data-urls/resources/data-urls.json >new file mode 100644 >index 0000000000000000000000000000000000000000..be1d1e74cf5f5105619a574c3caa7f2c0a39e7f6 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/data-urls/resources/data-urls.json >@@ -0,0 +1,208 @@ >+[ >+ ["data://test/,X", >+ "text/plain;charset=US-ASCII", >+ [88]], >+ ["data://test:test/,X", >+ null], >+ ["data:,X", >+ "text/plain;charset=US-ASCII", >+ [88]], >+ ["data:", >+ null], >+ ["data:text/html", >+ null], >+ ["data:text/html ;charset=x ", >+ null], >+ ["data:,", >+ "text/plain;charset=US-ASCII", >+ []], >+ ["data:,X#X", >+ "text/plain;charset=US-ASCII", >+ [88]], >+ ["data:,%FF", >+ "text/plain;charset=US-ASCII", >+ [255]], >+ ["data:text/plain,X", >+ "text/plain", >+ [88]], >+ ["data:text/plain ,X", >+ "text/plain", >+ [88]], >+ ["data:text/plain%20,X", >+ "text/plain%20", >+ [88]], >+ ["data:text/plain\f,X", >+ "text/plain%0c", >+ [88]], >+ ["data:text/plain%0C,X", >+ "text/plain%0c", >+ [88]], >+ ["data:text/plain;,X", >+ "text/plain", >+ [88]], >+ ["data:;x=x;charset=x,X", >+ "text/plain;x=x;charset=x", >+ [88]], >+ ["data:;x=x,X", >+ "text/plain;x=x", >+ [88]], >+ ["data:text/plain;charset=windows-1252,%C2%B1", >+ "text/plain;charset=windows-1252", >+ [194, 177]], >+ ["data:text/plain;Charset=UTF-8,%C2%B1", >+ "text/plain;charset=UTF-8", >+ [194, 177]], >+ ["data:image/gif,%C2%B1", >+ "image/gif", >+ [194, 177]], >+ ["data:IMAGE/gif,%C2%B1", >+ "image/gif", >+ [194, 177]], >+ ["data:IMAGE/gif;hi=x,%C2%B1", >+ "image/gif;hi=x", >+ [194, 177]], >+ ["data:IMAGE/gif;CHARSET=x,%C2%B1", >+ "image/gif;charset=x", >+ [194, 177]], >+ ["data: ,%FF", >+ "text/plain;charset=US-ASCII", >+ [255]], >+ ["data:%20,%FF", >+ "text/plain;charset=US-ASCII", >+ [255]], >+ ["data:\f,%FF", >+ "text/plain;charset=US-ASCII", >+ [255]], >+ ["data:%1F,%FF", >+ "text/plain;charset=US-ASCII", >+ [255]], >+ ["data:\u0000,%FF", >+ "text/plain;charset=US-ASCII", >+ [255]], >+ ["data:%00,%FF", >+ "text/plain;charset=US-ASCII", >+ [255]], >+ ["data:text/html ,X", >+ "text/html", >+ [88]], >+ ["data:text / html,X", >+ "text/plain;charset=US-ASCII", >+ [88]], >+ ["data:â ,X", >+ "text/plain;charset=US-ASCII", >+ [88]], >+ ["data:â /â ,X", >+ "%e2%80%a0/%e2%80%a0", >+ [88]], >+ ["data:X,X", >+ "text/plain;charset=US-ASCII", >+ [88]], >+ ["data:image/png,X X", >+ "image/png", >+ [88, 32, 88]], >+ ["data:application/javascript,X X", >+ "application/javascript", >+ [88, 32, 88]], >+ ["data:application/xml,X X", >+ "application/xml", >+ [88, 32, 88]], >+ ["data:text/javascript,X X", >+ "text/javascript", >+ [88, 32, 88]], >+ ["data:text/plain,X X", >+ "text/plain", >+ [88, 32, 88]], >+ ["data:unknown/unknown,X X", >+ "unknown/unknown", >+ [88, 32, 88]], >+ ["data:text/plain;a=\",\",X", >+ "text/plain;a=\"\"", >+ [34, 44, 88]], >+ ["data:text/plain;a=%2C,X", >+ "text/plain;a=%2C", >+ [88]], >+ ["data:;base64;base64,WA", >+ "text/plain", >+ [88]], >+ ["data:x/x;base64;base64,WA", >+ "x/x", >+ [88]], >+ ["data:x/x;base64;charset=x,WA", >+ "x/x;charset=x", >+ [87, 65]], >+ ["data:x/x;base64;charset=x;base64,WA", >+ "x/x;charset=x", >+ [88]], >+ ["data:x/x;base64;base64x,WA", >+ "x/x", >+ [87, 65]], >+ ["data:;base64,W%20A", >+ "text/plain;charset=US-ASCII", >+ [88]], >+ ["data:;base64,W%0CA", >+ "text/plain;charset=US-ASCII", >+ [88]], >+ ["data:x;base64x,WA", >+ "text/plain;charset=US-ASCII", >+ [87, 65]], >+ ["data:x;base64;x,WA", >+ "text/plain;charset=US-ASCII", >+ [87, 65]], >+ ["data:x;base64=x,WA", >+ "text/plain;charset=US-ASCII", >+ [87, 65]], >+ ["data:; base64,WA", >+ "text/plain;charset=US-ASCII", >+ [88]], >+ ["data:; base64,WA", >+ "text/plain;charset=US-ASCII", >+ [88]], >+ ["data: ;charset=x ; base64,WA", >+ "text/plain;charset=x", >+ [88]], >+ ["data:;base64;,WA", >+ "text/plain", >+ [87, 65]], >+ ["data:;base64 ,WA", >+ "text/plain;charset=US-ASCII", >+ [88]], >+ ["data:;base64 ,WA", >+ "text/plain;charset=US-ASCII", >+ [88]], >+ ["data:;base 64,WA", >+ "text/plain", >+ [87, 65]], >+ ["data:;BASe64,WA", >+ "text/plain;charset=US-ASCII", >+ [88]], >+ ["data:;%62ase64,WA", >+ "text/plain", >+ [87, 65]], >+ ["data:%3Bbase64,WA", >+ "text/plain;charset=US-ASCII", >+ [87, 65]], >+ ["data:;charset=x,X", >+ "text/plain;charset=x", >+ [88]], >+ ["data:; charset=x,X", >+ "text/plain;charset=x", >+ [88]], >+ ["data:;charset =x,X", >+ "text/plain", >+ [88]], >+ ["data:;charset= x,X", >+ "text/plain;charset=\" x\"", >+ [88]], >+ ["data:;charset=,X", >+ "text/plain", >+ [88]], >+ ["data:;charset,X", >+ "text/plain", >+ [88]], >+ ["data:;charset=\"x\",X", >+ "text/plain;charset=x", >+ [88]], >+ ["data:;CHARSET=\"X\",X", >+ "text/plain;charset=X", >+ [88]] >+] >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/data-urls/resources/w3c-import.log b/LayoutTests/imported/w3c/web-platform-tests/fetch/data-urls/resources/w3c-import.log >new file mode 100644 >index 0000000000000000000000000000000000000000..745a9967e53add8c59ba88c6567bd2dc508f2a92 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/data-urls/resources/w3c-import.log >@@ -0,0 +1,18 @@ >+The tests in this directory were imported from the W3C repository. >+Do NOT modify these tests directly in WebKit. >+Instead, create a pull request on the WPT github: >+ https://github.com/web-platform-tests/wpt >+ >+Then run the Tools/Scripts/import-w3c-tests in WebKit to reimport >+ >+Do NOT modify or remove this file. >+ >+------------------------------------------------------------------------ >+Properties requiring vendor prefixes: >+None >+Property values requiring vendor prefixes: >+None >+------------------------------------------------------------------------ >+List of files: >+/LayoutTests/imported/w3c/web-platform-tests/fetch/data-urls/resources/base64.json >+/LayoutTests/imported/w3c/web-platform-tests/fetch/data-urls/resources/data-urls.json >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/data-urls/w3c-import.log b/LayoutTests/imported/w3c/web-platform-tests/fetch/data-urls/w3c-import.log >new file mode 100644 >index 0000000000000000000000000000000000000000..4cd3658a8d301e21561dc9472c79cf49ac2956bb >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/data-urls/w3c-import.log >@@ -0,0 +1,19 @@ >+The tests in this directory were imported from the W3C repository. >+Do NOT modify these tests directly in WebKit. >+Instead, create a pull request on the WPT github: >+ https://github.com/web-platform-tests/wpt >+ >+Then run the Tools/Scripts/import-w3c-tests in WebKit to reimport >+ >+Do NOT modify or remove this file. >+ >+------------------------------------------------------------------------ >+Properties requiring vendor prefixes: >+None >+Property values requiring vendor prefixes: >+None >+------------------------------------------------------------------------ >+List of files: >+/LayoutTests/imported/w3c/web-platform-tests/fetch/data-urls/README.md >+/LayoutTests/imported/w3c/web-platform-tests/fetch/data-urls/base64.any.js >+/LayoutTests/imported/w3c/web-platform-tests/fetch/data-urls/processing.any.js >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/http-cache/304-update-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/http-cache/304-update-expected.txt >index f0ffd9d80ccd0817e0b33c7a501473403d703c47..78159206e6725ca8967ba03b609dedb5bfd2e011 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/http-cache/304-update-expected.txt >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/http-cache/304-update-expected.txt >@@ -1,6 +1,7 @@ > >-PASS HTTP cache updates returned headers from a Last-Modified 304. >-PASS HTTP cache updates stored headers from a Last-Modified 304. >-PASS HTTP cache updates returned headers from a ETag 304. >-PASS HTTP cache updates stored headers from a ETag 304. >+PASS HTTP cache updates returned headers from a Last-Modified 304 >+PASS HTTP cache updates stored headers from a Last-Modified 304 >+PASS HTTP cache updates returned headers from a ETag 304 >+PASS HTTP cache updates stored headers from a ETag 304 >+FAIL Content-* header assert_equals: Response 2 header Content-Test-Header is "A", not "B" expected "B" but got "A" > >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/http-cache/304-update.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/http-cache/304-update.html >index 663191a8785721ab9762c1285fb0fe0cfc4845ac..d6d8481e87427816113397bbed49f30b3e43c336 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/http-cache/304-update.html >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/http-cache/304-update.html >@@ -4,6 +4,7 @@ > <meta charset="utf-8"> > <title>HTTP Cache - 304 Updates</title> > <meta name="help" href="https://fetch.spec.whatwg.org/#request"> >+ <meta name="timeout" content="long"> > <script src="/resources/testharness.js"></script> > <script src="/resources/testharnessreport.js"></script> > <script src="/common/utils.js"></script> >@@ -14,19 +15,19 @@ > <script> > var tests = [ > { >- name: 'HTTP cache updates returned headers from a Last-Modified 304.', >+ name: "HTTP cache updates returned headers from a Last-Modified 304", > requests: [ > { > response_headers: [ >- ["Expires", http_date(-5000)], >- ["Last-Modified", http_date(-3000)], >+ ["Expires", -5000], >+ ["Last-Modified", -3000], > ["Test-Header", "A"] > ] > }, > { > response_headers: [ >- ["Expires", http_date(-3000)], >- ["Last-Modified", http_date(-3000)], >+ ["Expires", -3000], >+ ["Last-Modified", -3000], > ["Test-Header", "B"] > ], > expected_type: "lm_validated", >@@ -37,25 +38,26 @@ > ] > }, > { >- name: 'HTTP cache updates stored headers from a Last-Modified 304.', >+ name: "HTTP cache updates stored headers from a Last-Modified 304", > requests: [ > { > response_headers: [ >- ["Expires", http_date(-5000)], >- ["Last-Modified", http_date(-3000)], >+ ["Expires", -5000], >+ ["Last-Modified", -3000], > ["Test-Header", "A"] > ] > }, > { > response_headers: [ >- ["Expires", http_date(3000)], >- ["Last-Modified", http_date(-3000)], >+ ["Expires", 3000], >+ ["Last-Modified", -3000], > ["Test-Header", "B"] > ], > expected_type: "lm_validated", > expected_response_headers: [ > ["Test-Header", "B"] >- ] >+ ], >+ pause_after: true > }, > { > expected_type: "cached", >@@ -66,18 +68,18 @@ > ] > }, > { >- name: 'HTTP cache updates returned headers from a ETag 304.', >+ name: "HTTP cache updates returned headers from a ETag 304", > requests: [ > { > response_headers: [ >- ["Expires", http_date(-5000)], >+ ["Expires", -5000], > ["ETag", "ABC"], > ["Test-Header", "A"] > ] > }, > { > response_headers: [ >- ["Expires", http_date(-3000)], >+ ["Expires", -3000], > ["ETag", "ABC"], > ["Test-Header", "B"] > ], >@@ -89,25 +91,26 @@ > ] > }, > { >- name: 'HTTP cache updates stored headers from a ETag 304.', >+ name: "HTTP cache updates stored headers from a ETag 304", > requests: [ > { > response_headers: [ >- ["Expires", http_date(-5000)], >+ ["Expires", -5000], > ["ETag", "DEF"], > ["Test-Header", "A"] > ] > }, > { > response_headers: [ >- ["Expires", http_date(3000)], >+ ["Expires", 3000], > ["ETag", "DEF"], > ["Test-Header", "B"] > ], > expected_type: "etag_validated", > expected_response_headers: [ > ["Test-Header", "B"] >- ] >+ ], >+ pause_after: true > }, > { > expected_type: "cached", >@@ -117,6 +120,36 @@ > } > ] > }, >+ { >+ name: "Content-* header", >+ requests: [ >+ { >+ response_headers: [ >+ ["Expires", -5000], >+ ["ETag", "GHI"], >+ ["Content-Test-Header", "A"] >+ ] >+ }, >+ { >+ response_headers: [ >+ ["Expires", 3000], >+ ["ETag", "GHI"], >+ ["Content-Test-Header", "B"] >+ ], >+ expected_type: "etag_validated", >+ expected_response_headers: [ >+ ["Content-Test-Header", "B"] >+ ], >+ pause_after: true >+ }, >+ { >+ expected_type: "cached", >+ expected_response_headers: [ >+ ["Content-Test-Header", "B"] >+ ] >+ } >+ ] >+ }, > ]; > run_tests(tests); > </script> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/http-cache/README.md b/LayoutTests/imported/w3c/web-platform-tests/fetch/http-cache/README.md >index 288672236c1d82b26795a6ae18aad0614782b3f5..a32d500a7ef07f8536e7cf508dd45a6117472b0b 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/http-cache/README.md >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/http-cache/README.md >@@ -22,3 +22,50 @@ A few notes: > > * At the moment, Edge doesn't appear to using HTTP caching in conjunction > with Fetch at all. >+ >+ >+## Test Format >+ >+Each test run gets its own URL and randomized content and operates independently. >+ >+Each test is an an array of objects, with the following members: >+ >+- `name` - The name of the test. >+- `requests` - a list of request objects (see below). >+ >+Possible members of a request object: >+ >+- template - A template object for the request, by name. >+- request_method - A string containing the HTTP method to be used. >+- request_headers - An array of `[header_name_string, header_value_string]` arrays to >+ emit in the request. >+- request_body - A string to use as the request body. >+- mode - The mode string to pass to `fetch()`. >+- credentials - The credentials string to pass to `fetch()`. >+- cache - The cache string to pass to `fetch()`. >+- pause_after - Boolean controlling a 3-second pause after the request completes. >+- response_status - A `[number, string]` array containing the HTTP status code >+ and phrase to return. >+- response_headers - An array of `[header_name_string, header_value_string]` arrays to >+ emit in the response. These values will also be checked like >+ expected_response_headers, unless there is a third value that is >+ `false`. See below for special handling considerations. >+- response_body - String to send as the response body. If not set, it will contain >+ the test identifier. >+- expected_type - One of `["cached", "not_cached", "lm_validate", "etag_validate", "error"]` >+- expected_status - A number representing a HTTP status code to check the response for. >+ If not set, the value of `response_status[0]` will be used; if that >+ is not set, 200 will be used. >+- expected_request_headers - An array of `[header_name_string, header_value_string]` representing >+ headers to check the request for. >+- expected_response_headers - An array of `[header_name_string, header_value_string]` representing >+ headers to check the response for. See also response_headers. >+- expected_response_text - A string to check the response body against. If not present, `response_body` will be checked if present and non-null; otherwise the response body will be checked for the test uuid (unless the status code disallows a body). Set to `null` to disable all response body checking. >+ >+Some headers in `response_headers` are treated specially: >+ >+* For date-carrying headers, if the value is a number, it will be interpreted as a delta to the time of the first request at the server. >+* For URL-carrying headers, the value will be appended as a query parameter for `target`. >+ >+See the source for exact details. >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/http-cache/basic-auth-cache-test-expected.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/http-cache/basic-auth-cache-test-expected.html >new file mode 100644 >index 0000000000000000000000000000000000000000..905facdc8883bd1f1b20b3d9d05ba074270ddec0 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/http-cache/basic-auth-cache-test-expected.html >@@ -0,0 +1,6 @@ >+<!doctype html> >+<html> >+ <meta charset="utf-8"> >+ <img src="/images/green.png"> >+ <img src="/images/green.png"> >+</html> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/http-cache/basic-auth-cache-test.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/http-cache/basic-auth-cache-test.html >new file mode 100644 >index 0000000000000000000000000000000000000000..a8979baf548dc80747643f73bc7832bd7f71f9b1 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/http-cache/basic-auth-cache-test.html >@@ -0,0 +1,27 @@ >+<!doctype html> >+<html id="doc" class="reftest-wait"> >+ <meta charset="utf-8"> >+ <link rel="match" href="basic-auth-cache-test-ref.html"> >+ >+ <img id="auth" onload="loadNoAuth()"> >+ <img id="noauth" onload="removeWait()"> >+ >+ >+ <script type="text/javascript"> >+ function loadAuth() { >+ var authUrl = 'http://testuser:testpass@' + window.location.host + '/fetch/http-cache/resources/securedimage.py'; >+ document.getElementById('auth').src = authUrl; >+ } >+ >+ function loadNoAuth() { >+ var noAuthUrl = 'http://' + window.location.host + '/fetch/http-cache/resources/securedimage.py'; >+ document.getElementById('noauth').src = noAuthUrl; >+ } >+ >+ function removeWait() { >+ document.getElementById('doc').className = ""; >+ } >+ >+ window.onload = loadAuth; >+ </script> >+</html> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/http-cache/cc-request-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/http-cache/cc-request-expected.txt >index 9c1ea17235eeebc77a8efca1731a51201de3f98d..2e411cb818c85d3a111ed979bedfdfc1a9b88ff5 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/http-cache/cc-request-expected.txt >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/http-cache/cc-request-expected.txt >@@ -1,14 +1,14 @@ > >-PASS HTTP cache doesn't use aged but fresh response when request contains Cache-Control: max-age=0. >-FAIL HTTP cache doesn't use aged but fresh response when request contains Cache-Control: max-age=1. assert_equals: Response used expected 2 but got 1 >-FAIL HTTP cache doesn't use fresh response with Age header when request contains Cache-Control: max-age that is greater than remaining freshness. assert_equals: Response used expected 2 but got 1 >-PASS HTTP cache does use aged stale response when request contains Cache-Control: max-stale that permits its use. >-PASS HTTP cache does reuse stale response with Age header when request contains Cache-Control: max-stale that permits its use. >-FAIL HTTP cache doesn't reuse fresh response when request contains Cache-Control: min-fresh that wants it fresher. assert_equals: Response used expected 2 but got 1 >-FAIL HTTP cache doesn't reuse fresh response with Age header when request contains Cache-Control: min-fresh that wants it fresher. assert_equals: Response used expected 2 but got 1 >-PASS HTTP cache doesn't reuse fresh response when request contains Cache-Control: no-cache. >-PASS HTTP cache validates fresh response with Last-Modified when request contains Cache-Control: no-cache. >-PASS HTTP cache validates fresh response with ETag when request contains Cache-Control: no-cache. >-FAIL HTTP cache doesn't reuse fresh response when request contains Cache-Control: no-store. assert_equals: Response used expected 2 but got 1 >-FAIL HTTP cache generates 504 status code when nothing is in cache and request contains Cache-Control: only-if-cached. promise_test: Unhandled rejection with value: object "TypeError: canât load from network" >+PASS HTTP cache doesn't use aged but fresh response when request contains Cache-Control: max-age=0 >+FAIL HTTP cache doesn't use aged but fresh response when request contains Cache-Control: max-age=1 assert_equals: Response 2 comes from cache expected 2 but got 1 >+FAIL HTTP cache doesn't use fresh response with Age header when request contains Cache-Control: max-age that is greater than remaining freshness assert_equals: Response 2 comes from cache expected 2 but got 1 >+PASS HTTP cache does use aged stale response when request contains Cache-Control: max-stale that permits its use >+PASS HTTP cache does reuse stale response with Age header when request contains Cache-Control: max-stale that permits its use >+FAIL HTTP cache doesn't reuse fresh response when request contains Cache-Control: min-fresh that wants it fresher assert_equals: Response 2 comes from cache expected 2 but got 1 >+FAIL HTTP cache doesn't reuse fresh response with Age header when request contains Cache-Control: min-fresh that wants it fresher assert_equals: Response 2 comes from cache expected 2 but got 1 >+PASS HTTP cache doesn't reuse fresh response when request contains Cache-Control: no-cache >+PASS HTTP cache validates fresh response with Last-Modified when request contains Cache-Control: no-cache >+PASS HTTP cache validates fresh response with ETag when request contains Cache-Control: no-cache >+FAIL HTTP cache doesn't reuse fresh response when request contains Cache-Control: no-store assert_equals: Response 2 comes from cache expected 2 but got 1 >+FAIL HTTP cache generates 504 status code when nothing is in cache and request contains Cache-Control: only-if-cached promise_test: Unhandled rejection with value: object "TypeError: canât load from network" > >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/http-cache/cc-request.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/http-cache/cc-request.html >index 6ea8fbc92fd748106c6ba088502525f59750f273..e732683d7de1cb914e687e25b902a34e5e462c0c 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/http-cache/cc-request.html >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/http-cache/cc-request.html >@@ -15,7 +15,7 @@ > <script> > var tests = [ > { >- name: "HTTP cache doesn't use aged but fresh response when request contains Cache-Control: max-age=0.", >+ name: "HTTP cache doesn't use aged but fresh response when request contains Cache-Control: max-age=0", > requests: [ > { > template: "fresh", >@@ -25,12 +25,12 @@ > request_headers: [ > ["Cache-Control", "max-age=0"] > ], >- expected_type: "not_cached", >+ expected_type: "not_cached" > } > ] > }, > { >- name: "HTTP cache doesn't use aged but fresh response when request contains Cache-Control: max-age=1.", >+ name: "HTTP cache doesn't use aged but fresh response when request contains Cache-Control: max-age=1", > requests: [ > { > template: "fresh", >@@ -40,12 +40,12 @@ > request_headers: [ > ["Cache-Control", "max-age=1"] > ], >- expected_type: "not_cached", >+ expected_type: "not_cached" > } > ] > }, > { >- name: "HTTP cache doesn't use fresh response with Age header when request contains Cache-Control: max-age that is greater than remaining freshness.", >+ name: "HTTP cache doesn't use fresh response with Age header when request contains Cache-Control: max-age that is greater than remaining freshness", > requests: [ > { > response_headers: [ >@@ -57,12 +57,12 @@ > request_headers: [ > ["Cache-Control", "max-age=600"] > ], >- expected_type: "not_cached", >+ expected_type: "not_cached" > } > ] > }, > { >- name: "HTTP cache does use aged stale response when request contains Cache-Control: max-stale that permits its use.", >+ name: "HTTP cache does use aged stale response when request contains Cache-Control: max-stale that permits its use", > requests: [ > { > response_headers: [ >@@ -74,12 +74,12 @@ > request_headers: [ > ["Cache-Control", "max-stale=1000"] > ], >- expected_type: "cached", >+ expected_type: "cached" > } > ] > }, > { >- name: "HTTP cache does reuse stale response with Age header when request contains Cache-Control: max-stale that permits its use.", >+ name: "HTTP cache does reuse stale response with Age header when request contains Cache-Control: max-stale that permits its use", > requests: [ > { > response_headers: [ >@@ -91,12 +91,12 @@ > request_headers: [ > ["Cache-Control", "max-stale=1000"] > ], >- expected_type: "cached", >+ expected_type: "cached" > } > ] > }, > { >- name: "HTTP cache doesn't reuse fresh response when request contains Cache-Control: min-fresh that wants it fresher.", >+ name: "HTTP cache doesn't reuse fresh response when request contains Cache-Control: min-fresh that wants it fresher", > requests: [ > { > response_headers: [ >@@ -107,12 +107,12 @@ > request_headers: [ > ["Cache-Control", "min-fresh=2000"] > ], >- expected_type: "not_cached", >+ expected_type: "not_cached" > } > ] > }, > { >- name: "HTTP cache doesn't reuse fresh response with Age header when request contains Cache-Control: min-fresh that wants it fresher.", >+ name: "HTTP cache doesn't reuse fresh response with Age header when request contains Cache-Control: min-fresh that wants it fresher", > requests: [ > { > response_headers: [ >@@ -124,45 +124,45 @@ > request_headers: [ > ["Cache-Control", "min-fresh=1000"] > ], >- expected_type: "not_cached", >+ expected_type: "not_cached" > } > ] > }, > { >- name: "HTTP cache doesn't reuse fresh response when request contains Cache-Control: no-cache.", >+ name: "HTTP cache doesn't reuse fresh response when request contains Cache-Control: no-cache", > requests: [ > { > response_headers: [ >- ["Cache-Control", "max-age=3600"], >+ ["Cache-Control", "max-age=3600"] > ] > }, > { > request_headers: [ > ["Cache-Control", "no-cache"] > ], >- expected_type: "not_cached", >+ expected_type: "not_cached" > } > ] > }, > { >- name: "HTTP cache validates fresh response with Last-Modified when request contains Cache-Control: no-cache.", >+ name: "HTTP cache validates fresh response with Last-Modified when request contains Cache-Control: no-cache", > requests: [ > { > response_headers: [ > ["Cache-Control", "max-age=3600"], >- ["Last-Modified", http_date(-10000)] >+ ["Last-Modified", -10000] > ] > }, > { > request_headers: [ > ["Cache-Control", "no-cache"] > ], >- expected_type: "lm_validate", >+ expected_type: "lm_validate" > } > ] > }, > { >- name: "HTTP cache validates fresh response with ETag when request contains Cache-Control: no-cache.", >+ name: "HTTP cache validates fresh response with ETag when request contains Cache-Control: no-cache", > requests: [ > { > response_headers: [ >@@ -174,35 +174,35 @@ > request_headers: [ > ["Cache-Control", "no-cache"] > ], >- expected_type: "etag_validate", >+ expected_type: "etag_validate" > } > ] > }, > { >- name: "HTTP cache doesn't reuse fresh response when request contains Cache-Control: no-store.", >+ name: "HTTP cache doesn't reuse fresh response when request contains Cache-Control: no-store", > requests: [ > { > response_headers: [ >- ["Cache-Control", "max-age=3600"], >+ ["Cache-Control", "max-age=3600"] > ] > }, > { > request_headers: [ > ["Cache-Control", "no-store"] > ], >- expected_type: "not_cached", >+ expected_type: "not_cached" > } > ] > }, > { >- name: 'HTTP cache generates 504 status code when nothing is in cache and request contains Cache-Control: only-if-cached.', >+ name: "HTTP cache generates 504 status code when nothing is in cache and request contains Cache-Control: only-if-cached", > requests: [ > { > request_headers: [ > ["Cache-Control", "only-if-cached"] > ], > expected_status: 504, >- expected_response_text: "" >+ expected_response_text: null > } > ] > } >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/http-cache/freshness-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/http-cache/freshness-expected.txt >index c527d5a8f7f417d82d1896736e59454078fd5a4a..cf5346b799ed05dda202e6aed7171cd4212901a0 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/http-cache/freshness-expected.txt >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/http-cache/freshness-expected.txt >@@ -1,17 +1,17 @@ > >-PASS HTTP cache reuses a response with a future Expires. >-PASS HTTP cache does not reuse a response with a past Expires. >-PASS HTTP cache does not reuse a response with a present Expires. >-PASS HTTP cache does not reuse a response with an invalid Expires. >-PASS HTTP cache reuses a response with positive Cache-Control: max-age. >-PASS HTTP cache does not reuse a response with Cache-Control: max-age=0. >-PASS HTTP cache reuses a response with positive Cache-Control: max-age and a past Expires. >-PASS HTTP cache reuses a response with positive Cache-Control: max-age and an invalid Expires. >-PASS HTTP cache does not reuse a response with Cache-Control: max-age=0 and a future Expires. >-PASS HTTP cache does not prefer Cache-Control: s-maxage over Cache-Control: max-age. >-PASS HTTP cache does not reuse a response when the Age header is greater than its freshness lifetime. >-PASS HTTP cache does not store a response with Cache-Control: no-store. >-PASS HTTP cache does not store a response with Cache-Control: no-store, even with max-age and Expires. >-PASS HTTP cache stores a response with Cache-Control: no-cache, but revalidates upon use. >-PASS HTTP cache stores a response with Cache-Control: no-cache, but revalidates upon use, even with max-age and Expires. >+PASS HTTP cache reuses a response with a future Expires >+PASS HTTP cache does not reuse a response with a past Expires >+PASS HTTP cache does not reuse a response with a present Expires >+PASS HTTP cache does not reuse a response with an invalid Expires >+PASS HTTP cache reuses a response with positive Cache-Control: max-age >+PASS HTTP cache does not reuse a response with Cache-Control: max-age=0 >+PASS HTTP cache reuses a response with positive Cache-Control: max-age and a past Expires >+PASS HTTP cache reuses a response with positive Cache-Control: max-age and an invalid Expires >+PASS HTTP cache does not reuse a response with Cache-Control: max-age=0 and a future Expires >+PASS HTTP cache does not prefer Cache-Control: s-maxage over Cache-Control: max-age >+PASS HTTP cache does not reuse a response when the Age header is greater than its freshness lifetime >+PASS HTTP cache does not store a response with Cache-Control: no-store >+PASS HTTP cache does not store a response with Cache-Control: no-store, even with max-age and Expires >+PASS HTTP cache stores a response with Cache-Control: no-cache, but revalidates upon use >+PASS HTTP cache stores a response with Cache-Control: no-cache, but revalidates upon use, even with max-age and Expires > >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/http-cache/freshness.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/http-cache/freshness.html >index e15d1b42c92aa48474beda74e88f9eb24ec2c3b8..38a457cbebab6c5ac6d48beb9c18a854e1ea8cbb 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/http-cache/freshness.html >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/http-cache/freshness.html >@@ -16,46 +16,46 @@ > var tests = [ > // response directives > { >- name: 'HTTP cache reuses a response with a future Expires.', >+ name: "HTTP cache reuses a response with a future Expires", > requests: [ > { > response_headers: [ >- ["Expires", http_date(30*24*60*60)] >+ ["Expires", (30 * 24 * 60 * 60)] > ] > }, > { >- expected_type: "cached", >+ expected_type: "cached" > } > ] > }, > { >- name: 'HTTP cache does not reuse a response with a past Expires.', >+ name: "HTTP cache does not reuse a response with a past Expires", > requests: [ > { > response_headers: [ >- ["Expires", http_date(-30*24*60*60)] >+ ["Expires", (-30 * 24 * 60 * 60)] > ] > }, > { >- expected_type: "not_cached", >+ expected_type: "not_cached" > } > ] > }, > { >- name: 'HTTP cache does not reuse a response with a present Expires.', >+ name: "HTTP cache does not reuse a response with a present Expires", > requests: [ > { > response_headers: [ >- ["Expires", http_date(0)] >+ ["Expires", 0] > ] > }, > { >- expected_type: "not_cached", >+ expected_type: "not_cached" > } > ] > }, > { >- name: 'HTTP cache does not reuse a response with an invalid Expires.', >+ name: "HTTP cache does not reuse a response with an invalid Expires", > requests: [ > { > response_headers: [ >@@ -63,12 +63,12 @@ > ] > }, > { >- expected_type: "not_cached", >+ expected_type: "not_cached" > } > ] > }, > { >- name: 'HTTP cache reuses a response with positive Cache-Control: max-age.', >+ name: "HTTP cache reuses a response with positive Cache-Control: max-age", > requests: [ > { > response_headers: [ >@@ -76,12 +76,12 @@ > ] > }, > { >- expected_type: "cached", >+ expected_type: "cached" > } > ] > }, > { >- name: 'HTTP cache does not reuse a response with Cache-Control: max-age=0.', >+ name: "HTTP cache does not reuse a response with Cache-Control: max-age=0", > requests: [ > { > response_headers: [ >@@ -89,54 +89,54 @@ > ] > }, > { >- expected_type: "not_cached", >+ expected_type: "not_cached" > } > ] > }, > { >- name: 'HTTP cache reuses a response with positive Cache-Control: max-age and a past Expires.', >+ name: "HTTP cache reuses a response with positive Cache-Control: max-age and a past Expires", > requests: [ > { > response_headers: [ > ["Cache-Control", "max-age=3600"], >- ['Expires', http_date(-10000)] >+ ["Expires", -10000] > ] > }, > { >- expected_type: "cached", >+ expected_type: "cached" > } > ] > }, > { >- name: 'HTTP cache reuses a response with positive Cache-Control: max-age and an invalid Expires.', >+ name: "HTTP cache reuses a response with positive Cache-Control: max-age and an invalid Expires", > requests: [ > { > response_headers: [ > ["Cache-Control", "max-age=3600"], >- ['Expires', '0'] >+ ["Expires", "0"] > ] > }, > { >- expected_type: "cached", >+ expected_type: "cached" > } > ] > }, > { >- name: 'HTTP cache does not reuse a response with Cache-Control: max-age=0 and a future Expires.', >+ name: "HTTP cache does not reuse a response with Cache-Control: max-age=0 and a future Expires", > requests: [ > { > response_headers: [ > ["Cache-Control", "max-age=0"], >- ['Expires', http_date(10000)] >+ ["Expires", 10000] > ] > }, > { >- expected_type: "not_cached", >+ expected_type: "not_cached" > } > ] > }, > { >- name: 'HTTP cache does not prefer Cache-Control: s-maxage over Cache-Control: max-age.', >+ name: "HTTP cache does not prefer Cache-Control: s-maxage over Cache-Control: max-age", > requests: [ > { > response_headers: [ >@@ -145,12 +145,12 @@ > pause_after: true, > }, > { >- expected_type: "not_cached", >+ expected_type: "not_cached" > } > ] > }, > { >- name: 'HTTP cache does not reuse a response when the Age header is greater than its freshness lifetime.', >+ name: "HTTP cache does not reuse a response when the Age header is greater than its freshness lifetime", > requests: [ > { > response_headers: [ >@@ -159,12 +159,12 @@ > ], > }, > { >- expected_type: "not_cached", >+ expected_type: "not_cached" > } > ] > }, > { >- name: 'HTTP cache does not store a response with Cache-Control: no-store.', >+ name: "HTTP cache does not store a response with Cache-Control: no-store", > requests: [ > { > response_headers: [ >@@ -172,50 +172,50 @@ > ] > }, > { >- expected_type: "not_cached", >+ expected_type: "not_cached" > } > ] > }, > { >- name: 'HTTP cache does not store a response with Cache-Control: no-store, even with max-age and Expires.', >+ name: "HTTP cache does not store a response with Cache-Control: no-store, even with max-age and Expires", > requests: [ > { > response_headers: [ > ["Cache-Control", "max-age=10000, no-store"], >- ['Expires', http_date(10000)] >+ ["Expires", 10000] > ] > }, > { >- expected_type: "not_cached", >+ expected_type: "not_cached" > } > ] > }, > { >- name: 'HTTP cache stores a response with Cache-Control: no-cache, but revalidates upon use.', >+ name: "HTTP cache stores a response with Cache-Control: no-cache, but revalidates upon use", > requests: [ > { > response_headers: [ > ["Cache-Control", "no-cache"], >- ['ETag', 'abcd'] >+ ["ETag", "abcd"] > ] > }, > { >- expected_type: "etag_validated", >+ expected_type: "etag_validated" > } > ] > }, > { >- name: 'HTTP cache stores a response with Cache-Control: no-cache, but revalidates upon use, even with max-age and Expires.', >+ name: "HTTP cache stores a response with Cache-Control: no-cache, but revalidates upon use, even with max-age and Expires", > requests: [ > { > response_headers: [ > ["Cache-Control", "max-age=10000, no-cache"], >- ['Expires', http_date(10000)], >- ['ETag', 'abcd'] >+ ["Expires", 10000], >+ ["ETag", "abcd"] > ] > }, > { >- expected_type: "etag_validated", >+ expected_type: "etag_validated" > } > ] > }, >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/http-cache/heuristic-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/http-cache/heuristic-expected.txt >index e31dc278655cc4bde44ad6ad18e1286170964851..c1a0f41e74cf7d588019607d49b74ffa38470537 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/http-cache/heuristic-expected.txt >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/http-cache/heuristic-expected.txt >@@ -1,18 +1,18 @@ > >-FAIL HTTP cache reuses an unknown response with Last-Modified based upon heuristic freshness when Cache-Control: public is present. assert_less_than: Response used expected a number less than 2 but got 2 >-PASS HTTP cache does not reuse an unknown response with Last-Modified based upon heuristic freshness when Cache-Control: public is not present. >-PASS HTTP cache reuses a 200 OK response with Last-Modified based upon heuristic freshness. >-PASS HTTP cache reuses a 203 Non-Authoritative Information response with Last-Modified based upon heuristic freshness. >-PASS HTTP cache reuses a 204 No Content response with Last-Modified based upon heuristic freshness. >-PASS HTTP cache reuses a 404 Not Found response with Last-Modified based upon heuristic freshness. >-PASS HTTP cache reuses a 405 Method Not Allowed response with Last-Modified based upon heuristic freshness. >-PASS HTTP cache reuses a 410 Gone response with Last-Modified based upon heuristic freshness. >-PASS HTTP cache reuses a 414 URI Too Long response with Last-Modified based upon heuristic freshness. >-PASS HTTP cache reuses a 501 Not Implemented response with Last-Modified based upon heuristic freshness. >-PASS HTTP cache does not use a 201 Created response with Last-Modified based upon heuristic freshness. >-PASS HTTP cache does not use a 202 Accepted response with Last-Modified based upon heuristic freshness. >-PASS HTTP cache does not use a 403 Forbidden response with Last-Modified based upon heuristic freshness. >-PASS HTTP cache does not use a 502 Bad Gateway response with Last-Modified based upon heuristic freshness. >-PASS HTTP cache does not use a 503 Service Unavailable response with Last-Modified based upon heuristic freshness. >-PASS HTTP cache does not use a 504 Gateway Timeout response with Last-Modified based upon heuristic freshness. >+FAIL HTTP cache reuses an unknown response with Last-Modified based upon heuristic freshness when Cache-Control: public is present assert_less_than: Response 2 does not come from cache expected a number less than 2 but got 2 >+PASS HTTP cache does not reuse an unknown response with Last-Modified based upon heuristic freshness when Cache-Control: public is not present >+PASS HTTP cache reuses a 200 OK response with Last-Modified based upon heuristic freshness >+PASS HTTP cache reuses a 203 Non-Authoritative Information response with Last-Modified based upon heuristic freshness >+PASS HTTP cache reuses a 204 No Content response with Last-Modified based upon heuristic freshness >+PASS HTTP cache reuses a 404 Not Found response with Last-Modified based upon heuristic freshness >+PASS HTTP cache reuses a 405 Method Not Allowed response with Last-Modified based upon heuristic freshness >+PASS HTTP cache reuses a 410 Gone response with Last-Modified based upon heuristic freshness >+PASS HTTP cache reuses a 414 URI Too Long response with Last-Modified based upon heuristic freshness >+PASS HTTP cache reuses a 501 Not Implemented response with Last-Modified based upon heuristic freshness >+PASS HTTP cache does not use a 201 Created response with Last-Modified based upon heuristic freshness >+PASS HTTP cache does not use a 202 Accepted response with Last-Modified based upon heuristic freshness >+PASS HTTP cache does not use a 403 Forbidden response with Last-Modified based upon heuristic freshness >+PASS HTTP cache does not use a 502 Bad Gateway response with Last-Modified based upon heuristic freshness >+PASS HTTP cache does not use a 503 Service Unavailable response with Last-Modified based upon heuristic freshness >+PASS HTTP cache does not use a 504 Gateway Timeout response with Last-Modified based upon heuristic freshness > >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/http-cache/heuristic.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/http-cache/heuristic.html >index 81deb1d06884dcdc476a75d665eb49c2b65a7735..c2333cd9f05cf096bdddb7a4c9d560125bcb2de6 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/http-cache/heuristic.html >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/http-cache/heuristic.html >@@ -15,32 +15,32 @@ > <script> > var tests = [ > { >- name: 'HTTP cache reuses an unknown response with Last-Modified based upon heuristic freshness when Cache-Control: public is present.', >+ name: "HTTP cache reuses an unknown response with Last-Modified based upon heuristic freshness when Cache-Control: public is present", > requests: [ > { > response_status: [299, "Whatever"], > response_headers: [ >- ['Last-Modified', http_date(-3 * 100)], >- ['Cache-Control', 'public'] >+ ["Last-Modified", (-3 * 100)], >+ ["Cache-Control", "public"] > ], > }, > { > expected_type: "cached", >- response_status: [299, "Whatever"], >+ response_status: [299, "Whatever"] > } > ] > }, > { >- name: 'HTTP cache does not reuse an unknown response with Last-Modified based upon heuristic freshness when Cache-Control: public is not present.', >+ name: "HTTP cache does not reuse an unknown response with Last-Modified based upon heuristic freshness when Cache-Control: public is not present", > requests: [ > { > response_status: [299, "Whatever"], > response_headers: [ >- ['Last-Modified', http_date(-3 * 100)] >+ ["Last-Modified", (-3 * 100)] > ], > }, > { >- expected_type: "not_cached", >+ expected_type: "not_cached" > } > ] > } >@@ -62,26 +62,26 @@ > } > tests.push( > { >- name: 'HTTP cache ' + desired + ' a ' + code + ' ' + phrase + ' response with Last-Modified based upon heuristic freshness.', >+ name: "HTTP cache " + desired + " a " + code + " " + phrase + " response with Last-Modified based upon heuristic freshness", > requests: [ > { > response_status: [code, phrase], > response_headers: [ >- ['Last-Modified', http_date(-3 * 100)] >+ ["Last-Modified", (-3 * 100)] > ], >- response_body: body, >+ response_body: body > }, > { > expected_type: expected_type, > response_status: [code, phrase], >- response_body: body, >+ response_body: body > } > ] > } > ) > } > [ >- [true, 200, 'OK'], >+ [true, 200, "OK"], > [true, 203, "Non-Authoritative Information"], > [true, 204, "No Content", ""], > [true, 404, "Not Found"], >@@ -91,7 +91,7 @@ > [true, 501, "Not Implemented"] > ].forEach(check_status); > [ >- [false, 201, 'Created'], >+ [false, 201, "Created"], > [false, 202, "Accepted"], > [false, 403, "Forbidden"], > [false, 502, "Bad Gateway"], >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/http-cache/http-cache.js b/LayoutTests/imported/w3c/web-platform-tests/fetch/http-cache/http-cache.js >index afe008959cabcc7345faf14798ff5ff54728b120..3f4a2e7ed7fcc216fbc130de294eb045333ed9d5 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/http-cache/http-cache.js >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/http-cache/http-cache.js >@@ -1,285 +1,259 @@ >-/** >- * Each test run gets its own URL and randomized content and operates independently. >- * >- * Tests are an array of objects, each representing a request to make and check. >- * The cache.py server script stashes an entry containing observed headers for >- * each request it receives. When the test fetches have run, this state is retrieved >- * and the expected_* lists are checked, including their length. >- * >- * Request object keys: >- * - template - A template object for the request, by name -- see "templates" below. >- * - request_method - A string containing the HTTP method to be used. >- * - request_headers - An array of [header_name_string, header_value_string] arrays to >- * emit in the request. >- * - request_body - A string to use as the request body. >- * - mode - The mode string to pass to fetch(). >- * - credentials - The credentials string to pass to fetch(). >- * - cache - The cache string to pass to fetch(). >- * - pause_after - Boolean controlling a 3-second pause after the request completes. >- * - response_status - A [number, string] array containing the HTTP status code >- * and phrase to return. >- * - response_headers - An array of [header_name_string, header_value_string] arrays to >- * emit in the response. These values will also be checked like >- * expected_response_headers, unless there is a third value that is >- * false. >- * - response_body - String to send as the response body. If not set, it will contain >- * the test identifier. >- * - expected_type - One of ["cached", "not_cached", "lm_validate", "etag_validate", "error"] >- * - expected_status - A number representing a HTTP status code to check the response for. >- * If not set, the value of response_status[0] will be used; if that >- * is not set, 200 will be used. >- * - expected_request_headers - An array of [header_name_string, header_value_string] representing >- * headers to check the request for. >- * - expected_response_headers - An array of [header_name_string, header_value_string] representing >- * headers to check the response for. See also response_headers. >- * - expected_response_text - A string to check the response body against. >- */ >+/* global btoa fetch token promise_test step_timeout */ >+/* global assert_equals assert_true assert_own_property assert_throws assert_less_than */ > >-function make_url(uuid, requests, idx) { >- var arg = ""; >- if ("query_arg" in requests[idx]) { >- arg = "&target=" + requests[idx].query_arg; >- } >- return "resources/http-cache.py?token=" + uuid + "&info=" + btoa(JSON.stringify(requests)) + arg; >-} >- >-function server_state(uuid) { >- return fetch("resources/http-cache.py?querystate&token=" + uuid) >- .then(function(response) { >- return response.text(); >- }).then(function(text) { >- // null will be returned if the server never received any requests >- // for the given uuid. Normalize that to an empty list consistent >- // with our representation. >- return JSON.parse(text) || []; >- }); >-} >- >- >-templates = { >- "fresh": { >- "response_headers": [ >- ['Expires', http_date(100000)], >- ['Last-Modified', http_date(0)] >+const templates = { >+ 'fresh': { >+ 'response_headers': [ >+ ['Expires', 100000], >+ ['Last-Modified', 0] > ] > }, >- "stale": { >- "response_headers": [ >- ['Expires', http_date(-5000)], >- ['Last-Modified', http_date(-100000)] >+ 'stale': { >+ 'response_headers': [ >+ ['Expires', -5000], >+ ['Last-Modified', -100000] > ] > }, >- "lcl_response": { >- "response_headers": [ >- ['Location', "location_target"], >- ['Content-Location', "content_location_target"] >+ 'lcl_response': { >+ 'response_headers': [ >+ ['Location', 'location_target'], >+ ['Content-Location', 'content_location_target'] > ] > }, >- "location": { >- "query_arg": "location_target", >- "response_headers": [ >- ['Expires', http_date(100000)], >- ['Last-Modified', http_date(0)] >+ 'location': { >+ 'query_arg': 'location_target', >+ 'response_headers': [ >+ ['Expires', 100000], >+ ['Last-Modified', 0] > ] > }, >- "content_location": { >- "query_arg": "content_location_target", >- "response_headers": [ >- ['Expires', http_date(100000)], >- ['Last-Modified', http_date(0)] >+ 'content_location': { >+ 'query_arg': 'content_location_target', >+ 'response_headers': [ >+ ['Expires', 100000], >+ ['Last-Modified', 0] > ] > } > } > >-function make_test(raw_requests) { >- var requests = []; >- for (var i = 0; i < raw_requests.length; i++) { >- var request = raw_requests[i]; >- if ("template" in request) { >- var template = templates[request["template"]]; >- for (var member in template) { >- if (! request.hasOwnProperty(member)) { >- request[member] = template[member]; >- } >- } >- } >- if ("expected_type" in request && request.expected_type === "cached") { >- // requests after one that's expected to be cached will get out of sync >- // with the server; not currently supported. >- if (raw_requests.length > i + 1) { >- assert_unreached("Making requests after something is expected to be cached."); >- } >- } >- requests.push(request); >- } >- return function(test) { >- var uuid = token(); >- var fetch_functions = []; >- for (var i = 0; i < requests.length; ++i) { >- fetch_functions.push({ >- code: function(idx) { >- var init = {}; >- var url = make_url(uuid, requests, idx); >- var config = requests[idx]; >- if ("request_method" in config) { >- init.method = config["request_method"]; >- } >- if ("request_headers" in config) { >- init.headers = config["request_headers"]; >- } >- if ("request_body" in config) { >- init.body = config["request_body"]; >- } >- if ("mode" in config) { >- init.mode = config["mode"]; >- } >- if ("credentials" in config) { >- init.mode = config["credentials"]; >- } >- if ("cache" in config) { >- init.cache = config["cache"]; >- } >+const noBodyStatus = new Set([204, 304]) >+ >+function makeTest (test) { >+ return function () { >+ var uuid = token() >+ var requests = expandTemplates(test) >+ var fetchFunctions = [] >+ for (let i = 0; i < requests.length; ++i) { >+ fetchFunctions.push({ >+ code: function (idx) { >+ var config = requests[idx] >+ var url = makeTestUrl(uuid, config) >+ var init = fetchInit(requests, config) > return fetch(url, init) >- .then(function(response) { >- var res_num = parseInt(response.headers.get("Server-Request-Count")); >- var req_num = idx + 1; >- if ("expected_type" in config) { >- if (config.expected_type === "error") { >- assert_true(false, "Request " + req_num + " should have been an error"); >- return [response.text(), response_status]; >- } >- if (config.expected_type === "cached") { >- assert_less_than(res_num, req_num, "Response used"); >- } >- if (config.expected_type === "not_cached") { >- assert_equals(res_num, req_num, "Response used"); >- } >- } >- if ("expected_status" in config) { >- assert_equals(response.status, config.expected_status, "Response status"); >- } else if ("response_status" in config) { >- assert_equals(response.status, config.response_status[0], "Response status"); >+ .then(makeCheckResponse(idx, config)) >+ .then(makeCheckResponseBody(config, uuid), function (reason) { >+ if ('expected_type' in config && config.expected_type === 'error') { >+ assert_throws(new TypeError(), function () { throw reason }) > } else { >- assert_equals(response.status, 200, "Response status") >- } >- if ("response_headers" in config) { >- config.response_headers.forEach(function(header) { >- if (header.len < 3 || header[2] === true) { >- assert_equals(response.headers.get(header[0]), header[1], "Response header") >- } >- }) >- } >- if ("expected_response_headers" in config) { >- config.expected_response_headers.forEach(function(header) { >- assert_equals(response.headers.get(header[0]), header[1], "Response header"); >- }); >+ throw reason > } >- return response.text(); >- }).then(function(res_body) { >- if ("expected_response_text" in config) { >- assert_equals(res_body, config.expected_response_text, "Response body"); >- } else if ("response_body" in config) { >- assert_equals(res_body, config.response_body, "Response body"); >- } else { >- assert_equals(res_body, uuid, "Response body"); >- } >- }, function(reason) { >- if ("expected_type" in config && config.expected_type === "error") { >- assert_throws(new TypeError(), function() { throw reason; }); >- } else { >- throw reason; >- } >- }); >+ }) > }, >- pause_after: "pause_after" in requests[i] && true || false >- }); >+ pauseAfter: 'pause_after' in requests[i] >+ }) > } >- >- function pause() { >- return new Promise(function(resolve, reject) { >- step_timeout(function() { >- return resolve() >- }, 3000); >- }); >- } >- >- // TODO: it would be nice if this weren't serialised. >- var idx = 0; >- function run_next_step() { >- if (fetch_functions.length) { >- var fetch_function = fetch_functions.shift(); >- if (fetch_function.pause_after > 0) { >- return fetch_function.code(idx++) >+ var idx = 0 >+ function runNextStep () { >+ if (fetchFunctions.length) { >+ var nextFetchFunction = fetchFunctions.shift() >+ if (nextFetchFunction.pauseAfter === true) { >+ return nextFetchFunction.code(idx++) > .then(pause) >- .then(run_next_step); >+ .then(runNextStep) > } else { >- return fetch_function.code(idx++) >- .then(run_next_step); >+ return nextFetchFunction.code(idx++) >+ .then(runNextStep) > } > } else { >- return Promise.resolve(); >+ return Promise.resolve() > } > } > >- return run_next_step() >- .then(function() { >- // Now, query the server state >- return server_state(uuid); >- }).then(function(state) { >- for (var i = 0; i < requests.length; ++i) { >- var expected_validating_headers = [] >- var req_num = i + 1; >- if ("expected_type" in requests[i]) { >- if (requests[i].expected_type === "cached") { >- assert_true(state.length <= i, "cached response used for request " + req_num); >- continue; // the server will not see the request, so we can't check anything else. >- } >- if (requests[i].expected_type === "not_cached") { >- assert_false(state.length <= i, "cached response used for request " + req_num); >- } >- if (requests[i].expected_type === "etag_validated") { >- expected_validating_headers.push('if-none-match') >- } >- if (requests[i].expected_type === "lm_validated") { >- expected_validating_headers.push('if-modified-since') >- } >- } >- for (var j in expected_validating_headers) { >- var vhdr = expected_validating_headers[j]; >- assert_own_property(state[i].request_headers, vhdr, " has " + vhdr + " request header"); >- } >- if ("expected_request_headers" in requests[i]) { >- var expected_request_headers = requests[i].expected_request_headers; >- for (var j = 0; j < expected_request_headers.length; ++j) { >- var expected_header = expected_request_headers[j]; >- assert_equals(state[i].request_headers[expected_header[0].toLowerCase()], >- expected_header[1]); >- } >- } >+ return runNextStep() >+ .then(function () { >+ return getServerState(uuid) >+ }).then(function (testState) { >+ checkRequests(requests, testState) >+ return Promise.resolve() >+ }) >+ } >+} >+ >+function expandTemplates (test) { >+ var rawRequests = test.requests >+ var requests = [] >+ for (let i = 0; i < rawRequests.length; i++) { >+ var request = rawRequests[i] >+ request.name = test.name >+ if ('template' in request) { >+ var template = templates[request['template']] >+ for (let member in template) { >+ if (!request.hasOwnProperty(member)) { >+ request[member] = template[member] > } >- }); >- }; >+ } >+ } >+ requests.push(request) >+ } >+ return requests > } > >+function fetchInit (requests, config) { >+ var init = { >+ 'headers': [] >+ } >+ if ('request_method' in config) init.method = config['request_method'] >+ if ('request_headers' in config) init.headers = config['request_headers'] >+ if ('name' in config) init.headers.push(['Test-Name', config.name]) >+ if ('request_body' in config) init.body = config['request_body'] >+ if ('mode' in config) init.mode = config['mode'] >+ if ('credentials' in config) init.mode = config['credentials'] >+ if ('cache' in config) init.cache = config['cache'] >+ init.headers.push(['Test-Requests', btoa(JSON.stringify(requests))]) >+ return init >+} > >-function run_tests(tests) >-{ >- tests.forEach(function(info) { >- promise_test(make_test(info.requests), info.name); >- }); >+function makeCheckResponse (idx, config) { >+ return function checkResponse (response) { >+ var reqNum = idx + 1 >+ var resNum = parseInt(response.headers.get('Server-Request-Count')) >+ if ('expected_type' in config) { >+ if (config.expected_type === 'error') { >+ assert_true(false, `Request ${reqNum} doesn't throw an error`) >+ return response.text() >+ } >+ if (config.expected_type === 'cached') { >+ assert_less_than(resNum, reqNum, `Response ${reqNum} does not come from cache`) >+ } >+ if (config.expected_type === 'not_cached') { >+ assert_equals(resNum, reqNum, `Response ${reqNum} comes from cache`) >+ } >+ } >+ if ('expected_status' in config) { >+ assert_equals(response.status, config.expected_status, >+ `Response ${reqNum} status is ${response.status}, not ${config.expected_status}`) >+ } else if ('response_status' in config) { >+ assert_equals(response.status, config.response_status[0], >+ `Response ${reqNum} status is ${response.status}, not ${config.response_status[0]}`) >+ } else { >+ assert_equals(response.status, 200, `Response ${reqNum} status is ${response.status}, not 200`) >+ } >+ if ('response_headers' in config) { >+ config.response_headers.forEach(function (header) { >+ if (header.len < 3 || header[2] === true) { >+ assert_equals(response.headers.get(header[0]), header[1], >+ `Response ${reqNum} header ${header[0]} is "${response.headers.get(header[0])}", not "${header[1]}"`) >+ } >+ }) >+ } >+ if ('expected_response_headers' in config) { >+ config.expected_response_headers.forEach(function (header) { >+ assert_equals(response.headers.get(header[0]), header[1], >+ `Response ${reqNum} header ${header[0]} is "${response.headers.get(header[0])}", not "${header[1]}"`) >+ }) >+ } >+ return response.text() >+ } >+} >+ >+function makeCheckResponseBody (config, uuid) { >+ return function checkResponseBody (resBody) { >+ var statusCode = 200 >+ if ('response_status' in config) { >+ statusCode = config.response_status[0] >+ } >+ if ('expected_response_text' in config) { >+ if (config.expected_response_text !== null) { >+ assert_equals(resBody, config.expected_response_text, >+ `Response body is "${resBody}", not expected "${config.expected_response_text}"`) >+ } >+ } else if ('response_body' in config && config.response_body !== null) { >+ assert_equals(resBody, config.response_body, >+ `Response body is "${resBody}", not sent "${config.response_body}"`) >+ } else if (!noBodyStatus.has(statusCode)) { >+ assert_equals(resBody, uuid, `Response body is "${resBody}", not default "${uuid}"`) >+ } >+ } > } > >-function http_date(delta) { >- return new Date(Date.now() + (delta * 1000)).toGMTString(); >+function checkRequests (requests, testState) { >+ var testIdx = 0 >+ for (let i = 0; i < requests.length; ++i) { >+ var expectedValidatingHeaders = [] >+ var config = requests[i] >+ var serverRequest = testState[testIdx] >+ var reqNum = i + 1 >+ if ('expected_type' in config) { >+ if (config.expected_type === 'cached') continue // the server will not see the request >+ if (config.expected_type === 'etag_validated') { >+ expectedValidatingHeaders.push('if-none-match') >+ } >+ if (config.expected_type === 'lm_validated') { >+ expectedValidatingHeaders.push('if-modified-since') >+ } >+ } >+ testIdx++ >+ expectedValidatingHeaders.forEach(vhdr => { >+ assert_own_property(serverRequest.request_headers, vhdr, >+ `request ${reqNum} doesn't have ${vhdr} header`) >+ }) >+ if ('expected_request_headers' in config) { >+ config.expected_request_headers.forEach(expectedHdr => { >+ assert_equals(serverRequest.request_headers[expectedHdr[0].toLowerCase()], expectedHdr[1], >+ `request ${reqNum} header ${expectedHdr[0]} value is "${serverRequest.request_headers[expectedHdr[0].toLowerCase()]}", not "${expectedHdr[1]}"`) >+ }) >+ } >+ } >+} >+ >+function pause () { >+ return new Promise(function (resolve, reject) { >+ step_timeout(function () { >+ return resolve() >+ }, 3000) >+ }) > } > >-var content_store = {}; >-function http_content(cs_key) { >- if (cs_key in content_store) { >- return content_store[cs_key]; >+function makeTestUrl (uuid, config) { >+ var arg = '' >+ if ('query_arg' in config) { >+ arg = `&target=${config.query_arg}` >+ } >+ return `resources/http-cache.py?dispatch=test&uuid=${uuid}${arg}` >+} >+ >+function getServerState (uuid) { >+ return fetch(`resources/http-cache.py?dispatch=state&uuid=${uuid}`) >+ .then(function (response) { >+ return response.text() >+ }).then(function (text) { >+ return JSON.parse(text) || [] >+ }) >+} >+ >+function run_tests (tests) { >+ tests.forEach(function (test) { >+ promise_test(makeTest(test), test.name) >+ }) >+} >+ >+var contentStore = {} >+function http_content (csKey) { >+ if (csKey in contentStore) { >+ return contentStore[csKey] > } else { >- var content = btoa(Math.random() * Date.now()); >- content_store[cs_key] = content; >- return content; >+ var content = btoa(Math.random() * Date.now()) >+ contentStore[csKey] = content >+ return content > } >-} >\ No newline at end of file >+} >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/http-cache/invalidate-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/http-cache/invalidate-expected.txt >index a4d8a3b92b05a451339a7a6f2fdbd32c497f4020..370a785eb3c1c4e256aa3a434115c7ce96172a03 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/http-cache/invalidate-expected.txt >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/http-cache/invalidate-expected.txt >@@ -1,17 +1,17 @@ > > PASS HTTP cache invalidates after a successful response from a POST >-FAIL HTTP cache does not invalidate after a failed response from an unsafe request assert_less_than: Response used expected a number less than 3 but got 3 >+FAIL HTTP cache does not invalidate after a failed response from an unsafe request assert_less_than: Response 3 does not come from cache expected a number less than 3 but got 3 > PASS HTTP cache invalidates after a successful response from a PUT > PASS HTTP cache invalidates after a successful response from a DELETE > PASS HTTP cache invalidates after a successful response from an unknown method >-FAIL HTTP cache invalidates Location URL after a successful response from a POST assert_equals: Response used expected 3 but got 1 >+FAIL HTTP cache invalidates Location URL after a successful response from a POST assert_equals: Response 3 comes from cache expected 3 but got 1 > PASS HTTP cache does not invalidate Location URL after a failed response from an unsafe request >-FAIL HTTP cache invalidates Location URL after a successful response from a PUT assert_equals: Response used expected 3 but got 1 >-FAIL HTTP cache invalidates Location URL after a successful response from a DELETE assert_equals: Response used expected 3 but got 1 >-FAIL HTTP cache invalidates Location URL after a successful response from an unknown method assert_equals: Response used expected 3 but got 1 >-FAIL HTTP cache invalidates Content-Location URL after a successful response from a POST assert_equals: Response used expected 3 but got 1 >+FAIL HTTP cache invalidates Location URL after a successful response from a PUT assert_equals: Response 3 comes from cache expected 3 but got 1 >+FAIL HTTP cache invalidates Location URL after a successful response from a DELETE assert_equals: Response 3 comes from cache expected 3 but got 1 >+FAIL HTTP cache invalidates Location URL after a successful response from an unknown method assert_equals: Response 3 comes from cache expected 3 but got 1 >+FAIL HTTP cache invalidates Content-Location URL after a successful response from a POST assert_equals: Response 3 comes from cache expected 3 but got 1 > PASS HTTP cache does not invalidate Content-Location URL after a failed response from an unsafe request >-FAIL HTTP cache invalidates Content-Location URL after a successful response from a PUT assert_equals: Response used expected 3 but got 1 >-FAIL HTTP cache invalidates Content-Location URL after a successful response from a DELETE assert_equals: Response used expected 3 but got 1 >-FAIL HTTP cache invalidates Content-Location URL after a successful response from an unknown method assert_equals: Response used expected 3 but got 1 >+FAIL HTTP cache invalidates Content-Location URL after a successful response from a PUT assert_equals: Response 3 comes from cache expected 3 but got 1 >+FAIL HTTP cache invalidates Content-Location URL after a successful response from a DELETE assert_equals: Response 3 comes from cache expected 3 but got 1 >+FAIL HTTP cache invalidates Content-Location URL after a successful response from an unknown method assert_equals: Response 3 comes from cache expected 3 but got 1 > >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/http-cache/invalidate.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/http-cache/invalidate.html >index 3f2307396977e744fa119196bfd0bdbd3affaa97..dbf727c0eaae9e86105e50ef858f953444801890 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/http-cache/invalidate.html >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/http-cache/invalidate.html >@@ -4,6 +4,7 @@ > <meta charset="utf-8"> > <title>HTTP Cache - Invalidation</title> > <meta name="help" href="https://fetch.spec.whatwg.org/#request"> >+ <meta name="timeout" content="long"> > <script src="/resources/testharness.js"></script> > <script src="/resources/testharnessreport.js"></script> > <script src="/common/utils.js"></script> >@@ -20,7 +21,7 @@ > template: "fresh" > }, { > request_method: "POST", >- request_body: "abc", >+ request_body: "abc" > }, { > expected_type: "not_cached" > } >@@ -48,7 +49,7 @@ > }, { > template: "fresh", > request_method: "PUT", >- request_body: "abc", >+ request_body: "abc" > }, { > expected_type: "not_cached" > } >@@ -61,7 +62,7 @@ > template: "fresh" > }, { > request_method: "DELETE", >- request_body: "abc", >+ request_body: "abc" > }, { > expected_type: "not_cached" > } >@@ -74,7 +75,7 @@ > template: "fresh" > }, { > request_method: "FOO", >- request_body: "abc", >+ request_body: "abc" > }, { > expected_type: "not_cached" > } >@@ -121,7 +122,7 @@ > }, { > template: "lcl_response", > request_method: "PUT", >- request_body: "abc", >+ request_body: "abc" > }, { > template: "location", > expected_type: "not_cached" >@@ -136,7 +137,7 @@ > }, { > template: "lcl_response", > request_method: "DELETE", >- request_body: "abc", >+ request_body: "abc" > }, { > template: "location", > expected_type: "not_cached" >@@ -151,7 +152,7 @@ > }, { > template: "lcl_response", > request_method: "FOO", >- request_body: "abc", >+ request_body: "abc" > }, { > template: "location", > expected_type: "not_cached" >@@ -200,7 +201,7 @@ > }, { > template: "lcl_response", > request_method: "PUT", >- request_body: "abc", >+ request_body: "abc" > }, { > template: "content_location", > expected_type: "not_cached" >@@ -215,7 +216,7 @@ > }, { > template: "lcl_response", > request_method: "DELETE", >- request_body: "abc", >+ request_body: "abc" > }, { > template: "content_location", > expected_type: "not_cached" >@@ -230,7 +231,7 @@ > }, { > template: "lcl_response", > request_method: "FOO", >- request_body: "abc", >+ request_body: "abc" > }, { > template: "content_location", > expected_type: "not_cached" >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/http-cache/partial-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/http-cache/partial-expected.txt >index 73ca4ba0d45225dd58ec3558c0ca678f25c2afa5..b129c87d22c7d5159376bd25d430a0b2ec369363 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/http-cache/partial-expected.txt >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/http-cache/partial-expected.txt >@@ -1,10 +1,10 @@ > >-PASS HTTP cache stores partial content and reuses it. >-FAIL HTTP cache stores complete response and serves smaller ranges from it(byte-range-spec). assert_less_than: Response used expected a number less than 2 but got 2 >-FAIL HTTP cache stores complete response and serves smaller ranges from it(absent last-byte-pos). assert_less_than: Response used expected a number less than 2 but got 2 >-FAIL HTTP cache stores complete response and serves smaller ranges from it(suffix-byte-range-spec). assert_less_than: Response used expected a number less than 2 but got 2 >-FAIL HTTP cache stores partial response and serves smaller ranges from it(byte-range-spec). assert_less_than: Response used expected a number less than 2 but got 2 >-FAIL HTTP cache stores partial response and serves smaller ranges from it(absent last-byte-pos). assert_less_than: Response used expected a number less than 2 but got 2 >-FAIL HTTP cache stores partial response and serves smaller ranges from it(suffix-byte-range-spec). assert_less_than: Response used expected a number less than 2 but got 2 >-FAIL HTTP cache stores partial content and completes it. assert_equals: expected (string) "bytes=5-" but got (undefined) undefined >+PASS HTTP cache stores partial content and reuses it >+FAIL HTTP cache stores complete response and serves smaller ranges from it (byte-range-spec) assert_less_than: Response 2 does not come from cache expected a number less than 2 but got 2 >+FAIL HTTP cache stores complete response and serves smaller ranges from it (absent last-byte-pos) assert_less_than: Response 2 does not come from cache expected a number less than 2 but got 2 >+FAIL HTTP cache stores complete response and serves smaller ranges from it (suffix-byte-range-spec) assert_less_than: Response 2 does not come from cache expected a number less than 2 but got 2 >+FAIL HTTP cache stores partial response and serves smaller ranges from it (byte-range-spec) assert_less_than: Response 2 does not come from cache expected a number less than 2 but got 2 >+FAIL HTTP cache stores partial response and serves smaller ranges from it (absent last-byte-pos) assert_less_than: Response 2 does not come from cache expected a number less than 2 but got 2 >+FAIL HTTP cache stores partial response and serves smaller ranges from it (suffix-byte-range-spec) assert_less_than: Response 2 does not come from cache expected a number less than 2 but got 2 >+FAIL HTTP cache stores partial content and completes it assert_equals: request 2 header range value is "undefined", not "bytes=5-" expected (string) "bytes=5-" but got (undefined) undefined > >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/http-cache/partial.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/http-cache/partial.html >index 8d5d61d46c4496192a790466ebe9fc964fb7568f..8f0b528e8ce396c90a87fc76b64f930e99700068 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/http-cache/partial.html >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/http-cache/partial.html >@@ -15,7 +15,7 @@ > <script> > var tests = [ > { >- name: 'HTTP cache stores partial content and reuses it.', >+ name: "HTTP cache stores partial content and reuses it", > requests: [ > { > request_headers: [ >@@ -23,17 +23,17 @@ > ], > response_status: [206, "Partial Content"], > response_headers: [ >- ['Cache-Control', 'max-age=3600'], >- ['Content-Range', 'bytes 4-9/10'] >+ ["Cache-Control", "max-age=3600"], >+ ["Content-Range", "bytes 4-9/10"] > ], > response_body: "01234", > expected_request_headers: [ >- ['Range', "bytes=-5"] >- ], >+ ["Range", "bytes=-5"] >+ ] > }, > { > request_headers: [ >- ['Range', "bytes=-5"] >+ ["Range", "bytes=-5"] > ], > expected_type: "cached", > expected_status: 206, >@@ -42,13 +42,13 @@ > ] > }, > { >- name: 'HTTP cache stores complete response and serves smaller ranges from it(byte-range-spec).', >+ name: "HTTP cache stores complete response and serves smaller ranges from it (byte-range-spec)", > requests: [ > { > response_headers: [ >- ['Cache-Control', 'max-age=3600'], >+ ["Cache-Control", "max-age=3600"] > ], >- response_body: "01234567890", >+ response_body: "01234567890" > }, > { > request_headers: [ >@@ -61,13 +61,13 @@ > ] > }, > { >- name: 'HTTP cache stores complete response and serves smaller ranges from it(absent last-byte-pos).', >+ name: "HTTP cache stores complete response and serves smaller ranges from it (absent last-byte-pos)", > requests: [ > { > response_headers: [ >- ['Cache-Control', 'max-age=3600'], >+ ["Cache-Control", "max-age=3600"], > ], >- response_body: "01234567890", >+ response_body: "01234567890" > }, > { > request_headers: [ >@@ -80,13 +80,13 @@ > ] > }, > { >- name: 'HTTP cache stores complete response and serves smaller ranges from it(suffix-byte-range-spec).', >+ name: "HTTP cache stores complete response and serves smaller ranges from it (suffix-byte-range-spec)", > requests: [ > { > response_headers: [ >- ['Cache-Control', 'max-age=3600'], >+ ["Cache-Control", "max-age=3600"], > ], >- response_body: "0123456789A", >+ response_body: "0123456789A" > }, > { > request_headers: [ >@@ -99,7 +99,7 @@ > ] > }, > { >- name: 'HTTP cache stores partial response and serves smaller ranges from it(byte-range-spec).', >+ name: "HTTP cache stores partial response and serves smaller ranges from it (byte-range-spec)", > requests: [ > { > request_headers: [ >@@ -107,10 +107,10 @@ > ], > response_status: [206, "Partial Content"], > response_headers: [ >- ['Cache-Control', 'max-age=3600'], >- ['Content-Range', 'bytes 4-9/10'] >+ ["Cache-Control", "max-age=3600"], >+ ["Content-Range", "bytes 4-9/10"] > ], >- response_body: "01234", >+ response_body: "01234" > }, > { > request_headers: [ >@@ -123,7 +123,7 @@ > ] > }, > { >- name: 'HTTP cache stores partial response and serves smaller ranges from it(absent last-byte-pos).', >+ name: "HTTP cache stores partial response and serves smaller ranges from it (absent last-byte-pos)", > requests: [ > { > request_headers: [ >@@ -131,14 +131,14 @@ > ], > response_status: [206, "Partial Content"], > response_headers: [ >- ['Cache-Control', 'max-age=3600'], >- ['Content-Range', 'bytes 4-9/10'] >+ ["Cache-Control", "max-age=3600"], >+ ["Content-Range", "bytes 4-9/10"] > ], >- response_body: "01234", >+ response_body: "01234" > }, > { > request_headers: [ >- ['Range', "bytes=6-"] >+ ["Range", "bytes=6-"] > ], > expected_type: "cached", > expected_status: 206, >@@ -147,7 +147,7 @@ > ] > }, > { >- name: 'HTTP cache stores partial response and serves smaller ranges from it(suffix-byte-range-spec).', >+ name: "HTTP cache stores partial response and serves smaller ranges from it (suffix-byte-range-spec)", > requests: [ > { > request_headers: [ >@@ -155,10 +155,10 @@ > ], > response_status: [206, "Partial Content"], > response_headers: [ >- ['Cache-Control', 'max-age=3600'], >- ['Content-Range', 'bytes 4-9/10'] >+ ["Cache-Control", "max-age=3600"], >+ ["Content-Range", "bytes 4-9/10"] > ], >- response_body: "01234", >+ response_body: "01234" > }, > { > request_headers: [ >@@ -171,7 +171,7 @@ > ] > }, > { >- name: 'HTTP cache stores partial content and completes it.', >+ name: "HTTP cache stores partial content and completes it", > requests: [ > { > request_headers: [ >@@ -179,10 +179,10 @@ > ], > response_status: [206, "Partial Content"], > response_headers: [ >- ['Cache-Control', 'max-age=3600'], >- ['Content-Range', 'bytes 0-4/10'] >+ ["Cache-Control", "max-age=3600"], >+ ["Content-Range", "bytes 0-4/10"] > ], >- response_body: "01234", >+ response_body: "01234" > }, > { > expected_request_headers: [ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/http-cache/resources/http-cache.py b/LayoutTests/imported/w3c/web-platform-tests/fetch/http-cache/resources/http-cache.py >index aedd52e51aef880e409348e2a433082ab0f33d7c..b22dadada3beb8b9c689c4ac645431d6e8aba4ee 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/http-cache/resources/http-cache.py >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/http-cache/resources/http-cache.py >@@ -1,51 +1,109 @@ >-from json import JSONEncoder, JSONDecoder >+#!/usr/bin/env python >+ >+import datetime >+import json >+import time > from base64 import b64decode > >+NOTEHDRS = set(['content-type', 'access-control-allow-origin', 'last-modified', 'etag']) >+NOBODYSTATUS = set([204, 304]) >+LOCATIONHDRS = set(['location', 'content-location']) >+DATEHDRS = set(['date', 'expires', 'last-modified']) >+ > def main(request, response): >- uuid = request.GET.first("token", None) >- if "querystate" in request.GET: >+ dispatch = request.GET.first("dispatch", None) >+ uuid = request.GET.first("uuid", None) >+ if not uuid: >+ response.status = (404, "Not Found") > response.headers.set("Content-Type", "text/plain") >- return JSONEncoder().encode(request.server.stash.take(uuid)) >+ return "UUID not found" >+ if dispatch == 'test': >+ return handle_test(uuid, request, response) >+ elif dispatch == 'state': >+ return handle_state(uuid, request, response) >+ response.status = (404, "Not Found") >+ response.headers.set("Content-Type", "text/plain") >+ return "Fallthrough" > >- server_state = request.server.stash.take(uuid) >- if not server_state: >- server_state = [] >+def handle_state(uuid, request, response): >+ response.headers.set("Content-Type", "text/plain") >+ return json.dumps(request.server.stash.take(uuid)) > >- requests = JSONDecoder().decode(b64decode(request.GET.first("info", ""))) >+def handle_test(uuid, request, response): >+ server_state = request.server.stash.take(uuid) or [] >+ try: >+ requests = json.loads(b64decode(request.headers.get('Test-Requests', ""))) >+ except: >+ response.status = (400, "Bad Request") >+ response.headers.set("Content-Type", "text/plain") >+ return "No or bad Test-Requests request header" > config = requests[len(server_state)] >- >- state = dict() >- state["request_method"] = request.method >- state["request_headers"] = dict([[h.lower(), request.headers[h]] for h in request.headers]) >- server_state.append(state) >- request.server.stash.put(uuid, server_state) >- >- note_headers = ['content-type', 'access-control-allow-origin', 'last-modified', 'etag'] >+ if not config: >+ response.status = (404, "Not Found") >+ response.headers.set("Content-Type", "text/plain") >+ return "Config not found" > noted_headers = {} >+ now = time.time() > for header in config.get('response_headers', []): >- if header[0].lower() in ["location", "content-location"]: # magic! >+ if header[0].lower() in LOCATIONHDRS: # magic locations > header[1] = "%s&target=%s" % (request.url, header[1]) >+ if header[0].lower() in DATEHDRS and isinstance(header[1], int): # magic dates >+ header[1] = http_date(now, header[1]) > response.headers.set(header[0], header[1]) >- if header[0].lower() in note_headers: >+ if header[0].lower() in NOTEHDRS: > noted_headers[header[0].lower()] = header[1] >+ state = { >+ 'now': now, >+ 'request_method': request.method, >+ 'request_headers': dict([[h.lower(), request.headers[h]] for h in request.headers]), >+ 'response_headers': noted_headers >+ } >+ server_state.append(state) >+ request.server.stash.put(uuid, server_state) > > if "access-control-allow-origin" not in noted_headers: >- response.headers.set("Access-Control-Allow-Origin", "*"); >+ response.headers.set("Access-Control-Allow-Origin", "*") > if "content-type" not in noted_headers: > response.headers.set("Content-Type", "text/plain") > response.headers.set("Server-Request-Count", len(server_state)) > > code, phrase = config.get("response_status", [200, "OK"]) >- >- if request.headers.get("If-Modified-Since", False) == noted_headers.get('last-modified', True): >- code, phrase = [304, "Not Modified"] >- if request.headers.get("If-None-Match", False) == noted_headers.get('etag', True): >- code, phrase = [304, "Not Modified"] >- >+ if config.get("expected_type", "").endswith('validated'): >+ ref_hdrs = server_state[0]['response_headers'] >+ previous_lm = ref_hdrs.get('last-modified', False) >+ if previous_lm and request.headers.get("If-Modified-Since", False) == previous_lm: >+ code, phrase = [304, "Not Modified"] >+ previous_etag = ref_hdrs.get('etag', False) >+ if previous_etag and request.headers.get("If-None-Match", False) == previous_etag: >+ code, phrase = [304, "Not Modified"] >+ if code != 304: >+ code, phrase = [999, '304 Not Generated'] > response.status = (code, phrase) > > content = config.get("response_body", uuid) >- if code in [204, 304]: >+ if code in NOBODYSTATUS: > return "" >- else: >- return content >+ return content >+ >+ >+def get_header(headers, header_name): >+ result = None >+ for header in headers: >+ if header[0].lower() == header_name.lower(): >+ result = header[1] >+ return result >+ >+WEEKDAYS = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'] >+MONTHS = [None, 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', >+ 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'] >+ >+def http_date(now, delta_secs=0): >+ date = datetime.datetime.utcfromtimestamp(now + delta_secs) >+ return "%s, %.2d %s %.4d %.2d:%.2d:%.2d GMT" % ( >+ WEEKDAYS[date.weekday()], >+ date.day, >+ MONTHS[date.month], >+ date.year, >+ date.hour, >+ date.minute, >+ date.second) >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/http-cache/resources/securedimage.py b/LayoutTests/imported/w3c/web-platform-tests/fetch/http-cache/resources/securedimage.py >new file mode 100644 >index 0000000000000000000000000000000000000000..445b0bdd2ec95a1ac9be08228503475b386cf961 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/http-cache/resources/securedimage.py >@@ -0,0 +1,17 @@ >+# -*- coding: utf-8 - >+ >+def main(request, response): >+ image_url = str.replace(request.url, "fetch/http-cache/resources/securedimage.py", "images/green.png") >+ >+ if "authorization" not in request.headers: >+ response.status = 401 >+ response.headers.set("WWW-Authenticate", "Basic") >+ return >+ else: >+ auth = request.headers.get("Authorization") >+ if auth != "Basic dGVzdHVzZXI6dGVzdHBhc3M=": >+ response.set_error(403, "Invalid username or password - " + auth) >+ return >+ >+ response.status = 301 >+ response.headers.set("Location", image_url) >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/http-cache/resources/w3c-import.log b/LayoutTests/imported/w3c/web-platform-tests/fetch/http-cache/resources/w3c-import.log >index e02e313c6db6a83bdd1c265963cde1ca9565bc3c..26c0f7a009d53dc290003d3193327f74271e719e 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/http-cache/resources/w3c-import.log >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/http-cache/resources/w3c-import.log >@@ -1,7 +1,7 @@ > The tests in this directory were imported from the W3C repository. > Do NOT modify these tests directly in WebKit. > Instead, create a pull request on the WPT github: >- https://github.com/w3c/web-platform-tests >+ https://github.com/web-platform-tests/wpt > > Then run the Tools/Scripts/import-w3c-tests in WebKit to reimport > >@@ -15,3 +15,4 @@ None > ------------------------------------------------------------------------ > List of files: > /LayoutTests/imported/w3c/web-platform-tests/fetch/http-cache/resources/http-cache.py >+/LayoutTests/imported/w3c/web-platform-tests/fetch/http-cache/resources/securedimage.py >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/http-cache/status-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/http-cache/status-expected.txt >index c1321d354eaa78de632d5f8510ebee2fe2acbbd5..c071ac11464b2fabe2503360b1b445a241e8bd03 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/http-cache/status-expected.txt >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/http-cache/status-expected.txt >@@ -1,28 +1,28 @@ > >-PASS HTTP cache goes to the network if it has a stale 200 response. >-PASS HTTP cache avoids going to the network if it has a fresh 200 response. >-PASS HTTP cache goes to the network if it has a stale 203 response. >-PASS HTTP cache avoids going to the network if it has a fresh 203 response. >-PASS HTTP cache goes to the network if it has a stale 204 response. >-PASS HTTP cache avoids going to the network if it has a fresh 204 response. >-PASS HTTP cache goes to the network if it has a stale 299 response. >-FAIL HTTP cache avoids going to the network if it has a fresh 299 response. assert_less_than: Response used expected a number less than 2 but got 2 >-PASS HTTP cache goes to the network if it has a stale 400 response. >-FAIL HTTP cache avoids going to the network if it has a fresh 400 response. assert_less_than: Response used expected a number less than 2 but got 2 >-PASS HTTP cache goes to the network if it has a stale 404 response. >-PASS HTTP cache avoids going to the network if it has a fresh 404 response. >-PASS HTTP cache goes to the network if it has a stale 410 response. >-PASS HTTP cache avoids going to the network if it has a fresh 410 response. >-PASS HTTP cache goes to the network if it has a stale 499 response. >-FAIL HTTP cache avoids going to the network if it has a fresh 499 response. assert_less_than: Response used expected a number less than 2 but got 2 >-PASS HTTP cache goes to the network if it has a stale 500 response. >-FAIL HTTP cache avoids going to the network if it has a fresh 500 response. assert_less_than: Response used expected a number less than 2 but got 2 >-PASS HTTP cache goes to the network if it has a stale 502 response. >-FAIL HTTP cache avoids going to the network if it has a fresh 502 response. assert_less_than: Response used expected a number less than 2 but got 2 >-PASS HTTP cache goes to the network if it has a stale 503 response. >-FAIL HTTP cache avoids going to the network if it has a fresh 503 response. assert_less_than: Response used expected a number less than 2 but got 2 >-PASS HTTP cache goes to the network if it has a stale 504 response. >-FAIL HTTP cache avoids going to the network if it has a fresh 504 response. assert_less_than: Response used expected a number less than 2 but got 2 >-PASS HTTP cache goes to the network if it has a stale 599 response. >-FAIL HTTP cache avoids going to the network if it has a fresh 599 response. assert_less_than: Response used expected a number less than 2 but got 2 >+PASS HTTP cache goes to the network if it has a stale 200 response >+PASS HTTP cache avoids going to the network if it has a fresh 200 response >+PASS HTTP cache goes to the network if it has a stale 203 response >+PASS HTTP cache avoids going to the network if it has a fresh 203 response >+PASS HTTP cache goes to the network if it has a stale 204 response >+PASS HTTP cache avoids going to the network if it has a fresh 204 response >+PASS HTTP cache goes to the network if it has a stale 299 response >+FAIL HTTP cache avoids going to the network if it has a fresh 299 response assert_less_than: Response 2 does not come from cache expected a number less than 2 but got 2 >+PASS HTTP cache goes to the network if it has a stale 400 response >+FAIL HTTP cache avoids going to the network if it has a fresh 400 response assert_less_than: Response 2 does not come from cache expected a number less than 2 but got 2 >+PASS HTTP cache goes to the network if it has a stale 404 response >+PASS HTTP cache avoids going to the network if it has a fresh 404 response >+PASS HTTP cache goes to the network if it has a stale 410 response >+PASS HTTP cache avoids going to the network if it has a fresh 410 response >+PASS HTTP cache goes to the network if it has a stale 499 response >+FAIL HTTP cache avoids going to the network if it has a fresh 499 response assert_less_than: Response 2 does not come from cache expected a number less than 2 but got 2 >+PASS HTTP cache goes to the network if it has a stale 500 response >+FAIL HTTP cache avoids going to the network if it has a fresh 500 response assert_less_than: Response 2 does not come from cache expected a number less than 2 but got 2 >+PASS HTTP cache goes to the network if it has a stale 502 response >+FAIL HTTP cache avoids going to the network if it has a fresh 502 response assert_less_than: Response 2 does not come from cache expected a number less than 2 but got 2 >+PASS HTTP cache goes to the network if it has a stale 503 response >+FAIL HTTP cache avoids going to the network if it has a fresh 503 response assert_less_than: Response 2 does not come from cache expected a number less than 2 but got 2 >+PASS HTTP cache goes to the network if it has a stale 504 response >+FAIL HTTP cache avoids going to the network if it has a fresh 504 response assert_less_than: Response 2 does not come from cache expected a number less than 2 but got 2 >+PASS HTTP cache goes to the network if it has a stale 599 response >+FAIL HTTP cache avoids going to the network if it has a fresh 599 response assert_less_than: Response 2 does not come from cache expected a number less than 2 but got 2 > >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/http-cache/status.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/http-cache/status.html >index f60099a85a306fc83c4c53706f99726cb57c3e2b..308a296858c1ea2868fb6dc7f838ddcb45f1a1d0 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/http-cache/status.html >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/http-cache/status.html >@@ -21,7 +21,7 @@ > body = http_content(code); > } > tests.push({ >- name: 'HTTP cache goes to the network if it has a stale ' + code + ' response.', >+ name: "HTTP cache goes to the network if it has a stale " + code + " response", > requests: [ > { > template: "stale", >@@ -29,12 +29,13 @@ > response_body: body > }, { > expected_type: "not_cached", >+ response_status: [code, phrase], > response_body: body > } > ] > }) > tests.push({ >- name: 'HTTP cache avoids going to the network if it has a fresh ' + code + ' response.', >+ name: "HTTP cache avoids going to the network if it has a fresh " + code + " response", > requests: [ > { > template: "fresh", >@@ -49,9 +50,9 @@ > }) > } > [ >- [200, 'OK'], >+ [200, "OK"], > [203, "Non-Authoritative Information"], >- [204, "No Content", ""], >+ [204, "No Content", null], > [299, "Whatever"], > [400, "Bad Request"], > [404, "Not Found"], >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/http-cache/vary-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/http-cache/vary-expected.txt >index 0f36c3eac86ee15b2bd89ff0aeb7de0bc9f1ba60..e97341649553d534951bfece7aa0abc144b5bd05 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/http-cache/vary-expected.txt >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/http-cache/vary-expected.txt >@@ -1,15 +1,15 @@ > >-PASS HTTP cache reuses Vary response when request matches. >-PASS HTTP cache doesn't use Vary response when request doesn't match. >-PASS HTTP cache doesn't use Vary response when request omits variant header. >-FAIL HTTP cache doesn't invalidate existing Vary response. assert_less_than: Response used expected a number less than 3 but got 3 >-PASS HTTP cache doesn't pay attention to headers not listed in Vary. >-PASS HTTP cache reuses two-way Vary response when request matches. >-PASS HTTP cache doesn't use two-way Vary response when request doesn't match. >-PASS HTTP cache doesn't use two-way Vary response when request omits variant header. >-PASS HTTP cache reuses three-way Vary response when request matches. >-PASS HTTP cache doesn't use three-way Vary response when request doesn't match. >-PASS HTTP cache doesn't use three-way Vary response when request doesn't match, regardless of header order. >-PASS HTTP cache uses three-way Vary response when both request and the original request omited a variant header. >-PASS HTTP cache doesn't use Vary response with a field value of '*'. >+PASS HTTP cache reuses Vary response when request matches >+PASS HTTP cache doesn't use Vary response when request doesn't match >+PASS HTTP cache doesn't use Vary response when request omits variant header >+FAIL HTTP cache doesn't invalidate existing Vary response assert_less_than: Response 3 does not come from cache expected a number less than 3 but got 3 >+PASS HTTP cache doesn't pay attention to headers not listed in Vary >+PASS HTTP cache reuses two-way Vary response when request matches >+PASS HTTP cache doesn't use two-way Vary response when request doesn't match >+PASS HTTP cache doesn't use two-way Vary response when request omits variant header >+PASS HTTP cache reuses three-way Vary response when request matches >+PASS HTTP cache doesn't use three-way Vary response when request doesn't match >+PASS HTTP cache doesn't use three-way Vary response when request doesn't match, regardless of header order >+PASS HTTP cache uses three-way Vary response when both request and the original request omited a variant header >+PASS HTTP cache doesn't use Vary response with a field value of '*' > >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/http-cache/vary.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/http-cache/vary.html >index dd42b14f27ad9cfe2fd5fe783c2f560e66579a8b..721d6e79b5248ed7a4334d754b8039c366090051 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/http-cache/vary.html >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/http-cache/vary.html >@@ -14,15 +14,15 @@ > <script> > var tests = [ > { >- name: 'HTTP cache reuses Vary response when request matches.', >+ name: "HTTP cache reuses Vary response when request matches", > requests: [ > { > request_headers: [ > ["Foo", "1"] > ], > response_headers: [ >- ["Expires", http_date(5000)], >- ["Last-Modified", http_date(-3000)], >+ ["Expires", 5000], >+ ["Last-Modified", -3000], > ["Vary", "Foo"] > ] > }, >@@ -35,15 +35,15 @@ > ] > }, > { >- name: "HTTP cache doesn't use Vary response when request doesn't match.", >+ name: "HTTP cache doesn't use Vary response when request doesn't match", > requests: [ > { > request_headers: [ > ["Foo", "1"] > ], > response_headers: [ >- ["Expires", http_date(5000)], >- ["Last-Modified", http_date(-3000)], >+ ["Expires", 5000], >+ ["Last-Modified", -3000], > ["Vary", "Foo"] > ] > }, >@@ -56,15 +56,15 @@ > ] > }, > { >- name: "HTTP cache doesn't use Vary response when request omits variant header.", >+ name: "HTTP cache doesn't use Vary response when request omits variant header", > requests: [ > { > request_headers: [ > ["Foo", "1"] > ], > response_headers: [ >- ["Expires", http_date(5000)], >- ["Last-Modified", http_date(-3000)], >+ ["Expires", 5000], >+ ["Last-Modified", -3000], > ["Vary", "Foo"] > ] > }, >@@ -74,15 +74,15 @@ > ] > }, > { >- name: "HTTP cache doesn't invalidate existing Vary response.", >+ name: "HTTP cache doesn't invalidate existing Vary response", > requests: [ > { > request_headers: [ > ["Foo", "1"] > ], > response_headers: [ >- ["Expires", http_date(5000)], >- ["Last-Modified", http_date(-3000)], >+ ["Expires", 5000], >+ ["Last-Modified", -3000], > ["Vary", "Foo"] > ], > response_body: http_content('foo_1') >@@ -92,8 +92,8 @@ > ["Foo", "2"] > ], > response_headers: [ >- ["Expires", http_date(5000)], >- ["Last-Modified", http_date(-3000)], >+ ["Expires", 5000], >+ ["Last-Modified", -3000], > ["Vary", "Foo"] > ], > expected_type: "not_cached", >@@ -109,7 +109,7 @@ > ] > }, > { >- name: "HTTP cache doesn't pay attention to headers not listed in Vary.", >+ name: "HTTP cache doesn't pay attention to headers not listed in Vary", > requests: [ > { > request_headers: [ >@@ -117,8 +117,8 @@ > ["Other", "2"] > ], > response_headers: [ >- ["Expires", http_date(5000)], >- ["Last-Modified", http_date(-3000)], >+ ["Expires", 5000], >+ ["Last-Modified", -3000], > ["Vary", "Foo"] > ], > }, >@@ -127,12 +127,12 @@ > ["Foo", "1"], > ["Other", "3"] > ], >- expected_type: "cached", >+ expected_type: "cached" > } > ] > }, > { >- name: 'HTTP cache reuses two-way Vary response when request matches.', >+ name: "HTTP cache reuses two-way Vary response when request matches", > requests: [ > { > request_headers: [ >@@ -140,8 +140,8 @@ > ["Bar", "abc"] > ], > response_headers: [ >- ["Expires", http_date(5000)], >- ["Last-Modified", http_date(-3000)], >+ ["Expires", 5000], >+ ["Last-Modified", -3000], > ["Vary", "Foo, Bar"] > ] > }, >@@ -155,7 +155,7 @@ > ] > }, > { >- name: "HTTP cache doesn't use two-way Vary response when request doesn't match.", >+ name: "HTTP cache doesn't use two-way Vary response when request doesn't match", > requests: [ > { > request_headers: [ >@@ -163,8 +163,8 @@ > ["Bar", "abc"] > ], > response_headers: [ >- ["Expires", http_date(5000)], >- ["Last-Modified", http_date(-3000)], >+ ["Expires", 5000], >+ ["Last-Modified", -3000], > ["Vary", "Foo, Bar"] > ] > }, >@@ -178,15 +178,15 @@ > ] > }, > { >- name: "HTTP cache doesn't use two-way Vary response when request omits variant header.", >+ name: "HTTP cache doesn't use two-way Vary response when request omits variant header", > requests: [ > { > request_headers: [ > ["Foo", "1"] > ], > response_headers: [ >- ["Expires", http_date(5000)], >- ["Last-Modified", http_date(-3000)], >+ ["Expires", 5000], >+ ["Last-Modified", -3000], > ["Vary", "Foo, Bar"] > ] > }, >@@ -196,7 +196,7 @@ > ] > }, > { >- name: 'HTTP cache reuses three-way Vary response when request matches.', >+ name: "HTTP cache reuses three-way Vary response when request matches", > requests: [ > { > request_headers: [ >@@ -205,8 +205,8 @@ > ["Baz", "789"] > ], > response_headers: [ >- ["Expires", http_date(5000)], >- ["Last-Modified", http_date(-3000)], >+ ["Expires", 5000], >+ ["Last-Modified", -3000], > ["Vary", "Foo, Bar, Baz"] > ] > }, >@@ -221,7 +221,7 @@ > ] > }, > { >- name: "HTTP cache doesn't use three-way Vary response when request doesn't match.", >+ name: "HTTP cache doesn't use three-way Vary response when request doesn't match", > requests: [ > { > request_headers: [ >@@ -230,8 +230,8 @@ > ["Baz", "789"] > ], > response_headers: [ >- ["Expires", http_date(5000)], >- ["Last-Modified", http_date(-3000)], >+ ["Expires", 5000], >+ ["Last-Modified", -3000], > ["Vary", "Foo, Bar, Baz"] > ] > }, >@@ -246,7 +246,7 @@ > ] > }, > { >- name: "HTTP cache doesn't use three-way Vary response when request doesn't match, regardless of header order.", >+ name: "HTTP cache doesn't use three-way Vary response when request doesn't match, regardless of header order", > requests: [ > { > request_headers: [ >@@ -255,8 +255,8 @@ > ["Baz", "789"] > ], > response_headers: [ >- ["Expires", http_date(5000)], >- ["Last-Modified", http_date(-3000)], >+ ["Expires", 5000], >+ ["Last-Modified", -3000], > ["Vary", "Foo, Bar, Baz"] > ] > }, >@@ -271,7 +271,7 @@ > ] > }, > { >- name: "HTTP cache uses three-way Vary response when both request and the original request omited a variant header.", >+ name: "HTTP cache uses three-way Vary response when both request and the original request omited a variant header", > requests: [ > { > request_headers: [ >@@ -279,8 +279,8 @@ > ["Baz", "789"] > ], > response_headers: [ >- ["Expires", http_date(5000)], >- ["Last-Modified", http_date(-3000)], >+ ["Expires", 5000], >+ ["Last-Modified", -3000], > ["Vary", "Foo, Bar, Baz"] > ] > }, >@@ -294,7 +294,7 @@ > ] > }, > { >- name: "HTTP cache doesn't use Vary response with a field value of '*'.", >+ name: "HTTP cache doesn't use Vary response with a field value of '*'", > requests: [ > { > request_headers: [ >@@ -302,8 +302,8 @@ > ["Baz", "789"] > ], > response_headers: [ >- ["Expires", http_date(5000)], >- ["Last-Modified", http_date(-3000)], >+ ["Expires", 5000], >+ ["Last-Modified", -3000], > ["Vary", "*"] > ] > }, >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/http-cache/w3c-import.log b/LayoutTests/imported/w3c/web-platform-tests/fetch/http-cache/w3c-import.log >index 426801df7f3312866f72b4571c28da5edb3b8abb..df5e88b52d1d8c05ad40801371903e378dade43b 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/http-cache/w3c-import.log >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/http-cache/w3c-import.log >@@ -1,7 +1,7 @@ > The tests in this directory were imported from the W3C repository. > Do NOT modify these tests directly in WebKit. > Instead, create a pull request on the WPT github: >- https://github.com/w3c/web-platform-tests >+ https://github.com/web-platform-tests/wpt > > Then run the Tools/Scripts/import-w3c-tests in WebKit to reimport > >@@ -16,6 +16,8 @@ None > List of files: > /LayoutTests/imported/w3c/web-platform-tests/fetch/http-cache/304-update.html > /LayoutTests/imported/w3c/web-platform-tests/fetch/http-cache/README.md >+/LayoutTests/imported/w3c/web-platform-tests/fetch/http-cache/basic-auth-cache-test-expected.html >+/LayoutTests/imported/w3c/web-platform-tests/fetch/http-cache/basic-auth-cache-test.html > /LayoutTests/imported/w3c/web-platform-tests/fetch/http-cache/cc-request.html > /LayoutTests/imported/w3c/web-platform-tests/fetch/http-cache/freshness.html > /LayoutTests/imported/w3c/web-platform-tests/fetch/http-cache/heuristic.html >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/images/canvas-remote-read-remote-image-redirect-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/images/canvas-remote-read-remote-image-redirect-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..fda0ed8620d824001d7e447c6bf86c378c89ecf6 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/images/canvas-remote-read-remote-image-redirect-expected.txt >@@ -0,0 +1,4 @@ >+CONSOLE MESSAGE: line 18: Unable to get image data from canvas because the canvas has been tainted by cross-origin data. >+ >+PASS Load a no-cors image from a same-origin URL that redirects to a cross-origin URL that redirects to the initial origin >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/images/canvas-remote-read-remote-image-redirect.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/images/canvas-remote-read-remote-image-redirect.html >new file mode 100644 >index 0000000000000000000000000000000000000000..bfcb7537651f285d0aa5d60a41032c534ff39b95 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/images/canvas-remote-read-remote-image-redirect.html >@@ -0,0 +1,27 @@ >+<!doctype html> >+<meta charset=utf-8> >+<title>Load a no-cors image from a same-origin URL that redirects to a cross-origin URL that redirects to the initial origin</title> >+<script src="/resources/testharness.js"></script> >+<script src="/resources/testharnessreport.js"></script> >+<script src="/common/get-host-info.sub.js"></script> >+<script> >+var image = new Image(); >+image.onload = function() { >+ const canvas = document.createElement("canvas"); >+ canvas.width = 100; >+ canvas.height = 100; >+ >+ const context = canvas.getContext("2d"); >+ context.drawImage(image, 0, 0, 100, 100); >+ >+ assert_throws("SecurityError", () => { >+ context.getImageData(0, 0, 100, 100); >+ }); >+ done(); >+} >+ >+const info = get_host_info(); >+const finalURL = get_host_info().HTTP_ORIGIN + "/images/apng.png"; >+const intermediateURL = get_host_info().HTTP_REMOTE_ORIGIN + "/fetch/api/resources/redirect.py?location=" + finalURL; >+image.src = "/fetch/api/resources/redirect.py?location=" + encodeURIComponent(intermediateURL); >+</script> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/images/w3c-import.log b/LayoutTests/imported/w3c/web-platform-tests/fetch/images/w3c-import.log >new file mode 100644 >index 0000000000000000000000000000000000000000..1d9c4b6b39c61c4d28844e12076dcf0514358230 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/images/w3c-import.log >@@ -0,0 +1,17 @@ >+The tests in this directory were imported from the W3C repository. >+Do NOT modify these tests directly in WebKit. >+Instead, create a pull request on the WPT github: >+ https://github.com/web-platform-tests/wpt >+ >+Then run the Tools/Scripts/import-w3c-tests in WebKit to reimport >+ >+Do NOT modify or remove this file. >+ >+------------------------------------------------------------------------ >+Properties requiring vendor prefixes: >+None >+Property values requiring vendor prefixes: >+None >+------------------------------------------------------------------------ >+List of files: >+/LayoutTests/imported/w3c/web-platform-tests/fetch/images/canvas-remote-read-remote-image-redirect.html >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/nosniff/image-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/nosniff/image-expected.txt >index 6cb1ec1a4eabc831521508670d7e01ef0f3dab68..bb5c219bc649ffafa2ee67a32a23d4d28b84c6cf 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/nosniff/image-expected.txt >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/nosniff/image-expected.txt >@@ -6,4 +6,8 @@ PASS URL query: x/x > PASS URL query: image/gif > PASS URL query: image/png > PASS URL query: image/png;blah >+FAIL URL query: image/svg+xml assert_unreached: Unexpected error event Reached unreachable code >+PASS URL query: text/html >+PASS URL query: application/xml >+PASS URL query: application/blah+xml > >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/nosniff/image.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/nosniff/image.html >index 3273f19fb1ee5cf0fdf82e93d13508413056235b..9dfdb94cf62a4cde91e44f6d4299ca26c15ba9db 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/nosniff/image.html >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/nosniff/image.html >@@ -3,7 +3,19 @@ > <div id=log></div> > <script> > // Note: images get always sniffed, nosniff doesn't do anything >- var passes = [null, "", "x", "x/x", "image/gif", "image/png", "image/png;blah"] >+ // (but note the tentative Cross-Origin Read Blocking (CORB) tests >+ // - for example wpt/fetch/corb/img-mime-types-coverage.tentative.sub.html). >+ var passes = [ >+ // Empty or non-sensical MIME types >+ null, "", "x", "x/x", >+ >+ // Image MIME types >+ "image/gif", "image/png", "image/png;blah", "image/svg+xml", >+ >+ // CORB-protected MIME types (but note that CORB doesn't apply here, >+ // because CORB ignores same-origin requests). >+ "text/html", "application/xml", "application/blah+xml" >+ ] > > const get_url = (mime) => { > let url = "resources/image.py" >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/nosniff/parsing-nosniff.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/nosniff/parsing-nosniff.html >deleted file mode 100644 >index 10c5cadfcaadd8d64fb7248056cdbd708582e117..0000000000000000000000000000000000000000 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/nosniff/parsing-nosniff.html >+++ /dev/null >@@ -1,28 +0,0 @@ >-<script src=/resources/testharness.js></script> >-<script src=/resources/testharnessreport.js></script> >-<div id=log></div> >-<script> >- var fails = ["first", "uppercase"], >- passes = ["last", "quoted", "quoted-single", "no-x"] >- >- fails.forEach(function(urlpart) { >- async_test(function(t) { >- var script = document.createElement("script") >- script.onerror = t.step_func_done(function(){}) >- script.onload = t.unreached_func("Unexpected load event") >- script.src = "resources/nosniff-" + urlpart + ".asis" >- document.body.appendChild(script) >- }, "URL query: " + urlpart) >- }) >- >- passes.forEach(function(urlpart) { >- async_test(function(t) { >- var script = document.createElement("script") >- script.onerror = t.unreached_func("Unexpected error event") >- script.onload = t.step_func_done(function(){}) >- script.src = "resources/nosniff-" + urlpart + ".asis" >- document.body.appendChild(script) >- }, "URL query: " + urlpart) >- }) >- >-</script> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/nosniff/parsing-nosniff.window-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/nosniff/parsing-nosniff.window-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..3c35544f5c8d4ab8d57831c9181e3509aad3fab7 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/nosniff/parsing-nosniff.window-expected.txt >@@ -0,0 +1,17 @@ >+ >+PASS Loading JSON⦠>+PASS X-Content-Type-Options%3A%20NOSNIFF >+PASS x-content-type-OPTIONS%3A%20nosniff >+PASS X-Content-Type-Options%3A%20nosniff%2C%2C%40%23%24%23%25%25%26%5E%26%5E*()()11! >+PASS X-Content-Type-Options%3A%20%40%23%24%23%25%25%26%5E%26%5E*()()11!%2Cnosniff >+PASS X-Content-Type-Options%3A%20nosniff%0D%0AX-Content-Type-Options%3A%20no >+PASS X-Content-Type-Options%3A%20no%0D%0AX-Content-Type-Options%3A%20nosniff >+PASS X-Content-Type-Options%3A%0D%0AX-Content-Type-Options%3A%20nosniff >+PASS X-Content-Type-Options%3A%20%2Cnosniff >+FAIL X-Content-Type-Options%3A%20nosniff%0C assert_unreached: Script should have loaded Reached unreachable code >+FAIL X-Content-Type-Options%3A%20nosniff%0B assert_unreached: Script should have loaded Reached unreachable code >+PASS X-Content-Type-Options%3A%20nosniff%0B%2Cnosniff >+PASS X-Content-Type-Options%3A%20'NosniFF' >+PASS X-Content-Type-Options%3A%20%22nosniFF%22 >+PASS Content-Type-Options%3A%20nosniff >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/nosniff/parsing-nosniff.window.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/nosniff/parsing-nosniff.window.html >new file mode 100644 >index 0000000000000000000000000000000000000000..2382913528e693b3a5d56c660a45060980b548c3 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/nosniff/parsing-nosniff.window.html >@@ -0,0 +1 @@ >+<!-- This file is required for WebKit test infrastructure to run the templated test --> >\ No newline at end of file >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/nosniff/parsing-nosniff.window.js b/LayoutTests/imported/w3c/web-platform-tests/fetch/nosniff/parsing-nosniff.window.js >new file mode 100644 >index 0000000000000000000000000000000000000000..043e659127b2c4990482a885d0f2a1a25083d838 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/nosniff/parsing-nosniff.window.js >@@ -0,0 +1,24 @@ >+promise_test(() => fetch("resources/x-content-type-options.json").then(res => res.json()).then(runTests), "Loading JSONâ¦"); >+ >+function runTests(allTestData) { >+ for (let i = 0; i < allTestData.length; i++) { >+ const testData = allTestData[i], >+ input = encodeURIComponent(testData.input); >+ async_test(t => { >+ const script = document.createElement("script"); >+ t.add_cleanup(() => script.remove()); >+ // A <script> element loading a classic script does not care about the MIME type, unless >+ // X-Content-Type-Options: nosniff is specified, in which case a JavaScript MIME type is >+ // enforced, which x/x is not. >+ if (testData.nosniff) { >+ script.onerror = t.step_func_done(); >+ script.onload = t.unreached_func("Script should not have loaded"); >+ } else { >+ script.onerror = t.unreached_func("Script should have loaded"); >+ script.onload = t.step_func_done(); >+ } >+ script.src = "resources/nosniff.py?nosniff=" + input; >+ document.body.appendChild(script); >+ }, input); >+ } >+} >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/nosniff/resources/css.py b/LayoutTests/imported/w3c/web-platform-tests/fetch/nosniff/resources/css.py >index 55712c5e23eaeba6bdea09aff95d56f182a8310c..f283e785d900cd73bf14171c411713202eef00ca 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/nosniff/resources/css.py >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/nosniff/resources/css.py >@@ -6,18 +6,18 @@ def main(request, response): > > response.add_required_headers = False > if is_revalidation is not None: >- response.writer.write_status(304) >- response.writer.write_header("x-content-type-options", "nosniff") >- response.writer.write_header("content-length", 0) >- if(type != None): >- response.writer.write_header("content-type", type) >- response.writer.end_headers() >- response.writer.write("") >+ response.writer.write_status(304) >+ response.writer.write_header("x-content-type-options", "nosniff") >+ response.writer.write_header("content-length", 0) >+ if(type != None): >+ response.writer.write_header("content-type", type) >+ response.writer.end_headers() >+ response.writer.write("") > else: >- response.writer.write_status(200) >- response.writer.write_header("x-content-type-options", "nosniff") >- response.writer.write_header("content-length", len(content)) >- if(type != None): >- response.writer.write_header("content-type", type) >- response.writer.end_headers() >- response.writer.write(content) >+ response.writer.write_status(200) >+ response.writer.write_header("x-content-type-options", "nosniff") >+ response.writer.write_header("content-length", len(content)) >+ if(type != None): >+ response.writer.write_header("content-type", type) >+ response.writer.end_headers() >+ response.writer.write(content) >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/nosniff/resources/image.py b/LayoutTests/imported/w3c/web-platform-tests/fetch/nosniff/resources/image.py >index 8fb05edc658dd01d478d65393f28a7fc15174ff2..a19ff1f3a076c34ea17c00e3cd13a3e6e5f6b6bc 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/nosniff/resources/image.py >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/nosniff/resources/image.py >@@ -3,14 +3,20 @@ import os.path > def main(request, response): > type = request.GET.first("type", None) > >- body = open(os.path.join(os.path.dirname(__file__), "../../../images/blue96x96.png"), "rb").read() >+ if type != None and "svg" in type: >+ filename = "green-96x96.svg" >+ else: >+ filename = "blue96x96.png" >+ >+ path = os.path.join(os.path.dirname(__file__), "../../../images", filename) >+ body = open(path, "rb").read() > > response.add_required_headers = False > response.writer.write_status(200) > response.writer.write_header("x-content-type-options", "nosniff") > response.writer.write_header("content-length", len(body)) > if(type != None): >- response.writer.write_header("content-type", type) >+ response.writer.write_header("content-type", type) > response.writer.end_headers() > > response.writer.write(body) >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/nosniff/resources/js.py b/LayoutTests/imported/w3c/web-platform-tests/fetch/nosniff/resources/js.py >index 0c06d9cd2e432461434898ac6545638324c2503b..4fb7fb660086a6665b680ce9abb645e1bdaa510e 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/nosniff/resources/js.py >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/nosniff/resources/js.py >@@ -11,7 +11,7 @@ def main(request, response): > response.writer.write_header("x-content-type-options", "nosniff") > response.writer.write_header("content-length", len(content)) > if(type != "Content-Type missing"): >- response.writer.write_header("content-type", type) >+ response.writer.write_header("content-type", type) > response.writer.end_headers() > > response.writer.write(content) >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/nosniff/resources/nosniff-first.asis b/LayoutTests/imported/w3c/web-platform-tests/fetch/nosniff/resources/nosniff-first.asis >deleted file mode 100644 >index bccc53eef8acd4adf066dd45ed01472a2a46335a..0000000000000000000000000000000000000000 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/nosniff/resources/nosniff-first.asis >+++ /dev/null >@@ -1,7 +0,0 @@ >-HTTP/1.1 200 YOU HAVE NO POWER HERE >-Content-Length: 22 >-Content-Type: x/x >-X-Content-Type-options: nosniff >-X-Content-Type-Options: no >- >-// nothing to see here >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/nosniff/resources/nosniff-last.asis b/LayoutTests/imported/w3c/web-platform-tests/fetch/nosniff/resources/nosniff-last.asis >deleted file mode 100644 >index e3de0733e4fb6fabf733ea54feca6609f3f55b43..0000000000000000000000000000000000000000 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/nosniff/resources/nosniff-last.asis >+++ /dev/null >@@ -1,7 +0,0 @@ >-HTTP/1.1 200 YOU HAVE NO POWER HERE >-Content-Length: 22 >-Content-Type: x/x >-X-Content-Type-Options: no >-X-Content-Type-options: nosniff >- >-// nothing to see here >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/nosniff/resources/nosniff-no-x.asis b/LayoutTests/imported/w3c/web-platform-tests/fetch/nosniff/resources/nosniff-no-x.asis >deleted file mode 100644 >index 329d0f72143a4edfa41b413ee19d43bfb053ec51..0000000000000000000000000000000000000000 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/nosniff/resources/nosniff-no-x.asis >+++ /dev/null >@@ -1,6 +0,0 @@ >-HTTP/1.1 200 YOU HAVE NO POWER HERE >-Content-Length: 22 >-Content-Type: x/x >-Content-Type-Options: nosniff >- >-// nothing to see here >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/nosniff/resources/nosniff-quoted-single.asis b/LayoutTests/imported/w3c/web-platform-tests/fetch/nosniff/resources/nosniff-quoted-single.asis >deleted file mode 100644 >index 501f18999d074129dc5eb6db040d8ffd7a1a40f7..0000000000000000000000000000000000000000 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/nosniff/resources/nosniff-quoted-single.asis >+++ /dev/null >@@ -1,6 +0,0 @@ >-HTTP/1.1 200 YOU HAVE NO POWER HERE >-Content-Length: 22 >-Content-Type: x/x >-X-Content-Type-Options: 'NosniFF' >- >-// nothing to see here >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/nosniff/resources/nosniff-quoted.asis b/LayoutTests/imported/w3c/web-platform-tests/fetch/nosniff/resources/nosniff-quoted.asis >deleted file mode 100644 >index c6de62b689e2fd9cd540b8a30a6ed81a46317056..0000000000000000000000000000000000000000 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/nosniff/resources/nosniff-quoted.asis >+++ /dev/null >@@ -1,6 +0,0 @@ >-HTTP/1.1 200 YOU HAVE NO POWER HERE >-Content-Length: 22 >-Content-Type: x/x >-X-Content-Type-Options: "nosniFF" >- >-// nothing to see here >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/nosniff/resources/nosniff-uppercase.asis b/LayoutTests/imported/w3c/web-platform-tests/fetch/nosniff/resources/nosniff-uppercase.asis >deleted file mode 100644 >index 8097fddce106ab97ef869266ff42eda70a0725b9..0000000000000000000000000000000000000000 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/nosniff/resources/nosniff-uppercase.asis >+++ /dev/null >@@ -1,6 +0,0 @@ >-HTTP/1.1 200 YOU HAVE NO POWER HERE >-Content-Length: 22 >-Content-Type: x/x >-X-Content-Type-Options: NOSNIFF >- >-// nothing to see here >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/nosniff/resources/nosniff.py b/LayoutTests/imported/w3c/web-platform-tests/fetch/nosniff/resources/nosniff.py >new file mode 100644 >index 0000000000000000000000000000000000000000..9b59d35b925ef40195b80c1d866280b185ae63c5 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/nosniff/resources/nosniff.py >@@ -0,0 +1,10 @@ >+def main(request, response): >+ response.add_required_headers = False >+ output = "HTTP/1.1 220 YOU HAVE NO POWER HERE\r\n" >+ output += "Content-Length: 22\r\n" >+ output += "Content-Type: x/x\r\n" >+ output += request.GET.first("nosniff") + "\r\n" >+ output += "\r\n" >+ output += "// nothing to see here" >+ response.writer.write(output) >+ response.close_connection = True >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/nosniff/resources/w3c-import.log b/LayoutTests/imported/w3c/web-platform-tests/fetch/nosniff/resources/w3c-import.log >index d8f5a0d46b024c952ed600085ef0d59242841b9c..679ed09a4b7ae2ac84cbb9b90e08612a70861c87 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/nosniff/resources/w3c-import.log >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/nosniff/resources/w3c-import.log >@@ -1,7 +1,7 @@ > The tests in this directory were imported from the W3C repository. > Do NOT modify these tests directly in WebKit. > Instead, create a pull request on the WPT github: >- https://github.com/w3c/web-platform-tests >+ https://github.com/web-platform-tests/wpt > > Then run the Tools/Scripts/import-w3c-tests in WebKit to reimport > >@@ -17,10 +17,6 @@ List of files: > /LayoutTests/imported/w3c/web-platform-tests/fetch/nosniff/resources/css.py > /LayoutTests/imported/w3c/web-platform-tests/fetch/nosniff/resources/image.py > /LayoutTests/imported/w3c/web-platform-tests/fetch/nosniff/resources/js.py >-/LayoutTests/imported/w3c/web-platform-tests/fetch/nosniff/resources/nosniff-first.asis >-/LayoutTests/imported/w3c/web-platform-tests/fetch/nosniff/resources/nosniff-last.asis >-/LayoutTests/imported/w3c/web-platform-tests/fetch/nosniff/resources/nosniff-no-x.asis >-/LayoutTests/imported/w3c/web-platform-tests/fetch/nosniff/resources/nosniff-quoted-single.asis >-/LayoutTests/imported/w3c/web-platform-tests/fetch/nosniff/resources/nosniff-quoted.asis >-/LayoutTests/imported/w3c/web-platform-tests/fetch/nosniff/resources/nosniff-uppercase.asis >+/LayoutTests/imported/w3c/web-platform-tests/fetch/nosniff/resources/nosniff.py > /LayoutTests/imported/w3c/web-platform-tests/fetch/nosniff/resources/worker.py >+/LayoutTests/imported/w3c/web-platform-tests/fetch/nosniff/resources/x-content-type-options.json >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/nosniff/resources/worker.py b/LayoutTests/imported/w3c/web-platform-tests/fetch/nosniff/resources/worker.py >index 3903ba34947d0f621a8cbbb102806c476d46b14e..a06a3a2237834aed6e03acf9a8f7e14c794ae276 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/nosniff/resources/worker.py >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/nosniff/resources/worker.py >@@ -10,7 +10,7 @@ def main(request, response): > response.writer.write_header("x-content-type-options", "nosniff") > response.writer.write_header("content-length", len(content)) > if(type != None): >- response.writer.write_header("content-type", type) >+ response.writer.write_header("content-type", type) > response.writer.end_headers() > > response.writer.write(content) >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/nosniff/resources/x-content-type-options.json b/LayoutTests/imported/w3c/web-platform-tests/fetch/nosniff/resources/x-content-type-options.json >new file mode 100644 >index 0000000000000000000000000000000000000000..0a8c490756e674bacd7d78e1ad20dc6752abee8d >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/nosniff/resources/x-content-type-options.json >@@ -0,0 +1,58 @@ >+[ >+ { >+ "input": "X-Content-Type-Options: NOSNIFF", >+ "nosniff": true >+ }, >+ { >+ "input": "x-content-type-OPTIONS: nosniff", >+ "nosniff": true >+ }, >+ { >+ "input": "X-Content-Type-Options: nosniff,,@#$#%%&^&^*()()11!", >+ "nosniff": true >+ }, >+ { >+ "input": "X-Content-Type-Options: @#$#%%&^&^*()()11!,nosniff", >+ "nosniff": false >+ }, >+ { >+ "input": "X-Content-Type-Options: nosniff\r\nX-Content-Type-Options: no", >+ "nosniff": true >+ }, >+ { >+ "input": "X-Content-Type-Options: no\r\nX-Content-Type-Options: nosniff", >+ "nosniff": false >+ }, >+ { >+ "input": "X-Content-Type-Options:\r\nX-Content-Type-Options: nosniff", >+ "nosniff": false >+ }, >+ { >+ "input": "X-Content-Type-Options: ,nosniff", >+ "nosniff": false >+ }, >+ { >+ "input": "X-Content-Type-Options: nosniff\u000C", >+ "nosniff": false >+ }, >+ { >+ "input": "X-Content-Type-Options: nosniff\u000B", >+ "nosniff": false >+ }, >+ { >+ "input": "X-Content-Type-Options: nosniff\u000B,nosniff", >+ "nosniff": false >+ }, >+ { >+ "input": "X-Content-Type-Options: 'NosniFF'", >+ "nosniff": false >+ }, >+ { >+ "input": "X-Content-Type-Options: \"nosniFF\"", >+ "nosniff": false >+ }, >+ { >+ "input": "Content-Type-Options: nosniff", >+ "nosniff": false >+ } >+] >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/nosniff/w3c-import.log b/LayoutTests/imported/w3c/web-platform-tests/fetch/nosniff/w3c-import.log >index c4ec188aa3f69c97ffcc8c6f149ddaceea852b19..ce745986803aaf497a93436e71f459c0086df553 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/nosniff/w3c-import.log >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/nosniff/w3c-import.log >@@ -1,7 +1,7 @@ > The tests in this directory were imported from the W3C repository. > Do NOT modify these tests directly in WebKit. > Instead, create a pull request on the WPT github: >- https://github.com/w3c/web-platform-tests >+ https://github.com/web-platform-tests/wpt > > Then run the Tools/Scripts/import-w3c-tests in WebKit to reimport > >@@ -17,7 +17,7 @@ List of files: > /LayoutTests/imported/w3c/web-platform-tests/fetch/nosniff/image.html > /LayoutTests/imported/w3c/web-platform-tests/fetch/nosniff/importscripts.html > /LayoutTests/imported/w3c/web-platform-tests/fetch/nosniff/importscripts.js >-/LayoutTests/imported/w3c/web-platform-tests/fetch/nosniff/parsing-nosniff.html >+/LayoutTests/imported/w3c/web-platform-tests/fetch/nosniff/parsing-nosniff.window.js > /LayoutTests/imported/w3c/web-platform-tests/fetch/nosniff/script.html > /LayoutTests/imported/w3c/web-platform-tests/fetch/nosniff/stylesheet.html > /LayoutTests/imported/w3c/web-platform-tests/fetch/nosniff/worker.html >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/origin/no-cors.any-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/origin/no-cors.any-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..e3205bfc8be9b56fbb6f770d6f675cc5afca8423 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/origin/no-cors.any-expected.txt >@@ -0,0 +1,3 @@ >+ >+FAIL Origin header and 308 redirect assert_equals: second origin should be opaque and therefore null expected "null" but got "no Origin header" >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/origin/no-cors.any.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/origin/no-cors.any.html >new file mode 100644 >index 0000000000000000000000000000000000000000..2382913528e693b3a5d56c660a45060980b548c3 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/origin/no-cors.any.html >@@ -0,0 +1 @@ >+<!-- This file is required for WebKit test infrastructure to run the templated test --> >\ No newline at end of file >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/origin/no-cors.any.js b/LayoutTests/imported/w3c/web-platform-tests/fetch/origin/no-cors.any.js >new file mode 100644 >index 0000000000000000000000000000000000000000..c9d1d3b3af3750ec43549a3d96a0912e2cf6b399 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/origin/no-cors.any.js >@@ -0,0 +1,20 @@ >+// META: script=/common/utils.js >+// META: script=/common/get-host-info.sub.js >+ >+promise_test(async function() { >+ const stash = token(), >+ origins = get_host_info(), >+ redirectPath = "/fetch/origin/resources/redirect-and-stash.py"; >+ >+ // Cross-origin -> same-origin will result in setting the tainted origin flag for the second >+ // request. >+ let url = origins.HTTP_ORIGIN + redirectPath + "?stash=" + stash; >+ url = origins.HTTP_REMOTE_ORIGIN + redirectPath + "?stash=" + stash + "&location=" + encodeURIComponent(url); >+ >+ await fetch(url, { mode: "no-cors", method: "POST" }); >+ >+ const json = await (await fetch(redirectPath + "?dump&stash=" + stash)).json(); >+ >+ assert_equals(json[0], origins.HTTP_ORIGIN, "first origin should equal this origin"); >+ assert_equals(json[1], "null", "second origin should be opaque and therefore null"); >+}, "Origin header and 308 redirect"); >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/origin/no-cors.any.worker-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/origin/no-cors.any.worker-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..e3205bfc8be9b56fbb6f770d6f675cc5afca8423 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/origin/no-cors.any.worker-expected.txt >@@ -0,0 +1,3 @@ >+ >+FAIL Origin header and 308 redirect assert_equals: second origin should be opaque and therefore null expected "null" but got "no Origin header" >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/origin/no-cors.any.worker.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/origin/no-cors.any.worker.html >new file mode 100644 >index 0000000000000000000000000000000000000000..2382913528e693b3a5d56c660a45060980b548c3 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/origin/no-cors.any.worker.html >@@ -0,0 +1 @@ >+<!-- This file is required for WebKit test infrastructure to run the templated test --> >\ No newline at end of file >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/origin/resources/redirect-and-stash.py b/LayoutTests/imported/w3c/web-platform-tests/fetch/origin/resources/redirect-and-stash.py >new file mode 100644 >index 0000000000000000000000000000000000000000..1b1b46ba177ad3af56ef83e90b0974dd81cd3eae >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/origin/resources/redirect-and-stash.py >@@ -0,0 +1,29 @@ >+import json >+ >+def main(request, response): >+ key = request.GET.first("stash") >+ origin = request.headers.get("origin") >+ if origin is None: >+ origin = "no Origin header" >+ >+ origin_list = request.server.stash.take(key) >+ >+ if "dump" in request.GET: >+ response.headers.set("content-Type", "application/json") >+ response.content = json.dumps(origin_list) >+ return >+ >+ if origin_list is None: >+ origin_list = [origin] >+ else: >+ origin_list.append(origin) >+ >+ request.server.stash.put(key, origin_list) >+ >+ if "location" in request.GET: >+ response.status = 308 >+ response.headers.set("Location", request.GET.first("location")) >+ return >+ >+ response.headers.set("content-Type", "text/plain") >+ response.content = "Fix https://github.com/whatwg/fetch/issues/737..." >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/origin/resources/w3c-import.log b/LayoutTests/imported/w3c/web-platform-tests/fetch/origin/resources/w3c-import.log >new file mode 100644 >index 0000000000000000000000000000000000000000..68babc5248e1da2da23279e0b451b4796b86f090 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/origin/resources/w3c-import.log >@@ -0,0 +1,17 @@ >+The tests in this directory were imported from the W3C repository. >+Do NOT modify these tests directly in WebKit. >+Instead, create a pull request on the WPT github: >+ https://github.com/web-platform-tests/wpt >+ >+Then run the Tools/Scripts/import-w3c-tests in WebKit to reimport >+ >+Do NOT modify or remove this file. >+ >+------------------------------------------------------------------------ >+Properties requiring vendor prefixes: >+None >+Property values requiring vendor prefixes: >+None >+------------------------------------------------------------------------ >+List of files: >+/LayoutTests/imported/w3c/web-platform-tests/fetch/origin/resources/redirect-and-stash.py >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/origin/w3c-import.log b/LayoutTests/imported/w3c/web-platform-tests/fetch/origin/w3c-import.log >new file mode 100644 >index 0000000000000000000000000000000000000000..302407dfdc1bd461d09a70f434714ad07dbf13ce >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/origin/w3c-import.log >@@ -0,0 +1,17 @@ >+The tests in this directory were imported from the W3C repository. >+Do NOT modify these tests directly in WebKit. >+Instead, create a pull request on the WPT github: >+ https://github.com/web-platform-tests/wpt >+ >+Then run the Tools/Scripts/import-w3c-tests in WebKit to reimport >+ >+Do NOT modify or remove this file. >+ >+------------------------------------------------------------------------ >+Properties requiring vendor prefixes: >+None >+Property values requiring vendor prefixes: >+None >+------------------------------------------------------------------------ >+List of files: >+/LayoutTests/imported/w3c/web-platform-tests/fetch/origin/no-cors.any.js >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/range/general.window-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/range/general.window-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..3c8134054b20984812c795288777096f2c9fc322 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/range/general.window-expected.txt >@@ -0,0 +1,4 @@ >+ >+PASS Script executed from partial response >+PASS Fetch with range header will be sent with Accept-Encoding: identity >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/range/general.window.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/range/general.window.html >new file mode 100644 >index 0000000000000000000000000000000000000000..2382913528e693b3a5d56c660a45060980b548c3 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/range/general.window.html >@@ -0,0 +1 @@ >+<!-- This file is required for WebKit test infrastructure to run the templated test --> >\ No newline at end of file >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/range/resources/w3c-import.log b/LayoutTests/imported/w3c/web-platform-tests/fetch/range/resources/w3c-import.log >index e88dcc0790f178b98bd94128077860f13d577427..bdb7613940889da4238a68a193e29de7f5b70739 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/range/resources/w3c-import.log >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/range/resources/w3c-import.log >@@ -1,7 +1,7 @@ > The tests in this directory were imported from the W3C repository. > Do NOT modify these tests directly in WebKit. > Instead, create a pull request on the WPT github: >- https://github.com/w3c/web-platform-tests >+ https://github.com/web-platform-tests/wpt > > Then run the Tools/Scripts/import-w3c-tests in WebKit to reimport > >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/range/sw.https.window-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/range/sw.https.window-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..2ccac348a89299c11658bbaffd7eb77adc976bba >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/range/sw.https.window-expected.txt >@@ -0,0 +1,5 @@ >+#PID UNRESPONSIVE - com.apple.WebKit.WebContent.Development (pid 73757) >+FAIL: Timed out waiting for notifyDone to be called >+ >+#EOF >+#EOF >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/range/sw.https.window.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/range/sw.https.window.html >new file mode 100644 >index 0000000000000000000000000000000000000000..2382913528e693b3a5d56c660a45060980b548c3 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/range/sw.https.window.html >@@ -0,0 +1 @@ >+<!-- This file is required for WebKit test infrastructure to run the templated test --> >\ No newline at end of file >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/range/w3c-import.log b/LayoutTests/imported/w3c/web-platform-tests/fetch/range/w3c-import.log >index c23bcdbb52dd7af245dfcf1379bd311d0d8d479e..9f324c6ec65ff677efc5fc5c972c67353f9cf5da 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/range/w3c-import.log >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/range/w3c-import.log >@@ -1,7 +1,7 @@ > The tests in this directory were imported from the W3C repository. > Do NOT modify these tests directly in WebKit. > Instead, create a pull request on the WPT github: >- https://github.com/w3c/web-platform-tests >+ https://github.com/web-platform-tests/wpt > > Then run the Tools/Scripts/import-w3c-tests in WebKit to reimport > >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/redirect-navigate/302-found-post-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/redirect-navigate/302-found-post-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..e721775eaf4ee2d1b71c7129e4bc3bab9bcb1141 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/redirect-navigate/302-found-post-expected.txt >@@ -0,0 +1,4 @@ >+ >+ >+PASS HTTP 302 Found POST Navigation >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/redirect-navigate/302-found-post-handler.py b/LayoutTests/imported/w3c/web-platform-tests/fetch/redirect-navigate/302-found-post-handler.py >new file mode 100644 >index 0000000000000000000000000000000000000000..23bf4b2c522b7c00ab6bd0fc3eb99f0737d512ec >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/redirect-navigate/302-found-post-handler.py >@@ -0,0 +1,13 @@ >+def main(request, response): >+ if request.method == "POST": >+ response.add_required_headers = False >+ response.writer.write_status(302) >+ response.writer.write_header("Location", request.url) >+ response.writer.end_headers() >+ response.writer.write("") >+ elif request.method == "GET": >+ return ([("Content-Type", "text/plain")], >+ "OK") >+ else: >+ return ([("Content-Type", "text/plain")], >+ "FAIL") >\ No newline at end of file >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/redirect-navigate/302-found-post.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/redirect-navigate/302-found-post.html >new file mode 100644 >index 0000000000000000000000000000000000000000..854cd329a8f12052bb79f35dd80268f246a52afd >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/redirect-navigate/302-found-post.html >@@ -0,0 +1,20 @@ >+<!DOCTYPE html> >+<!-- Step 1: send POST request to a URL which will then 302 Found redirect --> >+<title>HTTP 302 Found POST Navigation Test</title> >+<script src="/resources/testharness.js"></script> >+<script src="/resources/testharnessreport.js"></script> >+<script> >+async_test(function(t) { >+ window.addEventListener("load", function() { >+ var frame = document.getElementById("frame"); >+ var link = new URL("302-found-post-handler.py", window.location.href); >+ frame.contentWindow.document.body.innerHTML = '<form action="' + link.href + '" method="POST" id="form"><input name="n"></form>'; >+ frame.contentWindow.document.getElementById("form").submit(); >+ frame.addEventListener("load", t.step_func_done(function() { >+ assert_equals(frame.contentWindow.document.body.textContent, "OK"); >+ })); >+ }); >+}, "HTTP 302 Found POST Navigation"); >+</script> >+<body> >+<iframe id="frame" src="about:blank"></iframe> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/redirect-navigate/w3c-import.log b/LayoutTests/imported/w3c/web-platform-tests/fetch/redirect-navigate/w3c-import.log >new file mode 100644 >index 0000000000000000000000000000000000000000..e1722310f51e176b5aa855d8b7172c471d277f77 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/redirect-navigate/w3c-import.log >@@ -0,0 +1,18 @@ >+The tests in this directory were imported from the W3C repository. >+Do NOT modify these tests directly in WebKit. >+Instead, create a pull request on the WPT github: >+ https://github.com/web-platform-tests/wpt >+ >+Then run the Tools/Scripts/import-w3c-tests in WebKit to reimport >+ >+Do NOT modify or remove this file. >+ >+------------------------------------------------------------------------ >+Properties requiring vendor prefixes: >+None >+Property values requiring vendor prefixes: >+None >+------------------------------------------------------------------------ >+List of files: >+/LayoutTests/imported/w3c/web-platform-tests/fetch/redirect-navigate/302-found-post-handler.py >+/LayoutTests/imported/w3c/web-platform-tests/fetch/redirect-navigate/302-found-post.html >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/README.md b/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/README.md >new file mode 100644 >index 0000000000000000000000000000000000000000..c460aa1ecb941118b6999209ba4601eb145a61b9 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/README.md >@@ -0,0 +1,11 @@ >+`Sec-Metadata` Tests >+==================== >+ >+This directory contains tests related to the `Sec-Metadata` proposal: >+ >+: Explainer >+:: <https://github.com/mikewest/sec-metadata> >+: "Spec" >+:: <https://mikewest.github.io/sec-metadata/> >+ >+Note: All of this is tentative, and will change (rapidly). >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/embed.tentative.https.sub-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/embed.tentative.https.sub-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..4032d250af46eba314ab1b1fd2050a5347c0d198 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/embed.tentative.https.sub-expected.txt >@@ -0,0 +1,8 @@ >+ >+ >+Harness Error (TIMEOUT), message = null >+ >+TIMEOUT Same-Origin embed Test timed out >+NOTRUN Same-Site embed >+NOTRUN Cross-Site embed >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/embed.tentative.https.sub.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/embed.tentative.https.sub.html >new file mode 100644 >index 0000000000000000000000000000000000000000..745ef42d484f5258f46ffc6ee9447fe5d8d3c142 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/embed.tentative.https.sub.html >@@ -0,0 +1,65 @@ >+<!DOCTYPE html> >+<meta charset="utf-8"/> >+<link rel="author" href="mtrzos@google.com" title="Maciek Trzos"> >+<script src=/resources/testharness.js></script> >+<script src=/resources/testharnessreport.js></script> >+<script src=/fetch/sec-metadata/resources/helper.js></script> >+<body> >+<script> >+ promise_test(t => { >+ return new Promise((resolve, reject) => { >+ let key = "embed-same-origin"; >+ >+ let e = document.createElement('embed'); >+ e.src = "https://{{host}}:{{ports[https][0]}}/fetch/sec-metadata/resources/record-header.py?file=" + key; >+ e.onload = e => { >+ let expected = {"destination":"embed", "site":"same-origin"}; >+ fetch("/fetch/sec-metadata/resources/record-header.py?retrieve=true&file=" + key) >+ .then(response => response.text()) >+ .then(text => assert_header_equals(text, expected)) >+ .then(_ => resolve()) >+ .catch(e => reject(e)); >+ }; >+ >+ document.body.appendChild(e); >+ }) >+ }, "Same-Origin embed"); >+ >+ promise_test(t => { >+ return new Promise((resolve, reject) => { >+ let key = "embed-same-site"; >+ >+ let e = document.createElement('embed'); >+ e.src = "https://{{hosts[][www]}}:{{ports[https][0]}}/fetch/sec-metadata/resources/record-header.py?file=" + key; >+ e.onload = e => { >+ let expected = {"destination":"embed", "site":"same-site"}; >+ fetch("/fetch/sec-metadata/resources/record-header.py?retrieve=true&file=" + key) >+ .then(response => response.text()) >+ .then(text => assert_header_equals(text, expected)) >+ .then(_ => resolve()) >+ .catch(e => reject(e)); >+ }; >+ >+ document.body.appendChild(e); >+ }) >+ }, "Same-Site embed"); >+ >+ promise_test(t => { >+ return new Promise((resolve, reject) => { >+ let key = "embed-cross-site"; >+ >+ let e = document.createElement('embed'); >+ e.src = "https://{{hosts[alt][www]}}:{{ports[https][0]}}/fetch/sec-metadata/resources/record-header.py?file=" + key; >+ e.onload = e => { >+ let expected = {"destination":"embed", "site":"cross-site"}; >+ fetch("/fetch/sec-metadata/resources/record-header.py?retrieve=true&file=" + key) >+ .then(response => response.text()) >+ .then(text => assert_header_equals(text, expected)) >+ .then(_ => resolve()) >+ .catch(e => reject(e)); >+ }; >+ >+ document.body.appendChild(e); >+ }) >+ }, "Cross-Site embed"); >+</script> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/fetch.tentative.https.sub-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/fetch.tentative.https.sub-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..5d4bd510e46bedff174adf06c3f8ee0d319fcbf5 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/fetch.tentative.https.sub-expected.txt >@@ -0,0 +1,9 @@ >+Blocked access to external URL https://www.localhost:9443/fetch/sec-metadata/resources/echo-as-json.py >+CONSOLE MESSAGE: line 19: Fetch API cannot load https://www.localhost:9443/fetch/sec-metadata/resources/echo-as-json.py due to access control checks. >+Blocked access to external URL https://www.not-web-platform.test:9443/fetch/sec-metadata/resources/echo-as-json.py >+CONSOLE MESSAGE: line 31: Fetch API cannot load https://www.not-web-platform.test:9443/fetch/sec-metadata/resources/echo-as-json.py due to access control checks. >+ >+FAIL Same-origin fetch assert_not_equals: Empty Sec-Metadata header. got disallowed value "" >+FAIL Same-site fetch promise_test: Unhandled rejection with value: object "TypeError: Type error" >+FAIL Cross-site fetch promise_test: Unhandled rejection with value: object "TypeError: Type error" >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/fetch.tentative.https.sub.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/fetch.tentative.https.sub.html >new file mode 100644 >index 0000000000000000000000000000000000000000..d18042ca98b083cb7ebe7b42070afe47daa4b47c >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/fetch.tentative.https.sub.html >@@ -0,0 +1,41 @@ >+<!DOCTYPE html> >+<script src=/resources/testharness.js></script> >+<script src=/resources/testharnessreport.js></script> >+<script src=/fetch/sec-metadata/resources/helper.js></script> >+<script> >+ promise_test(t => { >+ return fetch("https://{{host}}:{{ports[https][0]}}/fetch/sec-metadata/resources/echo-as-json.py") >+ .then(r => r.json()) >+ .then(j => { >+ assert_header_equals(j.header, { >+ "cause": undefined, >+ "destination": "empty", >+ "site": "same-origin" >+ }); >+ }); >+ }, "Same-origin fetch"); >+ >+ promise_test(t => { >+ return fetch("https://{{hosts[][www]}}:{{ports[https][0]}}/fetch/sec-metadata/resources/echo-as-json.py") >+ .then(r => r.json()) >+ .then(j => { >+ assert_header_equals(j.header, { >+ "cause": undefined, >+ "destination": "empty", >+ "site": "same-site" >+ }); >+ }); >+ }, "Same-site fetch"); >+ >+ promise_test(t => { >+ return fetch("https://{{hosts[alt][www]}}:{{ports[https][0]}}/fetch/sec-metadata/resources/echo-as-json.py") >+ .then(r => r.json()) >+ .then(j => { >+ assert_header_equals(j.header, { >+ "cause": undefined, >+ "destination": "empty", >+ "site": "cross-site" >+ }); >+ }); >+ }, "Cross-site fetch"); >+</script> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/font.tentative.https.sub-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/font.tentative.https.sub-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..d61d571ef953235af51e73470a4fc324a6b423fe >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/font.tentative.https.sub-expected.txt >@@ -0,0 +1,10 @@ >+Blocked access to external URL https://www.localhost:9443/fetch/sec-metadata/resources/record-header.py?file=font-same-site >+Blocked access to external URL https://www.not-web-platform.test:9443/fetch/sec-metadata/resources/record-header.py?file=font-cross-site >+1 >+2 >+3 >+ >+FAIL Same-Origin font assert_equals: destination expected (string) "font" but got (undefined) undefined >+FAIL Same-Site font assert_equals: destination expected (string) "font" but got (undefined) undefined >+FAIL Cross-Site font assert_equals: destination expected (string) "font" but got (undefined) undefined >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/font.tentative.https.sub.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/font.tentative.https.sub.html >new file mode 100644 >index 0000000000000000000000000000000000000000..0a75531c405fc6db3320caec5567bec1ac38c763 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/font.tentative.https.sub.html >@@ -0,0 +1,84 @@ >+<!DOCTYPE html> >+<html> >+<link rel="author" href="mtrzos@google.com" title="Maciek Trzos"> >+<script src=/resources/testharness.js></script> >+<script src=/resources/testharnessreport.js></script> >+<script src=/fetch/sec-metadata/resources/helper.js></script> >+<body> >+ <div id="test1">1</div> >+ <div id="test2">2</div> >+ <div id="test3">3</div> >+ <!-- Same-Origin request --> >+ <style> >+ @font-face { >+ font-family: myFirstFont; >+ src: url(https://{{host}}:{{ports[https][0]}}/fetch/sec-metadata/resources/record-header.py?file=font-same-origin); >+ } >+ #test1 { >+ font-family: myFirstFont; >+ } >+ </style> >+ >+ <!-- Same-Site request --> >+ <style> >+ @font-face { >+ font-family: mySecondFont; >+ src: url(https://{{hosts[][www]}}:{{ports[https][0]}}/fetch/sec-metadata/resources/record-header.py?file=font-same-site); >+ } >+ #test2 { >+ font-family: mySecondFont; >+ } >+ </style> >+ >+ <!-- Cross-Site request --> >+ <style> >+ @font-face { >+ font-family: myThirdFont; >+ src: url(https://{{hosts[alt][www]}}:{{ports[https][0]}}/fetch/sec-metadata/resources/record-header.py?file=font-cross-site); >+ } >+ #test3 { >+ font-family: myThirdFont; >+ } >+ </style> >+</body> >+<script> >+ document.fonts.ready.then(function () { >+ promise_test(t => { >+ return new Promise((resolve, reject) => { >+ let key = "font-same-origin"; >+ let expected = {"destination":"font", "site":"same-origin"}; >+ fetch("/fetch/sec-metadata/resources/record-header.py?retrieve=true&file=" + key) >+ .then(response => response.text()) >+ .then(text => assert_header_equals(text, expected)) >+ .then(_ => resolve()) >+ .catch(e => reject(e)); >+ }); >+ }, "Same-Origin font"); >+ >+ promise_test(t => { >+ return new Promise((resolve, reject) => { >+ let key = "font-same-site"; >+ let expected = {"destination":"font", "site":"same-site"}; >+ fetch("/fetch/sec-metadata/resources/record-header.py?retrieve=true&file=" + key) >+ .then(response => response.text()) >+ .then(text => assert_header_equals(text, expected)) >+ .then(_ => resolve()) >+ .catch(e => reject(e)); >+ }); >+ }, "Same-Site font"); >+ >+ promise_test(t => { >+ return new Promise((resolve, reject) => { >+ let key = "font-cross-site"; >+ let expected = {"destination":"font", "site":"cross-site"}; >+ fetch("/fetch/sec-metadata/resources/record-header.py?retrieve=true&file=" + key) >+ .then(response => response.text()) >+ .then(text => assert_header_equals(text, expected)) >+ .then(_ => resolve()) >+ .catch(e => reject(e)); >+ }); >+ }, "Cross-Site font"); >+ >+ }); >+</script> >+</html> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/iframe.tentative.https.sub-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/iframe.tentative.https.sub-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..8043006c0520d927805aa078a86ff91dd4d58b81 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/iframe.tentative.https.sub-expected.txt >@@ -0,0 +1,10 @@ >+Blocked access to external URL https://www.localhost:9443/fetch/sec-metadata/resources/post-to-owner.py >+Blocked access to external URL https://www.not-web-platform.test:9443/fetch/sec-metadata/resources/post-to-owner.py >+ >+ >+Harness Error (TIMEOUT), message = null >+ >+FAIL Same-origin iframe assert_not_equals: Empty Sec-Metadata header. got disallowed value "" >+TIMEOUT Same-site iframe Test timed out >+TIMEOUT Cross-site iframe Test timed out >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/iframe.tentative.https.sub.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/iframe.tentative.https.sub.html >new file mode 100644 >index 0000000000000000000000000000000000000000..8d89cda8936cc33a22e0899a2c8b3560b7ef20bd >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/iframe.tentative.https.sub.html >@@ -0,0 +1,60 @@ >+<!DOCTYPE html> >+<script src=/resources/testharness.js></script> >+<script src=/resources/testharnessreport.js></script> >+<script src=/fetch/sec-metadata/resources/helper.js></script> >+<body> >+<script> >+ async_test(t => { >+ let i = document.createElement('iframe'); >+ i.src = "https://{{host}}:{{ports[https][0]}}/fetch/sec-metadata/resources/post-to-owner.py"; >+ window.addEventListener('message', t.step_func(e => { >+ if (e.source != i.contentWindow) >+ return; >+ >+ assert_header_equals(e.data, { >+ "cause": "forced", >+ "destination": "nested-document", >+ "site": "same-origin" >+ }); >+ t.done(); >+ })); >+ >+ document.body.appendChild(i); >+ }, "Same-origin iframe"); >+ >+ async_test(t => { >+ let i = document.createElement('iframe'); >+ i.src = "https://{{hosts[][www]}}:{{ports[https][0]}}/fetch/sec-metadata/resources/post-to-owner.py"; >+ window.addEventListener('message', t.step_func(e => { >+ if (e.source != i.contentWindow) >+ return; >+ >+ assert_header_equals(e.data, { >+ "cause": "forced", >+ "destination": "nested-document", >+ "site": "same-site" >+ }); >+ t.done(); >+ })); >+ >+ document.body.appendChild(i); >+ }, "Same-site iframe"); >+ >+ async_test(t => { >+ let i = document.createElement('iframe'); >+ i.src = "https://{{hosts[alt][www]}}:{{ports[https][0]}}/fetch/sec-metadata/resources/post-to-owner.py"; >+ window.addEventListener('message', t.step_func(e => { >+ if (e.source != i.contentWindow) >+ return; >+ >+ assert_header_equals(e.data, { >+ "cause": "forced", >+ "destination": "nested-document", >+ "site": "cross-site" >+ }); >+ t.done(); >+ })); >+ >+ document.body.appendChild(i); >+ }, "Cross-site iframe"); >+</script> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/img.tentative.https.sub-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/img.tentative.https.sub-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..5059c7d9b6e1120adad05f9ae76391180c2a730c >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/img.tentative.https.sub-expected.txt >@@ -0,0 +1,5 @@ >+ >+FAIL Same-origin image Can't find variable: loadImageInWindow >+FAIL Same-site image Can't find variable: loadImageInWindow >+FAIL Cross-site image Can't find variable: loadImageInWindow >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/img.tentative.https.sub.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/img.tentative.https.sub.html >new file mode 100644 >index 0000000000000000000000000000000000000000..20701a6514653f86e33b3cdf700ecd0628097d6c >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/img.tentative.https.sub.html >@@ -0,0 +1,51 @@ >+<!DOCTYPE html> >+<script src=/resources/testharness.js></script> >+<script src=/resources/testharnessreport.js></script> >+<script src=/referrer-policy/generic/common.js></script> >+<script src=/fetch/sec-metadata/resources/helper.js></script> >+<body> >+<script> >+ // These tests reuse the `referrer-policy` infrastructure to load images that >+ // encode their request headers in their pixels. Fun stuff! >+ async_test(t => { >+ loadImageInWindow( >+ "https://{{host}}:{{ports[https][0]}}/referrer-policy/generic/subresource/image.py", >+ t.step_func_done(img => { >+ assert_header_equals(decodeImageData(extractImageData(img)).headers["sec-metadata"], { >+ "cause": undefined, >+ "destination": "image", >+ "site": "same-origin" >+ }); >+ }), >+ [], >+ window); >+ }, "Same-origin image"); >+ >+ async_test(t => { >+ loadImageInWindow( >+ "https://{{hosts[][www]}}:{{ports[https][0]}}/referrer-policy/generic/subresource/image.py", >+ t.step_func_done(img => { >+ assert_header_equals(decodeImageData(extractImageData(img)).headers["sec-metadata"], { >+ "cause": undefined, >+ "destination": "image", >+ "site": "same-site" >+ }); >+ }), >+ [], >+ window); >+ }, "Same-site image"); >+ >+ async_test(t => { >+ loadImageInWindow( >+ "https://{{hosts[alt][www]}}:{{ports[https][0]}}/referrer-policy/generic/subresource/image.py", >+ t.step_func_done(img => { >+ assert_header_equals(decodeImageData(extractImageData(img)).headers["sec-metadata"], { >+ "cause": undefined, >+ "destination": "image", >+ "site": "cross-site" >+ }); >+ }), >+ [], >+ window); >+ }, "Cross-site image"); >+</script> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/object.tentative.https.sub-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/object.tentative.https.sub-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..d1e5501aff92f4d42e0910e7bf127fe2e53ae808 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/object.tentative.https.sub-expected.txt >@@ -0,0 +1,8 @@ >+ >+ >+Harness Error (TIMEOUT), message = null >+ >+TIMEOUT Same-Origin object Test timed out >+NOTRUN Same-Site object >+NOTRUN Cross-Site object >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/object.tentative.https.sub.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/object.tentative.https.sub.html >new file mode 100644 >index 0000000000000000000000000000000000000000..e1ac53157e023a9c6bc4806feda2e782ef4eefa5 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/object.tentative.https.sub.html >@@ -0,0 +1,65 @@ >+<!DOCTYPE html> >+<meta charset="utf-8"/> >+<link rel="author" href="mtrzos@google.com" title="Maciek Trzos"> >+<script src=/resources/testharness.js></script> >+<script src=/resources/testharnessreport.js></script> >+<script src=/fetch/sec-metadata/resources/helper.js></script> >+<body> >+<script> >+ promise_test(t => { >+ return new Promise((resolve, reject) => { >+ let key = "object-same-origin"; >+ >+ let e = document.createElement('object'); >+ e.data = "https://{{host}}:{{ports[https][0]}}/fetch/sec-metadata/resources/record-header.py?file=" + key; >+ e.onload = e => { >+ let expected = {"destination":"object", "site":"same-origin"}; >+ fetch("/fetch/sec-metadata/resources/record-header.py?retrieve=true&file=" + key) >+ .then(response => response.text()) >+ .then(text => assert_header_equals(text, expected)) >+ .then(_ => resolve()) >+ .catch(e => reject(e)); >+ }; >+ >+ document.body.appendChild(e); >+ }) >+ }, "Same-Origin object"); >+ >+ promise_test(t => { >+ return new Promise((resolve, reject) => { >+ let key = "object-same-site"; >+ >+ let e = document.createElement('object'); >+ e.data = "https://{{hosts[][www]}}:{{ports[https][0]}}/fetch/sec-metadata/resources/record-header.py?file=" + key; >+ e.onload = e => { >+ let expected = {"destination":"object", "site":"same-site"}; >+ fetch("/fetch/sec-metadata/resources/record-header.py?retrieve=true&file=" + key) >+ .then(response => response.text()) >+ .then(text => assert_header_equals(text, expected)) >+ .then(_ => resolve()) >+ .catch(e => reject(e)); >+ }; >+ >+ document.body.appendChild(e); >+ }) >+ }, "Same-Site object"); >+ >+ promise_test(t => { >+ return new Promise((resolve, reject) => { >+ let key = "object-cross-site"; >+ >+ let e = document.createElement('object'); >+ e.data = "https://{{hosts[alt][www]}}:{{ports[https][0]}}/fetch/sec-metadata/resources/record-header.py?file=" + key; >+ e.onload = e => { >+ let expected = {"destination":"object", "site":"cross-site"}; >+ fetch("/fetch/sec-metadata/resources/record-header.py?retrieve=true&file=" + key) >+ .then(response => response.text()) >+ .then(text => assert_header_equals(text, expected)) >+ .then(_ => resolve()) >+ .catch(e => reject(e)); >+ }; >+ >+ document.body.appendChild(e); >+ }) >+ }, "Cross-Site object"); >+</script> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/redirect/cross-site-redirect.tentative.https.sub-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/redirect/cross-site-redirect.tentative.https.sub-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..6217c5de46f0d92480083ed1fe448b08d2729dad >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/redirect/cross-site-redirect.tentative.https.sub-expected.txt >@@ -0,0 +1,9 @@ >+Blocked access to external URL https://www.not-web-platform.test:9443/xhr/resources/redirect.py?location=https://localhost:9443/fetch/sec-metadata/resources/record-header.py?file=redirect-cross-site-same-origin >+Blocked access to external URL https://www.not-web-platform.test:9443/xhr/resources/redirect.py?location=https://www.localhost:9443/fetch/sec-metadata/resources/record-header.py?file=redirect-cross-site-same-site >+Blocked access to external URL https://www.not-web-platform.test:9443/xhr/resources/redirect.py?location=https://www.not-web-platform.test:9443/fetch/sec-metadata/resources/record-header.py?file=redirect-cross-site-cross-site >+ >+ >+FAIL Cross-Site -> Same-Origin redirect assert_equals: destination expected (string) "image" but got (undefined) undefined >+FAIL Cross-Site -> Same-Site redirect assert_equals: destination expected (string) "image" but got (undefined) undefined >+FAIL Cross-Site -> Cross-Site redirect assert_equals: destination expected (string) "image" but got (undefined) undefined >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/redirect/cross-site-redirect.tentative.https.sub.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/redirect/cross-site-redirect.tentative.https.sub.html >new file mode 100644 >index 0000000000000000000000000000000000000000..9f497a9b62b80da4eff2e35220c1d6317e0e2817 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/redirect/cross-site-redirect.tentative.https.sub.html >@@ -0,0 +1,86 @@ >+<!DOCTYPE html> >+ >+<link rel="author" href="mtrzos@google.com" title="Maciek Trzos"> >+<script src=/resources/testharness.js></script> >+<script src=/resources/testharnessreport.js></script> >+<script src=/fetch/sec-metadata/resources/helper.js></script> >+<body></body> >+<script> >+promise_test(t => { >+ return new Promise((resolve, reject) => { >+ let key = "redirect-cross-site-same-origin"; >+ >+ let e = document.createElement('img'); >+ e.src = "https://{{hosts[alt][www]}}:{{ports[https][0]}}/xhr/resources/redirect.py?location=https://{{host}}:{{ports[https][0]}}/fetch/sec-metadata/resources/record-header.py?file=" + key; >+ let expected = {"destination":"image", "site":"cross-site"}; >+ e.onload = e => { >+ fetch("/fetch/sec-metadata/resources/record-header.py?retrieve=true&file=" + key) >+ .then(response => response.text()) >+ .then(text => assert_header_equals(text, expected)) >+ .then(_ => resolve()) >+ .catch(e => reject(e)); >+ }; >+ e.onerror = e => { >+ fetch("/fetch/sec-metadata/resources/record-header.py?retrieve=true&file=" + key) >+ .then(response => response.text()) >+ .then(text => assert_header_equals(text, expected)) >+ .then(_ => resolve()) >+ .catch(e => reject(e)); >+ }; >+ >+ document.body.appendChild(e); >+ }) >+ }, "Cross-Site -> Same-Origin redirect"); >+ >+ promise_test(t => { >+ return new Promise((resolve, reject) => { >+ let key = "redirect-cross-site-same-site"; >+ >+ let e = document.createElement('img'); >+ e.src = "https://{{hosts[alt][www]}}:{{ports[https][0]}}/xhr/resources/redirect.py?location=https://{{hosts[][www]}}:{{ports[https][0]}}/fetch/sec-metadata/resources/record-header.py?file=" + key; >+ let expected = {"destination":"image", "site":"cross-site"}; >+ e.onload = e => { >+ fetch("/fetch/sec-metadata/resources/record-header.py?retrieve=true&file=" + key) >+ .then(response => response.text()) >+ .then(text => assert_header_equals(text, expected)) >+ .then(_ => resolve()) >+ .catch(e => reject(e)); >+ }; >+ e.onerror = e => { >+ fetch("/fetch/sec-metadata/resources/record-header.py?retrieve=true&file=" + key) >+ .then(response => response.text()) >+ .then(text => assert_header_equals(text, expected)) >+ .then(_ => resolve()) >+ .catch(e => reject(e)); >+ }; >+ >+ document.body.appendChild(e); >+ }) >+ }, "Cross-Site -> Same-Site redirect"); >+ >+ promise_test(t => { >+ return new Promise((resolve, reject) => { >+ let key = "redirect-cross-site-cross-site"; >+ >+ let e = document.createElement('img'); >+ e.src = "https://{{hosts[alt][www]}}:{{ports[https][0]}}/xhr/resources/redirect.py?location=https://{{hosts[alt][www]}}:{{ports[https][0]}}/fetch/sec-metadata/resources/record-header.py?file=" + key; >+ let expected = {"destination":"image", "site":"cross-site"}; >+ e.onload = e => { >+ fetch("/fetch/sec-metadata/resources/record-header.py?retrieve=true&file=" + key) >+ .then(response => response.text()) >+ .then(text => assert_header_equals(text, expected)) >+ .then(_ => resolve()) >+ .catch(e => reject(e)); >+ }; >+ e.onerror = e => { >+ fetch("/fetch/sec-metadata/resources/record-header.py?retrieve=true&file=" + key) >+ .then(response => response.text()) >+ .then(text => assert_header_equals(text, expected)) >+ .then(_ => resolve()) >+ .catch(e => reject(e)); >+ }; >+ >+ document.body.appendChild(e); >+ }) >+ }, "Cross-Site -> Cross-Site redirect"); >+</script> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/redirect/multiple-redirect-cross-site.tentative.https.sub-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/redirect/multiple-redirect-cross-site.tentative.https.sub-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..d60c5fa062de220aa4f1877abc84bdd45ed978fd >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/redirect/multiple-redirect-cross-site.tentative.https.sub-expected.txt >@@ -0,0 +1,7 @@ >+Blocked access to external URL https://www.not-web-platform.test:9443/xhr/resources/redirect.py?location=https://localhost:9443/fetch/sec-metadata/resources/record-header.py?file=redirect-multiple-cross-site >+ >+ >+Harness Error (TIMEOUT), message = null >+ >+TIMEOUT Same-Origin -> Cross-Site -> Same-Origin redirect Test timed out >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/redirect/multiple-redirect-cross-site.tentative.https.sub.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/redirect/multiple-redirect-cross-site.tentative.https.sub.html >new file mode 100644 >index 0000000000000000000000000000000000000000..fdd8733ba6d682b1f6b55fb4e3738d03a1fbbb50 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/redirect/multiple-redirect-cross-site.tentative.https.sub.html >@@ -0,0 +1,37 @@ >+<!DOCTYPE html> >+ >+<link rel="author" href="mtrzos@google.com" title="Maciek Trzos"> >+<script src=/resources/testharness.js></script> >+<script src=/resources/testharnessreport.js></script> >+<script src=/fetch/sec-metadata/resources/helper.js></script> >+<body></body> >+<script> >+promise_test(t => { >+ return new Promise((resolve, reject) => { >+ let key = "redirect-multiple-cross-site"; >+ >+ let e = document.createElement('img'); >+ e.src = "https://{{host}}:{{ports[https][0]}}/xhr/resources/redirect.py?location=" +// same-origin >+ "https://{{hosts[alt][www]}}:{{ports[https][0]}}/xhr/resources/redirect.py?location=" +// cross-site >+ "https://{{host}}:{{ports[https][0]}}/fetch/sec-metadata/resources/record-header.py?file=" + key;// same-origin >+ let expected = {"destination":"image", "site":"cross-site"}; >+ >+ e.onload = e => { >+ fetch("/fetch/sec-metadata/resources/record-header.py?retrieve=true&file=" + key) >+ .then(response => response.text()) >+ .then(text => assert_header_equals(text, expected)) >+ .then(_ => resolve()) >+ .catch(e => reject(e)); >+ }; >+ e.onerror = e => { >+ fetch("/fetch/sec-metadata/resources/record-header.py?retrieve=true&file=" + key) >+ .then(response => response.text()) >+ .then(text => assert_header_equals(text, expected)) >+ .then(_ => resolve()) >+ .catch(e => reject(e)); >+ }; >+ >+ document.body.appendChild(e); >+ }) >+ }, "Same-Origin -> Cross-Site -> Same-Origin redirect"); >+</script> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/redirect/multiple-redirect-same-site.tentative.https.sub-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/redirect/multiple-redirect-same-site.tentative.https.sub-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..0c45b5f129f66b23f19d18c5546e0f99611dbe9c >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/redirect/multiple-redirect-same-site.tentative.https.sub-expected.txt >@@ -0,0 +1,7 @@ >+Blocked access to external URL https://www.localhost:9443/xhr/resources/redirect.py?location=https://localhost:9443/fetch/sec-metadata/resources/record-header.py?file=redirect-multiple-same-site >+ >+ >+Harness Error (TIMEOUT), message = null >+ >+TIMEOUT Same-Origin -> Same-Site -> Same-Origin redirect Test timed out >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/redirect/multiple-redirect-same-site.tentative.https.sub.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/redirect/multiple-redirect-same-site.tentative.https.sub.html >new file mode 100644 >index 0000000000000000000000000000000000000000..8fdc943f4c96c0616778c3316587f3cc598606eb >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/redirect/multiple-redirect-same-site.tentative.https.sub.html >@@ -0,0 +1,37 @@ >+<!DOCTYPE html> >+ >+<link rel="author" href="mtrzos@google.com" title="Maciek Trzos"> >+<script src=/resources/testharness.js></script> >+<script src=/resources/testharnessreport.js></script> >+<script src=/fetch/sec-metadata/resources/helper.js></script> >+<body></body> >+<script> >+promise_test(t => { >+ return new Promise((resolve, reject) => { >+ let key = "redirect-multiple-same-site"; >+ >+ let e = document.createElement('img'); >+ e.src = "https://{{host}}:{{ports[https][0]}}/xhr/resources/redirect.py?location=" +// same-origin >+ "https://{{hosts[][www]}}:{{ports[https][0]}}/xhr/resources/redirect.py?location=" +// same-site >+ "https://{{host}}:{{ports[https][0]}}/fetch/sec-metadata/resources/record-header.py?file=" + key;// same-origin >+ let expected = {"destination":"image", "site":"same-site"}; >+ >+ e.onload = e => { >+ fetch("/fetch/sec-metadata/resources/record-header.py?retrieve=true&file=" + key) >+ .then(response => response.text()) >+ .then(text => assert_header_equals(text, expected)) >+ .then(_ => resolve()) >+ .catch(e => reject(e)); >+ }; >+ e.onerror = e => { >+ fetch("/fetch/sec-metadata/resources/record-header.py?retrieve=true&file=" + key) >+ .then(response => response.text()) >+ .then(text => assert_header_equals(text, expected)) >+ .then(_ => resolve()) >+ .catch(e => reject(e)); >+ }; >+ >+ document.body.appendChild(e); >+ }) >+ }, "Same-Origin -> Same-Site -> Same-Origin redirect"); >+</script> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/redirect/same-origin-redirect.tentative.https.sub-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/redirect/same-origin-redirect.tentative.https.sub-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..985e0b149affc4440139731fca96644a370a315c >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/redirect/same-origin-redirect.tentative.https.sub-expected.txt >@@ -0,0 +1,9 @@ >+Blocked access to external URL https://www.localhost:9443/fetch/sec-metadata/resources/record-header.py?file=redirect-same-origin-same-site >+ >+ >+Harness Error (TIMEOUT), message = null >+ >+FAIL Same-Origin -> Same-Origin redirect assert_not_equals: Empty Sec-Metadata header. got disallowed value "" >+TIMEOUT Same-Origin -> Same-Site redirect Test timed out >+NOTRUN Same-Origin -> Cross-Site redirect >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/redirect/same-origin-redirect.tentative.https.sub.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/redirect/same-origin-redirect.tentative.https.sub.html >new file mode 100644 >index 0000000000000000000000000000000000000000..dea71c3f67dca694e05f3c00db1d2d7aea5f3744 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/redirect/same-origin-redirect.tentative.https.sub.html >@@ -0,0 +1,89 @@ >+<!DOCTYPE html> >+ >+<link rel="author" href="mtrzos@google.com" title="Maciek Trzos"> >+<script src=/resources/testharness.js></script> >+<script src=/resources/testharnessreport.js></script> >+<script src=/fetch/sec-metadata/resources/helper.js></script> >+<body></body> >+<script> >+promise_test(t => { >+ return new Promise((resolve, reject) => { >+ let key = "redirect-same-origin-same-origin"; >+ >+ let e = document.createElement('img'); >+ e.src = "/xhr/resources/redirect.py?location=https://{{host}}:{{ports[https][0]}}/fetch/sec-metadata/resources/record-header.py?file=" + key; >+ let expected = {"destination":"image", "site":"same-origin"}; >+ >+ e.onload = e => { >+ fetch("/fetch/sec-metadata/resources/record-header.py?retrieve=true&file=" + key) >+ .then(response => response.text()) >+ .then(text => assert_header_equals(text, expected)) >+ .then(_ => resolve()) >+ .catch(e => reject(e)); >+ }; >+ e.onerror = e => { >+ fetch("/fetch/sec-metadata/resources/record-header.py?retrieve=true&file=" + key) >+ .then(response => response.text()) >+ .then(text => assert_header_equals(text, expected)) >+ .then(_ => resolve()) >+ .catch(e => reject(e)); >+ }; >+ >+ document.body.appendChild(e); >+ }) >+ }, "Same-Origin -> Same-Origin redirect"); >+ >+promise_test(t => { >+ return new Promise((resolve, reject) => { >+ let key = "redirect-same-origin-same-site"; >+ >+ let e = document.createElement('img'); >+ e.src = "/xhr/resources/redirect.py?location=https://{{hosts[][www]}}:{{ports[https][0]}}/fetch/sec-metadata/resources/record-header.py?file=" + key; >+ let expected = {"destination":"image", "site":"same-site"}; >+ >+ e.onload = e => { >+ fetch("/fetch/sec-metadata/resources/record-header.py?retrieve=true&file=" + key) >+ .then(response => response.text()) >+ .then(text => assert_header_equals(text, expected)) >+ .then(_ => resolve()) >+ .catch(e => reject(e)); >+ }; >+ e.onerror = e => { >+ fetch("/fetch/sec-metadata/resources/record-header.py?retrieve=true&file=" + key) >+ .then(response => response.text()) >+ .then(text => assert_header_equals(text, expected)) >+ .then(_ => resolve()) >+ .catch(e => reject(e)); >+ }; >+ >+ document.body.appendChild(e); >+ }) >+ }, "Same-Origin -> Same-Site redirect"); >+ >+promise_test(t => { >+ return new Promise((resolve, reject) => { >+ let key = "redirect-same-origin-cross-site"; >+ >+ let e = document.createElement('img'); >+ e.src = "/xhr/resources/redirect.py?location=https://{{hosts[alt][www]}}:{{ports[https][0]}}/fetch/sec-metadata/resources/record-header.py?file=" + key; >+ let expected = {"destination":"image", "site":"cross-site"}; >+ >+ e.onload = e => { >+ fetch("/fetch/sec-metadata/resources/record-header.py?retrieve=true&file=" + key) >+ .then(response => response.text()) >+ .then(text => assert_header_equals(text, expected)) >+ .then(_ => resolve()) >+ .catch(e => reject(e)); >+ }; >+ e.onerror = e => { >+ fetch("/fetch/sec-metadata/resources/record-header.py?retrieve=true&file=" + key) >+ .then(response => response.text()) >+ .then(text => assert_header_equals(text, expected)) >+ .then(_ => resolve()) >+ .catch(e => reject(e)); >+ }; >+ >+ document.body.appendChild(e); >+ }) >+ }, "Same-Origin -> Cross-Site redirect"); >+</script> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/redirect/same-site-redirect.tentative.https.sub-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/redirect/same-site-redirect.tentative.https.sub-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..c853de446a6dfb189183d893d949b8be2cc1d865 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/redirect/same-site-redirect.tentative.https.sub-expected.txt >@@ -0,0 +1,9 @@ >+Blocked access to external URL https://www.localhost:9443/xhr/resources/redirect.py?location=https://localhost:9443/fetch/sec-metadata/resources/record-header.py?file=redirect-same-site-same-origin >+Blocked access to external URL https://www.localhost:9443/xhr/resources/redirect.py?location=https://localhost:9443/fetch/sec-metadata/resources/record-header.py?file=redirect-same-site-same-site >+Blocked access to external URL https://www.localhost:9443/xhr/resources/redirect.py?location=https://www.not-web-platform.test:9443/fetch/sec-metadata/resources/record-header.py?file=redirect-same-site-cross-site >+ >+ >+FAIL Same-Site -> Same-Origin redirect assert_equals: destination expected (string) "image" but got (undefined) undefined >+FAIL Same-Site -> Same-Site redirect assert_equals: destination expected (string) "image" but got (undefined) undefined >+FAIL Same-Site -> Cross-Site redirect assert_equals: destination expected (string) "image" but got (undefined) undefined >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/redirect/same-site-redirect.tentative.https.sub.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/redirect/same-site-redirect.tentative.https.sub.html >new file mode 100644 >index 0000000000000000000000000000000000000000..a71163a1bfcb09196083dd1a38f4a6863f46eca8 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/redirect/same-site-redirect.tentative.https.sub.html >@@ -0,0 +1,89 @@ >+<!DOCTYPE html> >+ >+<link rel="author" href="mtrzos@google.com" title="Maciek Trzos"> >+<script src=/resources/testharness.js></script> >+<script src=/resources/testharnessreport.js></script> >+<script src=/fetch/sec-metadata/resources/helper.js></script> >+<body></body> >+<script> >+promise_test(t => { >+ return new Promise((resolve, reject) => { >+ let key = "redirect-same-site-same-origin"; >+ >+ let e = document.createElement('img'); >+ e.src = "https://{{hosts[][www]}}:{{ports[https][0]}}/xhr/resources/redirect.py?location=https://{{host}}:{{ports[https][0]}}/fetch/sec-metadata/resources/record-header.py?file=" + key; >+ let expected = {"destination":"image", "site":"same-site"}; >+ >+ e.onload = e => { >+ fetch("/fetch/sec-metadata/resources/record-header.py?retrieve=true&file=" + key) >+ .then(response => response.text()) >+ .then(text => assert_header_equals(text, expected)) >+ .then(_ => resolve()) >+ .catch(e => reject(e)); >+ }; >+ e.onerror = e => { >+ fetch("/fetch/sec-metadata/resources/record-header.py?retrieve=true&file=" + key) >+ .then(response => response.text()) >+ .then(text => assert_header_equals(text, expected)) >+ .then(_ => resolve()) >+ .catch(e => reject(e)); >+ }; >+ >+ document.body.appendChild(e); >+ }) >+ }, "Same-Site -> Same-Origin redirect"); >+ >+promise_test(t => { >+ return new Promise((resolve, reject) => { >+ let key = "redirect-same-site-same-site"; >+ >+ let e = document.createElement('img'); >+ e.src = "https://{{hosts[][www]}}:{{ports[https][0]}}/xhr/resources/redirect.py?location=https://{{host}}:{{ports[https][0]}}/fetch/sec-metadata/resources/record-header.py?file=" + key; >+ let expected = {"destination":"image", "site":"same-site"}; >+ >+ e.onload = e => { >+ fetch("/fetch/sec-metadata/resources/record-header.py?retrieve=true&file=" + key) >+ .then(response => response.text()) >+ .then(text => assert_header_equals(text, expected)) >+ .then(_ => resolve()) >+ .catch(e => reject(e)); >+ }; >+ e.onerror = e => { >+ fetch("/fetch/sec-metadata/resources/record-header.py?retrieve=true&file=" + key) >+ .then(response => response.text()) >+ .then(text => assert_header_equals(text, expected)) >+ .then(_ => resolve()) >+ .catch(e => reject(e)); >+ }; >+ >+ document.body.appendChild(e); >+ }) >+ }, "Same-Site -> Same-Site redirect"); >+ >+promise_test(t => { >+ return new Promise((resolve, reject) => { >+ let key = "redirect-same-site-cross-site"; >+ >+ let e = document.createElement('img'); >+ e.src = "https://{{hosts[][www]}}:{{ports[https][0]}}/xhr/resources/redirect.py?location=https://{{hosts[alt][www]}}:{{ports[https][0]}}/fetch/sec-metadata/resources/record-header.py?file=" + key; >+ let expected = {"destination":"image", "site":"cross-site"}; >+ >+ e.onload = e => { >+ fetch("/fetch/sec-metadata/resources/record-header.py?retrieve=true&file=" + key) >+ .then(response => response.text()) >+ .then(text => assert_header_equals(text, expected)) >+ .then(_ => resolve()) >+ .catch(e => reject(e)); >+ }; >+ e.onerror = e => { >+ fetch("/fetch/sec-metadata/resources/record-header.py?retrieve=true&file=" + key) >+ .then(response => response.text()) >+ .then(text => assert_header_equals(text, expected)) >+ .then(_ => resolve()) >+ .catch(e => reject(e)); >+ }; >+ >+ document.body.appendChild(e); >+ }) >+ }, "Same-Site -> Cross-Site redirect"); >+</script> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/redirect/w3c-import.log b/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/redirect/w3c-import.log >new file mode 100644 >index 0000000000000000000000000000000000000000..03015f57e998cd5e45ae749a4e7b463c97796254 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/redirect/w3c-import.log >@@ -0,0 +1,21 @@ >+The tests in this directory were imported from the W3C repository. >+Do NOT modify these tests directly in WebKit. >+Instead, create a pull request on the WPT github: >+ https://github.com/web-platform-tests/wpt >+ >+Then run the Tools/Scripts/import-w3c-tests in WebKit to reimport >+ >+Do NOT modify or remove this file. >+ >+------------------------------------------------------------------------ >+Properties requiring vendor prefixes: >+None >+Property values requiring vendor prefixes: >+None >+------------------------------------------------------------------------ >+List of files: >+/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/redirect/cross-site-redirect.tentative.https.sub.html >+/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/redirect/multiple-redirect-cross-site.tentative.https.sub.html >+/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/redirect/multiple-redirect-same-site.tentative.https.sub.html >+/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/redirect/same-origin-redirect.tentative.https.sub.html >+/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/redirect/same-site-redirect.tentative.https.sub.html >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/report.tentative.https.sub-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/report.tentative.https.sub-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..e0c2f1f54016c132376b84e17cc868d692dd67a4 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/report.tentative.https.sub-expected.txt >@@ -0,0 +1,9 @@ >+CONSOLE MESSAGE: Refused to load https://foo.bar/ because it does not appear in the style-src directive of the Content Security Policy. >+CONSOLE MESSAGE: Refused to load https://foo.bar/ because it does not appear in the style-src directive of the Content Security Policy. >+CONSOLE MESSAGE: Refused to load https://foo.bar/ because it does not appear in the style-src directive of the Content Security Policy. >+CONSOLE MESSAGE: Refused to load https://foo.bar/ because it does not appear in the style-src directive of the Content Security Policy. >+CONSOLE MESSAGE: Refused to load https://foo.bar/ because it does not appear in the style-src directive of the Content Security Policy. >+CONSOLE MESSAGE: Refused to load https://foo.bar/ because it does not appear in the style-src directive of the Content Security Policy. >+ >+PASS Initialization. >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/report.tentative.https.sub.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/report.tentative.https.sub.html >new file mode 100644 >index 0000000000000000000000000000000000000000..a74da6a7a7d60fcdc35dd32873ea25cf5e356dea >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/report.tentative.https.sub.html >@@ -0,0 +1,31 @@ >+<!DOCTYPE html> >+<link rel="author" href="mtrzos@google.com" title="Maciek Trzos"> >+<script src=/resources/testharness.js></script> >+<script src=/resources/testharnessreport.js></script> >+<script src=/fetch/sec-metadata/resources/helper.js></script> >+<link id="style" href="https://foo.bar" rel="stylesheet"> >+<body></body> >+<script> >+ function generate_test(expected, name) { >+ async_test(t => { >+ t.step_timeout(_ => { >+ return fetch("/fetch/sec-metadata/resources/record-header.py?retrieve=true&file=report-" + name) >+ .then(response => response.text()) >+ .then(text => assert_header_equals(text, expected)) >+ .then(_ => t.done()); >+ }, 1000); >+ }, name + " report"); >+ } >+ >+ test(_ => { >+ let counter = 0; >+ document.addEventListener("securitypolicyviolation", (e) => { >+ counter++; >+ if (counter == 3) { >+ generate_test({"destination":"report", "site":"same-origin"}, "same-origin"); >+ generate_test({"destination":"report", "site":"same-site"}, "same-site"); >+ generate_test({"destination":"report", "site":"cross-site"}, "cross-site"); >+ } >+ }); >+ }, "Initialization."); >+</script> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/report.tentative.https.sub.html.sub.headers b/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/report.tentative.https.sub.html.sub.headers >new file mode 100644 >index 0000000000000000000000000000000000000000..5c8bc58ad472ed9de841491df4e3e9e26e2e1c70 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/report.tentative.https.sub.html.sub.headers >@@ -0,0 +1,3 @@ >+Content-Security-Policy: style-src 'self' 'unsafe-inline'; report-uri /fetch/sec-metadata/resources/record-header.py?file=report-same-origin >+Content-Security-Policy: style-src 'self' 'unsafe-inline'; report-uri https://{{hosts[][www]}}:{{ports[https][0]}}/fetch/sec-metadata/resources/record-header.py?file=report-same-site >+Content-Security-Policy: style-src 'self' 'unsafe-inline'; report-uri https://{{hosts[alt][www]}}:{{ports[https][0]}}/fetch/sec-metadata/resources/record-header.py?file=report-cross-site >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/resources/dedicatedWorker.js b/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/resources/dedicatedWorker.js >new file mode 100644 >index 0000000000000000000000000000000000000000..18626d3d8458b967829b724fabebc10e939b62a9 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/resources/dedicatedWorker.js >@@ -0,0 +1 @@ >+self.postMessage("Loaded"); >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/resources/echo-as-json.py b/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/resources/echo-as-json.py >new file mode 100644 >index 0000000000000000000000000000000000000000..16cc67774f76347e5c71220f590a82a37302cff0 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/resources/echo-as-json.py >@@ -0,0 +1,12 @@ >+import json >+ >+def main(request, response): >+ headers = [("Content-Type", "application/json"), >+ ("Access-Control-Allow-Credentials", "true")] >+ >+ if "origin" in request.headers: >+ headers.append(("Access-Control-Allow-Origin", request.headers["origin"])) >+ >+ >+ body = json.dumps({ "header": request.headers.get("sec-metadata", "") }) >+ return headers, body >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/resources/echo-as-script.py b/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/resources/echo-as-script.py >new file mode 100644 >index 0000000000000000000000000000000000000000..c1c6a4673acfbda17e2a7045a304a30082288d1d >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/resources/echo-as-script.py >@@ -0,0 +1,8 @@ >+import json >+ >+def main(request, response): >+ headers = [("Content-Type", "text/javascript")] >+ >+ body = "var header = %s;" % json.dumps(request.headers.get("sec-metadata", "")); >+ >+ return headers, body >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/resources/helper.js b/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/resources/helper.js >new file mode 100644 >index 0000000000000000000000000000000000000000..037f7e1e1deb929322b26ee5436123a7b24db92f >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/resources/helper.js >@@ -0,0 +1,18 @@ >+function parse_metadata(value) { >+ let result = {}; >+ value.split(',').forEach(item => { >+ let parsed = item.trim().split('='); >+ result[parsed[0]] = parsed[1]; >+ }); >+ return result; >+} >+ >+function assert_header_equals(value, expected) { >+ // check that the returned value is an object, not a String >+ assert_not_equals(value, "", "Empty Sec-Metadata header."); >+ let result = parse_metadata(value); >+ assert_equals(result.cause, expected.cause, "cause"); >+ assert_equals(result.destination, expected.destination, "destination"); >+ assert_equals(result.target, expected.target, "target"); >+ assert_equals(result.site, expected.site, "site"); >+} >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/resources/post-to-owner.py b/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/resources/post-to-owner.py >new file mode 100644 >index 0000000000000000000000000000000000000000..5472aa5b47e424bb6590d6c757df635eb4b6dd1f >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/resources/post-to-owner.py >@@ -0,0 +1,16 @@ >+import json >+ >+def main(request, response): >+ headers = [("Content-Type", "text/html")] >+ >+ body = """ >+ <!DOCTYPE html> >+ <script> >+ var data = %s; >+ if (window.opener) >+ window.opener.postMessage(data, "*"); >+ if (window.top != window) >+ window.top.postMessage(data, "*"); >+ </script> >+ """ % json.dumps(request.headers.get("Sec-Metadata", "")) >+ return headers, body >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/resources/record-header.py b/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/resources/record-header.py >new file mode 100644 >index 0000000000000000000000000000000000000000..adf9a53fa17024537b8fce48023a52b62d853a12 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/resources/record-header.py >@@ -0,0 +1,116 @@ >+import os >+import uuid >+import hashlib >+import time >+ >+def main(request, response): >+ ## Get the query parameter (key) from URL ## >+ ## Tests will record POST requests (CSP Report) and GET (rest) ## >+ if request.GET: >+ key = request.GET['file'] >+ elif request.POST: >+ key = request.POST['file'] >+ >+ ## Convert the key from String to UUID valid String ## >+ testId = hashlib.md5(key).hexdigest() >+ >+ ## Handle the header retrieval request ## >+ if 'retrieve' in request.GET: >+ response.writer.write_status(200) >+ response.writer.end_headers() >+ try: >+ header_value = request.server.stash.take(testId) >+ response.writer.write(header_value) >+ except (KeyError, ValueError) as e: >+ response.writer.write("No header has been recorded") >+ pass >+ >+ response.close_connection = True >+ >+ ## Record incoming Sec-Metadata header value >+ else: >+ try: >+ ## Return empty string as a default value ## >+ header = request.headers.get("Sec-Metadata", "") >+ request.server.stash.put(testId, header) >+ except KeyError: >+ ## The header is already recorded or it doesn't exist >+ pass >+ >+ ## Prevent the browser from caching returned responses and allow CORS ## >+ response.headers.set("Access-Control-Allow-Origin", "*") >+ response.headers.set("Cache-Control", "no-cache, no-store, must-revalidate") >+ response.headers.set("Pragma", "no-cache") >+ response.headers.set("Expires", "0") >+ >+ ## Add a valid ServiceWorker Content-Type ## >+ if key.startswith("serviceworker"): >+ response.headers.set("Content-Type", "application/javascript") >+ >+ ## Return a valid .vtt content for the <track> tag ## >+ if key.startswith("track"): >+ return "WEBVTT" >+ >+ ## Return a valid SharedWorker ## >+ if key.startswith("sharedworker"): >+ response.headers.set("Content-Type", "application/javascript") >+ file = open(os.path.join(request.doc_root, "fetch", "sec-metadata", >+ "resources", "sharedWorker.js"), "r") >+ shared_worker = file.read() >+ file.close() >+ return shared_worker >+ >+ ## Return a valid font content and Content-Type ## >+ if key.startswith("font"): >+ response.headers.set("Content-Type", "application/x-font-ttf") >+ file = open(os.path.join(request.doc_root, "fonts", "Ahem.ttf"), "r") >+ font = file.read() >+ file.close() >+ return font >+ >+ ## Return a valid audio content and Content-Type ## >+ if key.startswith("audio"): >+ response.headers.set("Content-Type", "audio/mpeg") >+ file = open(os.path.join(request.doc_root, "media", "sound_5.mp3"), "r") >+ audio = file.read() >+ file.close() >+ return audio >+ >+ ## Return a valid video content and Content-Type ## >+ if key.startswith("video"): >+ response.headers.set("Content-Type", "video/mp4") >+ file = open(os.path.join(request.doc_root, "media", "A4.mp4"), "r") >+ video = file.read() >+ file.close() >+ return video >+ >+ ## Return a valid style content and Content-Type ## >+ if key.startswith("style") or key.startswith("embed") or key.startswith("object"): >+ response.headers.set("Content-Type", "text/html") >+ return "<html>EMBED!</html>" >+ >+ ## Return a valid image content and Content-Type for redirect requests ## >+ if key.startswith("redirect"): >+ response.headers.set("Content-Type", "image/jpeg") >+ file = open(os.path.join(request.doc_root, "media", "1x1-green.png"), "r") >+ image = file.read() >+ file.close() >+ return image >+ >+ ## Return a valid dedicated worker >+ if key.startswith("worker"): >+ response.headers.set("Content-Type", "application/javascript") >+ return "self.postMessage('loaded');" >+ >+ ## Return a valid XSLT >+ if key.startswith("xslt"): >+ response.headers.set("Content-Type", "text/xsl") >+ return """<?xml version="1.0" encoding="UTF-8"?> >+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> >+ <xsl:template match="@*|node()"> >+ <xsl:copy> >+ <xsl:apply-templates select="@*|node()"/> >+ </xsl:copy> >+ </xsl:template> >+</xsl:stylesheet>""" >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/resources/sharedWorker.js b/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/resources/sharedWorker.js >new file mode 100644 >index 0000000000000000000000000000000000000000..5eb89cb4f68a098154cf3605f53318af2f5e56f1 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/resources/sharedWorker.js >@@ -0,0 +1,9 @@ >+onconnect = function(e) { >+ var port = e.ports[0]; >+ >+ port.addEventListener('message', function(e) { >+ port.postMessage("Ready"); >+ }); >+ >+ port.start(); >+} >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/resources/w3c-import.log b/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/resources/w3c-import.log >new file mode 100644 >index 0000000000000000000000000000000000000000..f8a2a803e1d1194da6011f6c6746d8bef430b3e5 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/resources/w3c-import.log >@@ -0,0 +1,24 @@ >+The tests in this directory were imported from the W3C repository. >+Do NOT modify these tests directly in WebKit. >+Instead, create a pull request on the WPT github: >+ https://github.com/web-platform-tests/wpt >+ >+Then run the Tools/Scripts/import-w3c-tests in WebKit to reimport >+ >+Do NOT modify or remove this file. >+ >+------------------------------------------------------------------------ >+Properties requiring vendor prefixes: >+None >+Property values requiring vendor prefixes: >+None >+------------------------------------------------------------------------ >+List of files: >+/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/resources/dedicatedWorker.js >+/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/resources/echo-as-json.py >+/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/resources/echo-as-script.py >+/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/resources/helper.js >+/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/resources/post-to-owner.py >+/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/resources/record-header.py >+/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/resources/sharedWorker.js >+/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/resources/xslt-test.sub.xml >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/resources/xslt-test.sub.xml b/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/resources/xslt-test.sub.xml >new file mode 100644 >index 0000000000000000000000000000000000000000..4beb9af8d282f2672ab08c4c369d1fe0b061e80f >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/resources/xslt-test.sub.xml >@@ -0,0 +1,13 @@ >+<?xml version="1.0" encoding="UTF-8"?> >+<?xml-stylesheet href="https://{{host}}:{{ports[https][0]}}/fetch/sec-metadata/resources/record-header.py?file=xslt-same-origin" type="text/xsl" ?> >+<?xml-stylesheet href="https://{{hosts[][www]}}:{{ports[https][0]}}/fetch/sec-metadata/resources/record-header.py?file=xslt-same-site" type="text/xsl" ?> >+<?xml-stylesheet href="https://{{hosts[alt][www]}}:{{ports[https][0]}}/fetch/sec-metadata/resources/record-header.py?file=xslt-cross-site" type="text/xsl" ?> >+ >+<!-- postMessage parent back when the resources are loaded --> >+<script xmlns="http://www.w3.org/1999/xhtml"><![CDATA[ >+ setTimeout(function(){ >+ if (window.opener) >+ window.opener.postMessage("", "*"); >+ if (window.top != window) >+ window.top.postMessage("", "*");}, 100); >+]]></script> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/script.tentative.https.sub-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/script.tentative.https.sub-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..790c1458bf6f92d169ede6becced12b5f3283120 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/script.tentative.https.sub-expected.txt >@@ -0,0 +1,9 @@ >+Blocked access to external URL https://www.localhost:9443/fetch/sec-metadata/resources/echo-as-script.py >+Blocked access to external URL https://www.not-web-platform.test:9443/fetch/sec-metadata/resources/echo-as-script.py >+Blocked access to external URL https://www.localhost:9443/fetch/sec-metadata/resources/echo-as-script.py >+Blocked access to external URL https://www.not-web-platform.test:9443/fetch/sec-metadata/resources/echo-as-script.py >+ >+FAIL Same-origin script assert_not_equals: Empty Sec-Metadata header. got disallowed value "" >+FAIL Same-site script null is not an object (evaluating 'value.split') >+FAIL Cross-site script null is not an object (evaluating 'value.split') >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/script.tentative.https.sub.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/script.tentative.https.sub.html >new file mode 100644 >index 0000000000000000000000000000000000000000..643e11827f565ad11416589ae601d18cd8008239 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/script.tentative.https.sub.html >@@ -0,0 +1,46 @@ >+<!DOCTYPE html> >+<script src=/resources/testharness.js></script> >+<script src=/resources/testharnessreport.js></script> >+<script src=/fetch/sec-metadata/resources/helper.js></script> >+ >+<!-- Same-origin script --> >+<script src="https://{{host}}:{{ports[https][0]}}/fetch/sec-metadata/resources/echo-as-script.py"></script> >+<script> >+ test(t => { >+ t.add_cleanup(_ => { header = null; }); >+ >+ assert_header_equals(header, { >+ "cause": undefined, >+ "destination": "script", >+ "site": "same-origin" >+ }); >+ }, "Same-origin script"); >+</script> >+ >+<!-- Same-site script --> >+<script src="https://{{hosts[][www]}}:{{ports[https][0]}}/fetch/sec-metadata/resources/echo-as-script.py"></script> >+<script> >+ test(t => { >+ t.add_cleanup(_ => { header = null; }); >+ >+ assert_header_equals(header, { >+ "cause": undefined, >+ "destination": "script", >+ "site": "same-site" >+ }); >+ }, "Same-site script"); >+</script> >+ >+<!-- Cross-site script --> >+<script src="https://{{hosts[alt][www]}}:{{ports[https][0]}}/fetch/sec-metadata/resources/echo-as-script.py"></script> >+<script> >+ test(t => { >+ t.add_cleanup(_ => { header = null; }); >+ >+ assert_header_equals(header, { >+ "cause": undefined, >+ "destination": "script", >+ "site": "cross-site" >+ }); >+ }, "Cross-site script"); >+</script> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/serviceworker.tentative.https.sub-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/serviceworker.tentative.https.sub-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..8682bc9e45290031ea2a2190844db334fc263c94 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/serviceworker.tentative.https.sub-expected.txt >@@ -0,0 +1,3 @@ >+ >+FAIL Untitled assert_not_equals: Empty Sec-Metadata header. got disallowed value "" >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/serviceworker.tentative.https.sub.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/serviceworker.tentative.https.sub.html >new file mode 100644 >index 0000000000000000000000000000000000000000..cefabb20aaa40c91f5d90d180f52d596086a55cd >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/serviceworker.tentative.https.sub.html >@@ -0,0 +1,47 @@ >+<!DOCTYPE html> >+<meta charset="utf-8"/> >+<link rel="author" href="mtrzos@google.com" title="Maciek Trzos"> >+<script src=/resources/testharness.js></script> >+<script src=/resources/testharnessreport.js></script> >+<script src=/fetch/sec-metadata/resources/helper.js></script> >+<body> >+ <script> >+ if ('serviceWorker' in navigator) { >+ window.addEventListener('load', function() { >+ navigator.serviceWorker.register('https://{{host}}:{{ports[https][0]}}/fetch/sec-metadata/resources/record-header.py?file=serviceworker-same-origin').then(function(registration) { >+ test_same_origin(); >+ >+ // uninstall the serviceworker after the test >+ navigator.serviceWorker.getRegistrations().then(function(registrations) { >+ for(let registration of registrations) { >+ registration.unregister() >+ } >+ }) >+ }, function(err) { >+ // registration failed >+ }); >+ }); >+ } >+ else { >+ test(function () { >+ done(); >+ }, "Browser does not support serviceworker"); >+ } >+ </script> >+</body> >+ >+<script> >+ function test_same_origin(){ >+ promise_test(t => { >+ return new Promise((resolve, reject) => { >+ let key = "serviceworker-same-origin"; >+ let expected = {"destination":"serviceworker", "site":"same-origin"}; >+ fetch("/fetch/sec-metadata/resources/record-header.py?retrieve=true&file=" + key) >+ .then(response => response.text()) >+ .then(text => assert_header_equals(text, expected)) >+ .then(_ => resolve()) >+ .catch(e => reject(e)); >+ }) >+ }) >+ } >+</script> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/sharedworker.tentative.https.sub-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/sharedworker.tentative.https.sub-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..40e0f977eeae2272776b898055f04eccc2ec04c2 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/sharedworker.tentative.https.sub-expected.txt >@@ -0,0 +1,4 @@ >+CONSOLE MESSAGE: line 13: ReferenceError: Can't find variable: SharedWorker >+ >+FAIL Untitled ReferenceError: Can't find variable: SharedWorker >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/sharedworker.tentative.https.sub.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/sharedworker.tentative.https.sub.html >new file mode 100644 >index 0000000000000000000000000000000000000000..09017ccbb3a2b1b878d15e4199d59cad29a2277a >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/sharedworker.tentative.https.sub.html >@@ -0,0 +1,40 @@ >+<!DOCTYPE html> >+ >+<link rel="author" href="mtrzos@google.com" title="Maciek Trzos"> >+<script src=/resources/testharness.js></script> >+<script src=/resources/testharnessreport.js></script> >+<script src=/fetch/sec-metadata/resources/helper.js></script> >+<script> >+ >+ // TESTS // >+ if (window.Worker) { >+ >+ // Same-Origin test >+ var sharedWorker = new SharedWorker('/fetch/sec-metadata/resources/record-header.py?file=sharedworker-same-origin'); >+ sharedWorker.port.start(); >+ >+ sharedWorker.onerror = function(){ >+ test_same_origin(); >+ } >+ sharedWorker.port.onmessage = function(e) { >+ test_same_origin(); >+ } >+ sharedWorker.port.postMessage("Ready"); >+ } >+ >+ function test_same_origin(){ >+ promise_test(t => { >+ return new Promise((resolve, reject) => { >+ let key = "sharedworker-same-origin"; >+ let expected = {"destination":"sharedworker", "site":"same-origin"}; >+ >+ fetch("/fetch/sec-metadata/resources/record-header.py?retrieve=true&file=" + key) >+ .then(response => response.text()) >+ .then(text => assert_header_equals(text, expected)) >+ .then(_ => resolve()) >+ .catch(e => reject(e)); >+ }) >+ }, "Same-Origin sharedworker") >+ } >+</script> >+<body></body> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/style.tentative.https.sub-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/style.tentative.https.sub-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..8e96501896aa62fcdd121e1ab06b72353cbad960 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/style.tentative.https.sub-expected.txt >@@ -0,0 +1,8 @@ >+CONSOLE MESSAGE: Did not parse stylesheet at 'https://localhost:9443/fetch/sec-metadata/resources/record-header.py?file=style-same-origin' because non CSS MIME types are not allowed in strict mode. >+Blocked access to external URL https://www.localhost:9443/fetch/sec-metadata/resources/record-header.py?file=style-same-site >+Blocked access to external URL https://www.not-web-platform.test:9443/fetch/sec-metadata/resources/record-header.py?file=style-cross-site >+ >+FAIL Same-Origin style assert_not_equals: Empty Sec-Metadata header. got disallowed value "" >+FAIL Same-Site style assert_equals: destination expected (string) "style" but got (undefined) undefined >+FAIL Cross-Site style assert_equals: destination expected (string) "style" but got (undefined) undefined >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/style.tentative.https.sub.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/style.tentative.https.sub.html >new file mode 100644 >index 0000000000000000000000000000000000000000..609d5764f08ca5b3242692f4bdd94f2b364481b3 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/style.tentative.https.sub.html >@@ -0,0 +1,70 @@ >+<!DOCTYPE html> >+<html> >+<link rel="author" href="mtrzos@google.com" title="Maciek Trzos"> >+<script src=/resources/testharness.js></script> >+<script src=/resources/testharnessreport.js></script> >+<script src=/fetch/sec-metadata/resources/helper.js></script> >+<body></body> >+<script> >+ promise_test(t => { >+ return new Promise((resolve, reject) => { >+ let key = "style-same-origin"; >+ >+ let e = document.createElement('link'); >+ e.rel = "stylesheet"; >+ e.href = "https://{{host}}:{{ports[https][0]}}/fetch/sec-metadata/resources/record-header.py?file=" + key; >+ e.onload = e => { >+ let expected = {"destination":"style", "site":"same-origin"}; >+ fetch("/fetch/sec-metadata/resources/record-header.py?retrieve=true&file=" + key) >+ .then(response => response.text()) >+ .then(text => assert_header_equals(text, expected)) >+ .then(_ => resolve()) >+ .catch(e => reject(e)); >+ }; >+ >+ document.body.appendChild(e); >+ }) >+ }, "Same-Origin style"); >+ >+ promise_test(t => { >+ return new Promise((resolve, reject) => { >+ let key = "style-same-site"; >+ >+ let e = document.createElement('link'); >+ e.rel = "stylesheet"; >+ e.href = "https://{{hosts[][www]}}:{{ports[https][0]}}/fetch/sec-metadata/resources/record-header.py?file=" + key; >+ e.onload = e => { >+ let expected = {"destination":"style", "site":"same-site"}; >+ fetch("/fetch/sec-metadata/resources/record-header.py?retrieve=true&file=" + key) >+ .then(response => response.text()) >+ .then(text => assert_header_equals(text, expected)) >+ .then(_ => resolve()) >+ .catch(e => reject(e)); >+ }; >+ >+ document.body.appendChild(e); >+ }) >+ }, "Same-Site style"); >+ >+ promise_test(t => { >+ return new Promise((resolve, reject) => { >+ let key = "style-cross-site"; >+ >+ let e = document.createElement('link'); >+ e.rel = "stylesheet"; >+ e.href = "https://{{hosts[alt][www]}}:{{ports[https][0]}}/fetch/sec-metadata/resources/record-header.py?file=" + key; >+ e.onload = e => { >+ let expected = {"destination":"style", "site":"cross-site"}; >+ fetch("/fetch/sec-metadata/resources/record-header.py?retrieve=true&file=" + key) >+ .then(response => response.text()) >+ .then(text => assert_header_equals(text, expected)) >+ .then(_ => resolve()) >+ .catch(e => reject(e)); >+ }; >+ >+ document.body.appendChild(e); >+ }) >+ }, "Cross-Site style"); >+</script> >+</html> >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/track.tentative.https.sub-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/track.tentative.https.sub-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..d4e91d494992e27a5fd787a67ca50254f6fd4fdc >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/track.tentative.https.sub-expected.txt >@@ -0,0 +1,8 @@ >+ >+ >+Harness Error (TIMEOUT), message = null >+ >+TIMEOUT Same-Origin track Test timed out >+NOTRUN Same-Site track >+NOTRUN Cross-Site track >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/track.tentative.https.sub.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/track.tentative.https.sub.html >new file mode 100644 >index 0000000000000000000000000000000000000000..e89d4745ff2db234e3e49ee28dd8af15acbc9731 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/track.tentative.https.sub.html >@@ -0,0 +1,79 @@ >+<!DOCTYPE html> >+ >+<link rel="author" href="mtrzos@google.com" title="Maciek Trzos"> >+<script src=/resources/testharness.js></script> >+<script src=/resources/testharnessreport.js></script> >+<script src=/fetch/sec-metadata/resources/helper.js></script> >+<body> >+</body> >+<script> >+ function createVideoElement() { >+ let el = document.createElement('video'); >+ el.src = "/media/movie_5.mp4"; >+ el.setAttribute("controls", ""); >+ el.setAttribute("crossorigin", ""); >+ return el; >+ } >+ >+ function createTrack() { >+ let el = document.createElement("track"); >+ el.setAttribute("default", ""); >+ el.setAttribute("kind", "captions"); >+ el.setAttribute("srclang", "en"); >+ return el; >+ } >+ >+ promise_test(t => { >+ return new Promise((resolve, reject) => { >+ let video = createVideoElement(); >+ let el = createTrack(); >+ el.src = "https://{{host}}:{{ports[https][0]}}/fetch/sec-metadata/resources/record-header.py?file=track-same-origin"; >+ el.onload = t.step_func(_ => { >+ expected = {"destination":"track", "site":"same-origin"}; >+ fetch("/fetch/sec-metadata/resources/record-header.py?retrieve=true&file=track-same-origin") >+ .then(response => response.text()) >+ .then(text => assert_header_equals(text, expected)) >+ .then(_ => resolve()); >+ }); >+ video.appendChild(el); >+ document.body.appendChild(video); >+ }); >+ }, "Same-Origin track"); >+ >+ promise_test(t => { >+ return new Promise((resolve, reject) => { >+ let video = createVideoElement(); >+ let el = createTrack(); >+ el.src = "https://{{hosts[][www]}}:{{ports[https][0]}}/fetch/sec-metadata/resources/record-header.py?file=track-same-site"; >+ el.onload = t.step_func(_ => { >+ expected = {"destination":"track", "site":"same-site"}; >+ fetch("/fetch/sec-metadata/resources/record-header.py?retrieve=true&file=track-same-site") >+ .then(response => response.text()) >+ .then(text => assert_header_equals(text, expected)) >+ .then(resolve) >+ .catch(reject); >+ >+ }); >+ video.appendChild(el); >+ document.body.appendChild(video); >+ }); >+ }, "Same-Site track"); >+ >+ promise_test(t => { >+ return new Promise((resolve, reject) => { >+ let video = createVideoElement(); >+ let el = createTrack(); >+ el.src = "https://{{hosts[alt][www]}}:{{ports[https][0]}}/fetch/sec-metadata/resources/record-header.py?file=track-cross-site"; >+ el.onload = t.step_func(_ => { >+ expected = {"destination":"track", "site":"cross-site"}; >+ fetch("/fetch/sec-metadata/resources/record-header.py?retrieve=true&file=track-cross-site") >+ .then(response => response.text()) >+ .then(text => assert_header_equals(text, expected)) >+ .then(resolve) >+ .catch(reject); >+ }); >+ video.appendChild(el); >+ document.body.appendChild(video); >+ }); >+ }, "Cross-Site track"); >+</script> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/w3c-import.log b/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/w3c-import.log >new file mode 100644 >index 0000000000000000000000000000000000000000..fb9eeb123fddfa70ddc483c074684e6c8279e099 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/w3c-import.log >@@ -0,0 +1,33 @@ >+The tests in this directory were imported from the W3C repository. >+Do NOT modify these tests directly in WebKit. >+Instead, create a pull request on the WPT github: >+ https://github.com/web-platform-tests/wpt >+ >+Then run the Tools/Scripts/import-w3c-tests in WebKit to reimport >+ >+Do NOT modify or remove this file. >+ >+------------------------------------------------------------------------ >+Properties requiring vendor prefixes: >+None >+Property values requiring vendor prefixes: >+None >+------------------------------------------------------------------------ >+List of files: >+/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/README.md >+/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/embed.tentative.https.sub.html >+/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/fetch.tentative.https.sub.html >+/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/font.tentative.https.sub.html >+/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/iframe.tentative.https.sub.html >+/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/img.tentative.https.sub.html >+/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/object.tentative.https.sub.html >+/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/report.tentative.https.sub.html >+/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/report.tentative.https.sub.html.sub.headers >+/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/script.tentative.https.sub.html >+/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/serviceworker.tentative.https.sub.html >+/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/sharedworker.tentative.https.sub.html >+/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/style.tentative.https.sub.html >+/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/track.tentative.https.sub.html >+/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/window-open.tentative.https.sub.html >+/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/worker.tentative.https.sub.html >+/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/xslt.tentative.https.sub.html >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/window-open.tentative.https.sub-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/window-open.tentative.https.sub-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..468b89631b4dd748c87e62ce432264c464d6191e >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/window-open.tentative.https.sub-expected.txt >@@ -0,0 +1,13 @@ >+Blocked access to external URL https://www.localhost:9443/fetch/sec-metadata/resources/post-to-owner.py >+Blocked access to external URL https://www.not-web-platform.test:9443/fetch/sec-metadata/resources/post-to-owner.py >+ >+ >+Harness Error (TIMEOUT), message = null >+ >+FAIL Same-origin window, forced assert_not_equals: Empty Sec-Metadata header. got disallowed value "" >+TIMEOUT Same-site window, forced Test timed out >+TIMEOUT Cross-site window, forced Test timed out >+FAIL Same-origin window, user-activated Can't find variable: test_driver >+FAIL Same-site window, user-activated Can't find variable: test_driver >+FAIL Cross-site window, user-activated Can't find variable: test_driver >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/window-open.tentative.https.sub.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/window-open.tentative.https.sub.html >new file mode 100644 >index 0000000000000000000000000000000000000000..3cd6190f944816258b29546ef89ec5947faa035d >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/window-open.tentative.https.sub.html >@@ -0,0 +1,121 @@ >+<!DOCTYPE html> >+<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 src=/fetch/sec-metadata/resources/helper.js></script> >+<body> >+<script> >+ // Forced navigations: >+ async_test(t => { >+ let w = window.open("https://{{host}}:{{ports[https][0]}}/fetch/sec-metadata/resources/post-to-owner.py"); >+ t.add_cleanup(_ => w.close()); >+ window.addEventListener('message', t.step_func(e => { >+ if (e.source != w) >+ return; >+ >+ assert_header_equals(e.data, { >+ "cause": "forced", >+ "destination": "document", >+ "site": "same-origin" >+ }); >+ t.done(); >+ })); >+ }, "Same-origin window, forced"); >+ >+ async_test(t => { >+ let w = window.open("https://{{hosts[][www]}}:{{ports[https][0]}}/fetch/sec-metadata/resources/post-to-owner.py"); >+ t.add_cleanup(_ => w.close()); >+ window.addEventListener('message', t.step_func(e => { >+ if (e.source != w) >+ return; >+ >+ assert_header_equals(e.data, { >+ "cause": "forced", >+ "destination": "document", >+ "site": "same-site" >+ }); >+ t.done(); >+ })); >+ }, "Same-site window, forced"); >+ >+ async_test(t => { >+ let w = window.open("https://{{hosts[alt][www]}}:{{ports[https][0]}}/fetch/sec-metadata/resources/post-to-owner.py"); >+ t.add_cleanup(_ => w.close()); >+ window.addEventListener('message', t.step_func(e => { >+ if (e.source != w) >+ return; >+ >+ assert_header_equals(e.data, { >+ "cause": "forced", >+ "destination": "document", >+ "site": "cross-site" >+ }); >+ t.done(); >+ })); >+ }, "Cross-site window, forced"); >+ >+ // User-activated navigations: >+ async_test(t => { >+ let b = document.createElement('button'); >+ b.onclick = t.step_func(_ => { >+ let w = window.open("https://{{host}}:{{ports[https][0]}}/fetch/sec-metadata/resources/post-to-owner.py"); >+ t.add_cleanup(_ => w.close()); >+ window.addEventListener('message', t.step_func(e => { >+ if (e.source != w) >+ return; >+ >+ assert_header_equals(e.data, { >+ "cause": "user-activated", >+ "destination": "document", >+ "site": "same-origin" >+ }); >+ t.done(); >+ })); >+ }); >+ document.body.appendChild(b); >+ test_driver.click(b); >+ }, "Same-origin window, user-activated"); >+ >+ async_test(t => { >+ let b = document.createElement('button'); >+ b.onclick = t.step_func(_ => { >+ let w = window.open("https://{{hosts[][www]}}:{{ports[https][0]}}/fetch/sec-metadata/resources/post-to-owner.py"); >+ t.add_cleanup(_ => w.close()); >+ window.addEventListener('message', t.step_func(e => { >+ if (e.source != w) >+ return; >+ >+ assert_header_equals(e.data, { >+ "cause": "user-activated", >+ "destination": "document", >+ "site": "same-site" >+ }); >+ t.done(); >+ })); >+ }); >+ document.body.appendChild(b); >+ test_driver.click(b); >+ }, "Same-site window, user-activated"); >+ >+ async_test(t => { >+ let b = document.createElement('button'); >+ b.onclick = t.step_func(_ => { >+ let w = window.open("https://{{hosts[alt][www]}}:{{ports[https][0]}}/fetch/sec-metadata/resources/post-to-owner.py"); >+ t.add_cleanup(_ => w.close()); >+ window.addEventListener('message', t.step_func(e => { >+ if (e.source != w) >+ return; >+ >+ assert_header_equals(e.data, { >+ "cause": "user-activated", >+ "destination": "document", >+ "site": "cross-site" >+ }); >+ t.done(); >+ })); >+ }); >+ document.body.appendChild(b); >+ test_driver.click(b); >+ }, "Cross-site window, user-activated"); >+</script> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/worker.tentative.https.sub-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/worker.tentative.https.sub-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..73d922e071438a69c0d67211b26b44f19a7096f1 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/worker.tentative.https.sub-expected.txt >@@ -0,0 +1,3 @@ >+ >+FAIL Same-Origin worker assert_not_equals: Empty Sec-Metadata header. got disallowed value "" >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/worker.tentative.https.sub.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/worker.tentative.https.sub.html >new file mode 100644 >index 0000000000000000000000000000000000000000..eff66fcc7811d9aacced799d6707f8f9edcafa9b >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/worker.tentative.https.sub.html >@@ -0,0 +1,23 @@ >+<!DOCTYPE html> >+ >+<link rel="author" href="mtrzos@google.com" title="Maciek Trzos"> >+<script src=/resources/testharness.js></script> >+<script src=/resources/testharnessreport.js></script> >+<script src=/fetch/sec-metadata/resources/helper.js></script> >+<script> >+ promise_test(t => { >+ return new Promise((resolve, reject) => { >+ let key = "worker-same-origin"; >+ let w = new Worker("/fetch/sec-metadata/resources/record-header.py?file=" + key); >+ w.onmessage = e => { >+ let expected = {"destination":"worker", "site":"same-origin"}; >+ fetch("/fetch/sec-metadata/resources/record-header.py?retrieve=true&file=" + key) >+ .then(response => response.text()) >+ .then(text => assert_header_equals(text, expected)) >+ .then(_ => resolve()) >+ .catch(e => reject(e)); >+ }; >+ }); >+ }, "Same-Origin worker"); >+</script> >+<body></body> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/xslt.tentative.https.sub-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/xslt.tentative.https.sub-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..519c23494c0b5758ec198b6e52ca698d7c0d8eff >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/xslt.tentative.https.sub-expected.txt >@@ -0,0 +1,9 @@ >+CONSOLE MESSAGE: line 1: Unsafe attempt to load URL https://www.localhost:9443/fetch/sec-metadata/resources/record-header.py?file=xslt-same-site from origin https://localhost:9443. Domains, protocols and ports must match. >+ >+CONSOLE MESSAGE: line 1: Unsafe attempt to load URL https://www.not-web-platform.test:9443/fetch/sec-metadata/resources/record-header.py?file=xslt-cross-site from origin https://localhost:9443. Domains, protocols and ports must match. >+ >+ >+FAIL Same-Origin xslt assert_not_equals: Empty Sec-Metadata header. got disallowed value "" >+FAIL Same-site xslt assert_equals: destination expected (string) "xslt" but got (undefined) undefined >+FAIL Cross-site xslt assert_equals: destination expected (string) "xslt" but got (undefined) undefined >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/xslt.tentative.https.sub.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/xslt.tentative.https.sub.html >new file mode 100644 >index 0000000000000000000000000000000000000000..dff996679ff900cf3e3fe82381ef29ea5f5889b5 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/sec-metadata/xslt.tentative.https.sub.html >@@ -0,0 +1,38 @@ >+<!DOCTYPE html> >+ >+<link rel="author" href="mtrzos@google.com" title="Maciek Trzos"> >+<script src=/resources/testharness.js></script> >+<script src=/resources/testharnessreport.js></script> >+<script src=/fetch/sec-metadata/resources/helper.js></script> >+<script> >+ // Open a window with XML document which loads resources via <?xml-stylesheet/> tag >+ let w = window.open("resources/xslt-test.sub.xml"); >+ window.addEventListener('message', function(e) { >+ if (e.source != w) >+ return; >+ >+ promise_test(t => { >+ let expected = {"destination":"xslt", "site":"same-origin"}; >+ return fetch("/fetch/sec-metadata/resources/record-header.py?retrieve=true&file=xslt-same-origin") >+ .then(response => response.text()) >+ .then(text => assert_header_equals(text, expected)); >+ }, "Same-Origin xslt"); >+ >+ promise_test(t => { >+ let expected = {"destination":"xslt", "site":"same-site"}; >+ return fetch("/fetch/sec-metadata/resources/record-header.py?retrieve=true&file=xslt-same-site") >+ .then(response => response.text()) >+ .then(text => assert_header_equals(text, expected)); >+ }, "Same-site xslt"); >+ >+ promise_test(t => { >+ let expected = {"destination":"xslt", "site":"cross-site"}; >+ return fetch("/fetch/sec-metadata/resources/record-header.py?retrieve=true&file=xslt-cross-site") >+ .then(response => response.text()) >+ .then(text => assert_header_equals(text, expected)); >+ }, "Cross-site xslt"); >+ >+ w.close(); >+ }); >+ >+</script> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/security/dangling-markup-mitigation-data-url.tentative.sub-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/security/dangling-markup-mitigation-data-url.tentative.sub-expected.txt >index ce522bf1869778e75223a862832903d609b1bb92..6f8b3471a48a3872e9686332680670ce26e9f296 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/security/dangling-markup-mitigation-data-url.tentative.sub-expected.txt >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/security/dangling-markup-mitigation-data-url.tentative.sub-expected.txt >@@ -7,7 +7,7 @@ PASS <img id="dangling" src="data:image/svg+xml;utf8,\n <svg width='1' heig > PASS <iframe id="dangling"\n src="data:text/html,\n <img\n onload='window.parent.postMessage("loaded", "*");'\n onerror='window.parent.postMessage("error", "*");'\n src='http://localhost:8800/images/gr een-256x256.png'>\n ">\n </iframe> > PASS <iframe id="dangling"\n src="data:text/html,\n <img\n onload='window.parent.postMessage("loaded", "*");'\n onerror='window.parent.postMessage("error", "*");'\n src='http://localhost:8800/images/green-256x256.png?<'>\n ">\n </iframe> > PASS <iframe id="dangling"\n src="data:text/html,\n <img\n onload='window.parent.postMessage("loaded", "*");'\n onerror='window.parent.postMessage("error", "*");'\n src='http://localhost:8800/images/gr een-256x256.png?&amp;lt;'>\n ">\n </iframe> >-PASS <iframe id="dangling"\n src="data:text/html,\n <img\n onload='window.parent.postMessage("loaded", "*");'\n onerror='window.parent.postMessage("error", "*");'\n src='http://localhost:8800/images/green-256x256.png?&amp;#10;<'>\n ">\n </iframe> >+PASS <iframe id="dangling"\n src="data:text/html,\n <img\n onload='window.parent.postMessage("loaded", "*");'\n onerror='window.parent.postMessage("error", "*");'\n src='http://localhost:8800/images/green-256x256.png?&amp;%2310;<'>\n ">\n </iframe> > FAIL <iframe id="dangling"\n src="data:text/html,\n <img\n onload='window.parent.postMessage("loaded", "*");'\n onerror='window.parent.postMessage("error", "*");'\n src='http://localhost:8800/images/gr een-256x256.png?<'>\n ">\n </iframe> assert_equals: expected "error" but got "loaded" > FAIL <iframe id="dangling"\n src=" data:text/html,\n <img\n onload='window.parent.postMessage("loaded", "*");'\n onerror='window.parent.postMessage("error", "*");'\n src='http://localhost:8800/images/gr een-256x256.png?<'>\n ">\n </iframe> assert_equals: expected "error" but got "loaded" > FAIL <iframe id="dangling"\n src="\ndata:text/html,\n <img\n onload='window.parent.postMessage("loaded", "*");'\n onerror='window.parent.postMessage("error", "*");'\n src='http://localhost:8800/images/gr een-256x256.png?<'>\n ">\n </iframe> assert_equals: expected "error" but got "loaded" >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/security/dangling-markup-mitigation-data-url.tentative.sub.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/security/dangling-markup-mitigation-data-url.tentative.sub.html >index 3b13fccdc4b8119ba9851037bec34d6e802e3388..f27735daa1dd650726525d72a48b91d58d62535b 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/security/dangling-markup-mitigation-data-url.tentative.sub.html >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/security/dangling-markup-mitigation-data-url.tentative.sub.html >@@ -16,7 +16,8 @@ > var doubleEscapedBrace = "&amp;lt;"; > var rawNewline = " "; > var escapedNewline = "&#10;"; >- var doubleEscapedNewline = "&amp;#10;"; >+ // doubleEscapedNewline is used inside a data URI, and so must have its '#' escaped. >+ var doubleEscapedNewline = "&amp;%2310;"; > > function appendFrameAndGetElement(test, frame) { > return new Promise((resolve, reject) => { >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/security/dangling-markup-mitigation.tentative-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/security/dangling-markup-mitigation.tentative-expected.txt >index f379cca38d7e46e9c0fb06d0c9adb4ae377bfad6..13be0d32058e8a72c8b0c96a060263b92f51c33c 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/security/dangling-markup-mitigation.tentative-expected.txt >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/security/dangling-markup-mitigation.tentative-expected.txt >@@ -24,11 +24,11 @@ PASS <img id="dangling" src="/images/green-1x1.png?img=<b"> > PASS <img id="dangling" src="/images/green-1x1.png?img= b"> > PASS <img id="dangling" src="/images/green-1x1.png?img=&#10;b"> > PASS <img id="dangling" src="/images/green-1x1.png?img=&lt;b"> >-FAIL <img id="dangling" src="/images/green-1x1.png?img=&#10;b&lt;c"> assert_equals: Height expected 1 but got 0 >+PASS <img id="dangling" src="/images/green-1x1.png?img=&#10;b&lt;c"> > PASS \n <img id="dangling" src="\n /images/green-1x1.png?img=\n ">\n > PASS \n <img id="dangling" src="\n /images/green-1x1.png?img=&lt;\n ">\n >-FAIL \n <img id="dangling" src="\n /images/green-1x1.png?img=&#10;\n ">\n assert_equals: Height expected 1 but got 0 >+PASS \n <img id="dangling" src="\n /images/green-1x1.png?img=&#10;\n ">\n > FAIL <img id="dangling" src="/images/green-1x1.png?img= <b"> assert_equals: Height expected 0 but got 1 >-PASS <img id="dangling" src="/images/green-1x1.png?img=< b"> >+FAIL <img id="dangling" src="/images/green-1x1.png?img=< b"> assert_equals: Height expected 0 but got 1 > FAIL \n <img id="dangling" src="/images/green-1x1.png?img=\n <\n b\n ">\n assert_equals: Height expected 0 but got 1 > >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/security/redirect-to-url-with-credentials.https-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/security/redirect-to-url-with-credentials.https-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..80fdf016c4d27fdf209a0befc6a1cfd1c7547d5c >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/security/redirect-to-url-with-credentials.https-expected.txt >@@ -0,0 +1,9 @@ >+ >+PASS No CORS fetch after a redirect with an URL containing credentials >+FAIL CORS fetch after a redirect with a cross origin URL containing credentials assert_unreached: Should have rejected: undefined Reached unreachable code >+PASS CORS fetch after a redirect with a same origin URL containing credentials >+PASS Image loading after a redirect with an URL containing credentials >+FAIL CORS Image loading after a redirect with a cross origin URL containing credentials promise_test: Unhandled rejection with value: "Image should not load" >+PASS CORS Image loading after a redirect with a same origin URL containing credentials >+PASS Frame loading after a redirect with an URL containing credentials >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/security/redirect-to-url-with-credentials.https.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/security/redirect-to-url-with-credentials.https.html >new file mode 100644 >index 0000000000000000000000000000000000000000..4bf974875fbc3fa318dc5aeefca1b5ee9d9c8183 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/security/redirect-to-url-with-credentials.https.html >@@ -0,0 +1,68 @@ >+<html> >+<header> >+ <script src="/resources/testharness.js"></script> >+ <script src="/resources/testharnessreport.js"></script> >+ <script src="/common/get-host-info.sub.js"></script> >+</header> >+<body> >+<script> >+var host = get_host_info(); >+ >+var sameOriginImageURL = "/common/redirect.py?location=" + host.HTTPS_ORIGIN_WITH_CREDS + "/service-workers/service-worker/resources/fetch-access-control.py?ACAOrigin= " + host.HTTPS_ORIGIN + "%26PNGIMAGE%26ACACredentials=true"; >+var imageURL = "/common/redirect.py?location=" + host.HTTPS_REMOTE_ORIGIN_WITH_CREDS + "/service-workers/service-worker/resources/fetch-access-control.py?ACAOrigin= " + host.HTTPS_ORIGIN + "%26PNGIMAGE%26ACACredentials=true"; >+var frameURL = "/common/redirect.py?location=" + host.HTTPS_REMOTE_ORIGIN_WITH_CREDS + "/common/blank.html"; >+ >+promise_test((test) => { >+ return fetch(imageURL, {mode: "no-cors"}); >+}, "No CORS fetch after a redirect with an URL containing credentials"); >+ >+promise_test((test) => { >+ return promise_rejects(test, new TypeError, fetch(imageURL, {mode: "cors"})); >+}, "CORS fetch after a redirect with a cross origin URL containing credentials"); >+ >+promise_test((test) => { >+ return fetch(sameOriginImageURL, {mode: "cors"}); >+}, "CORS fetch after a redirect with a same origin URL containing credentials"); >+ >+promise_test((test) => { >+ return new Promise((resolve, reject) => { >+ var image = new Image(); >+ image.onload = resolve; >+ image.onerror = (e) => reject(e); >+ image.src = imageURL; >+ }); >+}, "Image loading after a redirect with an URL containing credentials"); >+ >+promise_test((test) => { >+ return new Promise((resolve, reject) => { >+ var image = new Image(); >+ image.crossOrigin = "use-credentials"; >+ image.onerror = resolve; >+ image.onload = () => reject("Image should not load"); >+ image.src = imageURL; >+ }); >+}, "CORS Image loading after a redirect with a cross origin URL containing credentials"); >+ >+promise_test((test) => { >+ return new Promise((resolve, reject) => { >+ var image = new Image(); >+ image.crossOrigin = "use-credentials"; >+ image.onload = resolve; >+ image.onerror = (e) => reject(e); >+ image.src = sameOriginImageURL; >+ }); >+}, "CORS Image loading after a redirect with a same origin URL containing credentials"); >+ >+promise_test(async (test) => { >+ var iframe = document.createElement("iframe"); >+ document.body.appendChild(iframe); >+ await new Promise((resolve, reject) => { >+ iframe.src = frameURL; >+ iframe.onload = resolve; >+ iframe.onerror = (e) => reject(e); >+ }); >+ document.body.removeChild(iframe); >+}, "Frame loading after a redirect with an URL containing credentials"); >+</script> >+</body> >+</html> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/security/support/w3c-import.log b/LayoutTests/imported/w3c/web-platform-tests/fetch/security/support/w3c-import.log >index 259e807689af57f8791861acbbddf2430ada2339..f5ae17cf05c8628113e18430e8c608e215e61d52 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/security/support/w3c-import.log >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/security/support/w3c-import.log >@@ -1,7 +1,7 @@ > The tests in this directory were imported from the W3C repository. > Do NOT modify these tests directly in WebKit. > Instead, create a pull request on the WPT github: >- https://github.com/w3c/web-platform-tests >+ https://github.com/web-platform-tests/wpt > > Then run the Tools/Scripts/import-w3c-tests in WebKit to reimport > >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/security/w3c-import.log b/LayoutTests/imported/w3c/web-platform-tests/fetch/security/w3c-import.log >index b01b23f000dff5433f5e5b68578932a152678969..1a3b15d9321703c7392e6852c28230a920196b01 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/security/w3c-import.log >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/security/w3c-import.log >@@ -1,7 +1,7 @@ > The tests in this directory were imported from the W3C repository. > Do NOT modify these tests directly in WebKit. > Instead, create a pull request on the WPT github: >- https://github.com/w3c/web-platform-tests >+ https://github.com/web-platform-tests/wpt > > Then run the Tools/Scripts/import-w3c-tests in WebKit to reimport > >@@ -17,3 +17,4 @@ List of files: > /LayoutTests/imported/w3c/web-platform-tests/fetch/security/dangling-markup-mitigation-data-url.tentative.sub.html > /LayoutTests/imported/w3c/web-platform-tests/fetch/security/dangling-markup-mitigation.tentative.html > /LayoutTests/imported/w3c/web-platform-tests/fetch/security/embedded-credentials.tentative.sub.html >+/LayoutTests/imported/w3c/web-platform-tests/fetch/security/redirect-to-url-with-credentials.https.html >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/w3c-import.log b/LayoutTests/imported/w3c/web-platform-tests/fetch/w3c-import.log >index b53582ece311d97fd4c3b33f993035e154f2b0dc..87d66582bee6563f17fc94133bf52df6d0fadf38 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/w3c-import.log >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/w3c-import.log >@@ -1,7 +1,7 @@ > The tests in this directory were imported from the W3C repository. > Do NOT modify these tests directly in WebKit. > Instead, create a pull request on the WPT github: >- https://github.com/w3c/web-platform-tests >+ https://github.com/web-platform-tests/wpt > > Then run the Tools/Scripts/import-w3c-tests in WebKit to reimport > >@@ -14,5 +14,5 @@ Property values requiring vendor prefixes: > None > ------------------------------------------------------------------------ > List of files: >-/LayoutTests/imported/w3c/web-platform-tests/fetch/OWNERS >+/LayoutTests/imported/w3c/web-platform-tests/fetch/META.yml > /LayoutTests/imported/w3c/web-platform-tests/fetch/README.md >diff --git a/LayoutTests/platform/gtk/TestExpectations b/LayoutTests/platform/gtk/TestExpectations >index e78e55a6dff39d9281fa59281e2cfc0a33f02860..1e583a93e75e7c6b1cc078a3e30fedac6755d982 100644 >--- a/LayoutTests/platform/gtk/TestExpectations >+++ b/LayoutTests/platform/gtk/TestExpectations >@@ -1130,7 +1130,6 @@ imported/w3c/web-platform-tests/credential-management/ [ Skip ] > webkit.org/b/175419 imported/w3c/web-platform-tests/background-fetch/interfaces-worker.https.html [ Failure ] > webkit.org/b/175419 imported/w3c/web-platform-tests/background-fetch/interfaces.html [ Failure ] > webkit.org/b/175419 imported/w3c/web-platform-tests/fetch/api/policies/referrer-origin-when-cross-origin-service-worker.https.html [ Failure ] >-webkit.org/b/175419 imported/w3c/web-platform-tests/fetch/api/abort/general-serviceworker.https.html [ Failure ] > webkit.org/b/175419 imported/w3c/web-platform-tests/fetch/api/abort/serviceworker-intercepted.https.html [ Failure ] > webkit.org/b/175419 imported/w3c/web-platform-tests/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-agent-formalism/canblock-serviceworker.https.html [ Failure ] > >@@ -3208,11 +3207,6 @@ webkit.org/b/163981 fast/css3-text/css3-text-decoration/text-underline-position/ > > webkit.org/b/163984 fast/dom/Window/child-window-focus.html [ Failure ] > >-webkit.org/b/167999 imported/w3c/web-platform-tests/fetch/api/redirect/redirect-count-worker.html [ Failure ] >-webkit.org/b/167999 imported/w3c/web-platform-tests/fetch/api/redirect/redirect-count.html [ Failure ] >-webkit.org/b/167999 imported/w3c/web-platform-tests/fetch/api/redirect/redirect-location.html [ Failure ] >-webkit.org/b/167999 imported/w3c/web-platform-tests/fetch/api/redirect/redirect-location-worker.html [ Failure ] >- > webkit.org/b/168543 http/wpt/resource-timing/rt-nextHopProtocol.html [ Failure ] > webkit.org/b/168543 http/wpt/resource-timing/rt-nextHopProtocol.worker.html [ Failure ] > >@@ -3432,8 +3426,6 @@ webkit.org/b/183902 fast/dom/frame-loading-via-document-write.html [ Failure ] > webkit.org/b/184086 imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/accumulation-per-property.html [ Failure ] > webkit.org/b/184086 imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/interpolation-per-property.html [ Failure ] > >-webkit.org/b/184503 imported/w3c/web-platform-tests/fetch/api/redirect/redirect-method.html [ Failure ] >-webkit.org/b/184503 imported/w3c/web-platform-tests/fetch/api/redirect/redirect-method-worker.html [ Failure ] > webkit.org/b/184504 imported/w3c/web-platform-tests/fetch/api/request/request-keepalive-quota.html [ Failure ] > > webkit.org/b/184775 imported/w3c/web-platform-tests/mediacapture-streams/MediaStreamTrack-MediaElement-disabled-audio-is-silence.https.html [ Failure ] >diff --git a/LayoutTests/platform/ios-simulator/imported/w3c/web-platform-tests/fetch/content-type/response.window-expected.txt b/LayoutTests/platform/ios-simulator/imported/w3c/web-platform-tests/fetch/content-type/response.window-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..ecac985db8eb39581619ccf8b80461044e5cd9dc >--- /dev/null >+++ b/LayoutTests/platform/ios-simulator/imported/w3c/web-platform-tests/fetch/content-type/response.window-expected.txt >@@ -0,0 +1,123 @@ >+ >+PASS Loading JSON⦠>+FAIL <iframe>: separate response Content-Type: text/plain assert_equals: expected "text/plain" but got "text/x-python-script" >+FAIL <iframe>: combined response Content-Type: text/plain assert_equals: expected "text/plain" but got "text/x-python-script" >+PASS fetch(): separate response Content-Type: text/plain >+FAIL fetch(): combined response Content-Type: text/plain assert_equals: expected "text/plain" but got "" >+FAIL Request: combined response Content-Type: text/plain assert_equals: expected "text/plain" but got "" >+FAIL Response: combined response Content-Type: text/plain assert_equals: expected "text/plain" but got "" >+FAIL <iframe>: separate response Content-Type: text/plain assert_equals: expected "text/plain" but got "text/x-python-script" >+FAIL <iframe>: combined response Content-Type: text/plain assert_equals: expected "text/plain" but got "text/x-python-script" >+FAIL fetch(): separate response Content-Type: text/plain assert_equals: expected "text/plain" but got "" >+PASS fetch(): combined response Content-Type: text/plain >+FAIL Request: combined response Content-Type: text/plain assert_equals: expected "text/plain" but got "" >+FAIL Response: combined response Content-Type: text/plain assert_equals: expected "text/plain" but got "" >+FAIL <iframe>: separate response Content-Type: text/html text/plain assert_equals: expected "text/plain" but got "text/x-python-script" >+FAIL <iframe>: combined response Content-Type: text/html text/plain assert_equals: expected "<b>hi</b>\n" but got "hi\n" >+PASS fetch(): separate response Content-Type: text/html text/plain >+FAIL fetch(): combined response Content-Type: text/html text/plain assert_equals: expected "text/plain" but got "text/html" >+FAIL Request: combined response Content-Type: text/html text/plain assert_equals: expected "text/plain" but got "" >+FAIL Response: combined response Content-Type: text/html text/plain assert_equals: expected "text/plain" but got "" >+PASS <iframe>: separate response Content-Type: text/plain;charset=gbk text/html >+FAIL <iframe>: combined response Content-Type: text/plain;charset=gbk text/html assert_equals: expected "UTF-8" but got "GBK" >+PASS fetch(): separate response Content-Type: text/plain;charset=gbk text/html >+FAIL fetch(): combined response Content-Type: text/plain;charset=gbk text/html assert_equals: expected "text/html" but got "text/plain" >+FAIL Request: combined response Content-Type: text/plain;charset=gbk text/html assert_equals: expected "text/html" but got "" >+FAIL Response: combined response Content-Type: text/plain;charset=gbk text/html assert_equals: expected "text/html" but got "" >+PASS <iframe>: separate response Content-Type: text/plain;charset=gbk text/html;charset=windows-1254 >+FAIL <iframe>: combined response Content-Type: text/plain;charset=gbk text/html;charset=windows-1254 assert_equals: expected "WINDOWS-1254" but got "GBK" >+FAIL fetch(): separate response Content-Type: text/plain;charset=gbk text/html;charset=windows-1254 assert_equals: expected "text/html;charset=windows-1254" but got "text/html" >+FAIL fetch(): combined response Content-Type: text/plain;charset=gbk text/html;charset=windows-1254 assert_equals: expected "text/html;charset=windows-1254" but got "text/plain" >+FAIL Request: combined response Content-Type: text/plain;charset=gbk text/html;charset=windows-1254 assert_equals: expected "text/html;charset=windows-1254" but got "" >+FAIL Response: combined response Content-Type: text/plain;charset=gbk text/html;charset=windows-1254 assert_equals: expected "text/html;charset=windows-1254" but got "" >+FAIL <iframe>: separate response Content-Type: text/plain;charset=gbk text/plain assert_equals: expected "GBK" but got "UTF-8" >+FAIL <iframe>: combined response Content-Type: text/plain;charset=gbk text/plain assert_equals: expected "text/plain" but got "text/x-python-script" >+FAIL fetch(): separate response Content-Type: text/plain;charset=gbk text/plain assert_equals: expected "text/plain;charset=gbk" but got "text/plain" >+FAIL fetch(): combined response Content-Type: text/plain;charset=gbk text/plain assert_equals: expected "text/plain;charset=gbk" but got "text/plain" >+FAIL Request: combined response Content-Type: text/plain;charset=gbk text/plain assert_equals: expected "text/plain;charset=gbk" but got "" >+FAIL Response: combined response Content-Type: text/plain;charset=gbk text/plain assert_equals: expected "text/plain;charset=gbk" but got "" >+FAIL <iframe>: separate response Content-Type: text/plain;charset=gbk text/plain;charset=windows-1252 assert_equals: expected "text/plain" but got "text/x-python-script" >+FAIL <iframe>: combined response Content-Type: text/plain;charset=gbk text/plain;charset=windows-1252 assert_equals: expected "WINDOWS-1252" but got "GBK" >+FAIL fetch(): separate response Content-Type: text/plain;charset=gbk text/plain;charset=windows-1252 assert_equals: expected "text/plain;charset=windows-1252" but got "text/plain" >+FAIL fetch(): combined response Content-Type: text/plain;charset=gbk text/plain;charset=windows-1252 assert_equals: expected "text/plain;charset=windows-1252" but got "text/plain" >+FAIL Request: combined response Content-Type: text/plain;charset=gbk text/plain;charset=windows-1252 assert_equals: expected "text/plain;charset=windows-1252" but got "" >+FAIL Response: combined response Content-Type: text/plain;charset=gbk text/plain;charset=windows-1252 assert_equals: expected "text/plain;charset=windows-1252" but got "" >+FAIL <iframe>: separate response Content-Type: text/html;charset=gbk text/html;x=",text/plain assert_equals: expected "GBK" but got "UTF-8" >+PASS <iframe>: combined response Content-Type: text/html;charset=gbk text/html;x=",text/plain >+FAIL fetch(): separate response Content-Type: text/html;charset=gbk text/html;x=",text/plain assert_equals: expected "text/html;x=\",text/plain\";charset=gbk" but got "text/html" >+FAIL fetch(): combined response Content-Type: text/html;charset=gbk text/html;x=",text/plain assert_equals: expected "text/html;x=\",text/plain\";charset=gbk" but got "text/html" >+FAIL Request: combined response Content-Type: text/html;charset=gbk text/html;x=",text/plain assert_equals: expected "text/html;x=\",text/plain\";charset=gbk" but got "" >+FAIL Response: combined response Content-Type: text/html;charset=gbk text/html;x=",text/plain assert_equals: expected "text/html;x=\",text/plain\";charset=gbk" but got "" >+FAIL <iframe>: separate response Content-Type: text/plain;charset=gbk;x=foo text/plain assert_equals: expected "GBK" but got "UTF-8" >+FAIL <iframe>: combined response Content-Type: text/plain;charset=gbk;x=foo text/plain assert_equals: expected "text/plain" but got "text/x-python-script" >+FAIL fetch(): separate response Content-Type: text/plain;charset=gbk;x=foo text/plain assert_equals: expected "text/plain;charset=gbk" but got "text/plain" >+FAIL fetch(): combined response Content-Type: text/plain;charset=gbk;x=foo text/plain assert_equals: expected "text/plain;charset=gbk" but got "text/plain" >+FAIL Request: combined response Content-Type: text/plain;charset=gbk;x=foo text/plain assert_equals: expected "text/plain;charset=gbk" but got "" >+FAIL Response: combined response Content-Type: text/plain;charset=gbk;x=foo text/plain assert_equals: expected "text/plain;charset=gbk" but got "" >+PASS <iframe>: separate response Content-Type: text/html;charset=gbk text/plain text/html >+FAIL <iframe>: combined response Content-Type: text/html;charset=gbk text/plain text/html assert_equals: expected "UTF-8" but got "GBK" >+PASS fetch(): separate response Content-Type: text/html;charset=gbk text/plain text/html >+PASS fetch(): combined response Content-Type: text/html;charset=gbk text/plain text/html >+FAIL Request: combined response Content-Type: text/html;charset=gbk text/plain text/html assert_equals: expected "text/html" but got "" >+FAIL Response: combined response Content-Type: text/html;charset=gbk text/plain text/html assert_equals: expected "text/html" but got "" >+FAIL <iframe>: separate response Content-Type: text/plain */* assert_equals: expected "text/plain" but got "text/x-python-script" >+FAIL <iframe>: combined response Content-Type: text/plain */* assert_equals: expected "text/plain" but got "text/x-python-script" >+FAIL fetch(): separate response Content-Type: text/plain */* assert_equals: expected "text/plain" but got "*/*" >+PASS fetch(): combined response Content-Type: text/plain */* >+FAIL Request: combined response Content-Type: text/plain */* assert_equals: expected "text/plain" but got "" >+FAIL Response: combined response Content-Type: text/plain */* assert_equals: expected "text/plain" but got "" >+FAIL <iframe>: separate response Content-Type: text/html */* assert_equals: expected "b" but got "pre" >+FAIL <iframe>: combined response Content-Type: text/html */* assert_equals: expected "b" but got "pre" >+FAIL fetch(): separate response Content-Type: text/html */* assert_equals: expected "text/html" but got "*/*" >+PASS fetch(): combined response Content-Type: text/html */* >+FAIL Request: combined response Content-Type: text/html */* assert_equals: expected "text/html" but got "" >+FAIL Response: combined response Content-Type: text/html */* assert_equals: expected "text/html" but got "" >+PASS <iframe>: separate response Content-Type: */* text/html >+FAIL <iframe>: combined response Content-Type: */* text/html assert_equals: expected "b" but got "pre" >+PASS fetch(): separate response Content-Type: */* text/html >+FAIL fetch(): combined response Content-Type: */* text/html assert_equals: expected "text/html" but got "*/*" >+FAIL Request: combined response Content-Type: */* text/html assert_equals: expected "text/html" but got "" >+FAIL Response: combined response Content-Type: */* text/html assert_equals: expected "text/html" but got "" >+FAIL <iframe>: separate response Content-Type: text/plain */*;charset=gbk assert_equals: expected "UTF-8" but got "GBK" >+FAIL <iframe>: combined response Content-Type: text/plain */*;charset=gbk assert_equals: expected "UTF-8" but got "GBK" >+FAIL fetch(): separate response Content-Type: text/plain */*;charset=gbk assert_equals: expected "text/plain" but got "*/*" >+PASS fetch(): combined response Content-Type: text/plain */*;charset=gbk >+FAIL Request: combined response Content-Type: text/plain */*;charset=gbk assert_equals: expected "text/plain" but got "" >+FAIL Response: combined response Content-Type: text/plain */*;charset=gbk assert_equals: expected "text/plain" but got "" >+FAIL <iframe>: separate response Content-Type: text/html */*;charset=gbk assert_equals: expected "UTF-8" but got "GBK" >+FAIL <iframe>: combined response Content-Type: text/html */*;charset=gbk assert_equals: expected "UTF-8" but got "GBK" >+FAIL fetch(): separate response Content-Type: text/html */*;charset=gbk assert_equals: expected "text/html" but got "*/*" >+PASS fetch(): combined response Content-Type: text/html */*;charset=gbk >+FAIL Request: combined response Content-Type: text/html */*;charset=gbk assert_equals: expected "text/html" but got "" >+FAIL Response: combined response Content-Type: text/html */*;charset=gbk assert_equals: expected "text/html" but got "" >+FAIL <iframe>: separate response Content-Type: text/html;x=" text/plain assert_equals: expected "b" but got "pre" >+PASS <iframe>: combined response Content-Type: text/html;x=" text/plain >+FAIL fetch(): separate response Content-Type: text/html;x=" text/plain assert_equals: expected "text/html;x=\", text/plain\"" but got "text/plain" >+FAIL fetch(): combined response Content-Type: text/html;x=" text/plain assert_equals: expected "text/html;x=\", text/plain\"" but got "text/html" >+FAIL Request: combined response Content-Type: text/html;x=" text/plain assert_equals: expected "text/html;x=\", text/plain\"" but got "" >+FAIL Response: combined response Content-Type: text/html;x=" text/plain assert_equals: expected "text/html;x=\", text/plain\"" but got "" >+FAIL <iframe>: separate response Content-Type: text/html;" text/plain assert_equals: expected "b" but got "pre" >+PASS <iframe>: combined response Content-Type: text/html;" text/plain >+FAIL fetch(): separate response Content-Type: text/html;" text/plain assert_equals: expected "text/html" but got "text/plain" >+PASS fetch(): combined response Content-Type: text/html;" text/plain >+FAIL Request: combined response Content-Type: text/html;" text/plain assert_equals: expected "text/html" but got "" >+FAIL Response: combined response Content-Type: text/html;" text/plain assert_equals: expected "text/html" but got "" >+FAIL <iframe>: separate response Content-Type: text/html;" \" text/plain assert_equals: expected "b" but got "pre" >+PASS <iframe>: combined response Content-Type: text/html;" \" text/plain >+FAIL fetch(): separate response Content-Type: text/html;" \" text/plain assert_equals: expected "text/html" but got "text/plain" >+PASS fetch(): combined response Content-Type: text/html;" \" text/plain >+FAIL Request: combined response Content-Type: text/html;" \" text/plain assert_equals: expected "text/html" but got "" >+FAIL Response: combined response Content-Type: text/html;" \" text/plain assert_equals: expected "text/html" but got "" >+FAIL <iframe>: separate response Content-Type: text/html;" \" text/plain ";charset=GBK assert_equals: expected "b" but got "pre" >+PASS <iframe>: combined response Content-Type: text/html;" \" text/plain ";charset=GBK >+FAIL fetch(): separate response Content-Type: text/html;" \" text/plain ";charset=GBK assert_equals: expected "text/html;charset=GBK" but got "\"" >+FAIL fetch(): combined response Content-Type: text/html;" \" text/plain ";charset=GBK assert_equals: expected "text/html;charset=GBK" but got "text/html" >+FAIL Request: combined response Content-Type: text/html;" \" text/plain ";charset=GBK assert_equals: expected "text/html;charset=GBK" but got "" >+FAIL Response: combined response Content-Type: text/html;" \" text/plain ";charset=GBK assert_equals: expected "text/html;charset=GBK" but got "" >+FAIL <iframe>: separate response Content-Type: text/html;" " text/plain assert_equals: expected "text/plain" but got "text/x-python-script" >+FAIL <iframe>: combined response Content-Type: text/html;" " text/plain assert_equals: expected "<b>hi</b>\n" but got "hi\n" >+PASS fetch(): separate response Content-Type: text/html;" " text/plain >+FAIL fetch(): combined response Content-Type: text/html;" " text/plain assert_equals: expected "text/plain" but got "text/html" >+FAIL Request: combined response Content-Type: text/html;" " text/plain assert_equals: expected "text/plain" but got "" >+FAIL Response: combined response Content-Type: text/html;" " text/plain assert_equals: expected "text/plain" but got "" >+ >diff --git a/LayoutTests/platform/ios-wk1/TestExpectations b/LayoutTests/platform/ios-wk1/TestExpectations >index 31dd1e304cd982c0da85e70aca30cca538b31887..f4f8266e6b0942aa64a2129f2473404206e573f3 100644 >--- a/LayoutTests/platform/ios-wk1/TestExpectations >+++ b/LayoutTests/platform/ios-wk1/TestExpectations >@@ -1469,7 +1469,6 @@ http/tests/navigation/page-cache-iframe-provisional-load.html [ Crash Pass Failu > imported/blink/editing/execCommand/4128080-2.html [ Crash Failure ] > imported/blink/editing/undo/crash-redo-with-iframes.html [ Crash Pass ] > imported/blink/paint/deprecatedpaintlayer/non-self-painting-layer-overrides-visibility.html [ Crash Pass ] >-imported/w3c/web-platform-tests/fetch/api/redirect/redirect-location.html [ Crash Pass ] > platform/ios/ios/fast/coordinates/document-elementFromPoint.html [ Timeout Failure ] > platform/ios/ios/fast/coordinates/touch-event-zoomed.html [ Crash Timeout ] > platform/ios/ios/fast/coordinates/touch-event.html [ Crash Timeout ] >@@ -1926,7 +1925,6 @@ imported/blink/imported/csswg-test/css-writing-modes-3/bidi-override-001.html [ > imported/blink/imported/csswg-test/css-writing-modes-3/bidi-plaintext-004.html [ Pass ImageOnlyFailure ] > imported/blink/imported/csswg-test/css-writing-modes-3/bidi-unset-007.html [ Pass ImageOnlyFailure ] > imported/blink/imported/csswg-test/css-writing-modes-3/block-embed-001.html [ Pass ImageOnlyFailure ] >-imported/w3c/web-platform-tests/fetch/api/redirect/redirect-count.html [ Crash Pass ] > imported/mozilla/svg/text/clipPath-content.svg [ Pass ImageOnlyFailure ] > > # Skipping timeouts that are impacting testing >diff --git a/LayoutTests/platform/ios/TestExpectations b/LayoutTests/platform/ios/TestExpectations >index 4c38407ee7b6c2b2d6155635eea954aed9e38a58..bd747f711a2eb2ded63c4c124c2f5f5bef370212 100644 >--- a/LayoutTests/platform/ios/TestExpectations >+++ b/LayoutTests/platform/ios/TestExpectations >@@ -218,6 +218,7 @@ fast/history/page-cache-media-source-closed-2.html [ Skip ] > fast/history/page-cache-media-source-closed.html [ Skip ] > fast/history/page-cache-media-source-opened.html [ Skip ] > fast/history/page-cache-removed-source-buffer.html [ Skip ] >+imported/w3c/web-platform-tests/fetch/api/basic/mediasource.window.html [ Skip ] > > # Quota API is not supported on iOS > storage/domstorage/quota.html >@@ -2687,10 +2688,6 @@ webkit.org/b/168215 imported/w3c/web-platform-tests/html/semantics/embedded-cont > # <rdar://problem/30610988> > imported/w3c/web-platform-tests/fetch/api/redirect/redirect-count-cross-origin-worker.html [ Failure ] > imported/w3c/web-platform-tests/fetch/api/redirect/redirect-count-cross-origin.html [ Failure ] >-imported/w3c/web-platform-tests/fetch/api/redirect/redirect-count-worker.html [ Failure ] >-imported/w3c/web-platform-tests/fetch/api/redirect/redirect-count.html [ Failure ] >-imported/w3c/web-platform-tests/fetch/api/redirect/redirect-location-worker.html [ Failure ] >-imported/w3c/web-platform-tests/fetch/api/redirect/redirect-location.html [ Failure ] > > # rdar://problem/23643423 > [ Debug ] fast/frames/exponential-frames.html [ Skip ] >diff --git a/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/fetch/api/abort/serviceworker-intercepted.https-expected.txt b/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/fetch/api/abort/serviceworker-intercepted.https-expected.txt >index 6acc3caf54f5534b33e39179a28b0197e5d6e9d2..7ba512b14cd0a0c66edc8683a759b63bc3a64a00 100644 >--- a/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/fetch/api/abort/serviceworker-intercepted.https-expected.txt >+++ b/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/fetch/api/abort/serviceworker-intercepted.https-expected.txt >@@ -1,9 +1,9 @@ > >-FAIL Already aborted request does not land in service worker promise_test: Unhandled rejection with value: object "TypeError: undefined is not an object (evaluating 'navigator.serviceWorker.getRegistration')" >-FAIL response.arrayBuffer() rejects if already aborted promise_test: Unhandled rejection with value: object "TypeError: undefined is not an object (evaluating 'navigator.serviceWorker.getRegistration')" >-FAIL response.blob() rejects if already aborted promise_test: Unhandled rejection with value: object "TypeError: undefined is not an object (evaluating 'navigator.serviceWorker.getRegistration')" >-FAIL response.formData() rejects if already aborted promise_test: Unhandled rejection with value: object "TypeError: undefined is not an object (evaluating 'navigator.serviceWorker.getRegistration')" >-FAIL response.json() rejects if already aborted promise_test: Unhandled rejection with value: object "TypeError: undefined is not an object (evaluating 'navigator.serviceWorker.getRegistration')" >-FAIL response.text() rejects if already aborted promise_test: Unhandled rejection with value: object "TypeError: undefined is not an object (evaluating 'navigator.serviceWorker.getRegistration')" >-FAIL Stream errors once aborted. promise_test: Unhandled rejection with value: object "TypeError: undefined is not an object (evaluating 'navigator.serviceWorker.getRegistration')" >+FAIL Already aborted request does not land in service worker promise_test: Unhandled rejection with value: object "TypeError: undefined is not an object (evaluating 'navigator.serviceWorker.register')" >+FAIL response.arrayBuffer() rejects if already aborted promise_test: Unhandled rejection with value: object "TypeError: undefined is not an object (evaluating 'navigator.serviceWorker.register')" >+FAIL response.blob() rejects if already aborted promise_test: Unhandled rejection with value: object "TypeError: undefined is not an object (evaluating 'navigator.serviceWorker.register')" >+FAIL response.formData() rejects if already aborted promise_test: Unhandled rejection with value: object "TypeError: undefined is not an object (evaluating 'navigator.serviceWorker.register')" >+FAIL response.json() rejects if already aborted promise_test: Unhandled rejection with value: object "TypeError: undefined is not an object (evaluating 'navigator.serviceWorker.register')" >+FAIL response.text() rejects if already aborted promise_test: Unhandled rejection with value: object "TypeError: undefined is not an object (evaluating 'navigator.serviceWorker.register')" >+FAIL Stream errors once aborted. promise_test: Unhandled rejection with value: object "TypeError: undefined is not an object (evaluating 'navigator.serviceWorker.register')" > >diff --git a/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/fetch/api/request/request-init-stream.any-expected.txt b/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/fetch/api/request/request-init-stream.any-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..0959731637cf1103d25212637bf879ce42297343 >--- /dev/null >+++ b/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/fetch/api/request/request-init-stream.any-expected.txt >@@ -0,0 +1,8 @@ >+ >+FAIL Constructing a Request with a stream on which getReader() is called assert_throws: new Request() function "() => new Request(input, init)" did not throw >+FAIL Constructing a Request with a stream on which read() is called assert_throws: new Request() function "() => new Request(input, init)" did not throw >+FAIL Constructing a Request with a stream on which read() and releaseLock() are called assert_throws: new Request() function "() => new Request(input, init)" did not throw >+FAIL Constructing a Request with a Request on which body.getReader() is called assert_throws: fetch() function "async () => await fetch(input, init)" did not throw >+FAIL Constructing a Request with a Request on which body.getReader().read() is called assert_throws: fetch() function "async () => await fetch(input, init)" did not throw >+FAIL Constructing a Request with a Request on which read() and releaseLock() are called assert_throws: fetch() function "async () => await fetch(input, init)" did not throw >+ >diff --git a/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/fetch/api/request/request-reset-attributes.https-expected.txt b/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/fetch/api/request/request-reset-attributes.https-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..290ed6141570b33ab74fbc7e0f39eac7fa90f0cb >--- /dev/null >+++ b/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/fetch/api/request/request-reset-attributes.https-expected.txt >@@ -0,0 +1,5 @@ >+ >+FAIL Request.isReloadNavigation is reset with non-empty RequestInit promise_test: Unhandled rejection with value: object "TypeError: undefined is not an object (evaluating 'navigator.serviceWorker.getRegistration')" >+FAIL Request.isHistoryNavigation is reset with non-empty RequestInit promise_test: Unhandled rejection with value: object "TypeError: undefined is not an object (evaluating 'navigator.serviceWorker.getRegistration')" >+FAIL Request.mode is reset with non-empty RequestInit when it's "navigate" promise_test: Unhandled rejection with value: object "TypeError: undefined is not an object (evaluating 'navigator.serviceWorker.getRegistration')" >+ >diff --git a/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/fetch/content-type/script.window-expected.txt b/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/fetch/content-type/script.window-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..c99a487c1feb39b89c63da008a8f098596694db5 >--- /dev/null >+++ b/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/fetch/content-type/script.window-expected.txt >@@ -0,0 +1,33 @@ >+ >+PASS Loading JSON⦠>+PASS separate text/javascript;charset=windows-1252 >+PASS separate text/javascript;";charset=windows-1252 >+FAIL separate text/javascript assert_unreached: Reached unreachable code >+PASS separate "text/javascript" >+PASS separate text/ javascript >+PASS separate text /javascript >+PASS separate x/x text/javascript >+FAIL combined x/x text/javascript assert_unreached: Reached unreachable code >+PASS separate x/x;charset=windows-1252 text/javascript >+FAIL combined x/x;charset=windows-1252 text/javascript assert_unreached: Reached unreachable code >+PASS separate text/javascript x/x >+FAIL combined text/javascript x/x assert_unreached: Reached unreachable code >+FAIL separate text/javascript; charset=windows-1252 text/javascript assert_equals: expected "ââ¬" but got "â¬" >+PASS combined text/javascript; charset=windows-1252 text/javascript >+FAIL separate text/javascript;" x/x assert_unreached: Reached unreachable code >+PASS combined text/javascript;" x/x >+FAIL separate text/javascript assert_unreached: Reached unreachable code >+PASS combined text/javascript >+FAIL separate text/javascript error assert_unreached: Reached unreachable code >+PASS combined text/javascript error >+PASS separate text/javascript;charset=windows-1252 x/x text/javascript >+FAIL combined text/javascript;charset=windows-1252 x/x text/javascript assert_equals: expected "â¬" but got "ââ¬" >+FAIL separate text/javascript;charset=windows-1252 error text/javascript assert_equals: expected "ââ¬" but got "â¬" >+PASS combined text/javascript;charset=windows-1252 error text/javascript >+FAIL separate text/javascript;charset=windows-1252 text/javascript assert_equals: expected "ââ¬" but got "â¬" >+PASS combined text/javascript;charset=windows-1252 text/javascript >+FAIL separate text/javascript;charset=windows-1252;" \" x/x assert_unreached: Reached unreachable code >+PASS combined text/javascript;charset=windows-1252;" \" x/x >+PASS separate x/x;" x/y;\" text/javascript;charset=windows-1252;" text/javascript >+FAIL combined x/x;" x/y;\" text/javascript;charset=windows-1252;" text/javascript assert_unreached: Reached unreachable code >+ >diff --git a/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/fetch/http-cache/304-update-expected.txt b/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/fetch/http-cache/304-update-expected.txt >index 8dd5c807dd2c5a3d2fd9d26c74c76c8c542b41c7..56040f4fa6246e0535aa5cab8fb58b039e82e12d 100644 >--- a/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/fetch/http-cache/304-update-expected.txt >+++ b/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/fetch/http-cache/304-update-expected.txt >@@ -1,6 +1,7 @@ > >-PASS HTTP cache updates returned headers from a Last-Modified 304. >-FAIL HTTP cache updates stored headers from a Last-Modified 304. assert_less_than: Response used expected a number less than 3 but got 3 >-PASS HTTP cache updates returned headers from a ETag 304. >-FAIL HTTP cache updates stored headers from a ETag 304. assert_less_than: Response used expected a number less than 3 but got 3 >+PASS HTTP cache updates returned headers from a Last-Modified 304 >+FAIL HTTP cache updates stored headers from a Last-Modified 304 assert_less_than: Response 3 does not come from cache expected a number less than 3 but got 3 >+PASS HTTP cache updates returned headers from a ETag 304 >+FAIL HTTP cache updates stored headers from a ETag 304 assert_less_than: Response 3 does not come from cache expected a number less than 3 but got 3 >+FAIL Content-* header assert_less_than: Response 3 does not come from cache expected a number less than 3 but got 3 > >diff --git a/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/fetch/http-cache/cc-request-expected.txt b/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/fetch/http-cache/cc-request-expected.txt >index 6db5c3d09b548cce57536adc1e41c279b1fcc3ca..fea128b9b37c1c8dd7003219664f72517af848ff 100644 >--- a/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/fetch/http-cache/cc-request-expected.txt >+++ b/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/fetch/http-cache/cc-request-expected.txt >@@ -1,14 +1,14 @@ > >-PASS HTTP cache doesn't use aged but fresh response when request contains Cache-Control: max-age=0. >-PASS HTTP cache doesn't use aged but fresh response when request contains Cache-Control: max-age=1. >-PASS HTTP cache doesn't use fresh response with Age header when request contains Cache-Control: max-age that is greater than remaining freshness. >-FAIL HTTP cache does use aged stale response when request contains Cache-Control: max-stale that permits its use. assert_less_than: Response used expected a number less than 2 but got 2 >-FAIL HTTP cache does reuse stale response with Age header when request contains Cache-Control: max-stale that permits its use. assert_less_than: Response used expected a number less than 2 but got 2 >-PASS HTTP cache doesn't reuse fresh response when request contains Cache-Control: min-fresh that wants it fresher. >-PASS HTTP cache doesn't reuse fresh response with Age header when request contains Cache-Control: min-fresh that wants it fresher. >-PASS HTTP cache doesn't reuse fresh response when request contains Cache-Control: no-cache. >-PASS HTTP cache validates fresh response with Last-Modified when request contains Cache-Control: no-cache. >-PASS HTTP cache validates fresh response with ETag when request contains Cache-Control: no-cache. >-PASS HTTP cache doesn't reuse fresh response when request contains Cache-Control: no-store. >-FAIL HTTP cache generates 504 status code when nothing is in cache and request contains Cache-Control: only-if-cached. promise_test: Unhandled rejection with value: object "TypeError: canât load from network" >+PASS HTTP cache doesn't use aged but fresh response when request contains Cache-Control: max-age=0 >+PASS HTTP cache doesn't use aged but fresh response when request contains Cache-Control: max-age=1 >+PASS HTTP cache doesn't use fresh response with Age header when request contains Cache-Control: max-age that is greater than remaining freshness >+FAIL HTTP cache does use aged stale response when request contains Cache-Control: max-stale that permits its use assert_less_than: Response 2 does not come from cache expected a number less than 2 but got 2 >+FAIL HTTP cache does reuse stale response with Age header when request contains Cache-Control: max-stale that permits its use assert_less_than: Response 2 does not come from cache expected a number less than 2 but got 2 >+PASS HTTP cache doesn't reuse fresh response when request contains Cache-Control: min-fresh that wants it fresher >+PASS HTTP cache doesn't reuse fresh response with Age header when request contains Cache-Control: min-fresh that wants it fresher >+PASS HTTP cache doesn't reuse fresh response when request contains Cache-Control: no-cache >+PASS HTTP cache validates fresh response with Last-Modified when request contains Cache-Control: no-cache >+PASS HTTP cache validates fresh response with ETag when request contains Cache-Control: no-cache >+PASS HTTP cache doesn't reuse fresh response when request contains Cache-Control: no-store >+FAIL HTTP cache generates 504 status code when nothing is in cache and request contains Cache-Control: only-if-cached promise_test: Unhandled rejection with value: object "TypeError: canât load from network" > >diff --git a/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/fetch/http-cache/heuristic-expected.txt b/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/fetch/http-cache/heuristic-expected.txt >index f1d5af26dd055ae9f9807701549ec7b1f9a34043..665f2c1a8211063f98d6488b815e4c2ee7dcf0c7 100644 >--- a/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/fetch/http-cache/heuristic-expected.txt >+++ b/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/fetch/http-cache/heuristic-expected.txt >@@ -1,18 +1,18 @@ > >-FAIL HTTP cache reuses an unknown response with Last-Modified based upon heuristic freshness when Cache-Control: public is present. assert_less_than: Response used expected a number less than 2 but got 2 >-PASS HTTP cache does not reuse an unknown response with Last-Modified based upon heuristic freshness when Cache-Control: public is not present. >-PASS HTTP cache reuses a 200 OK response with Last-Modified based upon heuristic freshness. >-PASS HTTP cache reuses a 203 Non-Authoritative Information response with Last-Modified based upon heuristic freshness. >-FAIL HTTP cache reuses a 204 No Content response with Last-Modified based upon heuristic freshness. assert_less_than: Response used expected a number less than 2 but got 2 >-PASS HTTP cache reuses a 404 Not Found response with Last-Modified based upon heuristic freshness. >-FAIL HTTP cache reuses a 405 Method Not Allowed response with Last-Modified based upon heuristic freshness. assert_less_than: Response used expected a number less than 2 but got 2 >-PASS HTTP cache reuses a 410 Gone response with Last-Modified based upon heuristic freshness. >-FAIL HTTP cache reuses a 414 URI Too Long response with Last-Modified based upon heuristic freshness. assert_less_than: Response used expected a number less than 2 but got 2 >-FAIL HTTP cache reuses a 501 Not Implemented response with Last-Modified based upon heuristic freshness. assert_less_than: Response used expected a number less than 2 but got 2 >-PASS HTTP cache does not use a 201 Created response with Last-Modified based upon heuristic freshness. >-PASS HTTP cache does not use a 202 Accepted response with Last-Modified based upon heuristic freshness. >-PASS HTTP cache does not use a 403 Forbidden response with Last-Modified based upon heuristic freshness. >-PASS HTTP cache does not use a 502 Bad Gateway response with Last-Modified based upon heuristic freshness. >-PASS HTTP cache does not use a 503 Service Unavailable response with Last-Modified based upon heuristic freshness. >-PASS HTTP cache does not use a 504 Gateway Timeout response with Last-Modified based upon heuristic freshness. >+FAIL HTTP cache reuses an unknown response with Last-Modified based upon heuristic freshness when Cache-Control: public is present assert_less_than: Response 2 does not come from cache expected a number less than 2 but got 2 >+PASS HTTP cache does not reuse an unknown response with Last-Modified based upon heuristic freshness when Cache-Control: public is not present >+PASS HTTP cache reuses a 200 OK response with Last-Modified based upon heuristic freshness >+PASS HTTP cache reuses a 203 Non-Authoritative Information response with Last-Modified based upon heuristic freshness >+FAIL HTTP cache reuses a 204 No Content response with Last-Modified based upon heuristic freshness assert_less_than: Response 2 does not come from cache expected a number less than 2 but got 2 >+PASS HTTP cache reuses a 404 Not Found response with Last-Modified based upon heuristic freshness >+FAIL HTTP cache reuses a 405 Method Not Allowed response with Last-Modified based upon heuristic freshness assert_less_than: Response 2 does not come from cache expected a number less than 2 but got 2 >+PASS HTTP cache reuses a 410 Gone response with Last-Modified based upon heuristic freshness >+FAIL HTTP cache reuses a 414 URI Too Long response with Last-Modified based upon heuristic freshness assert_less_than: Response 2 does not come from cache expected a number less than 2 but got 2 >+FAIL HTTP cache reuses a 501 Not Implemented response with Last-Modified based upon heuristic freshness assert_less_than: Response 2 does not come from cache expected a number less than 2 but got 2 >+PASS HTTP cache does not use a 201 Created response with Last-Modified based upon heuristic freshness >+PASS HTTP cache does not use a 202 Accepted response with Last-Modified based upon heuristic freshness >+PASS HTTP cache does not use a 403 Forbidden response with Last-Modified based upon heuristic freshness >+PASS HTTP cache does not use a 502 Bad Gateway response with Last-Modified based upon heuristic freshness >+PASS HTTP cache does not use a 503 Service Unavailable response with Last-Modified based upon heuristic freshness >+PASS HTTP cache does not use a 504 Gateway Timeout response with Last-Modified based upon heuristic freshness > >diff --git a/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/fetch/http-cache/invalidate-expected.txt b/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/fetch/http-cache/invalidate-expected.txt >index ebf5f21284f5bd99565cacd0d67de0b1d8e39b78..a5ced27570fe834c7bffd6f7266ae39248746463 100644 >--- a/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/fetch/http-cache/invalidate-expected.txt >+++ b/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/fetch/http-cache/invalidate-expected.txt >@@ -1,17 +1,17 @@ > >-FAIL HTTP cache invalidates after a successful response from a POST assert_equals: Response used expected 3 but got 1 >+FAIL HTTP cache invalidates after a successful response from a POST assert_equals: Response 3 comes from cache expected 3 but got 1 > PASS HTTP cache does not invalidate after a failed response from an unsafe request >-FAIL HTTP cache invalidates after a successful response from a PUT assert_equals: Response used expected 3 but got 1 >-FAIL HTTP cache invalidates after a successful response from a DELETE assert_equals: Response used expected 3 but got 1 >-FAIL HTTP cache invalidates after a successful response from an unknown method assert_equals: Response used expected 3 but got 1 >-FAIL HTTP cache invalidates Location URL after a successful response from a POST assert_equals: Response used expected 3 but got 1 >+FAIL HTTP cache invalidates after a successful response from a PUT assert_equals: Response 3 comes from cache expected 3 but got 1 >+FAIL HTTP cache invalidates after a successful response from a DELETE assert_equals: Response 3 comes from cache expected 3 but got 1 >+FAIL HTTP cache invalidates after a successful response from an unknown method assert_equals: Response 3 comes from cache expected 3 but got 1 >+FAIL HTTP cache invalidates Location URL after a successful response from a POST assert_equals: Response 3 comes from cache expected 3 but got 1 > PASS HTTP cache does not invalidate Location URL after a failed response from an unsafe request >-FAIL HTTP cache invalidates Location URL after a successful response from a PUT assert_equals: Response used expected 3 but got 1 >-FAIL HTTP cache invalidates Location URL after a successful response from a DELETE assert_equals: Response used expected 3 but got 1 >-FAIL HTTP cache invalidates Location URL after a successful response from an unknown method assert_equals: Response used expected 3 but got 1 >-FAIL HTTP cache invalidates Content-Location URL after a successful response from a POST assert_equals: Response used expected 3 but got 1 >+FAIL HTTP cache invalidates Location URL after a successful response from a PUT assert_equals: Response 3 comes from cache expected 3 but got 1 >+FAIL HTTP cache invalidates Location URL after a successful response from a DELETE assert_equals: Response 3 comes from cache expected 3 but got 1 >+FAIL HTTP cache invalidates Location URL after a successful response from an unknown method assert_equals: Response 3 comes from cache expected 3 but got 1 >+FAIL HTTP cache invalidates Content-Location URL after a successful response from a POST assert_equals: Response 3 comes from cache expected 3 but got 1 > PASS HTTP cache does not invalidate Content-Location URL after a failed response from an unsafe request >-FAIL HTTP cache invalidates Content-Location URL after a successful response from a PUT assert_equals: Response used expected 3 but got 1 >-FAIL HTTP cache invalidates Content-Location URL after a successful response from a DELETE assert_equals: Response used expected 3 but got 1 >-FAIL HTTP cache invalidates Content-Location URL after a successful response from an unknown method assert_equals: Response used expected 3 but got 1 >+FAIL HTTP cache invalidates Content-Location URL after a successful response from a PUT assert_equals: Response 3 comes from cache expected 3 but got 1 >+FAIL HTTP cache invalidates Content-Location URL after a successful response from a DELETE assert_equals: Response 3 comes from cache expected 3 but got 1 >+FAIL HTTP cache invalidates Content-Location URL after a successful response from an unknown method assert_equals: Response 3 comes from cache expected 3 but got 1 > >diff --git a/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/fetch/http-cache/status-expected.txt b/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/fetch/http-cache/status-expected.txt >index 55a6d5b58f97269c9858a3bab50810ff1c50c20f..fbf233e9bf0ef84897dfc410a3207dd6f349b44a 100644 >--- a/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/fetch/http-cache/status-expected.txt >+++ b/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/fetch/http-cache/status-expected.txt >@@ -1,28 +1,28 @@ > >-PASS HTTP cache goes to the network if it has a stale 200 response. >-PASS HTTP cache avoids going to the network if it has a fresh 200 response. >-PASS HTTP cache goes to the network if it has a stale 203 response. >-PASS HTTP cache avoids going to the network if it has a fresh 203 response. >-PASS HTTP cache goes to the network if it has a stale 204 response. >-FAIL HTTP cache avoids going to the network if it has a fresh 204 response. assert_less_than: Response used expected a number less than 2 but got 2 >-PASS HTTP cache goes to the network if it has a stale 299 response. >-FAIL HTTP cache avoids going to the network if it has a fresh 299 response. assert_less_than: Response used expected a number less than 2 but got 2 >-PASS HTTP cache goes to the network if it has a stale 400 response. >-FAIL HTTP cache avoids going to the network if it has a fresh 400 response. assert_less_than: Response used expected a number less than 2 but got 2 >-PASS HTTP cache goes to the network if it has a stale 404 response. >-PASS HTTP cache avoids going to the network if it has a fresh 404 response. >-PASS HTTP cache goes to the network if it has a stale 410 response. >-PASS HTTP cache avoids going to the network if it has a fresh 410 response. >-PASS HTTP cache goes to the network if it has a stale 499 response. >-FAIL HTTP cache avoids going to the network if it has a fresh 499 response. assert_less_than: Response used expected a number less than 2 but got 2 >-PASS HTTP cache goes to the network if it has a stale 500 response. >-FAIL HTTP cache avoids going to the network if it has a fresh 500 response. assert_less_than: Response used expected a number less than 2 but got 2 >-PASS HTTP cache goes to the network if it has a stale 502 response. >-FAIL HTTP cache avoids going to the network if it has a fresh 502 response. assert_less_than: Response used expected a number less than 2 but got 2 >-PASS HTTP cache goes to the network if it has a stale 503 response. >-FAIL HTTP cache avoids going to the network if it has a fresh 503 response. assert_less_than: Response used expected a number less than 2 but got 2 >-PASS HTTP cache goes to the network if it has a stale 504 response. >-FAIL HTTP cache avoids going to the network if it has a fresh 504 response. assert_less_than: Response used expected a number less than 2 but got 2 >-PASS HTTP cache goes to the network if it has a stale 599 response. >-FAIL HTTP cache avoids going to the network if it has a fresh 599 response. assert_less_than: Response used expected a number less than 2 but got 2 >+PASS HTTP cache goes to the network if it has a stale 200 response >+PASS HTTP cache avoids going to the network if it has a fresh 200 response >+PASS HTTP cache goes to the network if it has a stale 203 response >+PASS HTTP cache avoids going to the network if it has a fresh 203 response >+PASS HTTP cache goes to the network if it has a stale 204 response >+FAIL HTTP cache avoids going to the network if it has a fresh 204 response assert_less_than: Response 2 does not come from cache expected a number less than 2 but got 2 >+PASS HTTP cache goes to the network if it has a stale 299 response >+FAIL HTTP cache avoids going to the network if it has a fresh 299 response assert_less_than: Response 2 does not come from cache expected a number less than 2 but got 2 >+PASS HTTP cache goes to the network if it has a stale 400 response >+FAIL HTTP cache avoids going to the network if it has a fresh 400 response assert_less_than: Response 2 does not come from cache expected a number less than 2 but got 2 >+PASS HTTP cache goes to the network if it has a stale 404 response >+PASS HTTP cache avoids going to the network if it has a fresh 404 response >+PASS HTTP cache goes to the network if it has a stale 410 response >+PASS HTTP cache avoids going to the network if it has a fresh 410 response >+PASS HTTP cache goes to the network if it has a stale 499 response >+FAIL HTTP cache avoids going to the network if it has a fresh 499 response assert_less_than: Response 2 does not come from cache expected a number less than 2 but got 2 >+PASS HTTP cache goes to the network if it has a stale 500 response >+FAIL HTTP cache avoids going to the network if it has a fresh 500 response assert_less_than: Response 2 does not come from cache expected a number less than 2 but got 2 >+PASS HTTP cache goes to the network if it has a stale 502 response >+FAIL HTTP cache avoids going to the network if it has a fresh 502 response assert_less_than: Response 2 does not come from cache expected a number less than 2 but got 2 >+PASS HTTP cache goes to the network if it has a stale 503 response >+FAIL HTTP cache avoids going to the network if it has a fresh 503 response assert_less_than: Response 2 does not come from cache expected a number less than 2 but got 2 >+PASS HTTP cache goes to the network if it has a stale 504 response >+FAIL HTTP cache avoids going to the network if it has a fresh 504 response assert_less_than: Response 2 does not come from cache expected a number less than 2 but got 2 >+PASS HTTP cache goes to the network if it has a stale 599 response >+FAIL HTTP cache avoids going to the network if it has a fresh 599 response assert_less_than: Response 2 does not come from cache expected a number less than 2 but got 2 > >diff --git a/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/fetch/sec-metadata/embed.tentative.https.sub-expected.txt b/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/fetch/sec-metadata/embed.tentative.https.sub-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..47bcd831c9cffd6573baf7299a1406a2fcc33ffc >--- /dev/null >+++ b/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/fetch/sec-metadata/embed.tentative.https.sub-expected.txt >@@ -0,0 +1,8 @@ >+Blocked access to external URL https://www.localhost:9443/fetch/sec-metadata/resources/record-header.py?file=embed-same-site >+Blocked access to external URL https://www.not-web-platform.test:9443/fetch/sec-metadata/resources/record-header.py?file=embed-cross-site >+ >+ >+FAIL Same-Origin embed assert_not_equals: Empty Sec-Metadata header. got disallowed value "" >+FAIL Same-Site embed assert_equals: destination expected (string) "embed" but got (undefined) undefined >+FAIL Cross-Site embed assert_equals: destination expected (string) "embed" but got (undefined) undefined >+ >diff --git a/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/fetch/sec-metadata/object.tentative.https.sub-expected.txt b/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/fetch/sec-metadata/object.tentative.https.sub-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..3a3fe586b88f8055445b209418d9835a56d4d4f5 >--- /dev/null >+++ b/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/fetch/sec-metadata/object.tentative.https.sub-expected.txt >@@ -0,0 +1,8 @@ >+Blocked access to external URL https://www.localhost:9443/fetch/sec-metadata/resources/record-header.py?file=object-same-site >+Blocked access to external URL https://www.not-web-platform.test:9443/fetch/sec-metadata/resources/record-header.py?file=object-cross-site >+ >+ >+FAIL Same-Origin object assert_not_equals: Empty Sec-Metadata header. got disallowed value "" >+FAIL Same-Site object assert_equals: destination expected (string) "object" but got (undefined) undefined >+FAIL Cross-Site object assert_equals: destination expected (string) "object" but got (undefined) undefined >+ >diff --git a/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/fetch/sec-metadata/serviceworker.tentative.https.sub-expected.txt b/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/fetch/sec-metadata/serviceworker.tentative.https.sub-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..c2e0e98911c923748c43316899801a47fe81857a >--- /dev/null >+++ b/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/fetch/sec-metadata/serviceworker.tentative.https.sub-expected.txt >@@ -0,0 +1,3 @@ >+ >+PASS Browser does not support serviceworker >+ >diff --git a/LayoutTests/platform/mac/TestExpectations b/LayoutTests/platform/mac/TestExpectations >index 2e047a3dafab9e63cfa1c4ab665ee43217020026..6f7d94ef2463d2960ca45817b3b8406ab714496e 100644 >--- a/LayoutTests/platform/mac/TestExpectations >+++ b/LayoutTests/platform/mac/TestExpectations >@@ -1343,13 +1343,6 @@ webkit.org/b/168087 media/video-zoom.html [ Pass Failure ] > webkit.org/b/168094 imported/w3c/web-platform-tests/media-source/SourceBuffer-abort.html [ Pass Failure ] > webkit.org/b/167975 imported/w3c/web-platform-tests/media-source/SourceBuffer-abort-removed.html [ Pass Failure ] > >-# <rdar://problem/30610988> >-[ Sierra+ ] imported/w3c/web-platform-tests/fetch/api/redirect/redirect-count-cross-origin.html [ Failure ] >-[ Sierra+ ] imported/w3c/web-platform-tests/fetch/api/redirect/redirect-count-worker.html [ Failure ] >-[ Sierra+ ] imported/w3c/web-platform-tests/fetch/api/redirect/redirect-count.html [ Failure ] >-[ Sierra+ ] imported/w3c/web-platform-tests/fetch/api/redirect/redirect-location-worker.html [ Failure ] >-[ Sierra+ ] imported/w3c/web-platform-tests/fetch/api/redirect/redirect-location.html [ Failure ] >- > [ Debug ] imported/w3c/web-platform-tests/IndexedDB/interfaces.any.html [ Slow ] > [ Debug ] imported/w3c/web-platform-tests/IndexedDB/interfaces.any.worker.html [ Slow ] > [ Debug ] imported/w3c/web-platform-tests/hr-time/idlharness.html [ Slow ] >@@ -1685,9 +1678,6 @@ webkit.org/b/184116 imported/w3c/web-platform-tests/IndexedDB/idbobjectstore_cre > > webkit.org/b/177616 [ HighSierra+ ] http/tests/media/video-buffered-range-contains-currentTime.html [ Pass Timeout ] > >-webkit.org/b/184365 [ Debug ] imported/w3c/web-platform-tests/fetch/api/redirect/redirect-method-worker.html [ Skip ] >-webkit.org/b/184365 [ Debug ] imported/w3c/web-platform-tests/fetch/api/redirect/redirect-method.html [ Skip ] >- > webkit.org/b/184610 media/video-volume-slider-drag.html [ Pass Timeout ] > > webkit.org/b/184612 [ Debug ] media/audio-concurrent-supported.html [ Pass Failure ] >diff --git a/LayoutTests/tests-options.json b/LayoutTests/tests-options.json >index cb726902d94d2facf787defb77e25eb77ba38890..df029b005d37124d1f988b0baa5513a2d590f0b8 100644 >--- a/LayoutTests/tests-options.json >+++ b/LayoutTests/tests-options.json >@@ -1127,6 +1127,9 @@ > "imported/w3c/web-platform-tests/fetch/api/request/request-keepalive-quota.html": [ > "slow" > ], >+ "imported/w3c/web-platform-tests/fetch/http-cache/304-update.html": [ >+ "slow" >+ ], > "imported/w3c/web-platform-tests/fetch/http-cache/cc-request.html": [ > "slow" > ], >@@ -1136,6 +1139,9 @@ > "imported/w3c/web-platform-tests/fetch/http-cache/heuristic.html": [ > "slow" > ], >+ "imported/w3c/web-platform-tests/fetch/http-cache/invalidate.html": [ >+ "slow" >+ ], > "imported/w3c/web-platform-tests/fetch/http-cache/partial.html": [ > "slow" > ],
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 193125
:
358279
|
358284
|
358286
|
358289
|
358290
|
358296
|
358303
|
358306
|
358505