diff --git a/dom/base/FragmentOrElement.cpp b/dom/base/FragmentOrElement.cpp index 01e1718532b4..764d077b1b9f 100644 --- a/dom/base/FragmentOrElement.cpp +++ b/dom/base/FragmentOrElement.cpp @@ -1024,8 +1024,7 @@ nsIContent::GetEventTargetParent(EventChainPreVisitor& aVisitor) } if (!aVisitor.mEvent->mFlags.mComposedInNativeAnonymousContent && - IsRootOfNativeAnonymousSubtree() && OwnerDoc() && - OwnerDoc()->GetWindow()) { + IsRootOfNativeAnonymousSubtree() && OwnerDoc()->GetWindow()) { aVisitor.SetParentTarget(OwnerDoc()->GetWindow()->GetParentTarget(), true); } else if (parent) { aVisitor.SetParentTarget(parent, false); diff --git a/dom/canvas/CanvasRenderingContext2D.cpp b/dom/canvas/CanvasRenderingContext2D.cpp index 82b84370b64b..b8c9341d0314 100644 --- a/dom/canvas/CanvasRenderingContext2D.cpp +++ b/dom/canvas/CanvasRenderingContext2D.cpp @@ -1861,7 +1861,7 @@ CanvasRenderingContext2D::RegisterAllocation() static already_AddRefed LayerManagerFromCanvasElement(nsINode* aCanvasElement) { - if (!aCanvasElement || !aCanvasElement->OwnerDoc()) { + if (!aCanvasElement) { return nullptr; } @@ -1926,7 +1926,7 @@ CanvasRenderingContext2D::TrySharedTarget(RefPtr& aOutDT, aOutDT = nullptr; aOutProvider = nullptr; - if (!mCanvasElement || !mCanvasElement->OwnerDoc()) { + if (!mCanvasElement) { return false; } @@ -4967,8 +4967,9 @@ CanvasRenderingContext2D::IsPointInPath(JSContext* aCx, double aX, double aY, co // Check for site-specific permission and return false if no permission. if (mCanvasElement) { nsCOMPtr ownerDoc = mCanvasElement->OwnerDoc(); - if (!ownerDoc || !CanvasUtils::IsImageExtractionAllowed(ownerDoc, aCx)) + if (!CanvasUtils::IsImageExtractionAllowed(ownerDoc, aCx)) { return false; + } } EnsureUserSpacePath(aWinding); @@ -5009,8 +5010,9 @@ CanvasRenderingContext2D::IsPointInStroke(JSContext* aCx, double aX, double aY) // Check for site-specific permission and return false if no permission. if (mCanvasElement) { nsCOMPtr ownerDoc = mCanvasElement->OwnerDoc(); - if (!ownerDoc || !CanvasUtils::IsImageExtractionAllowed(ownerDoc, aCx)) + if (!CanvasUtils::IsImageExtractionAllowed(ownerDoc, aCx)) { return false; + } } EnsureUserSpacePath(); @@ -5878,8 +5880,7 @@ CanvasRenderingContext2D::GetImageDataArray(JSContext* aCx, bool usePlaceholder = false; if (mCanvasElement) { nsCOMPtr ownerDoc = mCanvasElement->OwnerDoc(); - usePlaceholder = !ownerDoc || - !CanvasUtils::IsImageExtractionAllowed(ownerDoc, aCx); + usePlaceholder = !CanvasUtils::IsImageExtractionAllowed(ownerDoc, aCx); } do { diff --git a/dom/ipc/TabParent.cpp b/dom/ipc/TabParent.cpp index f93af9581b65..238837f5fef1 100644 --- a/dom/ipc/TabParent.cpp +++ b/dom/ipc/TabParent.cpp @@ -316,7 +316,7 @@ TabParent::SetOwnerElement(Element* aElement) void TabParent::AddWindowListeners() { - if (mFrameElement && mFrameElement->OwnerDoc()) { + if (mFrameElement) { if (nsCOMPtr window = mFrameElement->OwnerDoc()->GetWindow()) { nsCOMPtr eventTarget = window->GetTopWindowRoot(); if (eventTarget) { diff --git a/dom/plugins/base/nsPluginInstanceOwner.cpp b/dom/plugins/base/nsPluginInstanceOwner.cpp index d791a3314455..c37887d7353e 100644 --- a/dom/plugins/base/nsPluginInstanceOwner.cpp +++ b/dom/plugins/base/nsPluginInstanceOwner.cpp @@ -497,7 +497,7 @@ NS_IMETHODIMP nsPluginInstanceOwner::GetDocument(nsIDocument* *aDocument) // XXX sXBL/XBL2 issue: current doc or owner doc? // But keep in mind bug 322414 comment 33 - NS_IF_ADDREF(*aDocument = content->OwnerDoc()); + NS_ADDREF(*aDocument = content->OwnerDoc()); return NS_OK; } @@ -3292,7 +3292,7 @@ void nsPluginInstanceOwner::SetFrame(nsPluginFrame *aFrame) } // Register for widget-focus events on the window root. - if (content && content->OwnerDoc() && content->OwnerDoc()->GetWindow()) { + if (content && content->OwnerDoc()->GetWindow()) { nsCOMPtr windowRoot = content->OwnerDoc()->GetWindow()->GetTopWindowRoot(); if (windowRoot) { windowRoot->AddEventListener(NS_LITERAL_STRING("activate"), diff --git a/dom/svg/SVGViewportElement.h b/dom/svg/SVGViewportElement.h index 4134c7e3c741..a0cb8ec8ca61 100644 --- a/dom/svg/SVGViewportElement.h +++ b/dom/svg/SVGViewportElement.h @@ -147,7 +147,7 @@ protected: bool IsRoot() const { NS_ASSERTION((IsInUncomposedDoc() && !GetParent()) == - (OwnerDoc() && (OwnerDoc()->GetRootElement() == this)), + (OwnerDoc()->GetRootElement() == this), "Can't determine if we're root"); return IsInUncomposedDoc() && !GetParent(); }