-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug 1162205 - Don't import encrypted cookies from Chrome. r=mak a=lma…
…ndel Includes https://hg.mozilla.org/mozilla-central/raw-diff/0ac453f0a1f6/browser/components/migration/tests/unit/head_migration.js --HG-- branch : GECKO380_2015050320_RELBRANCH
- Loading branch information
1 parent
4c4c083
commit 1594821
Showing
6 changed files
with
107 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+10 KB
...components/migration/tests/unit/Library/Application Support/Google/Chrome/Default/Cookies
Binary file not shown.
22 changes: 22 additions & 0 deletions
22
...ser/components/migration/tests/unit/Library/Application Support/Google/Chrome/Local State
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"profile" : { | ||
"info_cache" : { | ||
"Default" : { | ||
"active_time" : 1430950755.65137, | ||
"is_using_default_name" : true, | ||
"is_ephemeral" : false, | ||
"is_omitted_from_profile_list" : false, | ||
"user_name" : "", | ||
"background_apps" : false, | ||
"is_using_default_avatar" : true, | ||
"avatar_icon" : "chrome://theme/IDR_PROFILE_AVATAR_0", | ||
"name" : "Person 1" | ||
} | ||
}, | ||
"profiles_created" : 1, | ||
"last_used" : "Default", | ||
"last_active_profiles" : [ | ||
"Default" | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
browser/components/migration/tests/unit/test_Chrome_cookies.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
Cu.import("resource://gre/modules/ForgetAboutSite.jsm"); | ||
|
||
add_task(function* () { | ||
registerFakePath("ULibDir", do_get_file("Library/")); | ||
let migrator = MigrationUtils.getMigrator("chrome"); | ||
|
||
Assert.ok(migrator.sourceExists, "Sanity check the source exists"); | ||
|
||
const COOKIE = { | ||
expiry: 2145934800, | ||
host: "unencryptedcookie.invalid", | ||
isHttpOnly: false, | ||
isSession: false, | ||
name: "testcookie", | ||
path: "/", | ||
value: "testvalue", | ||
}; | ||
|
||
// Sanity check. | ||
Assert.equal(Services.cookies.countCookiesFromHost(COOKIE.host), 0, | ||
"There are no cookies initially"); | ||
|
||
const PROFILE = { | ||
id: "Default", | ||
name: "Person 1", | ||
}; | ||
|
||
// Migrate unencrypted cookies. | ||
yield promiseMigration(migrator, MigrationUtils.resourceTypes.COOKIES, PROFILE); | ||
|
||
do_register_cleanup(() => { | ||
ForgetAboutSite.removeDataFromDomain(COOKIE.host); | ||
Assert.equal(Services.cookies.countCookiesFromHost(COOKIE.host), 0, | ||
"There are no cookies after cleanup"); | ||
}); | ||
Assert.equal(Services.cookies.countCookiesFromHost(COOKIE.host), 1, | ||
"Migrated the expected number of unencrypted cookies"); | ||
Assert.equal(Services.cookies.countCookiesFromHost("encryptedcookie.invalid"), 0, | ||
"Migrated the expected number of encrypted cookies"); | ||
|
||
// Now check the cookie details. | ||
let enumerator = Services.cookies.getCookiesFromHost(COOKIE.host); | ||
Assert.ok(enumerator.hasMoreElements(), "Cookies available"); | ||
let foundCookie = enumerator.getNext().QueryInterface(Ci.nsICookie2); | ||
|
||
for (let prop of Object.keys(COOKIE)) { | ||
Assert.equal(foundCookie[prop], COOKIE[prop], "Check cookie " + prop); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters