Fix bug 459107 - Sunbird startup error (NS_ERROR_FILE_NOT_FOUND - nsIXPCComponents_Utils.import). r=philipp
authorDaniel Boelzle [:dbo] <daniel.boelzle@sun.com>
Thu, 09 Oct 2008 17:45:20 +0200
changeset 564 38cb09a53f4c88f9a0347dfb9b3a866f344f5bae
parent 563 42022c4cfd55068a8969646783ebe6a2605ca074
child 565 5d73f2badfb29abb01eccdfd1dcd192884d86fb9
push idunknown
push userunknown
push dateunknown
reviewersphilipp
bugs459107
Fix bug 459107 - Sunbird startup error (NS_ERROR_FILE_NOT_FOUND - nsIXPCComponents_Utils.import). r=philipp
calendar/base/src/calItemModule.js
calendar/lightning/jar.mn
calendar/sunbird/base/jar.mn
--- a/calendar/base/src/calItemModule.js
+++ b/calendar/base/src/calItemModule.js
@@ -237,17 +237,30 @@ var calItemModule = {
         const iosvcIID = Components.interfaces.nsIIOService;
 
         var loader = Components.classes[jssslContractID].getService(jssslIID);
         var dirsvc = Components.classes[dirsvcContractID].getService(propsIID);
         var iosvc = Components.classes[iosvcContractID].getService(iosvcIID);
 
         // Note that unintuitively, __LOCATION__.parent == .
         // We expect to find the subscripts in ./../js
-        var appdir = __LOCATION__.parent.parent;
+        let appdir = __LOCATION__.parent.parent.clone();
+
+        // Register our alias here: this code always needs to run first (triggered by app-startup)
+        let modulesDir = appdir.clone();
+        modulesDir.append("modules");
+        modulesDir = iosvc.newFileURI(modulesDir);
+        // bug 459196:
+        // we need to cut/hack around the trailing slash, otherwise our modules won't be found
+        // when loaded like "resource://calendar/modules/calUtils.jsm"
+        modulesDir.spec = modulesDir.spec.replace(/\/$/, "");
+        iosvc.getProtocolHandler("resource")
+             .QueryInterface(Components.interfaces.nsIResProtocolHandler)
+             .setSubstitution("calendar", modulesDir);
+
         appdir.append("js");
 
         for (var i = 0; i < componentData.length; i++) {
             var scriptName = componentData[i].script;
             if (!scriptName)
                 continue;
 
             var f = appdir.clone();
--- a/calendar/lightning/jar.mn
+++ b/calendar/lightning/jar.mn
@@ -1,10 +1,9 @@
 lightning.jar:
-% resource calendar .
 % content lightning %content/lightning/
 % content messagebody %content/messagebody/ contentaccessible=yes
 % override chrome://messagebody/skin/imip.css chrome://lightning/skin/imip.css
 % overlay chrome://messenger/content/messenger.xul chrome://lightning/content/lightning-migration.xul
 % overlay chrome://messenger/content/msgAccountCentral.xul chrome://lightning/content/messenger-overlay-accountCentral.xul
 % overlay chrome://messenger/content/messenger.xul chrome://lightning/content/messenger-overlay-sidebar.xul
 % overlay chrome://messenger/content/messageWindow.xul chrome://lightning/content/imip-bar-overlay.xul
 % overlay chrome://messenger/content/messageWindow.xul chrome://lightning/content/messenger-overlay-messageWindow.xul
--- a/calendar/sunbird/base/jar.mn
+++ b/calendar/sunbird/base/jar.mn
@@ -1,10 +1,9 @@
 calendar.jar:
-% resource calendar .
 % content calendar %content/calendar/
 *  content/calendar/aboutDialog.css              (content/aboutDialog.css)
 *  content/calendar/aboutDialog.js               (content/aboutDialog.js)
 *  content/calendar/aboutDialog.xul              (content/aboutDialog.xul)
 *  content/calendar/calendar.xul                 (content/calendar.xul)
    content/calendar/calendar-gotodate-dialog.xul (content/calendar-gotodate-dialog.xul)
    content/calendar/calendar-offline.js          (content/calendar-offline.js)
 *  content/calendar/credits.xhtml                (content/credits.xhtml)