diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:32:43 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:32:43 +0000 |
commit | 6bf0a5cb5034a7e684dcc3500e841785237ce2dd (patch) | |
tree | a68f146d7fa01f0134297619fbe7e33db084e0aa /testing/web-platform/tests/xhr/send-blob-with-no-mime-type.html | |
parent | Initial commit. (diff) | |
download | thunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.tar.xz thunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.zip |
Adding upstream version 1:115.7.0.upstream/1%115.7.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/xhr/send-blob-with-no-mime-type.html')
-rw-r--r-- | testing/web-platform/tests/xhr/send-blob-with-no-mime-type.html | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/testing/web-platform/tests/xhr/send-blob-with-no-mime-type.html b/testing/web-platform/tests/xhr/send-blob-with-no-mime-type.html new file mode 100644 index 0000000000..e7ab989fdc --- /dev/null +++ b/testing/web-platform/tests/xhr/send-blob-with-no-mime-type.html @@ -0,0 +1,61 @@ +<!DOCTYPE html> +<html> +<head> + <link rel="help" href="https://xhr.spec.whatwg.org/#the-send()-method" data-tested-assertations="following::ol[1]/li[4] following::ol[1]/li[4]/dl[1]/dd[2]/p[3]"/> + <link rel="help" href="https://xhr.spec.whatwg.org/#the-status-attribute" data-tested-assertations="following::ol[1]/li[3]"/> + <link rel="help" href="https://xhr.spec.whatwg.org/#the-responsetype-attribute" data-tested-assertations="following::ol[1]/li[4]"/> + <link rel="help" href="https://xhr.spec.whatwg.org/#the-response-attribute" data-tested-assertations="following::a[contains(@href,'#blob-response-entity-body')]/.."/> + + <script src="/resources/testharness.js"></script> + <script src="/resources/testharnessreport.js"></script> + <title>XMLHttpRequest: The send() method: Blob data with no mime type</title> +</head> + +<body> + <div id="log"></div> + + <script type="text/javascript"> + var blobTests = [ + ["no mime type", new Blob(["data"])], + ["invalid mime type", new Blob(["data"], {type: "Invalid \r\n mime \r\n type"})] + ]; + + function doSyncTest(testItem, method) { + test(function() { + var xhr = new XMLHttpRequest(); + xhr.open(method, "./resources/content.py", false); + xhr.send(testItem[1]); + + assert_equals(xhr.getResponseHeader("X-Request-Content-Length"), "4"); + assert_equals(xhr.getResponseHeader("X-Request-Content-Type"), "NO"); + }, "Synchronous blob loading with " + testItem[0] + " [" + method + "]"); + } + + function doAsyncTest(testItem, method) { + var atest = async_test("Asynchronous blob loading with " + testItem[0] + " [" + method + "]"); + atest.step(function() { + var xhr = new XMLHttpRequest(); + xhr.onreadystatechange = function() { + if (xhr.readyState == 4) { + atest.step(function() { + assert_equals(xhr.getResponseHeader("X-Request-Content-Length"), "4"); + assert_equals(xhr.getResponseHeader("X-Request-Content-Type"), "NO"); + }); + atest.done(); + } + } + xhr.open(method, "./resources/content.py", true); + xhr.send(testItem[1]); + }); + } + + blobTests.forEach(function(item){ + doSyncTest(item, "POST"); + doAsyncTest(item, "POST"); + + doSyncTest(item, "PUT"); + doAsyncTest(item, "PUT"); + }); + </script> +</body> +</html> |