From 5e0cd430c22a7e93294c3b281d6893e17b1195fc Mon Sep 17 00:00:00 2001 From: Cameron Kaiser Date: Sat, 16 Nov 2019 15:45:56 -0800 Subject: [PATCH] #579: M1218456 +backbugs -nsILinkHandler removal, with changes for 45 --- dom/base/Element.cpp | 60 +++++++++++++++---------------- dom/base/Element.h | 1 - dom/base/FragmentOrElement.cpp | 1 - dom/base/nsContentUtils.cpp | 14 ++++---- dom/base/nsContentUtils.h | 3 +- dom/base/nsDocument.cpp | 1 + dom/base/nsIDocument.h | 10 +++++- dom/base/nsINode.cpp | 1 - dom/html/HTMLAnchorElement.cpp | 13 ++----- dom/html/HTMLFormElement.cpp | 1 + dom/html/nsFormSubmission.cpp | 1 - dom/html/nsGenericHTMLElement.cpp | 19 ++-------- dom/svg/SVGAElement.cpp | 6 ++++ editor/libeditor/nsHTMLEditor.cpp | 24 +++++-------- editor/libeditor/nsHTMLEditor.h | 4 +-- layout/base/nsDocumentViewer.cpp | 13 ------- layout/base/nsPresContext.cpp | 1 - layout/base/nsPresContext.h | 12 +------ layout/base/nsPresShell.cpp | 3 -- layout/generic/nsImageFrame.cpp | 2 +- layout/xul/nsImageBoxFrame.cpp | 1 - 21 files changed, 74 insertions(+), 117 deletions(-) diff --git a/dom/base/Element.cpp b/dom/base/Element.cpp index ec0fa330d..bdfea9ae8 100644 --- a/dom/base/Element.cpp +++ b/dom/base/Element.cpp @@ -16,6 +16,7 @@ #include "mozilla/DebugOnly.h" #include "mozilla/dom/Animation.h" #include "mozilla/dom/Attr.h" +#include "nsDocShell.h" #include "nsDOMAttributeMap.h" #include "nsIAtom.h" #include "nsIContentInlines.h" @@ -26,7 +27,6 @@ #include "nsIContentIterator.h" #include "nsFocusManager.h" #include "nsFrameManager.h" -#include "nsILinkHandler.h" #include "nsIScriptGlobalObject.h" #include "nsIURL.h" #include "nsContainerFrame.h" @@ -2171,12 +2171,15 @@ Element::GetPrimaryFrame(mozFlushType aType) nsresult Element::LeaveLink(nsPresContext* aPresContext) { - nsILinkHandler *handler = aPresContext->GetLinkHandler(); - if (!handler) { + if (!aPresContext || !aPresContext->Document()->LinkHandlingEnabled()) { return NS_OK; } - return handler->OnLeaveLink(); + nsIDocShell* shell = aPresContext->Document()->GetDocShell(); + if (!shell) { + return NS_OK; + } + return nsDocShell::Cast(shell)->OnLeaveLink(); } nsresult @@ -2941,7 +2944,6 @@ Element::CheckHandleEventForLinksPrecondition(EventChainVisitor& aVisitor, (aVisitor.mEvent->mMessage != eMouseClick) && (aVisitor.mEvent->mMessage != eKeyPress) && (aVisitor.mEvent->mMessage != eLegacyDOMActivate)) || - !aVisitor.mPresContext || aVisitor.mEvent->mFlags.mMultipleActionsPrevented) { return false; } @@ -2985,7 +2987,7 @@ Element::PreHandleEventForLinks(EventChainPreVisitor& aVisitor) if (!focusEvent || !focusEvent->isRefocus) { nsAutoString target; GetLinkTarget(target); - nsContentUtils::TriggerLink(this, aVisitor.mPresContext, absURI, target, + nsContentUtils::TriggerLink(this, absURI, target, false, true, true); // Make sure any ancestor links don't also TriggerLink aVisitor.mEvent->mFlags.mMultipleActionsPrevented = true; @@ -3038,27 +3040,28 @@ Element::PostHandleEventForLinks(EventChainPostVisitor& aVisitor) case eMouseDown: { if (aVisitor.mEvent->AsMouseEvent()->button == - WidgetMouseEvent::eLeftButton) { - // don't make the link grab the focus if there is no link handler - nsILinkHandler *handler = aVisitor.mPresContext->GetLinkHandler(); - nsIDocument *document = GetComposedDoc(); - if (handler && document) { - nsIFocusManager* fm = nsFocusManager::GetFocusManager(); - if (fm) { - aVisitor.mEvent->mFlags.mMultipleActionsPrevented = true; + WidgetMouseEvent::eLeftButton && + OwnerDoc()->LinkHandlingEnabled()) { + aVisitor.mEvent->mFlags.mMultipleActionsPrevented = true; + if (IsInComposedDoc()) { + if (nsIFocusManager* fm = nsFocusManager::GetFocusManager()) { nsCOMPtr elem = do_QueryInterface(this); fm->SetFocus(elem, nsIFocusManager::FLAG_BYMOUSE | nsIFocusManager::FLAG_NOSCROLL); } + } + if (aVisitor.mPresContext) { EventStateManager::SetActiveManager( aVisitor.mPresContext->EventStateManager(), this); + } - // OK, we're pretty sure we're going to load, so warm up a speculative - // connection to be sure we have one ready when we open the channel. + // OK, we're pretty sure we're going to load, so warm up a speculative + // connection to be sure we have one ready when we open the channel. + if (nsIDocShell* shell = OwnerDoc()->GetDocShell()) { nsCOMPtr speculator(do_QueryInterface(nsContentUtils::GetIOService())); - nsCOMPtr ir = do_QueryInterface(handler); + nsCOMPtr ir = do_QueryInterface(shell); // We need bug 1304219 for this part, but this will suffice for now. //speculator->SpeculativeConnect2(absURI, NodePrincipal(), ir); speculator->SpeculativeConnect(absURI, ir); @@ -3076,19 +3079,16 @@ Element::PostHandleEventForLinks(EventChainPostVisitor& aVisitor) } // The default action is simply to dispatch DOMActivate - nsCOMPtr shell = aVisitor.mPresContext->GetPresShell(); - if (shell) { - // single-click - nsEventStatus status = nsEventStatus_eIgnore; - // DOMActive event should be trusted since the activation is actually - // occurred even if the cause is an untrusted click event. - InternalUIEvent actEvent(true, eLegacyDOMActivate, mouseEvent); - actEvent.detail = 1; + nsEventStatus status = nsEventStatus_eIgnore; + // DOMActive event should be trusted since the activation is actually + // occurred even if the cause is an untrusted click event. + InternalUIEvent actEvent(true, eLegacyDOMActivate, mouseEvent); + actEvent.detail = 1; - rv = shell->HandleDOMEventWithTarget(this, &actEvent, &status); - if (NS_SUCCEEDED(rv)) { - aVisitor.mEventStatus = nsEventStatus_eConsumeNoDefault; - } + rv = EventDispatcher::Dispatch(this, aVisitor.mPresContext, &actEvent, + nullptr, &status); + if (NS_SUCCEEDED(rv)) { + aVisitor.mEventStatus = nsEventStatus_eConsumeNoDefault; } } break; @@ -3100,7 +3100,7 @@ Element::PostHandleEventForLinks(EventChainPostVisitor& aVisitor) GetLinkTarget(target); const InternalUIEvent* activeEvent = aVisitor.mEvent->AsUIEvent(); MOZ_ASSERT(activeEvent); - nsContentUtils::TriggerLink(this, aVisitor.mPresContext, absURI, target, + nsContentUtils::TriggerLink(this, absURI, target, true, true, activeEvent->IsTrustable()); aVisitor.mEventStatus = nsEventStatus_eConsumeNoDefault; } diff --git a/dom/base/Element.h b/dom/base/Element.h index 03a29ec7c..3fcaf9ff1 100644 --- a/dom/base/Element.h +++ b/dom/base/Element.h @@ -18,7 +18,6 @@ #include "mozilla/EventStates.h" // for member #include "mozilla/dom/DirectionalityUtils.h" #include "nsIDOMElement.h" -#include "nsILinkHandler.h" #include "nsINodeList.h" #include "nsNodeUtils.h" #include "nsAttrAndChildArray.h" diff --git a/dom/base/FragmentOrElement.cpp b/dom/base/FragmentOrElement.cpp index 4a9ee4948..2ada79cf8 100644 --- a/dom/base/FragmentOrElement.cpp +++ b/dom/base/FragmentOrElement.cpp @@ -32,7 +32,6 @@ #include "nsIDOMNodeList.h" #include "nsIContentIterator.h" #include "nsFocusManager.h" -#include "nsILinkHandler.h" #include "nsIScriptGlobalObject.h" #include "nsIURL.h" #include "nsNetUtil.h" diff --git a/dom/base/nsContentUtils.cpp b/dom/base/nsContentUtils.cpp index 12e7ee479..436d764ed 100644 --- a/dom/base/nsContentUtils.cpp +++ b/dom/base/nsContentUtils.cpp @@ -81,6 +81,7 @@ #include "nsCycleCollectionParticipant.h" #include "nsCycleCollector.h" #include "nsDataHashtable.h" +#include "nsDocShell.h" #include "nsDocShellCID.h" #include "nsDocument.h" #include "nsDOMCID.h" @@ -4795,25 +4796,24 @@ nsContentUtils::CombineResourcePrincipals(nsCOMPtr* aResourcePrinc /* static */ void -nsContentUtils::TriggerLink(nsIContent *aContent, nsPresContext *aPresContext, +nsContentUtils::TriggerLink(nsIContent *aContent, nsIURI *aLinkURI, const nsString &aTargetSpec, bool aClick, bool aIsUserTriggered, bool aIsTrusted) { - NS_ASSERTION(aPresContext, "Need a nsPresContext"); NS_PRECONDITION(aLinkURI, "No link URI"); - if (aContent->IsEditable()) { + if (aContent->IsEditable() || !aContent->OwnerDoc()->LinkHandlingEnabled()) { return; } - nsILinkHandler *handler = aPresContext->GetLinkHandler(); - if (!handler) { + nsCOMPtr docShell = aContent->OwnerDoc()->GetDocShell(); + if (!docShell) { return; } if (!aClick) { - handler->OnOverLink(aContent, aLinkURI, aTargetSpec.get()); + nsDocShell::Cast(docShell)->OnOverLink(aContent, aLinkURI, aTargetSpec.get()); return; } @@ -4848,7 +4848,7 @@ nsContentUtils::TriggerLink(nsIContent *aContent, nsPresContext *aPresContext, fileName.SetIsVoid(true); // No actionable download attribute was found. } - handler->OnLinkClick(aContent, aLinkURI, + nsDocShell::Cast(docShell)->OnLinkClick(aContent, aLinkURI, fileName.IsVoid() ? aTargetSpec.get() : EmptyString().get(), fileName, nullptr, nullptr, aIsTrusted); } diff --git a/dom/base/nsContentUtils.h b/dom/base/nsContentUtils.h index 2368b4185..db421a447 100644 --- a/dom/base/nsContentUtils.h +++ b/dom/base/nsContentUtils.h @@ -1506,7 +1506,6 @@ public: * security check using aContent's principal. * * @param aContent the node on which a link was triggered. - * @param aPresContext the pres context, must be non-null. * @param aLinkURI the URI of the link, must be non-null. * @param aTargetSpec the target (like target=, may be empty). * @param aClick whether this was a click or not (if false, this method @@ -1517,7 +1516,7 @@ public: * @param aIsTrusted If false, JS Context will be pushed to stack * when the link is triggered. */ - static void TriggerLink(nsIContent *aContent, nsPresContext *aPresContext, + static void TriggerLink(nsIContent *aContent, nsIURI *aLinkURI, const nsString& aTargetSpec, bool aClick, bool aIsUserTriggered, bool aIsTrusted); diff --git a/dom/base/nsDocument.cpp b/dom/base/nsDocument.cpp index 61d32f47a..b204f7462 100644 --- a/dom/base/nsDocument.cpp +++ b/dom/base/nsDocument.cpp @@ -1435,6 +1435,7 @@ nsIDocument::nsIDocument() mPostedFlushUserFontSet(false), mDidFireDOMContentLoaded(true), mFrameRequestCallbacksScheduled(false), + mLinksEnabled(true), mPartID(0), mUserHasInteracted(false) { diff --git a/dom/base/nsIDocument.h b/dom/base/nsIDocument.h index dae027919..73ee21dd6 100644 --- a/dom/base/nsIDocument.h +++ b/dom/base/nsIDocument.h @@ -1358,7 +1358,8 @@ public: virtual void SetContainer(nsDocShell* aContainer); /** - * Get the container (docshell) for this document. + * Get the container (docshell) for this document. Virtual so that + * the shell service can call it. */ virtual nsISupports* GetContainer() const; @@ -2679,6 +2680,9 @@ public: bool InlineScriptAllowedByCSP(); + void SetLinkHandlingEnabled(bool aValue) { mLinksEnabled = aValue; } + bool LinkHandlingEnabled() { return mLinksEnabled; } + protected: bool GetUseCounter(mozilla::UseCounter aUseCounter) { @@ -2960,6 +2964,10 @@ protected: // UpdateFrameRequestCallbackSchedulingState. bool mFrameRequestCallbacksScheduled : 1; + // False if we've disabled link handling for elements inside this document, + // true otherwise. + bool mLinksEnabled : 1; + enum Type { eUnknown, // should never be used eHTML, diff --git a/dom/base/nsINode.cpp b/dom/base/nsINode.cpp index f17b89ec0..13b3d57ec 100644 --- a/dom/base/nsINode.cpp +++ b/dom/base/nsINode.cpp @@ -61,7 +61,6 @@ #include "nsIDOMNodeList.h" #include "nsIEditor.h" #include "nsIEditorIMESupport.h" -#include "nsILinkHandler.h" #include "mozilla/dom/NodeInfo.h" #include "mozilla/dom/NodeInfoInlines.h" #include "nsIPresShell.h" diff --git a/dom/html/HTMLAnchorElement.cpp b/dom/html/HTMLAnchorElement.cpp index 19ea1a39d..455f81c71 100644 --- a/dom/html/HTMLAnchorElement.cpp +++ b/dom/html/HTMLAnchorElement.cpp @@ -215,16 +215,9 @@ HTMLAnchorElement::IsHTMLFocusable(bool aWithMouse, } // cannot focus links if there is no link handler - nsIDocument* doc = GetComposedDoc(); - if (doc) { - nsIPresShell* presShell = doc->GetShell(); - if (presShell) { - nsPresContext* presContext = presShell->GetPresContext(); - if (presContext && !presContext->GetLinkHandler()) { - *aIsFocusable = false; - return false; - } - } + if (!OwnerDoc()->LinkHandlingEnabled()) { + *aIsFocusable = false; + return false; } // Links that are in an editable region should never be focusable, even if diff --git a/dom/html/HTMLFormElement.cpp b/dom/html/HTMLFormElement.cpp index 421a3bf53..d4d85e18f 100644 --- a/dom/html/HTMLFormElement.cpp +++ b/dom/html/HTMLFormElement.cpp @@ -23,6 +23,7 @@ #include "nsPresContext.h" #include "nsIDocument.h" #include "nsIFormControlFrame.h" +#include "nsILinkHandler.h" #include "nsError.h" #include "nsContentUtils.h" #include "nsInterfaceHashtable.h" diff --git a/dom/html/nsFormSubmission.cpp b/dom/html/nsFormSubmission.cpp index 9d46b980b..66abf1d21 100644 --- a/dom/html/nsFormSubmission.cpp +++ b/dom/html/nsFormSubmission.cpp @@ -8,7 +8,6 @@ #include "nsCOMPtr.h" #include "nsIForm.h" -#include "nsILinkHandler.h" #include "nsIDocument.h" #include "nsGkAtoms.h" #include "nsIFormControl.h" diff --git a/dom/html/nsGenericHTMLElement.cpp b/dom/html/nsGenericHTMLElement.cpp index 5a58c7324..b43338826 100644 --- a/dom/html/nsGenericHTMLElement.cpp +++ b/dom/html/nsGenericHTMLElement.cpp @@ -653,22 +653,9 @@ nsGenericHTMLElement::CheckHandleEventForAnchorsPreconditions( { NS_PRECONDITION(nsCOMPtr(do_QueryObject(this)), "should be called only when |this| implements |Link|"); - - if (!aVisitor.mPresContext) { - // We need a pres context to do link stuff. Some events (e.g. mutation - // events) don't have one. - // XXX: ideally, shouldn't we be able to do what we need without one? - return false; - } - - //Need to check if we hit an imagemap area and if so see if we're handling - //the event on that map or on a link farther up the tree. If we're on a - //link farther up, do nothing. - nsCOMPtr target = aVisitor.mPresContext->EventStateManager()-> - GetEventTargetContent(aVisitor.mEvent); - - return !target || !target->IsHTMLElement(nsGkAtoms::area) || - IsHTMLElement(nsGkAtoms::area); + // When disconnected, only should navigate away per + // https://html.spec.whatwg.org/#cannot-navigate + return IsInComposedDoc() || IsHTMLElement(nsGkAtoms::a); } nsresult diff --git a/dom/svg/SVGAElement.cpp b/dom/svg/SVGAElement.cpp index 845dd14f9..dbf66e851 100644 --- a/dom/svg/SVGAElement.cpp +++ b/dom/svg/SVGAElement.cpp @@ -187,6 +187,12 @@ SVGAElement::IsAttributeMapped(const nsIAtom* name) const bool SVGAElement::IsFocusableInternal(int32_t *aTabIndex, bool aWithMouse) { + // There are some backbugs in + // https://hg.mozilla.org/mozilla-central/rev/fc09b999be43 + if (!OwnerDoc()->LinkHandlingEnabled()) { + return false; + } + nsCOMPtr uri; if (IsLink(getter_AddRefs(uri))) { if (aTabIndex) { diff --git a/editor/libeditor/nsHTMLEditor.cpp b/editor/libeditor/nsHTMLEditor.cpp index add1b40d6..1cb5b0e42 100644 --- a/editor/libeditor/nsHTMLEditor.cpp +++ b/editor/libeditor/nsHTMLEditor.cpp @@ -34,7 +34,6 @@ #include "nsIDOMHTMLAnchorElement.h" #include "nsISelectionController.h" #include "nsIDOMHTMLDocument.h" -#include "nsILinkHandler.h" #include "nsIInlineSpellChecker.h" #include "mozilla/CSSStyleSheet.h" @@ -143,13 +142,10 @@ nsHTMLEditor::~nsHTMLEditor() // free any default style propItems RemoveAllDefaultProperties(); - if (mLinkHandler && mDocWeak) - { - nsCOMPtr ps = GetPresShell(); - - if (ps && ps->GetPresContext()) - { - ps->GetPresContext()->SetLinkHandler(mLinkHandler); + if (mDisabledLinkHandling) { + nsCOMPtr doc = GetDocument(); + if (doc) { + doc->SetLinkHandlingEnabled(mOldLinkHandlingEnabled); } } @@ -268,14 +264,12 @@ nsHTMLEditor::Init(nsIDOMDocument *aDoc, mHTMLCSSUtils = new nsHTMLCSSUtils(this); // disable links - nsCOMPtr presShell = GetPresShell(); - NS_ENSURE_TRUE(presShell, NS_ERROR_FAILURE); - nsPresContext *context = presShell->GetPresContext(); - NS_ENSURE_TRUE(context, NS_ERROR_NULL_POINTER); + nsCOMPtr doc = GetDocument(); + NS_ENSURE_TRUE(doc, NS_ERROR_FAILURE); if (!IsPlaintextEditor() && !IsInteractionAllowed()) { - mLinkHandler = context->GetLinkHandler(); - - context->SetLinkHandler(nullptr); + mDisabledLinkHandling = true; + mOldLinkHandlingEnabled = doc->LinkHandlingEnabled(); + doc->SetLinkHandlingEnabled(false); } // init the type-in state diff --git a/editor/libeditor/nsHTMLEditor.h b/editor/libeditor/nsHTMLEditor.h index 289b8daca..67ed1c3e3 100644 --- a/editor/libeditor/nsHTMLEditor.h +++ b/editor/libeditor/nsHTMLEditor.h @@ -46,7 +46,6 @@ class nsITransferable; class nsIClipboard; class TypeInState; class nsIContentFilter; -class nsILinkHandler; class nsTableOuterFrame; class nsIDOMRange; class nsRange; @@ -954,7 +953,8 @@ protected: void AddMouseClickListener(nsIDOMElement * aElement); void RemoveMouseClickListener(nsIDOMElement * aElement); - nsCOMPtr mLinkHandler; + bool mDisabledLinkHandling = false; + bool mOldLinkHandlingEnabled = false; public: diff --git a/layout/base/nsDocumentViewer.cpp b/layout/base/nsDocumentViewer.cpp index f9b47f5bb..897304c70 100644 --- a/layout/base/nsDocumentViewer.cpp +++ b/layout/base/nsDocumentViewer.cpp @@ -24,7 +24,6 @@ #include "nsIWritablePropertyBag2.h" #include "nsSubDocumentFrame.h" -#include "nsILinkHandler.h" #include "nsIDOMDocument.h" #include "nsISelectionListener.h" #include "mozilla/dom/Selection.h" @@ -884,12 +883,7 @@ nsDocumentViewer::InitInternal(nsIWidget* aParentWidget, nsCOMPtr requestor(mContainer); if (requestor) { if (mPresContext) { - nsCOMPtr linkHandler; - requestor->GetInterface(NS_GET_IID(nsILinkHandler), - getter_AddRefs(linkHandler)); - mPresContext->SetContainer(mContainer); - mPresContext->SetLinkHandler(linkHandler); } // Set script-context-owner in the document @@ -1368,7 +1362,6 @@ AttachContainerRecurse(nsIDocShell* aShell) viewer->GetPresContext(getter_AddRefs(pc)); if (pc) { pc->SetContainer(static_cast(aShell)); - pc->SetLinkHandler(nsCOMPtr(do_QueryInterface(aShell))); } nsCOMPtr presShell; viewer->GetPresShell(getter_AddRefs(presShell)); @@ -2081,12 +2074,6 @@ nsDocumentViewer::Show(void) return rv; if (mPresContext && base_win) { - nsCOMPtr linkHandler(do_GetInterface(base_win)); - - if (linkHandler) { - mPresContext->SetLinkHandler(linkHandler); - } - mPresContext->SetContainer(mContainer); } diff --git a/layout/base/nsPresContext.cpp b/layout/base/nsPresContext.cpp index 28248a532..d5bdf16d1 100644 --- a/layout/base/nsPresContext.cpp +++ b/layout/base/nsPresContext.cpp @@ -1720,7 +1720,6 @@ nsPresContext::GetDocShell() const nsPresContext::Detach() { SetContainer(nullptr); - SetLinkHandler(nullptr); if (mShell) { mShell->CancelInvalidatePresShellIfHidden(); } diff --git a/layout/base/nsPresContext.h b/layout/base/nsPresContext.h index a66253850..68c475049 100644 --- a/layout/base/nsPresContext.h +++ b/layout/base/nsPresContext.h @@ -50,7 +50,6 @@ class nsITheme; class nsIContent; class nsIFrame; class nsFrameManager; -class nsILinkHandler; class nsIAtom; class nsIRunnable; class gfxUserFontEntry; @@ -436,13 +435,8 @@ public: nsIDocShell* GetDocShell() const; - // XXX this are going to be replaced with set/get container - void SetLinkHandler(nsILinkHandler* aHandler) { mLinkHandler = aHandler; } - nsILinkHandler* GetLinkHandler() { return mLinkHandler; } - /** - * Detach this pres context - i.e. cancel relevant timers, - * SetLinkHandler(null), SetContainer(null) etc. + * Detach this pres context - i.e. cancel relevant timers, etc. * Only to be used by the DocumentViewer. */ virtual void Detach(); @@ -1228,10 +1222,6 @@ protected: nsIAtom* MOZ_UNSAFE_REF("always a static atom") mMedium; // initialized by subclass ctors nsCOMPtr mMediaEmulated; - // This pointer is nulled out through SetLinkHandler() in the destructors of - // the classes which set it. (using SetLinkHandler() again). - nsILinkHandler* MOZ_NON_OWNING_REF mLinkHandler; - // Formerly mLangGroup; moving from charset-oriented langGroup to // maintaining actual language settings everywhere (see bug 524107). // This may in fact hold a langGroup such as x-western rather than diff --git a/layout/base/nsPresShell.cpp b/layout/base/nsPresShell.cpp index 6b8fc5d94..25e8df119 100644 --- a/layout/base/nsPresShell.cpp +++ b/layout/base/nsPresShell.cpp @@ -1333,9 +1333,6 @@ PresShell::Destroy() // to us. To avoid the pres context having a dangling reference, set its // pres shell to nullptr mPresContext->SetShell(nullptr); - - // Clear the link handler (weak reference) as well - mPresContext->SetLinkHandler(nullptr); } mHaveShutDown = true; diff --git a/layout/generic/nsImageFrame.cpp b/layout/generic/nsImageFrame.cpp index a9a42b5da..aa18e5548 100644 --- a/layout/generic/nsImageFrame.cpp +++ b/layout/generic/nsImageFrame.cpp @@ -2061,7 +2061,7 @@ nsImageFrame::HandleEvent(nsPresContext* aPresContext, *aEventStatus = nsEventStatus_eConsumeDoDefault; clicked = true; } - nsContentUtils::TriggerLink(anchorNode, aPresContext, uri, target, + nsContentUtils::TriggerLink(anchorNode, uri, target, clicked, true, true); } } diff --git a/layout/xul/nsImageBoxFrame.cpp b/layout/xul/nsImageBoxFrame.cpp index b08d46151..ee52d6074 100644 --- a/layout/xul/nsImageBoxFrame.cpp +++ b/layout/xul/nsImageBoxFrame.cpp @@ -26,7 +26,6 @@ #include "nsIPresShell.h" #include "nsIDocument.h" #include "nsImageMap.h" -#include "nsILinkHandler.h" #include "nsIURL.h" #include "nsILoadGroup.h" #include "nsContainerFrame.h"