Add a realm

This commit is contained in:
Manish Goregaokar 2020-01-08 19:48:55 +05:30
parent f721113f8d
commit c89f79b132
2 changed files with 4 additions and 1 deletions

View file

@ -2,6 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use crate::compartments::enter_realm;
use crate::dom::bindings::codegen::Bindings::EventBinding::EventBinding::EventMethods; use crate::dom::bindings::codegen::Bindings::EventBinding::EventBinding::EventMethods;
use crate::dom::bindings::codegen::Bindings::XRInputSourcesChangeEventBinding::{ use crate::dom::bindings::codegen::Bindings::XRInputSourcesChangeEventBinding::{
self, XRInputSourcesChangeEventMethods, self, XRInputSourcesChangeEventMethods,
@ -62,7 +63,7 @@ impl XRInputSourcesChangeEvent {
let event = changeevent.upcast::<Event>(); let event = changeevent.upcast::<Event>();
event.init_event(type_, bubbles, cancelable); event.init_event(type_, bubbles, cancelable);
} }
let _ac = enter_realm(&*global);
let cx = global.get_cx(); let cx = global.get_cx();
unsafe { unsafe {
rooted!(in(*cx) let mut added_val = UndefinedValue()); rooted!(in(*cx) let mut added_val = UndefinedValue());

View file

@ -2,6 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use crate::compartments::enter_realm;
use crate::dom::bindings::codegen::Bindings::XRViewBinding::XREye; use crate::dom::bindings::codegen::Bindings::XRViewBinding::XREye;
use crate::dom::bindings::codegen::Bindings::XRViewerPoseBinding; use crate::dom::bindings::codegen::Bindings::XRViewerPoseBinding;
use crate::dom::bindings::codegen::Bindings::XRViewerPoseBinding::XRViewerPoseMethods; use crate::dom::bindings::codegen::Bindings::XRViewerPoseBinding::XRViewerPoseMethods;
@ -40,6 +41,7 @@ impl XRViewerPose {
session: &XRSession, session: &XRSession,
pose: ApiViewerPose, pose: ApiViewerPose,
) -> DomRoot<XRViewerPose> { ) -> DomRoot<XRViewerPose> {
let _ac = enter_realm(&*global);
rooted_vec!(let mut views); rooted_vec!(let mut views);
session.with_session(|s| match s.views() { session.with_session(|s| match s.views() {
Views::Inline => views.push(XRView::new( Views::Inline => views.push(XRView::new(