Fix dispatchEvent instrumentation regression and add reload regression benchmark#1468
Merged
Conversation
- Keep `window.dispatchEvent` untouched by listening for `ethereum#initialized` reinjection events - Add benchmark harness and repro page to compare Interceptor vs native vs broken dispatch behavior - Extend Chrome session launcher to support persistent profiles via env vars - Update inpage signer tests to verify dispatchEvent is restored and late wallet injection still reinjects
Contributor
Author
|
/review |
Remove removeEventListener from the onEthereumInitialized callback so the listener stays active. The isInterceptor guard already prevents unnecessary reinjections, making this safe. This also fixes the late-reinjection test which expects the listener to still respond to ethereum#initialized events dispatched after initial load.
Contributor
Author
|
/review |
MicahZoltu
approved these changes
Jun 15, 2026
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
window.dispatchEvent; Interceptor now reinjects itself by listening forethereum#initializedand dispatching the event after listener registration.dispatchEventreload behavior with three scenarios (current Interceptor, no extension, and simulated broken shim) via new benchmark page and server.CHROME_USER_DATA_DIR/INTERCEPTOR_CHROME_PROFILE_DIRwith optional cleanup behavior.bun run benchmark:dispatchevent-reload.window.dispatchEventis restored and lateethereum#initializedreinjection keepsethereum.isInterceptorsemantics.Testing
bun test.bun run setup-chrome.bun run typecheck.bun run lint.bun run benchmark:popup-lifecycle.bun run benchmark:dispatchevent-reload.