tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

test_startup_session_async.js (1166B)


      1 /* Any copyright is dedicated to the Public Domain.
      2   http://creativecommons.org/publicdomain/zero/1.0/ */
      3 
      4 // Test SessionStartup.sessionType in the following scenario:
      5 // - valid sessionstore.js;
      6 // - valid sessionCheckpoints.json with all checkpoints;
      7 // - the session store has been loaded
      8 
      9 function run_test() {
     10  let profd = do_get_profile();
     11  var SessionFile = ChromeUtils.importESModule(
     12    "resource:///modules/sessionstore/SessionFile.sys.mjs"
     13  ).SessionFile;
     14 
     15  let sourceSession = do_get_file("data/sessionstore_valid.js");
     16  sourceSession.copyTo(profd, "sessionstore.js");
     17 
     18  let sourceCheckpoints = do_get_file("data/sessionCheckpoints_all.json");
     19  sourceCheckpoints.copyTo(profd, "sessionCheckpoints.json");
     20 
     21  // Compress sessionstore.js to sessionstore.jsonlz4
     22  // and remove sessionstore.js
     23  let oldExtSessionFile = SessionFile.Paths.clean.replace("jsonlz4", "js");
     24  writeCompressedFile(oldExtSessionFile, SessionFile.Paths.clean).then(() => {
     25    afterSessionStartupInitialization(function cb() {
     26      Assert.equal(SessionStartup.sessionType, SessionStartup.DEFER_SESSION);
     27      do_test_finished();
     28    });
     29  });
     30 
     31  do_test_pending();
     32 }