This commit rewrites the ReadableStream.from() implementation to closely
follow the WebKit reference implementation, improving spec compliance
and simplifying the code structure.
Key changes:
- Use WebKit's algorithm structure for iterator handling
- Simplify async/sync iterator detection and setup
- Use regular ReadableStream constructor with highWaterMark: 0
- Properly handle promise values from sync iterators
- Maintain proper error handling and validation
- All existing tests continue to pass
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Implement comprehensive WHATWG web platform test suite (46 tests)
- Fix construction-time vs runtime error handling - now properly throws
validation errors synchronously while deferring iterator errors
- Add proper null asyncIterator handling for fallback to sync iterator
- Implement proper cancellation with return() method semantics
- Add promise unwrapping for sync iterator values
- Handle self-iterator pattern detection to avoid timing issues
- Achieve 40/46 WPT tests passing (87% compliance) vs original 0/46
Remaining edge cases:
- 1 test: Iterator timing with ReadableStream auto-pull behavior
- 5 tests: Cancellation edge cases with deferred iterator creation
This represents a massive improvement in WHATWG spec compliance
addressing the core PR review concerns about following the official
web platform test expectations.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Implement comprehensive WHATWG web streams test suite
- Fix iterator method validation and error handling
- Add proper cancellation support with return() method
- Defer iterator creation until first pull to avoid early execution
- Handle both sync and async iterables with promise unwrapping
- Ensure proper error propagation for iterator failures
Fixes most WPT test cases (44/46 passing) for ReadableStream.from()
Remaining edge cases for stream auto-pull behavior and cancel validation
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Changed sync iterable handling to use pull() instead of start() to properly
defer iterator creation and handle errors asynchronously. This ensures that
iterator errors are properly caught and converted to stream errors rather
than throwing synchronously.
All 19 tests now pass.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Add support for ReadableStream.from() which creates ReadableStream instances
from iterables and async iterables, following the WHATWG Streams specification.
- Supports arrays, strings, Sets, Maps, and custom iterables/async iterables
- Returns the same ReadableStream if one is passed
- Properly handles error cases with appropriate TypeError messages
- Includes comprehensive test coverage
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Co-authored-by: Claude Bot <claude-bot@bun.sh>
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Claude Bot <claude-bot@bun.sh>
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Claude Bot <claude-bot@bun.sh>
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>