Remove global argument from Promise::new_in_current_realm.

This commit is contained in:
Josh Matthews 2023-02-16 23:22:01 -05:00
parent f79e1e327d
commit fca5833e21
30 changed files with 54 additions and 56 deletions

View file

@ -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() {

View file

@ -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 {

View file

@ -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();

View file

@ -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();

View file

@ -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);

View file

@ -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

View file

@ -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,

View file

@ -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) {

View file

@ -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.

View file

@ -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
});

View file

@ -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")));

View file

@ -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;

View file

@ -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,

View file

@ -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() {

View file

@ -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 {

View file

@ -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);

View file

@ -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.

View file

@ -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.

View file

@ -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();

View file

@ -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;

View file

@ -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))
},
};

View file

@ -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());

View file

@ -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());

View file

@ -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

View file

@ -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) {}

View file

@ -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) {

View file

@ -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

View file

@ -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() {

View file

@ -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

View file

@ -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);
},