diff options
Diffstat (limited to 'components')
30 files changed, 54 insertions, 56 deletions
diff --git a/components/script/body.rs b/components/script/body.rs index b7436c3e5e0..4a028084bb8 100644 --- a/components/script/body.rs +++ b/components/script/body.rs @@ -721,7 +721,7 @@ pub fn consume_body<T: BodyMixin + DomObject>(object: &T, body_type: BodyType) - let global = object.global(); let in_realm_proof = AlreadyInRealm::assert(&global); let promise = - Promise::new_in_current_realm(&object.global(), InRealm::Already(&in_realm_proof)); + Promise::new_in_current_realm(InRealm::Already(&in_realm_proof)); // Step 1 if object.is_disturbed() || object.is_locked() { diff --git a/components/script/dom/audiocontext.rs b/components/script/dom/audiocontext.rs index 9a5160773f9..4f0d10285fa 100644 --- a/components/script/dom/audiocontext.rs +++ b/components/script/dom/audiocontext.rs @@ -132,7 +132,7 @@ impl AudioContextMethods for AudioContext { // https://webaudio.github.io/web-audio-api/#dom-audiocontext-suspend fn Suspend(&self, comp: InRealm) -> Rc<Promise> { // Step 1. - let promise = Promise::new_in_current_realm(&self.global(), comp); + let promise = Promise::new_in_current_realm(comp); // Step 2. if self.context.control_thread_state() == ProcessingState::Closed { @@ -193,7 +193,7 @@ impl AudioContextMethods for AudioContext { // https://webaudio.github.io/web-audio-api/#dom-audiocontext-close fn Close(&self, comp: InRealm) -> Rc<Promise> { // Step 1. - let promise = Promise::new_in_current_realm(&self.global(), comp); + let promise = Promise::new_in_current_realm(comp); // Step 2. if self.context.control_thread_state() == ProcessingState::Closed { diff --git a/components/script/dom/baseaudiocontext.rs b/components/script/dom/baseaudiocontext.rs index 42836dd61f0..ec7fcfc328e 100644 --- a/components/script/dom/baseaudiocontext.rs +++ b/components/script/dom/baseaudiocontext.rs @@ -284,7 +284,7 @@ impl BaseAudioContextMethods for BaseAudioContext { /// https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-resume fn Resume(&self, comp: InRealm) -> Rc<Promise> { // Step 1. - let promise = Promise::new_in_current_realm(&self.global(), comp); + let promise = Promise::new_in_current_realm(comp); // Step 2. if self.audio_context_impl.lock().unwrap().state() == ProcessingState::Closed { @@ -440,7 +440,7 @@ impl BaseAudioContextMethods for BaseAudioContext { comp: InRealm, ) -> Rc<Promise> { // Step 1. - let promise = Promise::new_in_current_realm(&self.global(), comp); + let promise = Promise::new_in_current_realm(comp); let global = self.global(); let window = global.as_window(); diff --git a/components/script/dom/blob.rs b/components/script/dom/blob.rs index 9845133c42c..451ced6efc3 100644 --- a/components/script/dom/blob.rs +++ b/components/script/dom/blob.rs @@ -239,7 +239,7 @@ impl BlobMethods for Blob { fn Text(&self) -> Rc<Promise> { let global = self.global(); let in_realm_proof = AlreadyInRealm::assert(&global); - let p = Promise::new_in_current_realm(&global, InRealm::Already(&in_realm_proof)); + let p = Promise::new_in_current_realm(InRealm::Already(&in_realm_proof)); let id = self.get_blob_url_id(); global.read_file_async( id, @@ -262,7 +262,7 @@ impl BlobMethods for Blob { fn ArrayBuffer(&self) -> Rc<Promise> { let global = self.global(); let in_realm_proof = AlreadyInRealm::assert(&global); - let p = Promise::new_in_current_realm(&global, InRealm::Already(&in_realm_proof)); + let p = Promise::new_in_current_realm(InRealm::Already(&in_realm_proof)); let id = self.get_blob_url_id(); diff --git a/components/script/dom/bluetooth.rs b/components/script/dom/bluetooth.rs index 2bdc636dc7a..51c69d48d03 100644 --- a/components/script/dom/bluetooth.rs +++ b/components/script/dom/bluetooth.rs @@ -288,7 +288,7 @@ where F: FnOnce(StringOrUnsignedLong) -> Fallible<UUID>, { let in_realm_proof = AlreadyInRealm::assert(&attribute.global()); - let p = Promise::new_in_current_realm(&attribute.global(), InRealm::Already(&in_realm_proof)); + let p = Promise::new_in_current_realm(InRealm::Already(&in_realm_proof)); let result_uuid = if let Some(u) = uuid { // Step 1. @@ -528,7 +528,7 @@ impl From<BluetoothError> for Error { impl BluetoothMethods for Bluetooth { // https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetooth-requestdevice fn RequestDevice(&self, option: &RequestDeviceOptions, comp: InRealm) -> Rc<Promise> { - let p = Promise::new_in_current_realm(&self.global(), comp); + let p = Promise::new_in_current_realm(comp); // Step 1. if (option.filters.is_some() && option.acceptAllDevices) || (option.filters.is_none() && !option.acceptAllDevices) @@ -546,7 +546,7 @@ impl BluetoothMethods for Bluetooth { // https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetooth-getavailability fn GetAvailability(&self, comp: InRealm) -> Rc<Promise> { - let p = Promise::new_in_current_realm(&self.global(), comp); + let p = Promise::new_in_current_realm(comp); // Step 1. We did not override the method // Step 2 - 3. in handle_response let sender = response_async(&p, self); diff --git a/components/script/dom/bluetoothdevice.rs b/components/script/dom/bluetoothdevice.rs index bff2e0871ff..2d96efb3e05 100644 --- a/components/script/dom/bluetoothdevice.rs +++ b/components/script/dom/bluetoothdevice.rs @@ -277,7 +277,7 @@ impl BluetoothDeviceMethods for BluetoothDevice { // https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothdevice-watchadvertisements fn WatchAdvertisements(&self, comp: InRealm) -> Rc<Promise> { - let p = Promise::new_in_current_realm(&self.global(), comp); + let p = Promise::new_in_current_realm(comp); let sender = response_async(&p, self); // TODO: Step 1. // Note: Steps 2 - 3 are implemented in components/bluetooth/lib.rs in watch_advertisements function diff --git a/components/script/dom/bluetoothremotegattcharacteristic.rs b/components/script/dom/bluetoothremotegattcharacteristic.rs index fd01653c84d..a3c4b826bd7 100644 --- a/components/script/dom/bluetoothremotegattcharacteristic.rs +++ b/components/script/dom/bluetoothremotegattcharacteristic.rs @@ -137,7 +137,7 @@ impl BluetoothRemoteGATTCharacteristicMethods for BluetoothRemoteGATTCharacteris // https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattcharacteristic-readvalue fn ReadValue(&self, comp: InRealm) -> Rc<Promise> { - let p = Promise::new_in_current_realm(&self.global(), comp); + let p = Promise::new_in_current_realm(comp); // Step 1. if uuid_is_blocklisted(self.uuid.as_ref(), Blocklist::Reads) { @@ -170,7 +170,7 @@ impl BluetoothRemoteGATTCharacteristicMethods for BluetoothRemoteGATTCharacteris // https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattcharacteristic-writevalue fn WriteValue(&self, value: ArrayBufferViewOrArrayBuffer, comp: InRealm) -> Rc<Promise> { - let p = Promise::new_in_current_realm(&self.global(), comp); + let p = Promise::new_in_current_realm(comp); // Step 1. if uuid_is_blocklisted(self.uuid.as_ref(), Blocklist::Writes) { @@ -221,7 +221,7 @@ impl BluetoothRemoteGATTCharacteristicMethods for BluetoothRemoteGATTCharacteris // https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattcharacteristic-startnotifications fn StartNotifications(&self, comp: InRealm) -> Rc<Promise> { - let p = Promise::new_in_current_realm(&self.global(), comp); + let p = Promise::new_in_current_realm(comp); // Step 1. if uuid_is_blocklisted(self.uuid.as_ref(), Blocklist::Reads) { @@ -258,7 +258,7 @@ impl BluetoothRemoteGATTCharacteristicMethods for BluetoothRemoteGATTCharacteris // https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattcharacteristic-stopnotifications fn StopNotifications(&self, comp: InRealm) -> Rc<Promise> { - let p = Promise::new_in_current_realm(&self.global(), comp); + let p = Promise::new_in_current_realm(comp); let sender = response_async(&p, self); // TODO: Step 3 - 4: Implement `active notification context set` for BluetoothRemoteGATTCharacteristic, diff --git a/components/script/dom/bluetoothremotegattdescriptor.rs b/components/script/dom/bluetoothremotegattdescriptor.rs index 39e298f923c..0e60170857e 100644 --- a/components/script/dom/bluetoothremotegattdescriptor.rs +++ b/components/script/dom/bluetoothremotegattdescriptor.rs @@ -93,7 +93,7 @@ impl BluetoothRemoteGATTDescriptorMethods for BluetoothRemoteGATTDescriptor { // https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattdescriptor-readvalue fn ReadValue(&self, comp: InRealm) -> Rc<Promise> { - let p = Promise::new_in_current_realm(&self.global(), comp); + let p = Promise::new_in_current_realm(comp); // Step 1. if uuid_is_blocklisted(self.uuid.as_ref(), Blocklist::Reads) { @@ -125,7 +125,7 @@ impl BluetoothRemoteGATTDescriptorMethods for BluetoothRemoteGATTDescriptor { // https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattdescriptor-writevalue fn WriteValue(&self, value: ArrayBufferViewOrArrayBuffer, comp: InRealm) -> Rc<Promise> { - let p = Promise::new_in_current_realm(&self.global(), comp); + let p = Promise::new_in_current_realm(comp); // Step 1. if uuid_is_blocklisted(self.uuid.as_ref(), Blocklist::Writes) { diff --git a/components/script/dom/bluetoothremotegattserver.rs b/components/script/dom/bluetoothremotegattserver.rs index 8a4f94fe35c..c5ffecb100b 100644 --- a/components/script/dom/bluetoothremotegattserver.rs +++ b/components/script/dom/bluetoothremotegattserver.rs @@ -71,7 +71,7 @@ impl BluetoothRemoteGATTServerMethods for BluetoothRemoteGATTServer { #[allow(unsafe_code)] fn Connect(&self, comp: InRealm) -> Rc<Promise> { // Step 1. - let p = Promise::new_in_current_realm(&self.global(), comp); + let p = Promise::new_in_current_realm(comp); let sender = response_async(&p, self); // TODO: Step 3: Check if the UA is currently using the Bluetooth system. diff --git a/components/script/dom/customelementregistry.rs b/components/script/dom/customelementregistry.rs index ddbefaf6783..153b1d206fc 100644 --- a/components/script/dom/customelementregistry.rs +++ b/components/script/dom/customelementregistry.rs @@ -428,7 +428,7 @@ impl CustomElementRegistryMethods for CustomElementRegistry { // Step 1 if !is_valid_custom_element_name(&name) { - let promise = Promise::new_in_current_realm(&global_scope, comp); + let promise = Promise::new_in_current_realm(comp); promise.reject_native(&DOMException::new(&global_scope, DOMErrorName::SyntaxError)); return promise; } @@ -441,7 +441,7 @@ impl CustomElementRegistryMethods for CustomElementRegistry { definition .constructor .to_jsval(*cx, constructor.handle_mut()); - let promise = Promise::new_in_current_realm(&global_scope, comp); + let promise = Promise::new_in_current_realm(comp); promise.resolve_native(&constructor.get()); return promise; } @@ -452,7 +452,7 @@ impl CustomElementRegistryMethods for CustomElementRegistry { // Steps 4, 5 let promise = map.get(&name).cloned().unwrap_or_else(|| { - let promise = Promise::new_in_current_realm(&global_scope, comp); + let promise = Promise::new_in_current_realm(comp); map.insert(name, promise.clone()); promise }); diff --git a/components/script/dom/document.rs b/components/script/dom/document.rs index f636e11fc51..a8152ae6c0f 100644 --- a/components/script/dom/document.rs +++ b/components/script/dom/document.rs @@ -3575,7 +3575,7 @@ impl Document { // Step 1 let in_realm_proof = AlreadyInRealm::assert(&self.global()); let promise = - Promise::new_in_current_realm(&self.global(), InRealm::Already(&in_realm_proof)); + Promise::new_in_current_realm(InRealm::Already(&in_realm_proof)); let mut error = false; // Step 4 @@ -3643,7 +3643,7 @@ impl Document { let global = self.global(); // Step 1 let in_realm_proof = AlreadyInRealm::assert(&global); - let promise = Promise::new_in_current_realm(&global, InRealm::Already(&in_realm_proof)); + let promise = Promise::new_in_current_realm(InRealm::Already(&in_realm_proof)); // Step 2 if self.fullscreen_element.get().is_none() { promise.reject_error(Error::Type(String::from("fullscreen is null"))); diff --git a/components/script/dom/globalscope.rs b/components/script/dom/globalscope.rs index 9adc6f3213d..ea8a5616b49 100644 --- a/components/script/dom/globalscope.rs +++ b/components/script/dom/globalscope.rs @@ -2734,7 +2734,7 @@ impl GlobalScope { options: &ImageBitmapOptions, ) -> Rc<Promise> { let in_realm_proof = AlreadyInRealm::assert(&self); - let p = Promise::new_in_current_realm(&self, InRealm::Already(&in_realm_proof)); + let p = Promise::new_in_current_realm(InRealm::Already(&in_realm_proof)); if options.resizeWidth.map_or(false, |w| w == 0) { p.reject_error(Error::InvalidState); return p; diff --git a/components/script/dom/gpu.rs b/components/script/dom/gpu.rs index eea21c1b988..8fe003f2fcd 100644 --- a/components/script/dom/gpu.rs +++ b/components/script/dom/gpu.rs @@ -100,7 +100,7 @@ impl GPUMethods for GPU { // https://gpuweb.github.io/gpuweb/#dom-gpu-requestadapter fn RequestAdapter(&self, options: &GPURequestAdapterOptions, comp: InRealm) -> Rc<Promise> { let global = &self.global(); - let promise = Promise::new_in_current_realm(global, comp); + let promise = Promise::new_in_current_realm(comp); let sender = response_async(&promise, self); let power_preference = match options.powerPreference { Some(GPUPowerPreference::Low_power) => PowerPreference::LowPower, diff --git a/components/script/dom/gpuadapter.rs b/components/script/dom/gpuadapter.rs index e4876416952..ce82e4ec4a3 100644 --- a/components/script/dom/gpuadapter.rs +++ b/components/script/dom/gpuadapter.rs @@ -78,7 +78,7 @@ impl GPUAdapterMethods for GPUAdapter { /// https://gpuweb.github.io/gpuweb/#dom-gpuadapter-requestdevice fn RequestDevice(&self, descriptor: &GPUDeviceDescriptor, comp: InRealm) -> Rc<Promise> { - let promise = Promise::new_in_current_realm(&self.global(), comp); + let promise = Promise::new_in_current_realm(comp); let sender = response_async(&promise, self); let mut features = wgt::Features::empty(); for &ext in descriptor.extensions.iter() { diff --git a/components/script/dom/gpubuffer.rs b/components/script/dom/gpubuffer.rs index 24eeb06b33d..83dd27b47d9 100644 --- a/components/script/dom/gpubuffer.rs +++ b/components/script/dom/gpubuffer.rs @@ -6,7 +6,6 @@ use crate::dom::bindings::cell::DomRefCell; use crate::dom::bindings::codegen::Bindings::GPUBufferBinding::{GPUBufferMethods, GPUSize64}; use crate::dom::bindings::codegen::Bindings::GPUMapModeBinding::GPUMapModeConstants; use crate::dom::bindings::error::{Error, Fallible}; -use crate::dom::bindings::reflector::DomObject; use crate::dom::bindings::reflector::{reflect_dom_object, Reflector}; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::bindings::str::USVString; @@ -209,7 +208,7 @@ impl GPUBufferMethods for GPUBuffer { size: Option<GPUSize64>, comp: InRealm, ) -> Rc<Promise> { - let promise = Promise::new_in_current_realm(&self.global(), comp); + let promise = Promise::new_in_current_realm(comp); let range_size = if let Some(s) = size { s } else if offset >= self.size { diff --git a/components/script/dom/gpudevice.rs b/components/script/dom/gpudevice.rs index fb6fad7efb4..5ea21eac5de 100644 --- a/components/script/dom/gpudevice.rs +++ b/components/script/dom/gpudevice.rs @@ -357,7 +357,7 @@ impl GPUDeviceMethods for GPUDevice { /// https://gpuweb.github.io/gpuweb/#dom-gpudevice-lost fn Lost(&self, comp: InRealm) -> Rc<Promise> { - let promise = Promise::new_in_current_realm(&self.global(), comp); + let promise = Promise::new_in_current_realm(comp); *self.lost_promise.borrow_mut() = Some(promise.clone()); promise } @@ -1117,7 +1117,7 @@ impl GPUDeviceMethods for GPUDevice { /// https://gpuweb.github.io/gpuweb/#dom-gpudevice-poperrorscope fn PopErrorScope(&self, comp: InRealm) -> Rc<Promise> { let mut context = self.scope_context.borrow_mut(); - let promise = Promise::new_in_current_realm(&self.global(), comp); + let promise = Promise::new_in_current_realm(comp); let scope_id = if let Some(meta) = context.scope_stack.iter().rev().find(|m| !m.popped.get()) { meta.popped.set(true); diff --git a/components/script/dom/htmlmediaelement.rs b/components/script/dom/htmlmediaelement.rs index f5043cac0ea..515ead5c228 100644 --- a/components/script/dom/htmlmediaelement.rs +++ b/components/script/dom/htmlmediaelement.rs @@ -2112,7 +2112,7 @@ impl HTMLMediaElementMethods for HTMLMediaElement { // https://html.spec.whatwg.org/multipage/#dom-media-play fn Play(&self, comp: InRealm) -> Rc<Promise> { - let promise = Promise::new_in_current_realm(&self.global(), comp); + let promise = Promise::new_in_current_realm(comp); // Step 1. // FIXME(nox): Reject promise if not allowed to play. diff --git a/components/script/dom/mediadevices.rs b/components/script/dom/mediadevices.rs index b1f00a154be..e6e30256147 100644 --- a/components/script/dom/mediadevices.rs +++ b/components/script/dom/mediadevices.rs @@ -44,7 +44,7 @@ impl MediaDevicesMethods for MediaDevices { /// https://w3c.github.io/mediacapture-main/#dom-mediadevices-getusermedia #[allow(unsafe_code)] fn GetUserMedia(&self, constraints: &MediaStreamConstraints, comp: InRealm) -> Rc<Promise> { - let p = Promise::new_in_current_realm(&self.global(), comp); + let p = Promise::new_in_current_realm(comp); let media = ServoMedia::get().unwrap(); let stream = MediaStream::new(&self.global()); if let Some(constraints) = convert_constraints(&constraints.audio) { @@ -69,7 +69,7 @@ impl MediaDevicesMethods for MediaDevices { // Step 1. let global = self.global(); let in_realm_proof = AlreadyInRealm::assert(&global); - let p = Promise::new_in_current_realm(&global, InRealm::Already(&in_realm_proof)); + let p = Promise::new_in_current_realm(InRealm::Already(&in_realm_proof)); // Step 2. // XXX These steps should be run in parallel. diff --git a/components/script/dom/navigationpreloadmanager.rs b/components/script/dom/navigationpreloadmanager.rs index d45fa9ac5f8..c8d74403fcd 100644 --- a/components/script/dom/navigationpreloadmanager.rs +++ b/components/script/dom/navigationpreloadmanager.rs @@ -43,7 +43,7 @@ impl NavigationPreloadManager { impl NavigationPreloadManagerMethods for NavigationPreloadManager { // https://w3c.github.io/ServiceWorker/#navigation-preload-manager-enable fn Enable(&self, comp: InRealm) -> Rc<Promise> { - let promise = Promise::new_in_current_realm(&*self.global(), comp); + let promise = Promise::new_in_current_realm(comp); // 2. if self.serviceworker_registration.is_active() { @@ -65,7 +65,7 @@ impl NavigationPreloadManagerMethods for NavigationPreloadManager { // https://w3c.github.io/ServiceWorker/#navigation-preload-manager-disable fn Disable(&self, comp: InRealm) -> Rc<Promise> { - let promise = Promise::new_in_current_realm(&*self.global(), comp); + let promise = Promise::new_in_current_realm(comp); // 2. if self.serviceworker_registration.is_active() { @@ -87,7 +87,7 @@ impl NavigationPreloadManagerMethods for NavigationPreloadManager { // https://w3c.github.io/ServiceWorker/#navigation-preload-manager-setheadervalue fn SetHeaderValue(&self, value: ByteString, comp: InRealm) -> Rc<Promise> { - let promise = Promise::new_in_current_realm(&*self.global(), comp); + let promise = Promise::new_in_current_realm(comp); // 2. if self.serviceworker_registration.is_active() { @@ -109,7 +109,7 @@ impl NavigationPreloadManagerMethods for NavigationPreloadManager { // https://w3c.github.io/ServiceWorker/#navigation-preload-manager-getstate fn GetState(&self, comp: InRealm) -> Rc<Promise> { - let promise = Promise::new_in_current_realm(&*self.global(), comp); + let promise = Promise::new_in_current_realm(comp); // 2. let mut state = NavigationPreloadState::empty(); diff --git a/components/script/dom/offlineaudiocontext.rs b/components/script/dom/offlineaudiocontext.rs index 878bdedd314..798abe76f7d 100644 --- a/components/script/dom/offlineaudiocontext.rs +++ b/components/script/dom/offlineaudiocontext.rs @@ -121,7 +121,7 @@ impl OfflineAudioContextMethods for OfflineAudioContext { // https://webaudio.github.io/web-audio-api/#dom-offlineaudiocontext-startrendering fn StartRendering(&self, comp: InRealm) -> Rc<Promise> { - let promise = Promise::new_in_current_realm(&self.global(), comp); + let promise = Promise::new_in_current_realm(comp); if self.rendering_started.get() { promise.reject_error(Error::InvalidState); return promise; diff --git a/components/script/dom/permissions.rs b/components/script/dom/permissions.rs index b4e6bf8f5de..80cbfb41cb5 100644 --- a/components/script/dom/permissions.rs +++ b/components/script/dom/permissions.rs @@ -88,7 +88,7 @@ impl Permissions { Some(promise) => promise, None => { let in_realm_proof = AlreadyInRealm::assert(&self.global()); - Promise::new_in_current_realm(&self.global(), InRealm::Already(&in_realm_proof)) + Promise::new_in_current_realm(InRealm::Already(&in_realm_proof)) }, }; diff --git a/components/script/dom/promise.rs b/components/script/dom/promise.rs index d008a7b9d30..2ba29d20db6 100644 --- a/components/script/dom/promise.rs +++ b/components/script/dom/promise.rs @@ -88,10 +88,10 @@ impl Promise { pub fn new(global: &GlobalScope) -> Rc<Promise> { let realm = enter_realm(&*global); let comp = InRealm::Entered(&realm); - Promise::new_in_current_realm(global, comp) + Promise::new_in_current_realm(comp) } - pub fn new_in_current_realm(_global: &GlobalScope, _comp: InRealm) -> Rc<Promise> { + pub fn new_in_current_realm(_comp: InRealm) -> Rc<Promise> { let cx = GlobalScope::get_cx(); rooted!(in(*cx) let mut obj = ptr::null_mut::<JSObject>()); Promise::create_js_promise(cx, obj.handle_mut()); diff --git a/components/script/dom/rtcpeerconnection.rs b/components/script/dom/rtcpeerconnection.rs index 9fd651e5a16..2342dd6730e 100644 --- a/components/script/dom/rtcpeerconnection.rs +++ b/components/script/dom/rtcpeerconnection.rs @@ -548,7 +548,7 @@ impl RTCPeerConnectionMethods for RTCPeerConnection { /// 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(&self.global(), comp); + let p = Promise::new_in_current_realm(comp); if candidate.sdpMid.is_none() && candidate.sdpMLineIndex.is_none() { p.reject_error(Error::Type(format!( "one of sdpMid and sdpMLineIndex must be set" @@ -583,7 +583,7 @@ 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(&self.global(), comp); + let p = Promise::new_in_current_realm(comp); if self.closed.get() { p.reject_error(Error::InvalidState); return p; @@ -595,7 +595,7 @@ 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(&self.global(), comp); + let p = Promise::new_in_current_realm(comp); if self.closed.get() { p.reject_error(Error::InvalidState); return p; @@ -618,7 +618,7 @@ impl RTCPeerConnectionMethods for RTCPeerConnection { /// https://w3c.github.io/webrtc-pc/#dom-rtcpeerconnection-setlocaldescription fn SetLocalDescription(&self, desc: &RTCSessionDescriptionInit, comp: InRealm) -> Rc<Promise> { // XXXManishearth validate the current state - let p = Promise::new_in_current_realm(&self.global(), comp); + let p = Promise::new_in_current_realm(comp); let this = Trusted::new(self); let desc: SessionDescription = desc.into(); let trusted_promise = TrustedPromise::new(p.clone()); @@ -651,7 +651,7 @@ impl RTCPeerConnectionMethods for RTCPeerConnection { /// https://w3c.github.io/webrtc-pc/#dom-rtcpeerconnection-setremotedescription fn SetRemoteDescription(&self, desc: &RTCSessionDescriptionInit, comp: InRealm) -> Rc<Promise> { // XXXManishearth validate the current state - let p = Promise::new_in_current_realm(&self.global(), comp); + let p = Promise::new_in_current_realm(comp); let this = Trusted::new(self); let desc: SessionDescription = desc.into(); let trusted_promise = TrustedPromise::new(p.clone()); diff --git a/components/script/dom/serviceworkercontainer.rs b/components/script/dom/serviceworkercontainer.rs index b65dcd59b7d..b02b72e2c5b 100644 --- a/components/script/dom/serviceworkercontainer.rs +++ b/components/script/dom/serviceworkercontainer.rs @@ -70,7 +70,7 @@ impl ServiceWorkerContainerMethods for ServiceWorkerContainer { let global = self.client.global(); // A: Step 1 - let promise = Promise::new_in_current_realm(&*global, comp); + let promise = Promise::new_in_current_realm(comp); let USVString(ref script_url) = script_url; // A: Step 3 diff --git a/components/script/dom/testbinding.rs b/components/script/dom/testbinding.rs index 34c25c40449..b8d2fefc951 100644 --- a/components/script/dom/testbinding.rs +++ b/components/script/dom/testbinding.rs @@ -1005,7 +1005,7 @@ impl TestBindingMethods for TestBinding { resolve.map(SimpleHandler::new), reject.map(SimpleHandler::new), ); - let p = Promise::new_in_current_realm(&global, comp.clone()); + let p = Promise::new_in_current_realm(comp.clone()); p.append_native_handler(&handler, comp); return p; @@ -1028,7 +1028,7 @@ impl TestBindingMethods for TestBinding { } fn PromiseAttribute(&self, comp: InRealm) -> Rc<Promise> { - Promise::new_in_current_realm(&self.global(), comp) + Promise::new_in_current_realm(comp) } fn AcceptPromise(&self, _promise: &Promise) {} diff --git a/components/script/dom/worklet.rs b/components/script/dom/worklet.rs index d472696325a..7455e2a5775 100644 --- a/components/script/dom/worklet.rs +++ b/components/script/dom/worklet.rs @@ -130,8 +130,7 @@ impl WorkletMethods for Worklet { comp: InRealm, ) -> Rc<Promise> { // Step 1. - let global = self.window.upcast(); - let promise = Promise::new_in_current_realm(&global, comp); + let promise = Promise::new_in_current_realm(comp); // Step 3. let module_url_record = match self.window.Document().base_url().join(&module_url.0) { diff --git a/components/script/dom/xrsession.rs b/components/script/dom/xrsession.rs index 01b21379ce3..73f2bc4ce88 100644 --- a/components/script/dom/xrsession.rs +++ b/components/script/dom/xrsession.rs @@ -757,7 +757,7 @@ impl XRSessionMethods for XRSession { /// https://immersive-web.github.io/webxr/#dom-xrsession-requestreferencespace fn RequestReferenceSpace(&self, ty: XRReferenceSpaceType, comp: InRealm) -> Rc<Promise> { - let p = Promise::new_in_current_realm(&self.global(), comp); + let p = Promise::new_in_current_realm(comp); // https://immersive-web.github.io/webxr/#create-a-reference-space diff --git a/components/script/dom/xrsystem.rs b/components/script/dom/xrsystem.rs index 8cfeedbd283..15e4f9e65f4 100644 --- a/components/script/dom/xrsystem.rs +++ b/components/script/dom/xrsystem.rs @@ -159,7 +159,7 @@ impl XRSystemMethods for XRSystem { ) -> Rc<Promise> { let global = self.global(); let window = global.as_window(); - let promise = Promise::new_in_current_realm(&global, comp); + let promise = Promise::new_in_current_realm(comp); if mode != XRSessionMode::Inline { if !ScriptThread::is_user_interacting() { diff --git a/components/script/fetch.rs b/components/script/fetch.rs index 4889d6f138c..9487e7c8717 100644 --- a/components/script/fetch.rs +++ b/components/script/fetch.rs @@ -142,7 +142,7 @@ pub fn Fetch( let core_resource_thread = global.core_resource_thread(); // Step 1 - let promise = Promise::new_in_current_realm(global, comp); + let promise = Promise::new_in_current_realm(comp); let response = Response::new(global); // Step 2 diff --git a/components/script/script_module.rs b/components/script/script_module.rs index a237322f2e9..7dc5c13ab99 100644 --- a/components/script/script_module.rs +++ b/components/script/script_module.rs @@ -357,7 +357,7 @@ impl ModuleTree { match promise.as_ref() { Some(promise) => promise.append_native_handler(&handler, comp), None => { - let new_promise = Promise::new_in_current_realm(&owner.global(), comp); + let new_promise = Promise::new_in_current_realm(comp); new_promise.append_native_handler(&handler, comp); *promise = Some(new_promise); }, @@ -393,7 +393,7 @@ impl ModuleTree { match promise.as_ref() { Some(promise) => promise.append_native_handler(&handler, comp), None => { - let new_promise = Promise::new_in_current_realm(&owner.global(), comp); + let new_promise = Promise::new_in_current_realm(comp); new_promise.append_native_handler(&handler, comp); *promise = Some(new_promise); }, |