зеркало из https://github.com/mozilla/gecko-dev.git
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:
Родитель
58e3682952
Коммит
678c18063d
|
@ -1305,10 +1305,8 @@ void ChromeTooltipListener::sTooltipCallback(nsITimer* aTimer,
|
|||
self->mMouseScreenY - screenDot.y / scaleFactor,
|
||||
tooltipText, directionText);
|
||||
self->mLastShownTooltipText = std::move(tooltipText);
|
||||
if (self->mPossibleTooltipNode->OwnerDoc()) {
|
||||
self->mLastDocshell = do_GetWeakReference(
|
||||
self->mPossibleTooltipNode->OwnerDoc()->GetDocShell());
|
||||
}
|
||||
self->mLastDocshell = do_GetWeakReference(
|
||||
self->mPossibleTooltipNode->OwnerDoc()->GetDocShell());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -2175,7 +2175,7 @@ void HTMLMediaElement::Load() {
|
|||
HasAttr(kNameSpaceID_None, nsGkAtoms::autoplay),
|
||||
AutoplayPolicy::IsAllowedToPlay(*this), OwnerDoc(),
|
||||
DocumentOrigin(OwnerDoc()).get(),
|
||||
OwnerDoc() ? OwnerDoc()->HasBeenUserGestureActivated() : 0, mMuted,
|
||||
OwnerDoc()->HasBeenUserGestureActivated(), mMuted,
|
||||
mVolume));
|
||||
|
||||
if (mIsRunningLoadMethod) {
|
||||
|
|
|
@ -3163,7 +3163,7 @@ void nsPluginInstanceOwner::SetFrame(nsPluginFrame* aFrame) {
|
|||
|
||||
// If we already have a frame that is changing or going away...
|
||||
if (mPluginFrame) {
|
||||
if (content && content->OwnerDoc() && content->OwnerDoc()->GetWindow()) {
|
||||
if (content && content->OwnerDoc()->GetWindow()) {
|
||||
nsCOMPtr<EventTarget> windowRoot =
|
||||
content->OwnerDoc()->GetWindow()->GetTopWindowRoot();
|
||||
if (windowRoot) {
|
||||
|
|
|
@ -455,7 +455,7 @@ nsresult nsXBLService::LoadBindings(Element* aElement, nsIURI* aURL,
|
|||
// in AllowXULXBL() documents in content process in production without
|
||||
// knowing.
|
||||
if (XRE_IsContentProcess() &&
|
||||
IsSystemOrChromeURLPrincipal(aOriginPrincipal) && aElement->OwnerDoc() &&
|
||||
IsSystemOrChromeURLPrincipal(aOriginPrincipal) &&
|
||||
!aElement->OwnerDoc()->AllowXULXBL()) {
|
||||
MOZ_ASSERT(false, "Unexpected XBL binding used in the content process");
|
||||
}
|
||||
|
|
|
@ -77,8 +77,7 @@ void ElementPropertyTransition::UpdateStartValueFromReplacedTransition() {
|
|||
CSSPropFlags::CanAnimateOnCompositor),
|
||||
"The transition property should be able to be run on the "
|
||||
"compositor");
|
||||
MOZ_ASSERT(mTarget && mTarget->mElement->OwnerDoc(),
|
||||
"We should have a valid document at this moment");
|
||||
MOZ_ASSERT(mTarget, "We should have a valid target at this moment");
|
||||
|
||||
dom::DocumentTimeline* timeline = mTarget->mElement->OwnerDoc()->Timeline();
|
||||
ComputedTiming computedTiming = GetComputedTimingAt(
|
||||
|
|
Загрузка…
Ссылка в новой задаче