Diff
Modified: trunk/LayoutTests/http/wpt/beacon/keepalive-after-navigation.html (270031 => 270032)
--- trunk/LayoutTests/http/wpt/beacon/keepalive-after-navigation.html 2020-11-19 16:04:56 UTC (rev 270031)
+++ trunk/LayoutTests/http/wpt/beacon/keepalive-after-navigation.html 2020-11-19 16:34:39 UTC (rev 270032)
@@ -13,7 +13,7 @@
const RESOURCES_DIR = "/beacon/resources/";
function pollResult(test, id) {
- var checkUrl = RESOURCES_DIR + "content-type.py?cmd=get&id=" + id;
+ var checkUrl = RESOURCES_DIR + "content-type-and-body.py?cmd=get&id=" + id;
return new Promise(resolve => {
step_timeout(test.step_func(() => {
@@ -33,7 +33,7 @@
testFrame.remove();
return pollResult(test, id).then(result => {
- assert_equals(result, "text/plain;charset=UTF-8", "Correct content-type header result");
+ assert_equals(result, "text/plain;charset=UTF-8: test", "Correct content-type header result");
});
}, "Test that beacon sent from unload event handler is properly received");
}
Modified: trunk/LayoutTests/http/wpt/beacon/sendBeacon-in-pagehide.html (270031 => 270032)
--- trunk/LayoutTests/http/wpt/beacon/sendBeacon-in-pagehide.html 2020-11-19 16:04:56 UTC (rev 270031)
+++ trunk/LayoutTests/http/wpt/beacon/sendBeacon-in-pagehide.html 2020-11-19 16:34:39 UTC (rev 270032)
@@ -13,7 +13,7 @@
const RESOURCES_DIR = "/beacon/resources/";
function pollResult(test, id) {
- var checkUrl = RESOURCES_DIR + "content-type.py?cmd=get&id=" + id;
+ var checkUrl = RESOURCES_DIR + "content-type-and-body.py?cmd=get&id=" + id;
return new Promise(resolve => {
step_timeout(test.step_func(() => {
@@ -36,7 +36,7 @@
}, 0);
return pollResult(test, id).then(result => {
- assert_equals(result, "text/plain;charset=UTF-8", "Correct content-type header result");
+ assert_equals(result, "text/plain;charset=UTF-8: test", "Correct content-type header result");
});
}, "Test that beacon sent from pagehide event handler is properly received");
}
Modified: trunk/LayoutTests/http/wpt/beacon/support/sendBeacon-onpagehide-window.html (270031 => 270032)
--- trunk/LayoutTests/http/wpt/beacon/support/sendBeacon-onpagehide-window.html 2020-11-19 16:04:56 UTC (rev 270031)
+++ trunk/LayoutTests/http/wpt/beacon/support/sendBeacon-onpagehide-window.html 2020-11-19 16:34:39 UTC (rev 270032)
@@ -12,7 +12,7 @@
<body>
<script>
_onpagehide_ = function() {
- const testUrl = RESOURCES_DIR + "content-type.py?cmd=put&id=" + id;
+ const testUrl = RESOURCES_DIR + "content-type-and-body.py?cmd=put&id=" + id;
navigator.sendBeacon(testUrl, "test");
}
</script>
Modified: trunk/LayoutTests/http/wpt/beacon/support/sendBeacon-onunload-iframe.html (270031 => 270032)
--- trunk/LayoutTests/http/wpt/beacon/support/sendBeacon-onunload-iframe.html 2020-11-19 16:04:56 UTC (rev 270031)
+++ trunk/LayoutTests/http/wpt/beacon/support/sendBeacon-onunload-iframe.html 2020-11-19 16:34:39 UTC (rev 270032)
@@ -9,7 +9,7 @@
var id = self.token();
function unload() {
- var testUrl = RESOURCES_DIR + "content-type.py?cmd=put&id=" + id;
+ var testUrl = RESOURCES_DIR + "content-type-and-body.py?cmd=put&id=" + id;
navigator.sendBeacon(testUrl, "test");
}
</script>
Modified: trunk/LayoutTests/http/wpt/fetch/fetch-in-pagehide.html (270031 => 270032)
--- trunk/LayoutTests/http/wpt/fetch/fetch-in-pagehide.html 2020-11-19 16:04:56 UTC (rev 270031)
+++ trunk/LayoutTests/http/wpt/fetch/fetch-in-pagehide.html 2020-11-19 16:34:39 UTC (rev 270032)
@@ -14,7 +14,7 @@
function checkUrl(id)
{
- return RESOURCES_DIR + "content-type.py?cmd=get&id=" + id;
+ return RESOURCES_DIR + "content-type-and-body.py?cmd=get&id=" + id;
}
promise_test(async (test) => {
@@ -31,7 +31,7 @@
const response = await fetch(checkUrl(id));
assert_equals(response.status, 200);
const result = await response.text();
- assert_equals(result, "text/plain;charset=UTF-8", "Correct content-type header result");
+ assert_equals(result, "text/plain;charset=UTF-8: test", "Correct content-type header result");
}, "Test that fetch sent from pagehide event handler is properly received with keepalive");
promise_test(async (test) => {
Modified: trunk/LayoutTests/http/wpt/fetch/resources/fetch-in-pagehide-window.html (270031 => 270032)
--- trunk/LayoutTests/http/wpt/fetch/resources/fetch-in-pagehide-window.html 2020-11-19 16:04:56 UTC (rev 270031)
+++ trunk/LayoutTests/http/wpt/fetch/resources/fetch-in-pagehide-window.html 2020-11-19 16:34:39 UTC (rev 270032)
@@ -12,7 +12,7 @@
<body>
<script>
_onpagehide_ = function() {
- const testUrl = RESOURCES_DIR + "content-type.py?cmd=put&id=" + id;
+ const testUrl = RESOURCES_DIR + "content-type-and-body.py?cmd=put&id=" + id;
fetch(testUrl, { method : 'POST', headers : [["Content-Type", "text/plain;charset=UTF-8"]], body: 'test', keepalive : location.hash === "#keepalive" });
}
</script>
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (270031 => 270032)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2020-11-19 16:04:56 UTC (rev 270031)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2020-11-19 16:34:39 UTC (rev 270032)
@@ -1,3 +1,19 @@
+2020-11-19 Chris Dumez <[email protected]>
+
+ Resync web-platform-tests/beacon tests from upstream
+ https://bugs.webkit.org/show_bug.cgi?id=219123
+
+ Reviewed by Sam Weinig.
+
+ Resync web-platform-tests/beacon tests from upstream dd35c2b21b76772123f7.
+
+ * web-platform-tests/beacon/headers/header-content-type-and-body-expected.txt: Renamed from LayoutTests/imported/w3c/web-platform-tests/beacon/headers/header-content-type-expected.txt.
+ * web-platform-tests/beacon/headers/header-content-type-and-body.html: Renamed from LayoutTests/imported/w3c/web-platform-tests/beacon/headers/header-content-type.html.
+ * web-platform-tests/beacon/headers/w3c-import.log:
+ * web-platform-tests/beacon/resources/content-type-and-body.py: Renamed from LayoutTests/imported/w3c/web-platform-tests/beacon/resources/content-type.py.
+ (main):
+ * web-platform-tests/beacon/resources/w3c-import.log:
+
2020-11-19 Commit Queue <[email protected]>
Unreviewed, reverting r270009.
Copied: trunk/LayoutTests/imported/w3c/web-platform-tests/beacon/headers/header-content-type-and-body-expected.txt (from rev 270031, trunk/LayoutTests/imported/w3c/web-platform-tests/beacon/headers/header-content-type-expected.txt) (0 => 270032)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/beacon/headers/header-content-type-and-body-expected.txt (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/beacon/headers/header-content-type-and-body-expected.txt 2020-11-19 16:34:39 UTC (rev 270032)
@@ -0,0 +1,8 @@
+
+PASS Test content-type header for a body string
+PASS Test content-type header for a body ArrayBufferView
+PASS Test content-type header for a body ArrayBuffer
+PASS Test content-type header for a body Blob
+PASS Test content-type header for a body FormData
+PASS Test content-type header for a body URLSearchParams
+
Copied: trunk/LayoutTests/imported/w3c/web-platform-tests/beacon/headers/header-content-type-and-body.html (from rev 270031, trunk/LayoutTests/imported/w3c/web-platform-tests/beacon/headers/header-content-type.html) (0 => 270032)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/beacon/headers/header-content-type-and-body.html (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/beacon/headers/header-content-type-and-body.html 2020-11-19 16:34:39 UTC (rev 270032)
@@ -0,0 +1,89 @@
+<!doctype html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>SendBeacon Content-Type header</title>
+ <script src=""
+ <script src=""
+ </head>
+ <body>
+ <script src=""
+ <script src=""
+ <script>
+const RESOURCES_DIR = "/beacon/resources/";
+
+function testContentTypeAndBody(what, expected, title) {
+ function wait(ms) {
+ return new Promise(resolve => step_timeout(resolve, ms));
+ }
+ promise_test(async t => {
+ const id = self.token();
+ const testUrl = new Request(RESOURCES_DIR + "content-type-and-body.py?cmd=put&id=" + id).url;
+ assert_equals(performance.getEntriesByName(testUrl).length, 0);
+ assert_true(navigator.sendBeacon(testUrl, what), "SendBeacon Succeeded");
+
+ do {
+ await wait(50);
+ } while (performance.getEntriesByName(testUrl).length === 0);
+ assert_equals(performance.getEntriesByName(testUrl).length, 1);
+ const checkUrl = RESOURCES_DIR + "content-type-and-body.py?cmd=get&id=" + id;
+ const response = await fetch(checkUrl);
+ const text = await response.text();
+ if (expected.startsWith("multipart/form-data")) {
+ const split = expected.split(":");
+ const contentType = split[0];
+ const contentDisposition = "Content-Disposition: form-data; name=\"" + split[1] + "\"; filename=\"blob\"";
+ assert_true(text.startsWith(contentType), "Correct Content-Type header result");
+ assert_true(text.includes(contentDisposition), "Body included value");
+ } else {
+ assert_equals(text, expected, "Correct Content-Type header result");
+ }
+ }, "Test content-type header for a body " + title);
+}
+
+function stringToArrayBufferView(input) {
+ var buffer = new ArrayBuffer(input.length * 2);
+ var view = new Uint16Array(buffer);
+
+ // dumbly copy over the bytes
+ for (var i = 0, len = input.length; i < len; i++) {
+ view[i] = input.charCodeAt(i);
+ }
+ return view;
+}
+
+function stringToArrayBuffer(input) {
+ var buffer = new ArrayBuffer(input.length * 2);
+ var view = new Uint16Array(buffer);
+
+ // dumbly copy over the bytes
+ for (var i = 0, len = input.length; i < len; i++) {
+ view[i] = input.charCodeAt(i);
+ }
+ return buffer;
+}
+
+function stringToBlob(input) {
+ return new Blob([input], {type: "text/plain"});
+}
+
+function stringToFormData(input) {
+ var formdata = new FormData();
+ formdata.append(input, new Blob(['hi']));
+ return formdata;
+}
+
+function stringToURLSearchParams(input)
+{
+ return new URLSearchParams(input);
+}
+
+testContentTypeAndBody("hi!", "text/plain;charset=UTF-8: hi!", "string");
+testContentTypeAndBody(stringToArrayBufferView("123"), ": 1\0" + "2\0" + "3\0", "ArrayBufferView");
+testContentTypeAndBody(stringToArrayBuffer("123"), ": 1\0" + "2\0" + "3\0", "ArrayBuffer");
+testContentTypeAndBody(stringToBlob("123"), "text/plain: 123", "Blob");
+testContentTypeAndBody(stringToFormData("qwerty"), "multipart/form-data:qwerty", "FormData");
+testContentTypeAndBody(stringToURLSearchParams("key1=value1&key2=value2"), "application/x-www-form-urlencoded;charset=UTF-8: key1=value1&key2=value2", "URLSearchParams");
+ </script>
+ </body>
+</html>
Deleted: trunk/LayoutTests/imported/w3c/web-platform-tests/beacon/headers/header-content-type-expected.txt (270031 => 270032)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/beacon/headers/header-content-type-expected.txt 2020-11-19 16:04:56 UTC (rev 270031)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/beacon/headers/header-content-type-expected.txt 2020-11-19 16:34:39 UTC (rev 270032)
@@ -1,8 +0,0 @@
-
-PASS Test content-type header for a body string
-PASS Test content-type header for a body ArrayBufferView
-PASS Test content-type header for a body ArrayBuffer
-PASS Test content-type header for a body Blob
-PASS Test content-type header for a body FormData
-PASS Test content-type header for a body URLSearchParams
-
Deleted: trunk/LayoutTests/imported/w3c/web-platform-tests/beacon/headers/header-content-type.html (270031 => 270032)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/beacon/headers/header-content-type.html 2020-11-19 16:04:56 UTC (rev 270031)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/beacon/headers/header-content-type.html 2020-11-19 16:34:39 UTC (rev 270032)
@@ -1,85 +0,0 @@
-<!doctype html>
-<html>
- <head>
- <meta charset="utf-8">
- <title>SendBeacon Content-Type header</title>
- <script src=""
- <script src=""
- </head>
- <body>
- <script src=""
- <script src=""
- <script>
-const RESOURCES_DIR = "/beacon/resources/";
-
-function testContentTypeHeader(what, contentType, title) {
- function wait(ms) {
- return new Promise(resolve => step_timeout(resolve, ms));
- }
- promise_test(async t => {
- const id = self.token();
- const testUrl = new Request(RESOURCES_DIR + "content-type.py?cmd=put&id=" + id).url;
- assert_equals(performance.getEntriesByName(testUrl).length, 0);
- assert_true(navigator.sendBeacon(testUrl, what), "SendBeacon Succeeded");
-
- do {
- await wait(50);
- } while (performance.getEntriesByName(testUrl).length === 0);
- assert_equals(performance.getEntriesByName(testUrl).length, 1);
- const checkUrl = RESOURCES_DIR + "content-type.py?cmd=get&id=" + id;
- const response = await fetch(checkUrl);
- const text = await response.text();
- if (contentType === "multipart/form-data") {
- assert_true(text.startsWith(contentType), "Correct Content-Type header result");
- } else {
- assert_equals(text, contentType, "Correct Content-Type header result");
- }
- }, "Test content-type header for a body " + title);
-}
-
-function stringToArrayBufferView(input) {
- var buffer = new ArrayBuffer(input.length * 2);
- var view = new Uint16Array(buffer);
-
- // dumbly copy over the bytes
- for (var i = 0, len = input.length; i < len; i++) {
- view[i] = input.charCodeAt(i);
- }
- return view;
-}
-
-function stringToArrayBuffer(input) {
- var buffer = new ArrayBuffer(input.length * 2);
- var view = new Uint16Array(buffer);
-
- // dumbly copy over the bytes
- for (var i = 0, len = input.length; i < len; i++) {
- view[i] = input.charCodeAt(i);
- }
- return buffer;
-}
-
-function stringToBlob(input) {
- return new Blob([input], {type: "text/plain"});
-}
-
-function stringToFormData(input) {
- var formdata = new FormData();
- formdata.append(input, new Blob(['hi']));
- return formdata;
-}
-
-function stringToURLSearchParams(input)
-{
- return new URLSearchParams(input);
-}
-
-testContentTypeHeader("hi!", "text/plain;charset=UTF-8", "string");
-testContentTypeHeader(stringToArrayBufferView("123"), "", "ArrayBufferView");
-testContentTypeHeader(stringToArrayBuffer("123"), "", "ArrayBuffer");
-testContentTypeHeader(stringToBlob("123"), "text/plain", "Blob");
-testContentTypeHeader(stringToFormData("qwerty"), "multipart/form-data", "FormData");
-testContentTypeHeader(stringToURLSearchParams("key1=value1&key2=value2"), "application/x-www-form-urlencoded;charset=UTF-8", "URLSearchParams");
- </script>
- </body>
-</html>
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/beacon/headers/w3c-import.log (270031 => 270032)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/beacon/headers/w3c-import.log 2020-11-19 16:04:56 UTC (rev 270031)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/beacon/headers/w3c-import.log 2020-11-19 16:34:39 UTC (rev 270032)
@@ -14,7 +14,7 @@
None
------------------------------------------------------------------------
List of files:
-/LayoutTests/imported/w3c/web-platform-tests/beacon/headers/header-content-type.html
+/LayoutTests/imported/w3c/web-platform-tests/beacon/headers/header-content-type-and-body.html
/LayoutTests/imported/w3c/web-platform-tests/beacon/headers/header-referrer-no-referrer-when-downgrade.https.html
/LayoutTests/imported/w3c/web-platform-tests/beacon/headers/header-referrer-no-referrer.html
/LayoutTests/imported/w3c/web-platform-tests/beacon/headers/header-referrer-origin-when-cross-origin.html
Copied: trunk/LayoutTests/imported/w3c/web-platform-tests/beacon/resources/content-type-and-body.py (from rev 270031, trunk/LayoutTests/imported/w3c/web-platform-tests/beacon/resources/content-type.py) (0 => 270032)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/beacon/resources/content-type-and-body.py (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/beacon/resources/content-type-and-body.py 2020-11-19 16:34:39 UTC (rev 270032)
@@ -0,0 +1,14 @@
+def main(request, response):
+ command = request.GET.first(b"cmd").lower()
+ test_id = request.GET.first(b"id")
+ if command == b"put":
+ request.server.stash.put(test_id, request.headers.get(b"Content-Type", b"") + b": " + request.body)
+ return [(b"Content-Type", b"text/plain")], u""
+
+ if command == b"get":
+ stashed_header = request.server.stash.take(test_id)
+ if stashed_header is not None:
+ return [(b"Content-Type", b"text/plain")], stashed_header
+
+ response.set_error(400, u"Bad Command")
+ return u"ERROR: Bad Command!"
Deleted: trunk/LayoutTests/imported/w3c/web-platform-tests/beacon/resources/content-type.py (270031 => 270032)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/beacon/resources/content-type.py 2020-11-19 16:04:56 UTC (rev 270031)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/beacon/resources/content-type.py 2020-11-19 16:34:39 UTC (rev 270032)
@@ -1,14 +0,0 @@
-def main(request, response):
- command = request.GET.first(b"cmd").lower()
- test_id = request.GET.first(b"id")
- if command == b"put":
- request.server.stash.put(test_id, request.headers.get(b"Content-Type", b""))
- return [(b"Content-Type", b"text/plain")], u""
-
- if command == b"get":
- stashed_header = request.server.stash.take(test_id)
- if stashed_header is not None:
- return [(b"Content-Type", b"text/plain")], stashed_header
-
- response.set_error(400, u"Bad Command")
- return u"ERROR: Bad Command!"
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/beacon/resources/w3c-import.log (270031 => 270032)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/beacon/resources/w3c-import.log 2020-11-19 16:04:56 UTC (rev 270031)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/beacon/resources/w3c-import.log 2020-11-19 16:34:39 UTC (rev 270032)
@@ -15,5 +15,5 @@
------------------------------------------------------------------------
List of files:
/LayoutTests/imported/w3c/web-platform-tests/beacon/resources/beacon.py
-/LayoutTests/imported/w3c/web-platform-tests/beacon/resources/content-type.py
+/LayoutTests/imported/w3c/web-platform-tests/beacon/resources/content-type-and-body.py
/LayoutTests/imported/w3c/web-platform-tests/beacon/resources/inspect-header.py