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

gitolite role git at cupani.torproject.org
Tue Apr 26 15:29:41 UTC 2022


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

pierov pushed a commit to branch geckoview-99.0.1-11.0-1
in repository tor-browser.

commit 0de0f8c0b27c72912c6fe171fb9dd14d47d01021
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=dmeehan
    
    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 41d4825b698d7..2157439b92b1f 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