diff options
-rw-r--r-- | components/script/body.rs | 3 | ||||
-rw-r--r-- | components/script/dom/blob.rs | 4 | ||||
-rw-r--r-- | components/script/dom/bluetooth.rs | 2 | ||||
-rw-r--r-- | components/script/dom/document.rs | 4 | ||||
-rw-r--r-- | components/script/dom/globalscope.rs | 2 | ||||
-rw-r--r-- | components/script/dom/mediadevices.rs | 3 | ||||
-rw-r--r-- | components/script/dom/permissions.rs | 2 | ||||
-rw-r--r-- | components/script/realms.rs | 2 |
8 files changed, 10 insertions, 12 deletions
diff --git a/components/script/body.rs b/components/script/body.rs index 4a028084bb8..2d8bdc0687e 100644 --- a/components/script/body.rs +++ b/components/script/body.rs @@ -718,8 +718,7 @@ impl Callback for ConsumeBodyPromiseHandler { // https://fetch.spec.whatwg.org/#concept-body-consume-body #[allow(unrooted_must_root)] pub fn consume_body<T: BodyMixin + DomObject>(object: &T, body_type: BodyType) -> Rc<Promise> { - let global = object.global(); - let in_realm_proof = AlreadyInRealm::assert(&global); + let in_realm_proof = AlreadyInRealm::assert(); let promise = Promise::new_in_current_realm(InRealm::Already(&in_realm_proof)); diff --git a/components/script/dom/blob.rs b/components/script/dom/blob.rs index 451ced6efc3..4cc0149d008 100644 --- a/components/script/dom/blob.rs +++ b/components/script/dom/blob.rs @@ -238,7 +238,7 @@ impl BlobMethods for Blob { // https://w3c.github.io/FileAPI/#text-method-algo fn Text(&self) -> Rc<Promise> { let global = self.global(); - let in_realm_proof = AlreadyInRealm::assert(&global); + let in_realm_proof = AlreadyInRealm::assert(); let p = Promise::new_in_current_realm(InRealm::Already(&in_realm_proof)); let id = self.get_blob_url_id(); global.read_file_async( @@ -261,7 +261,7 @@ impl BlobMethods for Blob { // https://w3c.github.io/FileAPI/#arraybuffer-method-algo fn ArrayBuffer(&self) -> Rc<Promise> { let global = self.global(); - let in_realm_proof = AlreadyInRealm::assert(&global); + let in_realm_proof = AlreadyInRealm::assert(); 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 51c69d48d03..e2754af4043 100644 --- a/components/script/dom/bluetooth.rs +++ b/components/script/dom/bluetooth.rs @@ -287,7 +287,7 @@ where T: AsyncBluetoothListener + DomObject + 'static, F: FnOnce(StringOrUnsignedLong) -> Fallible<UUID>, { - let in_realm_proof = AlreadyInRealm::assert(&attribute.global()); + let in_realm_proof = AlreadyInRealm::assert(); let p = Promise::new_in_current_realm(InRealm::Already(&in_realm_proof)); let result_uuid = if let Some(u) = uuid { diff --git a/components/script/dom/document.rs b/components/script/dom/document.rs index a8152ae6c0f..ff9203118fb 100644 --- a/components/script/dom/document.rs +++ b/components/script/dom/document.rs @@ -3573,7 +3573,7 @@ impl Document { // https://fullscreen.spec.whatwg.org/#dom-element-requestfullscreen pub fn enter_fullscreen(&self, pending: &Element) -> Rc<Promise> { // Step 1 - let in_realm_proof = AlreadyInRealm::assert(&self.global()); + let in_realm_proof = AlreadyInRealm::assert(); let promise = Promise::new_in_current_realm(InRealm::Already(&in_realm_proof)); let mut error = false; @@ -3642,7 +3642,7 @@ impl Document { pub fn exit_fullscreen(&self) -> Rc<Promise> { let global = self.global(); // Step 1 - let in_realm_proof = AlreadyInRealm::assert(&global); + let in_realm_proof = AlreadyInRealm::assert(); let promise = Promise::new_in_current_realm(InRealm::Already(&in_realm_proof)); // Step 2 if self.fullscreen_element.get().is_none() { diff --git a/components/script/dom/globalscope.rs b/components/script/dom/globalscope.rs index ea8a5616b49..b03915997e5 100644 --- a/components/script/dom/globalscope.rs +++ b/components/script/dom/globalscope.rs @@ -2733,7 +2733,7 @@ impl GlobalScope { image: ImageBitmapSource, options: &ImageBitmapOptions, ) -> Rc<Promise> { - let in_realm_proof = AlreadyInRealm::assert(&self); + let in_realm_proof = AlreadyInRealm::assert(); 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); diff --git a/components/script/dom/mediadevices.rs b/components/script/dom/mediadevices.rs index e6e30256147..9a88ed2e3a2 100644 --- a/components/script/dom/mediadevices.rs +++ b/components/script/dom/mediadevices.rs @@ -67,8 +67,7 @@ impl MediaDevicesMethods for MediaDevices { /// https://w3c.github.io/mediacapture-main/#dom-mediadevices-enumeratedevices fn EnumerateDevices(&self) -> Rc<Promise> { // Step 1. - let global = self.global(); - let in_realm_proof = AlreadyInRealm::assert(&global); + let in_realm_proof = AlreadyInRealm::assert(); let p = Promise::new_in_current_realm(InRealm::Already(&in_realm_proof)); // Step 2. diff --git a/components/script/dom/permissions.rs b/components/script/dom/permissions.rs index 80cbfb41cb5..2d7cd549cc2 100644 --- a/components/script/dom/permissions.rs +++ b/components/script/dom/permissions.rs @@ -87,7 +87,7 @@ impl Permissions { let p = match promise { Some(promise) => promise, None => { - let in_realm_proof = AlreadyInRealm::assert(&self.global()); + let in_realm_proof = AlreadyInRealm::assert(); Promise::new_in_current_realm(InRealm::Already(&in_realm_proof)) }, }; diff --git a/components/script/realms.rs b/components/script/realms.rs index bc322a2fe6d..48b141aae56 100644 --- a/components/script/realms.rs +++ b/components/script/realms.rs @@ -11,7 +11,7 @@ pub struct AlreadyInRealm(()); impl AlreadyInRealm { #![allow(unsafe_code)] - pub fn assert(_global: &GlobalScope) -> AlreadyInRealm { + pub fn assert() -> AlreadyInRealm { unsafe { assert!(!GetCurrentRealmOrNull(*GlobalScope::get_cx()).is_null()); } |