aboutsummaryrefslogtreecommitdiffstats
path: root/embed/mozilla/MozDownload.cpp
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <marco@gnome.org>2003-12-22 07:48:39 +0800
committerMarco Pesenti Gritti <marco@src.gnome.org>2003-12-22 07:48:39 +0800
commitf606a4b6e99b759e408b4b9e7e7a8dca25b306f4 (patch)
tree659b9c0b0100747de3521784e68fce200a5cd58e /embed/mozilla/MozDownload.cpp
parentec26f0d7fa45ee4a88f4834347f9a705b06a0ebb (diff)
downloadgsoc2013-epiphany-f606a4b6e99b759e408b4b9e7e7a8dca25b306f4.tar
gsoc2013-epiphany-f606a4b6e99b759e408b4b9e7e7a8dca25b306f4.tar.gz
gsoc2013-epiphany-f606a4b6e99b759e408b4b9e7e7a8dca25b306f4.tar.bz2
gsoc2013-epiphany-f606a4b6e99b759e408b4b9e7e7a8dca25b306f4.tar.lz
gsoc2013-epiphany-f606a4b6e99b759e408b4b9e7e7a8dca25b306f4.tar.xz
gsoc2013-epiphany-f606a4b6e99b759e408b4b9e7e7a8dca25b306f4.tar.zst
gsoc2013-epiphany-f606a4b6e99b759e408b4b9e7e7a8dca25b306f4.zip
Correctly cancel the download instead of just cancelling the request.
2003-12-22 Marco Pesenti Gritti <marco@gnome.org> * embed/mozilla/MozDownload.cpp: * embed/mozilla/MozDownload.h: Correctly cancel the download instead of just cancelling the request.
Diffstat (limited to 'embed/mozilla/MozDownload.cpp')
-rw-r--r--embed/mozilla/MozDownload.cpp28
1 files changed, 12 insertions, 16 deletions
diff --git a/embed/mozilla/MozDownload.cpp b/embed/mozilla/MozDownload.cpp
index 2b9a9e4b6..62ff29c87 100644
--- a/embed/mozilla/MozDownload.cpp
+++ b/embed/mozilla/MozDownload.cpp
@@ -58,7 +58,6 @@ const char* const persistContractID = "@mozilla.org/embedding/browser/nsWebBrows
MozDownload::MozDownload() :
mGotFirstStateChange(false), mIsNetworkTransfer(false),
- mUserCanceled(false),
mStatus(NS_OK),
mEmbedPersist(nsnull),
mDownloadState(EPHY_DOWNLOAD_DOWNLOADING)
@@ -251,7 +250,9 @@ MozDownload::GetObserver(nsIObserver **aObserver)
NS_IMETHODIMP
MozDownload::SetObserver(nsIObserver *aObserver)
{
- return NS_ERROR_NOT_IMPLEMENTED;
+ mObserver = aObserver;
+
+ return NS_OK;
}
NS_IMETHODIMP
@@ -320,15 +321,6 @@ MozDownload::OnProgressChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest
mLastUpdate = now;
- if (mUserCanceled)
- {
- if (aRequest)
- {
- aRequest->Cancel(NS_BINDING_ABORTED);
- }
- mUserCanceled = false;
- }
-
if (aMaxTotalProgress == -1)
{
mPercentComplete = -1;
@@ -371,11 +363,15 @@ MozDownload::OnSecurityChange (nsIWebProgress *aWebProgress, nsIRequest *aReques
void
MozDownload::Cancel()
{
- mUserCanceled = true;
- /* nsWebBrowserPersist does the right thing: After canceling, next time through
- * OnStateChange(), aStatus != NS_OK. This isn't the case with nsExternalHelperAppService.*/
- if (!mWebPersist)
- mStatus = NS_ERROR_ABORT;
+ if (mWebPersist)
+ {
+ mWebPersist->CancelSave ();
+ }
+
+ if (mObserver)
+ {
+ mObserver->Observe (nsnull, "oncancel", nsnull);
+ }
}
void