Follow-on fix for bug 457825. Use sheet principal for agent and user sheets. r=dbaron...
[wine-gecko.git] / chrome / test / unit / head_crtestutils.js
blob1616ea93ef5cdb34fd849995e8fbc1e024e80a8b
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)
12 this.array = array;
15 ArrayEnumerator.prototype = {
16 pos: 0,
18 hasMoreElements: function() {
19 return this.pos < this.array.length;
22 getNext: function() {
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))
31 return this;
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))
58 return this;
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));