Bug 1475697 - Part 2: Add infrastructure for notifying the DOM about a document containing blocked tracking cookies; r=baku

This commit is contained in:
Ehsan Akhgari 2018-07-17 06:12:00 +03:00
Родитель 51cc2694b0
Коммит ac25ec44da
3 изменённых файлов: 29 добавлений и 4 удалений

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

@ -5377,6 +5377,8 @@ nsGlobalWindowOuter::NotifyContentBlockingState(unsigned aState,
securityUI->GetState(&state); securityUI->GetState(&state);
if (aState == nsIWebProgressListener::STATE_BLOCKED_TRACKING_CONTENT) { if (aState == nsIWebProgressListener::STATE_BLOCKED_TRACKING_CONTENT) {
doc->SetHasTrackingContentBlocked(true); doc->SetHasTrackingContentBlocked(true);
} else if (aState == nsIWebProgressListener::STATE_BLOCKED_TRACKING_COOKIES) {
doc->SetHasTrackingCookiesBlocked(true);
} else { } else {
// Ignore nsIWebProgressListener::STATE_BLOCKED_UNSAFE_CONTENT; // Ignore nsIWebProgressListener::STATE_BLOCKED_UNSAFE_CONTENT;
} }

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

@ -992,6 +992,14 @@ public:
return mHasTrackingContentBlocked; return mHasTrackingContentBlocked;
} }
/**
* Get tracking cookies blocked flag for this document.
*/
bool GetHasTrackingCookiesBlocked()
{
return mHasTrackingCookiesBlocked;
}
/** /**
* Set the tracking content blocked flag for this document. * Set the tracking content blocked flag for this document.
*/ */
@ -1000,6 +1008,14 @@ public:
mHasTrackingContentBlocked = aHasTrackingContentBlocked; mHasTrackingContentBlocked = aHasTrackingContentBlocked;
} }
/**
* Set the tracking cookies blocked flag for this document.
*/
void SetHasTrackingCookiesBlocked(bool aHasTrackingCookiesBlocked)
{
mHasTrackingCookiesBlocked = aHasTrackingCookiesBlocked;
}
/** /**
* Get tracking content loaded flag for this document. * Get tracking content loaded flag for this document.
*/ */
@ -3905,6 +3921,9 @@ protected:
// True if a document has blocked Tracking Content // True if a document has blocked Tracking Content
bool mHasTrackingContentBlocked : 1; bool mHasTrackingContentBlocked : 1;
// True if a document has blocked Tracking Cookies
bool mHasTrackingCookiesBlocked : 1;
// True if a document has loaded Tracking Content // True if a document has loaded Tracking Content
bool mHasTrackingContentLoaded : 1; bool mHasTrackingContentLoaded : 1;

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

@ -218,10 +218,14 @@ interface nsIWebProgressListener : nsISupports
* *
* STATE_BLOCKED_UNSAFE_CONTENT * STATE_BLOCKED_UNSAFE_CONTENT
* Content which againts SafeBrowsing list has been blocked from loading. * Content which againts SafeBrowsing list has been blocked from loading.
*
* STATE_BLOCKED_TRACKING_COOKIES
* Tracking cookies has been blocked from loading.
*/ */
const unsigned long STATE_BLOCKED_TRACKING_CONTENT = 0x00001000; const unsigned long STATE_BLOCKED_TRACKING_CONTENT = 0x00001000;
const unsigned long STATE_LOADED_TRACKING_CONTENT = 0x00002000; const unsigned long STATE_LOADED_TRACKING_CONTENT = 0x00002000;
const unsigned long STATE_BLOCKED_UNSAFE_CONTENT = 0x00004000; const unsigned long STATE_BLOCKED_UNSAFE_CONTENT = 0x00004000;
const unsigned long STATE_BLOCKED_TRACKING_COOKIES = 0x00008000;
/** /**
* Diagnostic flags * Diagnostic flags
@ -233,7 +237,7 @@ interface nsIWebProgressListener : nsISupports
* STATE_CERT_DISTRUST_IMMINENT * STATE_CERT_DISTRUST_IMMINENT
* The certificate in use will be distrusted in the near future. * The certificate in use will be distrusted in the near future.
*/ */
const unsigned long STATE_CERT_DISTRUST_IMMINENT = 0x00008000; const unsigned long STATE_CERT_DISTRUST_IMMINENT = 0x00010000;
/** /**
* Security Strength Flags * Security Strength Flags
@ -256,9 +260,9 @@ interface nsIWebProgressListener : nsISupports
* STATE_SECURE_LOW * STATE_SECURE_LOW
* This flag indicates a low degree of security. * This flag indicates a low degree of security.
*/ */
const unsigned long STATE_SECURE_HIGH = 0x00040000; const unsigned long STATE_SECURE_HIGH = 0x00080000;
const unsigned long STATE_SECURE_MED = 0x00010000; const unsigned long STATE_SECURE_MED = 0x00020000;
const unsigned long STATE_SECURE_LOW = 0x00020000; const unsigned long STATE_SECURE_LOW = 0x00040000;
/** /**
* State bits for EV == Extended Validation == High Assurance * State bits for EV == Extended Validation == High Assurance