Bug 458861. Validate TrueType headers before activating downloaded font. r=roc, sr...
[wine-gecko.git] / netwerk / test / TestCacheVisitor.js
blob38db62b0954b2793fa051fe2b0250384560e7dcd
1 var DEBUG = true;
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);
10 return service;
13 function CacheVisitor()
17 CacheVisitor.prototype = {
18 QueryInterface : function(iid)
20 if (iid.equals(Components.interfaces.nsICacheVisitor))
21 return this;
22 throw Components.results.NS_NOINTERFACE;
25 visitDevice : function(deviceID, deviceInfo)
27 print("[visiting device (deviceID = " + deviceID + ", description = " + deviceInfo.description + ")]");
28 return true;
31 visitEntry : function(deviceID, entryInfo)
33 print("[visiting entry (clientID = " + entryInfo.clientID + ", key = " + entryInfo.key + ")]");
34 return true;
38 function test()
40 var cacheService = getCacheService();
41 var visitor = new CacheVisitor();
42 cacheService.visitEntries(visitor);
45 // load the cache service before doing anything with Java...
46 getCacheService();
48 if (DEBUG) {
49 print("cache service loaded.");
50 } else {
51 print("running cache visitor test.");
52 test();
53 print("cache visitor test complete.");