зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1805269 - Don't allow getting gamepad and VR test services outside of automation. r=smaug,cmartin
These interfaces are already disabled by prefs, but they are ironically probably not well tested, so just add an extra check. Differential Revision: https://phabricator.services.mozilla.com/D164496
This commit is contained in:
Родитель
136a940fe6
Коммит
9edebfc628
|
@ -1594,7 +1594,12 @@ void Navigator::GetGamepads(nsTArray<RefPtr<Gamepad>>& aGamepads,
|
|||
win->GetGamepads(aGamepads);
|
||||
}
|
||||
|
||||
GamepadServiceTest* Navigator::RequestGamepadServiceTest() {
|
||||
GamepadServiceTest* Navigator::RequestGamepadServiceTest(ErrorResult& aRv) {
|
||||
if (!xpc::IsInAutomation()) {
|
||||
aRv.Throw(NS_ERROR_UNEXPECTED);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (!mGamepadServiceTest) {
|
||||
mGamepadServiceTest = GamepadServiceTest::CreateTestService(mWindow);
|
||||
}
|
||||
|
@ -1759,7 +1764,12 @@ void Navigator::NotifyActiveVRDisplaysChanged() {
|
|||
Navigator_Binding::ClearCachedActiveVRDisplaysValue(this);
|
||||
}
|
||||
|
||||
VRServiceTest* Navigator::RequestVRServiceTest() {
|
||||
VRServiceTest* Navigator::RequestVRServiceTest(ErrorResult& aRv) {
|
||||
if (!xpc::IsInAutomation()) {
|
||||
aRv.Throw(NS_ERROR_UNEXPECTED);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// Ensure that the Mock VR devices are not released prematurely
|
||||
nsGlobalWindowInner* win = nsGlobalWindowInner::Cast(mWindow);
|
||||
win->NotifyHasXRSession();
|
||||
|
|
|
@ -175,13 +175,13 @@ class Navigator final : public nsISupports, public nsWrapperCache {
|
|||
MediaDevices* GetExtantMediaDevices() const { return mMediaDevices; };
|
||||
|
||||
void GetGamepads(nsTArray<RefPtr<Gamepad>>& aGamepads, ErrorResult& aRv);
|
||||
GamepadServiceTest* RequestGamepadServiceTest();
|
||||
GamepadServiceTest* RequestGamepadServiceTest(ErrorResult& aRv);
|
||||
already_AddRefed<Promise> GetVRDisplays(ErrorResult& aRv);
|
||||
void FinishGetVRDisplays(bool isWebVRSupportedInwindow, Promise* p);
|
||||
void GetActiveVRDisplays(nsTArray<RefPtr<VRDisplay>>& aDisplays) const;
|
||||
void OnXRPermissionRequestAllow();
|
||||
void OnXRPermissionRequestCancel();
|
||||
VRServiceTest* RequestVRServiceTest();
|
||||
VRServiceTest* RequestVRServiceTest(ErrorResult& aRv);
|
||||
bool IsWebVRContentDetected() const;
|
||||
bool IsWebVRContentPresenting() const;
|
||||
void RequestVRPresentation(VRDisplay& aDisplay);
|
||||
|
|
|
@ -209,7 +209,7 @@ partial interface Navigator {
|
|||
sequence<Gamepad?> getGamepads();
|
||||
};
|
||||
partial interface Navigator {
|
||||
[Pref="dom.gamepad.test.enabled"]
|
||||
[Throws, Pref="dom.gamepad.test.enabled"]
|
||||
GamepadServiceTest requestGamepadServiceTest();
|
||||
};
|
||||
|
||||
|
@ -228,7 +228,7 @@ partial interface Navigator {
|
|||
undefined requestVRPresentation(VRDisplay display);
|
||||
};
|
||||
partial interface Navigator {
|
||||
[Pref="dom.vr.puppet.enabled"]
|
||||
[Throws, Pref="dom.vr.puppet.enabled"]
|
||||
VRServiceTest requestVRServiceTest();
|
||||
};
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче