From 768843bdb4dc11600b2a219b3b01a0a813f39235 Mon Sep 17 00:00:00 2001 From: Wes Johnston Date: Wed, 15 Aug 2012 17:02:15 -0400 Subject: [PATCH] Bug 650399 - All webapps should use the same webapp database. r=mfinkle --- dom/apps/src/Webapps.jsm | 2 ++ mobile/android/components/DirectoryProvider.js | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/dom/apps/src/Webapps.jsm b/dom/apps/src/Webapps.jsm index 219b6f58105a..1a26844c8c22 100644 --- a/dom/apps/src/Webapps.jsm +++ b/dom/apps/src/Webapps.jsm @@ -39,6 +39,8 @@ XPCOMUtils.defineLazyGetter(this, "msgmgr", function() { #ifdef MOZ_WIDGET_GONK const DIRECTORY_NAME = "webappsDir"; +#elifdef ANDROID + const DIRECTORY_NAME = "webappsDir"; #else // If we're executing in the context of the webapp runtime, the data files // are in a different directory (currently the Firefox profile that installed diff --git a/mobile/android/components/DirectoryProvider.js b/mobile/android/components/DirectoryProvider.js index f3fc1284178b..01430f148b2a 100644 --- a/mobile/android/components/DirectoryProvider.js +++ b/mobile/android/components/DirectoryProvider.js @@ -14,6 +14,7 @@ Components.utils.import("resource://gre/modules/XPCOMUtils.jsm"); const NS_APP_CACHE_PARENT_DIR = "cachePDir"; const XRE_UPDATE_ROOT_DIR = "UpdRootD"; const ENVVAR_UPDATE_DIR = "UPDATES_DIRECTORY"; +const WEBAPPS_DIR = "webappsDir"; function DirectoryProvider() {} @@ -27,6 +28,13 @@ DirectoryProvider.prototype = { let dirsvc = Cc["@mozilla.org/file/directory_service;1"].getService(Ci.nsIProperties); let profile = dirsvc.get("ProfD", Ci.nsIFile); return profile; + } else if (prop == WEBAPPS_DIR) { + // returns the folder that should hold the webapps database file + // For fennec we will store that in the root profile folder so that all + // webapps can easily access it + let dirsvc = Cc["@mozilla.org/file/directory_service;1"].getService(Ci.nsIProperties); + let profile = dirsvc.get("ProfD", Ci.nsIFile); + return profile.parent; } else if (prop == XRE_UPDATE_ROOT_DIR) { let env = Cc["@mozilla.org/process/environment;1"].getService(Ci.nsIEnvironment); if (env.exists(ENVVAR_UPDATE_DIR)) {