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 --- .../components/aboutmemory/content/aboutMemory.css | 6 - toolkit/components/alerts/nsAlertsService.cpp | 8 - toolkit/components/alerts/nsXULAlerts.cpp | 3 - toolkit/components/blocklist/nsBlocklistService.js | 3 - toolkit/components/build/nsToolkitCompsCID.h | 4 +- toolkit/components/build/nsToolkitCompsModule.cpp | 15 +- toolkit/components/downloads/nsDownloadManager.cpp | 45 +- .../jsdownloads/src/DownloadIntegration.jsm | 28 +- .../jsdownloads/src/DownloadPlatform.cpp | 16 +- toolkit/components/moz.build | 19 +- .../osfile/modules/osfile_async_front.jsm | 33 +- .../components/osfile/modules/osfile_unix_back.jsm | 8 +- .../osfile/modules/osfile_unix_front.jsm | 21 +- toolkit/components/parentalcontrols/moz.build | 20 +- .../nsParentalControlsServiceAndroid.cpp | 103 -- toolkit/components/passwordmgr/moz.build | 20 +- toolkit/components/passwordmgr/nsLoginManager.js | 4 - .../passwordmgr/nsLoginManagerPrompter.js | 3 +- .../components/passwordmgr/passwordmgr.manifest | 5 - .../components/passwordmgr/storage-mozStorage.js | 1262 -------------------- toolkit/components/satchel/FormHistory.jsm | 4 - .../components/satchel/nsFormFillController.cpp | 2 - toolkit/components/satchel/nsFormHistory.js | 20 - toolkit/components/search/nsSearchService.js | 33 - .../url-classifier/nsUrlClassifierUtils.cpp | 4 +- toolkit/content/aboutSupport.js | 10 - toolkit/content/aboutSupport.xhtml | 5 - toolkit/content/aboutTelemetry.js | 8 - toolkit/content/buildconfig.html | 4 - toolkit/content/contentAreaUtils.js | 34 +- toolkit/content/jar.mn | 2 - toolkit/content/moz.build | 3 - toolkit/library/libxul.mk | 2 - toolkit/library/moz.build | 2 +- toolkit/modules/Services.jsm | 3 - toolkit/modules/moz.build | 16 +- toolkit/moz.build | 19 +- toolkit/moz.configure | 49 +- toolkit/mozapps/extensions/extensions.manifest | 6 +- toolkit/mozapps/extensions/internal/moz.build | 7 +- toolkit/nss.configure | 2 +- toolkit/profile/nsToolkitProfileService.cpp | 4 +- toolkit/system/androidproxy/moz.build | 11 - .../androidproxy/nsAndroidSystemProxySettings.cpp | 89 -- toolkit/themes/mobile/global/empty.css | 7 - toolkit/themes/mobile/global/icons/Error.png | Bin 2148 -> 0 bytes .../mobile/global/media/TopLevelImageDocument.css | 17 - .../mobile/global/media/TopLevelVideoDocument.css | 12 - .../mobile/global/media/clicktoplay-bgtexture.png | Bin 1751 -> 0 bytes toolkit/themes/mobile/global/media/error.png | Bin 433 -> 0 bytes .../mobile/global/media/imagedoc-darknoise.png | Bin 3050 -> 0 bytes .../mobile/global/media/imagedoc-lightnoise.png | Bin 4025 -> 0 bytes toolkit/themes/mobile/global/media/throbber.png | Bin 30718 -> 0 bytes .../mobile/global/media/videoClickToPlayButton.svg | 30 - toolkit/themes/mobile/jar.mn | 55 - toolkit/themes/mobile/moz.build | 7 - .../mozapps/plugins/contentPluginActivate.png | Bin 3043 -> 0 bytes .../mozapps/plugins/contentPluginBlocked.png | Bin 1514 -> 0 bytes .../mobile/mozapps/plugins/contentPluginClose.png | Bin 1370 -> 0 bytes .../mozapps/plugins/contentPluginCrashed.png | Bin 1470 -> 0 bytes .../mozapps/plugins/contentPluginDisabled.png | Bin 1620 -> 0 bytes .../mobile/mozapps/plugins/contentPluginStripe.png | Bin 460 -> 0 bytes .../mobile/mozapps/plugins/pluginProblem.css | 196 --- toolkit/themes/moz.build | 3 - toolkit/themes/shared/mozapps.inc.mn | 2 - toolkit/toolkit.mozbuild | 8 +- toolkit/xre/moz.build | 19 +- toolkit/xre/nsAndroidStartup.cpp | 45 - toolkit/xre/nsAppRunner.cpp | 25 +- toolkit/xre/nsEmbedFunctions.cpp | 8 - toolkit/xre/nsSigHandlers.cpp | 6 +- toolkit/xre/nsUpdateDriver.cpp | 2 +- toolkit/xre/nsXREDirProvider.cpp | 13 - 73 files changed, 105 insertions(+), 2315 deletions(-) delete mode 100644 toolkit/components/parentalcontrols/nsParentalControlsServiceAndroid.cpp delete mode 100644 toolkit/components/passwordmgr/storage-mozStorage.js delete mode 100644 toolkit/system/androidproxy/moz.build delete mode 100644 toolkit/system/androidproxy/nsAndroidSystemProxySettings.cpp delete mode 100644 toolkit/themes/mobile/global/empty.css delete mode 100644 toolkit/themes/mobile/global/icons/Error.png delete mode 100644 toolkit/themes/mobile/global/media/TopLevelImageDocument.css delete mode 100644 toolkit/themes/mobile/global/media/TopLevelVideoDocument.css delete mode 100644 toolkit/themes/mobile/global/media/clicktoplay-bgtexture.png delete mode 100644 toolkit/themes/mobile/global/media/error.png delete mode 100644 toolkit/themes/mobile/global/media/imagedoc-darknoise.png delete mode 100644 toolkit/themes/mobile/global/media/imagedoc-lightnoise.png delete mode 100644 toolkit/themes/mobile/global/media/throbber.png delete mode 100644 toolkit/themes/mobile/global/media/videoClickToPlayButton.svg delete mode 100644 toolkit/themes/mobile/jar.mn delete mode 100644 toolkit/themes/mobile/moz.build delete mode 100644 toolkit/themes/mobile/mozapps/plugins/contentPluginActivate.png delete mode 100644 toolkit/themes/mobile/mozapps/plugins/contentPluginBlocked.png delete mode 100644 toolkit/themes/mobile/mozapps/plugins/contentPluginClose.png delete mode 100644 toolkit/themes/mobile/mozapps/plugins/contentPluginCrashed.png delete mode 100644 toolkit/themes/mobile/mozapps/plugins/contentPluginDisabled.png delete mode 100644 toolkit/themes/mobile/mozapps/plugins/contentPluginStripe.png delete mode 100644 toolkit/themes/mobile/mozapps/plugins/pluginProblem.css delete mode 100644 toolkit/xre/nsAndroidStartup.cpp diff --git a/toolkit/components/aboutmemory/content/aboutMemory.css b/toolkit/components/aboutmemory/content/aboutMemory.css index b63bbac13..cf4d36de8 100644 --- a/toolkit/components/aboutmemory/content/aboutMemory.css +++ b/toolkit/components/aboutmemory/content/aboutMemory.css @@ -2,12 +2,6 @@ * 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/. */ -/* - * The version used for mobile is located at - * mobile/android/themes/core/aboutMemory.css. - * Desktop-specific stuff is at the bottom of this file. - */ - html { background: -moz-Dialog; font: message-box; diff --git a/toolkit/components/alerts/nsAlertsService.cpp b/toolkit/components/alerts/nsAlertsService.cpp index 73dbb265c..4f248c861 100644 --- a/toolkit/components/alerts/nsAlertsService.cpp +++ b/toolkit/components/alerts/nsAlertsService.cpp @@ -273,26 +273,18 @@ NS_IMETHODIMP nsAlertsService::CloseAlert(const nsAString& aAlertName, // nsIAlertsDoNotDisturb NS_IMETHODIMP nsAlertsService::GetManualDoNotDisturb(bool* aRetVal) { -#ifdef MOZ_WIDGET_ANDROID - return NS_ERROR_NOT_IMPLEMENTED; -#else nsCOMPtr alertsDND(GetDNDBackend()); NS_ENSURE_TRUE(alertsDND, NS_ERROR_NOT_IMPLEMENTED); return alertsDND->GetManualDoNotDisturb(aRetVal); -#endif } NS_IMETHODIMP nsAlertsService::SetManualDoNotDisturb(bool aDoNotDisturb) { -#ifdef MOZ_WIDGET_ANDROID - return NS_ERROR_NOT_IMPLEMENTED; -#else nsCOMPtr alertsDND(GetDNDBackend()); NS_ENSURE_TRUE(alertsDND, NS_ERROR_NOT_IMPLEMENTED); nsresult rv = alertsDND->SetManualDoNotDisturb(aDoNotDisturb); return rv; -#endif } already_AddRefed diff --git a/toolkit/components/alerts/nsXULAlerts.cpp b/toolkit/components/alerts/nsXULAlerts.cpp index d353d8714..47e72a27f 100644 --- a/toolkit/components/alerts/nsXULAlerts.cpp +++ b/toolkit/components/alerts/nsXULAlerts.cpp @@ -66,13 +66,10 @@ NS_IMPL_ISUPPORTS(nsXULAlerts, nsIAlertsService, nsIAlertsDoNotDisturb, nsIAlert /* static */ already_AddRefed nsXULAlerts::GetInstance() { - // Gecko on Android does not fully support XUL windows. -#ifndef MOZ_WIDGET_ANDROID if (!gXULAlerts) { gXULAlerts = new nsXULAlerts(); ClearOnShutdown(&gXULAlerts); } -#endif // MOZ_WIDGET_ANDROID RefPtr instance = gXULAlerts.get(); return instance.forget(); } diff --git a/toolkit/components/blocklist/nsBlocklistService.js b/toolkit/components/blocklist/nsBlocklistService.js index 788ce192f..67f283b26 100644 --- a/toolkit/components/blocklist/nsBlocklistService.js +++ b/toolkit/components/blocklist/nsBlocklistService.js @@ -1117,9 +1117,6 @@ Blocklist.prototype = { /* See nsIBlocklistService */ getPluginBlocklistState: function(plugin, appVersion, toolkitVersion) { -#ifdef MOZ_WIDGET_ANDROID - return Ci.nsIBlocklistService.STATE_NOT_BLOCKED; -#endif if (!this._isBlocklistLoaded()) this._loadBlocklist(); return this._getPluginBlocklistState(plugin, this._pluginEntries, diff --git a/toolkit/components/build/nsToolkitCompsCID.h b/toolkit/components/build/nsToolkitCompsCID.h index 064f1dbc4..9e61edb26 100644 --- a/toolkit/components/build/nsToolkitCompsCID.h +++ b/toolkit/components/build/nsToolkitCompsCID.h @@ -81,7 +81,7 @@ #define NS_APPSTARTUP_CONTRACTID \ "@mozilla.org/toolkit/app-startup;1" -#if defined(MOZ_UPDATER) && !defined(MOZ_WIDGET_ANDROID) +#ifdef MOZ_UPDATER #define NS_UPDATEPROCESSOR_CONTRACTID \ "@mozilla.org/updates/update-processor;1" #endif @@ -170,7 +170,7 @@ #define NS_FAVICONSERVICE_CID \ { 0x984e3259, 0x9266, 0x49cf, { 0xb6, 0x05, 0x60, 0xb0, 0x22, 0xa0, 0x07, 0x56 } } -#if defined(MOZ_UPDATER) && !defined(MOZ_WIDGET_ANDROID) +#ifdef MOZ_UPDATER #define NS_UPDATEPROCESSOR_CID \ { 0xf3dcf644, 0x79e8, 0x4f59, { 0xa1, 0xbb, 0x87, 0x84, 0x54, 0x48, 0x8e, 0xf9 } } #endif diff --git a/toolkit/components/build/nsToolkitCompsModule.cpp b/toolkit/components/build/nsToolkitCompsModule.cpp index a4293c6f9..420ff258a 100644 --- a/toolkit/components/build/nsToolkitCompsModule.cpp +++ b/toolkit/components/build/nsToolkitCompsModule.cpp @@ -10,7 +10,7 @@ #endif #include "nsToolkitCompsCID.h" #include "nsFindService.h" -#if defined(MOZ_UPDATER) && !defined(MOZ_WIDGET_ANDROID) +#ifdef MOZ_UPDATER #include "nsUpdateDriver.h" #endif @@ -47,13 +47,8 @@ #include "NativeFileWatcherNotSupported.h" #endif // (XP_WIN) -#if !defined(MOZ_WIDGET_ANDROID) #define MOZ_HAS_TERMINATOR -#endif - -#if defined(MOZ_HAS_TERMINATOR) #include "nsTerminator.h" -#endif #define MOZ_HAS_PERFSTATS @@ -122,7 +117,7 @@ nsUrlClassifierDBServiceConstructor(nsISupports *aOuter, REFNSIID aIID, #endif NS_GENERIC_FACTORY_CONSTRUCTOR(nsBrowserStatusFilter) -#if defined(MOZ_UPDATER) && !defined(MOZ_WIDGET_ANDROID) +#ifdef MOZ_UPDATER NS_GENERIC_FACTORY_CONSTRUCTOR(nsUpdateProcessor) #endif NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(FinalizationWitnessService, Init) @@ -160,7 +155,7 @@ NS_DEFINE_NAMED_CID(NS_URLCLASSIFIERSTREAMUPDATER_CID); NS_DEFINE_NAMED_CID(NS_URLCLASSIFIERUTILS_CID); #endif NS_DEFINE_NAMED_CID(NS_BROWSERSTATUSFILTER_CID); -#if defined(MOZ_UPDATER) && !defined(MOZ_WIDGET_ANDROID) +#ifdef MOZ_UPDATER NS_DEFINE_NAMED_CID(NS_UPDATEPROCESSOR_CID); #endif NS_DEFINE_NAMED_CID(FINALIZATIONWITNESSSERVICE_CID); @@ -197,7 +192,7 @@ static const Module::CIDEntry kToolkitCIDs[] = { { &kNS_URLCLASSIFIERUTILS_CID, false, nullptr, nsUrlClassifierUtilsConstructor }, #endif { &kNS_BROWSERSTATUSFILTER_CID, false, nullptr, nsBrowserStatusFilterConstructor }, -#if defined(MOZ_UPDATER) && !defined(MOZ_WIDGET_ANDROID) +#ifdef MOZ_UPDATER { &kNS_UPDATEPROCESSOR_CID, false, nullptr, nsUpdateProcessorConstructor }, #endif { &kFINALIZATIONWITNESSSERVICE_CID, false, nullptr, FinalizationWitnessServiceConstructor }, @@ -236,7 +231,7 @@ static const Module::ContractIDEntry kToolkitContracts[] = { { NS_URLCLASSIFIERUTILS_CONTRACTID, &kNS_URLCLASSIFIERUTILS_CID }, #endif { NS_BROWSERSTATUSFILTER_CONTRACTID, &kNS_BROWSERSTATUSFILTER_CID }, -#if defined(MOZ_UPDATER) && !defined(MOZ_WIDGET_ANDROID) +#ifdef MOZ_UPDATER { NS_UPDATEPROCESSOR_CONTRACTID, &kNS_UPDATEPROCESSOR_CID }, #endif { FINALIZATIONWITNESSSERVICE_CONTRACTID, &kFINALIZATIONWITNESSSERVICE_CID }, 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()); diff --git a/toolkit/components/jsdownloads/src/DownloadIntegration.jsm b/toolkit/components/jsdownloads/src/DownloadIntegration.jsm index 995cc0669..7656128d2 100644 --- a/toolkit/components/jsdownloads/src/DownloadIntegration.jsm +++ b/toolkit/components/jsdownloads/src/DownloadIntegration.jsm @@ -70,10 +70,6 @@ XPCOMUtils.defineLazyServiceGetter(this, "gMIMEService", XPCOMUtils.defineLazyServiceGetter(this, "gExternalProtocolService", "@mozilla.org/uriloader/external-protocol-service;1", "nsIExternalProtocolService"); -#ifdef MOZ_WIDGET_ANDROID -XPCOMUtils.defineLazyModuleGetter(this, "RuntimePermissions", - "resource://gre/modules/RuntimePermissions.jsm"); -#endif XPCOMUtils.defineLazyGetter(this, "gParentalControlsService", function() { if ("@mozilla.org/parental-controls-service;1" in Cc) { @@ -299,14 +295,10 @@ this.DownloadIntegration = { aDownload.hasBlockedData) { return true; } -#if defined(MOZ_WIDGET_ANDROID) - // On Android we store all history. - return true; -#else + // On Desktop, stopped downloads for which we don't need to track the // presence of a ".part" file are only retained in the browser history. return false; -#endif }, /** @@ -332,16 +324,8 @@ this.DownloadIntegration = { } else { directoryPath = this._getDirectory("DfltDwnld"); } + #elifdef XP_UNIX -#ifdef 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 - directoryPath = gEnvironment.get("DOWNLOADS_DIRECTORY"); - if (!directoryPath) { - throw new Components.Exception("DOWNLOADS_DIRECTORY is not set.", - Cr.NS_ERROR_FILE_UNRECOGNIZED_PATH); - } -#else // For Linux, use XDG download dir, with a fallback to Home/Downloads // if the XDG user dirs are disabled. try { @@ -349,7 +333,6 @@ this.DownloadIntegration = { } catch(e) { directoryPath = yield this._createDownloadsDirectory("Home"); } -#endif #else directoryPath = yield this._createDownloadsDirectory("Home"); #endif @@ -403,8 +386,6 @@ this.DownloadIntegration = { let directoryPath = null; #ifdef XP_MACOSX directoryPath = yield this.getPreferredDownloadsDirectory(); -#elifdef MOZ_WIDGET_ANDROID - directoryPath = yield this.getSystemDownloadsDirectory(); #else directoryPath = this._getDirectory("TmpD"); #endif @@ -443,12 +424,7 @@ this.DownloadIntegration = { * @resolves The boolean indicates to block downloads or not. */ shouldBlockForRuntimePermissions() { -#ifdef MOZ_WIDGET_ANDROID - return RuntimePermissions.waitForPermissions(RuntimePermissions.WRITE_EXTERNAL_STORAGE) - .then(permissionGranted => !permissionGranted); -#else return Promise.resolve(false); -#endif }, /** diff --git a/toolkit/components/jsdownloads/src/DownloadPlatform.cpp b/toolkit/components/jsdownloads/src/DownloadPlatform.cpp index d91124ee6..66ad2b8fa 100644 --- a/toolkit/components/jsdownloads/src/DownloadPlatform.cpp +++ b/toolkit/components/jsdownloads/src/DownloadPlatform.cpp @@ -30,10 +30,6 @@ #include "../../../../xpcom/io/CocoaFileUtils.h" #endif -#ifdef MOZ_WIDGET_ANDROID -#include "FennecJNIWrappers.h" -#endif - #ifdef MOZ_WIDGET_GTK #include #endif @@ -101,21 +97,15 @@ CFURLRef CreateCFURLFromNSIURI(nsIURI *aURI) { nsresult DownloadPlatform::DownloadDone(nsIURI* aSource, nsIURI* aReferrer, nsIFile* aTarget, const nsACString& aContentType, bool aIsPrivate) { -#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) nsAutoString path; if (aTarget && NS_SUCCEEDED(aTarget->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 = Preferences::GetBool(PREF_BDM_ADDTORECENTDOCS); -#ifdef MOZ_WIDGET_ANDROID - if (jni::IsFennec() && addToRecentDocs) { - java::DownloadsIntegration::ScanMedia(path, aContentType); - } -#else if (addToRecentDocs && !aIsPrivate) { #ifdef XP_WIN ::SHAddToRecentDocs(SHARD_PATHW, path.get()); @@ -130,7 +120,7 @@ nsresult DownloadPlatform::DownloadDone(nsIURI* aSource, nsIURI* aReferrer, nsIF } #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()); diff --git a/toolkit/components/moz.build b/toolkit/components/moz.build index ab759366c..ff71d7c9d 100644 --- a/toolkit/components/moz.build +++ b/toolkit/components/moz.build @@ -66,11 +66,10 @@ DIRS += [ DIRS += ['mozintl'] -if not CONFIG['MOZ_FENNEC']: - DIRS += ['narrate', 'viewsource']; +DIRS += ['narrate', 'viewsource']; - if CONFIG['NS_PRINTING']: - DIRS += ['printing'] +if CONFIG['NS_PRINTING']: + DIRS += ['printing'] if CONFIG['BUILD_CTYPES']: DIRS += ['ctypes'] @@ -94,13 +93,11 @@ if CONFIG['MOZ_URL_CLASSIFIER']: DIRS += ['captivedetect'] -if CONFIG['OS_TARGET'] != 'Android': - DIRS += ['terminator'] +DIRS += ['terminator'] DIRS += ['build'] -if CONFIG['MOZ_WIDGET_TOOLKIT'] != 'android': - EXTRA_COMPONENTS += [ - 'nsDefaultCLH.js', - 'nsDefaultCLH.manifest', - ] +EXTRA_COMPONENTS += [ + 'nsDefaultCLH.js', + 'nsDefaultCLH.manifest', +] diff --git a/toolkit/components/osfile/modules/osfile_async_front.jsm b/toolkit/components/osfile/modules/osfile_async_front.jsm index 9f3b7fb21..698ac8732 100644 --- a/toolkit/components/osfile/modules/osfile_async_front.jsm +++ b/toolkit/components/osfile/modules/osfile_async_front.jsm @@ -728,26 +728,19 @@ File.prototype = { } }; - -if (SharedAll.Constants.Sys.Name != "Android") { - /** - * Set the last access and modification date of the file. - * The time stamp resolution is 1 second at best, but might be worse - * depending on the platform. - * - * WARNING: This method is not implemented on Android. On Android, - * you should use File.setDates instead. - * - * @return {promise} - * @rejects {TypeError} - * @rejects {OS.File.Error} - */ - File.prototype.setDates = function(accessDate, modificationDate) { - return Scheduler.post("File_prototype_setDates", - [this._fdmsg, accessDate, modificationDate], this); - }; -} - + /** + * Set the last access and modification date of the file. + * The time stamp resolution is 1 second at best, but might be worse + * depending on the platform. + * + * @return {promise} + * @rejects {TypeError} + * @rejects {OS.File.Error} + */ +File.prototype.setDates = function(accessDate, modificationDate) { + return Scheduler.post("File_prototype_setDates", + [this._fdmsg, accessDate, modificationDate], this); +}; /** * Open a file asynchronously. diff --git a/toolkit/components/osfile/modules/osfile_unix_back.jsm b/toolkit/components/osfile/modules/osfile_unix_back.jsm index 7c2c6f28d..4cc444567 100644 --- a/toolkit/components/osfile/modules/osfile_unix_back.jsm +++ b/toolkit/components/osfile/modules/osfile_unix_back.jsm @@ -372,14 +372,14 @@ // Two variants of |getwd| which allocate the memory // dynamically. - // Linux/Android version + // Linux version libc.declareLazyFFI(SysFile, "get_current_dir_name", "get_current_dir_name", ctypes.default_abi, /*return*/ Type.out_path.releaseWithLazy(() => SysFile.free )); - // MacOS/BSD version (will return NULL on Linux/Android) + // MacOS/BSD version (will return NULL on Linux) libc.declareLazyFFI(SysFile, "getwd_auto", "getwd", ctypes.default_abi, /*return*/ Type.out_path.releaseWithLazy(() => @@ -520,13 +520,13 @@ /*fd_out*/ Type.fd, /*off_out*/Type.off_t.in_ptr, /*len*/ Type.size_t, - /*flags*/ Type.unsigned_int); // Linux/Android-specific + /*flags*/ Type.unsigned_int); // Linux-specific libc.declareLazyFFI(SysFile, "statfs", "statfs", ctypes.default_abi, /*return*/ Type.negativeone_or_nothing, /*path*/ Type.path, - /*buf*/ Type.statvfs.out_ptr); // Android,B2G + /*buf*/ Type.statvfs.out_ptr); // Other platforms libc.declareLazyFFI(SysFile, "statvfs", "statvfs", ctypes.default_abi, diff --git a/toolkit/components/osfile/modules/osfile_unix_front.jsm b/toolkit/components/osfile/modules/osfile_unix_front.jsm index bd60d4d84..4e41036df 100644 --- a/toolkit/components/osfile/modules/osfile_unix_front.jsm +++ b/toolkit/components/osfile/modules/osfile_unix_front.jsm @@ -204,10 +204,7 @@ * The time stamp resolution is 1 second at best, but might be worse * depending on the platform. * - * WARNING: This method is not implemented on Android/B2G. On Android/B2G, - * you should use File.setDates instead. - * - * @param {Date,number=} accessDate The last access date. If numeric, + * @param {Date,number=} accessDate The last access date. If numeric, * milliseconds since epoch. If omitted or null, then the current date * will be used. * @param {Date,number=} modificationDate The last modification date. If @@ -217,14 +214,12 @@ * @throws {TypeError} In case of invalid parameters. * @throws {OS.File.Error} In case of I/O error. */ - if (SharedAll.Constants.Sys.Name != "Android") { - File.prototype.setDates = function(accessDate, modificationDate) { - let {value, ptr} = datesToTimevals(accessDate, modificationDate); - throw_on_negative("setDates", - UnixFile.futimes(this.fd, ptr), - this._path); - }; - } + File.prototype.setDates = function(accessDate, modificationDate) { + let {value, ptr} = datesToTimevals(accessDate, modificationDate); + throw_on_negative("setDates", + UnixFile.futimes(this.fd, ptr), + this._path); + }; /** * Flushes the file's buffers and causes all buffered data @@ -576,7 +571,7 @@ if (UnixFile.splice) { const BUFSIZE = 1 << 17; - // An implementation of |pump| using |splice| (for Linux/Android) + // An implementation of |pump| using |splice| (for Linux) pump = function pump_splice(source, dest, options = {}) { let nbytes = options.nbytes > 0 ? options.nbytes : Infinity; let pipe = []; diff --git a/toolkit/components/parentalcontrols/moz.build b/toolkit/components/parentalcontrols/moz.build index 083312fef..17db8aaee 100644 --- a/toolkit/components/parentalcontrols/moz.build +++ b/toolkit/components/parentalcontrols/moz.build @@ -4,28 +4,16 @@ # 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/. -XPIDL_SOURCES += [ - 'nsIParentalControlsService.idl', -] +XPIDL_SOURCES += ['nsIParentalControlsService.idl'] XPIDL_MODULE = 'parentalcontrols' if not CONFIG['MOZ_DISABLE_PARENTAL_CONTROLS']: if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows': - SOURCES += [ - 'nsParentalControlsServiceWin.cpp', - ] + SOURCES += ['nsParentalControlsServiceWin.cpp'] elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa': - UNIFIED_SOURCES += [ - 'nsParentalControlsServiceCocoa.mm', - ] - elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'android': - UNIFIED_SOURCES += [ - 'nsParentalControlsServiceAndroid.cpp', - ] + UNIFIED_SOURCES += ['nsParentalControlsServiceCocoa.mm'] else: - SOURCES += [ - 'nsParentalControlsServiceDefault.cpp', - ] + SOURCES += ['nsParentalControlsServiceDefault.cpp'] FINAL_LIBRARY = 'xul' diff --git a/toolkit/components/parentalcontrols/nsParentalControlsServiceAndroid.cpp b/toolkit/components/parentalcontrols/nsParentalControlsServiceAndroid.cpp deleted file mode 100644 index 364749000..000000000 --- a/toolkit/components/parentalcontrols/nsParentalControlsServiceAndroid.cpp +++ /dev/null @@ -1,103 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode:nil; c-basic-offset: 2 -*- */ -/* 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/. */ - -#include "nsParentalControlsService.h" -#include "nsString.h" -#include "nsIFile.h" -#include "FennecJNIWrappers.h" - -namespace java = mozilla::java; - -NS_IMPL_ISUPPORTS(nsParentalControlsService, nsIParentalControlsService) - -nsParentalControlsService::nsParentalControlsService() : - mEnabled(false) -{ - if (mozilla::jni::IsFennec()) { - mEnabled = java::Restrictions::IsUserRestricted(); - } -} - -nsParentalControlsService::~nsParentalControlsService() -{ -} - -NS_IMETHODIMP -nsParentalControlsService::GetParentalControlsEnabled(bool *aResult) -{ - *aResult = mEnabled; - return NS_OK; -} - -NS_IMETHODIMP -nsParentalControlsService::GetBlockFileDownloadsEnabled(bool *aResult) -{ - // NOTE: isAllowed returns the opposite intention, so we need to flip it - bool res; - IsAllowed(nsIParentalControlsService::DOWNLOAD, NULL, &res); - *aResult = !res; - - return NS_OK; -} - -NS_IMETHODIMP -nsParentalControlsService::GetLoggingEnabled(bool *aResult) -{ - // Android doesn't currently have any method of logging restricted actions. - *aResult = false; - return NS_OK; -} - -NS_IMETHODIMP -nsParentalControlsService::Log(int16_t aEntryType, - bool aBlocked, - nsIURI *aSource, - nsIFile *aTarget) -{ - return NS_ERROR_NOT_AVAILABLE; -} - -NS_IMETHODIMP -nsParentalControlsService::RequestURIOverride(nsIURI *aTarget, - nsIInterfaceRequestor *aWindowContext, - bool *_retval) -{ - return NS_ERROR_NOT_AVAILABLE; -} - -NS_IMETHODIMP -nsParentalControlsService::RequestURIOverrides(nsIArray *aTargets, - nsIInterfaceRequestor *aWindowContext, - bool *_retval) -{ - return NS_ERROR_NOT_AVAILABLE; -} - -NS_IMETHODIMP -nsParentalControlsService::IsAllowed(int16_t aAction, - nsIURI *aUri, - bool *_retval) -{ - nsresult rv = NS_OK; - *_retval = true; - - if (!mEnabled) { - return rv; - } - - if (mozilla::jni::IsFennec()) { - nsAutoCString url; - if (aUri) { - rv = aUri->GetSpec(url); - NS_ENSURE_SUCCESS(rv, rv); - } - - *_retval = java::Restrictions::IsAllowed(aAction, - NS_ConvertUTF8toUTF16(url)); - return rv; - } - - return NS_ERROR_NOT_AVAILABLE; -} diff --git a/toolkit/components/passwordmgr/moz.build b/toolkit/components/passwordmgr/moz.build index 189f4925b..145e2fca4 100644 --- a/toolkit/components/passwordmgr/moz.build +++ b/toolkit/components/passwordmgr/moz.build @@ -39,18 +39,14 @@ EXTRA_JS_MODULES += [ EXTRA_PP_JS_MODULES += ['OSCrypto.jsm'] -if CONFIG['OS_TARGET'] == 'Android': - EXTRA_COMPONENTS += [ - 'storage-mozStorage.js', - ] -else: - EXTRA_COMPONENTS += [ - 'storage-json.js', - ] - EXTRA_JS_MODULES += [ - 'LoginImport.jsm', - 'LoginStore.jsm', - ] +EXTRA_COMPONENTS += [ + 'storage-json.js', +] + +EXTRA_JS_MODULES += [ + 'LoginImport.jsm', + 'LoginStore.jsm', +] if CONFIG['OS_TARGET'] == 'WINNT': EXTRA_JS_MODULES += [ diff --git a/toolkit/components/passwordmgr/nsLoginManager.js b/toolkit/components/passwordmgr/nsLoginManager.js index 87466fe5c..84b0319cb 100644 --- a/toolkit/components/passwordmgr/nsLoginManager.js +++ b/toolkit/components/passwordmgr/nsLoginManager.js @@ -112,11 +112,7 @@ LoginManager.prototype = { _initStorage() { -#ifdef MOZ_WIDGET_ANDROID - let contractID = "@mozilla.org/login-manager/storage/mozStorage;1"; -#else let contractID = "@mozilla.org/login-manager/storage/json;1"; -#endif try { let catMan = Cc["@mozilla.org/categorymanager;1"]. diff --git a/toolkit/components/passwordmgr/nsLoginManagerPrompter.js b/toolkit/components/passwordmgr/nsLoginManagerPrompter.js index c4be39e31..5fb1ee83e 100644 --- a/toolkit/components/passwordmgr/nsLoginManagerPrompter.js +++ b/toolkit/components/passwordmgr/nsLoginManagerPrompter.js @@ -19,8 +19,7 @@ const LoginInfo = const BRAND_BUNDLE = "chrome://branding/locale/brand.properties"; /** - * Constants for password prompt telemetry. - * Mirrored in mobile/android/components/LoginManagerPrompter.js */ + * Constants for password prompt telemetry. */ const PROMPT_DISPLAYED = 0; const PROMPT_ADD_OR_UPDATE = 1; diff --git a/toolkit/components/passwordmgr/passwordmgr.manifest b/toolkit/components/passwordmgr/passwordmgr.manifest index 72e9ccffb..c2c37ebff 100644 --- a/toolkit/components/passwordmgr/passwordmgr.manifest +++ b/toolkit/components/passwordmgr/passwordmgr.manifest @@ -6,12 +6,7 @@ component {8aa66d77-1bbb-45a6-991e-b8f47751c291} nsLoginManagerPrompter.js contract @mozilla.org/login-manager/prompter;1 {8aa66d77-1bbb-45a6-991e-b8f47751c291} component {0f2f347c-1e4f-40cc-8efd-792dea70a85e} nsLoginInfo.js contract @mozilla.org/login-manager/loginInfo;1 {0f2f347c-1e4f-40cc-8efd-792dea70a85e} -#ifdef ANDROID -component {8c2023b9-175c-477e-9761-44ae7b549756} storage-mozStorage.js -contract @mozilla.org/login-manager/storage/mozStorage;1 {8c2023b9-175c-477e-9761-44ae7b549756} -#else component {c00c432d-a0c9-46d7-bef6-9c45b4d07341} storage-json.js contract @mozilla.org/login-manager/storage/json;1 {c00c432d-a0c9-46d7-bef6-9c45b4d07341} -#endif component {dc6c2976-0f73-4f1f-b9ff-3d72b4e28309} crypto-SDR.js contract @mozilla.org/login-manager/crypto/SDR;1 {dc6c2976-0f73-4f1f-b9ff-3d72b4e28309} \ No newline at end of file diff --git a/toolkit/components/passwordmgr/storage-mozStorage.js b/toolkit/components/passwordmgr/storage-mozStorage.js deleted file mode 100644 index 9da244f7a..000000000 --- a/toolkit/components/passwordmgr/storage-mozStorage.js +++ /dev/null @@ -1,1262 +0,0 @@ -/* 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/. */ - -const { classes: Cc, interfaces: Ci, utils: Cu, results: Cr } = Components; -const DB_VERSION = 6; // The database schema version -const PERMISSION_SAVE_LOGINS = "login-saving"; - -Components.utils.import("resource://gre/modules/XPCOMUtils.jsm"); -Components.utils.import("resource://gre/modules/Services.jsm"); -Components.utils.import("resource://gre/modules/Promise.jsm"); - -XPCOMUtils.defineLazyModuleGetter(this, "LoginHelper", - "resource://gre/modules/LoginHelper.jsm"); - -/** - * Object that manages a database transaction properly so consumers don't have - * to worry about it throwing. - * - * @param aDatabase - * The mozIStorageConnection to start a transaction on. - */ -function Transaction(aDatabase) { - this._db = aDatabase; - - this._hasTransaction = false; - try { - this._db.beginTransaction(); - this._hasTransaction = true; - } catch (e) { /* om nom nom exceptions */ } -} - -Transaction.prototype = { - commit : function() { - if (this._hasTransaction) - this._db.commitTransaction(); - }, - - rollback : function() { - if (this._hasTransaction) - this._db.rollbackTransaction(); - }, -}; - - -function LoginManagerStorage_mozStorage() { } - -LoginManagerStorage_mozStorage.prototype = { - - classID : Components.ID("{8c2023b9-175c-477e-9761-44ae7b549756}"), - QueryInterface : XPCOMUtils.generateQI([Ci.nsILoginManagerStorage, - Ci.nsIInterfaceRequestor]), - getInterface : function(aIID) { - if (aIID.equals(Ci.nsIVariant)) { - // Allows unwrapping the JavaScript object for regression tests. - return this; - } - - if (aIID.equals(Ci.mozIStorageConnection)) { - return this._dbConnection; - } - - throw new Components.Exception("Interface not available", Cr.NS_ERROR_NO_INTERFACE); - }, - - __crypto : null, // nsILoginManagerCrypto service - get _crypto() { - if (!this.__crypto) - this.__crypto = Cc["@mozilla.org/login-manager/crypto/SDR;1"]. - getService(Ci.nsILoginManagerCrypto); - return this.__crypto; - }, - - __profileDir: null, // nsIFile for the user's profile dir - get _profileDir() { - if (!this.__profileDir) - this.__profileDir = Services.dirsvc.get("ProfD", Ci.nsIFile); - return this.__profileDir; - }, - - __storageService: null, // Storage service for using mozStorage - get _storageService() { - if (!this.__storageService) - this.__storageService = Cc["@mozilla.org/storage/service;1"]. - getService(Ci.mozIStorageService); - return this.__storageService; - }, - - __uuidService: null, - get _uuidService() { - if (!this.__uuidService) - this.__uuidService = Cc["@mozilla.org/uuid-generator;1"]. - getService(Ci.nsIUUIDGenerator); - return this.__uuidService; - }, - - - // The current database schema. - _dbSchema: { - tables: { - moz_logins: "id INTEGER PRIMARY KEY," + - "hostname TEXT NOT NULL," + - "httpRealm TEXT," + - "formSubmitURL TEXT," + - "usernameField TEXT NOT NULL," + - "passwordField TEXT NOT NULL," + - "encryptedUsername TEXT NOT NULL," + - "encryptedPassword TEXT NOT NULL," + - "guid TEXT," + - "encType INTEGER," + - "timeCreated INTEGER," + - "timeLastUsed INTEGER," + - "timePasswordChanged INTEGER," + - "timesUsed INTEGER", - // Changes must be reflected in this._dbAreExpectedColumnsPresent(), - // this._searchLogins(), and this.modifyLogin(). - - moz_disabledHosts: "id INTEGER PRIMARY KEY," + - "hostname TEXT UNIQUE ON CONFLICT REPLACE", - - moz_deleted_logins: "id INTEGER PRIMARY KEY," + - "guid TEXT," + - "timeDeleted INTEGER", - }, - indices: { - moz_logins_hostname_index: { - table: "moz_logins", - columns: ["hostname"] - }, - moz_logins_hostname_formSubmitURL_index: { - table: "moz_logins", - columns: ["hostname", "formSubmitURL"] - }, - moz_logins_hostname_httpRealm_index: { - table: "moz_logins", - columns: ["hostname", "httpRealm"] - }, - moz_logins_guid_index: { - table: "moz_logins", - columns: ["guid"] - }, - moz_logins_encType_index: { - table: "moz_logins", - columns: ["encType"] - } - } - }, - _dbConnection : null, // The database connection - _dbStmts : null, // Database statements for memoization - - _signonsFile : null, // nsIFile for "signons.sqlite" - - - /* - * Internal method used by regression tests only. It overrides the default - * database location. - */ - initWithFile : function(aDBFile) { - if (aDBFile) - this._signonsFile = aDBFile; - - this.initialize(); - }, - - - initialize : function () { - this._dbStmts = {}; - - let isFirstRun; - try { - // Force initialization of the crypto module. - // See bug 717490 comment 17. - this._crypto; - - // If initWithFile is calling us, _signonsFile may already be set. - if (!this._signonsFile) { - // Initialize signons.sqlite - this._signonsFile = this._profileDir.clone(); - this._signonsFile.append("signons.sqlite"); - } - this.log("Opening database at " + this._signonsFile.path); - - // Initialize the database (create, migrate as necessary) - isFirstRun = this._dbInit(); - - this._initialized = true; - - return Promise.resolve(); - } catch (e) { - this.log("Initialization failed: " + e); - // If the import fails on first run, we want to delete the db - if (isFirstRun && e == "Import failed") - this._dbCleanup(false); - throw new Error("Initialization failed"); - } - }, - - - /** - * Internal method used by regression tests only. It is called before - * replacing this storage module with a new instance. - */ - terminate : function () { - return Promise.resolve(); - }, - - - addLogin : function (login) { - // Throws if there are bogus values. - LoginHelper.checkLoginValues(login); - - let [encUsername, encPassword, encType] = this._encryptLogin(login); - - // Clone the login, so we don't modify the caller's object. - let loginClone = login.clone(); - - // Initialize the nsILoginMetaInfo fields, unless the caller gave us values - loginClone.QueryInterface(Ci.nsILoginMetaInfo); - if (loginClone.guid) { - if (!this._isGuidUnique(loginClone.guid)) - throw new Error("specified GUID already exists"); - } else { - loginClone.guid = this._uuidService.generateUUID().toString(); - } - - // Set timestamps - let currentTime = Date.now(); - if (!loginClone.timeCreated) - loginClone.timeCreated = currentTime; - if (!loginClone.timeLastUsed) - loginClone.timeLastUsed = currentTime; - if (!loginClone.timePasswordChanged) - loginClone.timePasswordChanged = currentTime; - if (!loginClone.timesUsed) - loginClone.timesUsed = 1; - - let query = - "INSERT INTO moz_logins " + - "(hostname, httpRealm, formSubmitURL, usernameField, " + - "passwordField, encryptedUsername, encryptedPassword, " + - "guid, encType, timeCreated, timeLastUsed, timePasswordChanged, " + - "timesUsed) " + - "VALUES (:hostname, :httpRealm, :formSubmitURL, :usernameField, " + - ":passwordField, :encryptedUsername, :encryptedPassword, " + - ":guid, :encType, :timeCreated, :timeLastUsed, " + - ":timePasswordChanged, :timesUsed)"; - - let params = { - hostname: loginClone.hostname, - httpRealm: loginClone.httpRealm, - formSubmitURL: loginClone.formSubmitURL, - usernameField: loginClone.usernameField, - passwordField: loginClone.passwordField, - encryptedUsername: encUsername, - encryptedPassword: encPassword, - guid: loginClone.guid, - encType: encType, - timeCreated: loginClone.timeCreated, - timeLastUsed: loginClone.timeLastUsed, - timePasswordChanged: loginClone.timePasswordChanged, - timesUsed: loginClone.timesUsed - }; - - let stmt; - try { - stmt = this._dbCreateStatement(query, params); - stmt.execute(); - } catch (e) { - this.log("addLogin failed: " + e.name + " : " + e.message); - throw new Error("Couldn't write to database, login not added."); - } finally { - if (stmt) { - stmt.reset(); - } - } - - // Send a notification that a login was added. - LoginHelper.notifyStorageChanged("addLogin", loginClone); - return loginClone; - }, - - - removeLogin : function (login) { - let [idToDelete, storedLogin] = this._getIdForLogin(login); - if (!idToDelete) - throw new Error("No matching logins"); - - // Execute the statement & remove from DB - let query = "DELETE FROM moz_logins WHERE id = :id"; - let params = { id: idToDelete }; - let stmt; - let transaction = new Transaction(this._dbConnection); - try { - stmt = this._dbCreateStatement(query, params); - stmt.execute(); - this.storeDeletedLogin(storedLogin); - transaction.commit(); - } catch (e) { - this.log("_removeLogin failed: " + e.name + " : " + e.message); - transaction.rollback(); - throw new Error("Couldn't write to database, login not removed."); - } finally { - if (stmt) { - stmt.reset(); - } - } - LoginHelper.notifyStorageChanged("removeLogin", storedLogin); - }, - - modifyLogin : function (oldLogin, newLoginData) { - let [idToModify, oldStoredLogin] = this._getIdForLogin(oldLogin); - if (!idToModify) - throw new Error("No matching logins"); - - let newLogin = LoginHelper.buildModifiedLogin(oldStoredLogin, newLoginData); - - // Check if the new GUID is duplicate. - if (newLogin.guid != oldStoredLogin.guid && - !this._isGuidUnique(newLogin.guid)) { - throw new Error("specified GUID already exists"); - } - - // Look for an existing entry in case key properties changed. - if (!newLogin.matches(oldLogin, true)) { - let logins = this.findLogins({}, newLogin.hostname, - newLogin.formSubmitURL, - newLogin.httpRealm); - - if (logins.some(login => newLogin.matches(login, true))) - throw new Error("This login already exists."); - } - - // Get the encrypted value of the username and password. - let [encUsername, encPassword, encType] = this._encryptLogin(newLogin); - - let query = - "UPDATE moz_logins " + - "SET hostname = :hostname, " + - "httpRealm = :httpRealm, " + - "formSubmitURL = :formSubmitURL, " + - "usernameField = :usernameField, " + - "passwordField = :passwordField, " + - "encryptedUsername = :encryptedUsername, " + - "encryptedPassword = :encryptedPassword, " + - "guid = :guid, " + - "encType = :encType, " + - "timeCreated = :timeCreated, " + - "timeLastUsed = :timeLastUsed, " + - "timePasswordChanged = :timePasswordChanged, " + - "timesUsed = :timesUsed " + - "WHERE id = :id"; - - let params = { - id: idToModify, - hostname: newLogin.hostname, - httpRealm: newLogin.httpRealm, - formSubmitURL: newLogin.formSubmitURL, - usernameField: newLogin.usernameField, - passwordField: newLogin.passwordField, - encryptedUsername: encUsername, - encryptedPassword: encPassword, - guid: newLogin.guid, - encType: encType, - timeCreated: newLogin.timeCreated, - timeLastUsed: newLogin.timeLastUsed, - timePasswordChanged: newLogin.timePasswordChanged, - timesUsed: newLogin.timesUsed - }; - - let stmt; - try { - stmt = this._dbCreateStatement(query, params); - stmt.execute(); - } catch (e) { - this.log("modifyLogin failed: " + e.name + " : " + e.message); - throw new Error("Couldn't write to database, login not modified."); - } finally { - if (stmt) { - stmt.reset(); - } - } - - LoginHelper.notifyStorageChanged("modifyLogin", [oldStoredLogin, newLogin]); - }, - - - /** - * Returns an array of nsILoginInfo. - */ - getAllLogins : function (count) { - let [logins, ids] = this._searchLogins({}); - - // decrypt entries for caller. - logins = this._decryptLogins(logins); - - this.log("_getAllLogins: returning " + logins.length + " logins."); - if (count) - count.value = logins.length; // needed for XPCOM - return logins; - }, - - - /** - * Public wrapper around _searchLogins to convert the nsIPropertyBag to a - * JavaScript object and decrypt the results. - * - * @return {nsILoginInfo[]} which are decrypted. - */ - searchLogins : function(count, matchData) { - let realMatchData = {}; - let options = {}; - // Convert nsIPropertyBag to normal JS object - let propEnum = matchData.enumerator; - while (propEnum.hasMoreElements()) { - let prop = propEnum.getNext().QueryInterface(Ci.nsIProperty); - switch (prop.name) { - // Some property names aren't field names but are special options to affect the search. - case "schemeUpgrades": { - options[prop.name] = prop.value; - break; - } - default: { - realMatchData[prop.name] = prop.value; - break; - } - } - } - - let [logins, ids] = this._searchLogins(realMatchData, options); - - // Decrypt entries found for the caller. - logins = this._decryptLogins(logins); - - count.value = logins.length; // needed for XPCOM - return logins; - }, - - - /** - * Private method to perform arbitrary searches on any field. Decryption is - * left to the caller. - * - * Returns [logins, ids] for logins that match the arguments, where logins - * is an array of encrypted nsLoginInfo and ids is an array of associated - * ids in the database. - */ - _searchLogins : function (matchData, aOptions = { - schemeUpgrades: false, - }) { - let conditions = [], params = {}; - - for (let field in matchData) { - let value = matchData[field]; - let condition = ""; - switch (field) { - case "formSubmitURL": - if (value != null) { - // Historical compatibility requires this special case - condition = "formSubmitURL = '' OR "; - } - // Fall through - case "hostname": - if (value != null) { - condition += `${field} = :${field}`; - params[field] = value; - let valueURI; - try { - if (aOptions.schemeUpgrades && (valueURI = Services.io.newURI(value, null, null)) && - valueURI.scheme == "https") { - condition += ` OR ${field} = :http${field}`; - params["http" + field] = "http://" + valueURI.hostPort; - } - } catch (ex) { - // newURI will throw for some values - // but those URLs wouldn't support upgrades anyways. - } - break; - } - // Fall through - // Normal cases. - case "httpRealm": - case "id": - case "usernameField": - case "passwordField": - case "encryptedUsername": - case "encryptedPassword": - case "guid": - case "encType": - case "timeCreated": - case "timeLastUsed": - case "timePasswordChanged": - case "timesUsed": - if (value == null) { - condition = field + " isnull"; - } else { - condition = field + " = :" + field; - params[field] = value; - } - break; - // Fail if caller requests an unknown property. - default: - throw new Error("Unexpected field: " + field); - } - if (condition) { - conditions.push(condition); - } - } - - // Build query - let query = "SELECT * FROM moz_logins"; - if (conditions.length) { - conditions = conditions.map(c => "(" + c + ")"); - query += " WHERE " + conditions.join(" AND "); - } - - let stmt; - let logins = [], ids = []; - try { - stmt = this._dbCreateStatement(query, params); - // We can't execute as usual here, since we're iterating over rows - while (stmt.executeStep()) { - // Create the new nsLoginInfo object, push to array - let login = Cc["@mozilla.org/login-manager/loginInfo;1"]. - createInstance(Ci.nsILoginInfo); - login.init(stmt.row.hostname, stmt.row.formSubmitURL, - stmt.row.httpRealm, stmt.row.encryptedUsername, - stmt.row.encryptedPassword, stmt.row.usernameField, - stmt.row.passwordField); - // set nsILoginMetaInfo values - login.QueryInterface(Ci.nsILoginMetaInfo); - login.guid = stmt.row.guid; - login.timeCreated = stmt.row.timeCreated; - login.timeLastUsed = stmt.row.timeLastUsed; - login.timePasswordChanged = stmt.row.timePasswordChanged; - login.timesUsed = stmt.row.timesUsed; - logins.push(login); - ids.push(stmt.row.id); - } - } catch (e) { - this.log("_searchLogins failed: " + e.name + " : " + e.message); - } finally { - if (stmt) { - stmt.reset(); - } - } - - this.log("_searchLogins: returning " + logins.length + " logins"); - return [logins, ids]; - }, - - /** - * Moves a login to the deleted logins table - */ - storeDeletedLogin : function(aLogin) { - let stmt = null; - try { - this.log("Storing " + aLogin.guid + " in deleted passwords\n"); - let query = "INSERT INTO moz_deleted_logins (guid, timeDeleted) VALUES (:guid, :timeDeleted)"; - let params = { guid: aLogin.guid, - timeDeleted: Date.now() }; - let stmt = this._dbCreateStatement(query, params); - stmt.execute(); - } catch (ex) { - throw ex; - } finally { - if (stmt) - stmt.reset(); - } - }, - - - /** - * Removes all logins from storage. - */ - removeAllLogins : function () { - this.log("Removing all logins"); - let query; - let stmt; - let transaction = new Transaction(this._dbConnection); - - // Disabled hosts kept, as one presumably doesn't want to erase those. - // TODO: Add these items to the deleted items table once we've sorted - // out the issues from bug 756701 - query = "DELETE FROM moz_logins"; - try { - stmt = this._dbCreateStatement(query); - stmt.execute(); - transaction.commit(); - } catch (e) { - this.log("_removeAllLogins failed: " + e.name + " : " + e.message); - transaction.rollback(); - throw new Error("Couldn't write to database"); - } finally { - if (stmt) { - stmt.reset(); - } - } - - LoginHelper.notifyStorageChanged("removeAllLogins", null); - }, - - - findLogins : function (count, hostname, formSubmitURL, httpRealm) { - let loginData = { - hostname: hostname, - formSubmitURL: formSubmitURL, - httpRealm: httpRealm - }; - let matchData = { }; - for (let field of ["hostname", "formSubmitURL", "httpRealm"]) - if (loginData[field] != '') - matchData[field] = loginData[field]; - let [logins, ids] = this._searchLogins(matchData); - - // Decrypt entries found for the caller. - logins = this._decryptLogins(logins); - - this.log("_findLogins: returning " + logins.length + " logins"); - count.value = logins.length; // needed for XPCOM - return logins; - }, - - - countLogins : function (hostname, formSubmitURL, httpRealm) { - - let _countLoginsHelper = (hostname, formSubmitURL, httpRealm) => { - // Do checks for null and empty strings, adjust conditions and params - let [conditions, params] = - this._buildConditionsAndParams(hostname, formSubmitURL, httpRealm); - - let query = "SELECT COUNT(1) AS numLogins FROM moz_logins"; - if (conditions.length) { - conditions = conditions.map(c => "(" + c + ")"); - query += " WHERE " + conditions.join(" AND "); - } - - let stmt, numLogins; - try { - stmt = this._dbCreateStatement(query, params); - stmt.executeStep(); - numLogins = stmt.row.numLogins; - } catch (e) { - this.log("_countLogins failed: " + e.name + " : " + e.message); - } finally { - if (stmt) { - stmt.reset(); - } - } - return numLogins; - }; - - let resultLogins = _countLoginsHelper(hostname, formSubmitURL, httpRealm); - this.log("_countLogins: counted logins: " + resultLogins); - return resultLogins; - }, - - - get uiBusy() { - return this._crypto.uiBusy; - }, - - - get isLoggedIn() { - return this._crypto.isLoggedIn; - }, - - - /** - * Returns an array with two items: [id, login]. If the login was not - * found, both items will be null. The returned login contains the actual - * stored login (useful for looking at the actual nsILoginMetaInfo values). - */ - _getIdForLogin : function (login) { - let matchData = { }; - for (let field of ["hostname", "formSubmitURL", "httpRealm"]) - if (login[field] != '') - matchData[field] = login[field]; - let [logins, ids] = this._searchLogins(matchData); - - let id = null; - let foundLogin = null; - - // The specified login isn't encrypted, so we need to ensure - // the logins we're comparing with are decrypted. We decrypt one entry - // at a time, lest _decryptLogins return fewer entries and screw up - // indices between the two. - for (let i = 0; i < logins.length; i++) { - let [decryptedLogin] = this._decryptLogins([logins[i]]); - - if (!decryptedLogin || !decryptedLogin.equals(login)) - continue; - - // We've found a match, set id and break - foundLogin = decryptedLogin; - id = ids[i]; - break; - } - - return [id, foundLogin]; - }, - - - /** - * Adjusts the WHERE conditions and parameters for statements prior to the - * statement being created. This fixes the cases where nulls are involved - * and the empty string is supposed to be a wildcard match - */ - _buildConditionsAndParams : function (hostname, formSubmitURL, httpRealm) { - let conditions = [], params = {}; - - if (hostname == null) { - conditions.push("hostname isnull"); - } else if (hostname != '') { - conditions.push("hostname = :hostname"); - params["hostname"] = hostname; - } - - if (formSubmitURL == null) { - conditions.push("formSubmitURL isnull"); - } else if (formSubmitURL != '') { - conditions.push("formSubmitURL = :formSubmitURL OR formSubmitURL = ''"); - params["formSubmitURL"] = formSubmitURL; - } - - if (httpRealm == null) { - conditions.push("httpRealm isnull"); - } else if (httpRealm != '') { - conditions.push("httpRealm = :httpRealm"); - params["httpRealm"] = httpRealm; - } - - return [conditions, params]; - }, - - - /** - * Checks to see if the specified GUID already exists. - */ - _isGuidUnique : function (guid) { - let query = "SELECT COUNT(1) AS numLogins FROM moz_logins WHERE guid = :guid"; - let params = { guid: guid }; - - let stmt, numLogins; - try { - stmt = this._dbCreateStatement(query, params); - stmt.executeStep(); - numLogins = stmt.row.numLogins; - } catch (e) { - this.log("_isGuidUnique failed: " + e.name + " : " + e.message); - } finally { - if (stmt) { - stmt.reset(); - } - } - - return (numLogins == 0); - }, - - - /** - * Returns the encrypted username, password, and encrypton type for the specified - * login. Can throw if the user cancels a master password entry. - */ - _encryptLogin : function (login) { - let encUsername = this._crypto.encrypt(login.username); - let encPassword = this._crypto.encrypt(login.password); - let encType = this._crypto.defaultEncType; - - return [encUsername, encPassword, encType]; - }, - - - /** - * Decrypts username and password fields in the provided array of - * logins. - * - * The entries specified by the array will be decrypted, if possible. - * An array of successfully decrypted logins will be returned. The return - * value should be given to external callers (since still-encrypted - * entries are useless), whereas internal callers generally don't want - * to lose unencrypted entries (eg, because the user clicked Cancel - * instead of entering their master password) - */ - _decryptLogins : function (logins) { - let result = []; - - for (let login of logins) { - try { - login.username = this._crypto.decrypt(login.username); - login.password = this._crypto.decrypt(login.password); - } catch (e) { - // If decryption failed (corrupt entry?), just skip it. - // Rethrow other errors (like canceling entry of a master pw) - if (e.result == Cr.NS_ERROR_FAILURE) - continue; - throw e; - } - result.push(login); - } - - return result; - }, - - - // Database Creation & Access - - /** - * Creates a statement, wraps it, and then does parameter replacement - * Returns the wrapped statement for execution. Will use memoization - * so that statements can be reused. - */ - _dbCreateStatement : function (query, params) { - let wrappedStmt = this._dbStmts[query]; - // Memoize the statements - if (!wrappedStmt) { - this.log("Creating new statement for query: " + query); - wrappedStmt = this._dbConnection.createStatement(query); - this._dbStmts[query] = wrappedStmt; - } - // Replace parameters, must be done 1 at a time - if (params) - for (let i in params) - wrappedStmt.params[i] = params[i]; - return wrappedStmt; - }, - - - /** - * Attempts to initialize the database. This creates the file if it doesn't - * exist, performs any migrations, etc. Return if this is the first run. - */ - _dbInit : function () { - this.log("Initializing Database"); - let isFirstRun = false; - try { - this._dbConnection = this._storageService.openDatabase(this._signonsFile); - // Get the version of the schema in the file. It will be 0 if the - // database has not been created yet. - let version = this._dbConnection.schemaVersion; - if (version == 0) { - this._dbCreate(); - isFirstRun = true; - } else if (version != DB_VERSION) { - this._dbMigrate(version); - } - } catch (e) { - if (e.result == Cr.NS_ERROR_FILE_CORRUPTED) { - // Database is corrupted, so we backup the database, then throw - // causing initialization to fail and a new db to be created next use - this._dbCleanup(true); - } - throw e; - } - - Services.obs.addObserver(this, "profile-before-change", false); - return isFirstRun; - }, - - observe: function (subject, topic, data) { - switch (topic) { - case "profile-before-change": - Services.obs.removeObserver(this, "profile-before-change"); - this._dbClose(); - break; - } - }, - - _dbCreate: function () { - this.log("Creating Database"); - this._dbCreateSchema(); - this._dbConnection.schemaVersion = DB_VERSION; - }, - - - _dbCreateSchema : function () { - this._dbCreateTables(); - this._dbCreateIndices(); - }, - - - _dbCreateTables : function () { - this.log("Creating Tables"); - for (let name in this._dbSchema.tables) - this._dbConnection.createTable(name, this._dbSchema.tables[name]); - }, - - - _dbCreateIndices : function () { - this.log("Creating Indices"); - for (let name in this._dbSchema.indices) { - let index = this._dbSchema.indices[name]; - let statement = "CREATE INDEX IF NOT EXISTS " + name + " ON " + index.table + - "(" + index.columns.join(", ") + ")"; - this._dbConnection.executeSimpleSQL(statement); - } - }, - - - _dbMigrate : function (oldVersion) { - this.log("Attempting to migrate from version " + oldVersion); - - if (oldVersion > DB_VERSION) { - this.log("Downgrading to version " + DB_VERSION); - // User's DB is newer. Sanity check that our expected columns are - // present, and if so mark the lower version and merrily continue - // on. If the columns are borked, something is wrong so blow away - // the DB and start from scratch. [Future incompatible upgrades - // should swtich to a different table or file.] - - if (!this._dbAreExpectedColumnsPresent()) - throw Components.Exception("DB is missing expected columns", - Cr.NS_ERROR_FILE_CORRUPTED); - - // Change the stored version to the current version. If the user - // runs the newer code again, it will see the lower version number - // and re-upgrade (to fixup any entries the old code added). - this._dbConnection.schemaVersion = DB_VERSION; - return; - } - - // Upgrade to newer version... - - let transaction = new Transaction(this._dbConnection); - - try { - for (let v = oldVersion + 1; v <= DB_VERSION; v++) { - this.log("Upgrading to version " + v + "..."); - let migrateFunction = "_dbMigrateToVersion" + v; - this[migrateFunction](); - } - } catch (e) { - this.log("Migration failed: " + e); - transaction.rollback(); - throw e; - } - - this._dbConnection.schemaVersion = DB_VERSION; - transaction.commit(); - this.log("DB migration completed."); - }, - - - /** - * Version 2 adds a GUID column. Existing logins are assigned a random GUID. - */ - _dbMigrateToVersion2 : function () { - // Check to see if GUID column already exists, add if needed - let query; - if (!this._dbColumnExists("guid")) { - query = "ALTER TABLE moz_logins ADD COLUMN guid TEXT"; - this._dbConnection.executeSimpleSQL(query); - - query = "CREATE INDEX IF NOT EXISTS moz_logins_guid_index ON moz_logins (guid)"; - this._dbConnection.executeSimpleSQL(query); - } - - // Get a list of IDs for existing logins - let ids = []; - query = "SELECT id FROM moz_logins WHERE guid isnull"; - let stmt; - try { - stmt = this._dbCreateStatement(query); - while (stmt.executeStep()) - ids.push(stmt.row.id); - } catch (e) { - this.log("Failed getting IDs: " + e); - throw e; - } finally { - if (stmt) { - stmt.reset(); - } - } - - // Generate a GUID for each login and update the DB. - query = "UPDATE moz_logins SET guid = :guid WHERE id = :id"; - for (let id of ids) { - let params = { - id: id, - guid: this._uuidService.generateUUID().toString() - }; - - try { - stmt = this._dbCreateStatement(query, params); - stmt.execute(); - } catch (e) { - this.log("Failed setting GUID: " + e); - throw e; - } finally { - if (stmt) { - stmt.reset(); - } - } - } - }, - - - /** - * Version 3 adds a encType column. - */ - _dbMigrateToVersion3 : function () { - // Check to see if encType column already exists, add if needed - let query; - if (!this._dbColumnExists("encType")) { - query = "ALTER TABLE moz_logins ADD COLUMN encType INTEGER"; - this._dbConnection.executeSimpleSQL(query); - - query = "CREATE INDEX IF NOT EXISTS " + - "moz_logins_encType_index ON moz_logins (encType)"; - this._dbConnection.executeSimpleSQL(query); - } - - // Get a list of existing logins - let logins = []; - let stmt; - query = "SELECT id, encryptedUsername, encryptedPassword " + - "FROM moz_logins WHERE encType isnull"; - try { - stmt = this._dbCreateStatement(query); - while (stmt.executeStep()) { - let params = { id: stmt.row.id }; - // We will tag base64 logins correctly, but no longer support their use. - if (stmt.row.encryptedUsername.charAt(0) == '~' || - stmt.row.encryptedPassword.charAt(0) == '~') - params.encType = Ci.nsILoginManagerCrypto.ENCTYPE_BASE64; - else - params.encType = Ci.nsILoginManagerCrypto.ENCTYPE_SDR; - logins.push(params); - } - } catch (e) { - this.log("Failed getting logins: " + e); - throw e; - } finally { - if (stmt) { - stmt.reset(); - } - } - - // Determine encryption type for each login and update the DB. - query = "UPDATE moz_logins SET encType = :encType WHERE id = :id"; - for (let params of logins) { - try { - stmt = this._dbCreateStatement(query, params); - stmt.execute(); - } catch (e) { - this.log("Failed setting encType: " + e); - throw e; - } finally { - if (stmt) { - stmt.reset(); - } - } - } - }, - - - /** - * Version 4 adds timeCreated, timeLastUsed, timePasswordChanged, - * and timesUsed columns - */ - _dbMigrateToVersion4 : function () { - let query; - // Add the new columns, if needed. - for (let column of ["timeCreated", "timeLastUsed", "timePasswordChanged", "timesUsed"]) { - if (!this._dbColumnExists(column)) { - query = "ALTER TABLE moz_logins ADD COLUMN " + column + " INTEGER"; - this._dbConnection.executeSimpleSQL(query); - } - } - - // Get a list of IDs for existing logins. - let ids = []; - let stmt; - query = "SELECT id FROM moz_logins WHERE timeCreated isnull OR " + - "timeLastUsed isnull OR timePasswordChanged isnull OR timesUsed isnull"; - try { - stmt = this._dbCreateStatement(query); - while (stmt.executeStep()) - ids.push(stmt.row.id); - } catch (e) { - this.log("Failed getting IDs: " + e); - throw e; - } finally { - if (stmt) { - stmt.reset(); - } - } - - // Initialize logins with current time. - query = "UPDATE moz_logins SET timeCreated = :initTime, timeLastUsed = :initTime, " + - "timePasswordChanged = :initTime, timesUsed = 1 WHERE id = :id"; - let params = { - id: null, - initTime: Date.now() - }; - for (let id of ids) { - params.id = id; - try { - stmt = this._dbCreateStatement(query, params); - stmt.execute(); - } catch (e) { - this.log("Failed setting timestamps: " + e); - throw e; - } finally { - if (stmt) { - stmt.reset(); - } - } - } - }, - - - /** - * Version 5 adds the moz_deleted_logins table - */ - _dbMigrateToVersion5 : function () { - if (!this._dbConnection.tableExists("moz_deleted_logins")) { - this._dbConnection.createTable("moz_deleted_logins", this._dbSchema.tables.moz_deleted_logins); - } - }, - - /** - * Version 6 migrates all the hosts from - * moz_disabledHosts to the permission manager. - */ - _dbMigrateToVersion6 : function () { - let disabledHosts = []; - let query = "SELECT hostname FROM moz_disabledHosts"; - let stmt; - - try { - stmt = this._dbCreateStatement(query); - - while (stmt.executeStep()) { - disabledHosts.push(stmt.row.hostname); - } - - for (let host of disabledHosts) { - try { - let uri = Services.io.newURI(host, null, null); - Services.perms.add(uri, PERMISSION_SAVE_LOGINS, Services.perms.DENY_ACTION); - } catch (e) { - Cu.reportError(e); - } - } - } catch (e) { - this.log(`_dbMigrateToVersion6 failed: ${e.name} : ${e.message}`); - } finally { - if (stmt) { - stmt.reset(); - } - } - - query = "DELETE FROM moz_disabledHosts"; - this._dbConnection.executeSimpleSQL(query); - }, - - /** - * Sanity check to ensure that the columns this version of the code expects - * are present in the DB we're using. - */ - _dbAreExpectedColumnsPresent : function () { - let query = "SELECT " + - "id, " + - "hostname, " + - "httpRealm, " + - "formSubmitURL, " + - "usernameField, " + - "passwordField, " + - "encryptedUsername, " + - "encryptedPassword, " + - "guid, " + - "encType, " + - "timeCreated, " + - "timeLastUsed, " + - "timePasswordChanged, " + - "timesUsed " + - "FROM moz_logins"; - try { - let stmt = this._dbConnection.createStatement(query); - // (no need to execute statement, if it compiled we're good) - stmt.finalize(); - } catch (e) { - return false; - } - - query = "SELECT " + - "id, " + - "hostname " + - "FROM moz_disabledHosts"; - try { - let stmt = this._dbConnection.createStatement(query); - // (no need to execute statement, if it compiled we're good) - stmt.finalize(); - } catch (e) { - return false; - } - - this.log("verified that expected columns are present in DB."); - return true; - }, - - - /** - * Checks to see if the named column already exists. - */ - _dbColumnExists : function (columnName) { - let query = "SELECT " + columnName + " FROM moz_logins"; - try { - let stmt = this._dbConnection.createStatement(query); - // (no need to execute statement, if it compiled we're good) - stmt.finalize(); - return true; - } catch (e) { - return false; - } - }, - - _dbClose : function () { - this.log("Closing the DB connection."); - // Finalize all statements to free memory, avoid errors later - for (let query in this._dbStmts) { - let stmt = this._dbStmts[query]; - stmt.finalize(); - } - this._dbStmts = {}; - - if (this._dbConnection !== null) { - try { - this._dbConnection.close(); - } catch (e) { - Components.utils.reportError(e); - } - } - this._dbConnection = null; - }, - - /** - * Called when database creation fails. Finalizes database statements, - * closes the database connection, deletes the database file. - */ - _dbCleanup : function (backup) { - this.log("Cleaning up DB file - close & remove & backup=" + backup); - - // Create backup file - if (backup) { - let backupFile = this._signonsFile.leafName + ".corrupt"; - this._storageService.backupDatabaseFile(this._signonsFile, backupFile); - } - - this._dbClose(); - this._signonsFile.remove(false); - } - -}; // end of nsLoginManagerStorage_mozStorage implementation - -XPCOMUtils.defineLazyGetter(this.LoginManagerStorage_mozStorage.prototype, "log", () => { - let logger = LoginHelper.createLogger("Login storage"); - return logger.log.bind(logger); -}); - -var component = [LoginManagerStorage_mozStorage]; -this.NSGetFactory = XPCOMUtils.generateNSGetFactory(component); diff --git a/toolkit/components/satchel/FormHistory.jsm b/toolkit/components/satchel/FormHistory.jsm index ca9a28f1f..2182fbfb7 100644 --- a/toolkit/components/satchel/FormHistory.jsm +++ b/toolkit/components/satchel/FormHistory.jsm @@ -101,11 +101,7 @@ const DAY_IN_MS = 86400000; // 1 day in milliseconds const MAX_SEARCH_TOKENS = 10; const NOOP = function noop() {}; -#ifdef MOZ_WIDGET_ANDROID -var supportsDeletedTable = true; -#else var supportsDeletedTable = false; -#endif var Prefs = { initialized: false, diff --git a/toolkit/components/satchel/nsFormFillController.cpp b/toolkit/components/satchel/nsFormFillController.cpp index d70036635..d8dae41ed 100644 --- a/toolkit/components/satchel/nsFormFillController.cpp +++ b/toolkit/components/satchel/nsFormFillController.cpp @@ -985,7 +985,6 @@ nsFormFillController::Focus(nsIDOMEvent* aEvent) return NS_OK; } -#ifndef ANDROID nsCOMPtr formControl = do_QueryInterface(mFocusedInputNode); MOZ_ASSERT(formControl); @@ -995,7 +994,6 @@ nsFormFillController::Focus(nsIDOMEvent* aEvent) && formControl->GetType() == NS_FORM_INPUT_PASSWORD) { ShowPopup(); } -#endif mContextMenuFiredBeforeFocus = false; return NS_OK; diff --git a/toolkit/components/satchel/nsFormHistory.js b/toolkit/components/satchel/nsFormHistory.js index 9d67f0729..f940e104d 100644 --- a/toolkit/components/satchel/nsFormHistory.js +++ b/toolkit/components/satchel/nsFormHistory.js @@ -349,26 +349,6 @@ FormHistory.prototype = { }, moveToDeletedTable : function moveToDeletedTable(values, params) { -#ifdef MOZ_WIDGET_ANDROID - this.log("Moving entries to deleted table."); - - let stmt; - - try { - // Move the entries to the deleted items table. - let query = "INSERT INTO moz_deleted_formhistory (guid, timeDeleted) "; - if (values) query += values; - stmt = this.dbCreateStatement(query, params); - stmt.execute(); - } catch (e) { - this.log("Moving deleted entries failed: " + e); - throw e; - } finally { - if (stmt) { - stmt.reset(); - } - } -#endif }, get dbConnection() { diff --git a/toolkit/components/search/nsSearchService.js b/toolkit/components/search/nsSearchService.js index f6303bca1..f3e8b94a7 100644 --- a/toolkit/components/search/nsSearchService.js +++ b/toolkit/components/search/nsSearchService.js @@ -2213,32 +2213,8 @@ Engine.prototype = { this.lazySerializeTask.arm(); }, -#ifdef ANDROID - get _defaultMobileResponseType() { - let type = URLTYPE_SEARCH_HTML; - - let sysInfo = Cc["@mozilla.org/system-info;1"].getService(Ci.nsIPropertyBag2); - let isTablet = sysInfo.get("tablet"); - if (isTablet && this.supportsResponseType("application/x-moz-tabletsearch")) { - // Check for a tablet-specific search URL override - type = "application/x-moz-tabletsearch"; - } else if (!isTablet && this.supportsResponseType("application/x-moz-phonesearch")) { - // Check for a phone-specific search URL override - type = "application/x-moz-phonesearch"; - } - - delete this._defaultMobileResponseType; - return this._defaultMobileResponseType = type; - }, -#endif - // from nsISearchEngine getSubmission: function SRCH_ENG_getSubmission(aData, aResponseType, aPurpose) { -#ifdef ANDROID - if (!aResponseType) { - aResponseType = this._defaultMobileResponseType; - } -#endif if (!aResponseType) { aResponseType = URLTYPE_SEARCH_HTML; } @@ -2272,11 +2248,6 @@ Engine.prototype = { // from nsISearchEngine getResultDomain: function SRCH_ENG_getResultDomain(aResponseType) { -#ifdef ANDROID - if (!aResponseType) { - aResponseType = this._defaultMobileResponseType; - } -#endif if (!aResponseType) { aResponseType = URLTYPE_SEARCH_HTML; } @@ -2293,11 +2264,7 @@ Engine.prototype = { * Returns URL parsing properties used by _buildParseSubmissionMap. */ getURLParsingInfo: function () { -#ifdef ANDROID - let responseType = this._defaultMobileResponseType; -#else let responseType = URLTYPE_SEARCH_HTML; -#endif LOG("getURLParsingInfo: responseType: \"" + responseType + "\""); diff --git a/toolkit/components/url-classifier/nsUrlClassifierUtils.cpp b/toolkit/components/url-classifier/nsUrlClassifierUtils.cpp index e4cf68c98..c4ee5f26d 100644 --- a/toolkit/components/url-classifier/nsUrlClassifierUtils.cpp +++ b/toolkit/components/url-classifier/nsUrlClassifierUtils.cpp @@ -83,9 +83,7 @@ namespace safebrowsing { static PlatformType GetPlatformType() { -#if defined(ANDROID) - return ANDROID_PLATFORM; -#elif defined(XP_MACOSX) +#if defined(XP_MACOSX) return OSX_PLATFORM; #elif defined(XP_LINUX) return LINUX_PLATFORM; diff --git a/toolkit/content/aboutSupport.js b/toolkit/content/aboutSupport.js index f49172230..f9a0abcb0 100644 --- a/toolkit/content/aboutSupport.js +++ b/toolkit/content/aboutSupport.js @@ -599,16 +599,6 @@ function copyContentsToClipboard() { let clipboard = Cc["@mozilla.org/widget/clipboard;1"] .getService(Ci.nsIClipboard); clipboard.setData(transferable, null, clipboard.kGlobalClipboard); - -#ifdef MOZ_WIDGET_ANDROID - // Present a toast notification. - let message = { - type: "Toast:Show", - message: stringBundle().GetStringFromName("textCopied"), - duration: "short" - }; - Services.androidBridge.handleGeckoMessage(message); -#endif } // Return the plain text representation of an element. Do a little bit diff --git a/toolkit/content/aboutSupport.xhtml b/toolkit/content/aboutSupport.xhtml index 0b7b52164..8afee1867 100644 --- a/toolkit/content/aboutSupport.xhtml +++ b/toolkit/content/aboutSupport.xhtml @@ -101,7 +101,6 @@ -#ifndef ANDROID #ifdef MOZ_UPDATER @@ -115,7 +114,6 @@ #endif -#endif #ifdef MOZ_UPDATER @@ -240,7 +238,6 @@ -#ifndef ANDROID &aboutSupport.appBasicsProfiles; @@ -250,8 +247,6 @@ about:profiles -#endif - diff --git a/toolkit/content/aboutTelemetry.js b/toolkit/content/aboutTelemetry.js index 0829fe7e2..97dcba9e2 100644 --- a/toolkit/content/aboutTelemetry.js +++ b/toolkit/content/aboutTelemetry.js @@ -233,17 +233,9 @@ var Settings = { let elements = document.getElementsByClassName("change-data-choices-link"); for (let el of elements) { el.addEventListener("click", function() { -#ifdef MOZ_WIDGET_ANDROID - Cu.import("resource://gre/modules/Messaging.jsm"); - Messaging.sendRequest({ - type: "Settings:Show", - resource: "preferences_privacy", - }); -#else // Show the data choices preferences on desktop. let mainWindow = getMainWindowWithPreferencesPane(); mainWindow.openAdvancedPreferences("dataChoicesTab"); -#endif }, false); } }, diff --git a/toolkit/content/buildconfig.html b/toolkit/content/buildconfig.html index d3373f54c..322208189 100644 --- a/toolkit/content/buildconfig.html +++ b/toolkit/content/buildconfig.html @@ -58,9 +58,5 @@

Configure options

@MOZ_CONFIGURE_OPTIONS@

-#ifdef ANDROID -

Package name

-

@ANDROID_PACKAGE_NAME@

-#endif diff --git a/toolkit/content/contentAreaUtils.js b/toolkit/content/contentAreaUtils.js index 2512804fa..17e463325 100644 --- a/toolkit/content/contentAreaUtils.js +++ b/toolkit/content/contentAreaUtils.js @@ -1115,40 +1115,8 @@ function validateFileName(aFileName) aFileName = aFileName.replace(/[\<]+/g, "("); aFileName = aFileName.replace(/[\>]+/g, ")"); } - else if (navigator.appVersion.indexOf("Macintosh") != -1) + else if (navigator.appVersion.indexOf("Macintosh") != -1) { re = /[\:\/]+/g; - else if (navigator.appVersion.indexOf("Android") != -1) { - // On mobile devices, the filesystem may be very limited in what - // it considers valid characters. To avoid errors, we sanitize - // conservatively. - const dangerousChars = "*?<>|\":/\\[];,+="; - var processed = ""; - for (var i = 0; i < aFileName.length; i++) - processed += aFileName.charCodeAt(i) >= 32 && - !(dangerousChars.indexOf(aFileName[i]) >= 0) ? aFileName[i] - : "_"; - - // Last character should not be a space - processed = processed.trim(); - - // If a large part of the filename has been sanitized, then we - // will use a default filename instead - if (processed.replace(/_/g, "").length <= processed.length/2) { - // We purposefully do not use a localized default filename, - // which we could have done using - // ContentAreaUtils.stringBundle.GetStringFromName("DefaultSaveFileName") - // since it may contain invalid characters. - var original = processed; - processed = "download"; - - // Preserve a suffix, if there is one - if (original.indexOf(".") >= 0) { - var suffix = original.split(".").slice(-1)[0]; - if (suffix && suffix.indexOf("_") < 0) - processed += "." + suffix; - } - } - return processed; } return aFileName.replace(re, "_"); diff --git a/toolkit/content/jar.mn b/toolkit/content/jar.mn index 96c559bb2..c73427a31 100644 --- a/toolkit/content/jar.mn +++ b/toolkit/content/jar.mn @@ -19,10 +19,8 @@ toolkit.jar: #endif content/global/aboutNetworking.js content/global/aboutNetworking.xhtml -#ifndef ANDROID * content/global/aboutProfiles.js content/global/aboutProfiles.xhtml -#endif content/global/aboutServiceWorkers.js content/global/aboutServiceWorkers.xhtml #ifdef MOZ_WEBRTC diff --git a/toolkit/content/moz.build b/toolkit/content/moz.build index b1f6b6419..0a08483b4 100644 --- a/toolkit/content/moz.build +++ b/toolkit/content/moz.build @@ -14,9 +14,6 @@ for var in ('target', DEFINES['CFLAGS'] = CONFIG['OS_CFLAGS'] DEFINES['TOPOBJDIR'] = TOPOBJDIR -if CONFIG['OS_TARGET'] == 'Android': - DEFINES['ANDROID_PACKAGE_NAME'] = CONFIG['ANDROID_PACKAGE_NAME'] - if CONFIG['MOZ_ANDROID_CXX_STL'] == 'libc++': DEFINES['MOZ_USE_LIBCXX'] = True diff --git a/toolkit/library/libxul.mk b/toolkit/library/libxul.mk index 80f934e60..d09a3962f 100644 --- a/toolkit/library/libxul.mk +++ b/toolkit/library/libxul.mk @@ -5,7 +5,6 @@ EXTRA_DEPS += $(topsrcdir)/toolkit/library/libxul.mk ifeq (Linux,$(OS_ARCH)) -ifneq (Android,$(OS_TARGET)) OS_LDFLAGS += -Wl,-version-script,symverscript symverscript: $(topsrcdir)/toolkit/library/symverscript.in @@ -14,7 +13,6 @@ symverscript: $(topsrcdir)/toolkit/library/symverscript.in EXTRA_DEPS += symverscript endif -endif # Generate GDB pretty printer-autoload files on Linux and Solaris. OSX's GDB is # too old to support Python pretty-printers; if this changes, we could make diff --git a/toolkit/library/moz.build b/toolkit/library/moz.build index 3056799f0..d9b167547 100644 --- a/toolkit/library/moz.build +++ b/toolkit/library/moz.build @@ -178,7 +178,7 @@ if CONFIG['OS_ARCH'] == 'WINNT': 'winspool', ] -if CONFIG['OS_ARCH'] == 'Linux' and CONFIG['OS_TARGET'] != 'Android': +if CONFIG['OS_ARCH'] == 'Linux': OS_LIBS += [ 'rt', ] diff --git a/toolkit/modules/Services.jsm b/toolkit/modules/Services.jsm index 9b5082efd..09e5df077 100644 --- a/toolkit/modules/Services.jsm +++ b/toolkit/modules/Services.jsm @@ -51,9 +51,6 @@ XPCOMUtils.defineLazyGetter(Services, "ppmm", () => { }); var initTable = [ -#ifdef MOZ_WIDGET_ANDROID - ["androidBridge", "@mozilla.org/android/bridge;1", "nsIAndroidBridge"], -#endif ["appShell", "@mozilla.org/appshell/appShellService;1", "nsIAppShellService"], ["cache", "@mozilla.org/network/cache-service;1", "nsICacheService"], ["cache2", "@mozilla.org/netwerk/cache-storage-service;1", "nsICacheStorageService"], diff --git a/toolkit/modules/moz.build b/toolkit/modules/moz.build index c386759e7..062388d24 100644 --- a/toolkit/modules/moz.build +++ b/toolkit/modules/moz.build @@ -105,16 +105,14 @@ EXTRA_PP_JS_MODULES += [ 'Services.jsm', ] -if 'Android' != CONFIG['OS_TARGET']: - EXTRA_PP_JS_MODULES += [ - 'LightweightThemeConsumer.jsm', - ] - DIRS += [ - 'subprocess', - ] -else: - DEFINES['ANDROID'] = True +EXTRA_PP_JS_MODULES += [ + 'LightweightThemeConsumer.jsm', +] + +DIRS += [ + 'subprocess', +] if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows': diff --git a/toolkit/moz.build b/toolkit/moz.build index c0f7dc214..9c5102a01 100644 --- a/toolkit/moz.build +++ b/toolkit/moz.build @@ -27,16 +27,15 @@ if CONFIG['MOZ_JETPACK']: DIRS += ['mozapps/extensions'] -if CONFIG['MOZ_UPDATER'] and CONFIG['MOZ_WIDGET_TOOLKIT'] != 'android': +if CONFIG['MOZ_UPDATER']: DIRS += ['mozapps/update'] - -if CONFIG['MOZ_UPDATER'] and CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows': -# Including mozapps/update/common-standalone allows the maintenance service -# to be built so the maintenance service can be used for things other than -# updating applications. - DIRS += [ - 'mozapps/update/common-standalone', - ] + if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows': + # Including mozapps/update/common-standalone allows the maintenance service + # to be built so the maintenance service can be used for things other than + # updating applications. + DIRS += [ + 'mozapps/update/common-standalone', + ] DIRS += ['xre'] @@ -46,5 +45,3 @@ elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa': DIRS += ['system/osxproxy'] elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows': DIRS += ['system/windowsproxy'] -elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'android': - DIRS += ['system/androidproxy'] diff --git a/toolkit/moz.configure b/toolkit/moz.configure index 792fb113d..ca7f91e6e 100644 --- a/toolkit/moz.configure +++ b/toolkit/moz.configure @@ -14,9 +14,6 @@ option('--enable-systrace', env='MOZ_USE_SYSTRACE', @depends('--enable-systrace', target) def systrace(value, target): - if value and target.os != 'Android': - die('--enable-systrace cannot be used when targeting %s', - target.os) if value: return True @@ -66,7 +63,7 @@ set_config('L10NBASEDIR', l10n_base) # reason. option('--enable-default-toolkit', nargs=1, choices=('cairo-windows', 'cairo-gtk2', 'cairo-gtk2-x11', 'cairo-gtk3', - 'cairo-cocoa', 'cairo-uikit', 'cairo-android'), + 'cairo-cocoa', 'cairo-uikit'), help='Select default toolkit') @depends('--enable-default-toolkit', target) @@ -80,13 +77,6 @@ def toolkit(value, target): platform_choices = ('cairo-cocoa',) elif target.os == 'iOS': platform_choices = ('cairo-uikit',) - elif target.os == 'Android': - if value.origin == 'implied': - # Trust values coming from imply_option() (used in - # b2g/moz.configure). - platform_choices = tuple(value) - else: - platform_choices = ('cairo-android',) else: platform_choices = ('cairo-gtk3', 'cairo-gtk2', 'cairo-gtk2-x11') @@ -185,7 +175,7 @@ set_define(gl_provider_define, True) # ============================================================== @depends(toolkit) def pdf_printing(toolkit): - if toolkit in ('windows', 'gtk2', 'gtk3', 'android'): + if toolkit in ('windows', 'gtk2', 'gtk3'): return True @depends(pdf_printing) @@ -207,8 +197,7 @@ option(env='MOZ_INSTRUMENT_EVENT_LOOP', @depends('MOZ_INSTRUMENT_EVENT_LOOP', toolkit) def instrument_event_loop(value, toolkit): - if value or (toolkit in ('windows', 'gtk2', 'gtk3', 'cocoa', - 'android') and value.origin == 'default'): + if value or (toolkit in ('windows', 'gtk2', 'gtk3', 'cocoa') and value.origin == 'default'): return True set_config('MOZ_INSTRUMENT_EVENT_LOOP', instrument_event_loop) @@ -266,8 +255,7 @@ add_old_configure_assignment('_HAVE_FREETYPE2', # ============================================================== @depends(target) def tree_freetype(target): - if target.os == 'Android': - return True + return None set_define('MOZ_TREE_FREETYPE', tree_freetype) set_config('MOZ_TREE_FREETYPE', tree_freetype) @@ -332,7 +320,7 @@ option('--disable-ffmpeg', def ffmpeg(value, target): enabled = bool(value) if value.origin == 'default': - enabled = target.os not in ('Android', 'WINNT') + enabled = target.os not in ('WINNT') if enabled: return True @@ -349,8 +337,7 @@ option('--disable-fmp4', env='MOZ_FMP4', def fmp4(value, target, wmf, applemedia): enabled = bool(value) if value.origin == 'default': - # target.os == 'Android' includes all B2G versions - enabled = wmf or applemedia or target.os == 'Android' + enabled = wmf or applemedia if enabled: return True @@ -390,7 +377,7 @@ set_config('MOZ_PACKAGER_FORMAT', packager_format) def jar_maker_format(host, build_project): # Multilocales for mobile/android use the same mergedirs for all locales, # so we can't use symlinks for those builds. - if host.os == 'WINNT' or build_project == 'mobile/android': + if host.os == 'WINNT': return 'flat' return 'symlink' @@ -398,23 +385,10 @@ set_config('MOZ_JAR_MAKER_FILE_FORMAT', jar_maker_format) @depends(toolkit) def omnijar_name(toolkit): - # Fennec's static resources live in the assets/ folder of the - # APK. Adding a path to the name here works because we only - # have one omnijar file in the final package (which is not the - # case on desktop), and necessitates some contortions during - # packaging so that the resources in the omnijar are considered - # as rooted at / and not as rooted at assets/ (which again is - # not the case on desktop: there are omnijars rooted at webrtc/, - # etc). packager.mk handles changing the rooting of the single - # omnijar. - return 'assets/omni.ja' if toolkit == 'android' else 'omni.ja' + return 'omni.ja' set_config('OMNIJAR_NAME', omnijar_name) -project_flag('MOZ_ANDROID_HISTORY', - help='Enable Android History instead of Places', - set_as_define=True) - # Permissions system # ============================================================== option(name='--disable-permissions', @@ -667,13 +641,6 @@ set_config('MOZ_ENABLE_SKIA', skia) set_define('MOZ_ENABLE_SKIA', skia) set_define('USE_SKIA', skia) -@depends(skia, target) -def skia_android(skia, target): - if skia and target.os == 'Android': - return True - -set_define('SK_BUILD_FOR_ANDROID_NDK', skia_android) - option('--disable-skia-gpu', help='Disable use of Skia-GPU') @depends('--disable-skia-gpu', skia, target) diff --git a/toolkit/mozapps/extensions/extensions.manifest b/toolkit/mozapps/extensions/extensions.manifest index 7efb74a9d..b56152e10 100644 --- a/toolkit/mozapps/extensions/extensions.manifest +++ b/toolkit/mozapps/extensions/extensions.manifest @@ -1,14 +1,16 @@ component {4399533d-08d1-458c-a87a-235f74451cfa} addonManager.js contract @mozilla.org/addons/integration;1 {4399533d-08d1-458c-a87a-235f74451cfa} category update-timer addonManager @mozilla.org/addons/integration;1,getService,addon-background-update-timer,extensions.update.interval,86400 + component {7beb3ba8-6ec3-41b4-b67c-da89b8518922} amContentHandler.js contract @mozilla.org/uriloader/content-handler;1?type=application/x-xpinstall {7beb3ba8-6ec3-41b4-b67c-da89b8518922} + component {0f38e086-89a3-40a5-8ffc-9b694de1d04a} amWebInstallListener.js contract @mozilla.org/addons/web-install-listener;1 {0f38e086-89a3-40a5-8ffc-9b694de1d04a} + component {9df8ef2b-94da-45c9-ab9f-132eb55fddf1} amInstallTrigger.js contract @mozilla.org/addons/installtrigger;1 {9df8ef2b-94da-45c9-ab9f-132eb55fddf1} category JavaScript-global-property InstallTrigger @mozilla.org/addons/installtrigger;1 -#ifndef MOZ_WIDGET_ANDROID + category addon-provider-module PluginProvider resource://gre/modules/addons/PluginProvider.jsm -#endif category addon-provider-module GMPProvider resource://gre/modules/addons/GMPProvider.jsm diff --git a/toolkit/mozapps/extensions/internal/moz.build b/toolkit/mozapps/extensions/internal/moz.build index 337df3104..12e95fb5a 100644 --- a/toolkit/mozapps/extensions/internal/moz.build +++ b/toolkit/mozapps/extensions/internal/moz.build @@ -10,16 +10,11 @@ EXTRA_JS_MODULES.addons += [ 'Content.js', 'GMPProvider.jsm', 'LightweightThemeImageOptimizer.jsm', + 'PluginProvider.jsm', 'ProductAddonChecker.jsm', 'SpellCheckDictionaryBootstrap.js', ] -# Don't ship unused providers on Android -if CONFIG['MOZ_WIDGET_TOOLKIT'] != 'android': - EXTRA_JS_MODULES.addons += [ - 'PluginProvider.jsm', - ] - EXTRA_PP_JS_MODULES.addons += [ 'AddonRepository.jsm', 'AddonUpdateChecker.jsm', diff --git a/toolkit/nss.configure b/toolkit/nss.configure index 734f4f029..0febafb34 100644 --- a/toolkit/nss.configure +++ b/toolkit/nss.configure @@ -9,7 +9,7 @@ # ============================================================== @depends(build_project, '--help') def dbm_default(build_project, _): - return build_project not in ('mobile/android', 'b2g', 'b2g/graphene') + return True option('--enable-dbm', default=dbm_default, help='Enable building DBM') diff --git a/toolkit/profile/nsToolkitProfileService.cpp b/toolkit/profile/nsToolkitProfileService.cpp index e818d27e6..2fe51b285 100644 --- a/toolkit/profile/nsToolkitProfileService.cpp +++ b/toolkit/profile/nsToolkitProfileService.cpp @@ -811,10 +811,10 @@ nsToolkitProfileService::CreateProfileInternal(nsIFile* aRootDir, rv = rootDir->Create(nsIFile::DIRECTORY_TYPE, 0700); NS_ENSURE_SUCCESS(rv, rv); rv = rootDir->SetPermissions(0700); -#ifndef ANDROID + // If the profile is on the sdcard, this will fail but its non-fatal NS_ENSURE_SUCCESS(rv, rv); -#endif + } rv = localDir->Exists(&exists); diff --git a/toolkit/system/androidproxy/moz.build b/toolkit/system/androidproxy/moz.build deleted file mode 100644 index 5c6b0c105..000000000 --- a/toolkit/system/androidproxy/moz.build +++ /dev/null @@ -1,11 +0,0 @@ -# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- -# vim: set filetype=python: -# 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/. - -SOURCES += [ - 'nsAndroidSystemProxySettings.cpp', -] - -FINAL_LIBRARY = 'xul' diff --git a/toolkit/system/androidproxy/nsAndroidSystemProxySettings.cpp b/toolkit/system/androidproxy/nsAndroidSystemProxySettings.cpp deleted file mode 100644 index 71e12bb77..000000000 --- a/toolkit/system/androidproxy/nsAndroidSystemProxySettings.cpp +++ /dev/null @@ -1,89 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* 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/. */ - -#include "nsIURI.h" - -#include "nsISystemProxySettings.h" -#include "nsIServiceManager.h" -#include "mozilla/ModuleUtils.h" -#include "nsPrintfCString.h" -#include "nsNetCID.h" -#include "nsISupportsPrimitives.h" -#include "nsIURI.h" - -#include "AndroidBridge.h" - -class nsAndroidSystemProxySettings : public nsISystemProxySettings -{ -public: - NS_DECL_THREADSAFE_ISUPPORTS - NS_DECL_NSISYSTEMPROXYSETTINGS - - nsAndroidSystemProxySettings() {}; - nsresult Init(); - -private: - virtual ~nsAndroidSystemProxySettings() {} -}; - -NS_IMPL_ISUPPORTS(nsAndroidSystemProxySettings, nsISystemProxySettings) - -NS_IMETHODIMP -nsAndroidSystemProxySettings::GetMainThreadOnly(bool *aMainThreadOnly) -{ - *aMainThreadOnly = true; - return NS_OK; -} - - -nsresult -nsAndroidSystemProxySettings::Init() -{ - return NS_OK; -} - -nsresult -nsAndroidSystemProxySettings::GetPACURI(nsACString& aResult) -{ - return NS_OK; -} - -nsresult -nsAndroidSystemProxySettings::GetProxyForURI(const nsACString & aSpec, - const nsACString & aScheme, - const nsACString & aHost, - const int32_t aPort, - nsACString & aResult) -{ - return mozilla::AndroidBridge::Bridge()->GetProxyForURI(aSpec, aScheme, aHost, aPort, aResult); -} - -NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsAndroidSystemProxySettings, Init) - -#define NS_ANDROIDSYSTEMPROXYSERVICE_CID \ - {0xf01f0060, 0x3708, 0x478e, \ - {0xb9, 0x35, 0x3e, 0xce, 0x8b, 0xe2, 0x94, 0xb8}} - -NS_DEFINE_NAMED_CID(NS_ANDROIDSYSTEMPROXYSERVICE_CID); - -void test() {}; - -static const mozilla::Module::CIDEntry kSysProxyCIDs[] = { - { &kNS_ANDROIDSYSTEMPROXYSERVICE_CID, false, nullptr, nsAndroidSystemProxySettingsConstructor }, - { nullptr } -}; - -static const mozilla::Module::ContractIDEntry kSysProxyContracts[] = { - { NS_SYSTEMPROXYSETTINGS_CONTRACTID, &kNS_ANDROIDSYSTEMPROXYSERVICE_CID }, - { nullptr } -}; - -static const mozilla::Module kSysProxyModule = { - mozilla::Module::kVersion, - kSysProxyCIDs, - kSysProxyContracts -}; - -NSMODULE_DEFN(nsAndroidProxyModule) = &kSysProxyModule; diff --git a/toolkit/themes/mobile/global/empty.css b/toolkit/themes/mobile/global/empty.css deleted file mode 100644 index d615bf886..000000000 --- a/toolkit/themes/mobile/global/empty.css +++ /dev/null @@ -1,7 +0,0 @@ -/* 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/. */ - -/* - * Empty stub for theme CSS - */ diff --git a/toolkit/themes/mobile/global/icons/Error.png b/toolkit/themes/mobile/global/icons/Error.png deleted file mode 100644 index bd4064f49..000000000 Binary files a/toolkit/themes/mobile/global/icons/Error.png and /dev/null differ diff --git a/toolkit/themes/mobile/global/media/TopLevelImageDocument.css b/toolkit/themes/mobile/global/media/TopLevelImageDocument.css deleted file mode 100644 index 524217516..000000000 --- a/toolkit/themes/mobile/global/media/TopLevelImageDocument.css +++ /dev/null @@ -1,17 +0,0 @@ -/* 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/. */ - -@media not print { - /* N.B.: Remember to update ImageDocument.css in the tree or reftests may fail! */ - - body { - color: #eee; - background-image: url("chrome://global/skin/media/imagedoc-darknoise.png"); - } - - img.transparent { - background: hsl(0,0%,90%) url("chrome://global/skin/media/imagedoc-lightnoise.png"); - color: #222; - } -} diff --git a/toolkit/themes/mobile/global/media/TopLevelVideoDocument.css b/toolkit/themes/mobile/global/media/TopLevelVideoDocument.css deleted file mode 100644 index 760cdcd53..000000000 --- a/toolkit/themes/mobile/global/media/TopLevelVideoDocument.css +++ /dev/null @@ -1,12 +0,0 @@ -/* 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/. */ - -body { - background-image: url("chrome://global/skin/media/imagedoc-darknoise.png"); - background-color: rgb(33,33,33); /* Average color of that ^ image. */ -} - -video { - box-shadow: 0 0 15px #000; -} diff --git a/toolkit/themes/mobile/global/media/clicktoplay-bgtexture.png b/toolkit/themes/mobile/global/media/clicktoplay-bgtexture.png deleted file mode 100644 index 0d3cacd11..000000000 Binary files a/toolkit/themes/mobile/global/media/clicktoplay-bgtexture.png and /dev/null differ diff --git a/toolkit/themes/mobile/global/media/error.png b/toolkit/themes/mobile/global/media/error.png deleted file mode 100644 index 58e37283a..000000000 Binary files a/toolkit/themes/mobile/global/media/error.png and /dev/null differ diff --git a/toolkit/themes/mobile/global/media/imagedoc-darknoise.png b/toolkit/themes/mobile/global/media/imagedoc-darknoise.png deleted file mode 100644 index 5c33e24d4..000000000 Binary files a/toolkit/themes/mobile/global/media/imagedoc-darknoise.png and /dev/null differ diff --git a/toolkit/themes/mobile/global/media/imagedoc-lightnoise.png b/toolkit/themes/mobile/global/media/imagedoc-lightnoise.png deleted file mode 100644 index 3467cf4d4..000000000 Binary files a/toolkit/themes/mobile/global/media/imagedoc-lightnoise.png and /dev/null differ diff --git a/toolkit/themes/mobile/global/media/throbber.png b/toolkit/themes/mobile/global/media/throbber.png deleted file mode 100644 index 8e49fe5b2..000000000 Binary files a/toolkit/themes/mobile/global/media/throbber.png and /dev/null differ diff --git a/toolkit/themes/mobile/global/media/videoClickToPlayButton.svg b/toolkit/themes/mobile/global/media/videoClickToPlayButton.svg deleted file mode 100644 index f7ca6b653..000000000 --- a/toolkit/themes/mobile/global/media/videoClickToPlayButton.svg +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/toolkit/themes/mobile/jar.mn b/toolkit/themes/mobile/jar.mn deleted file mode 100644 index 62f889349..000000000 --- a/toolkit/themes/mobile/jar.mn +++ /dev/null @@ -1,55 +0,0 @@ -# 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/. - -toolkit.jar: -% skin global classic/1.0 %skin/classic/global/ -# These are the CSS files that must exist - skin/classic/global/autocomplete.css (global/empty.css) - skin/classic/global/button.css (global/empty.css) - skin/classic/global/checkbox.css (global/empty.css) - skin/classic/global/dialog.css (global/empty.css) - skin/classic/global/dropmarker.css (global/empty.css) - skin/classic/global/global.css (global/empty.css) - skin/classic/global/groupbox.css (global/empty.css) - skin/classic/global/listbox.css (global/empty.css) - skin/classic/global/menu.css (global/empty.css) - skin/classic/global/menulist.css (global/empty.css) - skin/classic/global/numberbox.css (global/empty.css) - skin/classic/global/popup.css (global/empty.css) - skin/classic/global/preferences.css (global/empty.css) - skin/classic/global/progressmeter.css (global/empty.css) - skin/classic/global/radio.css (global/empty.css) - skin/classic/global/resizer.css (global/empty.css) - skin/classic/global/richlistbox.css (global/empty.css) - skin/classic/global/scale.css (global/empty.css) - skin/classic/global/scrollbox.css (global/empty.css) - skin/classic/global/spinbuttons.css (global/empty.css) - skin/classic/global/splitter.css (global/empty.css) - skin/classic/global/tabbox.css (global/empty.css) - skin/classic/global/textbox.css (global/empty.css) - skin/classic/global/toolbar.css (global/empty.css) - skin/classic/global/toolbarbutton.css (global/empty.css) - skin/classic/global/tree.css (global/empty.css) - skin/classic/global/wizard.css (global/empty.css) - skin/classic/global/scrollbars.css (global/empty.css) - - skin/classic/global/media/clicktoplay-bgtexture.png (global/media/clicktoplay-bgtexture.png) - skin/classic/global/media/error.png (global/media/error.png) - skin/classic/global/media/throbber.png (global/media/throbber.png) - skin/classic/global/media/videoClickToPlayButton.svg (global/media/videoClickToPlayButton.svg) - skin/classic/global/media/TopLevelImageDocument.css (global/media/TopLevelImageDocument.css) - skin/classic/global/media/TopLevelVideoDocument.css (global/media/TopLevelVideoDocument.css) - skin/classic/global/media/imagedoc-lightnoise.png (global/media/imagedoc-lightnoise.png) - skin/classic/global/media/imagedoc-darknoise.png (global/media/imagedoc-darknoise.png) - - skin/classic/global/icons/Error.png (global/icons/Error.png) - -% skin mozapps classic/1.0 %skin/classic/mozapps/ - skin/classic/mozapps/plugins/pluginProblem.css (mozapps/plugins/pluginProblem.css) - - skin/classic/mozapps/plugins/contentPluginActivate.png (mozapps/plugins/contentPluginActivate.png) - skin/classic/mozapps/plugins/contentPluginBlocked.png (mozapps/plugins/contentPluginBlocked.png) - skin/classic/mozapps/plugins/contentPluginClose.png (mozapps/plugins/contentPluginClose.png) - skin/classic/mozapps/plugins/contentPluginCrashed.png (mozapps/plugins/contentPluginCrashed.png) - skin/classic/mozapps/plugins/contentPluginStripe.png (mozapps/plugins/contentPluginStripe.png) diff --git a/toolkit/themes/mobile/moz.build b/toolkit/themes/mobile/moz.build deleted file mode 100644 index aac3a838c..000000000 --- a/toolkit/themes/mobile/moz.build +++ /dev/null @@ -1,7 +0,0 @@ -# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- -# vim: set filetype=python: -# 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/. - -JAR_MANIFESTS += ['jar.mn'] diff --git a/toolkit/themes/mobile/mozapps/plugins/contentPluginActivate.png b/toolkit/themes/mobile/mozapps/plugins/contentPluginActivate.png deleted file mode 100644 index 31351dc3b..000000000 Binary files a/toolkit/themes/mobile/mozapps/plugins/contentPluginActivate.png and /dev/null differ diff --git a/toolkit/themes/mobile/mozapps/plugins/contentPluginBlocked.png b/toolkit/themes/mobile/mozapps/plugins/contentPluginBlocked.png deleted file mode 100644 index 1e092bf18..000000000 Binary files a/toolkit/themes/mobile/mozapps/plugins/contentPluginBlocked.png and /dev/null differ diff --git a/toolkit/themes/mobile/mozapps/plugins/contentPluginClose.png b/toolkit/themes/mobile/mozapps/plugins/contentPluginClose.png deleted file mode 100644 index 61eb55828..000000000 Binary files a/toolkit/themes/mobile/mozapps/plugins/contentPluginClose.png and /dev/null differ diff --git a/toolkit/themes/mobile/mozapps/plugins/contentPluginCrashed.png b/toolkit/themes/mobile/mozapps/plugins/contentPluginCrashed.png deleted file mode 100644 index 89d3e91a9..000000000 Binary files a/toolkit/themes/mobile/mozapps/plugins/contentPluginCrashed.png and /dev/null differ diff --git a/toolkit/themes/mobile/mozapps/plugins/contentPluginDisabled.png b/toolkit/themes/mobile/mozapps/plugins/contentPluginDisabled.png deleted file mode 100644 index b8b6a1020..000000000 Binary files a/toolkit/themes/mobile/mozapps/plugins/contentPluginDisabled.png and /dev/null differ diff --git a/toolkit/themes/mobile/mozapps/plugins/contentPluginStripe.png b/toolkit/themes/mobile/mozapps/plugins/contentPluginStripe.png deleted file mode 100644 index 6035ee121..000000000 Binary files a/toolkit/themes/mobile/mozapps/plugins/contentPluginStripe.png and /dev/null differ diff --git a/toolkit/themes/mobile/mozapps/plugins/pluginProblem.css b/toolkit/themes/mobile/mozapps/plugins/pluginProblem.css deleted file mode 100644 index e436b96cf..000000000 --- a/toolkit/themes/mobile/mozapps/plugins/pluginProblem.css +++ /dev/null @@ -1,196 +0,0 @@ -/* 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/. */ - -@namespace html url(http://www.w3.org/1999/xhtml); - -/* These styles affect only the bound element, not other page content. */ -/* Keep any changes to these styles in sync with plugin-doorhanger.inc.css */ -.mainBox { - font: message-box; - font-size: 12px; - text-align: center; - display: table; - width: 100%; - height: 100%; - background-color: rgb(72,72,72); - color: white; - -moz-user-select: none; -} - -.hoverBox { - display: table-cell; - box-sizing: border-box; - padding: 5px; - vertical-align: middle; - width: 100%; - height: 100%; -} -:-moz-handler-vulnerable-updatable .hoverBox:active, -:-moz-handler-vulnerable-no-update .hoverBox:active, -:-moz-handler-clicktoplay .hoverBox:active { - background-color: rgb(65, 65, 65); -} - -:-moz-handler-clicktoplay .hoverBox:active .msgTapToPlay, -:-moz-handler-clicktoplay .hoverBox:active .msgClickToPlay, -:-moz-handler-vulnerable-updatable .hoverBox:active .msgTapToPlay, -:-moz-handler-vulnerable-updatable .hoverBox:active .msgClickToPlay, -:-moz-handler-vulnerable-no-update .hoverBox:active .msgTapToPlay, -:-moz-handler-vulnerable-no-update .hoverBox:active .msgClickToPlay { - color: red; -} - -:-moz-handler-vulnerable-updatable .hoverBox, -:-moz-handler-vulnerable-no-update .hoverBox, -:-moz-handler-blocked .hoverBox, -:-moz-handler-crashed .hoverBox { - background-image: url(chrome://mozapps/skin/plugins/contentPluginStripe.png); -} - -html|a { - color: white; -} - -.icon { - width: 48px; - height: 48px; - background-position: center; - background-repeat: no-repeat; - border: none; - background-color: transparent; - -moz-user-focus: ignore; - margin-bottom: 6px; -} - -:-moz-handler-vulnerable-updatable .icon, -:-moz-handler-vulnerable-no-update .icon { - background-image: url(chrome://mozapps/skin/plugins/contentPluginBlocked.png); - -moz-user-focus: normal; -} -:-moz-handler-blocked .icon { - background-image: url(chrome://mozapps/skin/plugins/contentPluginBlocked.png); -} -:-moz-handler-clicktoplay .icon { - background-image: url(chrome://mozapps/skin/plugins/contentPluginActivate.png); - -moz-user-focus: normal; -} -:-moz-handler-crashed .icon { - background-image: url(chrome://mozapps/skin/plugins/contentPluginCrashed.png); -} - -.throbber { - padding-left: 16px; /* width of the background image */ - background: url(chrome://global/skin/icons/loading.png) no-repeat; - margin-left: 5px; -} - -.msgTapToPlay, -.msgClickToPlay { - text-decoration: underline; -} - -@media not all and (-moz-touch-enabled) { - :-moz-handler-clicktoplay .msgTapToPlay { - display: none; - } -} - -@media (-moz-touch-enabled) { - :-moz-handler-clicktoplay .msgClickToPlay { - display: none; - } -} - -.submitStatus div { - min-height: 19px; /* height of biggest line (with throbber) */ -} - -.submitComment { - width: 340px; - height: 70px; - padding: 5px; - border: none; - border-radius: 5px; - resize: none; - font-family: inherit; - font-size: inherit; -} - -.submitURLOptInBox { - text-align: start; -} - -.submitURLOptIn { - margin-left: -1px; -} - -.mainBox[chromedir="rtl"] .submitURLOptIn { - margin-left: 0; - margin-right: -1px; -} - -.submitButtonBox { - margin-top: 7px; -} - -.submitButton { - float: right; -} - -.mainBox[chromedir="rtl"] .submitButton { - float: left; -} - -.helpIcon { - display: inline-block; - min-width: 16px; - min-height: 16px; - background: url(chrome://mozapps/skin/plugins/pluginHelp-16.png) no-repeat; - cursor: pointer; - float: left; -} - -.mainBox[chromedir="rtl"] .helpIcon { - float: right; -} - -.closeIcon { - display: block; - width: 16px; - height: 16px; - margin-top: 4px; - margin-inline-start: -20px; - margin-inline-end: 4px; - border: none; - background-color: transparent; - background-image: url("chrome://mozapps/skin/plugins/contentPluginClose.png"); - background-repeat: no-repeat; -} - -.closeIcon:hover { - background-position: -16px 0; -} - -.closeIcon:hover:active { - background-position: -32px 0; -} - -.action-link { - display: inline-block; - border-radius: 10px; - background-color: rgb(35, 35, 35); - padding: 2px 8px; - margin-top: 7px; - text-decoration: none; -} -.action-link:active { - background-color: rgb(20, 20, 20); -} - -:-moz-handler-vulnerable-updatable .action-link { - background-color: #a81b0c; -} -:-moz-handler-vulnerable-updatable .action-link:active { - background-color: #801409; -} diff --git a/toolkit/themes/moz.build b/toolkit/themes/moz.build index 4031f36b8..d06395953 100644 --- a/toolkit/themes/moz.build +++ b/toolkit/themes/moz.build @@ -14,7 +14,6 @@ # GNOME/Linux linux (toolkit/themes/linux) # non-mac (toolkit/themes/shared/non-mac) # faststripe windows + faststripe (no native theme components) -# mobile native UIs that do not use XUL for UI toolkit = CONFIG['MOZ_WIDGET_TOOLKIT'] if CONFIG['MOZ_PHOENIX']: @@ -27,8 +26,6 @@ if toolkit == 'cocoa': DIRS += ['osx'] elif toolkit in ('gtk2', 'gtk3'): DIRS += ['linux'] -elif app == 'mobile/android': - DIRS += ['mobile'] else: DIRS += ['windows'] diff --git a/toolkit/themes/shared/mozapps.inc.mn b/toolkit/themes/shared/mozapps.inc.mn index 4a6b87cc8..db744c705 100644 --- a/toolkit/themes/shared/mozapps.inc.mn +++ b/toolkit/themes/shared/mozapps.inc.mn @@ -10,9 +10,7 @@ skin/classic/mozapps/formautofill/requestAutocomplete.css (../../shared/formautofill/requestAutocomplete.css) skin/classic/mozapps/plugins/pluginProblem.css (../../shared/plugins/pluginProblem.css) skin/classic/mozapps/aboutNetworking.css (../../shared/aboutNetworking.css) -#ifndef ANDROID skin/classic/mozapps/aboutProfiles.css (../../shared/aboutProfiles.css) -#endif skin/classic/mozapps/aboutServiceWorkers.css (../../shared/aboutServiceWorkers.css) skin/classic/mozapps/plugins/contentPluginActivate.png (../../shared/plugins/contentPluginActivate.png) skin/classic/mozapps/plugins/contentPluginBlocked.png (../../shared/plugins/contentPluginBlocked.png) diff --git a/toolkit/toolkit.mozbuild b/toolkit/toolkit.mozbuild index fcc3eb556..230fef418 100644 --- a/toolkit/toolkit.mozbuild +++ b/toolkit/toolkit.mozbuild @@ -85,12 +85,6 @@ DIRS += [ '/xpfe/appshell' ] -# This needs to be built after the gfx/ directory -# to ensure all dependencies for skia (e.g. mozalloc, xpcom) -# have been built -if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'android': - DIRS += ['/other-licenses/skia-npapi'] - if CONFIG['MOZ_UNIVERSALCHARDET']: DIRS += ['/extensions/universalchardet'] @@ -143,7 +137,7 @@ DIRS += [ if 'gtk' in CONFIG['MOZ_WIDGET_TOOLKIT']: DIRS += ['/toolkit/system/gnome'] -if CONFIG['ENABLE_MARIONETTE'] or CONFIG['MOZ_WIDGET_TOOLKIT'] not in ('android'): +if CONFIG['ENABLE_MARIONETTE']: DIRS += [ '/testing/firefox-ui', '/testing/marionette', diff --git a/toolkit/xre/moz.build b/toolkit/xre/moz.build index b00b419c8..4ad9926a8 100644 --- a/toolkit/xre/moz.build +++ b/toolkit/xre/moz.build @@ -46,11 +46,6 @@ if CONFIG['MOZ_X11']: EXPORTS += ['nsX11ErrorHandler.h'] UNIFIED_SOURCES += ['nsX11ErrorHandler.cpp'] -if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'android': - UNIFIED_SOURCES += [ - 'nsAndroidStartup.cpp', - ] - UNIFIED_SOURCES += [ 'CreateAppData.cpp', 'nsConsoleWriter.cpp', @@ -79,10 +74,10 @@ if CONFIG['MOZ_INSTRUMENT_EVENT_LOOP']: ] if CONFIG['MOZ_UPDATER']: - if CONFIG['MOZ_WIDGET_TOOLKIT'] != 'android': - UNIFIED_SOURCES += [ - 'nsUpdateDriver.cpp', - ] + DEFINES['MOZ_UPDATER'] = True + UNIFIED_SOURCES += [ + 'nsUpdateDriver.cpp', + ] include('/ipc/chromium/chromium-config.mozbuild') @@ -98,17 +93,11 @@ for var in ('MOZ_APP_NAME', 'MOZ_WIDGET_TOOLKIT'): DEFINES[var] = '"%s"' % CONFIG[var] -if CONFIG['MOZ_UPDATER'] and CONFIG['MOZ_WIDGET_TOOLKIT'] != 'android': - DEFINES['MOZ_UPDATER'] = True - if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows': DEFINES['WIN32_LEAN_AND_MEAN'] = True DEFINES['UNICODE'] = True DEFINES['_UNICODE'] = True -if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'android': - DEFINES['ANDROID_PACKAGE_NAME'] = '"%s"' % CONFIG['ANDROID_PACKAGE_NAME'] - if CONFIG['TARGET_XPCOM_ABI']: DEFINES['TARGET_OS_ABI'] = '"%s_%s"' % (CONFIG['OS_TARGET'], CONFIG['TARGET_XPCOM_ABI']) diff --git a/toolkit/xre/nsAndroidStartup.cpp b/toolkit/xre/nsAndroidStartup.cpp deleted file mode 100644 index 68ad75c01..000000000 --- a/toolkit/xre/nsAndroidStartup.cpp +++ /dev/null @@ -1,45 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - * 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/. */ - -#include - -#include - -#include -#include -#include - -#include "mozilla/jni/Utils.h" -#include "nsTArray.h" -#include "nsString.h" -#include "nsIFile.h" -#include "nsAppRunner.h" -#include "APKOpen.h" - -#define LOG(args...) __android_log_print(ANDROID_LOG_INFO, MOZ_APP_NAME, args) - -extern "C" NS_EXPORT void -GeckoStart(JNIEnv* env, char* data, const nsXREAppData* appData) -{ - mozilla::jni::SetGeckoThreadEnv(env); - - if (!data) { - LOG("Failed to get arguments for GeckoStart\n"); - return; - } - - nsTArray targs; - char *arg = strtok(data, " "); - while (arg) { - targs.AppendElement(arg); - arg = strtok(nullptr, " "); - } - targs.AppendElement(static_cast(nullptr)); - - int result = XRE_main(targs.Length() - 1, targs.Elements(), appData, 0); - - if (result) - LOG("XRE_main returned %d", result); -} diff --git a/toolkit/xre/nsAppRunner.cpp b/toolkit/xre/nsAppRunner.cpp index d8f95c2a8..e3705a5c2 100644 --- a/toolkit/xre/nsAppRunner.cpp +++ b/toolkit/xre/nsAppRunner.cpp @@ -23,7 +23,7 @@ #include "nsAppRunner.h" #include "mozilla/AppData.h" -#if defined(MOZ_UPDATER) && !defined(MOZ_WIDGET_ANDROID) +#ifdef MOZ_UPDATER #include "nsUpdateDriver.h" #endif #include "ProfileReset.h" @@ -186,10 +186,6 @@ #include "base/command_line.h" #include "GTestRunner.h" -#ifdef MOZ_WIDGET_ANDROID -#include "GeneratedJNIWrappers.h" -#endif - extern uint32_t gRestartMode; extern void InstallSignalHandlers(const char *ProgramName); @@ -1517,9 +1513,6 @@ static nsresult LaunchChild(nsINativeAppSupport* aNative, SaveToEnv("MOZ_LAUNCHED_CHILD=1"); -#if defined(MOZ_WIDGET_ANDROID) - java::GeckoAppShell::ScheduleRestart(); -#else #if defined(XP_MACOSX) CommandLineServiceMac::SetupMacCommandLine(gRestartArgc, gRestartArgv, true); LaunchChildMac(gRestartArgc, gRestartArgv); @@ -1559,7 +1552,6 @@ static nsresult LaunchChild(nsINativeAppSupport* aNative, #endif // XP_UNIX #endif // WP_WIN #endif // WP_MACOSX -#endif // MOZ_WIDGET_ANDROID return NS_ERROR_LAUNCHED_CHILD_PROCESS; } @@ -1653,10 +1645,7 @@ ProfileLockedDialog(nsIFile* aProfileDir, nsIFile* aProfileLocalDir, if (aUnlocker) { int32_t button; -#ifdef MOZ_WIDGET_ANDROID - java::GeckoAppShell::KillAnyZombies(); - button = 0; -#else + const uint32_t flags = (nsIPromptService::BUTTON_TITLE_IS_STRING * nsIPromptService::BUTTON_POS_0) + @@ -1668,7 +1657,6 @@ ProfileLockedDialog(nsIFile* aProfileDir, nsIFile* aProfileLocalDir, killTitle, nullptr, nullptr, nullptr, &checkState, &button); NS_ENSURE_SUCCESS_LOG(rv, rv); -#endif if (button == 0) { rv = aUnlocker->Unlock(nsIProfileUnlocker::FORCE_QUIT); @@ -1682,15 +1670,8 @@ ProfileLockedDialog(nsIFile* aProfileDir, nsIFile* aProfileLocalDir, return LaunchChild(aNative); } } else { -#ifdef MOZ_WIDGET_ANDROID - if (java::GeckoAppShell::UnlockProfile()) { - return NS_LockProfilePath(aProfileDir, aProfileLocalDir, - nullptr, aResult); - } -#else rv = ps->Alert(nullptr, killTitle, killMessage); NS_ENSURE_SUCCESS_LOG(rv, rv); -#endif } return NS_ERROR_ABORT; @@ -3409,7 +3390,7 @@ XREMain::XRE_mainStartup(bool* aExitFlag) } #endif -#if defined(MOZ_UPDATER) && !defined(MOZ_WIDGET_ANDROID) +#ifdef MOZ_UPDATER // Check for and process any available updates nsCOMPtr updRoot; bool persistent; diff --git a/toolkit/xre/nsEmbedFunctions.cpp b/toolkit/xre/nsEmbedFunctions.cpp index 52b443770..f0a8d9cab 100644 --- a/toolkit/xre/nsEmbedFunctions.cpp +++ b/toolkit/xre/nsEmbedFunctions.cpp @@ -246,17 +246,9 @@ XRE_InitChildProcess(int aArgc, NS_ENSURE_ARG_POINTER(aArgv[0]); MOZ_ASSERT(aChildData); -#if !defined(MOZ_WIDGET_ANDROID) // On non-Fennec Gecko, the GMPLoader code resides in plugin-container, // and we must forward it through to the GMP code here. GMPProcessChild::SetGMPLoader(aChildData->gmpLoader.get()); -#else - // On Fennec, the GMPLoader's code resides inside XUL (because for the time - // being GMPLoader relies upon NSPR, which we can't use in plugin-container - // on Android), so we create it here inside XUL and pass it to the GMP code. - UniquePtr loader = CreateGMPLoader(nullptr); - GMPProcessChild::SetGMPLoader(loader.get()); -#endif #if defined(XP_WIN) // From the --attach-console support in nsNativeAppSupportWin.cpp, but diff --git a/toolkit/xre/nsSigHandlers.cpp b/toolkit/xre/nsSigHandlers.cpp index 660af4522..11648e45a 100644 --- a/toolkit/xre/nsSigHandlers.cpp +++ b/toolkit/xre/nsSigHandlers.cpp @@ -27,9 +27,7 @@ #include #include // atoi #include -#ifndef ANDROID // no Android impl -# include -#endif +#include #endif #ifdef XP_SOLARIS @@ -172,7 +170,7 @@ static void fpehandler(int signum, siginfo_t *si, void *context) *mxcsr &= ~SSE_STATUS_FLAGS; /* clear all pending SSE exceptions */ #endif #endif -#if defined(LINUX) && !defined(ANDROID) +#if defined(LINUX) ucontext_t *uc = (ucontext_t *)context; #if defined(__i386__) diff --git a/toolkit/xre/nsUpdateDriver.cpp b/toolkit/xre/nsUpdateDriver.cpp index be11fb158..499445885 100644 --- a/toolkit/xre/nsUpdateDriver.cpp +++ b/toolkit/xre/nsUpdateDriver.cpp @@ -333,7 +333,7 @@ CopyUpdaterIntoUpdateDir(nsIFile *greDir, nsIFile *appDir, nsIFile *updateDir, return false; CopyFileIntoUpdateDir(appDir, NS_LITERAL_CSTRING(UPDATER_INI), updateDir); #endif -#if defined(XP_UNIX) && !defined(XP_MACOSX) && !defined(ANDROID) +#if defined(XP_UNIX) && !defined(XP_MACOSX) nsCOMPtr iconDir; appDir->Clone(getter_AddRefs(iconDir)); iconDir->AppendNative(NS_LITERAL_CSTRING("icons")); diff --git a/toolkit/xre/nsXREDirProvider.cpp b/toolkit/xre/nsXREDirProvider.cpp index 265652477..151eb34e5 100644 --- a/toolkit/xre/nsXREDirProvider.cpp +++ b/toolkit/xre/nsXREDirProvider.cpp @@ -1340,10 +1340,6 @@ nsXREDirProvider::GetUserDataDirectoryHome(nsIFile** aFile, bool aLocal) if (!homeDir || !*homeDir) return NS_ERROR_FAILURE; -#ifdef ANDROID /* We want (ProfD == ProfLD) on Android. */ - aLocal = false; -#endif - if (aLocal) { // If $XDG_CACHE_HOME is defined use it, otherwise use $HOME/.cache. const char* cacheHome = getenv("XDG_CACHE_HOME"); @@ -1550,15 +1546,6 @@ nsXREDirProvider::AppendProfilePath(nsIFile* aFile, } NS_ENSURE_SUCCESS(rv, rv); -#elif defined(ANDROID) - // The directory used for storing profiles - // The parent of this directory is set in GetUserDataDirectoryHome - // XXX: handle gAppData->profile properly - // XXXsmaug ...and the rest of the profile creation! - MOZ_ASSERT(!aAppName, - "Profile creation for external applications is not implemented!"); - rv = aFile->AppendNative(nsDependentCString("mozilla")); - NS_ENSURE_SUCCESS(rv, rv); #elif defined(XP_UNIX) nsAutoCString folder; // Make it hidden (by starting with "."), except when local (the -- cgit v1.2.3