Bug 1452120 - remove use of __LOCATION__ so Lightning can be a packed add-on. r=MakeMyDay a=philipp
authorPhilipp Kewisch <mozilla@kewis.ch>
Sat, 28 Apr 2018 11:56:00 +0200
changeset 31440 7d57bd47deff7b7e96b9a8417bea2e5cba931d6c
parent 31439 aa4d68e63413f951bd0b3f70752edee2c3aed612
child 31441 b2d63636dca84397d55784504b141e450b6c8e2a
push id383
push userclokep@gmail.com
push dateMon, 07 May 2018 21:52:48 +0000
reviewersMakeMyDay, philipp
bugs1452120
Bug 1452120 - remove use of __LOCATION__ so Lightning can be a packed add-on. r=MakeMyDay a=philipp
calendar/base/modules/calUtils.jsm
--- a/calendar/base/modules/calUtils.jsm
+++ b/calendar/base/modules/calUtils.jsm
@@ -164,38 +164,30 @@ var cal = {
      * @param {nsIIDRef} aIID       The IID to query for
      * @param {nsIIDRef[]}          The interfaces that this object implements
      * @return {nsQIResult}         The object queried for aIID
      */
     generateClassQI: function(aGlobal, aIID, aInterfaces) {
         Object.defineProperty(aGlobal, "QueryInterface", { value: XPCOMUtils.generateQI(aInterfaces) });
         return aGlobal.QueryInterface(aIID);
     },
-
     /**
      * Loads an array of calendar scripts into the passed scope.
      *
      * @param scriptNames an array of calendar script names
      * @param scope       scope to load into
-     * @param baseDir     base dir; defaults to calendar-js/
      */
-    loadScripts: function(scriptNames, scope, baseDir) {
-        if (!baseDir) {
-            baseDir = __LOCATION__.parent.parent.clone();
-            baseDir.append("calendar-js");
-        }
-
+    loadScripts: function(scriptNames, scope) {
+        let baseUri = "resource://calendar/calendar-js/";
         for (let script of scriptNames) {
             if (!script) {
                 // If the array element is null, then just skip this script.
                 continue;
             }
-            let scriptFile = baseDir.clone();
-            scriptFile.append(script);
-            let scriptUrlSpec = Services.io.newFileURI(scriptFile).spec;
+            let scriptUrlSpec = baseUri + script;
             try {
                 Services.scriptloader.loadSubScript(scriptUrlSpec, scope);
             } catch (exc) {
                 Components.utils.reportError(exc + " (" + scriptUrlSpec + ")");
             }
         }
     },