[tor-commits] [tor-browser/tor-browser-78.6.0esr-10.5-1] fixup! Bug 12620: TorBrowser regression tests

gk at torproject.org gk at torproject.org
Mon Jan 11 17:05:35 UTC 2021


commit af344650cbfb5527c9c6fc67a35eecf4e42a2560
Author: Alex Catarineu <acat at torproject.org>
Date:   Wed Nov 4 21:05:43 2020 +0100

    fixup! Bug 12620: TorBrowser regression tests
---
 tbb-tests/browser_tor_bug2950.js | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/tbb-tests/browser_tor_bug2950.js b/tbb-tests/browser_tor_bug2950.js
index 010cc6356202..add683022d8e 100644
--- a/tbb-tests/browser_tor_bug2950.js
+++ b/tbb-tests/browser_tor_bug2950.js
@@ -13,19 +13,19 @@ let Ci = Components.interfaces;
 
 // ## utility functions
 
-// __uri(spec)__.
-// Creates an nsIURI instance from a spec
+// __principal(spec)__.
+// Creates a principal instance from a spec
 // (string address such as "http://torproject.org").
-let uri = spec => Services.io.newURI(spec, null, null);
+let principal = spec => Services.scriptSecurityManager.createContentPrincipalFromOrigin(spec);
 
 // __setPermission(spec, key, value)__.
 // Sets the site permission of type key to value, for the site located at address spec.
-let setPermission = (spec, key, value) => SitePermissions.set(uri(spec), key, value);
+let setPermission = (spec, key, value) => SitePermissions.setForPrincipal(principal(spec), key, value);
 
 // __getPermission(spec, key)__.
 // Reads the site permission value for permission type key, for the site
 // located at address spec.
-let getPermission = (spec, key) => SitePermissions.get(uri(spec), key);
+let getPermission = (spec, key) => SitePermissions.getForPrincipal(principal(spec), key);
 
 // __profileDirPath__.
 // The Firefox Profile directory. Expected location of various persistent files.
@@ -54,12 +54,12 @@ let originalValue = getPermission(SITE, KEY);
 window.setTimeout(
   function () {
     // Set the permission to a new value.
-    setPermission(SITE, KEY, (originalValue === 0) ? 1 : 0);
+    setPermission(SITE, KEY, SitePermissions.BLOCK);
     // Now read back the permission value again.
     let newReadValue = getPermission(SITE, KEY);
     // Compare to confirm that the permission
     // value was successfully changed.
-    isnot(newReadValue, originalValue, "Set a value in permissions db (perhaps in memory).");;
+    Assert.notDeepEqual(originalValue, newReadValue, "Set a value in permissions db (perhaps in memory).");
     // If file existed or now exists, get the current time stamp.
     if (permissionsFile.exists()) {
       newModifiedTime = permissionsFile.lastModifiedTime;





More information about the tor-commits mailing list