tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

data.any.js (1339B)


      1 // META: script=/common/utils.js
      2 
      3 promise_test(async () => {
      4  return fetch("data:text/plain;charset=US-ASCII,paddingHello%2C%20World%21padding", {
      5    "method": "GET",
      6    "Range": "bytes=13-26"
      7  }).then(function(resp) {
      8    assert_equals(resp.status, 200, "HTTP status is 200");
      9    assert_equals(resp.type, "basic", "response type is basic");
     10    assert_equals(resp.headers.get("Content-Type"), "text/plain;charset=US-ASCII", "Content-Type is " + resp.headers.get("Content-Type"));
     11    return resp.text();
     12  }).then(function(text) {
     13    assert_equals(text, 'paddingHello, World!padding', "Response's body ignores range");
     14  });
     15 }, "data: URL and Range header");
     16 
     17 promise_test(async () => {
     18  return fetch("data:text/plain;charset=US-ASCII,paddingHello%2C%20paddingWorld%21padding", {
     19    "method": "GET",
     20    "Range": "bytes=7-14,21-27"
     21  }).then(function(resp) {
     22    assert_equals(resp.status, 200, "HTTP status is 200");
     23    assert_equals(resp.type, "basic", "response type is basic");
     24    assert_equals(resp.headers.get("Content-Type"), "text/plain;charset=US-ASCII", "Content-Type is " + resp.headers.get("Content-Type"));
     25    return resp.text();
     26  }).then(function(text) {
     27    assert_equals(text, 'paddingHello, paddingWorld!padding', "Response's body ignores range");
     28  });
     29 }, "data: URL and Range header with multiple ranges");