Issue #65 - Remove AppConstants from toolkit/components/satchel

This commit is contained in:
Matt A. Tobin 2020-02-06 09:11:39 -05:00 • committed by Roy Tam
commit d28907df2a
3 changed files with 29 additions and 26 deletions

View file

@ -91,7 +91,6 @@ const Cr = Components.results;
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm"); Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
Components.utils.import("resource://gre/modules/Services.jsm"); Components.utils.import("resource://gre/modules/Services.jsm");
Components.utils.import("resource://gre/modules/AppConstants.jsm");
XPCOMUtils.defineLazyServiceGetter(this, "uuidService", XPCOMUtils.defineLazyServiceGetter(this, "uuidService",
"@mozilla.org/uuid-generator;1", "@mozilla.org/uuid-generator;1",
@ -102,7 +101,11 @@ const DAY_IN_MS = 86400000; // 1 day in milliseconds
const MAX_SEARCH_TOKENS = 10; const MAX_SEARCH_TOKENS = 10;
const NOOP = function noop() {}; const NOOP = function noop() {};
var supportsDeletedTable = AppConstants.platform == "android"; #ifdef MOZ_WIDGET_ANDROID
var supportsDeletedTable = true;
#else
var supportsDeletedTable = false;
#endif
var Prefs = { var Prefs = {
initialized: false, initialized: false,

View file

@ -28,17 +28,19 @@ LOCAL_INCLUDES += [
EXTRA_COMPONENTS += [ EXTRA_COMPONENTS += [
'FormHistoryStartup.js', 'FormHistoryStartup.js',
'nsFormAutoComplete.js', 'nsFormAutoComplete.js',
'nsFormHistory.js',
'nsInputListAutoComplete.js', 'nsInputListAutoComplete.js',
'satchel.manifest', 'satchel.manifest',
] ]
EXTRA_PP_COMPONENTS += ['nsFormHistory.js']
EXTRA_JS_MODULES += [ EXTRA_JS_MODULES += [
'AutoCompletePopup.jsm', 'AutoCompletePopup.jsm',
'FormHistory.jsm',
'nsFormAutoCompleteResult.jsm', 'nsFormAutoCompleteResult.jsm',
] ]
EXTRA_PP_JS_MODULES += ['FormHistory.jsm']
FINAL_LIBRARY = 'xul' FINAL_LIBRARY = 'xul'
JAR_MANIFESTS += ['jar.mn'] JAR_MANIFESTS += ['jar.mn']

View file

@ -12,8 +12,6 @@ Components.utils.import("resource://gre/modules/Services.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Deprecated", XPCOMUtils.defineLazyModuleGetter(this, "Deprecated",
"resource://gre/modules/Deprecated.jsm"); "resource://gre/modules/Deprecated.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "AppConstants",
"resource://gre/modules/AppConstants.jsm");
const DB_VERSION = 4; const DB_VERSION = 4;
const DAY_IN_MS = 86400000; // 1 day in milliseconds const DAY_IN_MS = 86400000; // 1 day in milliseconds
@ -351,26 +349,26 @@ FormHistory.prototype = {
}, },
moveToDeletedTable : function moveToDeletedTable(values, params) { moveToDeletedTable : function moveToDeletedTable(values, params) {
if (AppConstants.platform == "android") { #ifdef MOZ_WIDGET_ANDROID
this.log("Moving entries to deleted table."); this.log("Moving entries to deleted table.");
let stmt; let stmt;
try { try {
// Move the entries to the deleted items table. // Move the entries to the deleted items table.
let query = "INSERT INTO moz_deleted_formhistory (guid, timeDeleted) "; let query = "INSERT INTO moz_deleted_formhistory (guid, timeDeleted) ";
if (values) query += values; if (values) query += values;
stmt = this.dbCreateStatement(query, params); stmt = this.dbCreateStatement(query, params);
stmt.execute(); stmt.execute();
} catch (e) { } catch (e) {
this.log("Moving deleted entries failed: " + e); this.log("Moving deleted entries failed: " + e);
throw e; throw e;
} finally { } finally {
if (stmt) { if (stmt) {
stmt.reset(); stmt.reset();
} }
} }
} #endif
}, },
get dbConnection() { get dbConnection() {