WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Patch
bug-205119-20200518091457.patch (text/plain), 63.50 KB, created by
Rob Buis
on 2020-05-18 00:15:00 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Rob Buis
Created:
2020-05-18 00:15:00 PDT
Size:
63.50 KB
patch
obsolete
>Subversion Revision: 261798 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index bf8d816cdd4d9fc0d510dcf78274d08313d4faa2..03ac2e3386f7e0b563453681f2533eb72853a869 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,25 @@ >+2020-05-18 Rob Buis <rbuis@igalia.com> >+ >+ Remove certain headers when a redirect causes a request method change >+ https://bugs.webkit.org/show_bug.cgi?id=205119 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Implement step 11 of HTTP-redirect fetch [1] to redirect to GET >+ method, remove body and strip certain headers for 301, 302 and 303 redirects. >+ >+ Tests: imported/w3c/web-platform-tests/fetch/api/redirect/redirect-method.any.html >+ imported/w3c/web-platform-tests/fetch/api/redirect/redirect-method.any.worker.html >+ >+ * loader/SubresourceLoader.cpp: >+ (WebCore::SubresourceLoader::checkRedirectionCrossOriginAccessControl): >+ * platform/network/HTTPHeaderNames.in: >+ * platform/network/ResourceRequestBase.cpp: >+ (WebCore::shouldUseGet): >+ (WebCore::ResourceRequestBase::redirectAsGETIfNeeded const): >+ (WebCore::ResourceRequestBase::redirectedRequest const): >+ * platform/network/ResourceRequestBase.h: >+ > 2020-05-17 Simon Fraser <simon.fraser@apple.com> > > Fix operator== and hash() for ExtendedColor >diff --git a/Source/WebCore/loader/SubresourceLoader.cpp b/Source/WebCore/loader/SubresourceLoader.cpp >index 499b6a4c34b7786def0d02a1d54082d18b6fbd12..37704757425d54824332adbc2ae55af7998383de 100644 >--- a/Source/WebCore/loader/SubresourceLoader.cpp >+++ b/Source/WebCore/loader/SubresourceLoader.cpp >@@ -659,6 +659,8 @@ Expected<void, String> SubresourceLoader::checkRedirectionCrossOriginAccessContr > if (crossOriginFlag && redirectingToNewOrigin) > m_origin = SecurityOrigin::createUnique(); > >+ previousRequest.redirectAsGETIfNeeded(newRequest, redirectResponse); >+ > // Implementing https://fetch.spec.whatwg.org/#concept-http-redirect-fetch step 14. > updateReferrerPolicy(redirectResponse.httpHeaderField(HTTPHeaderName::ReferrerPolicy)); > >diff --git a/Source/WebCore/platform/network/HTTPHeaderNames.in b/Source/WebCore/platform/network/HTTPHeaderNames.in >index d0824d6a945beb20b55757a6422ce22741cbb149..cbc470412f9ff1507202ab1babdf8e4f6df94880 100644 >--- a/Source/WebCore/platform/network/HTTPHeaderNames.in >+++ b/Source/WebCore/platform/network/HTTPHeaderNames.in >@@ -44,6 +44,7 @@ Content-Disposition > Content-Encoding > Content-Language > Content-Length >+Content-Location > Content-Security-Policy > Content-Security-Policy-Report-Only > Content-Type >diff --git a/Source/WebCore/platform/network/ResourceRequestBase.cpp b/Source/WebCore/platform/network/ResourceRequestBase.cpp >index ee7aa3485f7648068ef9c5e660f559c89d3e1d81..cc4e4733738dde3a8cf020ee4fef02ea8e0019c3 100644 >--- a/Source/WebCore/platform/network/ResourceRequestBase.cpp >+++ b/Source/WebCore/platform/network/ResourceRequestBase.cpp >@@ -129,11 +129,27 @@ void ResourceRequestBase::setURL(const URL& url) > > static bool shouldUseGet(const ResourceRequestBase& request, const ResourceResponse& redirectResponse) > { >+ if (equalLettersIgnoringASCIICase(request.httpMethod(), "get") || equalLettersIgnoringASCIICase(request.httpMethod(), "head")) >+ return false; > if (redirectResponse.httpStatusCode() == 301 || redirectResponse.httpStatusCode() == 302) > return equalLettersIgnoringASCIICase(request.httpMethod(), "post"); > return redirectResponse.httpStatusCode() == 303; > } > >+// https://fetch.spec.whatwg.org/#concept-http-redirect-fetch Step 11 >+void ResourceRequestBase::redirectAsGETIfNeeded(ResourceRequest &newRequest, const ResourceResponse& redirectResponse) const >+{ >+ if (shouldUseGet(*this, redirectResponse)) { >+ newRequest.setHTTPMethod("GET"_s); >+ newRequest.setHTTPBody(nullptr); >+ newRequest.m_httpHeaderFields.remove(HTTPHeaderName::ContentLength); >+ newRequest.m_httpHeaderFields.remove(HTTPHeaderName::ContentLanguage); >+ newRequest.m_httpHeaderFields.remove(HTTPHeaderName::ContentEncoding); >+ newRequest.m_httpHeaderFields.remove(HTTPHeaderName::ContentLocation); >+ newRequest.clearHTTPContentType(); >+ } >+} >+ > ResourceRequest ResourceRequestBase::redirectedRequest(const ResourceResponse& redirectResponse, bool shouldClearReferrerOnHTTPSToHTTPRedirect) const > { > ASSERT(redirectResponse.isRedirection()); >@@ -145,12 +161,7 @@ ResourceRequest ResourceRequestBase::redirectedRequest(const ResourceResponse& r > > request.setURL(location.isEmpty() ? URL { } : URL { redirectResponse.url(), location }); > >- if (shouldUseGet(*this, redirectResponse)) { >- request.setHTTPMethod("GET"_s); >- request.setHTTPBody(nullptr); >- request.clearHTTPContentType(); >- request.m_httpHeaderFields.remove(HTTPHeaderName::ContentLength); >- } >+ redirectAsGETIfNeeded(request, redirectResponse); > > if (shouldClearReferrerOnHTTPSToHTTPRedirect && !request.url().protocolIs("https") && WTF::protocolIs(request.httpReferrer(), "https")) > request.clearHTTPReferrer(); >diff --git a/Source/WebCore/platform/network/ResourceRequestBase.h b/Source/WebCore/platform/network/ResourceRequestBase.h >index 66f5fd7416ca87e54879e4f27de78733be47e6cc..8152ffe7291ba3df03e45c9a2b76c01e99377196 100644 >--- a/Source/WebCore/platform/network/ResourceRequestBase.h >+++ b/Source/WebCore/platform/network/ResourceRequestBase.h >@@ -67,6 +67,7 @@ public: > WEBCORE_EXPORT const URL& url() const; > WEBCORE_EXPORT void setURL(const URL& url); > >+ void redirectAsGETIfNeeded(ResourceRequest &, const ResourceResponse&) const; > WEBCORE_EXPORT ResourceRequest redirectedRequest(const ResourceResponse&, bool shouldClearReferrerOnHTTPSToHTTPRedirect) const; > > WEBCORE_EXPORT void removeCredentials(); >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index 2859ac3e3ee65e277c4e227bd9251888db270cb6..d6e67e27f6105a0326c44b79842d9dd704b22003 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,28 @@ >+2020-05-18 Rob Buis <rbuis@igalia.com> >+ >+ Remove certain headers when a redirect causes a request method change >+ https://bugs.webkit.org/show_bug.cgi?id=205119 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Add platform expectations for redirect-method.any.html and >+ redirect-method.any.worker.html. Remove expectations for >+ already removed tests redirect-method.html and >+ redirect-method.worker.html. >+ >+ * platform/gtk/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-method-expected.txt: Removed. >+ * platform/gtk/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-method-worker-expected.txt: Removed. >+ * platform/gtk/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-method.any-expected.txt: Renamed from LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-method-expected.txt. >+ * platform/gtk/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-method.any.worker-expected.txt: Renamed from LayoutTests/platform/wpe/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-method-expected.txt. >+ * platform/mac-mojave/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-method.any-expected.txt: Added. >+ * platform/mac-mojave/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-method.any.worker-expected.txt: Added. >+ * platform/mac-wk1/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-method.any-expected.txt: Added. >+ * platform/mac-wk1/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-method.any.worker-expected.txt: Added. >+ * platform/mac/TestExpectations: >+ * platform/wpe/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-method-worker-expected.txt: Removed. >+ * platform/wpe/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-method.any-expected.txt: Copied from LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-method.any-expected.txt. >+ * platform/wpe/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-method.any.worker-expected.txt: Copied from LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-method.any.worker-expected.txt. >+ > 2020-05-17 Daniel Bates <dabates@apple.com> > > Make editing-word-with-marker-1.html work on iOS >diff --git a/LayoutTests/imported/w3c/ChangeLog b/LayoutTests/imported/w3c/ChangeLog >index b560b0127512c63102c4985b9021e9b9477771f9..e9002e09c160ee5fadb5a3c7b15770b4533f096c 100644 >--- a/LayoutTests/imported/w3c/ChangeLog >+++ b/LayoutTests/imported/w3c/ChangeLog >@@ -1,3 +1,50 @@ >+2020-05-18 Rob Buis <rbuis@igalia.com> >+ >+ Remove certain headers when a redirect causes a request method change >+ https://bugs.webkit.org/show_bug.cgi?id=205119 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Sync fetch/api/redirect (ba2e4f92). >+ >+ * resources/import-expectations.json: >+ * web-platform-tests/fetch/api/redirect/redirect-count.any.js: >+ (redirectCount): >+ * web-platform-tests/fetch/api/redirect/redirect-empty-location.any.js: >+ * web-platform-tests/fetch/api/redirect/redirect-location-escape.tentative.any-expected.txt: Added. >+ * web-platform-tests/fetch/api/redirect/redirect-location-escape.tentative.any.html: Added. >+ * web-platform-tests/fetch/api/redirect/redirect-location-escape.tentative.any.js: Added. >+ (redirectLocation): >+ * web-platform-tests/fetch/api/redirect/redirect-location-escape.tentative.any.worker-expected.txt: Added. >+ * web-platform-tests/fetch/api/redirect/redirect-location-escape.tentative.any.worker.html: Added. >+ * web-platform-tests/fetch/api/redirect/redirect-location.any.js: >+ (redirectLocation): >+ * web-platform-tests/fetch/api/redirect/redirect-method.any-expected.txt: >+ * web-platform-tests/fetch/api/redirect/redirect-method.any.js: >+ (redirectMethod): >+ * web-platform-tests/fetch/api/redirect/redirect-method.any.worker-expected.txt: >+ * web-platform-tests/fetch/api/redirect/redirect-mode.any.js: >+ (testRedirect): >+ * web-platform-tests/fetch/api/redirect/redirect-origin.any-expected.txt: >+ * web-platform-tests/fetch/api/redirect/redirect-origin.any.js: >+ (testOriginAfterRedirection): >+ * web-platform-tests/fetch/api/redirect/redirect-origin.any.worker-expected.txt: >+ * web-platform-tests/fetch/api/redirect/redirect-referrer.any.js: >+ * web-platform-tests/fetch/api/redirect/redirect-schemes.html: >+ * web-platform-tests/fetch/api/redirect/redirect-to-dataurl.any.js: >+ (redirectDataURL): >+ * web-platform-tests/fetch/api/redirect/w3c-import.log: >+ * web-platform-tests/fetch/api/resources/keepalive-iframe.html: >+ * web-platform-tests/fetch/api/resources/method.py: >+ (main): >+ * web-platform-tests/fetch/api/resources/preflight.py: >+ (main): >+ * web-platform-tests/fetch/api/resources/redirect.py: >+ (main): >+ * web-platform-tests/fetch/api/resources/stash-put.py: >+ (main): >+ * web-platform-tests/fetch/api/resources/trickle.py: >+ > 2020-05-15 Oriol Brufau <obrufau@igalia.com> > > [css-grid] Treat percentages as auto for the minimum contribution >diff --git a/LayoutTests/imported/w3c/resources/import-expectations.json b/LayoutTests/imported/w3c/resources/import-expectations.json >index 3668fe9fe1b55e05af20fd92817ddda1aced1ec4..9c25bf3c570bb6128a9e05d3248343e443ca5bf0 100644 >--- a/LayoutTests/imported/w3c/resources/import-expectations.json >+++ b/LayoutTests/imported/w3c/resources/import-expectations.json >@@ -187,6 +187,8 @@ > "web-platform-tests/fetch": "import", > "web-platform-tests/fetch/api": "import", > "web-platform-tests/fetch/api/cors": "import", >+ "web-platform-tests/fetch/api/redirect": "import", >+ "web-platform-tests/fetch/api/resources": "import", > "web-platform-tests/fetch/origin": "import", > "web-platform-tests/fetch/range": "import", > "web-platform-tests/fetch/stale-while-revalidate": "import", >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 >index 0c45d8d87ce44e0ebdde4d10d974681384d47c09..4ce080e69027bc12f180dc93d00f0e7c9683022c 100644 >--- 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 >@@ -19,7 +19,7 @@ function redirectCount(desc, redirectUrl, redirectLocation, redirectStatus, maxC > 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 promise_rejects_js(test, TypeError, fetch(url + urlParameters, requestInit)); > > return fetch(url + urlParameters, requestInit).then(function(resp) { > assert_equals(resp.status, 200, "Response's status is 200"); >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 >index ace8f221c09af1fbcb33a57426c3324d8ac6ea9b..79b04f5c5ec271f1fd3b17378ccc970ca1c3fab3 100644 >--- 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 >@@ -6,7 +6,7 @@ > const url = RESOURCES_DIR + 'redirect-empty-location.py'; > > promise_test(t => { >- return promise_rejects(t, new TypeError(), fetch(url, {redirect:'follow'})); >+ return promise_rejects_js(t, TypeError, fetch(url, {redirect:'follow'})); > }, 'redirect response with empty Location, follow mode'); > > promise_test(t => { >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-location-escape.tentative.any-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-location-escape.tentative.any-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..bc2b751a38bef301ac3aaf49c1e50f42e6619857 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-location-escape.tentative.any-expected.txt >@@ -0,0 +1,7 @@ >+ >+PASS Redirect to escaped UTF-8 >+PASS Redirect to unescaped UTF-8 >+PASS Redirect to escaped and unescaped UTF-8 >+PASS Escaping produces double-percent >+PASS Redirect to invalid UTF-8 >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-location-escape.tentative.any.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-location-escape.tentative.any.html >new file mode 100644 >index 0000000000000000000000000000000000000000..2382913528e693b3a5d56c660a45060980b548c3 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-location-escape.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/api/redirect/redirect-location-escape.tentative.any.js b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-location-escape.tentative.any.js >new file mode 100644 >index 0000000000000000000000000000000000000000..2975e5fe1a9758e45d4abf7feeceb0b2b58e257d >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-location-escape.tentative.any.js >@@ -0,0 +1,45 @@ >+// META: script=../resources/utils.js >+ >+// See https://github.com/whatwg/fetch/issues/883 for the behavior covered by >+// this test. As of writing, the Fetch spec has not been updated to cover these. >+ >+// redirectLocation tests that a Location header of |locationHeader| is resolved >+// to a URL which ends in |expectedUrlSuffix|. |locationHeader| is interpreted >+// as a byte sequence via isomorphic encode, as described in [INFRA]. This >+// allows the caller to specify byte sequences which are not valid UTF-8. >+// However, this means, e.g., U+2603 must be passed in as "\xe2\x98\x83", its >+// UTF-8 encoding, not "\u2603". >+// >+// [INFRA] https://infra.spec.whatwg.org/#isomorphic-encode >+function redirectLocation( >+ desc, redirectUrl, locationHeader, expectedUrlSuffix) { >+ promise_test(function(test) { >+ // Note we use escape() instead of encodeURIComponent(), so that characters >+ // are escaped as bytes in the isomorphic encoding. >+ var url = redirectUrl + '?simple=1&location=' + escape(locationHeader); >+ >+ return fetch(url, {'redirect': 'follow'}).then(function(resp) { >+ assert_true( >+ resp.url.endsWith(expectedUrlSuffix), >+ resp.url + ' ends with ' + expectedUrlSuffix); >+ }); >+ }, desc); >+} >+ >+var redirUrl = RESOURCES_DIR + 'redirect.py'; >+redirectLocation( >+ 'Redirect to escaped UTF-8', redirUrl, 'top.txt?%E2%98%83%e2%98%83', >+ 'top.txt?%E2%98%83%e2%98%83'); >+redirectLocation( >+ 'Redirect to unescaped UTF-8', redirUrl, 'top.txt?\xe2\x98\x83', >+ 'top.txt?%E2%98%83'); >+redirectLocation( >+ 'Redirect to escaped and unescaped UTF-8', redirUrl, >+ 'top.txt?\xe2\x98\x83%e2%98%83', 'top.txt?%E2%98%83%e2%98%83'); >+redirectLocation( >+ 'Escaping produces double-percent', redirUrl, 'top.txt?%\xe2\x98\x83', >+ 'top.txt?%%E2%98%83'); >+redirectLocation( >+ 'Redirect to invalid UTF-8', redirUrl, 'top.txt?\xff', 'top.txt?%FF'); >+ >+done(); >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-location-escape.tentative.any.worker-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-location-escape.tentative.any.worker-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..bc2b751a38bef301ac3aaf49c1e50f42e6619857 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-location-escape.tentative.any.worker-expected.txt >@@ -0,0 +1,7 @@ >+ >+PASS Redirect to escaped UTF-8 >+PASS Redirect to unescaped UTF-8 >+PASS Redirect to escaped and unescaped UTF-8 >+PASS Escaping produces double-percent >+PASS Redirect to invalid UTF-8 >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-location-escape.tentative.any.worker.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-location-escape.tentative.any.worker.html >new file mode 100644 >index 0000000000000000000000000000000000000000..2382913528e693b3a5d56c660a45060980b548c3 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-location-escape.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/api/redirect/redirect-location.any.js b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-location.any.js >index 27baefc91587d8cc93d03a31ce74f9a8d16314c4..91da26021d09a0254b7e571b9ee112fe1080d60f 100644 >--- 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 >@@ -10,7 +10,7 @@ function redirectLocation(desc, redirectUrl, redirectLocation, redirectStatus, r > > promise_test(function(test) { > if (redirectMode === "error" || !shouldPass) >- return promise_rejects(test, new TypeError(), fetch(url + urlParameters, requestInit)); >+ return promise_rejects_js(test, 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"); >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-method-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-method-expected.txt >deleted file mode 100644 >index ae32d5146630f4ab54bb46487700646d606dd68f..0000000000000000000000000000000000000000 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-method-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.any-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-method.any-expected.txt >index ae32d5146630f4ab54bb46487700646d606dd68f..76391aed1f62e519b0959df4f60f1b47591c3791 100644 >--- 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 >@@ -2,15 +2,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 >+FAIL Redirect 301 with HEAD assert_equals: Request Content-Length after redirection is NO expected "NO" but got "0" > PASS Redirect 302 with GET > PASS Redirect 302 with POST >-PASS Redirect 302 with HEAD >+FAIL Redirect 302 with HEAD assert_equals: Request Content-Length after redirection is NO expected "NO" but got "0" > PASS Redirect 303 with GET > PASS Redirect 303 with POST >-PASS Redirect 303 with HEAD >+FAIL Redirect 303 with HEAD assert_equals: Request Content-Length after redirection is NO expected "NO" but got "0" >+PASS Redirect 303 with TESTING > PASS Redirect 307 with GET > PASS Redirect 307 with POST (string body) > PASS Redirect 307 with POST (blob body) >-PASS Redirect 307 with HEAD >+FAIL Redirect 307 with HEAD assert_equals: Request Content-Length after redirection is NO expected "NO" but got "0" > >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 >index 056ccf847bbeffa21b705739b48d3322b13247fa..b24bb092c603a2f2c6942a9c6b3ab5936a7e1687 100644 >--- 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 >@@ -7,28 +7,70 @@ > // |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|. >+// |opts.expectedRequestContentType|: the expected Content-Type of redirected >+// request. > function redirectMethod(desc, redirectUrl, redirectLocation, redirectStatus, method, expectedMethod, opts) { >- var url = redirectUrl; >- var urlParameters = "?redirect_status=" + redirectStatus; >+ let url = redirectUrl; >+ let urlParameters = "?redirect_status=" + redirectStatus; > urlParameters += "&location=" + encodeURIComponent(redirectLocation); > >- var requestInit = {"method": method, "redirect": "follow"}; >+ let requestHeaders = { >+ "Content-Encoding": "Identity", >+ "Content-Language": "en-US", >+ "Content-Location": "foo", >+ }; >+ let requestInit = {"method": method, "redirect": "follow", "headers" : requestHeaders}; > opts = opts || {}; >- if (opts.body) >+ if (opts.body) { > requestInit.body = opts.body; >+ } > > promise_test(function(test) { > return fetch(url + urlParameters, requestInit).then(function(resp) { >+ let expectedRequestContentType = "NO"; >+ if (opts.expectedRequestContentType) { >+ expectedRequestContentType = opts.expectedRequestContentType; >+ } >+ > 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_equals( >+ resp.headers.get("x-request-method"), >+ expectedMethod, >+ "Request method after redirection is " + expectedMethod); >+ let hasRequestBodyHeader = true; >+ if (opts.expectedStripRequestBodyHeader) { >+ hasRequestBodyHeader = !opts.expectedStripRequestBodyHeader; >+ } >+ assert_equals( >+ resp.headers.get("x-request-content-type"), >+ expectedRequestContentType, >+ "Request Content-Type after redirection is " + expectedRequestContentType); >+ [ >+ "Content-Encoding", >+ "Content-Language", >+ "Content-Location" >+ ].forEach(header => { >+ let xHeader = "x-request-" + header.toLowerCase(); >+ let expectedValue = hasRequestBodyHeader ? requestHeaders[header] : "NO"; >+ assert_equals( >+ resp.headers.get(xHeader), >+ expectedValue, >+ "Request " + header + " after redirection is " + expectedValue); >+ }); > assert_true(resp.redirected); > return resp.text().then(function(text) { > let expectedBody = ""; >- if (expectedMethod == "POST") >+ if (expectedMethod == "POST") { > expectedBody = opts.expectedBodyAsString || requestInit.body; >+ } >+ let expectedContentLength = expectedBody ? expectedBody.length.toString() : "NO"; > assert_equals(text, expectedBody, "request body"); >- }); >+ assert_equals( >+ resp.headers.get("x-request-content-length"), >+ expectedContentLength, >+ "Request Content-Length after redirection is " + expectedContentLength); >+ }); > }); > }, desc); > } >@@ -49,19 +91,20 @@ 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 POST", redirUrl, locationUrl, 301, "POST", "GET", { body: stringBody, expectedStripRequestBodyHeader: true }); > 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 POST", redirUrl, locationUrl, 302, "POST", "GET", { body: stringBody, expectedStripRequestBodyHeader: true }); > 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 POST", redirUrl, locationUrl, 303, "POST", "GET", { body: stringBody, expectedStripRequestBodyHeader: true }); > redirectMethod("Redirect 303 with HEAD", redirUrl, locationUrl, 303, "HEAD", "HEAD"); >+redirectMethod("Redirect 303 with TESTING", redirUrl, locationUrl, 303, "TESTING", "GET", { expectedStripRequestBodyHeader: true }); > > 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 (string body)", redirUrl, locationUrl, 307, "POST", "POST", { body: stringBody , expectedRequestContentType: "text/plain;charset=UTF-8"}); > 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"); > >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 >index ae32d5146630f4ab54bb46487700646d606dd68f..76391aed1f62e519b0959df4f60f1b47591c3791 100644 >--- 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 >@@ -2,15 +2,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 >+FAIL Redirect 301 with HEAD assert_equals: Request Content-Length after redirection is NO expected "NO" but got "0" > PASS Redirect 302 with GET > PASS Redirect 302 with POST >-PASS Redirect 302 with HEAD >+FAIL Redirect 302 with HEAD assert_equals: Request Content-Length after redirection is NO expected "NO" but got "0" > PASS Redirect 303 with GET > PASS Redirect 303 with POST >-PASS Redirect 303 with HEAD >+FAIL Redirect 303 with HEAD assert_equals: Request Content-Length after redirection is NO expected "NO" but got "0" >+PASS Redirect 303 with TESTING > PASS Redirect 307 with GET > PASS Redirect 307 with POST (string body) > PASS Redirect 307 with POST (blob body) >-PASS Redirect 307 with HEAD >+FAIL Redirect 307 with HEAD assert_equals: Request Content-Length after redirection is NO expected "NO" but got "0" > >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 >index e731ed5a91ba6fce817b79b440d9ac532859cff0..eed44e0414cb8947c9b7c21df6ef288f733f8994 100644 >--- 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 >@@ -17,7 +17,7 @@ function testRedirect(origin, redirectStatus, redirectMode, 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)); >+ return promise_rejects_js(test, 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"); >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 >index 2c76b620856b4c5884029e20884e8823f918c966..b88bf2a03de5fd1c2be5e90fb44cc6f321758dde 100644 >--- 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 >@@ -3,20 +3,40 @@ 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[POST] 301 >+PASS Same origin to other origin redirection[POST] 301 >+PASS Other origin to other origin redirection[POST] 301 >+PASS Other origin to same origin redirection[POST] 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[POST] 302 >+PASS Same origin to other origin redirection[POST] 302 >+PASS Other origin to other origin redirection[POST] 302 >+PASS Other origin to same origin redirection[POST] 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[POST] 303 >+PASS Same origin to other origin redirection[POST] 303 >+PASS Other origin to other origin redirection[POST] 303 >+PASS Other origin to same origin redirection[POST] 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[POST] 307 >+PASS Same origin to other origin redirection[POST] 307 >+PASS Other origin to other origin redirection[POST] 307 >+PASS Other origin to same origin redirection[POST] 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 >+PASS Same origin to same origin redirection[POST] 308 >+PASS Same origin to other origin redirection[POST] 308 >+PASS Other origin to other origin redirection[POST] 308 >+PASS Other origin to same origin redirection[POST] 308 > >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 >index 3edb1bd03e891672e0939dfb0b797950d8a9aacb..b81b91601a8e3495a7de547d0c2db55b231e56f7 100644 >--- 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 >@@ -2,7 +2,7 @@ > // META: script=../resources/utils.js > // META: script=/common/get-host-info.sub.js > >-function testOriginAfterRedirection(desc, redirectUrl, redirectLocation, redirectStatus, expectedOrigin) { >+function testOriginAfterRedirection(desc, method, redirectUrl, redirectLocation, redirectStatus, expectedOrigin) { > var uuid_token = token(); > var url = redirectUrl; > var urlParameters = "?token=" + uuid_token + "&max_age=0"; >@@ -28,10 +28,15 @@ var locationUrl = get_host_info().HTTP_ORIGIN + dirname(location.pathname) + RE > 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"); >+ testOriginAfterRedirection("Same origin to same origin redirection " + code, 'GET', redirectUrl, locationUrl, code, null); >+ testOriginAfterRedirection("Same origin to other origin redirection " + code, 'GET', redirectUrl, corsLocationUrl, code, get_host_info().HTTP_ORIGIN); >+ testOriginAfterRedirection("Other origin to other origin redirection " + code, 'GET', corsRedirectUrl, corsLocationUrl, code, get_host_info().HTTP_ORIGIN); >+ testOriginAfterRedirection("Other origin to same origin redirection " + code, 'GET', corsRedirectUrl, locationUrl + "&cors", code, "null"); >+ >+ testOriginAfterRedirection("Same origin to same origin redirection[POST] " + code, 'POST', redirectUrl, locationUrl, code, null); >+ testOriginAfterRedirection("Same origin to other origin redirection[POST] " + code, 'POST', redirectUrl, corsLocationUrl, code, get_host_info().HTTP_ORIGIN); >+ testOriginAfterRedirection("Other origin to other origin redirection[POST] " + code, 'POST', corsRedirectUrl, corsLocationUrl, code, get_host_info().HTTP_ORIGIN); >+ testOriginAfterRedirection("Other origin to same origin redirection[POST] " + code, 'POST', 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 >index 2c76b620856b4c5884029e20884e8823f918c966..b88bf2a03de5fd1c2be5e90fb44cc6f321758dde 100644 >--- 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 >@@ -3,20 +3,40 @@ 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[POST] 301 >+PASS Same origin to other origin redirection[POST] 301 >+PASS Other origin to other origin redirection[POST] 301 >+PASS Other origin to same origin redirection[POST] 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[POST] 302 >+PASS Same origin to other origin redirection[POST] 302 >+PASS Other origin to other origin redirection[POST] 302 >+PASS Other origin to same origin redirection[POST] 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[POST] 303 >+PASS Same origin to other origin redirection[POST] 303 >+PASS Other origin to other origin redirection[POST] 303 >+PASS Other origin to same origin redirection[POST] 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[POST] 307 >+PASS Same origin to other origin redirection[POST] 307 >+PASS Other origin to other origin redirection[POST] 307 >+PASS Other origin to same origin redirection[POST] 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 >+PASS Same origin to same origin redirection[POST] 308 >+PASS Same origin to other origin redirection[POST] 308 >+PASS Other origin to other origin redirection[POST] 308 >+PASS Other origin to same origin redirection[POST] 308 > >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 >index 92f0b9be515b540133aa616d643eb9347e774425..99fda42e69b29ff8bd12b7d987dbe00306059c5c 100644 >--- 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 >@@ -1,3 +1,4 @@ >+// META: timeout=long > // META: script=/common/utils.js > // META: script=../resources/utils.js > // META: script=/common/get-host-info.sub.js >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-schemes.html b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-schemes.html >index cffec19d56a32f4b19eac363bbf48e66d9bcda1e..2aa7bcea6955882fad34f529fc2544c24c560f3e 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-schemes.html >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-schemes.html >@@ -17,7 +17,7 @@ > ]; > tests.forEach(function(url) { > promise_test(function(test) { >- return promise_rejects(test, new TypeError(), fetch(url)) >+ return promise_rejects_js(test, TypeError, fetch(url)) > }) > }) > </script> >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 >index 68ff2c5bcf2d85e6930196b8b1a3a2005ea54094..2f36f0b9d21b223c4f20e9ae2cc1620fb08212f3 100644 >--- 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 >@@ -10,7 +10,7 @@ function redirectDataURL(desc, redirectUrl, mode) { > var requestInit = {"mode": mode}; > > promise_test(function(test) { >- return promise_rejects(test, new TypeError(), fetch(url, requestInit)); >+ return promise_rejects_js(test, TypeError, fetch(url, requestInit)); > }, desc); > } > >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 489d68a96c046c3f2ac9592f4cfe4fbbcf3b1412..3b2917207cdb59bb8229b84e1fbac2f58f41ac3d 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 >@@ -17,6 +17,7 @@ List of files: > /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-escape.tentative.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 >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 >index 742309ab4d238404b3ad66f8160c24fd5d16ef66..47de0da7790618224f70171c12dc8fd04436c0e3 100644 >--- 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 >@@ -2,16 +2,24 @@ > <html> > <meta charset="utf-8"> > <script src="/common/utils.js"></script> >+<script src="/common/get-host-info.sub.js"></script> > <script> >-const uuid = token(); >-const URL = >- `../resources/redirect.py?` + >- `delay=100&` + >- `location=../resources/stash-put.py?key=${uuid}%26value=on`; >+const SEARCH_PARAMS = new URL(location.href).searchParams; >+const ORIGIN1 = SEARCH_PARAMS.get('origin1') || ''; >+const ORIGIN2 = SEARCH_PARAMS.get('origin2') || ''; >+const WITH_HEADERS = !!SEARCH_PARAMS.has('with-headers'); >+const TOKEN = token(); >+ >+const url = >+ `${ORIGIN1}/fetch/api/resources/redirect.py?` + >+ `delay=500&` + >+ `allow_headers=foo&` + >+ `location=${ORIGIN2}/fetch/api/resources/stash-put.py?key=${TOKEN}%26value=on`; > > addEventListener('load', () => { >- let p = fetch(URL, {keepalive: true}); >- window.parent.postMessage(uuid, '*'); >+ const headers = WITH_HEADERS ? {'foo': 'bar'} : undefined; >+ let p = fetch(url, {keepalive: true, headers}); >+ window.parent.postMessage(TOKEN, '*'); > }); > </script> > </html> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/resources/method.py b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/resources/method.py >index db234f9d123fceed16081b6afada3bdda071d3a8..795ad1ff11d085d82cb010b969753b94cbe06b53 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/resources/method.py >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/resources/method.py >@@ -8,4 +8,9 @@ def main(request, response): > headers.append(("Access-Control-Expose-Headers", "x-request-method")) > > headers.append(("x-request-method", request.method)) >+ headers.append(("x-request-content-type", request.headers.get("Content-Type", "NO"))) >+ headers.append(("x-request-content-length", request.headers.get("Content-Length", "NO"))) >+ headers.append(("x-request-content-encoding", request.headers.get("Content-Encoding", "NO"))) >+ headers.append(("x-request-content-language", request.headers.get("Content-Language", "NO"))) >+ headers.append(("x-request-content-location", request.headers.get("Content-Location", "NO"))) > return headers, request.body >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 1843c74c88e200986af1ac0ecf5921456020ffe0..a2552c2565ad9be6d17dea1cb6a90ff9eb211190 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 >@@ -26,6 +26,10 @@ def main(request, response): > response.set_error(400, "No Access-Control-Request-Method header") > return "ERROR: No access-control-request-method in preflight!" > >+ if request.headers.get("Accept", "") != "*/*": >+ response.set_error(400, "Request does not have 'Accept: */*' header") >+ return "ERROR: Invalid access in preflight!" >+ > if "control_request_headers" in request.GET: > stashed_data['control_request_headers'] = request.headers.get("Access-Control-Request-Headers", None) > >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 8e6f9c24b77f7850ea5e8045e8ce276f204f61f4..05129c515ad9433b68a69e43c58059c6c7faa3ba 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 >@@ -1,7 +1,7 @@ >-from urllib import urlencode >-from urlparse import urlparse > import time > >+from six.moves.urllib.parse import urlencode, urlparse >+ > def main(request, response): > stashed_data = {'count': 0, 'preflight': "0"} > status = 302 >@@ -38,16 +38,17 @@ def main(request, response): > > if "location" in request.GET: > url = request.GET['location'] >- scheme = urlparse(url).scheme >- if scheme == "" or scheme == "http" or scheme == "https": >- url += "&" if '?' in url else "?" >- #keep url parameters in location >- url_parameters = {} >- for item in request.GET.items(): >- url_parameters[item[0]] = item[1][0] >- url += urlencode(url_parameters) >- #make sure location changes during redirection loop >- url += "&count=" + str(stashed_data['count']) >+ if "simple" not in request.GET: >+ scheme = urlparse(url).scheme >+ if scheme == "" or scheme == "http" or scheme == "https": >+ url += "&" if '?' in url else "?" >+ #keep url parameters in location >+ url_parameters = {} >+ for item in request.GET.items(): >+ url_parameters[item[0]] = item[1][0] >+ url += urlencode(url_parameters) >+ #make sure location changes during redirection loop >+ url += "&count=" + str(stashed_data['count']) > headers.append(("Location", url)) > > if "redirect_referrerpolicy" in request.GET: >diff --git a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/resources/stash-put.py b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/resources/stash-put.py >index dd84ff1fc852cfc143231f717366c61b12e3c30c..36527b98b71785809cd6a490196dd9112fef9181 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/fetch/api/resources/stash-put.py >+++ b/LayoutTests/imported/w3c/web-platform-tests/fetch/api/resources/stash-put.py >@@ -1,4 +1,11 @@ > def main(request, response): >+ if request.method == 'OPTIONS': >+ # CORS preflight >+ response.headers.set('Access-Control-Allow-Origin', '*') >+ response.headers.set('Access-Control-Allow-Methods', '*') >+ response.headers.set('Access-Control-Allow-Headers', '*') >+ return 'done' >+ > url_dir = '/'.join(request.url_parts.path.split('/')[:-1]) + '/' > key = request.GET.first("key") > value = request.GET.first("value") >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 e2c9beec1e077c67b0d83202ba644c018cbace94..57c9407dc4b2db368b87930163efd6f36b49e849 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 >@@ -1,5 +1,7 @@ > import time > >+from six.moves import xrange >+ > def main(request, response): > delay = float(request.GET.first("ms", 500)) / 1E3 > count = int(request.GET.first("count", 50)) >diff --git a/LayoutTests/platform/gtk/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-method-expected.txt b/LayoutTests/platform/gtk/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-method-expected.txt >deleted file mode 100644 >index 1ad21fa00eaaae5d300591aa36469b86aae90f65..0000000000000000000000000000000000000000 >--- a/LayoutTests/platform/gtk/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-method-expected.txt >+++ /dev/null >@@ -1,15 +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 >-PASS Redirect 307 with HEAD >- >diff --git a/LayoutTests/platform/gtk/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-method-worker-expected.txt b/LayoutTests/platform/gtk/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-method-worker-expected.txt >deleted file mode 100644 >index 1ad21fa00eaaae5d300591aa36469b86aae90f65..0000000000000000000000000000000000000000 >--- a/LayoutTests/platform/gtk/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-method-worker-expected.txt >+++ /dev/null >@@ -1,15 +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 >-PASS Redirect 307 with HEAD >- >diff --git a/LayoutTests/platform/gtk/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-method.any-expected.txt b/LayoutTests/platform/gtk/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-method.any-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..2efc793218454ebcec6a3021d6ad9c695a8a9d47 >--- /dev/null >+++ b/LayoutTests/platform/gtk/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-method.any-expected.txt >@@ -0,0 +1,17 @@ >+ >+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 303 with TESTING >+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/platform/gtk/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-method.any.worker-expected.txt b/LayoutTests/platform/gtk/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-method.any.worker-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..2efc793218454ebcec6a3021d6ad9c695a8a9d47 >--- /dev/null >+++ b/LayoutTests/platform/gtk/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-method.any.worker-expected.txt >@@ -0,0 +1,17 @@ >+ >+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 303 with TESTING >+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/platform/mac-mojave/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-method.any-expected.txt b/LayoutTests/platform/mac-mojave/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-method.any-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..19784922f9240be0c5420cb906899e613ca59278 >--- /dev/null >+++ b/LayoutTests/platform/mac-mojave/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-method.any-expected.txt >@@ -0,0 +1,17 @@ >+ >+PASS Response.redirected should be false on not-redirected responses >+PASS Redirect 301 with GET >+PASS Redirect 301 with POST >+FAIL Redirect 301 with HEAD assert_equals: Request Content-Length after redirection is NO expected "NO" but got "0" >+PASS Redirect 302 with GET >+PASS Redirect 302 with POST >+FAIL Redirect 302 with HEAD assert_equals: Request Content-Length after redirection is NO expected "NO" but got "0" >+PASS Redirect 303 with GET >+PASS Redirect 303 with POST >+FAIL Redirect 303 with HEAD assert_equals: Request Content-Length after redirection is NO expected "NO" but got "0" >+PASS Redirect 303 with TESTING >+PASS Redirect 307 with GET >+PASS Redirect 307 with POST (string body) >+FAIL Redirect 307 with POST (blob body) assert_equals: Request Content-Type after redirection is NO expected "NO" but got "application/x-www-form-urlencoded" >+FAIL Redirect 307 with HEAD assert_equals: Request Content-Length after redirection is NO expected "NO" but got "0" >+ >diff --git a/LayoutTests/platform/mac-mojave/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-method.any.worker-expected.txt b/LayoutTests/platform/mac-mojave/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-method.any.worker-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..19784922f9240be0c5420cb906899e613ca59278 >--- /dev/null >+++ b/LayoutTests/platform/mac-mojave/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-method.any.worker-expected.txt >@@ -0,0 +1,17 @@ >+ >+PASS Response.redirected should be false on not-redirected responses >+PASS Redirect 301 with GET >+PASS Redirect 301 with POST >+FAIL Redirect 301 with HEAD assert_equals: Request Content-Length after redirection is NO expected "NO" but got "0" >+PASS Redirect 302 with GET >+PASS Redirect 302 with POST >+FAIL Redirect 302 with HEAD assert_equals: Request Content-Length after redirection is NO expected "NO" but got "0" >+PASS Redirect 303 with GET >+PASS Redirect 303 with POST >+FAIL Redirect 303 with HEAD assert_equals: Request Content-Length after redirection is NO expected "NO" but got "0" >+PASS Redirect 303 with TESTING >+PASS Redirect 307 with GET >+PASS Redirect 307 with POST (string body) >+FAIL Redirect 307 with POST (blob body) assert_equals: Request Content-Type after redirection is NO expected "NO" but got "application/x-www-form-urlencoded" >+FAIL Redirect 307 with HEAD assert_equals: Request Content-Length after redirection is NO expected "NO" but got "0" >+ >diff --git a/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-method.any-expected.txt b/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-method.any-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..19784922f9240be0c5420cb906899e613ca59278 >--- /dev/null >+++ b/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-method.any-expected.txt >@@ -0,0 +1,17 @@ >+ >+PASS Response.redirected should be false on not-redirected responses >+PASS Redirect 301 with GET >+PASS Redirect 301 with POST >+FAIL Redirect 301 with HEAD assert_equals: Request Content-Length after redirection is NO expected "NO" but got "0" >+PASS Redirect 302 with GET >+PASS Redirect 302 with POST >+FAIL Redirect 302 with HEAD assert_equals: Request Content-Length after redirection is NO expected "NO" but got "0" >+PASS Redirect 303 with GET >+PASS Redirect 303 with POST >+FAIL Redirect 303 with HEAD assert_equals: Request Content-Length after redirection is NO expected "NO" but got "0" >+PASS Redirect 303 with TESTING >+PASS Redirect 307 with GET >+PASS Redirect 307 with POST (string body) >+FAIL Redirect 307 with POST (blob body) assert_equals: Request Content-Type after redirection is NO expected "NO" but got "application/x-www-form-urlencoded" >+FAIL Redirect 307 with HEAD assert_equals: Request Content-Length after redirection is NO expected "NO" but got "0" >+ >diff --git a/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-method.any.worker-expected.txt b/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-method.any.worker-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..19784922f9240be0c5420cb906899e613ca59278 >--- /dev/null >+++ b/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-method.any.worker-expected.txt >@@ -0,0 +1,17 @@ >+ >+PASS Response.redirected should be false on not-redirected responses >+PASS Redirect 301 with GET >+PASS Redirect 301 with POST >+FAIL Redirect 301 with HEAD assert_equals: Request Content-Length after redirection is NO expected "NO" but got "0" >+PASS Redirect 302 with GET >+PASS Redirect 302 with POST >+FAIL Redirect 302 with HEAD assert_equals: Request Content-Length after redirection is NO expected "NO" but got "0" >+PASS Redirect 303 with GET >+PASS Redirect 303 with POST >+FAIL Redirect 303 with HEAD assert_equals: Request Content-Length after redirection is NO expected "NO" but got "0" >+PASS Redirect 303 with TESTING >+PASS Redirect 307 with GET >+PASS Redirect 307 with POST (string body) >+FAIL Redirect 307 with POST (blob body) assert_equals: Request Content-Type after redirection is NO expected "NO" but got "application/x-www-form-urlencoded" >+FAIL Redirect 307 with HEAD assert_equals: Request Content-Length after redirection is NO expected "NO" but got "0" >+ >diff --git a/LayoutTests/platform/mac/TestExpectations b/LayoutTests/platform/mac/TestExpectations >index 3d31681e88a63ef72003af5cdb0830afe6bd4633..96067a4d5d964e1019dee5769a65e24323e05f02 100644 >--- a/LayoutTests/platform/mac/TestExpectations >+++ b/LayoutTests/platform/mac/TestExpectations >@@ -366,10 +366,6 @@ editing/pasteboard/paste-TIFF.html [ Skip ] > editing/mac/pasteboard/dataTransfer-set-data-file-url.html [ Skip ] > webkit.org/b/147674 editing/mac/pasteboard/5583362.html [ Skip ] > >-# Assorted failures that need investigation >-[ Debug ] imported/w3c/web-platform-tests/fetch/api/redirect/redirect-method.any.worker.html [ Skip ] >-[ Debug ] imported/w3c/web-platform-tests/fetch/api/redirect/redirect-method.any.html [ Skip ] >- > webkit.org/b/107118 fast/canvas/canvas-quadratic-same-endpoint.html [ Failure ] > webkit.org/b/142258 fast/css/object-fit/object-fit-canvas.html [ Pass ImageOnlyFailure ] > >diff --git a/LayoutTests/platform/wpe/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-method-expected.txt b/LayoutTests/platform/wpe/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-method-expected.txt >deleted file mode 100644 >index abc70736271ce86be39b069455cb58193cc1d66e..0000000000000000000000000000000000000000 >--- a/LayoutTests/platform/wpe/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-method-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) >-FAIL Redirect 307 with POST (blob body) assert_equals: request body expected "it's me the blob! and more blob!" but got "" >-PASS Redirect 307 with HEAD >- >diff --git a/LayoutTests/platform/wpe/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-method-worker-expected.txt b/LayoutTests/platform/wpe/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-method-worker-expected.txt >deleted file mode 100644 >index abc70736271ce86be39b069455cb58193cc1d66e..0000000000000000000000000000000000000000 >--- a/LayoutTests/platform/wpe/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) >-FAIL Redirect 307 with POST (blob body) assert_equals: request body expected "it's me the blob! and more blob!" but got "" >-PASS Redirect 307 with HEAD >- >diff --git a/LayoutTests/platform/wpe/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-method.any-expected.txt b/LayoutTests/platform/wpe/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-method.any-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..2efc793218454ebcec6a3021d6ad9c695a8a9d47 >--- /dev/null >+++ b/LayoutTests/platform/wpe/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-method.any-expected.txt >@@ -0,0 +1,17 @@ >+ >+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 303 with TESTING >+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/platform/wpe/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-method.any.worker-expected.txt b/LayoutTests/platform/wpe/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-method.any.worker-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..2efc793218454ebcec6a3021d6ad9c695a8a9d47 >--- /dev/null >+++ b/LayoutTests/platform/wpe/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-method.any.worker-expected.txt >@@ -0,0 +1,17 @@ >+ >+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 303 with TESTING >+PASS Redirect 307 with GET >+PASS Redirect 307 with POST (string body) >+PASS Redirect 307 with POST (blob body) >+PASS Redirect 307 with HEAD >+
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 205119
:
399493
|
399505
|
399558
|
399561
|
399562
|
399565
|
399570
|
399626
|
399636
|
399637
|
399641
|
399648