mirror of
https://github.com/servo/servo.git
synced 2025-07-30 10:40:27 +01:00
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:
commit
3475790fc2
7 changed files with 10 additions and 27 deletions
|
@ -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
|
||||
|
|
|
@ -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()));
|
||||
|
@ -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);
|
||||
};
|
||||
}),
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue