Auto merge of #25770 - Manishearth:sessionsupport, r=jdm

supportsSession() -> isSessionSupported()

r? @jdm

fixes https://github.com/servo/servo/issues/25596
This commit is contained in:
bors-servo 2020-02-15 07:59:39 -05:00 committed by GitHub
commit 3475790fc2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 10 additions and 27 deletions

View file

@ -6,7 +6,7 @@
[SecureContext, Exposed=Window, Pref="dom.webxr.enabled"] [SecureContext, Exposed=Window, Pref="dom.webxr.enabled"]
interface XR: EventTarget { interface XR: EventTarget {
// Methods // Methods
Promise<void> supportsSession(XRSessionMode mode); Promise<boolean> isSessionSupported(XRSessionMode mode);
Promise<XRSession> requestSession(XRSessionMode mode, optional XRSessionInit parameters = {}); Promise<XRSession> requestSession(XRSessionMode mode, optional XRSessionInit parameters = {});
// Events // Events

View file

@ -113,8 +113,8 @@ impl Into<SessionMode> for XRSessionMode {
} }
impl XRMethods for XR { impl XRMethods for XR {
/// https://immersive-web.github.io/webxr/#dom-xr-supportssessionmode /// https://immersive-web.github.io/webxr/#dom-xr-issessionsupported
fn SupportsSession(&self, mode: XRSessionMode) -> Rc<Promise> { fn IsSessionSupported(&self, mode: XRSessionMode) -> Rc<Promise> {
// XXXManishearth this should select an XR device first // XXXManishearth this should select an XR device first
let promise = Promise::new(&self.global()); let promise = Promise::new(&self.global());
let mut trusted = Some(TrustedPromise::new(promise.clone())); let mut trusted = Some(TrustedPromise::new(promise.clone()));
@ -141,10 +141,11 @@ impl XRMethods for XR {
return; return;
}; };
if let Ok(()) = message { if let Ok(()) = message {
let _ = task_source.queue_with_canceller(trusted.resolve_task(()), &canceller); let _ =
task_source.queue_with_canceller(trusted.resolve_task(true), &canceller);
} else { } else {
let _ = task_source let _ =
.queue_with_canceller(trusted.reject_task(Error::NotSupported), &canceller); task_source.queue_with_canceller(trusted.resolve_task(false), &canceller);
}; };
}), }),
); );

View file

@ -1,7 +1,4 @@
[xrDevice_isSessionSupported_immersive-ar.https.html] [xrDevice_isSessionSupported_immersive-ar.https.html]
[isSessionSupported resolves to true for immersive-ar on a supported device]
expected: FAIL
[isSessionSupported resolves to false for immersive-ar on an unsupported device] [isSessionSupported resolves to false for immersive-ar on an unsupported device]
expected: FAIL expected: FAIL

View file

@ -116,18 +116,15 @@
[XRSession interface: operation end()] [XRSession interface: operation end()]
expected: FAIL expected: FAIL
[XR interface: operation isSessionSupported(XRSessionMode)]
expected: FAIL
[XR interface: calling isSessionSupported(XRSessionMode) on navigator.xr with too few arguments must throw TypeError] [XR interface: calling isSessionSupported(XRSessionMode) on navigator.xr with too few arguments must throw TypeError]
expected: FAIL expected: FAIL
[XR interface: navigator.xr must inherit property "isSessionSupported(XRSessionMode)" with the proper type]
expected: FAIL
[WebGLRenderingContext includes WebGLRenderingContextOverloads: member names are unique] [WebGLRenderingContext includes WebGLRenderingContextOverloads: member names are unique]
expected: FAIL expected: FAIL
[WebGLRenderingContext includes WebGLRenderingContextBase: member names are unique] [WebGLRenderingContext includes WebGLRenderingContextBase: member names are unique]
expected: FAIL expected: FAIL
[XR interface: operation isSessionSupported(XRSessionMode)]
expected: FAIL

View file

@ -1,4 +0,0 @@
[xrDevice_isSessionSupported_immersive.https.html]
[isSessionSupported resolves to true when immersive options supported]
expected: FAIL

View file

@ -1,4 +0,0 @@
[xrDevice_isSessionSupported_immersive_unsupported.https.html]
[isSessionSupported resolves to false when options not supported]
expected: FAIL

View file

@ -1,4 +0,0 @@
[xrDevice_isSessionSupported_inline.https.html]
[isSessionSupported resolves to true when inline options supported]
expected: FAIL