Bug 743198 part 1 - Drop [Throws] of document.mozFullScreenElement.
This method actually never throws. IsFullScreenDoc() simply checks
whether GetFullScreenElement() returns nullptr, which means if that
method returns true, the "!el" check would never fail.
MozReview-Commit-ID: GTyPTqk894V
--- a/dom/base/nsDocument.cpp
+++ b/dom/base/nsDocument.cpp
@@ -11950,41 +11950,23 @@ nsDocument::ApplyFullscreen(const Fullsc
DispatchFullScreenChange(changed[changed.Length() - i - 1]);
}
return true;
}
NS_IMETHODIMP
nsDocument::GetMozFullScreenElement(nsIDOMElement **aFullScreenElement)
{
- ErrorResult rv;
- Element* el = GetMozFullScreenElement(rv);
- if (rv.Failed()) {
- return rv.StealNSResult();
- }
+ Element* el = GetMozFullScreenElement();
nsCOMPtr<nsIDOMElement> retval = do_QueryInterface(el);
retval.forget(aFullScreenElement);
return NS_OK;
}
Element*
-nsDocument::GetMozFullScreenElement(ErrorResult& rv)
-{
- if (IsFullScreenDoc()) {
- // Must have a full-screen element while in full-screen mode.
- Element* el = GetFullScreenElement();
- if (!el) {
- rv.Throw(NS_ERROR_UNEXPECTED);
- }
- return el;
- }
- return nullptr;
-}
-
-Element*
nsDocument::GetFullScreenElement()
{
Element* element = FullScreenStackTop();
NS_ASSERTION(!element ||
element->IsFullScreenAncestor(),
"Fullscreen element should have fullscreen styles applied");
return element;
}
--- a/dom/base/nsDocument.h
+++ b/dom/base/nsDocument.h
@@ -1257,17 +1257,17 @@ public:
// element, if there is one.
void FullScreenStackPop();
// Returns the top element from the full-screen stack.
Element* FullScreenStackTop();
// DOM-exposed fullscreen API
virtual bool MozFullScreenEnabled() override;
- virtual Element* GetMozFullScreenElement(mozilla::ErrorResult& rv) override;
+ Element* GetMozFullScreenElement() override { return GetFullScreenElement(); }
void RequestPointerLock(Element* aElement) override;
bool ShouldLockPointer(Element* aElement, Element* aCurrentLock,
bool aNoFocusCheck = false);
bool SetPointerLock(Element* aElement, int aCursorStyle);
static void UnlockPointer(nsIDocument* aDoc = nullptr);
void SetCurrentOrientation(mozilla::dom::OrientationType aType,
--- a/dom/base/nsIDocument.h
+++ b/dom/base/nsIDocument.h
@@ -2499,17 +2499,17 @@ public:
}
Element* GetCurrentScript();
void ReleaseCapture() const;
virtual void MozSetImageElement(const nsAString& aImageElementId,
Element* aElement) = 0;
nsIURI* GetDocumentURIObject() const;
// Not const because all the full-screen goop is not const
virtual bool MozFullScreenEnabled() = 0;
- virtual Element* GetMozFullScreenElement(mozilla::ErrorResult& rv) = 0;
+ virtual Element* GetMozFullScreenElement() = 0;
bool MozFullScreen()
{
return IsFullScreenDoc();
}
void MozCancelFullScreen();
Element* GetMozPointerLockElement();
void MozExitPointerLock()
{
--- a/dom/webidl/Document.webidl
+++ b/dom/webidl/Document.webidl
@@ -220,17 +220,16 @@ partial interface Document {
};
// http://dvcs.w3.org/hg/fullscreen/raw-file/tip/Overview.html#api
partial interface Document {
// Note: Per spec the 'S' in these two is lowercase, but the "Moz"
// versions hve it uppercase.
readonly attribute boolean mozFullScreenEnabled;
- [Throws]
readonly attribute Element? mozFullScreenElement;
//(Renamed?)void exitFullscreen();
// Gecko-specific fullscreen bits
readonly attribute boolean mozFullScreen;
void mozCancelFullScreen();
};