Skip to content

Commit

Permalink
Add stubs for session start/end
Browse files Browse the repository at this point in the history
  • Loading branch information
Manishearth committed Jul 17, 2019
1 parent df1f865 commit ffc943f
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 2 deletions.
2 changes: 1 addition & 1 deletion components/script/dom/webidls/XRSession.webidl
Expand Up @@ -33,7 +33,7 @@ interface XRSession : EventTarget {
long requestAnimationFrame(XRFrameRequestCallback callback);
void cancelAnimationFrame(long handle);

// Promise<void> end();
Promise<void> end();

// // Events
// attribute EventHandler onblur;
Expand Down
2 changes: 1 addition & 1 deletion components/script/dom/webidls/XRTest.webidl
Expand Up @@ -16,7 +16,7 @@ interface XRTest {
void simulateUserActivation(Function f);

// // Disconnect all fake devices
// Promise<void> disconnectAllDevices();
Promise<void> disconnectAllDevices();
};

dictionary FakeXRDeviceInit {
Expand Down
8 changes: 8 additions & 0 deletions components/script/dom/xrsession.rs
Expand Up @@ -288,6 +288,14 @@ impl XRSessionMethods for XRSession {
.map(|x| DomRoot::from_ref(&**x))
.collect()
}

/// https://immersive-web.github.io/webxr/#dom-xrsession-end
fn End(&self) -> Rc<Promise> {
// XXXManishearth implement device disconnection and session ending
let p = Promise::new(&self.global());
p.resolve_native(&());
p
}
}

#[derive(Clone, Copy, Debug)]
Expand Down
8 changes: 8 additions & 0 deletions components/script/dom/xrtest.rs
Expand Up @@ -170,4 +170,12 @@ impl XRTestMethods for XRTest {
// XXXManishearth actually check for activation in XRSession
let _ = f.Call__(vec![], ExceptionHandling::Rethrow);
}

/// https://github.com/immersive-web/webxr-test-api/blob/master/explainer.md
fn DisconnectAllDevices(&self) -> Rc<Promise> {
// XXXManishearth implement device disconnection and session ending
let p = Promise::new(&self.global());
p.resolve_native(&());
p
}
}

0 comments on commit ffc943f

Please sign in to comment.