forked from mirrors/gecko-dev
Bug 1441009: Don't null-check OwnerDoc. r=smaug
Can't return null. MozReview-Commit-ID: JzcNwmsCxIu
This commit is contained in:
parent
d6a3786a64
commit
0ad7abf15e
5 changed files with 12 additions and 12 deletions
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -1861,7 +1861,7 @@ CanvasRenderingContext2D::RegisterAllocation()
|
|||
static already_AddRefed<LayerManager>
|
||||
LayerManagerFromCanvasElement(nsINode* aCanvasElement)
|
||||
{
|
||||
if (!aCanvasElement || !aCanvasElement->OwnerDoc()) {
|
||||
if (!aCanvasElement) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
|
@ -1926,7 +1926,7 @@ CanvasRenderingContext2D::TrySharedTarget(RefPtr<gfx::DrawTarget>& 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<nsIDocument> 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<nsIDocument> 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<nsIDocument> ownerDoc = mCanvasElement->OwnerDoc();
|
||||
usePlaceholder = !ownerDoc ||
|
||||
!CanvasUtils::IsImageExtractionAllowed(ownerDoc, aCx);
|
||||
usePlaceholder = !CanvasUtils::IsImageExtractionAllowed(ownerDoc, aCx);
|
||||
}
|
||||
|
||||
do {
|
||||
|
|
|
|||
|
|
@ -316,7 +316,7 @@ TabParent::SetOwnerElement(Element* aElement)
|
|||
void
|
||||
TabParent::AddWindowListeners()
|
||||
{
|
||||
if (mFrameElement && mFrameElement->OwnerDoc()) {
|
||||
if (mFrameElement) {
|
||||
if (nsCOMPtr<nsPIDOMWindowOuter> window = mFrameElement->OwnerDoc()->GetWindow()) {
|
||||
nsCOMPtr<EventTarget> eventTarget = window->GetTopWindowRoot();
|
||||
if (eventTarget) {
|
||||
|
|
|
|||
|
|
@ -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<EventTarget> windowRoot = content->OwnerDoc()->GetWindow()->GetTopWindowRoot();
|
||||
if (windowRoot) {
|
||||
windowRoot->AddEventListener(NS_LITERAL_STRING("activate"),
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue