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 513b0d091fb177b04706a51720bfa33b40ce2beb Author: Andrew McCreight continuation@gmail.com AuthorDate: Sat Mar 12 15:30:37 2022 +0000
Bug 1758549, part 1 - Check that WebVR is enabled before creating PVR, PVRGPU and PVRLayer actors. r=jgilbert a=RyanVM
Differential Revision: https://phabricator.services.mozilla.com/D140784 --- gfx/vr/ipc/VRGPUChild.cpp | 5 +++++ gfx/vr/ipc/VRGPUParent.cpp | 5 +++++ gfx/vr/ipc/VRLayerChild.cpp | 5 +++++ gfx/vr/ipc/VRManagerParent.cpp | 5 +++++ gfx/vr/ipc/VRProcessChild.cpp | 6 ++++++ gfx/vr/ipc/VRProcessParent.cpp | 6 ++++++ testing/web-platform/meta/webvr/__dir__.ini | 1 + 7 files changed, 33 insertions(+)
diff --git a/gfx/vr/ipc/VRGPUChild.cpp b/gfx/vr/ipc/VRGPUChild.cpp index f8b90a5b4423b..793778c03276b 100644 --- a/gfx/vr/ipc/VRGPUChild.cpp +++ b/gfx/vr/ipc/VRGPUChild.cpp @@ -9,6 +9,7 @@
#include "mozilla/ipc/Endpoint.h" #include "mozilla/layers/CompositorThread.h" +#include "mozilla/StaticPrefs_dom.h" #include "VRManager.h"
namespace mozilla { @@ -21,6 +22,10 @@ bool VRGPUChild::InitForGPUProcess(Endpoint<PVRGPUChild>&& aEndpoint) { MOZ_ASSERT(NS_IsMainThread()); MOZ_ASSERT(!sVRGPUChildSingleton);
+ if (!StaticPrefs::dom_vr_enabled() && !StaticPrefs::dom_vr_webxr_enabled()) { + return false; + } + RefPtr<VRGPUChild> child(new VRGPUChild()); if (!aEndpoint.Bind(child)) { return false; diff --git a/gfx/vr/ipc/VRGPUParent.cpp b/gfx/vr/ipc/VRGPUParent.cpp index ce1eef77fac5c..72d943086d2a4 100644 --- a/gfx/vr/ipc/VRGPUParent.cpp +++ b/gfx/vr/ipc/VRGPUParent.cpp @@ -9,6 +9,7 @@
#include "mozilla/ipc/Endpoint.h" #include "mozilla/ipc/ProcessChild.h" +#include "mozilla/StaticPrefs_dom.h"
namespace mozilla { namespace gfx { @@ -43,6 +44,10 @@ void VRGPUParent::DeferredDestroy() { mSelfRef = nullptr; } /* static */ RefPtr<VRGPUParent> VRGPUParent::CreateForGPU( Endpoint<PVRGPUParent>&& aEndpoint) { + if (!StaticPrefs::dom_vr_enabled() && !StaticPrefs::dom_vr_webxr_enabled()) { + return nullptr; + } + RefPtr<VRGPUParent> vcp = new VRGPUParent(aEndpoint.OtherPid()); GetCurrentSerialEventTarget()->Dispatch( NewRunnableMethod<Endpoint<PVRGPUParent>&&>("gfx::VRGPUParent::Bind", vcp, diff --git a/gfx/vr/ipc/VRLayerChild.cpp b/gfx/vr/ipc/VRLayerChild.cpp index fd9dd19988016..57f69f7d2b1f3 100644 --- a/gfx/vr/ipc/VRLayerChild.cpp +++ b/gfx/vr/ipc/VRLayerChild.cpp @@ -10,6 +10,7 @@ #include "mozilla/layers/ImageBridgeChild.h" #include "mozilla/layers/LayersMessages.h" // for TimedTexture #include "mozilla/layers/SyncObject.h" // for SyncObjectClient +#include "mozilla/StaticPrefs_dom.h" #include "mozilla/StaticPrefs_webgl.h"
#include "ClientWebGLContext.h" @@ -122,6 +123,10 @@ void VRLayerChild::ActorDestroy(ActorDestroyReason aWhy) { mIPCOpen = false; }
// static PVRLayerChild* VRLayerChild::CreateIPDLActor() { + if (!StaticPrefs::dom_vr_enabled() && !StaticPrefs::dom_vr_webxr_enabled()) { + return nullptr; + } + VRLayerChild* c = new VRLayerChild(); c->AddIPDLReference(); return c; diff --git a/gfx/vr/ipc/VRManagerParent.cpp b/gfx/vr/ipc/VRManagerParent.cpp index 5d154e1b32d00..01a2f4e6a566f 100644 --- a/gfx/vr/ipc/VRManagerParent.cpp +++ b/gfx/vr/ipc/VRManagerParent.cpp @@ -10,6 +10,7 @@ #include "mozilla/gfx/PVRManagerParent.h" #include "mozilla/ipc/Endpoint.h" #include "mozilla/ipc/ProtocolTypes.h" +#include "mozilla/StaticPrefs_dom.h" #include "mozilla/ipc/ProtocolUtils.h" // for IToplevelProtocol #include "mozilla/TimeStamp.h" // for TimeStamp #include "mozilla/Unused.h" @@ -45,6 +46,10 @@ VRManagerParent::~VRManagerParent() {
PVRLayerParent* VRManagerParent::AllocPVRLayerParent(const uint32_t& aDisplayID, const uint32_t& aGroup) { + if (!StaticPrefs::dom_vr_enabled() && !StaticPrefs::dom_vr_webxr_enabled()) { + return nullptr; + } + RefPtr<VRLayerParent> layer; layer = new VRLayerParent(aDisplayID, aGroup); VRManager* vm = VRManager::Get(); diff --git a/gfx/vr/ipc/VRProcessChild.cpp b/gfx/vr/ipc/VRProcessChild.cpp index 4da047f7afea1..9fb42ab307331 100644 --- a/gfx/vr/ipc/VRProcessChild.cpp +++ b/gfx/vr/ipc/VRProcessChild.cpp @@ -9,6 +9,7 @@ #include "mozilla/BackgroundHangMonitor.h" #include "mozilla/ipc/IOThreadChild.h" #include "mozilla/ipc/ProcessUtils.h" +#include "mozilla/StaticPrefs_dom.h"
using namespace mozilla; using namespace mozilla::gfx; @@ -28,6 +29,11 @@ VRParent* VRProcessChild::GetVRParent() { }
bool VRProcessChild::Init(int aArgc, char* aArgv[]) { + if (!StaticPrefs::dom_vr_enabled() && !StaticPrefs::dom_vr_webxr_enabled()) { + NS_WARNING("VR is not enabled when trying to create a VRParent"); + return false; + } + char* parentBuildID = nullptr; char* prefsHandle = nullptr; char* prefMapHandle = nullptr; diff --git a/gfx/vr/ipc/VRProcessParent.cpp b/gfx/vr/ipc/VRProcessParent.cpp index e24cff62c2cce..0f810779f0f83 100644 --- a/gfx/vr/ipc/VRProcessParent.cpp +++ b/gfx/vr/ipc/VRProcessParent.cpp @@ -156,6 +156,12 @@ bool VRProcessParent::InitAfterConnect(bool aSucceeded) { return false; }
+ if (!StaticPrefs::dom_vr_enabled() && + !StaticPrefs::dom_vr_webxr_enabled()) { + NS_WARNING("VR is not enabled when trying to create a VRChild"); + return false; + } + mVRChild = MakeUnique<VRChild>(this);
DebugOnly<bool> rv = mVRChild->Open( diff --git a/testing/web-platform/meta/webvr/__dir__.ini b/testing/web-platform/meta/webvr/__dir__.ini index d6cfe0eb08777..bde38b749b459 100644 --- a/testing/web-platform/meta/webvr/__dir__.ini +++ b/testing/web-platform/meta/webvr/__dir__.ini @@ -1 +1,2 @@ prefs: [dom.vr.enabled:true, dom.vr.prompt.testing:true, dom.vr.prompt.testing.allow:true, dom.security.featurePolicy.experimental.enabled:true, dom.security.featurePolicy.header.enabled:true, dom.security.featurePolicy.webidl.enabled:true] +leak-threshold: [vr:500]