Fix bug 406569 - GData loader fails for lightning. r=dbo
git-svn-id: svn://10.0.0.236/trunk@240309 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -87,19 +87,38 @@ var calGoogleCalendarModule = {
|
||||
if (this.mUtilsLoaded)
|
||||
return;
|
||||
|
||||
const kSUNBIRD_UID = "{718e30fb-e89b-41dd-9da7-e25a45638b28}";
|
||||
const kLIGHTNING_UID = "{e2fda1a4-762b-4020-b5ad-a41df1933103}";
|
||||
const scripts = ["calGoogleCalendar.js", "calGoogleSession.js",
|
||||
"calGoogleRequest.js", "calGoogleUtils.js"];
|
||||
const baseScripts = ["calUtils.js", "calProviderBase.js"];
|
||||
|
||||
// First, load script from the application dir
|
||||
var dirsvc = Components.classes["@mozilla.org/file/directory_service;1"]
|
||||
.getService(Components.interfaces.nsIProperties);
|
||||
try {
|
||||
var appdir = dirsvc.get("GreD", Components.interfaces.nsIFile);
|
||||
appdir.append("js");
|
||||
} catch (e) {
|
||||
Components.utils.reportError("Error getting GRE Application Directory");
|
||||
throw(e);
|
||||
var appInfo = Components.classes["@mozilla.org/xre/app-info;1"].
|
||||
getService(Components.interfaces.nsIXULAppInfo);
|
||||
if (appInfo.id == kSUNBIRD_UID) {
|
||||
// On sunbird, the application dir is the GRE Application Directory
|
||||
var dirsvc = Components.classes["@mozilla.org/file/directory_service;1"]
|
||||
.getService(Components.interfaces.nsIProperties);
|
||||
try {
|
||||
var appdir = dirsvc.get("GreD", Components.interfaces.nsIFile);
|
||||
appdir.append("js");
|
||||
} catch (e) {
|
||||
Components.utils.reportError("Error getting GRE Application Directory");
|
||||
throw(e);
|
||||
}
|
||||
} else {
|
||||
// Otherwise, the application directory is the lightning extension directory
|
||||
var extman = Components.classes["@mozilla.org/extensions/manager;1"]
|
||||
.getService(Components.interfaces.nsIExtensionManager);
|
||||
try {
|
||||
var appdir = extman.getInstallLocation(kLIGHTNING_UID)
|
||||
.getItemLocation(kLIGHTNING_UID);
|
||||
appdir.append("js");
|
||||
} catch (e) {
|
||||
Components.utils.reportError("Error getting Lightning Extension Directory");
|
||||
throw(e);
|
||||
}
|
||||
}
|
||||
|
||||
for each (var script in baseScripts) {
|
||||
|
||||
Reference in New Issue
Block a user