Implement speculative HTML parsing with off-main-thread preload scanning
Add a speculative parser that runs on a background thread to discover
preloadable resources while the main parser is blocked on script execution.
- PreloadScanner: lightweight state machine that identifies <link rel=stylesheet>,
<script src>, <img src>, and <link rel=preload> tags
- SpeculativeParser: manages background thread, mpsc channels, token buffering,
and invalidation on document.write
- Handles inline script content correctly (enters ScriptData mode)
- Skips HTML comments to avoid false positives
- Supports double-quoted, single-quoted, and unquoted attribute values
- 22 new tests covering resource discovery, speculation hit/miss, invalidation,
and token replay
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>