Bug 1160458 - Part 1: Use the CSP of the principal passed to CreateServiceWorker. r=nsm

--HG--
extra : transplant_source : %5D%12%AE%F1%22%FAx%02g%D1C%3E%F7h%DB%AF%5C%A7PY
This commit is contained in:
Jose Antonio Olivera Ortega 2015-06-16 09:20:21 +02:00
Родитель 616f08b31b
Коммит 8e93c3cd23
1 изменённых файлов: 18 добавлений и 0 удалений

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

@ -3580,6 +3580,24 @@ ServiceWorkerManager::CreateServiceWorker(nsIPrincipal* aPrincipal,
info.mIndexedDBAllowed =
indexedDB::IDBFactory::AllowedForPrincipal(aPrincipal);
nsCOMPtr<nsIContentSecurityPolicy> csp;
rv = aPrincipal->GetCsp(getter_AddRefs(csp));
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
info.mCSP = csp;
if (info.mCSP) {
rv = info.mCSP->GetAllowsEval(&info.mReportCSPViolations,
&info.mEvalAllowed);
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
} else {
info.mEvalAllowed = true;
info.mReportCSPViolations = false;
}
// NOTE: this defaults the SW load context to:
// - private browsing = false
// - content = true