Modify *::get_cx methods to return a safe JSContext instead of a raw one

This commit is contained in:
marmeladema 2019-07-22 22:14:11 +01:00
parent 2c5d0a6ebc
commit 88cacfb009
43 changed files with 306 additions and 321 deletions

View file

@ -119,10 +119,9 @@ impl XRRigidTransformMethods for XRRigidTransform {
})
}
// https://immersive-web.github.io/webxr/#dom-xrrigidtransform-matrix
#[allow(unsafe_code)]
fn Matrix(&self, _cx: JSContext) -> NonNull<JSObject> {
if self.matrix.get().is_null() {
let cx = unsafe { JSContext::from_ptr(self.global().get_cx()) };
let cx = self.global().get_cx();
// According to the spec all matrices are column-major,
// however euclid uses row vectors so we use .to_row_major_array()
let arr = self.transform.to_transform().to_row_major_array();