Bug 1574111 - Improve the definition of ThirdPartyCookies.isDetected. r=johannh

Differential Revision: https://phabricator.services.mozilla.com/D43464
This commit is contained in:
Nihanth Subramanya
2019-08-30 14:19:43 +00:00
parent e18eb1c1fe
commit cea5ee97e2
2 changed files with 19 additions and 3 deletions

View File

@@ -665,7 +665,20 @@ var ThirdPartyCookies = {
},
isDetected(state) {
return (state & Ci.nsIWebProgressListener.STATE_COOKIES_LOADED) != 0;
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.
return (
(state & Ci.nsIWebProgressListener.STATE_LOADED_TRACKING_CONTENT) != 0
);
}
// We don't have any proxies for the other cookie behaviors unfortunately.
return (
this.isBlocking(state) ||
(state & Ci.nsIWebProgressListener.STATE_COOKIES_LOADED) != 0
);
},
async updateSubView() {
@@ -678,7 +691,10 @@ var ThirdPartyCookies = {
for (let category of ["firstParty", "trackers", "thirdParty"]) {
let itemsToShow;
if (category == "trackers" && gProtectionsHandler.hasException) {
if (
category == "trackers" &&
(gProtectionsHandler.hasException || !this.enabled)
) {
itemsToShow = categories[category];
} else {
itemsToShow = categories[category].filter(