test_cache2-06-pb-mode.js (1305B)
1 "use strict"; 2 3 function exitPB() { 4 Services.obs.notifyObservers(null, "last-pb-context-exited"); 5 } 6 7 function run_test() { 8 do_get_profile(); 9 10 // Store PB entry 11 asyncOpenCacheEntry( 12 "http://p1/", 13 "disk", 14 Ci.nsICacheStorage.OPEN_NORMALLY, 15 Services.loadContextInfo.private, 16 new OpenCallback(NEW, "p1m", "p1d", function () { 17 asyncOpenCacheEntry( 18 "http://p1/", 19 "disk", 20 Ci.nsICacheStorage.OPEN_NORMALLY, 21 Services.loadContextInfo.private, 22 new OpenCallback(NORMAL, "p1m", "p1d", function () { 23 // Check it's there 24 syncWithCacheIOThread(function () { 25 var storage = getCacheStorage( 26 "disk", 27 Services.loadContextInfo.private 28 ); 29 storage.asyncVisitStorage( 30 new VisitCallback(1, 12, ["http://p1/"], function () { 31 // Simulate PB exit 32 exitPB(); 33 // Check the entry is gone 34 storage.asyncVisitStorage( 35 new VisitCallback(0, 0, [], function () { 36 finish_cache2_test(); 37 }), 38 true 39 ); 40 }), 41 true 42 ); 43 }); 44 }) 45 ); 46 }) 47 ); 48 49 do_test_pending(); 50 }