Bug 1839918 - Update tests for nsICookieNotification. r=cookie-reviewers,sessionstore-reviewers,bvandersloot,valentin
Depends on D185301 Differential Revision: https://phabricator.services.mozilla.com/D185302
This commit is contained in:
@@ -28,12 +28,13 @@ function waitForNewCookie({ host, name, value }) {
|
||||
info(`waiting for cookie ${name}=${value} from ${host}...`);
|
||||
|
||||
return new Promise(resolve => {
|
||||
Services.obs.addObserver(function observer(subj, topic, data) {
|
||||
if (data != "added") {
|
||||
Services.obs.addObserver(function observer(subj, topic) {
|
||||
let notification = subj.QueryInterface(Ci.nsICookieNotification);
|
||||
if (notification.action != Ci.nsICookieNotification.COOKIE_ADDED) {
|
||||
return;
|
||||
}
|
||||
|
||||
let cookie = subj.QueryInterface(Ci.nsICookie);
|
||||
let cookie = notification.cookie.QueryInterface(Ci.nsICookie);
|
||||
if (cookie.host == host && cookie.name == name && cookie.value == value) {
|
||||
ok(true, "cookie added by the cookie service");
|
||||
Services.obs.removeObserver(observer, topic);
|
||||
|
||||
@@ -113,8 +113,9 @@ async function openTabInUserContext(userContextId) {
|
||||
|
||||
function waitForNewCookie() {
|
||||
return new Promise(resolve => {
|
||||
Services.obs.addObserver(function observer(subj, topic, data) {
|
||||
if (data == "added") {
|
||||
Services.obs.addObserver(function observer(subj, topic) {
|
||||
let notification = subj.QueryInterface(Ci.nsICookieNotification);
|
||||
if (notification.action == Ci.nsICookieNotification.COOKIE_ADDED) {
|
||||
Services.obs.removeObserver(observer, topic);
|
||||
resolve();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user