зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1218456 - Remove nsILinkHandler. r=smaug
Interfaces with just one implementation don't seem very useful. Differential Revision: https://phabricator.services.mozilla.com/D37406
This commit is contained in:
Родитель
28801c9e84
Коммит
c17be889ab
|
@ -25,9 +25,6 @@ with Files('*LoadContext.*'):
|
|||
with Files('nsAboutRedirector.*'):
|
||||
BUG_COMPONENT = ('Core', 'General')
|
||||
|
||||
with Files('nsILinkHandler.*'):
|
||||
BUG_COMPONENT = ('Core', 'DOM: Core & HTML')
|
||||
|
||||
with Files('nsIScrollObserver.*'):
|
||||
BUG_COMPONENT = ('Core', 'Panning and Zooming')
|
||||
|
||||
|
@ -64,7 +61,6 @@ EXPORTS += [
|
|||
'nsDocShellLoadState.h',
|
||||
'nsDocShellLoadTypes.h',
|
||||
'nsDocShellTreeOwner.h',
|
||||
'nsILinkHandler.h',
|
||||
'nsIScrollObserver.h',
|
||||
'SerializedLoadContext.h',
|
||||
]
|
||||
|
|
|
@ -557,7 +557,6 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsDocShell)
|
|||
NS_INTERFACE_MAP_ENTRY(nsIWebPageDescriptor)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIAuthPromptProvider)
|
||||
NS_INTERFACE_MAP_ENTRY(nsILoadContext)
|
||||
NS_INTERFACE_MAP_ENTRY(nsILinkHandler)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMStorageManager)
|
||||
NS_INTERFACE_MAP_ENTRY_CONDITIONAL(nsINetworkInterceptController,
|
||||
mInterceptController)
|
||||
|
@ -12640,8 +12639,7 @@ OnLinkClickEvent::OnLinkClickEvent(
|
|||
mTriggeringPrincipal(aTriggeringPrincipal),
|
||||
mCsp(aCsp) {}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocShell::OnLinkClick(
|
||||
nsresult nsDocShell::OnLinkClick(
|
||||
nsIContent* aContent, nsIURI* aURI, const nsAString& aTargetSpec,
|
||||
const nsAString& aFileName, nsIInputStream* aPostDataStream,
|
||||
nsIInputStream* aHeadersDataStream, bool aIsUserTriggered, bool aIsTrusted,
|
||||
|
@ -12699,8 +12697,7 @@ static bool IsElementAnchorOrArea(nsIContent* aContent) {
|
|||
return aContent->IsAnyOfHTMLElements(nsGkAtoms::a, nsGkAtoms::area);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocShell::OnLinkClickSync(
|
||||
nsresult nsDocShell::OnLinkClickSync(
|
||||
nsIContent* aContent, nsIURI* aURI, const nsAString& aTargetSpec,
|
||||
const nsAString& aFileName, nsIInputStream* aPostDataStream,
|
||||
nsIInputStream* aHeadersDataStream, bool aNoOpenerImplied,
|
||||
|
@ -12884,9 +12881,8 @@ nsDocShell::OnLinkClickSync(
|
|||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocShell::OnOverLink(nsIContent* aContent, nsIURI* aURI,
|
||||
const nsAString& aTargetSpec) {
|
||||
nsresult nsDocShell::OnOverLink(nsIContent* aContent, nsIURI* aURI,
|
||||
const nsAString& aTargetSpec) {
|
||||
if (aContent->IsEditable()) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -12920,8 +12916,7 @@ nsDocShell::OnOverLink(nsIContent* aContent, nsIURI* aURI,
|
|||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocShell::OnLeaveLink() {
|
||||
nsresult nsDocShell::OnLeaveLink() {
|
||||
nsCOMPtr<nsIWebBrowserChrome> browserChrome(do_GetInterface(mTreeOwner));
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
|
||||
|
|
|
@ -29,7 +29,6 @@
|
|||
#include "nsIDocShellTreeItem.h"
|
||||
#include "nsIDOMStorageManager.h"
|
||||
#include "nsIInterfaceRequestor.h"
|
||||
#include "nsILinkHandler.h"
|
||||
#include "nsILoadContext.h"
|
||||
#include "nsILoadURIDelegate.h"
|
||||
#include "nsINetworkInterceptController.h"
|
||||
|
@ -120,7 +119,6 @@ class nsDocShell final : public nsDocLoader,
|
|||
public nsIWebPageDescriptor,
|
||||
public nsIAuthPromptProvider,
|
||||
public nsILoadContext,
|
||||
public nsILinkHandler,
|
||||
public nsIDOMStorageManager,
|
||||
public nsINetworkInterceptController,
|
||||
public nsIDeprecationWarner,
|
||||
|
@ -211,26 +209,80 @@ class nsDocShell final : public nsDocLoader,
|
|||
return nsDocLoader::Stop();
|
||||
}
|
||||
|
||||
// nsILinkHandler
|
||||
NS_IMETHOD OnLinkClick(nsIContent* aContent, nsIURI* aURI,
|
||||
const nsAString& aTargetSpec,
|
||||
const nsAString& aFileName,
|
||||
nsIInputStream* aPostDataStream,
|
||||
nsIInputStream* aHeadersDataStream,
|
||||
bool aIsUserTriggered, bool aIsTrusted,
|
||||
nsIPrincipal* aTriggeringPrincipal,
|
||||
nsIContentSecurityPolicy* aCsp) override;
|
||||
NS_IMETHOD OnLinkClickSync(
|
||||
/**
|
||||
* Process a click on a link.
|
||||
*
|
||||
* @param aContent the content object used for triggering the link.
|
||||
* @param aURI a URI object that defines the destination for the link
|
||||
* @param aTargetSpec indicates where the link is targeted (may be an empty
|
||||
* string)
|
||||
* @param aFileName non-null when the link should be downloaded as the given
|
||||
* file
|
||||
* @param aPostDataStream the POST data to send
|
||||
* @param aHeadersDataStream ??? (only used for plugins)
|
||||
* @param aIsTrusted false if the triggerer is an untrusted DOM event.
|
||||
* @param aTriggeringPrincipal, if not passed explicitly we fall back to
|
||||
* the document's principal.
|
||||
* @param aCsp, the CSP to be used for the load, that is the CSP of the
|
||||
* entity responsible for causing the load to occur. Most likely
|
||||
* this is the CSP of the document that started the load. In case
|
||||
* aCsp was not passed explicitly we fall back to using
|
||||
* aContent's document's CSP if that document holds any.
|
||||
*/
|
||||
nsresult OnLinkClick(nsIContent* aContent, nsIURI* aURI,
|
||||
const nsAString& aTargetSpec, const nsAString& aFileName,
|
||||
nsIInputStream* aPostDataStream,
|
||||
nsIInputStream* aHeadersDataStream,
|
||||
bool aIsUserTriggered, bool aIsTrusted,
|
||||
nsIPrincipal* aTriggeringPrincipal,
|
||||
nsIContentSecurityPolicy* aCsp);
|
||||
/**
|
||||
* Process a click on a link.
|
||||
*
|
||||
* Works the same as OnLinkClick() except it happens immediately rather than
|
||||
* through an event.
|
||||
*
|
||||
* @param aContent the content object used for triggering the link.
|
||||
* @param aURI a URI obect that defines the destination for the link
|
||||
* @param aTargetSpec indicates where the link is targeted (may be an empty
|
||||
* string)
|
||||
* @param aFileName non-null when the link should be downloaded as the given
|
||||
* file
|
||||
* @param aPostDataStream the POST data to send
|
||||
* @param aHeadersDataStream ??? (only used for plugins)
|
||||
* @param aNoOpenerImplied if the link implies "noopener"
|
||||
* @param aDocShell (out-param) the DocShell that the request was opened on
|
||||
* @param aRequest the request that was opened
|
||||
* @param aTriggeringPrincipal, if not passed explicitly we fall back to
|
||||
* the document's principal.
|
||||
* @param aCsp, the CSP to be used for the load, that is the CSP of the
|
||||
* entity responsible for causing the load to occur. Most likely
|
||||
* this is the CSP of the document that started the load. In case
|
||||
* aCsp was not passed explicitly we fall back to using
|
||||
* aContent's document's CSP if that document holds any.
|
||||
*/
|
||||
nsresult OnLinkClickSync(
|
||||
nsIContent* aContent, nsIURI* aURI, const nsAString& aTargetSpec,
|
||||
const nsAString& aFileName, nsIInputStream* aPostDataStream = 0,
|
||||
nsIInputStream* aHeadersDataStream = 0, bool aNoOpenerImplied = false,
|
||||
nsIDocShell** aDocShell = 0, nsIRequest** aRequest = 0,
|
||||
bool aIsUserTriggered = false,
|
||||
const nsAString& aFileName, nsIInputStream* aPostDataStream = nullptr,
|
||||
nsIInputStream* aHeadersDataStream = nullptr,
|
||||
bool aNoOpenerImplied = false, nsIDocShell** aDocShell = nullptr,
|
||||
nsIRequest** aRequest = nullptr, bool aIsUserTriggered = false,
|
||||
nsIPrincipal* aTriggeringPrincipal = nullptr,
|
||||
nsIContentSecurityPolicy* aCsp = nullptr) override;
|
||||
NS_IMETHOD OnOverLink(nsIContent* aContent, nsIURI* aURI,
|
||||
const nsAString& aTargetSpec) override;
|
||||
NS_IMETHOD OnLeaveLink() override;
|
||||
nsIContentSecurityPolicy* aCsp = nullptr);
|
||||
/**
|
||||
* Process a mouse-over a link.
|
||||
*
|
||||
* @param aContent the linked content.
|
||||
* @param aURI an URI object that defines the destination for the link
|
||||
* @param aTargetSpec indicates where the link is targeted (it may be an empty
|
||||
* string)
|
||||
*/
|
||||
nsresult OnOverLink(nsIContent* aContent, nsIURI* aURI,
|
||||
const nsAString& aTargetSpec);
|
||||
/**
|
||||
* Process the mouse leaving a link.
|
||||
*/
|
||||
nsresult OnLeaveLink();
|
||||
|
||||
// Don't use NS_DECL_NSILOADCONTEXT because some of nsILoadContext's methods
|
||||
// are shared with nsIDocShell and can't be declared twice.
|
||||
|
|
|
@ -1,114 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
#ifndef nsILinkHandler_h___
|
||||
#define nsILinkHandler_h___
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "mozilla/EventForwards.h"
|
||||
|
||||
class nsIContent;
|
||||
class nsIContentSecurityPolicy;
|
||||
class nsIDocShell;
|
||||
class nsIInputStream;
|
||||
class nsIRequest;
|
||||
|
||||
#define NS_ILINKHANDLER_IID \
|
||||
{ \
|
||||
0xceb9aade, 0x43da, 0x4f1a, { \
|
||||
0xac, 0x8a, 0xc7, 0x09, 0xfb, 0x22, 0x46, 0x64 \
|
||||
} \
|
||||
}
|
||||
|
||||
/**
|
||||
* Interface used for handling clicks on links
|
||||
*/
|
||||
class nsILinkHandler : public nsISupports {
|
||||
public:
|
||||
NS_DECLARE_STATIC_IID_ACCESSOR(NS_ILINKHANDLER_IID)
|
||||
|
||||
/**
|
||||
* Process a click on a link.
|
||||
*
|
||||
* @param aContent the content for the frame that generated the trigger
|
||||
* @param aURI a URI object that defines the destination for the link
|
||||
* @param aTargetSpec indicates where the link is targeted (may be an empty
|
||||
* string)
|
||||
* @param aFileName non-null when the link should be downloaded as the given
|
||||
* file
|
||||
* @param aPostDataStream the POST data to send
|
||||
* @param aHeadersDataStream ???
|
||||
* @param aIsTrusted false if the triggerer is an untrusted DOM event.
|
||||
* @param aTriggeringPrincipal, if not passed explicitly we fall back to
|
||||
* the document's principal.
|
||||
* @param aCsp, the CSP to be used for the load, that is the CSP of the
|
||||
* entity responsible for causing the load to occur. Most likely
|
||||
* this is the CSP of the document that started the load. In case
|
||||
* aCsp was not passed explicitly we fall back to using
|
||||
* aContent's document's CSP if that document holds any.
|
||||
*/
|
||||
NS_IMETHOD OnLinkClick(nsIContent* aContent, nsIURI* aURI,
|
||||
const nsAString& aTargetSpec,
|
||||
const nsAString& aFileName,
|
||||
nsIInputStream* aPostDataStream,
|
||||
nsIInputStream* aHeadersDataStream,
|
||||
bool aIsUserTriggered, bool aIsTrusted,
|
||||
nsIPrincipal* aTriggeringPrincipal,
|
||||
nsIContentSecurityPolicy* aCsp) = 0;
|
||||
|
||||
/**
|
||||
* Process a click on a link.
|
||||
*
|
||||
* Works the same as OnLinkClick() except it happens immediately rather than
|
||||
* through an event.
|
||||
*
|
||||
* @param aContent the content for the frame that generated the trigger
|
||||
* @param aURI a URI obect that defines the destination for the link
|
||||
* @param aTargetSpec indicates where the link is targeted (may be an empty
|
||||
* string)
|
||||
* @param aFileName non-null when the link should be downloaded as the given
|
||||
* file
|
||||
* @param aPostDataStream the POST data to send
|
||||
* @param aHeadersDataStream ???
|
||||
* @param aNoOpenerImplied if the link implies "noopener"
|
||||
* @param aDocShell (out-param) the DocShell that the request was opened on
|
||||
* @param aRequest the request that was opened
|
||||
* @param aTriggeringPrincipal, if not passed explicitly we fall back to
|
||||
* the document's principal.
|
||||
* @param aCsp, the CSP to be used for the load, that is the CSP of the
|
||||
* entity responsible for causing the load to occur. Most likely
|
||||
* this is the CSP of the document that started the load. In case
|
||||
* aCsp was not passed explicitly we fall back to using
|
||||
* aContent's document's CSP if that document holds any.
|
||||
*/
|
||||
NS_IMETHOD OnLinkClickSync(
|
||||
nsIContent* aContent, nsIURI* aURI, const nsAString& aTargetSpec,
|
||||
const nsAString& aFileName, nsIInputStream* aPostDataStream = 0,
|
||||
nsIInputStream* aHeadersDataStream = 0, bool aNoOpenerImplied = false,
|
||||
nsIDocShell** aDocShell = 0, nsIRequest** aRequest = 0,
|
||||
bool aIsUserTriggered = false,
|
||||
nsIPrincipal* aTriggeringPrincipal = nullptr,
|
||||
nsIContentSecurityPolicy* aCsp = nullptr) = 0;
|
||||
|
||||
/**
|
||||
* Process a mouse-over a link.
|
||||
*
|
||||
* @param aContent the linked content.
|
||||
* @param aURI an URI object that defines the destination for the link
|
||||
* @param aTargetSpec indicates where the link is targeted (it may be an empty
|
||||
* string)
|
||||
*/
|
||||
NS_IMETHOD OnOverLink(nsIContent* aContent, nsIURI* aURLSpec,
|
||||
const nsAString& aTargetSpec) = 0;
|
||||
|
||||
/**
|
||||
* Process the mouse leaving a link.
|
||||
*/
|
||||
NS_IMETHOD OnLeaveLink() = 0;
|
||||
};
|
||||
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(nsILinkHandler, NS_ILINKHANDLER_IID)
|
||||
|
||||
#endif /* nsILinkHandler_h___ */
|
|
@ -30,7 +30,6 @@
|
|||
#include "mozilla/dom/DocumentTimeline.h"
|
||||
#include "nsFlexContainerFrame.h"
|
||||
#include "nsFocusManager.h"
|
||||
#include "nsILinkHandler.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsIURL.h"
|
||||
#include "nsContainerFrame.h"
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
#include "nsChangeHint.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsDOMAttributeMap.h"
|
||||
#include "nsILinkHandler.h"
|
||||
#include "nsINodeList.h"
|
||||
#include "nsIScrollableFrame.h"
|
||||
#include "nsNodeUtils.h"
|
||||
|
|
|
@ -38,7 +38,6 @@
|
|||
#include "mozilla/dom/DocumentInlines.h"
|
||||
#include "nsIDocumentEncoder.h"
|
||||
#include "nsFocusManager.h"
|
||||
#include "nsILinkHandler.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsIURL.h"
|
||||
#include "nsNetUtil.h"
|
||||
|
|
|
@ -67,7 +67,6 @@
|
|||
#include "mozilla/dom/DocumentInlines.h"
|
||||
#include "nsIDOMEventListener.h"
|
||||
#include "nsIFrameInlines.h"
|
||||
#include "nsILinkHandler.h"
|
||||
#include "mozilla/dom/NodeInfo.h"
|
||||
#include "mozilla/dom/NodeInfoInlines.h"
|
||||
#include "nsIScriptError.h"
|
||||
|
|
|
@ -634,9 +634,8 @@ nsresult HTMLFormElement::SubmitSubmission(
|
|||
|
||||
// If there is no link handler, then we won't actually be able to submit.
|
||||
Document* doc = GetComposedDoc();
|
||||
nsCOMPtr<nsISupports> container = doc ? doc->GetContainer() : nullptr;
|
||||
nsCOMPtr<nsILinkHandler> linkHandler(do_QueryInterface(container));
|
||||
if (!linkHandler || IsEditable()) {
|
||||
nsCOMPtr<nsIDocShell> container = doc ? doc->GetDocShell() : nullptr;
|
||||
if (!container || IsEditable()) {
|
||||
mIsSubmitting = false;
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -701,7 +700,7 @@ nsresult HTMLFormElement::SubmitSubmission(
|
|||
|
||||
nsAutoString target;
|
||||
aFormSubmission->GetTarget(target);
|
||||
rv = linkHandler->OnLinkClickSync(
|
||||
rv = nsDocShell::Cast(container)->OnLinkClickSync(
|
||||
this, actionURI, target, VoidString(), postDataStream, nullptr, false,
|
||||
getter_AddRefs(docShell), getter_AddRefs(mSubmittingRequest),
|
||||
aFormSubmission->IsInitiatedFromUserInput());
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIForm.h"
|
||||
#include "nsILinkHandler.h"
|
||||
#include "mozilla/dom/Document.h"
|
||||
#include "nsGkAtoms.h"
|
||||
#include "nsIFormControl.h"
|
||||
|
|
|
@ -28,7 +28,6 @@ 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"
|
||||
|
@ -389,10 +388,8 @@ NS_IMETHODIMP nsPluginInstanceOwner::GetURL(
|
|||
}
|
||||
|
||||
// the container of the pres context will give us the link handler
|
||||
nsCOMPtr<nsISupports> container = presContext->GetContainerWeak();
|
||||
nsCOMPtr<nsIDocShell> container = presContext->GetDocShell();
|
||||
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")) ||
|
||||
|
@ -446,10 +443,10 @@ NS_IMETHODIMP nsPluginInstanceOwner::GetURL(
|
|||
|
||||
nsCOMPtr<nsIContentSecurityPolicy> csp = content->GetCsp();
|
||||
|
||||
rv = lh->OnLinkClick(content, uri, unitarget, VoidString(), aPostStream,
|
||||
headersDataStream,
|
||||
/* isUserTriggered */ false,
|
||||
/* isTrusted */ true, triggeringPrincipal, csp);
|
||||
rv = nsDocShell::Cast(container)->OnLinkClick(
|
||||
content, uri, unitarget, VoidString(), aPostStream, headersDataStream,
|
||||
/* isUserTriggered */ false, /* isTrusted */ true, triggeringPrincipal,
|
||||
csp);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
|
|
@ -30,7 +30,6 @@
|
|||
#include "nsHTMLDocument.h"
|
||||
#include "mozilla/dom/DocumentInlines.h"
|
||||
#include "nsISelectionController.h"
|
||||
#include "nsILinkHandler.h"
|
||||
#include "nsIInlineSpellChecker.h"
|
||||
#include "nsIPrincipal.h"
|
||||
|
||||
|
|
|
@ -30,7 +30,6 @@
|
|||
#include "nsGenericHTMLElement.h"
|
||||
#include "nsStubMutationObserver.h"
|
||||
|
||||
#include "nsILinkHandler.h"
|
||||
#include "nsISelectionListener.h"
|
||||
#include "mozilla/dom/Selection.h"
|
||||
#include "nsContentUtils.h"
|
||||
|
|
|
@ -52,7 +52,6 @@ class nsITimer;
|
|||
class nsIContent;
|
||||
class nsIFrame;
|
||||
class nsFrameManager;
|
||||
class nsILinkHandler;
|
||||
class nsAtom;
|
||||
class nsIRunnable;
|
||||
class gfxFontFeatureValueSet;
|
||||
|
|
|
@ -27,7 +27,6 @@
|
|||
#include "mozilla/dom/Document.h"
|
||||
#include "mozilla/dom/DocumentInlines.h"
|
||||
#include "nsImageMap.h"
|
||||
#include "nsILinkHandler.h"
|
||||
#include "nsIURL.h"
|
||||
#include "nsILoadGroup.h"
|
||||
#include "nsContainerFrame.h"
|
||||
|
|
Загрузка…
Ссылка в новой задаче