Bug 1382104 - Warn in VRDIsplay.isPresenting if the display has been forcibly shutdown. - r=kip
MozReview-Commit-ID: 9eUspD2q8pz
--- a/dom/vr/VRDisplay.cpp
+++ b/dom/vr/VRDisplay.cpp
@@ -670,23 +670,41 @@ ErrorResult& aError)
void
VRDisplay::CancelAnimationFrame(int32_t aHandle, ErrorResult& aError)
{
gfx::VRManagerChild* vm = gfx::VRManagerChild::Get();
vm->CancelFrameRequestCallback(aHandle);
}
-
bool
VRDisplay::IsPresenting() const
{
// IsPresenting returns true only if this Javascript context is presenting
// and will return false if another context is presenting.
- return mPresentation != nullptr;
+ if (mPresentation)
+ return true;
+
+ do {
+ if (!mShutdown)
+ break;
+
+ dom::AutoJSAPI api;
+ if (!api.Init(GetOwnerGlobal())) {
+ MOZ_ASSERT(false);
+ break;
+ }
+
+ JS_ReportWarningASCII(api.cx(),
+ "VRDisplay.isPresenting is always false after"
+ " presentation is forcibly shutdown by window"
+ " destruction.");
+ } while (false);
+
+ return false;
}
bool
VRDisplay::IsAnyPresenting(uint32_t aGroupMask) const
{
// IsAnyPresenting returns true if either this VRDisplay object or any other
// from anther Javascript context is presenting with a group matching
// aGroupMask.