michael@0: function exitPB() michael@0: { michael@0: var obsvc = Cc["@mozilla.org/observer-service;1"]. michael@0: getService(Ci.nsIObserverService); michael@0: obsvc.notifyObservers(null, "last-pb-context-exited", null); michael@0: } michael@0: michael@0: function run_test() michael@0: { michael@0: do_get_profile(); michael@0: michael@0: // Store PB entry michael@0: asyncOpenCacheEntry("http://p1/", "disk", Ci.nsICacheStorage.OPEN_NORMALLY, LoadContextInfo.private, michael@0: new OpenCallback(NEW, "p1m", "p1d", function(entry) { michael@0: asyncOpenCacheEntry("http://p1/", "disk", Ci.nsICacheStorage.OPEN_NORMALLY, LoadContextInfo.private, michael@0: new OpenCallback(NORMAL, "p1m", "p1d", function(entry) { michael@0: // Check it's there michael@0: syncWithCacheIOThread(function() { michael@0: var storage = getCacheStorage("disk", LoadContextInfo.private); michael@0: storage.asyncVisitStorage( michael@0: new VisitCallback(1, 12, ["http://p1/"], function() { michael@0: // Simulate PB exit michael@0: exitPB(); michael@0: // Check the entry is gone 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: }) michael@0: ); michael@0: michael@0: do_test_pending(); michael@0: }