diff --git a/dom/base/nsDocument.cpp b/dom/base/nsDocument.cpp index 1e4731c4ac5f..325747251d99 100644 --- a/dom/base/nsDocument.cpp +++ b/dom/base/nsDocument.cpp @@ -11878,27 +11878,11 @@ FullscreenRequest::FullscreenRequest(Element* aElement) , mDocument(static_cast(aElement->OwnerDoc())) { MOZ_COUNT_CTOR(FullscreenRequest); - mDocument->mPendingFullscreenRequests++; - if (MOZ_UNLIKELY(!mDocument->mPendingFullscreenRequests)) { - NS_WARNING("Pending fullscreen request counter overflow"); - } } -static void RedispatchPendingPointerLockRequest(nsIDocument* aDocument); - FullscreenRequest::~FullscreenRequest() { MOZ_COUNT_DTOR(FullscreenRequest); - if (MOZ_UNLIKELY(!mDocument->mPendingFullscreenRequests)) { - NS_WARNING("Pending fullscreen request counter underflow"); - return; - } - mDocument->mPendingFullscreenRequests--; - if (!mDocument->mPendingFullscreenRequests) { - // There may be pointer lock request be blocked because of pending - // fullscreen requests. Re-dispatch it to ensure it gets handled. - RedispatchPendingPointerLockRequest(mDocument); - } } // Any fullscreen request waiting for the widget to finish being full- @@ -12350,11 +12334,6 @@ public: } nsDocument* doc = static_cast(d.get()); - if (doc->mPendingFullscreenRequests > 0) { - // We're still entering fullscreen. - return NS_OK; - } - if (doc->GetFullscreenElement() || doc->mAllowRelocking) { Allow(JS::UndefinedHandleValue); return NS_OK; @@ -12510,35 +12489,6 @@ nsPointerLockPermissionRequest::GetRequester(nsIContentPermissionRequester** aRe return NS_OK; } -static void -RedispatchPendingPointerLockRequest(nsIDocument* aDocument) -{ - if (!gPendingPointerLockRequest) { - return; - } - nsCOMPtr doc = - do_QueryReferent(gPendingPointerLockRequest->mDocument); - if (doc != aDocument) { - return; - } - nsCOMPtr elem = - do_QueryReferent(gPendingPointerLockRequest->mElement); - if (!elem || elem->GetUncomposedDoc() != aDocument) { - gPendingPointerLockRequest->Handled(); - return; - } - - // We have a request pending on the document which may previously be - // blocked for fullscreen change. Create a clone and re-dispatch it - // to guarantee that Run() method gets called again. - bool userInputOrChromeCaller = - gPendingPointerLockRequest->mUserInputOrChromeCaller; - gPendingPointerLockRequest->Handled(); - gPendingPointerLockRequest = - new nsPointerLockPermissionRequest(elem, userInputOrChromeCaller); - NS_DispatchToMainThread(gPendingPointerLockRequest); -} - nsresult nsDocument::Observe(nsISupports *aSubject, const char *aTopic,