mirror of
https://github.com/servo/servo.git
synced 2025-08-05 05:30:08 +01:00
Gate reference space creation on requested features
This commit is contained in:
parent
8cc7c51803
commit
9a04a37c1c
3 changed files with 18 additions and 8 deletions
|
@ -185,6 +185,8 @@ impl XRMethods for XR {
|
|||
let mut optional_features = vec![];
|
||||
let cx = global.get_cx();
|
||||
|
||||
// We are supposed to include "viewer" and on immersive devices "local"
|
||||
// by default here, but this is handled directly in requestReferenceSpace()
|
||||
if let Some(ref r) = init.requiredFeatures {
|
||||
for feature in r {
|
||||
unsafe {
|
||||
|
|
|
@ -559,10 +559,25 @@ impl XRSessionMethods for XRSession {
|
|||
p.reject_error(Error::NotSupported)
|
||||
},
|
||||
ty => {
|
||||
if ty != XRReferenceSpaceType::Viewer &&
|
||||
(!self.is_immersive() || ty != XRReferenceSpaceType::Local)
|
||||
{
|
||||
let s = ty.as_str();
|
||||
if self
|
||||
.session
|
||||
.borrow()
|
||||
.granted_features()
|
||||
.iter()
|
||||
.find(|f| &**f == s)
|
||||
.is_none()
|
||||
{
|
||||
p.reject_error(Error::NotSupported);
|
||||
return p;
|
||||
}
|
||||
}
|
||||
p.resolve_native(&XRReferenceSpace::new(&self.global(), self, ty));
|
||||
},
|
||||
}
|
||||
|
||||
p
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
[xrSession_requestReferenceSpace_features.https.html]
|
||||
[Immersive session rejects local-floor space if not requested]
|
||||
expected: FAIL
|
||||
|
||||
[Non-immersive session rejects local space if not requested]
|
||||
expected: FAIL
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue