Bug 1583203 - Annotate nsINode::OwnerDoc() as MOZ_NONNULL_RETURN. r=smaug

People keep adding useless null-checks and it was not clear what the consensus
was from bug 1441165, but this should be unobjectionable I guess.

Differential Revision: https://phabricator.services.mozilla.com/D46781

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Emilio Cobos Álvarez 2019-09-23 14:23:17 +00:00
parent b8b5911e89
commit 1a26094a08

View File

@ -597,13 +597,15 @@ class nsINode : public mozilla::dom::EventTarget {
*
* For all other cases OwnerDoc and GetOwnerDocument behave identically.
*/
Document* OwnerDoc() const { return mNodeInfo->GetDocument(); }
Document* OwnerDoc() const MOZ_NONNULL_RETURN {
return mNodeInfo->GetDocument();
}
/**
* Return the "owner document" of this node as an nsINode*. Implemented
* in Document.h.
*/
inline nsINode* OwnerDocAsNode() const;
inline nsINode* OwnerDocAsNode() const MOZ_NONNULL_RETURN;
/**
* Returns true if the content has an ancestor that is a document.