tor-browser

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

decompression-correct-input.any.js (698B)


      1 // META: global=window,worker
      2 // META: script=decompression-correct-input.js
      3 
      4 "use strict";
      5 
      6 promise_test(async t => {
      7  const ds = new DecompressionStream("zstd");
      8  const writer = ds.writable.getWriter();
      9  const reader = ds.readable.getReader();
     10 
     11  const writePromise = writer.write(compressedZstdBytes);
     12  const writerClosePromise = writer.close();
     13 
     14  const { value, done } = await reader.read();
     15 
     16  assert_false(
     17    done,
     18    "The done flag should not be set after reading valid input"
     19  );
     20 
     21  await writePromise;
     22  await writerClosePromise;
     23 
     24  assert_array_equals(Array.from(value), trueChunkValue, "value should match");
     25 }, "decompressing valid zstd input should yield 'expected output'");