Bug 1506390 - Ensure the default permissions do not intefer with the permission tests that assume no defaults. r=johannh, a=test-only
authorMagnus Melin <mkmelin+mozilla@iki.fi>
Wed, 14 Nov 2018 14:55:22 +0200
changeset 501279 a96813612e0cee496e7d3e8e3b5d805233c0f74e
parent 501278 0e12912bc61b604fe805a4c0d6ec9bbc75ec00f6
child 501280 d4ce8b3cdee86a47d1e201bde99f81756b45193a
push id1864
push userffxbld-merge
push dateMon, 03 Dec 2018 15:51:40 +0000
treeherdermozilla-release@f040763d99ad [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjohannh, test-only
bugs1506390
milestone64.0
Bug 1506390 - Ensure the default permissions do not intefer with the permission tests that assume no defaults. r=johannh, a=test-only
extensions/cookie/test/unit/test_permmanager_migrate_4-7.js
extensions/cookie/test/unit/test_permmanager_migrate_4-7_no_history.js
extensions/cookie/test/unit/test_permmanager_migrate_5-7a.js
extensions/cookie/test/unit/test_permmanager_migrate_5-7b.js
extensions/cookie/test/unit/test_permmanager_migrate_6-7a.js
extensions/cookie/test/unit/test_permmanager_migrate_6-7b.js
extensions/cookie/test/unit/test_permmanager_migrate_7-8.js
extensions/cookie/test/unit/test_permmanager_notifications.js
extensions/cookie/test/unit/test_permmanager_removebytype.js
netwerk/test/unit/test_permmgr.js
--- a/extensions/cookie/test/unit/test_permmanager_migrate_4-7.js
+++ b/extensions/cookie/test/unit/test_permmanager_migrate_4-7.js
@@ -11,16 +11,17 @@ function GetPermissionsFile(profile)
   let file = profile.clone();
   file.append(PERMISSIONS_FILE_NAME);
   return file;
 }
 
 add_task(async function test() {
   /* Create and set up the permissions database */
   let profile = do_get_profile();
+  Services.prefs.setCharPref("permissions.manager.defaultsUrl", "");
 
   let db = Services.storage.openDatabase(GetPermissionsFile(profile));
   db.schemaVersion = 4;
 
   db.executeSimpleSQL(
     "CREATE TABLE moz_hosts (" +
       " id INTEGER PRIMARY KEY" +
       ",host TEXT" +
--- a/extensions/cookie/test/unit/test_permmanager_migrate_4-7_no_history.js
+++ b/extensions/cookie/test/unit/test_permmanager_migrate_4-7_no_history.js
@@ -40,16 +40,17 @@ function GetPermissionsFile(profile)
 
 /*
  * Done nsINavHistoryService code
  */
 
 add_task(function test() {
   /* Create and set up the permissions database */
   let profile = do_get_profile();
+  Services.prefs.setCharPref("permissions.manager.defaultsUrl", "");
 
   // Make sure that we can't resolve the nsINavHistoryService
   try {
     Cc['@mozilla.org/browser/nav-history-service;1'].getService(Ci.nsINavHistoryService);
     Assert.ok(false, "There shouldn't have been a nsINavHistoryService");
   } catch (e) {
     Assert.ok(true, "There wasn't a nsINavHistoryService");
   }
--- a/extensions/cookie/test/unit/test_permmanager_migrate_5-7a.js
+++ b/extensions/cookie/test/unit/test_permmanager_migrate_5-7a.js
@@ -11,16 +11,17 @@ function GetPermissionsFile(profile)
   let file = profile.clone();
   file.append(PERMISSIONS_FILE_NAME);
   return file;
 }
 
 add_task(async function test() {
   /* Create and set up the permissions database */
   let profile = do_get_profile();
+  Services.prefs.setCharPref("permissions.manager.defaultsUrl", "");
 
   let db = Services.storage.openDatabase(GetPermissionsFile(profile));
   db.schemaVersion = 5;
 
   /*
    * V5 table
    */
   db.executeSimpleSQL(
--- a/extensions/cookie/test/unit/test_permmanager_migrate_5-7b.js
+++ b/extensions/cookie/test/unit/test_permmanager_migrate_5-7b.js
@@ -11,16 +11,17 @@ function GetPermissionsFile(profile)
   let file = profile.clone();
   file.append(PERMISSIONS_FILE_NAME);
   return file;
 }
 
 add_task(function test() {
   /* Create and set up the permissions database */
   let profile = do_get_profile();
+  Services.prefs.setCharPref("permissions.manager.defaultsUrl", "");
 
   let db = Services.storage.openDatabase(GetPermissionsFile(profile));
   db.schemaVersion = 5;
 
   /*
    * V5 table
    */
   db.executeSimpleSQL(
--- a/extensions/cookie/test/unit/test_permmanager_migrate_6-7a.js
+++ b/extensions/cookie/test/unit/test_permmanager_migrate_6-7a.js
@@ -11,16 +11,17 @@ function GetPermissionsFile(profile)
   let file = profile.clone();
   file.append(PERMISSIONS_FILE_NAME);
   return file;
 }
 
 add_task(async function test() {
   /* Create and set up the permissions database */
   let profile = do_get_profile();
+  Services.prefs.setCharPref("permissions.manager.defaultsUrl", "");
 
   let db = Services.storage.openDatabase(GetPermissionsFile(profile));
   db.schemaVersion = 6;
 
   /*
    * V5 table
    */
   db.executeSimpleSQL(
--- a/extensions/cookie/test/unit/test_permmanager_migrate_6-7b.js
+++ b/extensions/cookie/test/unit/test_permmanager_migrate_6-7b.js
@@ -11,16 +11,17 @@ function GetPermissionsFile(profile)
   let file = profile.clone();
   file.append(PERMISSIONS_FILE_NAME);
   return file;
 }
 
 add_task(function test() {
   /* Create and set up the permissions database */
   let profile = do_get_profile();
+  Services.prefs.setCharPref("permissions.manager.defaultsUrl", "");
 
   let db = Services.storage.openDatabase(GetPermissionsFile(profile));
   db.schemaVersion = 6;
 
   /*
    * V5 table
    */
   db.executeSimpleSQL(
--- a/extensions/cookie/test/unit/test_permmanager_migrate_7-8.js
+++ b/extensions/cookie/test/unit/test_permmanager_migrate_7-8.js
@@ -11,16 +11,17 @@ function GetPermissionsFile(profile)
   let file = profile.clone();
   file.append(PERMISSIONS_FILE_NAME);
   return file;
 }
 
 add_task(async function test() {
   /* Create and set up the permissions database */
   let profile = do_get_profile();
+  Services.prefs.setCharPref("permissions.manager.defaultsUrl", "");
 
   let db = Services.storage.openDatabase(GetPermissionsFile(profile));
   db.schemaVersion = 7;
 
   /*
    * V5 table
    */
   db.executeSimpleSQL(
--- a/extensions/cookie/test/unit/test_permmanager_notifications.js
+++ b/extensions/cookie/test/unit/test_permmanager_notifications.js
@@ -2,16 +2,17 @@
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
 // Test that the permissionmanager 'added', 'changed', 'deleted', and 'cleared'
 // notifications behave as expected.
 
 var test_generator = do_run_test();
 
 function run_test() {
+  Services.prefs.setCharPref("permissions.manager.defaultsUrl", "");
   do_test_pending();
   test_generator.next();
 }
 
 function continue_test()
 {
   do_run_generator(test_generator);
 }
--- a/extensions/cookie/test/unit/test_permmanager_removebytype.js
+++ b/extensions/cookie/test/unit/test_permmanager_removebytype.js
@@ -1,12 +1,14 @@
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
 function run_test() {
+  Services.prefs.setCharPref("permissions.manager.defaultsUrl", "");
+
   // initialize the permission manager service
   let pm = Cc["@mozilla.org/permissionmanager;1"].
         getService(Ci.nsIPermissionManager);
 
   Assert.equal(perm_count(), 0);
 
   // add some permissions
   let uri = NetUtil.newURI("http://amazon.com:8080/foobarbaz");
--- a/netwerk/test/unit/test_permmgr.js
+++ b/netwerk/test/unit/test_permmgr.js
@@ -25,16 +25,17 @@ var results = [
   // test different permissions on subdomains
   ["http://mozilla.com", "cookie", 1, 1],
   ["http://www.mozilla.com", "cookie", 2, 2],
   ["http://dev.mozilla.com", "cookie", 3, 3],
   ["http://www.dev.mozilla.com", "cookie", 3, 0]
 ];
 
 function run_test() {
+  Services.prefs.setCharPref("permissions.manager.defaultsUrl", "");
   var pm = Cc["@mozilla.org/permissionmanager;1"]
              .getService(Ci.nsIPermissionManager);
 
   var ioService = Cc["@mozilla.org/network/io-service;1"]
                     .getService(Ci.nsIIOService);
 
   var secMan = Cc["@mozilla.org/scriptsecuritymanager;1"]
                  .getService(Ci.nsIScriptSecurityManager);
@@ -97,17 +98,17 @@ function run_test() {
   Assert.equal(enumerator.hasMoreElements(), false);
 
   // test removeAll()
   pm.removeAll();
   Assert.equal(pm.enumerator.hasMoreElements(), false);
 
   uri = ioService.newURI("https://www.example.com");
   pm.add(uri, "offline-app", pm.ALLOW_ACTION);
-  principal = secMan.createCodebasePrincipalFromOrigin("https://www.example.com");
+  let principal = secMan.createCodebasePrincipalFromOrigin("https://www.example.com");
   // Remove existing entry.
-  perm = pm.getPermissionObject(principal, "offline-app", true);
+  let perm = pm.getPermissionObject(principal, "offline-app", true);
   pm.removePermission(perm);
   // Try to remove already deleted entry.
   perm = pm.getPermissionObject(principal, "offline-app", true);
   pm.removePermission(perm);
   Assert.equal(pm.enumerator.hasMoreElements(), false);
 }