From d20ca24a070d547be3bce4d513ef151b6be5f955 Mon Sep 17 00:00:00 2001 From: "Matt A. Tobin" Date: Tue, 25 Feb 2020 19:45:39 -0500 Subject: Issue #1053 - Remove android support from toolkit Note: Does not remove support completely from toolkit/mozapps/installer or from telemetry or AppConstants.jsm --- toolkit/components/downloads/nsDownloadManager.cpp | 45 +--------------------- 1 file changed, 2 insertions(+), 43 deletions(-) (limited to 'toolkit/components/downloads/nsDownloadManager.cpp') diff --git a/toolkit/components/downloads/nsDownloadManager.cpp b/toolkit/components/downloads/nsDownloadManager.cpp index ab984c5f2..9f43ade2c 100644 --- a/toolkit/components/downloads/nsDownloadManager.cpp +++ b/toolkit/components/downloads/nsDownloadManager.cpp @@ -61,10 +61,6 @@ #include #endif -#ifdef MOZ_WIDGET_ANDROID -#include "FennecJNIWrappers.h" -#endif - #ifdef MOZ_WIDGET_GTK #include #endif @@ -1421,19 +1417,6 @@ nsDownloadManager::GetDefaultDownloadsDirectory(nsIFile **aResult) } } #elif defined(XP_UNIX) -#if defined(MOZ_WIDGET_ANDROID) - // Android doesn't have a $HOME directory, and by default we only have - // write access to /data/data/org.mozilla.{$APP} and /sdcard - char* downloadDirPath = getenv("DOWNLOADS_DIRECTORY"); - if (downloadDirPath) { - rv = NS_NewNativeLocalFile(nsDependentCString(downloadDirPath), - true, getter_AddRefs(downloadDir)); - NS_ENSURE_SUCCESS(rv, rv); - } - else { - rv = NS_ERROR_FAILURE; - } -#else rv = dirService->Get(NS_UNIX_DEFAULT_DOWNLOAD_DIR, NS_GET_IID(nsIFile), getter_AddRefs(downloadDir)); @@ -1446,7 +1429,6 @@ nsDownloadManager::GetDefaultDownloadsDirectory(nsIFile **aResult) rv = downloadDir->Append(folderName); NS_ENSURE_SUCCESS(rv, rv); } -#endif #else rv = dirService->Get(NS_OS_HOME_DIR, NS_GET_IID(nsIFile), @@ -2685,14 +2667,6 @@ nsDownload::SetState(DownloadState aState) case nsIDownloadManager::DOWNLOAD_DIRTY: case nsIDownloadManager::DOWNLOAD_CANCELED: case nsIDownloadManager::DOWNLOAD_FAILED: -#ifdef ANDROID - // If we still have a temp file, remove it - bool tempExists; - if (mTempFile && NS_SUCCEEDED(mTempFile->Exists(&tempExists)) && tempExists) { - nsresult rv = mTempFile->Remove(false); - NS_ENSURE_SUCCESS(rv, rv); - } -#endif // Transfers are finished, so break the reference cycle Finalize(); @@ -2770,7 +2744,7 @@ nsDownload::SetState(DownloadState aState) } } -#if defined(XP_WIN) || defined(XP_MACOSX) || defined(MOZ_WIDGET_ANDROID) || defined(MOZ_WIDGET_GTK) +#if defined(XP_WIN) || defined(XP_MACOSX) || defined(MOZ_WIDGET_GTK) nsCOMPtr fileURL = do_QueryInterface(mTarget); nsCOMPtr file; nsAutoString path; @@ -2780,27 +2754,13 @@ nsDownload::SetState(DownloadState aState) file && NS_SUCCEEDED(file->GetPath(path))) { -#if defined(XP_WIN) || defined(MOZ_WIDGET_GTK) || defined(MOZ_WIDGET_ANDROID) +#if defined(XP_WIN) || defined(MOZ_WIDGET_GTK) // On Windows and Gtk, add the download to the system's "recent documents" // list, with a pref to disable. { bool addToRecentDocs = true; if (pref) pref->GetBoolPref(PREF_BDM_ADDTORECENTDOCS, &addToRecentDocs); -#ifdef MOZ_WIDGET_ANDROID - if (addToRecentDocs) { - nsCOMPtr mimeInfo; - nsAutoCString contentType; - GetMIMEInfo(getter_AddRefs(mimeInfo)); - - if (mimeInfo) - mimeInfo->GetMIMEType(contentType); - - if (jni::IsFennec()) { - java::DownloadsIntegration::ScanMedia(path, NS_ConvertUTF8toUTF16(contentType)); - } - } -#else if (addToRecentDocs && !mPrivate) { #ifdef XP_WIN ::SHAddToRecentDocs(SHARD_PATHW, path.get()); @@ -2815,7 +2775,6 @@ nsDownload::SetState(DownloadState aState) } #endif } -#endif #ifdef MOZ_ENABLE_GIO // Use GIO to store the source URI for later display in the file manager. GFile* gio_file = g_file_new_for_path(NS_ConvertUTF16toUTF8(path).get()); -- cgit v1.2.3 From e003547dc5c0f9336d95e499e0cefbd320130763 Mon Sep 17 00:00:00 2001 From: "Matt A. Tobin" Date: Sun, 29 Mar 2020 05:06:50 -0400 Subject: Properly fix crash in nsDownloadManager when repeatedly pausing and resuming a download This applies only to applications that do not use JSDownloads and is based on Bug 1224326 --- toolkit/components/downloads/nsDownloadManager.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'toolkit/components/downloads/nsDownloadManager.cpp') diff --git a/toolkit/components/downloads/nsDownloadManager.cpp b/toolkit/components/downloads/nsDownloadManager.cpp index 9f43ade2c..587c1ac8a 100644 --- a/toolkit/components/downloads/nsDownloadManager.cpp +++ b/toolkit/components/downloads/nsDownloadManager.cpp @@ -1829,6 +1829,9 @@ nsDownloadManager::RetryDownload(nsDownload* dl) return rv; } + rv = NotifyDownloadRemoval(dl); + NS_ENSURE_SUCCESS(rv, rv); + // reset time and download progress dl->SetStartTime(PR_Now()); dl->SetProgressBytes(0, -1); @@ -3083,7 +3086,7 @@ nsDownload::OnStateChange(nsIWebProgress *aWebProgress, #else (void)SetState(nsIDownloadManager::DOWNLOAD_FINISHED); #endif - } else { + } else if (aStatus != NS_BINDING_ABORTED) { // We failed for some unknown reason -- fail with a generic message (void)FailDownload(aStatus, nullptr); } -- cgit v1.2.3