Bug 1839918 - Update tests for nsICookieNotification. r=cookie-reviewers,sessionstore-reviewers,bvandersloot,valentin

Differential Revision: https://phabricator.services.mozilla.com/D185302
This commit is contained in:
Paul Zuehlcke
2023-09-07 08:25:55 +00:00
parent 045208bf52
commit a6d147de42
9 changed files with 53 additions and 45 deletions

View File

@@ -65,8 +65,10 @@ add_task(async function test_discovery() {
});
// Test the addition of a new container.
let changed = TestUtils.topicObserved("cookie-changed", (subject, data) => {
let cookie = subject.QueryInterface(Ci.nsICookie);
let changed = TestUtils.topicObserved("cookie-changed", subject => {
let cookie = subject
.QueryInterface(Ci.nsICookieNotification)
.cookie.QueryInterface(Ci.nsICookie);
equal(cookie.name, TAAR_COOKIE_NAME, "taar cookie exists");
equal(cookie.host, uri.host, "cookie exists for host");
equal(
@@ -119,11 +121,12 @@ add_task(async function test_discovery() {
});
// Make sure clientId changes update discovery
changed = TestUtils.topicObserved("cookie-changed", (subject, data) => {
if (data !== "added") {
changed = TestUtils.topicObserved("cookie-changed", subject => {
let notification = subject.QueryInterface(Ci.nsICookieNotification);
if (notification.action != Ci.nsICookieNotification.COOKIE_ADDED) {
return false;
}
let cookie = subject.QueryInterface(Ci.nsICookie);
let cookie = notification.cookie.QueryInterface(Ci.nsICookie);
equal(cookie.name, TAAR_COOKIE_NAME, "taar cookie exists");
equal(cookie.host, uri.host, "cookie exists for host");
return true;