receiveMessagesOnInspectorThread was draining messages from the queue
before checking if the connection needed doConnect. If the connection
was Pending, it called doConnect and returned early, dropping the
already-drained messages on the floor.
Move the doConnect check before the message drain so messages that
arrive during reconnection are not lost.
The options page is mprotected read-only after JSC initialization.
Writing to usePollingTraps from Bun__activateRuntimeInspectorMode crashes
with SEGV at offset 0xB34 (the usePollingTraps field offset in the frozen page).
Confirmed via ASAN on Linux aarch64.
When the event loop path wins the race against STW for inspector activation,
requestResumeAll() doesn't clear the VM's trap bits (world was never stopped).
The residual NeedStopTheWorld trap + poisoned stack limit then crashes when JS
next enters a function. Fix by explicitly calling vm.cancelStop() before
requestResumeAll() on the event loop path.
preAttachedDebugger was per-connection and broke on reconnect — a new
connection after disconnect wouldn't have the flag set (debugger already
attached from first connection), so interruptForMessageDelivery would
skip requestStopAll. Using the global runtimeInspectorActivated flag
fixes reconnection and eliminates a redundant atomic bool.
Added test verifying CDP messages work after client disconnect/reconnect.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The pre-attach code in doConnect() was firing for --inspect too (debugger
isn't attached at doConnect time, only after Debugger.enable CDP command).
This set preAttachedDebugger=true, causing interruptForMessageDelivery to
call requestStopAll for every CDP message — deadlocking on Windows.
Gate the pre-attach on runtimeInspectorActivated so it only fires for
the SIGUSR1 path where it's actually needed.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Improve the comment on the pre-attach debugger guard to explain why it
only fires on the SIGUSR1 path (--inspect already has the debugger
attached by JSC at startup). Replace hardcoded port 6499 assertion in
Windows test with regex match.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Make preAttachedDebugger std::atomic<bool> to fix data race between JS
thread (doConnect writer) and debugger thread (interruptForMessageDelivery
reader). Add comments documenting why schedulePauseAtNextOpportunity is
safe during STW, the double requestStopAll rationale with empirical
results, and STW_CONTINUE behavior for non-VMStopped events.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
connect() was unconditionally calling requestStopAll for all inspector
connections, causing --inspect tests to hang because the STW cycle
interfered with normal event loop delivery. Added runtimeInspectorActivated
flag that is only set when the STW callback processes a SIGUSR1 activation,
so connect() only uses requestStopAll on the runtime activation path.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The --inspect flag tests were failing because interruptForMessageDelivery
called requestStopAll for every CDP message, even on the normal --inspect
path where the event loop delivers messages fine. Now we only use
requestStopAll when the debugger was pre-attached during SIGUSR1 activation
(where the event loop may not be running).
### What does this PR do?
Updates WebKit to
5b6a0ac49b
### How did you verify your code works?
---------
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
Co-authored-by: Claude Bot <claude-bot@bun.sh>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
## Summary
- When a string exceeds `WTF::String::MaxLength` (~4GB),
`bun.String.createUninitialized()` returns a `.Dead` tag
- The C++ layer now properly throws `ERR_STRING_TOO_LONG` when this
happens
- Updated `String.toJS()` in Zig to return `bun.JSError!jsc.JSValue`
instead of just `jsc.JSValue`
- Updated ~40 Zig caller files to handle the error with `try`
- C++ callers updated with `RETURN_IF_EXCEPTION` checks
## Test plan
- [x] `bun bd test test/js/node/buffer.test.js` - 449 tests pass
- [x] `bun bd
test/js/node/test/parallel/test-buffer-tostring-rangeerror.js` - passes
🤖 Generated with [Claude Code](https://claude.ai/code)
---------
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>
- WTFMove → WTF::move / std::move: Replaced WTFMove() macro with
WTF::move() function for WTF types, std::move() for std types
- SortedArrayMap removed: Replaced with if-else chains in
EventFactory.cpp, JSCryptoKeyUsage.cpp
- Wasm::Memory::create signature changed: Removed VM parameter
- URLPattern allocation: Changed from WTF_MAKE_ISO_ALLOCATED to
WTF_MAKE_TZONE_ALLOCATED
---------
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>