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

Thu, 15 Jan 2015 21:03:48 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 21:03:48 +0100
branch
TOR_BUG_9701
changeset 11
deefc01c0e14
permissions
-rw-r--r--

Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)

     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