netwerk/test/unit/test_cache2-06-pb-mode.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 function exitPB()
     2 {
     3   var obsvc = Cc["@mozilla.org/observer-service;1"].
     4     getService(Ci.nsIObserverService);
     5   obsvc.notifyObservers(null, "last-pb-context-exited", null);
     6 }
     8 function run_test()
     9 {
    10   do_get_profile();
    12   // Store PB entry
    13   asyncOpenCacheEntry("http://p1/", "disk", Ci.nsICacheStorage.OPEN_NORMALLY, LoadContextInfo.private,
    14     new OpenCallback(NEW, "p1m", "p1d", function(entry) {
    15       asyncOpenCacheEntry("http://p1/", "disk", Ci.nsICacheStorage.OPEN_NORMALLY, LoadContextInfo.private,
    16         new OpenCallback(NORMAL, "p1m", "p1d", function(entry) {
    17           // Check it's there
    18           syncWithCacheIOThread(function() {
    19             var storage = getCacheStorage("disk", LoadContextInfo.private);
    20             storage.asyncVisitStorage(
    21               new VisitCallback(1, 12, ["http://p1/"], function() {
    22                 // Simulate PB exit
    23                 exitPB();
    24                 // Check the entry is gone
    25                 storage.asyncVisitStorage(
    26                   new VisitCallback(0, 0, [], function() {
    27                     finish_cache2_test();
    28                   }),
    29                   true
    30                 );
    31               }),
    32               true
    33             );
    34           });
    35         })
    36       );
    37     })
    38   );
    40   do_test_pending();
    41 }

mercurial