1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/netwerk/test/unit/test_cache2-06-pb-mode.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,41 @@ 1.4 +function exitPB() 1.5 +{ 1.6 + var obsvc = Cc["@mozilla.org/observer-service;1"]. 1.7 + getService(Ci.nsIObserverService); 1.8 + obsvc.notifyObservers(null, "last-pb-context-exited", null); 1.9 +} 1.10 + 1.11 +function run_test() 1.12 +{ 1.13 + do_get_profile(); 1.14 + 1.15 + // Store PB entry 1.16 + asyncOpenCacheEntry("http://p1/", "disk", Ci.nsICacheStorage.OPEN_NORMALLY, LoadContextInfo.private, 1.17 + new OpenCallback(NEW, "p1m", "p1d", function(entry) { 1.18 + asyncOpenCacheEntry("http://p1/", "disk", Ci.nsICacheStorage.OPEN_NORMALLY, LoadContextInfo.private, 1.19 + new OpenCallback(NORMAL, "p1m", "p1d", function(entry) { 1.20 + // Check it's there 1.21 + syncWithCacheIOThread(function() { 1.22 + var storage = getCacheStorage("disk", LoadContextInfo.private); 1.23 + storage.asyncVisitStorage( 1.24 + new VisitCallback(1, 12, ["http://p1/"], function() { 1.25 + // Simulate PB exit 1.26 + exitPB(); 1.27 + // Check the entry is gone 1.28 + storage.asyncVisitStorage( 1.29 + new VisitCallback(0, 0, [], function() { 1.30 + finish_cache2_test(); 1.31 + }), 1.32 + true 1.33 + ); 1.34 + }), 1.35 + true 1.36 + ); 1.37 + }); 1.38 + }) 1.39 + ); 1.40 + }) 1.41 + ); 1.42 + 1.43 + do_test_pending(); 1.44 +}