diff options
author | marmeladema <xademax@gmail.com> | 2019-07-22 01:09:24 +0100 |
---|---|---|
committer | marmeladema <xademax@gmail.com> | 2019-07-24 08:24:50 +0100 |
commit | 2c5d0a6ebc39ad263e2bbe623e357a11b4cec5aa (patch) | |
tree | c1c93f26ab047bb010d1781511a750a302cc5636 /components/script/dom/vrpose.rs | |
parent | 808fa65aef163879b82baddc4af0a5445f806c81 (diff) | |
download | servo-2c5d0a6ebc39ad263e2bbe623e357a11b4cec5aa.tar.gz servo-2c5d0a6ebc39ad263e2bbe623e357a11b4cec5aa.zip |
Convert CGTraitInterface to use safe JSContext instead of raw JSContext
Diffstat (limited to 'components/script/dom/vrpose.rs')
-rw-r--r-- | components/script/dom/vrpose.rs | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/components/script/dom/vrpose.rs b/components/script/dom/vrpose.rs index 90bca0956ee..898691a9679 100644 --- a/components/script/dom/vrpose.rs +++ b/components/script/dom/vrpose.rs @@ -7,6 +7,7 @@ use crate::dom::bindings::codegen::Bindings::VRPoseBinding::VRPoseMethods; use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector}; use crate::dom::bindings::root::DomRoot; use crate::dom::globalscope::GlobalScope; +use crate::script_runtime::JSContext as SafeJSContext; use dom_struct::dom_struct; use js::jsapi::{Heap, JSContext, JSObject}; use js::typedarray::{CreateWith, Float32Array}; @@ -131,39 +132,33 @@ impl VRPose { } impl VRPoseMethods for VRPose { - #[allow(unsafe_code)] // https://w3c.github.io/webvr/#dom-vrpose-position - unsafe fn GetPosition(&self, _cx: *mut JSContext) -> Option<NonNull<JSObject>> { + fn GetPosition(&self, _cx: SafeJSContext) -> Option<NonNull<JSObject>> { heap_to_option(&self.position) } - #[allow(unsafe_code)] // https://w3c.github.io/webvr/#dom-vrpose-linearvelocity - unsafe fn GetLinearVelocity(&self, _cx: *mut JSContext) -> Option<NonNull<JSObject>> { + fn GetLinearVelocity(&self, _cx: SafeJSContext) -> Option<NonNull<JSObject>> { heap_to_option(&self.linear_vel) } - #[allow(unsafe_code)] // https://w3c.github.io/webvr/#dom-vrpose-linearacceleration - unsafe fn GetLinearAcceleration(&self, _cx: *mut JSContext) -> Option<NonNull<JSObject>> { + fn GetLinearAcceleration(&self, _cx: SafeJSContext) -> Option<NonNull<JSObject>> { heap_to_option(&self.linear_acc) } - #[allow(unsafe_code)] // https://w3c.github.io/webvr/#dom-vrpose-orientation - unsafe fn GetOrientation(&self, _cx: *mut JSContext) -> Option<NonNull<JSObject>> { + fn GetOrientation(&self, _cx: SafeJSContext) -> Option<NonNull<JSObject>> { heap_to_option(&self.orientation) } - #[allow(unsafe_code)] // https://w3c.github.io/webvr/#dom-vrpose-angularvelocity - unsafe fn GetAngularVelocity(&self, _cx: *mut JSContext) -> Option<NonNull<JSObject>> { + fn GetAngularVelocity(&self, _cx: SafeJSContext) -> Option<NonNull<JSObject>> { heap_to_option(&self.angular_vel) } - #[allow(unsafe_code)] // https://w3c.github.io/webvr/#dom-vrpose-angularacceleration - unsafe fn GetAngularAcceleration(&self, _cx: *mut JSContext) -> Option<NonNull<JSObject>> { + fn GetAngularAcceleration(&self, _cx: SafeJSContext) -> Option<NonNull<JSObject>> { heap_to_option(&self.angular_acc) } } |