зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1303685: Add telemetry for CSP referrer directive. r=ckerschb,francois
This commit is contained in:
Родитель
3d3a99a102
Коммит
265b3a3710
|
@ -1430,6 +1430,7 @@ nsDocument::~nsDocument()
|
|||
// record CSP telemetry on this document
|
||||
if (mHasCSP) {
|
||||
Accumulate(Telemetry::CSP_DOCUMENTS_COUNT, 1);
|
||||
Accumulate(Telemetry::CSP_REFERRER_DIRECTIVE, mHasReferrerPolicyCSP);
|
||||
}
|
||||
if (mHasUnsafeInlineCSP) {
|
||||
Accumulate(Telemetry::CSP_UNSAFE_INLINE_DOCUMENTS_COUNT, 1);
|
||||
|
|
|
@ -707,6 +707,14 @@ public:
|
|||
return mHasMixedDisplayContentBlocked;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set referrer policy CSP flag for this document.
|
||||
*/
|
||||
void SetHasReferrerPolicyCSP(bool aHasReferrerPolicyCSP)
|
||||
{
|
||||
mHasReferrerPolicyCSP = aHasReferrerPolicyCSP;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the mixed display content blocked flag for this document.
|
||||
*/
|
||||
|
@ -3080,6 +3088,9 @@ protected:
|
|||
// it's false only when we're in bfcache or unloaded.
|
||||
bool mVisible : 1;
|
||||
|
||||
// True if a document load has a CSP with referrer attached.
|
||||
bool mHasReferrerPolicyCSP : 1;
|
||||
|
||||
// True if our content viewer has been removed from the docshell
|
||||
// (it may still be displayed, but in zombie state). Form control data
|
||||
// has been saved.
|
||||
|
|
|
@ -924,6 +924,11 @@ nsCSPParser::referrerDirectiveValue(nsCSPDirective* aDir)
|
|||
params, ArrayLength(params));
|
||||
|
||||
// the referrer policy is valid, so go ahead and use it.
|
||||
nsWeakPtr ctx = mCSPContext->GetLoadingContext();
|
||||
nsCOMPtr<nsIDocument> doc = do_QueryReferent(ctx);
|
||||
if (doc) {
|
||||
doc->SetHasReferrerPolicyCSP(true);
|
||||
}
|
||||
mPolicy->setReferrerPolicy(&mCurDir[1]);
|
||||
mPolicy->addDirective(aDir);
|
||||
}
|
||||
|
|
|
@ -4236,6 +4236,13 @@
|
|||
"kind": "count",
|
||||
"description": "Number of unique pages that contain an unsafe-eval CSP directive"
|
||||
},
|
||||
"CSP_REFERRER_DIRECTIVE": {
|
||||
"alert_emails": ["seceng-telemetry@mozilla.com"],
|
||||
"bug_numbers": [1303685],
|
||||
"expires_in_version": "56",
|
||||
"kind": "boolean",
|
||||
"description": "Whether a document with a CSP policy (report-only or enforcing) contains a referrer directive ('true') or not ('false')."
|
||||
},
|
||||
"PLACES_PAGES_COUNT": {
|
||||
"expires_in_version": "never",
|
||||
"kind": "exponential",
|
||||
|
|
Загрузка…
Ссылка в новой задаче