Revert "Issue #2721 - Remove nsILinkHandler."

This reverts commit c3f1c0cdba.
This commit is contained in:
wuggy 2026-09-19 07:22:05 -07:00
commit 733789f40b
16 changed files with 160 additions and 88 deletions

View file

@ -27,6 +27,7 @@
#include "nsIContentIterator.h"
#include "nsFocusManager.h"
#include "nsFrameManager.h"
#include "nsILinkHandler.h"
#include "nsIScriptGlobalObject.h"
#include "nsIURL.h"
#include "nsContainerFrame.h"

View file

@ -17,6 +17,7 @@
#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"

View file

@ -31,6 +31,7 @@
#include "nsIDOMNodeList.h"
#include "nsIContentIterator.h"
#include "nsFocusManager.h"
#include "nsILinkHandler.h"
#include "nsIScriptGlobalObject.h"
#include "nsIURL.h"
#include "nsNetUtil.h"

View file

@ -60,6 +60,7 @@
#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"

View file

@ -49,7 +49,6 @@
#include "nsIInterfaceRequestorUtils.h"
#include "nsIWebProgress.h"
#include "nsIDocShell.h"
#include "nsDocShell.h" // for ::Cast
#include "nsIPrompt.h"
#include "nsIStringBundle.h"
@ -812,8 +811,9 @@ HTMLFormElement::SubmitSubmission(HTMLFormSubmission* aFormSubmission)
// If there is no link handler, then we won't actually be able to submit.
nsIDocument* doc = GetComposedDoc();
nsCOMPtr<nsIDocShell> container = doc ? doc->GetDocShell() : nullptr;
if (!container || IsEditable()) {
nsCOMPtr<nsISupports> container = doc ? doc->GetContainer() : nullptr;
nsCOMPtr<nsILinkHandler> linkHandler(do_QueryInterface(container));
if (!linkHandler || IsEditable()) {
mIsSubmitting = false;
return NS_OK;
}
@ -892,12 +892,12 @@ HTMLFormElement::SubmitSubmission(HTMLFormSubmission* aFormSubmission)
getter_AddRefs(postDataStream));
NS_ENSURE_SUBMIT_SUCCESS(rv);
rv = nsDocShell::Cast(container)->OnLinkClickSync(this, actionURI,
target.get(),
NullString(),
postDataStream, nullptr,
getter_AddRefs(docShell),
getter_AddRefs(mSubmittingRequest));
rv = linkHandler->OnLinkClickSync(this, actionURI,
target.get(),
NullString(),
postDataStream, nullptr,
getter_AddRefs(docShell),
getter_AddRefs(mSubmittingRequest));
NS_ENSURE_SUBMIT_SUCCESS(rv);
}

View file

@ -7,6 +7,7 @@
#include "nsCOMPtr.h"
#include "nsIForm.h"
#include "nsILinkHandler.h"
#include "nsIDocument.h"
#include "nsGkAtoms.h"
#include "nsIFormControl.h"

View file

@ -79,7 +79,6 @@ else:
]
LOCAL_INCLUDES += [
'/docshell/base',
'/dom/base',
'/dom/plugins/ipc',
'/layout/generic',

View file

@ -27,6 +27,7 @@ using mozilla::DefaultXDisplay;
#include "nsIStringStream.h"
#include "nsNetUtil.h"
#include "mozilla/Preferences.h"
#include "nsILinkHandler.h"
#include "nsIDocShellTreeItem.h"
#include "nsIWebBrowserChrome.h"
#include "nsLayoutUtils.h"
@ -45,7 +46,6 @@ using mozilla::DefaultXDisplay;
#include "nsIScriptSecurityManager.h"
#include "nsIScrollableFrame.h"
#include "nsIDocShell.h"
#include "nsDocShell.h" // for ::Cast
#include "ImageContainer.h"
#include "nsIDOMHTMLCollection.h"
#include "GLContext.h"
@ -440,8 +440,10 @@ NS_IMETHODIMP nsPluginInstanceOwner::GetURL(const char *aURL,
}
// the container of the pres context will give us the link handler
nsCOMPtr<nsIDocShell> container = presContext->GetDocShell();
nsCOMPtr<nsISupports> container = presContext->GetContainerWeak();
NS_ENSURE_TRUE(container,NS_ERROR_FAILURE);
nsCOMPtr<nsILinkHandler> lh = do_QueryInterface(container);
NS_ENSURE_TRUE(lh, NS_ERROR_FAILURE);
nsAutoString unitarget;
if ((0 == PL_strcmp(aTarget, "newwindow")) ||
@ -493,14 +495,8 @@ NS_IMETHODIMP nsPluginInstanceOwner::GetURL(const char *aURL,
triggeringPrincipal = BasePrincipal::CreateCodebasePrincipal(uri, attrs);
}
rv = nsDocShell::Cast(container)->OnLinkClick(content,
uri,
unitarget.get(),
NullString(),
aPostStream,
headersDataStream,
true,
triggeringPrincipal);
rv = lh->OnLinkClick(content, uri, unitarget.get(), NullString(),
aPostStream, headersDataStream, true, triggeringPrincipal);
return rv;
}