Add feature gating for hit tests

This commit is contained in:
Manish Goregaokar 2020-04-11 10:10:13 -07:00
parent 1b07b77323
commit 30cd89d2d8

View file

@ -741,6 +741,18 @@ impl XRSessionMethods for XRSession {
fn RequestHitTestSource(&self, options: &XRHitTestOptionsInit) -> Rc<Promise> { fn RequestHitTestSource(&self, options: &XRHitTestOptionsInit) -> Rc<Promise> {
let p = Promise::new(&self.global()); let p = Promise::new(&self.global());
if self
.session
.borrow()
.granted_features()
.iter()
.find(|f| &**f == "hit-test")
.is_none()
{
p.reject_error(Error::NotSupported);
return p;
}
let id = self.next_hit_test_id.get(); let id = self.next_hit_test_id.get();
self.next_hit_test_id.set(HitTestId(id.0 + 1)); self.next_hit_test_id.set(HitTestId(id.0 + 1));