Add CompressionStream and DecompressionStream polyfills#211
Open
matthargett wants to merge 3 commits into
Open
Add CompressionStream and DecompressionStream polyfills#211matthargett wants to merge 3 commits into
matthargett wants to merge 3 commits into
Conversation
Vendor the ES5 web-streams-polyfill 4.3.0 ponyfill and expose an idempotent Streams initializer that preserves constructors supplied by the selected JavaScript engine. Cover readable, writable, transform, BYOB, error, tee, subclassing, and host-constructor behavior with focused ports from WPT plus Firefox and Chromium regression tests. Validate the implementation on JavaScriptCore under ASan/UBSan and QuickJS Release.
Add optional CompressionStream and DecompressionStream polyfills for gzip, deflate, and raw deflate on top of WHATWG Streams. Reuse one native output buffer per active codec, borrow input views only synchronously, and defer JavaScript enqueue callbacks until zlib has finished consuming each input. Cover constructor and BufferSource behavior, split and empty chunks, large flushes, corrupt/truncated/trailing input, reentrant input mutation, and repeated stream teardown with focused WPT and browser-engine regression tests. Preserve host constructors and use platform zlib where available with a pinned fallback.
Replace a partial or null host Streams surface as a complete constructor suite so stream products retain compatible instanceof relationships. Preserve a complete suite on repeated initialization.\n\nHarden the native initialization test so N-API failures complete the test promise instead of hanging, and cover partial host replacement plus null handling and cross-constructor compatibility.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
CompressionStreamandDecompressionStreampolyfills forgzip,deflate, anddeflate-rawDepends on #208.
Ownership
Input BufferSource views are borrowed only during a synchronous zlib call. Output is buffered before any enqueue callback can run JavaScript, then copied once into exact-size JS-owned Uint8Arrays. Each active codec reuses one 64 KiB native scratch buffer and releases zlib/scratch storage immediately on completion or error.
Coverage
Focused tests cover the WPT compression suite, including constructor conversion, BufferSource variants and offsets, split/empty chunks, large flush output, corrupt/truncated input, trailing data, and Uint8Array output. They also exercise the input-invalidation safeguard documented by Chromium's transformer, Firefox's output-before-extra-input-error ordering, and WebKit's BufferSource validation path.
Validated with: