Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /compression/decompression-correct-input.any.html - WPT Dashboard Interop Dashboard
- /compression/decompression-correct-input.any.serviceworker.html - WPT Dashboard Interop Dashboard
- /compression/decompression-correct-input.any.shadowrealm-in-dedicatedworker.html - WPT Dashboard Interop Dashboard
- /compression/decompression-correct-input.any.shadowrealm-in-shadowrealm.html - WPT Dashboard Interop Dashboard
- /compression/decompression-correct-input.any.shadowrealm-in-sharedworker.html - WPT Dashboard Interop Dashboard
- /compression/decompression-correct-input.any.shadowrealm-in-window.html - WPT Dashboard Interop Dashboard
- /compression/decompression-correct-input.any.sharedworker.html - WPT Dashboard Interop Dashboard
- /compression/decompression-correct-input.any.worker.html - WPT Dashboard Interop Dashboard
- /compression/decompression-correct-input.https.any.shadowrealm-in-audioworklet.html - WPT Dashboard Interop Dashboard
- /compression/decompression-correct-input.https.any.shadowrealm-in-serviceworker.html - WPT Dashboard Interop Dashboard
// META: global=window,worker,shadowrealm
// META: script=decompression-correct-input.js
'use strict';
promise_test(async t => {
const ds = new DecompressionStream('deflate');
const reader = ds.readable.getReader();
const writer = ds.writable.getWriter();
const writePromise = writer.write(deflateChunkValue);
const { done, value } = await reader.read();
assert_array_equals(Array.from(value), trueChunkValue, "value should match");
}, 'decompressing deflated input should work');
promise_test(async t => {
const ds = new DecompressionStream('gzip');
const reader = ds.readable.getReader();
const writer = ds.writable.getWriter();
const writePromise = writer.write(gzipChunkValue);
const { done, value } = await reader.read();
assert_array_equals(Array.from(value), trueChunkValue, "value should match");
}, 'decompressing gzip input should work');
promise_test(async t => {
const ds = new DecompressionStream('deflate-raw');
const reader = ds.readable.getReader();
const writer = ds.writable.getWriter();
const writePromise = writer.write(deflateRawChunkValue);
const { done, value } = await reader.read();
assert_array_equals(Array.from(value), trueChunkValue, "value should match");
}, 'decompressing deflated (with -raw) input should work');