mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
More CanGc fixes: Range, Event, gpu error, Header (#33774)
* Propagate CanGc parameter in Range Signed-off-by: webbeef <me@webbeef.org> * Propagate CanGc parameter in gpu code and dependencies Signed-off-by: webbeef <me@webbeef.org> * Propagate CanGc parameter in Header and dependencies Signed-off-by: webbeef <me@webbeef.org> * Propagate CanGc parameter in Event and dependencies Signed-off-by: webbeef <me@webbeef.org> * Propagate CanGc parameter in rtcdatachannel Signed-off-by: webbeef <me@webbeef.org> * Propagate CanGc parameter in servoparser Signed-off-by: webbeef <me@webbeef.org> --------- Signed-off-by: webbeef <me@webbeef.org>
This commit is contained in:
parent
8c56cbdab2
commit
f9a06d62a2
17 changed files with 92 additions and 85 deletions
|
@ -2286,6 +2286,7 @@ impl Document {
|
|||
atom!("unload"),
|
||||
EventBubbles::Bubbles,
|
||||
EventCancelable::Cancelable,
|
||||
CanGc::note(),
|
||||
);
|
||||
event.set_trusted(true);
|
||||
let event_target = self.window.upcast::<EventTarget>();
|
||||
|
@ -2328,7 +2329,7 @@ impl Document {
|
|||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#the-end
|
||||
pub fn maybe_queue_document_completion(&self) {
|
||||
pub fn maybe_queue_document_completion(&self, can_gc: CanGc) {
|
||||
// https://html.spec.whatwg.org/multipage/#delaying-load-events-mode
|
||||
let is_in_delaying_load_events_mode = match self.window.undiscarded_window_proxy() {
|
||||
Some(window_proxy) => window_proxy.is_delaying_load_events_mode(),
|
||||
|
@ -2378,6 +2379,7 @@ impl Document {
|
|||
atom!("load"),
|
||||
EventBubbles::DoesNotBubble,
|
||||
EventCancelable::NotCancelable,
|
||||
can_gc,
|
||||
);
|
||||
event.set_trusted(true);
|
||||
|
||||
|
@ -2658,7 +2660,7 @@ impl Document {
|
|||
for iframe in self.iter_iframes() {
|
||||
if let Some(document) = iframe.GetContentDocument() {
|
||||
// TODO: abort the active documents of every child browsing context.
|
||||
document.abort(CanGc::note());
|
||||
document.abort(can_gc);
|
||||
// TODO: salvageable flag.
|
||||
}
|
||||
}
|
||||
|
@ -4590,9 +4592,10 @@ impl DocumentMethods for Document {
|
|||
))),
|
||||
// FIXME(#25136): devicemotionevent, deviceorientationevent
|
||||
// FIXME(#7529): dragevent
|
||||
"events" | "event" | "htmlevents" | "svgevents" => {
|
||||
Ok(Event::new_uninitialized(self.window.upcast()))
|
||||
},
|
||||
"events" | "event" | "htmlevents" | "svgevents" => Ok(Event::new_uninitialized(
|
||||
self.window.upcast(),
|
||||
CanGc::note(),
|
||||
)),
|
||||
"focusevent" => Ok(DomRoot::upcast(FocusEvent::new_uninitialized(&self.window))),
|
||||
"hashchangeevent" => Ok(DomRoot::upcast(HashChangeEvent::new_uninitialized(
|
||||
&self.window,
|
||||
|
|
|
@ -75,8 +75,8 @@ impl Event {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn new_uninitialized(global: &GlobalScope) -> DomRoot<Event> {
|
||||
Self::new_uninitialized_with_proto(global, None, CanGc::note())
|
||||
pub fn new_uninitialized(global: &GlobalScope, can_gc: CanGc) -> DomRoot<Event> {
|
||||
Self::new_uninitialized_with_proto(global, None, can_gc)
|
||||
}
|
||||
|
||||
pub fn new_uninitialized_with_proto(
|
||||
|
@ -92,8 +92,9 @@ impl Event {
|
|||
type_: Atom,
|
||||
bubbles: EventBubbles,
|
||||
cancelable: EventCancelable,
|
||||
can_gc: CanGc,
|
||||
) -> DomRoot<Event> {
|
||||
Self::new_with_proto(global, None, type_, bubbles, cancelable, CanGc::note())
|
||||
Self::new_with_proto(global, None, type_, bubbles, cancelable, can_gc)
|
||||
}
|
||||
|
||||
fn new_with_proto(
|
||||
|
|
|
@ -682,7 +682,7 @@ impl EventTarget {
|
|||
bubbles: EventBubbles,
|
||||
cancelable: EventCancelable,
|
||||
) -> DomRoot<Event> {
|
||||
let event = Event::new(&self.global(), name, bubbles, cancelable);
|
||||
let event = Event::new(&self.global(), name, bubbles, cancelable, CanGc::note());
|
||||
event.fire(self);
|
||||
event
|
||||
}
|
||||
|
|
|
@ -3190,14 +3190,19 @@ impl GlobalScope {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn handle_uncaptured_gpu_error(&self, device: WebGPUDevice, error: webgpu::Error) {
|
||||
pub fn handle_uncaptured_gpu_error(
|
||||
&self,
|
||||
device: WebGPUDevice,
|
||||
error: webgpu::Error,
|
||||
can_gc: CanGc,
|
||||
) {
|
||||
if let Some(gpu_device) = self
|
||||
.gpu_devices
|
||||
.borrow()
|
||||
.get(&device)
|
||||
.and_then(|device| device.root())
|
||||
{
|
||||
gpu_device.fire_uncaptured_error(error);
|
||||
gpu_device.fire_uncaptured_error(error, can_gc);
|
||||
} else {
|
||||
warn!("Recived error for lost GPUDevice!")
|
||||
}
|
||||
|
|
|
@ -63,6 +63,7 @@ use crate::dom::gputexture::GPUTexture;
|
|||
use crate::dom::gpuuncapturederrorevent::GPUUncapturedErrorEvent;
|
||||
use crate::dom::promise::Promise;
|
||||
use crate::realms::InRealm;
|
||||
use crate::script_runtime::CanGc;
|
||||
|
||||
#[dom_struct]
|
||||
pub struct GPUDevice {
|
||||
|
@ -170,8 +171,8 @@ impl GPUDevice {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn fire_uncaptured_error(&self, error: webgpu::Error) {
|
||||
let error = GPUError::from_error(&self.global(), error);
|
||||
pub fn fire_uncaptured_error(&self, error: webgpu::Error, can_gc: CanGc) {
|
||||
let error = GPUError::from_error(&self.global(), error, can_gc);
|
||||
let ev = GPUUncapturedErrorEvent::new(
|
||||
&self.global(),
|
||||
DOMString::from("uncapturederror"),
|
||||
|
@ -566,7 +567,7 @@ impl AsyncWGPUListener for GPUDevice {
|
|||
Ok(None) | Err(PopError::Lost) => promise.resolve_native(&None::<Option<GPUError>>),
|
||||
Err(PopError::Empty) => promise.reject_error(Error::Operation),
|
||||
Ok(Some(error)) => {
|
||||
let error = GPUError::from_error(&self.global(), error);
|
||||
let error = GPUError::from_error(&self.global(), error, CanGc::note());
|
||||
promise.resolve_native(&error);
|
||||
},
|
||||
},
|
||||
|
|
|
@ -29,8 +29,8 @@ impl GPUError {
|
|||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn new(global: &GlobalScope, message: DOMString) -> DomRoot<Self> {
|
||||
Self::new_with_proto(global, None, message)
|
||||
pub fn new(global: &GlobalScope, message: DOMString, can_gc: CanGc) -> DomRoot<Self> {
|
||||
Self::new_with_proto(global, None, message, can_gc)
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
|
@ -38,34 +38,35 @@ impl GPUError {
|
|||
global: &GlobalScope,
|
||||
proto: Option<HandleObject>,
|
||||
message: DOMString,
|
||||
can_gc: CanGc,
|
||||
) -> DomRoot<Self> {
|
||||
reflect_dom_object_with_proto(
|
||||
Box::new(GPUError::new_inherited(message)),
|
||||
global,
|
||||
proto,
|
||||
CanGc::note(),
|
||||
can_gc,
|
||||
)
|
||||
}
|
||||
|
||||
pub fn from_error(global: &GlobalScope, error: Error) -> DomRoot<Self> {
|
||||
pub fn from_error(global: &GlobalScope, error: Error, can_gc: CanGc) -> DomRoot<Self> {
|
||||
match error {
|
||||
Error::Validation(msg) => DomRoot::upcast(GPUValidationError::new_with_proto(
|
||||
global,
|
||||
None,
|
||||
DOMString::from_string(msg),
|
||||
CanGc::note(),
|
||||
can_gc,
|
||||
)),
|
||||
Error::OutOfMemory(msg) => DomRoot::upcast(GPUOutOfMemoryError::new_with_proto(
|
||||
global,
|
||||
None,
|
||||
DOMString::from_string(msg),
|
||||
CanGc::note(),
|
||||
can_gc,
|
||||
)),
|
||||
Error::Internal(msg) => DomRoot::upcast(GPUInternalError::new_with_proto(
|
||||
global,
|
||||
None,
|
||||
DOMString::from_string(msg),
|
||||
CanGc::note(),
|
||||
can_gc,
|
||||
)),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -52,8 +52,8 @@ impl Headers {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn new(global: &GlobalScope) -> DomRoot<Headers> {
|
||||
Self::new_with_proto(global, None, CanGc::note())
|
||||
pub fn new(global: &GlobalScope, can_gc: CanGc) -> DomRoot<Headers> {
|
||||
Self::new_with_proto(global, None, can_gc)
|
||||
}
|
||||
|
||||
fn new_with_proto(
|
||||
|
@ -287,14 +287,14 @@ impl Headers {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn for_request(global: &GlobalScope) -> DomRoot<Headers> {
|
||||
let headers_for_request = Headers::new(global);
|
||||
pub fn for_request(global: &GlobalScope, can_gc: CanGc) -> DomRoot<Headers> {
|
||||
let headers_for_request = Headers::new(global, can_gc);
|
||||
headers_for_request.guard.set(Guard::Request);
|
||||
headers_for_request
|
||||
}
|
||||
|
||||
pub fn for_response(global: &GlobalScope) -> DomRoot<Headers> {
|
||||
let headers_for_response = Headers::new(global);
|
||||
pub fn for_response(global: &GlobalScope, can_gc: CanGc) -> DomRoot<Headers> {
|
||||
let headers_for_response = Headers::new(global, can_gc);
|
||||
headers_for_response.guard.set(Guard::Response);
|
||||
headers_for_response
|
||||
}
|
||||
|
|
|
@ -994,7 +994,7 @@ impl HTMLScriptElement {
|
|||
// Step 2.
|
||||
Err(e) => {
|
||||
warn!("error loading script {:?}", e);
|
||||
self.dispatch_error_event();
|
||||
self.dispatch_error_event(CanGc::note());
|
||||
return;
|
||||
},
|
||||
|
||||
|
@ -1043,7 +1043,7 @@ impl HTMLScriptElement {
|
|||
|
||||
// Step 6.
|
||||
if script.external {
|
||||
self.dispatch_load_event();
|
||||
self.dispatch_load_event(CanGc::note());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1138,19 +1138,21 @@ impl HTMLScriptElement {
|
|||
.queue_simple_event(self.upcast(), atom!("error"), &window);
|
||||
}
|
||||
|
||||
pub fn dispatch_load_event(&self) {
|
||||
pub fn dispatch_load_event(&self, can_gc: CanGc) {
|
||||
self.dispatch_event(
|
||||
atom!("load"),
|
||||
EventBubbles::DoesNotBubble,
|
||||
EventCancelable::NotCancelable,
|
||||
can_gc,
|
||||
);
|
||||
}
|
||||
|
||||
pub fn dispatch_error_event(&self) {
|
||||
pub fn dispatch_error_event(&self, can_gc: CanGc) {
|
||||
self.dispatch_event(
|
||||
atom!("error"),
|
||||
EventBubbles::DoesNotBubble,
|
||||
EventCancelable::NotCancelable,
|
||||
can_gc,
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -1229,9 +1231,10 @@ impl HTMLScriptElement {
|
|||
type_: Atom,
|
||||
bubbles: EventBubbles,
|
||||
cancelable: EventCancelable,
|
||||
can_gc: CanGc,
|
||||
) -> EventStatus {
|
||||
let window = window_from_node(self);
|
||||
let event = Event::new(window.upcast(), type_, bubbles, cancelable);
|
||||
let event = Event::new(window.upcast(), type_, bubbles, cancelable, can_gc);
|
||||
event.fire(self.upcast())
|
||||
}
|
||||
}
|
||||
|
|
|
@ -602,7 +602,7 @@ impl RangeMethods for Range {
|
|||
fragment.upcast::<Node>().AppendChild(&clone)?;
|
||||
} else {
|
||||
// Step 14.1.
|
||||
let clone = child.CloneNode(/* deep */ false, CanGc::note())?;
|
||||
let clone = child.CloneNode(/* deep */ false, can_gc)?;
|
||||
// Step 14.2.
|
||||
fragment.upcast::<Node>().AppendChild(&clone)?;
|
||||
// Step 14.3.
|
||||
|
@ -615,7 +615,7 @@ impl RangeMethods for Range {
|
|||
can_gc,
|
||||
);
|
||||
// Step 14.4.
|
||||
let subfragment = subrange.CloneContents(CanGc::note())?;
|
||||
let subfragment = subrange.CloneContents(can_gc)?;
|
||||
// Step 14.5.
|
||||
clone.AppendChild(subfragment.upcast())?;
|
||||
}
|
||||
|
@ -624,7 +624,7 @@ impl RangeMethods for Range {
|
|||
// Step 15.
|
||||
for child in contained_children {
|
||||
// Step 15.1.
|
||||
let clone = child.CloneNode(/* deep */ true, CanGc::note())?;
|
||||
let clone = child.CloneNode(/* deep */ true, can_gc)?;
|
||||
// Step 15.2.
|
||||
fragment.upcast::<Node>().AppendChild(&clone)?;
|
||||
}
|
||||
|
@ -640,20 +640,14 @@ impl RangeMethods for Range {
|
|||
fragment.upcast::<Node>().AppendChild(&clone)?;
|
||||
} else {
|
||||
// Step 17.1.
|
||||
let clone = child.CloneNode(/* deep */ false, CanGc::note())?;
|
||||
let clone = child.CloneNode(/* deep */ false, can_gc)?;
|
||||
// Step 17.2.
|
||||
fragment.upcast::<Node>().AppendChild(&clone)?;
|
||||
// Step 17.3.
|
||||
let subrange = Range::new(
|
||||
&clone.owner_doc(),
|
||||
&child,
|
||||
0,
|
||||
&end_node,
|
||||
end_offset,
|
||||
CanGc::note(),
|
||||
);
|
||||
let subrange =
|
||||
Range::new(&clone.owner_doc(), &child, 0, &end_node, end_offset, can_gc);
|
||||
// Step 17.4.
|
||||
let subfragment = subrange.CloneContents(CanGc::note())?;
|
||||
let subfragment = subrange.CloneContents(can_gc)?;
|
||||
// Step 17.5.
|
||||
clone.AppendChild(subfragment.upcast())?;
|
||||
}
|
||||
|
@ -683,7 +677,7 @@ impl RangeMethods for Range {
|
|||
if end_node == start_node {
|
||||
if let Some(end_data) = end_node.downcast::<CharacterData>() {
|
||||
// Step 4.1.
|
||||
let clone = end_node.CloneNode(/* deep */ true, CanGc::note())?;
|
||||
let clone = end_node.CloneNode(/* deep */ true, can_gc)?;
|
||||
// Step 4.2.
|
||||
let text = end_data.SubstringData(start_offset, end_offset - start_offset);
|
||||
clone
|
||||
|
@ -727,7 +721,7 @@ impl RangeMethods for Range {
|
|||
if let Some(start_data) = child.downcast::<CharacterData>() {
|
||||
assert!(child == start_node);
|
||||
// Step 15.1.
|
||||
let clone = start_node.CloneNode(/* deep */ true, CanGc::note())?;
|
||||
let clone = start_node.CloneNode(/* deep */ true, can_gc)?;
|
||||
// Step 15.2.
|
||||
let text = start_data.SubstringData(start_offset, start_node.len() - start_offset);
|
||||
clone
|
||||
|
@ -744,7 +738,7 @@ impl RangeMethods for Range {
|
|||
)?;
|
||||
} else {
|
||||
// Step 16.1.
|
||||
let clone = child.CloneNode(/* deep */ false, CanGc::note())?;
|
||||
let clone = child.CloneNode(/* deep */ false, can_gc)?;
|
||||
// Step 16.2.
|
||||
fragment.upcast::<Node>().AppendChild(&clone)?;
|
||||
// Step 16.3.
|
||||
|
@ -757,7 +751,7 @@ impl RangeMethods for Range {
|
|||
can_gc,
|
||||
);
|
||||
// Step 16.4.
|
||||
let subfragment = subrange.ExtractContents(CanGc::note())?;
|
||||
let subfragment = subrange.ExtractContents(can_gc)?;
|
||||
// Step 16.5.
|
||||
clone.AppendChild(subfragment.upcast())?;
|
||||
}
|
||||
|
@ -772,7 +766,7 @@ impl RangeMethods for Range {
|
|||
if let Some(end_data) = child.downcast::<CharacterData>() {
|
||||
assert!(child == end_node);
|
||||
// Step 18.1.
|
||||
let clone = end_node.CloneNode(/* deep */ true, CanGc::note())?;
|
||||
let clone = end_node.CloneNode(/* deep */ true, can_gc)?;
|
||||
// Step 18.2.
|
||||
let text = end_data.SubstringData(0, end_offset);
|
||||
clone
|
||||
|
@ -785,20 +779,14 @@ impl RangeMethods for Range {
|
|||
end_data.ReplaceData(0, end_offset, DOMString::new())?;
|
||||
} else {
|
||||
// Step 19.1.
|
||||
let clone = child.CloneNode(/* deep */ false, CanGc::note())?;
|
||||
let clone = child.CloneNode(/* deep */ false, can_gc)?;
|
||||
// Step 19.2.
|
||||
fragment.upcast::<Node>().AppendChild(&clone)?;
|
||||
// Step 19.3.
|
||||
let subrange = Range::new(
|
||||
&clone.owner_doc(),
|
||||
&child,
|
||||
0,
|
||||
&end_node,
|
||||
end_offset,
|
||||
CanGc::note(),
|
||||
);
|
||||
let subrange =
|
||||
Range::new(&clone.owner_doc(), &child, 0, &end_node, end_offset, can_gc);
|
||||
// Step 19.4.
|
||||
let subfragment = subrange.ExtractContents(CanGc::note())?;
|
||||
let subfragment = subrange.ExtractContents(can_gc)?;
|
||||
// Step 19.5.
|
||||
clone.AppendChild(subfragment.upcast())?;
|
||||
}
|
||||
|
|
|
@ -383,7 +383,8 @@ impl RequestMethods for Request {
|
|||
// Step 31
|
||||
// "or_init" looks unclear here, but it always enters the block since r
|
||||
// hasn't had any other way to initialize its headers
|
||||
r.headers.or_init(|| Headers::for_request(&r.global()));
|
||||
r.headers
|
||||
.or_init(|| Headers::for_request(&r.global(), CanGc::note()));
|
||||
|
||||
// Step 33 - but spec says this should only be when non-empty init?
|
||||
let headers_copy = init
|
||||
|
@ -536,7 +537,8 @@ impl RequestMethods for Request {
|
|||
|
||||
// https://fetch.spec.whatwg.org/#dom-request-headers
|
||||
fn Headers(&self) -> DomRoot<Headers> {
|
||||
self.headers.or_init(|| Headers::new(&self.global()))
|
||||
self.headers
|
||||
.or_init(|| Headers::new(&self.global(), CanGc::note()))
|
||||
}
|
||||
|
||||
// https://fetch.spec.whatwg.org/#dom-request-destination
|
||||
|
|
|
@ -302,7 +302,7 @@ impl ResponseMethods for Response {
|
|||
// https://fetch.spec.whatwg.org/#dom-response-headers
|
||||
fn Headers(&self) -> DomRoot<Headers> {
|
||||
self.headers_reflector
|
||||
.or_init(|| Headers::for_response(&self.global()))
|
||||
.or_init(|| Headers::for_response(&self.global(), CanGc::note()))
|
||||
}
|
||||
|
||||
// https://fetch.spec.whatwg.org/#dom-response-clone
|
||||
|
|
|
@ -117,6 +117,7 @@ impl RTCDataChannel {
|
|||
atom!("open"),
|
||||
EventBubbles::DoesNotBubble,
|
||||
EventCancelable::NotCancelable,
|
||||
CanGc::note(),
|
||||
);
|
||||
event.upcast::<Event>().fire(self.upcast());
|
||||
}
|
||||
|
@ -127,6 +128,7 @@ impl RTCDataChannel {
|
|||
atom!("close"),
|
||||
EventBubbles::DoesNotBubble,
|
||||
EventCancelable::NotCancelable,
|
||||
CanGc::note(),
|
||||
);
|
||||
event.upcast::<Event>().fire(self.upcast());
|
||||
|
||||
|
@ -134,7 +136,7 @@ impl RTCDataChannel {
|
|||
.unregister_data_channel(&self.servo_media_id);
|
||||
}
|
||||
|
||||
pub fn on_error(&self, error: WebRtcError) {
|
||||
pub fn on_error(&self, error: WebRtcError, can_gc: CanGc) {
|
||||
let global = self.global();
|
||||
let cx = GlobalScope::get_cx();
|
||||
let _ac = JSAutoRealm::new(*cx, self.reflector().get_jsobject().get());
|
||||
|
@ -150,7 +152,7 @@ impl RTCDataChannel {
|
|||
WebRtcError::Backend(message) => DOMString::from(message),
|
||||
};
|
||||
let error = RTCError::new(&global, &init, message);
|
||||
let event = RTCErrorEvent::new(&global, atom!("error"), false, false, &error);
|
||||
let event = RTCErrorEvent::new(&global, atom!("error"), false, false, &error, can_gc);
|
||||
event.upcast::<Event>().fire(self.upcast());
|
||||
}
|
||||
|
||||
|
@ -201,13 +203,14 @@ impl RTCDataChannel {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn on_state_change(&self, state: DataChannelState) {
|
||||
pub fn on_state_change(&self, state: DataChannelState, can_gc: CanGc) {
|
||||
if let DataChannelState::Closing = state {
|
||||
let event = Event::new(
|
||||
&self.global(),
|
||||
atom!("closing"),
|
||||
EventBubbles::DoesNotBubble,
|
||||
EventCancelable::NotCancelable,
|
||||
can_gc,
|
||||
);
|
||||
event.upcast::<Event>().fire(self.upcast());
|
||||
};
|
||||
|
|
|
@ -40,16 +40,9 @@ impl RTCErrorEvent {
|
|||
bubbles: bool,
|
||||
cancelable: bool,
|
||||
error: &RTCError,
|
||||
can_gc: CanGc,
|
||||
) -> DomRoot<RTCErrorEvent> {
|
||||
Self::new_with_proto(
|
||||
global,
|
||||
None,
|
||||
type_,
|
||||
bubbles,
|
||||
cancelable,
|
||||
error,
|
||||
CanGc::note(),
|
||||
)
|
||||
Self::new_with_proto(global, None, type_, bubbles, cancelable, error, can_gc)
|
||||
}
|
||||
|
||||
fn new_with_proto(
|
||||
|
|
|
@ -279,6 +279,7 @@ impl RTCPeerConnection {
|
|||
atom!("negotiationneeded"),
|
||||
EventBubbles::DoesNotBubble,
|
||||
EventCancelable::NotCancelable,
|
||||
CanGc::note(),
|
||||
);
|
||||
event.upcast::<Event>().fire(self.upcast());
|
||||
}
|
||||
|
@ -335,9 +336,9 @@ impl RTCPeerConnection {
|
|||
match event {
|
||||
DataChannelEvent::Open => channel.on_open(),
|
||||
DataChannelEvent::Close => channel.on_close(),
|
||||
DataChannelEvent::Error(error) => channel.on_error(error),
|
||||
DataChannelEvent::Error(error) => channel.on_error(error, can_gc),
|
||||
DataChannelEvent::OnMessage(message) => channel.on_message(message, can_gc),
|
||||
DataChannelEvent::StateChange(state) => channel.on_state_change(state),
|
||||
DataChannelEvent::StateChange(state) => channel.on_state_change(state, can_gc),
|
||||
DataChannelEvent::NewChannel => unreachable!(),
|
||||
}
|
||||
},
|
||||
|
@ -383,6 +384,7 @@ impl RTCPeerConnection {
|
|||
atom!("icegatheringstatechange"),
|
||||
EventBubbles::DoesNotBubble,
|
||||
EventCancelable::NotCancelable,
|
||||
CanGc::note(),
|
||||
);
|
||||
event.upcast::<Event>().fire(self.upcast());
|
||||
|
||||
|
@ -423,6 +425,7 @@ impl RTCPeerConnection {
|
|||
atom!("iceconnectionstatechange"),
|
||||
EventBubbles::DoesNotBubble,
|
||||
EventCancelable::NotCancelable,
|
||||
CanGc::note(),
|
||||
);
|
||||
event.upcast::<Event>().fire(self.upcast());
|
||||
}
|
||||
|
@ -445,6 +448,7 @@ impl RTCPeerConnection {
|
|||
atom!("signalingstatechange"),
|
||||
EventBubbles::DoesNotBubble,
|
||||
EventCancelable::NotCancelable,
|
||||
CanGc::note(),
|
||||
);
|
||||
event.upcast::<Event>().fire(self.upcast());
|
||||
}
|
||||
|
@ -761,7 +765,7 @@ impl RTCPeerConnectionMethods for RTCPeerConnection {
|
|||
|
||||
// Step 6
|
||||
for (_, val) in self.data_channels.borrow().iter() {
|
||||
val.on_state_change(DataChannelState::Closed);
|
||||
val.on_state_change(DataChannelState::Closed, CanGc::note());
|
||||
}
|
||||
|
||||
// Step 7-10
|
||||
|
|
|
@ -241,7 +241,7 @@ impl ServoParser {
|
|||
)),
|
||||
ParserKind::Normal,
|
||||
);
|
||||
parser.parse_complete_string_chunk(String::from(input), CanGc::note());
|
||||
parser.parse_complete_string_chunk(String::from(input), can_gc);
|
||||
|
||||
// Step 14.
|
||||
let root_element = document.GetDocumentElement().expect("no document element");
|
||||
|
@ -637,8 +637,7 @@ impl ServoParser {
|
|||
|
||||
// Steps 3-12 are in another castle, namely finish_load.
|
||||
let url = self.tokenizer.url().clone();
|
||||
self.document
|
||||
.finish_load(LoadType::PageSource(url), CanGc::note());
|
||||
self.document.finish_load(LoadType::PageSource(url), can_gc);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1030,6 +1030,7 @@ impl XMLHttpRequest {
|
|||
atom!("readystatechange"),
|
||||
EventBubbles::DoesNotBubble,
|
||||
EventCancelable::Cancelable,
|
||||
CanGc::note(),
|
||||
);
|
||||
event.fire(self.upcast());
|
||||
}
|
||||
|
@ -1173,6 +1174,7 @@ impl XMLHttpRequest {
|
|||
atom!("readystatechange"),
|
||||
EventBubbles::DoesNotBubble,
|
||||
EventCancelable::Cancelable,
|
||||
CanGc::note(),
|
||||
);
|
||||
event.fire(self.upcast());
|
||||
return_if_fetch_was_terminated!();
|
||||
|
|
|
@ -2005,7 +2005,9 @@ impl ScriptThread {
|
|||
FromScript(inner_msg) => self.handle_msg_from_script(inner_msg),
|
||||
FromDevtools(inner_msg) => self.handle_msg_from_devtools(inner_msg),
|
||||
FromImageCache(inner_msg) => self.handle_msg_from_image_cache(inner_msg),
|
||||
FromWebGPUServer(inner_msg) => self.handle_msg_from_webgpu_server(inner_msg),
|
||||
FromWebGPUServer(inner_msg) => {
|
||||
self.handle_msg_from_webgpu_server(inner_msg, can_gc)
|
||||
},
|
||||
}
|
||||
|
||||
None
|
||||
|
@ -2025,7 +2027,7 @@ impl ScriptThread {
|
|||
let mut docs = self.docs_with_no_blocking_loads.borrow_mut();
|
||||
for document in docs.iter() {
|
||||
let _realm = enter_realm(&**document);
|
||||
document.maybe_queue_document_completion();
|
||||
document.maybe_queue_document_completion(can_gc);
|
||||
|
||||
// Document load is a rendering opportunity.
|
||||
ScriptThread::note_rendering_opportunity(document.window().pipeline_id());
|
||||
|
@ -2473,7 +2475,7 @@ impl ScriptThread {
|
|||
window.layout_mut().set_epoch_paint_time(epoch, time);
|
||||
}
|
||||
|
||||
fn handle_msg_from_webgpu_server(&self, msg: WebGPUMsg) {
|
||||
fn handle_msg_from_webgpu_server(&self, msg: WebGPUMsg, can_gc: CanGc) {
|
||||
match msg {
|
||||
WebGPUMsg::FreeAdapter(id) => self.gpu_id_hub.free_adapter_id(id),
|
||||
WebGPUMsg::FreeDevice {
|
||||
|
@ -2518,7 +2520,7 @@ impl ScriptThread {
|
|||
} => {
|
||||
let global = self.documents.borrow().find_global(pipeline_id).unwrap();
|
||||
let _ac = enter_realm(&*global);
|
||||
global.handle_uncaptured_gpu_error(device, error);
|
||||
global.handle_uncaptured_gpu_error(device, error, can_gc);
|
||||
},
|
||||
_ => {},
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue