Bug 1579209 - [Protections Panel] Use new STATE_COOKIES_LOADED_TRACKER for cookies category item visibility logic. r=johannh

Differential Revision: https://phabricator.services.mozilla.com/D47323

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Nihanth Subramanya 2019-09-27 10:41:48 +00:00
Родитель e0740e7784
Коммит fbae672ca0
2 изменённых файлов: 15 добавлений и 11 удалений

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

@ -672,20 +672,22 @@ var ThirdPartyCookies = {
},
isDetected(state) {
if (this.behaviorPref == Ci.nsICookieService.BEHAVIOR_REJECT_TRACKER) {
// We don't have a state that specifically represents loaded tracker cookies,
// so use loaded tracking content as a proxy - it's not perfect but it
// yields fewer false-positives than the generic loaded cookies state.
if (this.isBlocking(state)) {
return true;
}
if (
this.behaviorPref == Ci.nsICookieService.BEHAVIOR_REJECT_TRACKER ||
this.behaviorPref == Ci.nsICookieService.BEHAVIOR_ACCEPT
) {
return (
(state & Ci.nsIWebProgressListener.STATE_LOADED_TRACKING_CONTENT) != 0
(state & Ci.nsIWebProgressListener.STATE_COOKIES_LOADED_TRACKER) != 0
);
}
// We don't have any proxies for the other cookie behaviors unfortunately.
return (
this.isBlocking(state) ||
(state & Ci.nsIWebProgressListener.STATE_COOKIES_LOADED) != 0
);
// We don't have specific flags for the other cookie behaviors so just
// fall back to STATE_COOKIES_LOADED.
return (state & Ci.nsIWebProgressListener.STATE_COOKIES_LOADED) != 0;
},
async updateSubView() {

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

@ -7,6 +7,8 @@ const TP_PREF = "privacy.trackingprotection.enabled";
const TPC_PREF = "network.cookie.cookieBehavior";
const TRACKING_PAGE =
"http://tracking.example.org/browser/browser/base/content/test/trackingUI/trackingPage.html";
const COOKIE_PAGE =
"http://tracking.example.com/browser/browser/base/content/test/trackingUI/cookiePage.html";
async function waitAndAssertPreferencesShown(_spotlight, identityPopup) {
await BrowserTestUtils.waitForEvent(
@ -103,7 +105,7 @@ add_task(async function testOpenPreferencesFromCookiesSubview() {
);
let promise = BrowserTestUtils.openNewForegroundTab({
url: TRACKING_PAGE,
url: COOKIE_PAGE,
gBrowser,
});