aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/xrtest.rs
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2020-01-21 23:19:40 -0500
committerGitHub <noreply@github.com>2020-01-21 23:19:40 -0500
commitee3fb92e53d08c34a41b748aa4e49ae336eaf611 (patch)
tree59c35028546b0be1d2931ea491399c301064ce7b /components/script/dom/xrtest.rs
parent35eb6dd0748dd9cd47e4b754166107aac72e62db (diff)
parent9a04a37c1cdd0f6f5fe5feca45f9468701fa3799 (diff)
downloadservo-ee3fb92e53d08c34a41b748aa4e49ae336eaf611.tar.gz
servo-ee3fb92e53d08c34a41b748aa4e49ae336eaf611.zip
Auto merge of #25504 - Manishearth:features, r=asajeffrey
Support features in webxr Based on https://github.com/servo/webxr/pull/119 Todo: - [x] gate reference space creation on feature presence - [x] Fix the `features_deviceSupport` test to correctly use simulateUserActivation Fixes #24196, #24270 r? @jdm @asajeffrey
Diffstat (limited to 'components/script/dom/xrtest.rs')
-rw-r--r--components/script/dom/xrtest.rs11
1 files changed, 10 insertions, 1 deletions
diff --git a/components/script/dom/xrtest.rs b/components/script/dom/xrtest.rs
index b00a69b8fca..4c6852fc121 100644
--- a/components/script/dom/xrtest.rs
+++ b/components/script/dom/xrtest.rs
@@ -69,8 +69,10 @@ impl XRTest {
impl XRTestMethods for XRTest {
/// https://github.com/immersive-web/webxr-test-api/blob/master/explainer.md
+ #[allow(unsafe_code)]
fn SimulateDeviceConnection(&self, init: &FakeXRDeviceInit) -> Rc<Promise> {
- let p = Promise::new(&self.global());
+ let global = self.global();
+ let p = Promise::new(&global);
let origin = if let Some(ref o) = init.viewerOrigin {
match get_origin(&o) {
@@ -104,12 +106,19 @@ impl XRTestMethods for XRTest {
},
};
+ let supported_features = if let Some(ref s) = init.supportedFeatures {
+ s.iter().cloned().map(String::from).collect()
+ } else {
+ vec![]
+ };
+
let init = MockDeviceInit {
viewer_origin: origin,
views,
supports_immersive: init.supportsImmersive,
supports_unbounded: init.supportsUnbounded,
floor_origin,
+ supported_features,
};
let global = self.global();