summaryrefslogtreecommitdiff
path: root/toolkit
diff options
context:
space:
mode:
authorMatt A. Tobin <email@mattatobin.com>2020-02-06 10:39:22 -0500
committerMatt A. Tobin <email@mattatobin.com>2020-02-06 10:39:22 -0500
commitcf4ad4e969bf553c4e7bcf79e8f3a98783584070 (patch)
tree8575660d9967c4390fd4317ecf0882c0d96c3745 /toolkit
parent741abd440e4f4c4d91799f06c826e0f879c5c837 (diff)
downloaduxp-cf4ad4e969bf553c4e7bcf79e8f3a98783584070.tar.gz
Issue #65 - Remove AppConstants from toolkit/components/passwordmgr
Diffstat (limited to 'toolkit')
-rw-r--r--toolkit/components/passwordmgr/OSCrypto.jsm11
-rw-r--r--toolkit/components/passwordmgr/content/passwordManager.js9
-rw-r--r--toolkit/components/passwordmgr/moz.build5
-rw-r--r--toolkit/components/passwordmgr/nsLoginManager.js13
4 files changed, 20 insertions, 18 deletions
diff --git a/toolkit/components/passwordmgr/OSCrypto.jsm b/toolkit/components/passwordmgr/OSCrypto.jsm
index 04254f66f5..3d2b27c4e8 100644
--- a/toolkit/components/passwordmgr/OSCrypto.jsm
+++ b/toolkit/components/passwordmgr/OSCrypto.jsm
@@ -8,15 +8,14 @@
"use strict";
-Components.utils.import("resource://gre/modules/AppConstants.jsm");
Components.utils.import("resource://gre/modules/Services.jsm");
this.EXPORTED_SYMBOLS = ["OSCrypto"];
var OSCrypto = {};
-if (AppConstants.platform == "win") {
- Services.scriptloader.loadSubScript("resource://gre/modules/OSCrypto_win.js", this);
-} else {
- throw new Error("OSCrypto.jsm isn't supported on this platform");
-}
+#ifdef XP_WIN
+Services.scriptloader.loadSubScript("resource://gre/modules/OSCrypto_win.js", this);
+#else
+throw new Error("OSCrypto.jsm isn't supported on this platform");
+#endif
diff --git a/toolkit/components/passwordmgr/content/passwordManager.js b/toolkit/components/passwordmgr/content/passwordManager.js
index 327ebbdf84..662f212790 100644
--- a/toolkit/components/passwordmgr/content/passwordManager.js
+++ b/toolkit/components/passwordmgr/content/passwordManager.js
@@ -5,7 +5,6 @@
/** * =================== SAVED SIGNONS CODE =================== ***/
const { classes: Cc, interfaces: Ci, results: Cr, utils: Cu } = Components;
-Cu.import("resource://gre/modules/AppConstants.jsm");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");
@@ -486,9 +485,13 @@ function HandleSignonKeyPress(e) {
if (signonsTree.getAttribute("editing")) {
return;
}
+
+#ifdef XP_MACOSX
if (e.keyCode == KeyboardEvent.DOM_VK_DELETE ||
- (AppConstants.platform == "macosx" &&
- e.keyCode == KeyboardEvent.DOM_VK_BACK_SPACE)) {
+ e.keyCode == KeyboardEvent.DOM_VK_BACK_SPACE) {
+#else
+ if (e.keyCode == KeyboardEvent.DOM_VK_DELETE) {
+#endif
DeleteSignon();
}
}
diff --git a/toolkit/components/passwordmgr/moz.build b/toolkit/components/passwordmgr/moz.build
index e54e6ba2d3..af9a4ab03a 100644
--- a/toolkit/components/passwordmgr/moz.build
+++ b/toolkit/components/passwordmgr/moz.build
@@ -32,11 +32,11 @@ XPIDL_MODULE = 'loginmgr'
EXTRA_COMPONENTS += [
'crypto-SDR.js',
'nsLoginInfo.js',
- 'nsLoginManager.js',
'nsLoginManagerPrompter.js',
]
EXTRA_PP_COMPONENTS += [
+ 'nsLoginManager.js',
'passwordmgr.manifest',
]
@@ -46,9 +46,10 @@ EXTRA_JS_MODULES += [
'LoginManagerContent.jsm',
'LoginManagerParent.jsm',
'LoginRecipes.jsm',
- 'OSCrypto.jsm',
]
+EXTRA_PP_JS_MODULES += ['OSCrypto.jsm']
+
if CONFIG['OS_TARGET'] == 'Android':
EXTRA_COMPONENTS += [
'storage-mozStorage.js',
diff --git a/toolkit/components/passwordmgr/nsLoginManager.js b/toolkit/components/passwordmgr/nsLoginManager.js
index 514351fa52..87466fe5c1 100644
--- a/toolkit/components/passwordmgr/nsLoginManager.js
+++ b/toolkit/components/passwordmgr/nsLoginManager.js
@@ -8,7 +8,6 @@ const { classes: Cc, interfaces: Ci, results: Cr, utils: Cu } = Components;
const PERMISSION_SAVE_LOGINS = "login-saving";
-Cu.import("resource://gre/modules/AppConstants.jsm");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/Timer.jsm");
@@ -113,12 +112,12 @@ LoginManager.prototype = {
_initStorage() {
- let contractID;
- if (AppConstants.platform == "android") {
- contractID = "@mozilla.org/login-manager/storage/mozStorage;1";
- } else {
- contractID = "@mozilla.org/login-manager/storage/json;1";
- }
+#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"].
getService(Ci.nsICategoryManager);