tor-browser

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

test_allowListFiles.js (1539B)


      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 thoes unexpected files are in the allow list of
      8 * QuotaManager. They aren't expected in the repository but if there are,
      9 * QuotaManager shouldn't fail to initialize an origin and getting usage, though
     10 * those files aren't managed by QuotaManager.
     11 */
     12 
     13 async function testSteps() {
     14  const allowListFiles = [
     15    ".dot-file",
     16    "desktop.ini",
     17    "Desktop.ini",
     18    "Thumbs.db",
     19    "thumbs.db",
     20  ];
     21 
     22  for (let allowListFile of allowListFiles) {
     23    info("Testing " + allowListFile + " in the repository");
     24 
     25    info("Initializing");
     26 
     27    let request = init();
     28    await requestFinished(request);
     29 
     30    info("Creating unknown files");
     31 
     32    for (let dir of ["persistenceType dir", "origin dir"]) {
     33      let dirPath =
     34        dir == "persistenceType dir"
     35          ? "storage/default/"
     36          : "storage/default/http+++example.com/";
     37      let file = getRelativeFile(dirPath + allowListFile);
     38      file.create(Ci.nsIFile.NORMAL_FILE_TYPE, parseInt("0644", 8));
     39    }
     40 
     41    info("Initializing temporary storage");
     42 
     43    request = initTemporaryStorage();
     44    await requestFinished(request);
     45 
     46    info("Resetting");
     47 
     48    request = reset();
     49    await requestFinished(request);
     50 
     51    info("Getting usage");
     52 
     53    request = getCurrentUsage(continueToNextStepSync);
     54    await requestFinished(request);
     55 
     56    info("Clearing");
     57 
     58    request = clear();
     59    await requestFinished(request);
     60  }
     61 }