mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
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:
parent
233c9aaea6
commit
a0419faa85
2 changed files with 7 additions and 19 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -2088,19 +2088,8 @@ impl CrossRealmTransformReadable {
|
|||
|
||||
// Otherwise, if type is "error",
|
||||
if type_string == "error" {
|
||||
if value.is_undefined() {
|
||||
// Note: for DataClone errors, we send UndefinedValue across,
|
||||
// because somehow sending the error results in another error.
|
||||
// The error is then created here.
|
||||
rooted!(in(*cx) let mut rooted_error = UndefinedValue());
|
||||
Error::DataClone(None).to_jsval(cx, global, rooted_error.handle_mut(), can_gc);
|
||||
|
||||
// Perform ! ReadableStreamDefaultControllerError(controller, value).
|
||||
self.controller.error(rooted_error.handle(), can_gc);
|
||||
} else {
|
||||
// Perform ! ReadableStreamDefaultControllerError(controller, value).
|
||||
self.controller.error(value.handle(), can_gc);
|
||||
}
|
||||
// Perform ! ReadableStreamDefaultControllerError(controller, value).
|
||||
self.controller.error(value.handle(), can_gc);
|
||||
|
||||
// Disentangle port.
|
||||
global.disentangle_port(port);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue