mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-28 07:13:20 +00:00
Bug 1510860 - Ensure that the cookie service checks the content blocking allow list even for first-party cookies since that's required when we're blocking all cookies; r=baku
Differential Revision: https://phabricator.services.mozilla.com/D15109
This commit is contained in:
parent
a4d958568d
commit
aa81b3cc6c
@ -1998,8 +1998,8 @@ nsresult nsCookieService::GetCookieStringCommon(nsIURI *aHostURI,
|
||||
// Check first-party storage access even for non-tracking resources, since
|
||||
// we will need the result when computing the access rights for the reject
|
||||
// foreign cookie behavior mode.
|
||||
if (isForeign && AntiTrackingCommon::IsFirstPartyStorageAccessGrantedFor(
|
||||
httpChannel, aHostURI, nullptr)) {
|
||||
if (AntiTrackingCommon::IsFirstPartyStorageAccessGrantedFor(
|
||||
httpChannel, aHostURI, nullptr)) {
|
||||
firstPartyStorageAccessGranted = true;
|
||||
}
|
||||
}
|
||||
@ -2099,8 +2099,8 @@ nsresult nsCookieService::SetCookieStringCommon(nsIURI *aHostURI,
|
||||
// Check first-party storage access even for non-tracking resources, since
|
||||
// we will need the result when computing the access rights for the reject
|
||||
// foreign cookie behavior mode.
|
||||
if (isForeign && AntiTrackingCommon::IsFirstPartyStorageAccessGrantedFor(
|
||||
httpChannel, aHostURI, nullptr)) {
|
||||
if (AntiTrackingCommon::IsFirstPartyStorageAccessGrantedFor(
|
||||
httpChannel, aHostURI, nullptr)) {
|
||||
firstPartyStorageAccessGranted = true;
|
||||
}
|
||||
}
|
||||
|
@ -41,6 +41,7 @@ skip-if = (os == "win" && os_version == "6.1" && bits == 32 && !debug) # Bug 149
|
||||
[browser_blockingNoOpener.js]
|
||||
[browser_doublyNestedTracker.js]
|
||||
[browser_existingCookiesForSubresources.js]
|
||||
[browser_firstPartyCookieRejectionHonoursAllowList.js]
|
||||
[browser_imageCache4.js]
|
||||
[browser_imageCache4-1.js]
|
||||
[browser_imageCache4-2.js]
|
||||
|
@ -0,0 +1,69 @@
|
||||
ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
add_task(async function() {
|
||||
info("Starting subResources test");
|
||||
|
||||
await SpecialPowers.flushPrefEnv();
|
||||
await SpecialPowers.pushPrefEnv({"set": [
|
||||
["browser.contentblocking.allowlist.annotations.enabled", true],
|
||||
["browser.contentblocking.allowlist.storage.enabled", true],
|
||||
["network.cookie.cookieBehavior", Ci.nsICookieService.BEHAVIOR_REJECT],
|
||||
["privacy.trackingprotection.enabled", false],
|
||||
["privacy.trackingprotection.pbmode.enabled", false],
|
||||
["privacy.trackingprotection.annotate_channels", true],
|
||||
]});
|
||||
|
||||
let tab = BrowserTestUtils.addTab(gBrowser, TEST_TOP_PAGE);
|
||||
gBrowser.selectedTab = tab;
|
||||
|
||||
let browser = gBrowser.getBrowserForTab(tab);
|
||||
await BrowserTestUtils.browserLoaded(browser);
|
||||
|
||||
info("Disabling content blocking for this page");
|
||||
ContentBlocking.disableForCurrentPage();
|
||||
|
||||
// The previous function reloads the browser, so wait for it to load again!
|
||||
await BrowserTestUtils.browserLoaded(browser);
|
||||
|
||||
await ContentTask.spawn(browser, {},
|
||||
async function(obj) {
|
||||
await new content.Promise(async resolve => {
|
||||
let document = content.document;
|
||||
let window = document.defaultView;
|
||||
|
||||
is(document.cookie, "", "No cookies for me");
|
||||
|
||||
await window.fetch("server.sjs").then(r => r.text()).then(text => {
|
||||
is(text, "cookie-not-present", "We should not have cookies");
|
||||
});
|
||||
|
||||
document.cookie = "name=value";
|
||||
ok(document.cookie.includes("name=value"), "Some cookies for me");
|
||||
ok(document.cookie.includes("foopy=1"), "Some cookies for me");
|
||||
|
||||
await window.fetch("server.sjs").then(r => r.text()).then(text => {
|
||||
is(text, "cookie-present", "We should have cookies");
|
||||
});
|
||||
|
||||
ok(document.cookie.length, "Some Cookies for me");
|
||||
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
|
||||
info("Enabling content blocking for this page");
|
||||
ContentBlocking.enableForCurrentPage();
|
||||
|
||||
// The previous function reloads the browser, so wait for it to load again!
|
||||
await BrowserTestUtils.browserLoaded(browser);
|
||||
|
||||
BrowserTestUtils.removeTab(tab);
|
||||
});
|
||||
|
||||
add_task(async function() {
|
||||
info("Cleaning up.");
|
||||
await new Promise(resolve => {
|
||||
Services.clearData.deleteData(Ci.nsIClearDataService.CLEAR_ALL, value => resolve());
|
||||
});
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user