Bug 1679489 - Add test cases to check the cookieJarSettings of the browser object. r=dimi

Depends on D98053

Differential Revision: https://phabricator.services.mozilla.com/D98141
This commit is contained in:
Tim Huang 2020-11-30 12:00:09 +00:00
Родитель 95be6604ef
Коммит cbf270e16d
3 изменённых файлов: 45 добавлений и 0 удалений

Просмотреть файл

@ -672,6 +672,17 @@ this.AntiTracking = {
let browser = win.gBrowser.getBrowserForTab(tab);
await BrowserTestUtils.browserLoaded(browser);
info("Check the cookieJarSettings of the browser object");
ok(
browser.cookieJarSettings,
"The browser object has the cookieJarSettings."
);
is(
browser.cookieJarSettings.cookieBehavior,
options.cookieBehavior,
"The cookieJarSettings has the correct cookieBehavior"
);
if (options.allowList) {
info("Disabling content blocking for this page");
win.gProtectionsHandler.disableForCurrentPage();

Просмотреть файл

@ -30,6 +30,7 @@ this.DynamicFPIHelper = {
["privacy.trackingprotection.pbmode.enabled", false],
["privacy.trackingprotection.annotate_channels", true],
["privacy.storagePrincipal.enabledForTrackers", false],
["privacy.dynamic_firstparty.use_site", true],
[
"privacy.restrict3rdpartystorage.userInteractionRequiredForHosts",
"not-tracking.example.com",
@ -54,6 +55,22 @@ this.DynamicFPIHelper = {
let browser = win.gBrowser.getBrowserForTab(tab);
await BrowserTestUtils.browserLoaded(browser);
info("Check the cookieJarSettings of the browser object");
ok(
browser.cookieJarSettings,
"The browser object has the cookieJarSettings."
);
is(
browser.cookieJarSettings.cookieBehavior,
Ci.nsICookieService.BEHAVIOR_REJECT_TRACKER_AND_PARTITION_FOREIGN,
"The cookieJarSettings has the correct cookieBehavior"
);
is(
browser.cookieJarSettings.partitionKey,
"(http,example.net)",
"The cookieJarSettings has the correct partitionKey"
);
info("Creating a 3rd party content");
await SpecialPowers.spawn(
browser,

Просмотреть файл

@ -30,6 +30,7 @@ this.StoragePrincipalHelper = {
["privacy.trackingprotection.pbmode.enabled", false],
["privacy.trackingprotection.annotate_channels", true],
["privacy.storagePrincipal.enabledForTrackers", true],
["privacy.dynamic_firstparty.use_site", true],
[
"privacy.restrict3rdpartystorage.userInteractionRequiredForHosts",
"tracking.example.org",
@ -56,6 +57,22 @@ this.StoragePrincipalHelper = {
let browser = win.gBrowser.getBrowserForTab(tab);
await BrowserTestUtils.browserLoaded(browser);
info("Check the cookieJarSettings of the browser object");
ok(
browser.cookieJarSettings,
"The browser object has the cookieJarSettings."
);
is(
browser.cookieJarSettings.cookieBehavior,
Ci.nsICookieService.BEHAVIOR_REJECT_TRACKER,
"The cookieJarSettings has the correct cookieBehavior"
);
is(
browser.cookieJarSettings.partitionKey,
"(http,example.net)",
"The cookieJarSettings has the correct partitionKey"
);
info("Creating a 3rd party content");
await SpecialPowers.spawn(
browser,