tor-browser

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

test_localStorageArchive1upgrade.js (1945B)


      1 /**
      2 * Any copyright is dedicated to the Public Domain.
      3 * http://creativecommons.org/publicdomain/zero/1.0/
      4 */
      5 
      6 /**
      7 * This test is mainly to verify that local storage directories are removed
      8 * during local storage archive upgrade from version 0 to version 1.
      9 * See bug 1546305.
     10 */
     11 
     12 async function testSteps() {
     13  const lsDirs = [
     14    "storage/default/http+++example.com/ls",
     15    "storage/default/http+++localhost/ls",
     16    "storage/default/http+++www.mozilla.org/ls",
     17  ];
     18 
     19  info("Clearing");
     20 
     21  let request = clear();
     22  await requestFinished(request);
     23 
     24  info("Installing package");
     25 
     26  // The profile contains three initialized origin directories with local
     27  // storage data, local storage archive, a script for origin initialization,
     28  // the storage database and the web apps store database:
     29  // - storage/default/https+++example.com
     30  // - storage/default/https+++localhost
     31  // - storage/default/https+++www.mozilla.org
     32  // - storage/ls-archive.sqlite
     33  // - create_db.js
     34  // - storage.sqlite
     35  // - webappsstore.sqlite
     36  // The file create_db.js in the package was run locally (with a build that
     37  // doesn't support local storage archive upgrades), specifically it was
     38  // temporarily added to xpcshell.toml and then executed:
     39  //   mach xpcshell-test --interactive dom/localstorage/test/xpcshell/create_db.js
     40  // Note: to make it become the profile in the test, additional manual steps
     41  // are needed.
     42  // 1. Remove the folder "storage/temporary".
     43  installPackage("localStorageArchive1upgrade_profile");
     44 
     45  info("Checking ls dirs");
     46 
     47  for (let lsDir of lsDirs) {
     48    let dir = getRelativeFile(lsDir);
     49 
     50    exists = dir.exists();
     51    ok(exists, "ls directory does exist");
     52  }
     53 
     54  request = init();
     55  request = await requestFinished(request);
     56 
     57  info("Checking ls dirs");
     58 
     59  for (let lsDir of lsDirs) {
     60    let dir = getRelativeFile(lsDir);
     61 
     62    exists = dir.exists();
     63    ok(!exists, "ls directory doesn't exist");
     64  }
     65 }