[tbb-commits] [tor-browser] 49/76: Bug 1758549, part 2 - Guard a few more entry points into VRManager. r=jgilbert a=RyanVM

gitolite role git at cupani.torproject.org
Wed Mar 30 20:40:17 UTC 2022


This is an automated email from the git hooks/post-receive script.

richard pushed a commit to branch tor-browser-91.8.0esr-11.0-1
in repository tor-browser.

commit 3c92dd82fe14bf92a20c63606a68cf1d455cf5b3
Author: Andrew McCreight <continuation at gmail.com>
AuthorDate: Sat Mar 12 15:30:37 2022 +0000

    Bug 1758549, part 2 - Guard a few more entry points into VRManager. r=jgilbert a=RyanVM
    
    Differential Revision: https://phabricator.services.mozilla.com/D140785
---
 gfx/vr/VRManager.cpp | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/gfx/vr/VRManager.cpp b/gfx/vr/VRManager.cpp
index 0af97ee56f761..668e454994691 100644
--- a/gfx/vr/VRManager.cpp
+++ b/gfx/vr/VRManager.cpp
@@ -858,6 +858,9 @@ void VRManager::DispatchRuntimeCapabilitiesUpdate() {
 }
 
 void VRManager::StopAllHaptics() {
+  if (mState != VRManagerState::Active) {
+    return;
+  }
   for (size_t i = 0; i < mozilla::ArrayLength(mBrowserState.hapticState); i++) {
     ClearHapticSlot(i);
   }
@@ -1015,6 +1018,10 @@ bool VRManager::RunPuppet(const nsTArray<uint64_t>& aBuffer,
 }
 
 void VRManager::ResetPuppet(VRManagerParent* aManagerParent) {
+  if (!StaticPrefs::dom_vr_puppet_enabled()) {
+    return;
+  }
+
   mManagerParentsWaitingForPuppetReset.Insert(aManagerParent);
   if (mManagerParentRunningPuppet != nullptr) {
     Unused << mManagerParentRunningPuppet
@@ -1516,6 +1523,10 @@ void VRManager::CancelCurrentSubmitTask() {
 NS_IMETHODIMP
 VRManager::Observe(nsISupports* subject, const char* topic,
                    const char16_t* data) {
+  if (!StaticPrefs::dom_vr_enabled() && !StaticPrefs::dom_vr_webxr_enabled()) {
+    return NS_OK;
+  }
+
   if (!strcmp(topic, "application-background")) {
     // StopTasks() is called later in the timer thread based on this flag to
     // avoid threading issues.

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the tbb-commits mailing list