mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-11-07 11:48:19 +02:00
This patch updates the pref for existing content blocking tests. And it also adds a new test to verify that the cookieBehavior in regular windowa and private window are both correct. Differential Revision: https://phabricator.services.mozilla.com/D109046
59 lines
1.7 KiB
JavaScript
59 lines
1.7 KiB
JavaScript
add_task(async function() {
|
|
await SpecialPowers.flushPrefEnv();
|
|
await SpecialPowers.pushPrefEnv({
|
|
set: [
|
|
["dom.storage_access.enabled", true],
|
|
["network.cookie.cookieBehavior", BEHAVIOR_REJECT],
|
|
["network.cookie.cookieBehavior.pbmode", BEHAVIOR_REJECT],
|
|
["privacy.trackingprotection.enabled", false],
|
|
["privacy.trackingprotection.pbmode.enabled", false],
|
|
["privacy.trackingprotection.annotate_channels", true],
|
|
["dom.ipc.processCount", 4],
|
|
],
|
|
});
|
|
|
|
info("First tab opened");
|
|
let tab = BrowserTestUtils.addTab(
|
|
gBrowser,
|
|
TEST_DOMAIN + TEST_PATH + "empty.html"
|
|
);
|
|
gBrowser.selectedTab = tab;
|
|
|
|
let browser = gBrowser.getBrowserForTab(tab);
|
|
await BrowserTestUtils.browserLoaded(browser);
|
|
|
|
info("Disabling content blocking for this page");
|
|
gProtectionsHandler.disableForCurrentPage();
|
|
|
|
await BrowserTestUtils.browserLoaded(browser);
|
|
|
|
await SpecialPowers.spawn(browser, [], async _ => {
|
|
is(content.document.cookie, "", "No cookie set");
|
|
content.document.cookie = "a=b";
|
|
is(content.document.cookie, "a=b", "Cookie set");
|
|
});
|
|
|
|
info("Second tab opened");
|
|
let tab2 = BrowserTestUtils.addTab(
|
|
gBrowser,
|
|
TEST_DOMAIN + TEST_PATH + "empty.html"
|
|
);
|
|
gBrowser.selectedTab = tab2;
|
|
|
|
let browser2 = gBrowser.getBrowserForTab(tab2);
|
|
await BrowserTestUtils.browserLoaded(browser2);
|
|
|
|
await SpecialPowers.spawn(browser2, [], async _ => {
|
|
is(content.document.cookie, "a=b", "Cookie set");
|
|
});
|
|
|
|
info("Removing tabs");
|
|
BrowserTestUtils.removeTab(tab);
|
|
BrowserTestUtils.removeTab(tab2);
|
|
|
|
await new Promise(resolve => {
|
|
Services.clearData.deleteData(Ci.nsIClearDataService.CLEAR_ALL, value =>
|
|
resolve()
|
|
);
|
|
});
|
|
});
|