Backed out changeset 34e32a1c5cef (bug 1058438)
authorCarsten "Tomcat" Book <cbook@mozilla.com>
Mon, 25 Jul 2016 12:20:33 +0200
changeset 346365 b3a92e3d6ae3650c41e0075c02706279a701f1a1
parent 346364 b3a0aa75399dbb7da9a246082293cdd36fe05be7
child 346366 cdca902ad554e20aa077d43374eebad54a363c43
push id6389
push userraliiev@mozilla.com
push dateMon, 19 Sep 2016 13:38:22 +0000
treeherdermozilla-beta@01d67bfe6c81 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1058438
milestone50.0a1
backs out34e32a1c5cef83dc0271fc973f0caad7910b440d
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Backed out changeset 34e32a1c5cef (bug 1058438)
toolkit/components/passwordmgr/test/unit/data/signons-v5v6.sqlite
toolkit/components/passwordmgr/test/unit/test_storage_mozStorage.js
deleted file mode 100644
index eb4ee6d01e0d9c89d4447515eab1a7beffc3c89c..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
GIT binary patch
literal 0
Hc$@<O00001
--- a/toolkit/components/passwordmgr/test/unit/test_storage_mozStorage.js
+++ b/toolkit/components/passwordmgr/test/unit/test_storage_mozStorage.js
@@ -1,21 +1,20 @@
 /*
  * This test interfaces directly with the mozStorage password storage module,
  * bypassing the normal password manager usage.
  */
 
 
 const ENCTYPE_BASE64 = 0;
 const ENCTYPE_SDR = 1;
-const PERMISSION_SAVE_LOGINS = "login-saving";
 
 // Current schema version used by storage-mozStorage.js. This will need to be
 // kept in sync with the version there (or else the tests fail).
-const CURRENT_SCHEMA = 6;
+const CURRENT_SCHEMA = 5;
 
 function* copyFile(aLeafName)
 {
   yield OS.File.copy(OS.Path.join(do_get_file("data").path, aLeafName),
                      OS.Path.join(OS.Constants.Path.profileDir, aLeafName));
 }
 
 function openDB(aLeafName)
@@ -57,44 +56,20 @@ function reloadStorage(aInputPathName, a
          .initWithFile(inputFile);
 
   return storage;
 }
 
 function checkStorageData(storage, ref_disabledHosts, ref_logins)
 {
   LoginTestUtils.assertLoginListsEqual(storage.getAllLogins(), ref_logins);
-  LoginTestUtils.assertDisabledHostsEqual(getAllDisabledHostsFromPermissionManager(),
+  LoginTestUtils.assertDisabledHostsEqual(storage.getAllDisabledHosts(),
                                           ref_disabledHosts);
 }
 
-function getAllDisabledHostsFromPermissionManager() {
-  let disabledHosts = [];
-  let enumerator = Services.perms.enumerator;
-
-  while (enumerator.hasMoreElements()) {
-    let perm = enumerator.getNext();
-    if (perm.type == PERMISSION_SAVE_LOGINS && perm.capability == Services.perms.DENY_ACTION) {
-      disabledHosts.push(perm.principal.URI.prePath);
-    }
-  }
-
-  return disabledHosts;
-}
-
-function setLoginSavingEnabled(origin, enabled) {
-  let uri = Services.io.newURI(origin, null, null);
-
-  if (enabled) {
-    Services.perms.remove(uri, PERMISSION_SAVE_LOGINS);
-  } else {
-    Services.perms.add(uri, PERMISSION_SAVE_LOGINS, Services.perms.DENY_ACTION);
-  }
-}
-
 add_task(function* test_execute()
 {
 
 const OUTDIR = OS.Constants.Path.profileDir;
 
 try {
 
 var isGUID = /^\{[0-9a-f\d]{8}-[0-9a-f\d]{4}-[0-9a-f\d]{4}-[0-9a-f\d]{4}-[0-9a-f\d]{12}\}$/;
@@ -109,27 +84,16 @@ function getGUIDforID(conn, id) {
 function getEncTypeForID(conn, id) {
     var stmt = conn.createStatement("SELECT encType from moz_logins WHERE id = " + id);
     stmt.executeStep();
     var encType = stmt.row.encType;
     stmt.finalize();
     return encType;
 }
 
-function getAllDisabledHostsFromMozStorage(conn) {
-    let disabledHosts = [];
-    let stmt = conn.createStatement("SELECT hostname from moz_disabledHosts");
-
-    while (stmt.executeStep()) {
-      disabledHosts.push(stmt.row.hostname);
-    }
-
-    return disabledHosts;
-}
-
 var storage;
 var dbConnection;
 var testnum = 0;
 var testdesc = "Setup of nsLoginInfo test-users";
 var nsLoginInfo = new Components.Constructor(
                     "@mozilla.org/login-manager/loginInfo;1",
                     Components.interfaces.nsILoginInfo);
 do_check_true(nsLoginInfo != null);
@@ -160,17 +124,16 @@ testdesc = "Test downgrade from v999 sto
 
 yield* copyFile("signons-v999.sqlite");
 // Verify the schema version in the test file.
 dbConnection = openDB("signons-v999.sqlite");
 do_check_eq(999, dbConnection.schemaVersion);
 dbConnection.close();
 
 storage = reloadStorage(OUTDIR, "signons-v999.sqlite");
-setLoginSavingEnabled("https://disabled.net", false);
 checkStorageData(storage, ["https://disabled.net"], [testuser1]);
 
 // Check to make sure we downgraded the schema version.
 dbConnection = openDB("signons-v999.sqlite");
 do_check_eq(CURRENT_SCHEMA, dbConnection.schemaVersion);
 dbConnection.close();
 
 deleteFile(OUTDIR, "signons-v999.sqlite");
@@ -322,19 +285,16 @@ testdesc = "Test upgrade from v3->v4 sto
 yield* copyFile("signons-v3.sqlite");
 // Sanity check the test file.
 dbConnection = openDB("signons-v3.sqlite");
 do_check_eq(3, dbConnection.schemaVersion);
 
 storage = reloadStorage(OUTDIR, "signons-v3.sqlite");
 do_check_eq(CURRENT_SCHEMA, dbConnection.schemaVersion);
 
-// Remove old entry from permission manager.
-setLoginSavingEnabled("https://disabled.net", true);
-
 // Check that timestamps and counts were initialized correctly
 checkStorageData(storage, [], [testuser1, testuser2]);
 
 var logins = storage.getAllLogins();
 for (var i = 0; i < 2; i++) {
     do_check_true(logins[i] instanceof Ci.nsILoginMetaInfo);
     do_check_eq(1, logins[i].timesUsed);
     LoginTestUtils.assertTimeIsAboutNow(logins[i].timeCreated);
@@ -406,70 +366,33 @@ yield copyFile("signons-v4v5.sqlite");
 dbConnection = openDB("signons-v4v5.sqlite");
 do_check_eq(4, dbConnection.schemaVersion);
 do_check_true(dbConnection.tableExists("moz_deleted_logins"));
 
 storage = reloadStorage(OUTDIR, "signons-v4v5.sqlite");
 do_check_eq(CURRENT_SCHEMA, dbConnection.schemaVersion);
 do_check_true(dbConnection.tableExists("moz_deleted_logins"));
 
+
 /* ========== 11 ========== */
 testnum++;
-testdesc = "Test upgrade from v5->v6 storage";
-
-yield* copyFile("signons-v5v6.sqlite");
-
-// Sanity check the test file.
-dbConnection = openDB("signons-v5v6.sqlite");
-do_check_eq(5, dbConnection.schemaVersion);
-do_check_true(dbConnection.tableExists("moz_disabledHosts"));
-
-// Initial disabled hosts inside signons-v5v6.sqlite
-var disabledHosts = [
-  "http://disabled1.example.com",
-  "http://大.net",
-  "http://xn--19g.com"
-];
-
-LoginTestUtils.assertDisabledHostsEqual(disabledHosts, getAllDisabledHostsFromMozStorage(dbConnection));
-
-// Reload storage
-storage = reloadStorage(OUTDIR, "signons-v5v6.sqlite");
-do_check_eq(CURRENT_SCHEMA, dbConnection.schemaVersion);
-
-// moz_disabledHosts should now be empty after migration.
-LoginTestUtils.assertDisabledHostsEqual([], getAllDisabledHostsFromMozStorage(dbConnection));
-
-// Get all the other hosts currently saved in the permission manager.
-let hostsInPermissionManager = getAllDisabledHostsFromPermissionManager();
-
-// All disabledHosts should have migrated to the permission manager
-LoginTestUtils.assertDisabledHostsEqual(disabledHosts, hostsInPermissionManager);
-
-// Remove all disabled hosts from the permission manager before test ends
-for (let host of disabledHosts) {
-  setLoginSavingEnabled(host, true);
-}
-
-/* ========== 12 ========== */
-testnum++;
 testdesc = "Create nsILoginInfo instances for testing with"
 
 testuser1 = new nsLoginInfo;
 testuser1.init("http://dummyhost.mozilla.org", "", null,
     "dummydude", "itsasecret", "put_user_here", "put_pw_here");
 
 
 /*
  * ---------------------- DB Corruption ----------------------
  * Try to initialize with a corrupt database file. This should create a backup
  * file, then upon next use create a new database file.
  */
 
-/* ========== 13 ========== */
+/* ========== 12 ========== */
 testnum++;
 testdesc = "Corrupt database and backup"
 
 const filename = "signons-c.sqlite";
 const filepath = OS.Path.join(OS.Constants.Path.profileDir, filename);
 
 yield OS.File.copy(do_get_file("data/corruptDB.sqlite").path, filepath);