[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [tor-browser] 180/311: Bug 1758549, part 1 - Check that WebVR is enabled before creating PVR, PVRGPU and PVRLayer actors. r=jgilbert a=dmeehan
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 8d9ec53c261c62909a3961a8896537d5d903db8e
Author: Andrew McCreight <continuation@xxxxxxxxx>
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=dmeehan
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 9723f9c13c6e0..88fde06a2ac81 100644
--- a/gfx/vr/ipc/VRProcessChild.cpp
+++ b/gfx/vr/ipc/VRProcessChild.cpp
@@ -10,6 +10,7 @@
#include "mozilla/GeckoArgs.h"
#include "mozilla/ipc/IOThreadChild.h"
#include "mozilla/ipc/ProcessUtils.h"
+#include "mozilla/StaticPrefs_dom.h"
using namespace mozilla;
using namespace mozilla::gfx;
@@ -29,6 +30,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;
+ }
+
Maybe<const char*> parentBuildID =
geckoargs::sParentBuildID.Get(aArgc, aArgv);
if (parentBuildID.isNothing()) {
diff --git a/gfx/vr/ipc/VRProcessParent.cpp b/gfx/vr/ipc/VRProcessParent.cpp
index d8d125d44e810..37187bb576938 100644
--- a/gfx/vr/ipc/VRProcessParent.cpp
+++ b/gfx/vr/ipc/VRProcessParent.cpp
@@ -154,6 +154,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]
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits