I use
Components.classes["@mozilla.org/network/cache-service;1"].getService(Components.interfaces.nsICacheService);
to manipulate http cache when developing Firefox extension.
But after I upgrade to Firefox 38 esr, this interface throws error when calling its function
[Exception... "Component returned failure code: 0x80004001 (NS_ERROR_NOT_IMPLEMENTED) [nsICacheService.visitEntries]" nsresult: "0x80004001 (NS_ERROR_NOT_IMPLEMENTED)"
And I didn't find it obsolete in MDN, so anyone knows why? Thanks a lot.
http://code.metager.de/source/xref/mozilla/firefox/netwerk/cache/nsICacheService.idl
This looks like a hint * @throws NS_ERROR_NOT_IMPLEMENTED when the cache v2 is prefered to use.
https://bugzilla.mozilla.org/show_bug.cgi?id=913807
I’m thinking that all we need to do is change 1 to 2 in this line in the
var cacheService = cc["@mozilla.org/network/cache-service;1"] .getService(ci.nsICacheService);
I tried this code and it throws: (copy paste run in scratcpad in browser environment - https://www.youtube.com/watch?v=oo4STWceGTM )
var cacheService = Cc["@mozilla.org/network/cache-service;1"].getService(Ci.nsICacheService);
console.log('cacheService:', cacheService);
function CacheVisitor(){}
CacheVisitor.prototype = {
QueryInterface : function(iid)
{
if (iid.equals(Ci.nsICacheVisitor))
return this;
throw Components.results.NS_NOINTERFACE;
},
visitDevice : function(deviceID, deviceInfo)
{
console.log("[visiting device (deviceID = ", deviceID ,", description = ", deviceInfo.description ,")]");
return true;
},
visitEntry : function(deviceID, entryInfo)
{
console.log("[visiting entry (clientID = ", entryInfo.clientID, "key = ", entryInfo.key, ")]");
return true;
}
};
var visitor = new CacheVisitor();
cacheService.visitEntries(visitor); // throws on this line here!!!
It throws on line cacheService.visitEntries(visitor); // throws on this line here!!!
it throws this:
/*
Exception: [Exception... "Component returned failure code: 0x80004001 (NS_ERROR_NOT_IMPLEMENTED) [nsICacheService.visitEntries]" nsresult: "0x80004001 (NS_ERROR_NOT_IMPLEMENTED)" location: "JS frame :: Scratchpad/1 :: <TOP_LEVEL> :: line 27" data: no]
*/
This is the same issue you're having it looks like. Can you verify, I dont see reproducible code from you.
User contributions licensed under CC BY-SA 3.0