3 var clientID
= "javascript";
4 var nsICache
= Components
.interfaces
.nsICache
;
6 function getCacheService()
8 var nsCacheService
= Components
.classes
["@mozilla.org/network/cache-service;1"];
9 var service
= nsCacheService
.getService(Components
.interfaces
.nsICacheService
);
13 function CacheVisitor()
17 CacheVisitor
.prototype = {
18 QueryInterface : function(iid
)
20 if (iid
.equals(Components
.interfaces
.nsICacheVisitor
))
22 throw Components
.results
.NS_NOINTERFACE
;
25 visitDevice : function(deviceID
, deviceInfo
)
27 print("[visiting device (deviceID = " + deviceID
+ ", description = " + deviceInfo
.description
+ ")]");
31 visitEntry : function(deviceID
, entryInfo
)
33 print("[visiting entry (clientID = " + entryInfo
.clientID
+ ", key = " + entryInfo
.key
+ ")]");
40 var cacheService
= getCacheService();
41 var visitor
= new CacheVisitor();
42 cacheService
.visitEntries(visitor
);
45 // load the cache service before doing anything with Java...
49 print("cache service loaded.");
51 print("running cache visitor test.");
53 print("cache visitor test complete.");