tor-browser

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

browser_sanitize-sitepermissions.js (953B)


      1 // Bug 380852 - Delete permission manager entries in Clear Recent History
      2 
      3 function countPermissions() {
      4  return Services.perms.all.length;
      5 }
      6 
      7 add_task(async function test() {
      8  // sanitize before we start so we have a good baseline.
      9  await Sanitizer.sanitize(["siteSettings"], { ignoreTimespan: false });
     10 
     11  // Count how many permissions we start with - some are defaults that
     12  // will not be sanitized.
     13  let numAtStart = countPermissions();
     14 
     15  // Add a permission entry
     16  PermissionTestUtils.add(
     17    "https://example.com",
     18    "testing",
     19    Services.perms.ALLOW_ACTION
     20  );
     21 
     22  // Sanity check
     23  ok(
     24    !!Services.perms.all.length,
     25    "Permission manager should have elements, since we just added one"
     26  );
     27 
     28  // Clear it
     29  await Sanitizer.sanitize(["siteSettings"], { ignoreTimespan: false });
     30 
     31  // Make sure it's gone
     32  is(
     33    numAtStart,
     34    countPermissions(),
     35    "Permission manager should have the same count it started with"
     36  );
     37 });