mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 676619 - Implementation of the download attribute for links. r=smaug
This commit is contained in:
parent
10f6d4b56d
commit
12e54d9bdb
@ -4663,7 +4663,6 @@ nsContentUtils::TriggerLink(nsIContent *aContent, nsPresContext *aPresContext,
|
|||||||
|
|
||||||
if (!aClick) {
|
if (!aClick) {
|
||||||
handler->OnOverLink(aContent, aLinkURI, aTargetSpec.get());
|
handler->OnOverLink(aContent, aLinkURI, aTargetSpec.get());
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4681,9 +4680,25 @@ nsContentUtils::TriggerLink(nsIContent *aContent, nsPresContext *aPresContext,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Only pass off the click event if the script security manager says it's ok.
|
// Only pass off the click event if the script security manager says it's ok.
|
||||||
|
// We need to rest aTargetSpec for forced downloads.
|
||||||
if (NS_SUCCEEDED(proceed)) {
|
if (NS_SUCCEEDED(proceed)) {
|
||||||
handler->OnLinkClick(aContent, aLinkURI, aTargetSpec.get(), nullptr, nullptr,
|
|
||||||
aIsTrusted);
|
// A link/area element with a download attribute is allowed to set
|
||||||
|
// a pseudo Content-Disposition header.
|
||||||
|
// For security reasons we only allow websites to declare same-origin resources
|
||||||
|
// as downloadable. If this check fails we will just do the normal thing
|
||||||
|
// (i.e. navigate to the resource).
|
||||||
|
nsAutoString fileName;
|
||||||
|
if ((!aContent->IsHTML(nsGkAtoms::a) && !aContent->IsHTML(nsGkAtoms::area) &&
|
||||||
|
!aContent->IsSVG(nsGkAtoms::a)) ||
|
||||||
|
!aContent->GetAttr(kNameSpaceID_None, nsGkAtoms::download, fileName) ||
|
||||||
|
NS_FAILED(aContent->NodePrincipal()->CheckMayLoad(aLinkURI, false, true))) {
|
||||||
|
fileName.SetIsVoid(true); // No actionable download attribute was found.
|
||||||
|
}
|
||||||
|
|
||||||
|
handler->OnLinkClick(aContent, aLinkURI,
|
||||||
|
fileName.IsVoid() ? aTargetSpec.get() : EmptyString().get(),
|
||||||
|
fileName, nullptr, nullptr, aIsTrusted);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -287,6 +287,7 @@ GK_ATOM(dl, "dl")
|
|||||||
GK_ATOM(doctypePublic, "doctype-public")
|
GK_ATOM(doctypePublic, "doctype-public")
|
||||||
GK_ATOM(doctypeSystem, "doctype-system")
|
GK_ATOM(doctypeSystem, "doctype-system")
|
||||||
GK_ATOM(document, "document")
|
GK_ATOM(document, "document")
|
||||||
|
GK_ATOM(download, "download")
|
||||||
GK_ATOM(DOMAttrModified, "DOMAttrModified")
|
GK_ATOM(DOMAttrModified, "DOMAttrModified")
|
||||||
GK_ATOM(DOMCharacterDataModified, "DOMCharacterDataModified")
|
GK_ATOM(DOMCharacterDataModified, "DOMCharacterDataModified")
|
||||||
GK_ATOM(DOMNodeInserted, "DOMNodeInserted")
|
GK_ATOM(DOMNodeInserted, "DOMNodeInserted")
|
||||||
|
@ -47,7 +47,7 @@ public:
|
|||||||
virtual bool Draggable() const MOZ_OVERRIDE;
|
virtual bool Draggable() const MOZ_OVERRIDE;
|
||||||
|
|
||||||
// nsIDOMHTMLAnchorElement
|
// nsIDOMHTMLAnchorElement
|
||||||
NS_DECL_NSIDOMHTMLANCHORELEMENT
|
NS_DECL_NSIDOMHTMLANCHORELEMENT
|
||||||
|
|
||||||
// DOM memory reporter participant
|
// DOM memory reporter participant
|
||||||
NS_DECL_SIZEOF_EXCLUDING_THIS
|
NS_DECL_SIZEOF_EXCLUDING_THIS
|
||||||
@ -92,7 +92,7 @@ public:
|
|||||||
virtual nsXPCClassInfo* GetClassInfo();
|
virtual nsXPCClassInfo* GetClassInfo();
|
||||||
|
|
||||||
virtual nsIDOMNode* AsDOMNode() { return this; }
|
virtual nsIDOMNode* AsDOMNode() { return this; }
|
||||||
|
|
||||||
virtual void OnDNSPrefetchDeferred();
|
virtual void OnDNSPrefetchDeferred();
|
||||||
virtual void OnDNSPrefetchRequested();
|
virtual void OnDNSPrefetchRequested();
|
||||||
virtual bool HasDeferredDNSPrefetchRequest();
|
virtual bool HasDeferredDNSPrefetchRequest();
|
||||||
@ -160,6 +160,7 @@ NS_IMPL_STRING_ATTR(nsHTMLAnchorElement, Rel, rel)
|
|||||||
NS_IMPL_STRING_ATTR(nsHTMLAnchorElement, Rev, rev)
|
NS_IMPL_STRING_ATTR(nsHTMLAnchorElement, Rev, rev)
|
||||||
NS_IMPL_STRING_ATTR(nsHTMLAnchorElement, Shape, shape)
|
NS_IMPL_STRING_ATTR(nsHTMLAnchorElement, Shape, shape)
|
||||||
NS_IMPL_STRING_ATTR(nsHTMLAnchorElement, Type, type)
|
NS_IMPL_STRING_ATTR(nsHTMLAnchorElement, Type, type)
|
||||||
|
NS_IMPL_STRING_ATTR(nsHTMLAnchorElement, Download, download)
|
||||||
|
|
||||||
int32_t
|
int32_t
|
||||||
nsHTMLAnchorElement::TabIndexDefault()
|
nsHTMLAnchorElement::TabIndexDefault()
|
||||||
|
@ -120,6 +120,7 @@ NS_IMPL_STRING_ATTR(nsHTMLAreaElement, Coords, coords)
|
|||||||
NS_IMPL_URI_ATTR(nsHTMLAreaElement, Href, href)
|
NS_IMPL_URI_ATTR(nsHTMLAreaElement, Href, href)
|
||||||
NS_IMPL_BOOL_ATTR(nsHTMLAreaElement, NoHref, nohref)
|
NS_IMPL_BOOL_ATTR(nsHTMLAreaElement, NoHref, nohref)
|
||||||
NS_IMPL_STRING_ATTR(nsHTMLAreaElement, Shape, shape)
|
NS_IMPL_STRING_ATTR(nsHTMLAreaElement, Shape, shape)
|
||||||
|
NS_IMPL_STRING_ATTR(nsHTMLAreaElement, Download, download)
|
||||||
|
|
||||||
int32_t
|
int32_t
|
||||||
nsHTMLAreaElement::TabIndexDefault()
|
nsHTMLAreaElement::TabIndexDefault()
|
||||||
|
@ -883,6 +883,7 @@ nsHTMLFormElement::SubmitSubmission(nsFormSubmission* aFormSubmission)
|
|||||||
|
|
||||||
rv = linkHandler->OnLinkClickSync(this, actionURI,
|
rv = linkHandler->OnLinkClickSync(this, actionURI,
|
||||||
target.get(),
|
target.get(),
|
||||||
|
NullString(),
|
||||||
postDataStream, nullptr,
|
postDataStream, nullptr,
|
||||||
getter_AddRefs(docShell),
|
getter_AddRefs(docShell),
|
||||||
getter_AddRefs(mSubmittingRequest));
|
getter_AddRefs(mSubmittingRequest));
|
||||||
|
@ -68,6 +68,7 @@ nsSVGAElement::GetHref(nsIDOMSVGAnimatedString * *aHref)
|
|||||||
return mStringAttributes[HREF].ToDOMAnimatedString(aHref, this);
|
return mStringAttributes[HREF].ToDOMAnimatedString(aHref, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NS_IMPL_STRING_ATTR(nsSVGAElement, Download, download)
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
// nsINode methods
|
// nsINode methods
|
||||||
|
@ -1501,6 +1501,7 @@ nsDocShell::LoadURI(nsIURI * aURI,
|
|||||||
flags,
|
flags,
|
||||||
target.get(),
|
target.get(),
|
||||||
nullptr, // No type hint
|
nullptr, // No type hint
|
||||||
|
NullString(), // No forced download
|
||||||
postStream,
|
postStream,
|
||||||
headersStream,
|
headersStream,
|
||||||
loadType,
|
loadType,
|
||||||
@ -4494,7 +4495,7 @@ nsDocShell::LoadErrorPage(nsIURI *aURI, const PRUnichar *aURL,
|
|||||||
|
|
||||||
return InternalLoad(errorPageURI, nullptr, nullptr,
|
return InternalLoad(errorPageURI, nullptr, nullptr,
|
||||||
INTERNAL_LOAD_FLAGS_INHERIT_OWNER, nullptr, nullptr,
|
INTERNAL_LOAD_FLAGS_INHERIT_OWNER, nullptr, nullptr,
|
||||||
nullptr, nullptr, LOAD_ERROR_PAGE,
|
NullString(), nullptr, nullptr, LOAD_ERROR_PAGE,
|
||||||
nullptr, true, nullptr, nullptr);
|
nullptr, true, nullptr, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4525,7 +4526,7 @@ nsDocShell::Reload(uint32_t aReloadFlags)
|
|||||||
|
|
||||||
if (!canReload)
|
if (!canReload)
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
|
||||||
/* If you change this part of code, make sure bug 45297 does not re-occur */
|
/* If you change this part of code, make sure bug 45297 does not re-occur */
|
||||||
if (mOSHE) {
|
if (mOSHE) {
|
||||||
rv = LoadHistoryEntry(mOSHE, loadType);
|
rv = LoadHistoryEntry(mOSHE, loadType);
|
||||||
@ -4549,15 +4550,15 @@ nsDocShell::Reload(uint32_t aReloadFlags)
|
|||||||
INTERNAL_LOAD_FLAGS_NONE, // Do not inherit owner from document
|
INTERNAL_LOAD_FLAGS_NONE, // Do not inherit owner from document
|
||||||
nullptr, // No window target
|
nullptr, // No window target
|
||||||
NS_LossyConvertUTF16toASCII(contentTypeHint).get(),
|
NS_LossyConvertUTF16toASCII(contentTypeHint).get(),
|
||||||
|
NullString(), // No forced download
|
||||||
nullptr, // No post data
|
nullptr, // No post data
|
||||||
nullptr, // No headers data
|
nullptr, // No headers data
|
||||||
loadType, // Load type
|
loadType, // Load type
|
||||||
nullptr, // No SHEntry
|
nullptr, // No SHEntry
|
||||||
true,
|
true,
|
||||||
nullptr, // No nsIDocShell
|
nullptr, // No nsIDocShell
|
||||||
nullptr); // No nsIRequest
|
nullptr); // No nsIRequest
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
@ -8318,12 +8319,13 @@ public:
|
|||||||
mTypeHint = aTypeHint;
|
mTypeHint = aTypeHint;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHOD Run() {
|
NS_IMETHOD Run() {
|
||||||
return mDocShell->InternalLoad(mURI, mReferrer, mOwner, mFlags,
|
return mDocShell->InternalLoad(mURI, mReferrer, mOwner, mFlags,
|
||||||
nullptr, mTypeHint.get(),
|
nullptr, mTypeHint.get(),
|
||||||
mPostData, mHeadersData, mLoadType,
|
NullString(), mPostData, mHeadersData,
|
||||||
mSHEntry, mFirstParty, nullptr, nullptr);
|
mLoadType, mSHEntry, mFirstParty,
|
||||||
|
nullptr, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -8368,6 +8370,7 @@ nsDocShell::InternalLoad(nsIURI * aURI,
|
|||||||
uint32_t aFlags,
|
uint32_t aFlags,
|
||||||
const PRUnichar *aWindowTarget,
|
const PRUnichar *aWindowTarget,
|
||||||
const char* aTypeHint,
|
const char* aTypeHint,
|
||||||
|
const nsAString& aFileName,
|
||||||
nsIInputStream * aPostData,
|
nsIInputStream * aPostData,
|
||||||
nsIInputStream * aHeadersData,
|
nsIInputStream * aHeadersData,
|
||||||
uint32_t aLoadType,
|
uint32_t aLoadType,
|
||||||
@ -8387,7 +8390,6 @@ nsDocShell::InternalLoad(nsIURI * aURI,
|
|||||||
PR_LogPrint("DOCSHELL %p InternalLoad %s\n", this, spec.get());
|
PR_LogPrint("DOCSHELL %p InternalLoad %s\n", this, spec.get());
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Initialize aDocShell/aRequest
|
// Initialize aDocShell/aRequest
|
||||||
if (aDocShell) {
|
if (aDocShell) {
|
||||||
*aDocShell = nullptr;
|
*aDocShell = nullptr;
|
||||||
@ -8602,6 +8604,7 @@ nsDocShell::InternalLoad(nsIURI * aURI,
|
|||||||
aFlags,
|
aFlags,
|
||||||
nullptr, // No window target
|
nullptr, // No window target
|
||||||
aTypeHint,
|
aTypeHint,
|
||||||
|
NullString(), // No forced download
|
||||||
aPostData,
|
aPostData,
|
||||||
aHeadersData,
|
aHeadersData,
|
||||||
aLoadType,
|
aLoadType,
|
||||||
@ -9096,8 +9099,8 @@ nsDocShell::InternalLoad(nsIURI * aURI,
|
|||||||
nsCOMPtr<nsIRequest> req;
|
nsCOMPtr<nsIRequest> req;
|
||||||
rv = DoURILoad(aURI, aReferrer,
|
rv = DoURILoad(aURI, aReferrer,
|
||||||
!(aFlags & INTERNAL_LOAD_FLAGS_DONT_SEND_REFERRER),
|
!(aFlags & INTERNAL_LOAD_FLAGS_DONT_SEND_REFERRER),
|
||||||
owner, aTypeHint, aPostData, aHeadersData, aFirstParty,
|
owner, aTypeHint, aFileName, aPostData, aHeadersData,
|
||||||
aDocShell, getter_AddRefs(req),
|
aFirstParty, aDocShell, getter_AddRefs(req),
|
||||||
(aFlags & INTERNAL_LOAD_FLAGS_FIRST_LOAD) != 0,
|
(aFlags & INTERNAL_LOAD_FLAGS_FIRST_LOAD) != 0,
|
||||||
(aFlags & INTERNAL_LOAD_FLAGS_BYPASS_CLASSIFIER) != 0,
|
(aFlags & INTERNAL_LOAD_FLAGS_BYPASS_CLASSIFIER) != 0,
|
||||||
(aFlags & INTERNAL_LOAD_FLAGS_FORCE_ALLOW_COOKIES) != 0);
|
(aFlags & INTERNAL_LOAD_FLAGS_FORCE_ALLOW_COOKIES) != 0);
|
||||||
@ -9170,6 +9173,7 @@ nsDocShell::DoURILoad(nsIURI * aURI,
|
|||||||
bool aSendReferrer,
|
bool aSendReferrer,
|
||||||
nsISupports * aOwner,
|
nsISupports * aOwner,
|
||||||
const char * aTypeHint,
|
const char * aTypeHint,
|
||||||
|
const nsAString & aFileName,
|
||||||
nsIInputStream * aPostData,
|
nsIInputStream * aPostData,
|
||||||
nsIInputStream * aHeadersData,
|
nsIInputStream * aHeadersData,
|
||||||
bool aFirstParty,
|
bool aFirstParty,
|
||||||
@ -9269,11 +9273,19 @@ nsDocShell::DoURILoad(nsIURI * aURI,
|
|||||||
if (aTypeHint && *aTypeHint) {
|
if (aTypeHint && *aTypeHint) {
|
||||||
channel->SetContentType(nsDependentCString(aTypeHint));
|
channel->SetContentType(nsDependentCString(aTypeHint));
|
||||||
mContentTypeHint = aTypeHint;
|
mContentTypeHint = aTypeHint;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
mContentTypeHint.Truncate();
|
mContentTypeHint.Truncate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!aFileName.IsVoid()) {
|
||||||
|
rv = channel->SetContentDisposition(nsIChannel::DISPOSITION_ATTACHMENT);
|
||||||
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
if (!aFileName.IsEmpty()) {
|
||||||
|
rv = channel->SetContentDispositionFilename(aFileName);
|
||||||
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//hack
|
//hack
|
||||||
nsCOMPtr<nsIHttpChannel> httpChannel(do_QueryInterface(channel));
|
nsCOMPtr<nsIHttpChannel> httpChannel(do_QueryInterface(channel));
|
||||||
nsCOMPtr<nsIHttpChannelInternal> httpChannelInternal(do_QueryInterface(channel));
|
nsCOMPtr<nsIHttpChannelInternal> httpChannelInternal(do_QueryInterface(channel));
|
||||||
@ -10586,11 +10598,12 @@ nsDocShell::LoadHistoryEntry(nsISHEntry * aEntry, uint32_t aLoadType)
|
|||||||
owner,
|
owner,
|
||||||
INTERNAL_LOAD_FLAGS_NONE, // Do not inherit owner from document (security-critical!)
|
INTERNAL_LOAD_FLAGS_NONE, // Do not inherit owner from document (security-critical!)
|
||||||
nullptr, // No window target
|
nullptr, // No window target
|
||||||
contentType.get(), // Type hint
|
contentType.get(), // Type hint
|
||||||
postData, // Post data stream
|
NullString(), // No forced file download
|
||||||
|
postData, // Post data stream
|
||||||
nullptr, // No headers stream
|
nullptr, // No headers stream
|
||||||
aLoadType, // Load type
|
aLoadType, // Load type
|
||||||
aEntry, // SHEntry
|
aEntry, // SHEntry
|
||||||
true,
|
true,
|
||||||
nullptr, // No nsIDocShell
|
nullptr, // No nsIDocShell
|
||||||
nullptr); // No nsIRequest
|
nullptr); // No nsIRequest
|
||||||
@ -11823,7 +11836,8 @@ public:
|
|||||||
OnLinkClickEvent(nsDocShell* aHandler, nsIContent* aContent,
|
OnLinkClickEvent(nsDocShell* aHandler, nsIContent* aContent,
|
||||||
nsIURI* aURI,
|
nsIURI* aURI,
|
||||||
const PRUnichar* aTargetSpec,
|
const PRUnichar* aTargetSpec,
|
||||||
nsIInputStream* aPostDataStream,
|
const nsAString& aFileName,
|
||||||
|
nsIInputStream* aPostDataStream,
|
||||||
nsIInputStream* aHeadersDataStream,
|
nsIInputStream* aHeadersDataStream,
|
||||||
bool aIsTrusted);
|
bool aIsTrusted);
|
||||||
|
|
||||||
@ -11834,8 +11848,8 @@ public:
|
|||||||
nsCxPusher pusher;
|
nsCxPusher pusher;
|
||||||
if (mIsTrusted || pusher.Push(mContent)) {
|
if (mIsTrusted || pusher.Push(mContent)) {
|
||||||
mHandler->OnLinkClickSync(mContent, mURI,
|
mHandler->OnLinkClickSync(mContent, mURI,
|
||||||
mTargetSpec.get(), mPostDataStream,
|
mTargetSpec.get(), mFileName,
|
||||||
mHeadersDataStream,
|
mPostDataStream, mHeadersDataStream,
|
||||||
nullptr, nullptr);
|
nullptr, nullptr);
|
||||||
}
|
}
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
@ -11845,6 +11859,7 @@ private:
|
|||||||
nsRefPtr<nsDocShell> mHandler;
|
nsRefPtr<nsDocShell> mHandler;
|
||||||
nsCOMPtr<nsIURI> mURI;
|
nsCOMPtr<nsIURI> mURI;
|
||||||
nsString mTargetSpec;
|
nsString mTargetSpec;
|
||||||
|
nsString mFileName;
|
||||||
nsCOMPtr<nsIInputStream> mPostDataStream;
|
nsCOMPtr<nsIInputStream> mPostDataStream;
|
||||||
nsCOMPtr<nsIInputStream> mHeadersDataStream;
|
nsCOMPtr<nsIInputStream> mHeadersDataStream;
|
||||||
nsCOMPtr<nsIContent> mContent;
|
nsCOMPtr<nsIContent> mContent;
|
||||||
@ -11856,12 +11871,14 @@ OnLinkClickEvent::OnLinkClickEvent(nsDocShell* aHandler,
|
|||||||
nsIContent *aContent,
|
nsIContent *aContent,
|
||||||
nsIURI* aURI,
|
nsIURI* aURI,
|
||||||
const PRUnichar* aTargetSpec,
|
const PRUnichar* aTargetSpec,
|
||||||
|
const nsAString& aFileName,
|
||||||
nsIInputStream* aPostDataStream,
|
nsIInputStream* aPostDataStream,
|
||||||
nsIInputStream* aHeadersDataStream,
|
nsIInputStream* aHeadersDataStream,
|
||||||
bool aIsTrusted)
|
bool aIsTrusted)
|
||||||
: mHandler(aHandler)
|
: mHandler(aHandler)
|
||||||
, mURI(aURI)
|
, mURI(aURI)
|
||||||
, mTargetSpec(aTargetSpec)
|
, mTargetSpec(aTargetSpec)
|
||||||
|
, mFileName(aFileName)
|
||||||
, mPostDataStream(aPostDataStream)
|
, mPostDataStream(aPostDataStream)
|
||||||
, mHeadersDataStream(aHeadersDataStream)
|
, mHeadersDataStream(aHeadersDataStream)
|
||||||
, mContent(aContent)
|
, mContent(aContent)
|
||||||
@ -11878,6 +11895,7 @@ NS_IMETHODIMP
|
|||||||
nsDocShell::OnLinkClick(nsIContent* aContent,
|
nsDocShell::OnLinkClick(nsIContent* aContent,
|
||||||
nsIURI* aURI,
|
nsIURI* aURI,
|
||||||
const PRUnichar* aTargetSpec,
|
const PRUnichar* aTargetSpec,
|
||||||
|
const nsAString& aFileName,
|
||||||
nsIInputStream* aPostDataStream,
|
nsIInputStream* aPostDataStream,
|
||||||
nsIInputStream* aHeadersDataStream,
|
nsIInputStream* aHeadersDataStream,
|
||||||
bool aIsTrusted)
|
bool aIsTrusted)
|
||||||
@ -11917,7 +11935,7 @@ nsDocShell::OnLinkClick(nsIContent* aContent,
|
|||||||
target = aTargetSpec;
|
target = aTargetSpec;
|
||||||
|
|
||||||
nsCOMPtr<nsIRunnable> ev =
|
nsCOMPtr<nsIRunnable> ev =
|
||||||
new OnLinkClickEvent(this, aContent, aURI, target.get(),
|
new OnLinkClickEvent(this, aContent, aURI, target.get(), aFileName,
|
||||||
aPostDataStream, aHeadersDataStream, aIsTrusted);
|
aPostDataStream, aHeadersDataStream, aIsTrusted);
|
||||||
return NS_DispatchToCurrentThread(ev);
|
return NS_DispatchToCurrentThread(ev);
|
||||||
}
|
}
|
||||||
@ -11926,6 +11944,7 @@ NS_IMETHODIMP
|
|||||||
nsDocShell::OnLinkClickSync(nsIContent *aContent,
|
nsDocShell::OnLinkClickSync(nsIContent *aContent,
|
||||||
nsIURI* aURI,
|
nsIURI* aURI,
|
||||||
const PRUnichar* aTargetSpec,
|
const PRUnichar* aTargetSpec,
|
||||||
|
const nsAString& aFileName,
|
||||||
nsIInputStream* aPostDataStream,
|
nsIInputStream* aPostDataStream,
|
||||||
nsIInputStream* aHeadersDataStream,
|
nsIInputStream* aHeadersDataStream,
|
||||||
nsIDocShell** aDocShell,
|
nsIDocShell** aDocShell,
|
||||||
@ -12018,7 +12037,7 @@ nsDocShell::OnLinkClickSync(nsIContent *aContent,
|
|||||||
if (!clonedURI) {
|
if (!clonedURI) {
|
||||||
return NS_ERROR_OUT_OF_MEMORY;
|
return NS_ERROR_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult rv = InternalLoad(clonedURI, // New URI
|
nsresult rv = InternalLoad(clonedURI, // New URI
|
||||||
referer, // Referer URI
|
referer, // Referer URI
|
||||||
aContent->NodePrincipal(), // Owner is our node's
|
aContent->NodePrincipal(), // Owner is our node's
|
||||||
@ -12026,11 +12045,12 @@ nsDocShell::OnLinkClickSync(nsIContent *aContent,
|
|||||||
INTERNAL_LOAD_FLAGS_NONE,
|
INTERNAL_LOAD_FLAGS_NONE,
|
||||||
target.get(), // Window target
|
target.get(), // Window target
|
||||||
NS_LossyConvertUTF16toASCII(typeHint).get(),
|
NS_LossyConvertUTF16toASCII(typeHint).get(),
|
||||||
|
aFileName, // Download as file
|
||||||
aPostDataStream, // Post data stream
|
aPostDataStream, // Post data stream
|
||||||
aHeadersDataStream, // Headers stream
|
aHeadersDataStream, // Headers stream
|
||||||
LOAD_LINK, // Load type
|
LOAD_LINK, // Load type
|
||||||
nullptr, // No SHEntry
|
nullptr, // No SHEntry
|
||||||
true, // first party site
|
true, // first party site
|
||||||
aDocShell, // DocShell out-param
|
aDocShell, // DocShell out-param
|
||||||
aRequest); // Request out-param
|
aRequest); // Request out-param
|
||||||
if (NS_SUCCEEDED(rv)) {
|
if (NS_SUCCEEDED(rv)) {
|
||||||
|
@ -197,12 +197,14 @@ public:
|
|||||||
NS_IMETHOD OnLinkClick(nsIContent* aContent,
|
NS_IMETHOD OnLinkClick(nsIContent* aContent,
|
||||||
nsIURI* aURI,
|
nsIURI* aURI,
|
||||||
const PRUnichar* aTargetSpec,
|
const PRUnichar* aTargetSpec,
|
||||||
|
const nsAString& aFileName,
|
||||||
nsIInputStream* aPostDataStream,
|
nsIInputStream* aPostDataStream,
|
||||||
nsIInputStream* aHeadersDataStream,
|
nsIInputStream* aHeadersDataStream,
|
||||||
bool aIsTrusted);
|
bool aIsTrusted);
|
||||||
NS_IMETHOD OnLinkClickSync(nsIContent* aContent,
|
NS_IMETHOD OnLinkClickSync(nsIContent* aContent,
|
||||||
nsIURI* aURI,
|
nsIURI* aURI,
|
||||||
const PRUnichar* aTargetSpec,
|
const PRUnichar* aTargetSpec,
|
||||||
|
const nsAString& aFileName,
|
||||||
nsIInputStream* aPostDataStream = 0,
|
nsIInputStream* aPostDataStream = 0,
|
||||||
nsIInputStream* aHeadersDataStream = 0,
|
nsIInputStream* aHeadersDataStream = 0,
|
||||||
nsIDocShell** aDocShell = 0,
|
nsIDocShell** aDocShell = 0,
|
||||||
@ -291,6 +293,7 @@ protected:
|
|||||||
bool aSendReferrer,
|
bool aSendReferrer,
|
||||||
nsISupports * aOwner,
|
nsISupports * aOwner,
|
||||||
const char * aTypeHint,
|
const char * aTypeHint,
|
||||||
|
const nsAString & aFileName,
|
||||||
nsIInputStream * aPostData,
|
nsIInputStream * aPostData,
|
||||||
nsIInputStream * aHeadersData,
|
nsIInputStream * aHeadersData,
|
||||||
bool firstParty,
|
bool firstParty,
|
||||||
|
@ -39,7 +39,7 @@ interface nsIWebBrowserPrint;
|
|||||||
interface nsIVariant;
|
interface nsIVariant;
|
||||||
interface nsIPrivacyTransitionObserver;
|
interface nsIPrivacyTransitionObserver;
|
||||||
|
|
||||||
[scriptable, builtinclass, uuid(318CE516-3F7A-41F6-8F3D-3661650F7A46)]
|
[scriptable, builtinclass, uuid(a106db7f-6449-4a6b-914f-834ba308c3e2)]
|
||||||
interface nsIDocShell : nsISupports
|
interface nsIDocShell : nsISupports
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
@ -118,6 +118,8 @@ interface nsIDocShell : nsISupports
|
|||||||
* @param aWindowTarget - Window target for the load.
|
* @param aWindowTarget - Window target for the load.
|
||||||
* @param aTypeHint - A hint as to the content-type of the resulting
|
* @param aTypeHint - A hint as to the content-type of the resulting
|
||||||
* data. May be null or empty if no hint.
|
* data. May be null or empty if no hint.
|
||||||
|
* @param aFileName - Non-null when the link should be downloaded as
|
||||||
|
the given filename.
|
||||||
* @param aPostDataStream - Post data stream (if POSTing)
|
* @param aPostDataStream - Post data stream (if POSTing)
|
||||||
* @param aHeadersStream - Stream containing "extra" request headers...
|
* @param aHeadersStream - Stream containing "extra" request headers...
|
||||||
* @param aLoadFlags - Flags to modify load behaviour. Flags are defined
|
* @param aLoadFlags - Flags to modify load behaviour. Flags are defined
|
||||||
@ -130,6 +132,7 @@ interface nsIDocShell : nsISupports
|
|||||||
in uint32_t aFlags,
|
in uint32_t aFlags,
|
||||||
in wstring aWindowTarget,
|
in wstring aWindowTarget,
|
||||||
in string aTypeHint,
|
in string aTypeHint,
|
||||||
|
in AString aFileName,
|
||||||
in nsIInputStream aPostDataStream,
|
in nsIInputStream aPostDataStream,
|
||||||
in nsIInputStream aHeadersStream,
|
in nsIInputStream aHeadersStream,
|
||||||
in unsigned long aLoadFlags,
|
in unsigned long aLoadFlags,
|
||||||
|
@ -16,8 +16,8 @@ class nsGUIEvent;
|
|||||||
|
|
||||||
// Interface ID for nsILinkHandler
|
// Interface ID for nsILinkHandler
|
||||||
#define NS_ILINKHANDLER_IID \
|
#define NS_ILINKHANDLER_IID \
|
||||||
{ 0xd85670a1, 0x224a, 0x4562, \
|
{ 0xceb9aade, 0x43da, 0x4f1a, \
|
||||||
{ 0x87, 0xa9, 0x43, 0xa5, 0x24, 0xe7, 0xd0, 0x1b } }
|
{ 0xac, 0x8a, 0xc7, 0x09, 0xfb, 0x22, 0x46, 0x64 } }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interface used for handling clicks on links
|
* Interface used for handling clicks on links
|
||||||
@ -34,12 +34,14 @@ public:
|
|||||||
* @param aTargetSpec indicates where the link is targeted (may be an empty
|
* @param aTargetSpec indicates where the link is targeted (may be an empty
|
||||||
* string)
|
* string)
|
||||||
* @param aPostDataStream the POST data to send
|
* @param aPostDataStream the POST data to send
|
||||||
|
* @param aFileName non-null when the link should be downloaded as the given file
|
||||||
* @param aHeadersDataStream ???
|
* @param aHeadersDataStream ???
|
||||||
* @param aIsTrusted false if the triggerer is an untrusted DOM event.
|
* @param aIsTrusted false if the triggerer is an untrusted DOM event.
|
||||||
*/
|
*/
|
||||||
NS_IMETHOD OnLinkClick(nsIContent* aContent,
|
NS_IMETHOD OnLinkClick(nsIContent* aContent,
|
||||||
nsIURI* aURI,
|
nsIURI* aURI,
|
||||||
const PRUnichar* aTargetSpec,
|
const PRUnichar* aTargetSpec,
|
||||||
|
const nsAString& aFileName,
|
||||||
nsIInputStream* aPostDataStream,
|
nsIInputStream* aPostDataStream,
|
||||||
nsIInputStream* aHeadersDataStream,
|
nsIInputStream* aHeadersDataStream,
|
||||||
bool aIsTrusted) = 0;
|
bool aIsTrusted) = 0;
|
||||||
@ -54,14 +56,16 @@ public:
|
|||||||
* @param aURI a URI obect that defines the destination for 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
|
* @param aTargetSpec indicates where the link is targeted (may be an empty
|
||||||
* string)
|
* string)
|
||||||
|
* @param aFileName non-null when the link should be downloaded as the given file
|
||||||
* @param aPostDataStream the POST data to send
|
* @param aPostDataStream the POST data to send
|
||||||
* @param aHeadersDataStream ???
|
* @param aHeadersDataStream ???
|
||||||
* @param aDocShell (out-param) the DocShell that the request was opened on
|
* @param aDocShell (out-param) the DocShell that the request was opened on
|
||||||
* @param aRequest the request that was opened
|
* @param aRequest the request that was opened
|
||||||
*/
|
*/
|
||||||
NS_IMETHOD OnLinkClickSync(nsIContent* aContent,
|
NS_IMETHOD OnLinkClickSync(nsIContent* aContent,
|
||||||
nsIURI* aURI,
|
nsIURI* aURI,
|
||||||
const PRUnichar* aTargetSpec,
|
const PRUnichar* aTargetSpec,
|
||||||
|
const nsAString& aFileName,
|
||||||
nsIInputStream* aPostDataStream = 0,
|
nsIInputStream* aPostDataStream = 0,
|
||||||
nsIInputStream* aHeadersDataStream = 0,
|
nsIInputStream* aHeadersDataStream = 0,
|
||||||
nsIDocShell** aDocShell = 0,
|
nsIDocShell** aDocShell = 0,
|
||||||
|
@ -16,13 +16,14 @@
|
|||||||
* http://www.whatwg.org/specs/web-apps/current-work/
|
* http://www.whatwg.org/specs/web-apps/current-work/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
[scriptable, uuid(68F49F8F-5FFD-44EB-A59F-D2B3F4817299)]
|
[scriptable, uuid(1339c36e-23ad-4047-a04c-1702e27c7c83)]
|
||||||
interface nsIDOMHTMLAnchorElement : nsIDOMHTMLElement
|
interface nsIDOMHTMLAnchorElement : nsIDOMHTMLElement
|
||||||
{
|
{
|
||||||
attribute DOMString href;
|
attribute DOMString href;
|
||||||
attribute DOMString target;
|
attribute DOMString target;
|
||||||
|
|
||||||
attribute DOMString ping;
|
attribute DOMString ping;
|
||||||
|
attribute DOMString download;
|
||||||
|
|
||||||
attribute DOMString rel;
|
attribute DOMString rel;
|
||||||
attribute DOMString hreflang;
|
attribute DOMString hreflang;
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
* http://www.whatwg.org/specs/web-apps/current-work/
|
* http://www.whatwg.org/specs/web-apps/current-work/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
[scriptable, uuid(D3043539-158A-43EC-B845-175B5726AEB7)]
|
[scriptable, uuid(69c5ce45-108a-442e-91c5-8c874e384ed7)]
|
||||||
interface nsIDOMHTMLAreaElement : nsIDOMHTMLElement
|
interface nsIDOMHTMLAreaElement : nsIDOMHTMLElement
|
||||||
{
|
{
|
||||||
attribute DOMString alt;
|
attribute DOMString alt;
|
||||||
@ -26,16 +26,17 @@ interface nsIDOMHTMLAreaElement : nsIDOMHTMLElement
|
|||||||
attribute DOMString target;
|
attribute DOMString target;
|
||||||
|
|
||||||
attribute DOMString ping;
|
attribute DOMString ping;
|
||||||
|
attribute DOMString download;
|
||||||
|
|
||||||
// URL decomposition IDL attributes
|
// URL decomposition IDL attributes
|
||||||
attribute DOMString protocol;
|
attribute DOMString protocol;
|
||||||
attribute DOMString host;
|
attribute DOMString host;
|
||||||
attribute DOMString hostname;
|
attribute DOMString hostname;
|
||||||
attribute DOMString port;
|
attribute DOMString port;
|
||||||
attribute DOMString pathname;
|
attribute DOMString pathname;
|
||||||
attribute DOMString search;
|
attribute DOMString search;
|
||||||
attribute DOMString hash;
|
attribute DOMString hash;
|
||||||
|
|
||||||
attribute boolean noHref;
|
attribute boolean noHref;
|
||||||
DOMString toString();
|
DOMString toString();
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
interface nsIDOMSVGAnimatedString;
|
interface nsIDOMSVGAnimatedString;
|
||||||
|
|
||||||
[scriptable, uuid(DBC9B56C-3DE3-4475-A934-EE88D3BCB03C)]
|
[scriptable, uuid(6e0eff6e-ce35-4c01-ab3c-ae81b79b40ca)]
|
||||||
interface nsIDOMSVGAElement
|
interface nsIDOMSVGAElement
|
||||||
: nsIDOMSVGElement
|
: nsIDOMSVGElement
|
||||||
/*
|
/*
|
||||||
@ -33,4 +33,5 @@ interface nsIDOMSVGAElement
|
|||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
readonly attribute nsIDOMSVGAnimatedString target;
|
readonly attribute nsIDOMSVGAnimatedString target;
|
||||||
|
attribute DOMString download;
|
||||||
};
|
};
|
||||||
|
@ -563,7 +563,7 @@ NS_IMETHODIMP nsPluginInstanceOwner::GetURL(const char *aURL,
|
|||||||
Preferences::GetInt("privacy.popups.disable_from_plugins");
|
Preferences::GetInt("privacy.popups.disable_from_plugins");
|
||||||
nsAutoPopupStatePusher popupStatePusher((PopupControlState)blockPopups);
|
nsAutoPopupStatePusher popupStatePusher((PopupControlState)blockPopups);
|
||||||
|
|
||||||
rv = lh->OnLinkClick(mContent, uri, unitarget.get(),
|
rv = lh->OnLinkClick(mContent, uri, unitarget.get(), NullString(),
|
||||||
aPostStream, headersDataStream, true);
|
aPostStream, headersDataStream, true);
|
||||||
|
|
||||||
return rv;
|
return rv;
|
||||||
|
Loading…
Reference in New Issue
Block a user