Commit 76fd8eba authored by Pier Angelo Vendrame's avatar Pier Angelo Vendrame Committed by Richard Pospesel
Browse files

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.
parent c2ae1d62
......@@ -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 {
......
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))
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment