diff --git a/dom/gamepad/ipc/GamepadTestChannelParent.cpp b/dom/gamepad/ipc/GamepadTestChannelParent.cpp index c65248650663..1c8d67491e3c 100644 --- a/dom/gamepad/ipc/GamepadTestChannelParent.cpp +++ b/dom/gamepad/ipc/GamepadTestChannelParent.cpp @@ -8,11 +8,17 @@ #include "mozilla/dom/GamepadPlatformService.h" #include "mozilla/ipc/BackgroundParent.h" +#include "mozilla/StaticPrefs_dom.h" #include "mozilla/Unused.h" namespace mozilla::dom { already_AddRefed GamepadTestChannelParent::Create() { + // Refuse to create the parent actor if this pref is disabled + if (!StaticPrefs::dom_gamepad_test_enabled()) { + return nullptr; + } + return RefPtr(new GamepadTestChannelParent()) .forget(); } diff --git a/modules/libpref/init/StaticPrefList.yaml b/modules/libpref/init/StaticPrefList.yaml index 65bd14757592..787ed92a6d53 100644 --- a/modules/libpref/init/StaticPrefList.yaml +++ b/modules/libpref/init/StaticPrefList.yaml @@ -2329,7 +2329,7 @@ mirror: always - name: dom.gamepad.test.enabled - type: bool + type: RelaxedAtomicBool value: false mirror: always