mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
Do not allow XR session on non user-activated events
This commit is contained in:
parent
9138d1dfed
commit
ea7b581537
9 changed files with 54 additions and 15 deletions
|
@ -23,6 +23,7 @@ use crate::dom::vrdisplay::VRDisplay;
|
|||
use crate::dom::vrdisplayevent::VRDisplayEvent;
|
||||
use crate::dom::xrsession::XRSession;
|
||||
use crate::dom::xrtest::XRTest;
|
||||
use crate::script_thread::ScriptThread;
|
||||
use crate::task_source::TaskSource;
|
||||
use dom_struct::dom_struct;
|
||||
use ipc_channel::ipc::IpcSender;
|
||||
|
@ -157,6 +158,11 @@ impl XRMethods for XR {
|
|||
) -> Rc<Promise> {
|
||||
let promise = Promise::new_in_current_compartment(&self.global(), comp);
|
||||
|
||||
if !ScriptThread::is_user_interacting() {
|
||||
promise.reject_error(Error::Security);
|
||||
return promise;
|
||||
}
|
||||
|
||||
if self.pending_or_active_session() {
|
||||
promise.reject_error(Error::InvalidState);
|
||||
return promise;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue