Repository navigation
fix(runtime): deliver a posted undefined as undefined, not null - #2063
adrian-niculescu wants to merge 1 commit into
Conversation
Every delivery path built its MessageEvent through the public constructor, whose init dictionary turns an undefined data into null. Delivery now goes through an internal factory that stores the payload as given. The native messageerror paths pass null so that event keeps its default data, and a worker's messageerror carries the deserialization failure as its data, as a port's already does.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (10)
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review. 📝 WalkthroughWalkthroughMessage delivery now uses a factory to preserve delivered ChangesMessage data handling
Priority: ➖ Normal Estimated code review effort: 3 (Moderate) | ~20 minutes Change: Bug fix Merge Risk: ⚪ Minimal · up to The change makes a posted undefined arrive as undefined instead of null across message ports, broadcast channels and workers. Regression tests cover these paths. No merge-blocking risk was found. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. A rabbit sends a message through the night, Comment |
|
@coderabbitai review |
✅ Action performedReview finished.
|
postMessage(undefined)arrives asnulleverywhere a message is delivered: a MessagePort, a BroadcastChannel, a Worker and its global scope, and anode:worker_threadsparentPort. Node and browsers deliverundefined.Every delivery path builds its event with
new MessageEvent(type, { data, ports }), and the constructor's init dictionary turns an undefineddataintonull, as Web IDL requires. Delivery now goes through an internalcreateMessageEventthat stores the payload as given, the same fix as NativeScript/ios#477. The nativemessageerrorpaths passnullinstead ofundefined, so that event keeps its default. A worker'smessageerrornow carries the deserialization failure as itsdata, as a port's already does and as NativeScript/ios#489 does on iOS.Stacked on #2043. The new specs in
testMessaging.jsfail on that branch and pass with this change, and the full device suite passes.Summary by CodeRabbit
undefinedvalues across message ports, broadcast channels, and workers instead of converting them tonull.dataproperty, including when its value isundefined.nullwhen no error is available.