Skip to content

Commit

Permalink
supportsSession() -> isSessionSupported()
Browse files Browse the repository at this point in the history
  • Loading branch information
Manishearth committed Feb 15, 2020
1 parent 5f55cd5 commit 54c8cac
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 27 deletions.
2 changes: 1 addition & 1 deletion components/script/dom/webidls/XR.webidl
Expand Up @@ -6,7 +6,7 @@
[SecureContext, Exposed=Window, Pref="dom.webxr.enabled"]
interface XR: EventTarget {
// Methods
Promise<void> supportsSession(XRSessionMode mode);
Promise<boolean> isSessionSupported(XRSessionMode mode);
Promise<XRSession> requestSession(XRSessionMode mode, optional XRSessionInit parameters = {});

// Events
Expand Down
11 changes: 6 additions & 5 deletions components/script/dom/xr.rs
Expand Up @@ -113,8 +113,8 @@ impl Into<SessionMode> for XRSessionMode {
}

impl XRMethods for XR {
/// https://immersive-web.github.io/webxr/#dom-xr-supportssessionmode
fn SupportsSession(&self, mode: XRSessionMode) -> Rc<Promise> {
/// https://immersive-web.github.io/webxr/#dom-xr-issessionsupported
fn IsSessionSupported(&self, mode: XRSessionMode) -> Rc<Promise> {
// XXXManishearth this should select an XR device first
let promise = Promise::new(&self.global());
let mut trusted = Some(TrustedPromise::new(promise.clone()));
Expand All @@ -141,10 +141,11 @@ impl XRMethods for XR {
return;
};
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 {
let _ = task_source
.queue_with_canceller(trusted.reject_task(Error::NotSupported), &canceller);
let _ =
task_source.queue_with_canceller(trusted.resolve_task(false), &canceller);
};
}),
);
Expand Down
@@ -1,7 +1,4 @@
[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]
expected: FAIL

9 changes: 3 additions & 6 deletions tests/wpt/metadata/webxr/idlharness.https.window.js.ini
Expand Up @@ -116,18 +116,15 @@
[XRSession interface: operation end()]
expected: FAIL

[XR interface: operation isSessionSupported(XRSessionMode)]
expected: FAIL

[XR interface: calling isSessionSupported(XRSessionMode) on navigator.xr with too few arguments must throw TypeError]
expected: FAIL

[XR interface: navigator.xr must inherit property "isSessionSupported(XRSessionMode)" with the proper type]
expected: FAIL

[WebGLRenderingContext includes WebGLRenderingContextOverloads: member names are unique]
expected: FAIL

[WebGLRenderingContext includes WebGLRenderingContextBase: member names are unique]
expected: FAIL

[XR interface: operation isSessionSupported(XRSessionMode)]
expected: FAIL

This file was deleted.

This file was deleted.

This file was deleted.

0 comments on commit 54c8cac

Please sign in to comment.