mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Mark promise creation methods with CanGc (#33928)
* Add CanGc annotations to promise constructor. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Propagate CanGc arguments for Promise::new_in_current_realm. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Fix out-of-order entries. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Propagate CanGc from Promise::new. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Suppress clippy warning. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Formatting. Signed-off-by: Josh Matthews <josh@joshmatthews.net> --------- Signed-off-by: Josh Matthews <josh@joshmatthews.net>
This commit is contained in:
parent
edc304854f
commit
575e885529
50 changed files with 422 additions and 221 deletions
|
@ -583,8 +583,13 @@ impl RTCPeerConnectionMethods for RTCPeerConnection {
|
|||
event_handler!(datachannel, GetOndatachannel, SetOndatachannel);
|
||||
|
||||
/// <https://w3c.github.io/webrtc-pc/#dom-rtcpeerconnection-addicecandidate>
|
||||
fn AddIceCandidate(&self, candidate: &RTCIceCandidateInit, comp: InRealm) -> Rc<Promise> {
|
||||
let p = Promise::new_in_current_realm(comp);
|
||||
fn AddIceCandidate(
|
||||
&self,
|
||||
candidate: &RTCIceCandidateInit,
|
||||
comp: InRealm,
|
||||
can_gc: CanGc,
|
||||
) -> Rc<Promise> {
|
||||
let p = Promise::new_in_current_realm(comp, can_gc);
|
||||
if candidate.sdpMid.is_none() && candidate.sdpMLineIndex.is_none() {
|
||||
p.reject_error(Error::Type(
|
||||
"one of sdpMid and sdpMLineIndex must be set".to_string(),
|
||||
|
@ -618,8 +623,8 @@ impl RTCPeerConnectionMethods for RTCPeerConnection {
|
|||
}
|
||||
|
||||
/// <https://w3c.github.io/webrtc-pc/#dom-rtcpeerconnection-createoffer>
|
||||
fn CreateOffer(&self, _options: &RTCOfferOptions, comp: InRealm) -> Rc<Promise> {
|
||||
let p = Promise::new_in_current_realm(comp);
|
||||
fn CreateOffer(&self, _options: &RTCOfferOptions, comp: InRealm, can_gc: CanGc) -> Rc<Promise> {
|
||||
let p = Promise::new_in_current_realm(comp, can_gc);
|
||||
if self.closed.get() {
|
||||
p.reject_error(Error::InvalidState);
|
||||
return p;
|
||||
|
@ -630,8 +635,13 @@ impl RTCPeerConnectionMethods for RTCPeerConnection {
|
|||
}
|
||||
|
||||
/// <https://w3c.github.io/webrtc-pc/#dom-rtcpeerconnection-createoffer>
|
||||
fn CreateAnswer(&self, _options: &RTCAnswerOptions, comp: InRealm) -> Rc<Promise> {
|
||||
let p = Promise::new_in_current_realm(comp);
|
||||
fn CreateAnswer(
|
||||
&self,
|
||||
_options: &RTCAnswerOptions,
|
||||
comp: InRealm,
|
||||
can_gc: CanGc,
|
||||
) -> Rc<Promise> {
|
||||
let p = Promise::new_in_current_realm(comp, can_gc);
|
||||
if self.closed.get() {
|
||||
p.reject_error(Error::InvalidState);
|
||||
return p;
|
||||
|
@ -652,9 +662,14 @@ impl RTCPeerConnectionMethods for RTCPeerConnection {
|
|||
}
|
||||
|
||||
/// <https://w3c.github.io/webrtc-pc/#dom-rtcpeerconnection-setlocaldescription>
|
||||
fn SetLocalDescription(&self, desc: &RTCSessionDescriptionInit, comp: InRealm) -> Rc<Promise> {
|
||||
fn SetLocalDescription(
|
||||
&self,
|
||||
desc: &RTCSessionDescriptionInit,
|
||||
comp: InRealm,
|
||||
can_gc: CanGc,
|
||||
) -> Rc<Promise> {
|
||||
// XXXManishearth validate the current state
|
||||
let p = Promise::new_in_current_realm(comp);
|
||||
let p = Promise::new_in_current_realm(comp, can_gc);
|
||||
let this = Trusted::new(self);
|
||||
let desc: SessionDescription = desc.into();
|
||||
let trusted_promise = TrustedPromise::new(p.clone());
|
||||
|
@ -693,9 +708,14 @@ impl RTCPeerConnectionMethods for RTCPeerConnection {
|
|||
}
|
||||
|
||||
/// <https://w3c.github.io/webrtc-pc/#dom-rtcpeerconnection-setremotedescription>
|
||||
fn SetRemoteDescription(&self, desc: &RTCSessionDescriptionInit, comp: InRealm) -> Rc<Promise> {
|
||||
fn SetRemoteDescription(
|
||||
&self,
|
||||
desc: &RTCSessionDescriptionInit,
|
||||
comp: InRealm,
|
||||
can_gc: CanGc,
|
||||
) -> Rc<Promise> {
|
||||
// XXXManishearth validate the current state
|
||||
let p = Promise::new_in_current_realm(comp);
|
||||
let p = Promise::new_in_current_realm(comp, can_gc);
|
||||
let this = Trusted::new(self);
|
||||
let desc: SessionDescription = desc.into();
|
||||
let trusted_promise = TrustedPromise::new(p.clone());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue