summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/fetch/orb/tentative/content-range.sub.any.js
blob: ee97521a55cd9906d693499a79d72f6b46effa23 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// META: script=/fetch/orb/resources/utils.js

const url =
  "http://{{domains[www1]}}:{{ports[http][0]}}/fetch/orb/resources/image.png";

promise_test(async () => {
  let headers = new Headers([["Range", "bytes=0-99"]]);
  await fetchORB(
    url,
    { headers },
    header("Content-Range", "bytes 0-99/1010"),
    "slice(null,100)",
    "status(206)"
  );
}, "ORB shouldn't block opaque range of image/png starting at zero");

promise_test(
  t =>
    promise_rejects_js(
      t,
      TypeError,
      fetchORB(
        url,
        { headers: new Headers([["Range", "bytes 10-99"]]) },
        header("Content-Range", "bytes 10-99/1010"),
        "slice(10,100)",
        "status(206)"
      )
    ),
  "ORB should block opaque range of image/png not starting at zero, that isn't subsequent"
);