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

@ -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;
}