diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2019-06-02 14:41:20 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-06-02 14:41:20 -0400 |
commit | 03f223663f1c0bc7432f0f47b533fb41c0226eb1 (patch) | |
tree | c17adc3c51a757f7d84f5f0ae4e930d8e087acbc /components/script/dom/rtcpeerconnection.rs | |
parent | 31ee17e9e1c6012fd512f594c27abb44fe927ec4 (diff) | |
parent | b7e10a82247545c2f9894e9fb61540caf0b7f157 (diff) | |
download | servo-03f223663f1c0bc7432f0f47b533fb41c0226eb1.tar.gz servo-03f223663f1c0bc7432f0f47b533fb41c0226eb1.zip |
Auto merge of #23459 - Eijebong:compartments, r=jdm
Add an inCompartments config option for bindings
Fixes #23257
<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/23459)
<!-- Reviewable:end -->
Diffstat (limited to 'components/script/dom/rtcpeerconnection.rs')
-rw-r--r-- | components/script/dom/rtcpeerconnection.rs | 50 |
1 files changed, 19 insertions, 31 deletions
diff --git a/components/script/dom/rtcpeerconnection.rs b/components/script/dom/rtcpeerconnection.rs index 9ec1940bbb3..2997698e309 100644 --- a/components/script/dom/rtcpeerconnection.rs +++ b/components/script/dom/rtcpeerconnection.rs @@ -2,7 +2,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -use crate::compartments::{AlreadyInCompartment, InCompartment}; +use crate::compartments::InCompartment; use crate::dom::bindings::cell::DomRefCell; use crate::dom::bindings::codegen::Bindings::RTCIceCandidateBinding::RTCIceCandidateInit; use crate::dom::bindings::codegen::Bindings::RTCPeerConnectionBinding; @@ -453,12 +453,8 @@ impl RTCPeerConnectionMethods for RTCPeerConnection { ); /// https://w3c.github.io/webrtc-pc/#dom-rtcpeerconnection-addicecandidate - fn AddIceCandidate(&self, candidate: &RTCIceCandidateInit) -> Rc<Promise> { - let in_compartment_proof = AlreadyInCompartment::assert(&self.global()); - let p = Promise::new_in_current_compartment( - &self.global(), - InCompartment::Already(&in_compartment_proof), - ); + fn AddIceCandidate(&self, candidate: &RTCIceCandidateInit, comp: InCompartment) -> Rc<Promise> { + let p = Promise::new_in_current_compartment(&self.global(), comp); if candidate.sdpMid.is_none() && candidate.sdpMLineIndex.is_none() { p.reject_error(Error::Type(format!( "one of sdpMid and sdpMLineIndex must be set" @@ -492,12 +488,8 @@ impl RTCPeerConnectionMethods for RTCPeerConnection { } /// https://w3c.github.io/webrtc-pc/#dom-rtcpeerconnection-createoffer - fn CreateOffer(&self, _options: &RTCOfferOptions) -> Rc<Promise> { - let in_compartment_proof = AlreadyInCompartment::assert(&self.global()); - let p = Promise::new_in_current_compartment( - &self.global(), - InCompartment::Already(&in_compartment_proof), - ); + fn CreateOffer(&self, _options: &RTCOfferOptions, comp: InCompartment) -> Rc<Promise> { + let p = Promise::new_in_current_compartment(&self.global(), comp); if self.closed.get() { p.reject_error(Error::InvalidState); return p; @@ -508,12 +500,8 @@ impl RTCPeerConnectionMethods for RTCPeerConnection { } /// https://w3c.github.io/webrtc-pc/#dom-rtcpeerconnection-createoffer - fn CreateAnswer(&self, _options: &RTCAnswerOptions) -> Rc<Promise> { - let in_compartment_proof = AlreadyInCompartment::assert(&self.global()); - let p = Promise::new_in_current_compartment( - &self.global(), - InCompartment::Already(&in_compartment_proof), - ); + fn CreateAnswer(&self, _options: &RTCAnswerOptions, comp: InCompartment) -> Rc<Promise> { + let p = Promise::new_in_current_compartment(&self.global(), comp); if self.closed.get() { p.reject_error(Error::InvalidState); return p; @@ -534,13 +522,13 @@ impl RTCPeerConnectionMethods for RTCPeerConnection { } /// https://w3c.github.io/webrtc-pc/#dom-rtcpeerconnection-setlocaldescription - fn SetLocalDescription(&self, desc: &RTCSessionDescriptionInit) -> Rc<Promise> { + fn SetLocalDescription( + &self, + desc: &RTCSessionDescriptionInit, + comp: InCompartment, + ) -> Rc<Promise> { // XXXManishearth validate the current state - let in_compartment_proof = AlreadyInCompartment::assert(&self.global()); - let p = Promise::new_in_current_compartment( - &self.global(), - InCompartment::Already(&in_compartment_proof), - ); + let p = Promise::new_in_current_compartment(&self.global(), comp); let this = Trusted::new(self); let desc: SessionDescription = desc.into(); let trusted_promise = TrustedPromise::new(p.clone()); @@ -571,13 +559,13 @@ impl RTCPeerConnectionMethods for RTCPeerConnection { } /// https://w3c.github.io/webrtc-pc/#dom-rtcpeerconnection-setremotedescription - fn SetRemoteDescription(&self, desc: &RTCSessionDescriptionInit) -> Rc<Promise> { + fn SetRemoteDescription( + &self, + desc: &RTCSessionDescriptionInit, + comp: InCompartment, + ) -> Rc<Promise> { // XXXManishearth validate the current state - let in_compartment_proof = AlreadyInCompartment::assert(&self.global()); - let p = Promise::new_in_current_compartment( - &self.global(), - InCompartment::Already(&in_compartment_proof), - ); + let p = Promise::new_in_current_compartment(&self.global(), comp); let this = Trusted::new(self); let desc: SessionDescription = desc.into(); let trusted_promise = TrustedPromise::new(p.clone()); |