mirror of
https://github.com/servo/servo.git
synced 2025-09-30 16:49:16 +01:00
Add Content Range Header and add one for blob end range (#34797)
Signed-off-by: rayguo17 <rayguo17@gmail.com>
This commit is contained in:
parent
faf30176f1
commit
55ac1887dc
6 changed files with 75 additions and 95 deletions
24
tests/wpt/meta/fetch/range/blob.any.js.ini
vendored
24
tests/wpt/meta/fetch/range/blob.any.js.ini
vendored
|
@ -1,18 +1,18 @@
|
|||
[blob.any.html]
|
||||
[A simple blob range request.]
|
||||
expected: FAIL
|
||||
expected: PASS
|
||||
|
||||
[A blob range request with no end.]
|
||||
expected: FAIL
|
||||
expected: PASS
|
||||
|
||||
[A blob range request with no start.]
|
||||
expected: FAIL
|
||||
expected: PASS
|
||||
|
||||
[A simple blob range request with whitespace.]
|
||||
expected: FAIL
|
||||
expected: PASS
|
||||
|
||||
[Blob content with short content and a large range end]
|
||||
expected: FAIL
|
||||
expected: PASS
|
||||
|
||||
[Blob range with whitespace before and after hyphen]
|
||||
expected: FAIL
|
||||
|
@ -60,7 +60,7 @@
|
|||
expected: FAIL
|
||||
|
||||
[Blob content with short content and a range end matching content length]
|
||||
expected: FAIL
|
||||
expected: PASS
|
||||
|
||||
[Blob range with no value]
|
||||
expected: FAIL
|
||||
|
@ -83,19 +83,19 @@
|
|||
|
||||
[blob.any.worker.html]
|
||||
[A simple blob range request.]
|
||||
expected: FAIL
|
||||
expected: PASS
|
||||
|
||||
[A blob range request with no end.]
|
||||
expected: FAIL
|
||||
expected: PASS
|
||||
|
||||
[A blob range request with no start.]
|
||||
expected: FAIL
|
||||
expected: PASS
|
||||
|
||||
[A simple blob range request with whitespace.]
|
||||
expected: FAIL
|
||||
expected: PASS
|
||||
|
||||
[Blob content with short content and a large range end]
|
||||
expected: FAIL
|
||||
expected: PASS
|
||||
|
||||
[Blob range with whitespace before and after hyphen]
|
||||
expected: FAIL
|
||||
|
@ -143,7 +143,7 @@
|
|||
expected: FAIL
|
||||
|
||||
[Blob content with short content and a range end matching content length]
|
||||
expected: FAIL
|
||||
expected: PASS
|
||||
|
||||
[Blob range with no value]
|
||||
expected: FAIL
|
||||
|
|
20
tests/wpt/meta/xhr/blob-range.any.js.ini
vendored
20
tests/wpt/meta/xhr/blob-range.any.js.ini
vendored
|
@ -1,24 +1,24 @@
|
|||
[blob-range.any.worker.html]
|
||||
[A simple blob range request.]
|
||||
expected: FAIL
|
||||
expected: PASS
|
||||
|
||||
[A blob range request with no type.]
|
||||
expected: FAIL
|
||||
|
||||
[A blob range request with no end.]
|
||||
expected: FAIL
|
||||
expected: PASS
|
||||
|
||||
[A blob range request with no start.]
|
||||
expected: FAIL
|
||||
expected: PASS
|
||||
|
||||
[A simple blob range request with whitespace.]
|
||||
expected: FAIL
|
||||
|
||||
[Blob content with short content and a large range end]
|
||||
expected: FAIL
|
||||
expected: PASS
|
||||
|
||||
[Blob content with short content and a range end matching content length]
|
||||
expected: FAIL
|
||||
expected: PASS
|
||||
|
||||
[Blob range with whitespace before and after hyphen]
|
||||
expected: FAIL
|
||||
|
@ -83,25 +83,25 @@
|
|||
|
||||
[blob-range.any.html]
|
||||
[A simple blob range request.]
|
||||
expected: FAIL
|
||||
expected: PASS
|
||||
|
||||
[A blob range request with no type.]
|
||||
expected: FAIL
|
||||
|
||||
[A blob range request with no end.]
|
||||
expected: FAIL
|
||||
expected: PASS
|
||||
|
||||
[A blob range request with no start.]
|
||||
expected: FAIL
|
||||
expected: PASS
|
||||
|
||||
[A simple blob range request with whitespace.]
|
||||
expected: FAIL
|
||||
|
||||
[Blob content with short content and a large range end]
|
||||
expected: FAIL
|
||||
expected: PASS
|
||||
|
||||
[Blob content with short content and a range end matching content length]
|
||||
expected: FAIL
|
||||
expected: PASS
|
||||
|
||||
[Blob range with whitespace before and after hyphen]
|
||||
expected: FAIL
|
||||
|
|
7
tests/wpt/mozilla/meta/MANIFEST.json
vendored
7
tests/wpt/mozilla/meta/MANIFEST.json
vendored
|
@ -13905,13 +13905,6 @@
|
|||
{}
|
||||
]
|
||||
],
|
||||
"range_request_blob_url.html": [
|
||||
"075397620e989dafc814c0ed2bca46bd476bccf6",
|
||||
[
|
||||
null,
|
||||
{}
|
||||
]
|
||||
],
|
||||
"range_request_file_url.html": [
|
||||
"4fd4ddc8b1a9959e90b243795267c220d6a05f5e",
|
||||
[
|
||||
|
|
|
@ -1,60 +0,0 @@
|
|||
<html>
|
||||
<head>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script>
|
||||
[{
|
||||
range: "bytes=0-",
|
||||
status: 206,
|
||||
expected: "abcdefghijklmnopqrstuvwxyz"
|
||||
}, {
|
||||
range: "bytes=0-9",
|
||||
status: 206,
|
||||
expected: "abcdefghi"
|
||||
}, {
|
||||
range: "bytes=1-9",
|
||||
status: 206,
|
||||
expected: "bcdefghi"
|
||||
}, {
|
||||
range: "bytes=-10",
|
||||
status: 206,
|
||||
expected: "qrstuvwxyz"
|
||||
}, {
|
||||
range: "bytes=0-100",
|
||||
status: 206,
|
||||
expected: "abcdefghijklmnopqrstuvwxyz"
|
||||
}, {
|
||||
range: "bytes=100-",
|
||||
status: 416,
|
||||
expected: ""
|
||||
}, {
|
||||
range: "bytes=-100",
|
||||
status: 206,
|
||||
expected: "abcdefghijklmnopqrstuvwxyz"
|
||||
}].forEach(test => {
|
||||
promise_test(function() {
|
||||
const abc = "abcdefghijklmnopqrstuvwxyz";
|
||||
const blob = new Blob([abc], { "type": "text/plain" });
|
||||
return fetch(URL.createObjectURL(blob), {
|
||||
headers: {
|
||||
"Range": test.range
|
||||
}
|
||||
})
|
||||
.then(response => {
|
||||
assert_equals(response.status, test.status);
|
||||
if (response.status != 206) {
|
||||
return "";
|
||||
}
|
||||
return response.text();
|
||||
})
|
||||
.then(response => {
|
||||
assert_equals(response, test.expected);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
</script>
|
||||
</head>
|
||||
</body>
|
||||
</html>
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue