summaryrefslogtreecommitdiffstats
path: root/toolkit
diff options
context:
space:
mode:
authorMatt A. Tobin <email@mattatobin.com>2020-02-06 09:11:39 -0500
committerwolfbeast <mcwerewolf@wolfbeast.com>2020-04-14 12:38:14 +0200
commit113a825c1f87263ef7e322c31084d00821edbef3 (patch)
treed5630ed2f85a339682d3d8dc7ea0b483d0e0491d /toolkit
parent419abfb09f4ab5aac0f4e315c0dd20716e6fe29b (diff)
downloadUXP-113a825c1f87263ef7e322c31084d00821edbef3.tar
UXP-113a825c1f87263ef7e322c31084d00821edbef3.tar.gz
UXP-113a825c1f87263ef7e322c31084d00821edbef3.tar.lz
UXP-113a825c1f87263ef7e322c31084d00821edbef3.tar.xz
UXP-113a825c1f87263ef7e322c31084d00821edbef3.zip
Issue #65 - Remove AppConstants from toolkit/components/satchel
Diffstat (limited to 'toolkit')
-rw-r--r--toolkit/components/satchel/FormHistory.jsm7
-rw-r--r--toolkit/components/satchel/moz.build6
-rw-r--r--toolkit/components/satchel/nsFormHistory.js42
3 files changed, 29 insertions, 26 deletions
diff --git a/toolkit/components/satchel/FormHistory.jsm b/toolkit/components/satchel/FormHistory.jsm
index 3d4a9fc43..ca9a28f1f 100644
--- a/toolkit/components/satchel/FormHistory.jsm
+++ b/toolkit/components/satchel/FormHistory.jsm
@@ -91,7 +91,6 @@ const Cr = Components.results;
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
Components.utils.import("resource://gre/modules/Services.jsm");
-Components.utils.import("resource://gre/modules/AppConstants.jsm");
XPCOMUtils.defineLazyServiceGetter(this, "uuidService",
"@mozilla.org/uuid-generator;1",
@@ -102,7 +101,11 @@ const DAY_IN_MS = 86400000; // 1 day in milliseconds
const MAX_SEARCH_TOKENS = 10;
const NOOP = function noop() {};
-var supportsDeletedTable = AppConstants.platform == "android";
+#ifdef MOZ_WIDGET_ANDROID
+var supportsDeletedTable = true;
+#else
+var supportsDeletedTable = false;
+#endif
var Prefs = {
initialized: false,
diff --git a/toolkit/components/satchel/moz.build b/toolkit/components/satchel/moz.build
index 239f412bc..883ee9f23 100644
--- a/toolkit/components/satchel/moz.build
+++ b/toolkit/components/satchel/moz.build
@@ -28,17 +28,19 @@ LOCAL_INCLUDES += [
EXTRA_COMPONENTS += [
'FormHistoryStartup.js',
'nsFormAutoComplete.js',
- 'nsFormHistory.js',
'nsInputListAutoComplete.js',
'satchel.manifest',
]
+EXTRA_PP_COMPONENTS += ['nsFormHistory.js']
+
EXTRA_JS_MODULES += [
'AutoCompletePopup.jsm',
- 'FormHistory.jsm',
'nsFormAutoCompleteResult.jsm',
]
+EXTRA_PP_JS_MODULES += ['FormHistory.jsm']
+
FINAL_LIBRARY = 'xul'
JAR_MANIFESTS += ['jar.mn']
diff --git a/toolkit/components/satchel/nsFormHistory.js b/toolkit/components/satchel/nsFormHistory.js
index d68be2d58..9d67f0729 100644
--- a/toolkit/components/satchel/nsFormHistory.js
+++ b/toolkit/components/satchel/nsFormHistory.js
@@ -12,8 +12,6 @@ Components.utils.import("resource://gre/modules/Services.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Deprecated",
"resource://gre/modules/Deprecated.jsm");
-XPCOMUtils.defineLazyModuleGetter(this, "AppConstants",
- "resource://gre/modules/AppConstants.jsm");
const DB_VERSION = 4;
const DAY_IN_MS = 86400000; // 1 day in milliseconds
@@ -351,26 +349,26 @@ FormHistory.prototype = {
},
moveToDeletedTable : function moveToDeletedTable(values, params) {
- if (AppConstants.platform == "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();
- }
- }
- }
+#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() {