mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Add a pref to indicate user intent to enter webxr
This commit is contained in:
parent
0d77e0f6cf
commit
4894e8f2c4
3 changed files with 10 additions and 2 deletions
|
@ -300,6 +300,8 @@ mod gen {
|
|||
enabled: bool,
|
||||
},
|
||||
sessionavailable: bool,
|
||||
#[serde(rename = "dom.webxr.unsafe-assume-user-intent")]
|
||||
unsafe_assume_user_intent: bool,
|
||||
},
|
||||
worklet: {
|
||||
blockingsleep: {
|
||||
|
|
|
@ -26,6 +26,7 @@ use ipc_channel::ipc::{self as ipc_crate, IpcReceiver};
|
|||
use ipc_channel::router::ROUTER;
|
||||
use msg::constellation_msg::PipelineId;
|
||||
use profile_traits::ipc;
|
||||
use servo_config::pref;
|
||||
use std::cell::Cell;
|
||||
use std::rc::Rc;
|
||||
use webxr_api::{Error as XRError, Frame, Session, SessionInit, SessionMode};
|
||||
|
@ -161,9 +162,13 @@ impl XRSystemMethods for XRSystem {
|
|||
|
||||
if mode != XRSessionMode::Inline {
|
||||
if !ScriptThread::is_user_interacting() {
|
||||
if pref!(dom.webxr.unsafe_assume_user_intent) {
|
||||
warn!("The dom.webxr.unsafe-assume-user-intent preference assumes user intent to enter WebXR.");
|
||||
} else {
|
||||
promise.reject_error(Error::Security);
|
||||
return promise;
|
||||
}
|
||||
}
|
||||
|
||||
if self.pending_or_active_session() {
|
||||
promise.reject_error(Error::InvalidState);
|
||||
|
|
|
@ -49,6 +49,7 @@
|
|||
"dom.webxr.layers.enabled": false,
|
||||
"dom.webxr.sessionavailable": false,
|
||||
"dom.webxr.test": false,
|
||||
"dom.webxr.unsafe-assume-user-intent": false,
|
||||
"dom.worklet.timeout_ms": 10,
|
||||
"gfx.subpixel-text-antialiasing.enabled": true,
|
||||
"gfx.texture-swizzling.enabled": true,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue