Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /compression/decompression-empty-input.any.html - WPT Dashboard Interop Dashboard
- /compression/decompression-empty-input.any.serviceworker.html - WPT Dashboard Interop Dashboard
- /compression/decompression-empty-input.any.shadowrealm-in-dedicatedworker.html - WPT Dashboard Interop Dashboard
- /compression/decompression-empty-input.any.shadowrealm-in-shadowrealm.html - WPT Dashboard Interop Dashboard
- /compression/decompression-empty-input.any.shadowrealm-in-sharedworker.html - WPT Dashboard Interop Dashboard
- /compression/decompression-empty-input.any.shadowrealm-in-window.html - WPT Dashboard Interop Dashboard
- /compression/decompression-empty-input.any.sharedworker.html - WPT Dashboard Interop Dashboard
- /compression/decompression-empty-input.any.worker.html - WPT Dashboard Interop Dashboard
- /compression/decompression-empty-input.https.any.shadowrealm-in-audioworklet.html - WPT Dashboard Interop Dashboard
- /compression/decompression-empty-input.https.any.shadowrealm-in-serviceworker.html - WPT Dashboard Interop Dashboard
// META: global=window,worker,shadowrealm
'use strict';
const emptyValues = [
["gzip", new Uint8Array([31, 139, 8, 0, 0, 0, 0, 0, 0, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0])],
["deflate", new Uint8Array([120, 156, 3, 0, 0, 0, 0, 1])],
["deflate-raw", new Uint8Array([1, 0, 0, 255, 255])],
];
for (const [format, emptyValue] of emptyValues) {
promise_test(async t => {
const ds = new DecompressionStream(format);
const reader = ds.readable.getReader();
const writer = ds.writable.getWriter();
const writePromise = writer.write(emptyValue);
writer.close();
const { value, done } = await reader.read();
assert_true(done, "read() should set done");
assert_equals(value, undefined, "value should be undefined");
await writePromise;
}, `decompressing ${format} empty input should work`);
}