summaryrefslogtreecommitdiffstats
path: root/toolkit/components
diff options
context:
space:
mode:
authorMatt A. Tobin <email@mattatobin.com>2020-02-25 19:45:39 -0500
committerMatt A. Tobin <email@mattatobin.com>2020-02-25 19:45:39 -0500
commit35c26c6c19e66fabcb230fb074e76e243df04d2b (patch)
tree9cbdb0397c76a7477cd60c53347ab33d426f2019 /toolkit/components
parent8f35c37a9e82ea3e99780c1a001641227a00b6a9 (diff)
downloadUXP-35c26c6c19e66fabcb230fb074e76e243df04d2b.tar
UXP-35c26c6c19e66fabcb230fb074e76e243df04d2b.tar.gz
UXP-35c26c6c19e66fabcb230fb074e76e243df04d2b.tar.lz
UXP-35c26c6c19e66fabcb230fb074e76e243df04d2b.tar.xz
UXP-35c26c6c19e66fabcb230fb074e76e243df04d2b.zip
Issue #1053 - Remove android support from toolkit
Note: Does not remove support completely from toolkit/mozapps/installer or from telemetry or AppConstants.jsm
Diffstat (limited to 'toolkit/components')
-rw-r--r--toolkit/components/aboutmemory/content/aboutMemory.css6
-rw-r--r--toolkit/components/alerts/nsAlertsService.cpp8
-rw-r--r--toolkit/components/alerts/nsXULAlerts.cpp3
-rw-r--r--toolkit/components/blocklist/nsBlocklistService.js3
-rw-r--r--toolkit/components/build/nsToolkitCompsCID.h4
-rw-r--r--toolkit/components/build/nsToolkitCompsModule.cpp15
-rw-r--r--toolkit/components/downloads/nsDownloadManager.cpp45
-rw-r--r--toolkit/components/jsdownloads/src/DownloadIntegration.jsm28
-rw-r--r--toolkit/components/jsdownloads/src/DownloadPlatform.cpp16
-rw-r--r--toolkit/components/moz.build19
-rw-r--r--toolkit/components/osfile/modules/osfile_async_front.jsm33
-rw-r--r--toolkit/components/osfile/modules/osfile_unix_back.jsm8
-rw-r--r--toolkit/components/osfile/modules/osfile_unix_front.jsm21
-rw-r--r--toolkit/components/parentalcontrols/moz.build20
-rw-r--r--toolkit/components/parentalcontrols/nsParentalControlsServiceAndroid.cpp103
-rw-r--r--toolkit/components/passwordmgr/moz.build20
-rw-r--r--toolkit/components/passwordmgr/nsLoginManager.js4
-rw-r--r--toolkit/components/passwordmgr/nsLoginManagerPrompter.js3
-rw-r--r--toolkit/components/passwordmgr/passwordmgr.manifest5
-rw-r--r--toolkit/components/passwordmgr/storage-mozStorage.js1262
-rw-r--r--toolkit/components/satchel/FormHistory.jsm4
-rw-r--r--toolkit/components/satchel/nsFormFillController.cpp2
-rw-r--r--toolkit/components/satchel/nsFormHistory.js20
-rw-r--r--toolkit/components/search/nsSearchService.js33
-rw-r--r--toolkit/components/url-classifier/nsUrlClassifierUtils.cpp4
25 files changed, 61 insertions, 1628 deletions
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<nsIAlertsDoNotDisturb> 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<nsIAlertsDoNotDisturb> alertsDND(GetDNDBackend());
NS_ENSURE_TRUE(alertsDND, NS_ERROR_NOT_IMPLEMENTED);
nsresult rv = alertsDND->SetManualDoNotDisturb(aDoNotDisturb);
return rv;
-#endif
}
already_AddRefed<nsIAlertsDoNotDisturb>
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>
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<nsXULAlerts> 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 <CoreFoundation/CoreFoundation.h>
#endif
-#ifdef MOZ_WIDGET_ANDROID
-#include "FennecJNIWrappers.h"
-#endif
-
#ifdef MOZ_WIDGET_GTK
#include <gtk/gtk.h>
#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<nsIFileURL> fileURL = do_QueryInterface(mTarget);
nsCOMPtr<nsIFile> 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<nsIMIMEInfo> 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 <gtk/gtk.h>
#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<nsIFormControl> 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;