Conversation
Member
|
CC @bkonyi |
Adds `?uri=messageport:<targetOrigin>`. On every connect, DevTools posts a new `MessagePort` to `window.parent`, and the embedding page connects it to a VM service. This lets pages such as DartPad, whose VM service runs in a web worker, embed DevTools without a WebSocket.
jonasfj
force-pushed
the
devtools_iframe_messageport_integration
branch
from
September 28, 2026 20:05
4585928 to
1f9592c
Compare
jonasfj
marked this pull request as ready for review
September 28, 2026 20:40
Contributor
There was a problem hiding this comment.
Code Review
This pull request introduces support for proxying the VM service connection over a MessagePort, allowing DevTools to connect when embedded in an iframe. The implementation includes a web-specific connection handler, a stub for other platforms, and corresponding tests. The review feedback identifies several areas for improvement: adding a check for window.parent to prevent hanging when not embedded, implementing a graceful disconnection mechanism via null signals, validating the URI path to avoid runtime exceptions, and adding a timeout to the connection verification process to ensure robustness.
… and add connect timeout
This branch has not been deployed
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.
Support for providing VM service protocol using a
MessagePort.?uri=messageport:<targetOrigin>window.parent.postMessage({action: 'connect', port})Then parent window is responsible for proxying messages into the
MessagePort.Note:
MessagePortdoesn't actually carry a disconnect / closed event, so in an ideal world we might want to allow the other end to sendnullto indicate end-of-stream. But I'm not sure we need it.For context I'm trying to add the VM Service Protocol bits required in
package:dartpadhere: sdk/+/554920AI description
Adds
?uri=messageport:<targetOrigin>, so a page embedding DevTools can provide the VM service connection over aMessagePortinstead of a WebSocket URI.MessageChanneland posts one port to the embedding page:Uint8Array. Only the latest port is used.devtools_apprather than indevtools_shared'sconnect, because that is published API and must not depend on web-only libraries.messageport:URI but can't connect with it.--platform chromeand--platform chrome --wasm.