Bug 1303682 - Add deprecation warning before removing 'referrer' directive from CSP. r=ckerschb

This commit is contained in:
Samriddhi Jain 2016-09-28 20:17:18 +05:30
Родитель ebb9f983f1
Коммит 40e1a53f35
2 изменённых файлов: 8 добавлений и 0 удалений

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

@ -77,6 +77,9 @@ ignoringDirectiveWithNoValues = Ignoring %1$S since it does not contain an
# LOCALIZATION NOTE (ignoringReportOnlyDirective):
# %1$S is the directive that is ignored in report-only mode.
ignoringReportOnlyDirective = Ignoring sandbox directive when delivered in a report-only policy %1$S
# LOCALIZATION NOTE (deprecatedReferrerDirective):
# %1$S is the value of the deprecated Referrer Directive.
deprecatedReferrerDirective = Referrer Directive %1$S has been deprecated. Please use the Referrer-Policy header instead.
# CSP Errors:
# LOCALIZATION NOTE (couldntParseInvalidSource):

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

@ -865,6 +865,11 @@ nsCSPParser::referrerDirectiveValue(nsCSPDirective* aDir)
return;
}
//referrer-directive deprecation warning
const char16_t* params[] = { mCurDir[1].get() };
logWarningErrorToConsole(nsIScriptError::warningFlag, "deprecatedReferrerDirective",
params, ArrayLength(params));
// the referrer policy is valid, so go ahead and use it.
mPolicy->setReferrerPolicy(&mCurDir[1]);
mPolicy->addDirective(aDir);