Wed, 31 Dec 2014 13:27:57 +0100
Ignore runtime configuration files generated during quality assurance.
michael@0 | 1 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 2 | * License, v. 2.0. If a copy of the MPL was not distributed with this file, |
michael@0 | 3 | * You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 4 | |
michael@0 | 5 | const Cc = Components.classes; |
michael@0 | 6 | const Ci = Components.interfaces; |
michael@0 | 7 | const Cu = Components.utils; |
michael@0 | 8 | |
michael@0 | 9 | const WEBAPP_REGISTRY_DIR = "WebappRegD"; |
michael@0 | 10 | const NS_APP_CHROME_DIR_LIST = "AChromDL"; |
michael@0 | 11 | |
michael@0 | 12 | Cu.import("resource://gre/modules/FileUtils.jsm"); |
michael@0 | 13 | Cu.import("resource://gre/modules/XPCOMUtils.jsm"); |
michael@0 | 14 | Cu.import("resource://webapprt/modules/WebappRT.jsm"); |
michael@0 | 15 | Cu.import("resource://gre/modules/Services.jsm"); |
michael@0 | 16 | |
michael@0 | 17 | function DirectoryProvider() {} |
michael@0 | 18 | |
michael@0 | 19 | DirectoryProvider.prototype = { |
michael@0 | 20 | classID: Components.ID("{e1799fda-4b2f-4457-b671-e0641d95698d}"), |
michael@0 | 21 | |
michael@0 | 22 | QueryInterface: XPCOMUtils.generateQI([Ci.nsIDirectoryServiceProvider, |
michael@0 | 23 | Ci.nsIDirectoryServiceProvider2]), |
michael@0 | 24 | |
michael@0 | 25 | getFile: function(prop, persistent) { |
michael@0 | 26 | if (prop == WEBAPP_REGISTRY_DIR) { |
michael@0 | 27 | let dir = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsILocalFile); |
michael@0 | 28 | dir.initWithPath(WebappRT.config.registryDir); |
michael@0 | 29 | return dir; |
michael@0 | 30 | } |
michael@0 | 31 | |
michael@0 | 32 | // We return null to show failure instead of throwing an error, |
michael@0 | 33 | // which works with the way the interface is called (per bug 529077). |
michael@0 | 34 | return null; |
michael@0 | 35 | }, |
michael@0 | 36 | |
michael@0 | 37 | getFiles: function(prop, persistent) { |
michael@0 | 38 | if (prop == NS_APP_CHROME_DIR_LIST) { |
michael@0 | 39 | return { |
michael@0 | 40 | _done: false, |
michael@0 | 41 | QueryInterface: XPCOMUtils.generateQI([Ci.nsISimpleEnumerator]), |
michael@0 | 42 | hasMoreElements: function() { |
michael@0 | 43 | return !this._done; |
michael@0 | 44 | }, |
michael@0 | 45 | getNext: function() { |
michael@0 | 46 | this._done = true; |
michael@0 | 47 | return FileUtils.getDir("AppRegD", ["chrome"], false); |
michael@0 | 48 | } |
michael@0 | 49 | }; |
michael@0 | 50 | } |
michael@0 | 51 | |
michael@0 | 52 | return null; |
michael@0 | 53 | }, |
michael@0 | 54 | }; |
michael@0 | 55 | |
michael@0 | 56 | this.NSGetFactory = XPCOMUtils.generateNSGetFactory([DirectoryProvider]); |