1 const XULAPPINFO_CONTRACTID
= "@mozilla.org/xre/app-info;1";
2 const XULAPPINFO_CID
= Components
.ID("{48a4e946-1f9f-4224-b4b0-9a54183cb81e}");
4 const NS_CHROME_MANIFESTS_FILE_LIST
= "ChromeML";
6 const Cc
= Components
.classes
;
7 const Ci
= Components
.interfaces
;
8 const Cr
= Components
.results
;
10 function ArrayEnumerator(array
)
15 ArrayEnumerator
.prototype = {
18 hasMoreElements: function() {
19 return this.pos
< this.array
.length
;
23 if (this.pos
< this.array
.length
)
24 return this.array
[this.pos
++];
25 throw Cr
.NS_ERROR_FAILURE
;
28 QueryInterface: function(iid
) {
29 if (iid
.equals(Ci
.nsISimpleEnumerator
)
30 || iid
.equals(Ci
.nsISupports
))
33 throw Cr
.NS_ERROR_NO_INTERFACE
;
37 function ChromeProvider(manifests
)
39 this._manifests
= manifests
;
42 ChromeProvider
.prototype = {
43 getFile: function(prop
, persistent
) {
44 throw Cr
.NS_ERROR_FAILURE
;
47 getFiles: function(prop
) {
48 if (prop
== NS_CHROME_MANIFESTS_FILE_LIST
) {
49 return new ArrayEnumerator(this._manifests
);
51 throw Cr
.NS_ERROR_FAILURE
;
54 QueryInterface: function(iid
) {
55 if (iid
.equals(Ci
.nsIDirectoryServiceProvider
)
56 || iid
.equals(Ci
.nsIDirectoryServiceProvider2
)
57 || iid
.equals(Ci
.nsISupports
))
60 throw Components
.results
.NS_ERROR_NO_INTERFACE
;
64 function registerManifests(manifests
)
66 var dirSvc
= Cc
["@mozilla.org/file/directory_service;1"].
67 getService(Ci
.nsIDirectoryService
);
68 dirSvc
.registerProvider(new ChromeProvider(manifests
));