michael@0: Components.utils.import('resource://gre/modules/LoadContextInfo.jsm'); michael@0: michael@0: function run_test() michael@0: { michael@0: do_get_profile(); michael@0: michael@0: function checkNewBackEnd() michael@0: { michael@0: var storage = getCacheStorage("disk", LoadContextInfo.default); michael@0: storage.asyncVisitStorage( michael@0: new VisitCallback(1, 12, ["http://an2/"], function() { michael@0: storage = getCacheStorage("disk", LoadContextInfo.anonymous); michael@0: storage.asyncVisitStorage( michael@0: new VisitCallback(1, 12, ["http://an2/"], function() { michael@0: finish_cache2_test(); michael@0: }), michael@0: true michael@0: ); michael@0: }), michael@0: true michael@0: ); michael@0: } michael@0: michael@0: function checkOldBackEnd() michael@0: { michael@0: syncWithCacheIOThread(function() { michael@0: var storage = getCacheStorage("disk", LoadContextInfo.default); michael@0: storage.asyncVisitStorage( michael@0: new VisitCallback(2, 24, ["http://an2/", "anon&uri=http://an2/"], function() { michael@0: storage = getCacheStorage("disk", LoadContextInfo.anonymous); michael@0: storage.asyncVisitStorage( michael@0: new VisitCallback(0, 0, [], function() { michael@0: finish_cache2_test(); michael@0: }), michael@0: true michael@0: ); michael@0: }), michael@0: true michael@0: ); michael@0: }); michael@0: } michael@0: michael@0: var mc = new MultipleCallbacks(2, newCacheBackEndUsed() ? checkNewBackEnd : checkOldBackEnd, !newCacheBackEndUsed()); michael@0: michael@0: asyncOpenCacheEntry("http://an2/", "disk", Ci.nsICacheStorage.OPEN_NORMALLY, LoadContextInfo.default, michael@0: new OpenCallback(NEW|WAITFORWRITE, "an2", "an2", function(entry) { michael@0: mc.fired(); michael@0: }) michael@0: ); michael@0: michael@0: asyncOpenCacheEntry("http://an2/", "disk", Ci.nsICacheStorage.OPEN_NORMALLY, LoadContextInfo.anonymous, michael@0: new OpenCallback(NEW|WAITFORWRITE, "an2", "an2", function(entry) { michael@0: mc.fired(); michael@0: }) michael@0: ); michael@0: michael@0: do_test_pending(); michael@0: }