mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
Allow spawning inline sessions without interaction
This commit is contained in:
parent
fe7cbd7843
commit
d12f8e31a3
5 changed files with 16 additions and 17 deletions
|
@ -162,12 +162,12 @@ impl XRMethods for XR {
|
||||||
) -> Rc<Promise> {
|
) -> Rc<Promise> {
|
||||||
let promise = Promise::new_in_current_compartment(&self.global(), comp);
|
let promise = Promise::new_in_current_compartment(&self.global(), comp);
|
||||||
|
|
||||||
if !ScriptThread::is_user_interacting() {
|
|
||||||
promise.reject_error(Error::Security);
|
|
||||||
return promise;
|
|
||||||
}
|
|
||||||
|
|
||||||
if mode != XRSessionMode::Inline {
|
if mode != XRSessionMode::Inline {
|
||||||
|
if !ScriptThread::is_user_interacting() {
|
||||||
|
promise.reject_error(Error::Security);
|
||||||
|
return promise;
|
||||||
|
}
|
||||||
|
|
||||||
if self.pending_or_active_session() {
|
if self.pending_or_active_session() {
|
||||||
promise.reject_error(Error::InvalidState);
|
promise.reject_error(Error::InvalidState);
|
||||||
return promise;
|
return promise;
|
||||||
|
|
|
@ -727683,7 +727683,7 @@
|
||||||
"testharness"
|
"testharness"
|
||||||
],
|
],
|
||||||
"webxr/xrWebGLLayer_constructor.https.html": [
|
"webxr/xrWebGLLayer_constructor.https.html": [
|
||||||
"0584da79c12def757f951ec53c4c048f18c39b8c",
|
"dda7ec80310f7ff8aac582a98410886ab4d1b81d",
|
||||||
"testharness"
|
"testharness"
|
||||||
],
|
],
|
||||||
"webxr/xrWebGLLayer_framebuffer_draw.https.html": [
|
"webxr/xrWebGLLayer_framebuffer_draw.https.html": [
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
[xrDevice_requestSession_non_immersive_no_gesture.https.html]
|
|
||||||
[Requesting non-immersive session outside of a user gesture succeeds]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
[xrWebGLLayer_constructor.https.html]
|
[xrWebGLLayer_constructor.https.html]
|
||||||
|
expected: ERROR
|
||||||
[Ensure that XRWebGLLayer's constructor throws appropriate errors]
|
[Ensure that XRWebGLLayer's constructor throws appropriate errors]
|
||||||
expected: FAIL
|
expected: TIMEOUT
|
||||||
|
|
||||||
|
|
|
@ -31,12 +31,14 @@ xr_promise_test("Ensure that XRWebGLLayer's constructor throws appropriate error
|
||||||
navigator.xr.test.simulateUserActivation(() => {
|
navigator.xr.test.simulateUserActivation(() => {
|
||||||
navigator.xr.requestSession('immersive-vr')
|
navigator.xr.requestSession('immersive-vr')
|
||||||
.then((session) => {
|
.then((session) => {
|
||||||
try {
|
t.step_func(() => {
|
||||||
let webglLayerIncompatible = new XRWebGLLayer(session, gl);
|
try {
|
||||||
assert_unreached("XRWebGLLayer should fail when created with a context that is not XRCompatible")
|
let webglLayerIncompatible = new XRWebGLLayer(session, gl);
|
||||||
} catch (err) {
|
assert_unreached("XRWebGLLayer should fail when created with a context that is not XRCompatible")
|
||||||
assert_equals(err.name, "InvalidStateError");
|
} catch (err) {
|
||||||
}
|
assert_equals(err.name, "InvalidStateError");
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
gl.makeXRCompatible();
|
gl.makeXRCompatible();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue