aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--components/script/dom/vrframedata.rs16
-rw-r--r--components/script/dom/xrview.rs7
2 files changed, 13 insertions, 10 deletions
diff --git a/components/script/dom/vrframedata.rs b/components/script/dom/vrframedata.rs
index ebd0c8cc24f..08acd74bb42 100644
--- a/components/script/dom/vrframedata.rs
+++ b/components/script/dom/vrframedata.rs
@@ -58,10 +58,12 @@ impl VRFrameData {
VRFrameDataBinding::Wrap,
);
let cx = global.get_cx();
- create_typed_array(cx, &matrix, &root.left_proj);
- create_typed_array(cx, &matrix, &root.left_view);
- create_typed_array(cx, &matrix, &root.right_proj);
- create_typed_array(cx, &matrix, &root.right_view);
+ unsafe {
+ create_typed_array(cx, &matrix, &root.left_proj);
+ create_typed_array(cx, &matrix, &root.left_view);
+ create_typed_array(cx, &matrix, &root.right_proj);
+ create_typed_array(cx, &matrix, &root.right_view);
+ }
root
}
@@ -73,11 +75,9 @@ impl VRFrameData {
/// FIXME(#22526) this should be in a better place
#[allow(unsafe_code)]
-pub fn create_typed_array(cx: *mut JSContext, src: &[f32], dst: &Heap<*mut JSObject>) {
+pub unsafe fn create_typed_array(cx: *mut JSContext, src: &[f32], dst: &Heap<*mut JSObject>) {
rooted!(in (cx) let mut array = ptr::null_mut::<JSObject>());
- unsafe {
- let _ = Float32Array::create(cx, CreateWith::Slice(src), array.handle_mut());
- }
+ let _ = Float32Array::create(cx, CreateWith::Slice(src), array.handle_mut());
(*dst).set(array.get());
}
diff --git a/components/script/dom/xrview.rs b/components/script/dom/xrview.rs
index 55975e5d8a0..59da37a144e 100644
--- a/components/script/dom/xrview.rs
+++ b/components/script/dom/xrview.rs
@@ -34,6 +34,7 @@ impl XRView {
}
}
+ #[allow(unsafe_code)]
pub fn new(
global: &GlobalScope,
session: &XRSession,
@@ -53,8 +54,10 @@ impl XRView {
};
let cx = global.get_cx();
- create_typed_array(cx, proj, &ret.proj);
- create_typed_array(cx, view, &ret.view);
+ unsafe {
+ create_typed_array(cx, proj, &ret.proj);
+ create_typed_array(cx, view, &ret.view);
+ }
ret
}