fix: preserve data channel message order#16
Merged
Conversation
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.
Purpose
Prevent a later native RTCDataChannel message batch from overtaking messages already queued for JavaScript delivery.
Root cause
The direct native-batch dispatch fast path did not account for older messages waiting in
_queuedMessageEvents. On timing-sensitive platforms, notably macOS with Node 24, a later batch could be delivered before the scheduled queue flush.Behavior impact
Ordered data channels now preserve FIFO ordering across queued and directly dispatched native batches. The normal fast path remains active whenever the queue is empty and adds only one array-length check per native batch.
Native and WPT impact
No native bridge changes. The selected WPT manifest is unchanged. Targeted
RTCDataChannel-send.htmlvalidation passed 26/26.Browser impact
Chrome interoperability scenarios passed, including ordered Unicode bursts, binary messages, close behavior, and repeated negotiations.
Validation
npm run checknpm run native:checknpm test(53/53)npm run api:checknpm run types:checknpm run pack:checknpm run wpt:selection:checknpm run wpt:test -- webrtc/RTCDataChannel-send.html(26/26)npm run e2e:chromeThe full selected WPT suite was not rerun locally because targeted coverage exercises the affected behavior and the full matrix runs in the independent Conformance workflow.