Streams: remove unnecessary special hanlding of dataclone error (#36628)

This removes a now unnecessary handling of dataclone error when port
posts a message handling error to support stream transfers.

Fix https://github.com/servo/servo/issues/36479

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>
This commit is contained in:
Gregory Terzian 2025-04-21 16:31:25 +08:00 committed by GitHub
parent 233c9aaea6
commit a0419faa85
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 7 additions and 19 deletions

View file

@ -20,7 +20,7 @@ use crate::dom::bindings::codegen::Bindings::MessagePortBinding::{
MessagePortMethods, StructuredSerializeOptions,
};
use crate::dom::bindings::conversions::root_from_object;
use crate::dom::bindings::error::{Error, ErrorResult};
use crate::dom::bindings::error::{Error, ErrorResult, ErrorToJsval};
use crate::dom::bindings::inheritance::Castable;
use crate::dom::bindings::reflector::{DomGlobal, reflect_dom_object};
use crate::dom::bindings::root::DomRoot;
@ -180,14 +180,13 @@ impl MessagePort {
let result = self.pack_and_post_message(type_, value, can_gc);
// If result is an abrupt completion,
if result.is_err() {
if let Err(error) = result.as_ref() {
// Perform ! CrossRealmTransformSendError(port, result.[[Value]]).
// Note: we send UndefinedValue across,
// because somehow sending an error results in another error.
// The Error::DataClone, which is the only one that is sent across,
// will be created upon receipt.
let cx = GlobalScope::get_cx();
rooted!(in(*cx) let mut rooted_error = UndefinedValue());
error
.clone()
.to_jsval(cx, &self.global(), rooted_error.handle_mut(), can_gc);
self.cross_realm_transform_send_error(rooted_error.handle(), can_gc);
}