mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 743198 part 4 - Rename LogFullScreenDenied to nsIDocument::DispatchFullscreenError, and reuse it in Element::RequestFullscreen. r=smaug
This commit is contained in:
parent
a3fe1e9c45
commit
a8c9cddacc
@ -3259,18 +3259,8 @@ Element::RequestFullscreen(JSContext* aCx, JS::Handle<JS::Value> aOptions,
|
||||
// spoof the browser chrome/window and phish logins etc.
|
||||
// Note that requests for fullscreen inside a web app's origin are exempt
|
||||
// from this restriction.
|
||||
const char* error = GetFullScreenError(OwnerDoc());
|
||||
if (error) {
|
||||
nsContentUtils::ReportToConsole(nsIScriptError::warningFlag,
|
||||
NS_LITERAL_CSTRING("DOM"), OwnerDoc(),
|
||||
nsContentUtils::eDOM_PROPERTIES,
|
||||
error);
|
||||
RefPtr<AsyncEventDispatcher> asyncDispatcher =
|
||||
new AsyncEventDispatcher(OwnerDoc(),
|
||||
NS_LITERAL_STRING("mozfullscreenerror"),
|
||||
true,
|
||||
false);
|
||||
asyncDispatcher->PostDOMEvent();
|
||||
if (const char* error = GetFullScreenError(OwnerDoc())) {
|
||||
OwnerDoc()->DispatchFullscreenError(error);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -11354,20 +11354,17 @@ nsDocument::AsyncRequestFullScreen(UniquePtr<FullscreenRequest>&& aRequest)
|
||||
NS_DispatchToCurrentThread(event);
|
||||
}
|
||||
|
||||
static void
|
||||
LogFullScreenDenied(bool aLogFailure, const char* aMessage, nsIDocument* aDoc)
|
||||
void
|
||||
nsIDocument::DispatchFullscreenError(const char* aMessage)
|
||||
{
|
||||
if (!aLogFailure) {
|
||||
return;
|
||||
}
|
||||
RefPtr<AsyncEventDispatcher> asyncDispatcher =
|
||||
new AsyncEventDispatcher(aDoc,
|
||||
new AsyncEventDispatcher(this,
|
||||
NS_LITERAL_STRING("mozfullscreenerror"),
|
||||
true,
|
||||
false);
|
||||
asyncDispatcher->PostDOMEvent();
|
||||
nsContentUtils::ReportToConsole(nsIScriptError::warningFlag,
|
||||
NS_LITERAL_CSTRING("DOM"), aDoc,
|
||||
NS_LITERAL_CSTRING("DOM"), this,
|
||||
nsContentUtils::eDOM_PROPERTIES,
|
||||
aMessage);
|
||||
}
|
||||
@ -11610,30 +11607,30 @@ nsDocument::FullscreenElementReadyCheck(Element* aElement,
|
||||
return false;
|
||||
}
|
||||
if (!aElement->IsInDoc()) {
|
||||
LogFullScreenDenied(true, "FullScreenDeniedNotInDocument", this);
|
||||
DispatchFullscreenError("FullScreenDeniedNotInDocument");
|
||||
return false;
|
||||
}
|
||||
if (aElement->OwnerDoc() != this) {
|
||||
LogFullScreenDenied(true, "FullScreenDeniedMovedDocument", this);
|
||||
DispatchFullscreenError("FullScreenDeniedMovedDocument");
|
||||
return false;
|
||||
}
|
||||
if (!GetWindow()) {
|
||||
LogFullScreenDenied(true, "FullScreenDeniedLostWindow", this);
|
||||
DispatchFullscreenError("FullScreenDeniedLostWindow");
|
||||
return false;
|
||||
}
|
||||
if (const char* msg = GetFullscreenError(this, aWasCallerChrome)) {
|
||||
LogFullScreenDenied(true, msg, this);
|
||||
DispatchFullscreenError(msg);
|
||||
return false;
|
||||
}
|
||||
if (GetFullscreenElement() &&
|
||||
!nsContentUtils::ContentIsDescendantOf(aElement, GetFullscreenElement())) {
|
||||
// If this document is full-screen, only grant full-screen requests from
|
||||
// a descendant of the current full-screen element.
|
||||
LogFullScreenDenied(true, "FullScreenDeniedNotDescendant", this);
|
||||
DispatchFullscreenError("FullScreenDeniedNotDescendant");
|
||||
return false;
|
||||
}
|
||||
if (!nsContentUtils::IsChromeDoc(this) && !IsInActiveTab(this)) {
|
||||
LogFullScreenDenied(true, "FullScreenDeniedNotFocusedTab", this);
|
||||
DispatchFullscreenError("FullScreenDeniedNotFocusedTab");
|
||||
return false;
|
||||
}
|
||||
// Deny requests when a windowed plugin is focused.
|
||||
@ -11647,7 +11644,7 @@ nsDocument::FullscreenElementReadyCheck(Element* aElement,
|
||||
if (focusedElement) {
|
||||
nsCOMPtr<nsIContent> content = do_QueryInterface(focusedElement);
|
||||
if (nsContentUtils::HasPluginWithUncontrolledEventDispatch(content)) {
|
||||
LogFullScreenDenied(true, "FullScreenDeniedFocusedPlugin", this);
|
||||
DispatchFullscreenError("FullScreenDeniedFocusedPlugin");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -1231,6 +1231,12 @@ public:
|
||||
*/
|
||||
static bool HandlePendingFullscreenRequests(nsIDocument* aDocument);
|
||||
|
||||
/**
|
||||
* Dispatch fullscreenerror event and report the failure message to
|
||||
* the console.
|
||||
*/
|
||||
void DispatchFullscreenError(const char* aMessage);
|
||||
|
||||
virtual void RequestPointerLock(Element* aElement) = 0;
|
||||
|
||||
static void UnlockPointer(nsIDocument* aDoc = nullptr);
|
||||
|
Loading…
Reference in New Issue
Block a user