[tbb-commits] [tor-browser-bundle-testsuite] branch master updated: Bug 40036: added a test to check that permissions are not saved on storage

gitolite role git at cupani.torproject.org
Thu Mar 31 20:46:19 UTC 2022


This is an automated email from the git hooks/post-receive script.

richard pushed a commit to branch master
in repository tor-browser-bundle-testsuite.

The following commit(s) were added to refs/heads/master by this push:
     new 76fd8eb  Bug 40036: added a test to check that permissions are not saved on storage
76fd8eb is described below

commit 76fd8eba75bf4215041d4a11f4e06faa175f0005
Author: Pier Angelo Vendrame <pierov at torproject.org>
AuthorDate: Mon Feb 28 11:56:46 2022 +0100

    Bug 40036: added a test to check that permissions are not saved on storage
    
    In our Firefox patch set we have a test that assures that preferences
    are kept in memory, instead of saving them to the disk or other
    storage.
    However, usually we check this kind of functionality here, not on
    the Firefox/tor-browser code.
    
    Other tests in that tor-browser commit should already be covered.
---
 TBBTestSuite/TestSuite/BrowserBundleTests.pm       |  6 ++++++
 .../tor_browser_tests/test_volatile_preferences.py | 25 ++++++++++++++++++++++
 2 files changed, 31 insertions(+)

diff --git a/TBBTestSuite/TestSuite/BrowserBundleTests.pm b/TBBTestSuite/TestSuite/BrowserBundleTests.pm
index ae3a484..15daa84 100644
--- a/TBBTestSuite/TestSuite/BrowserBundleTests.pm
+++ b/TBBTestSuite/TestSuite/BrowserBundleTests.pm
@@ -465,6 +465,12 @@ our @tests = (
         use_net         => 1,
         descr           => 'Check that the security level UI is working properly',
     },
+    {
+        name            => 'volatile_preferences',
+        type            => 'marionette',
+        use_net         => 0,
+        descr           => 'Check that the site preferences are not saved to disk',
+    }
 );
 
 sub set_test_prefs {
diff --git a/marionette/tor_browser_tests/test_volatile_preferences.py b/marionette/tor_browser_tests/test_volatile_preferences.py
new file mode 100644
index 0000000..c08d9eb
--- /dev/null
+++ b/marionette/tor_browser_tests/test_volatile_preferences.py
@@ -0,0 +1,25 @@
+import os.path
+
+from marionette_harness import MarionetteTestCase
+import testsuite
+
+class Test(MarionetteTestCase):
+
+    def test_volatile_preferences(self):
+        with self.marionette.using_context('chrome'):
+            profile_path = self.marionette.execute_script('''
+return Services.dirsvc.get("ProfD", Components.interfaces.nsIFile).path;
+''')
+            # This file does not exist by default in Tor Browser
+            perm_file = profile_path + '/permissions.sqlite'
+            self.assertFalse(os.path.exists(perm_file))
+            script = '''
+const SITE = "https://www.torproject.org";
+const KEY = "storageAccessAPI";
+const principal = Services.scriptSecurityManager.createContentPrincipalFromOrigin(SITE);
+SitePermissions.setForPrincipal(principal, KEY, SitePermissions.ALLOW);
+return SitePermissions.getForPrincipal(principal, KEY).state == SitePermissions.ALLOW;
+'''
+            script_succeeded = self.marionette.execute_script(script)
+            self.assertTrue(script_succeeded)
+            self.assertFalse(os.path.exists(perm_file))

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the tbb-commits mailing list