зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1338523 Make worker SetPrincipalOnMainThread fallible. r=baku
This commit is contained in:
Родитель
774823dcf7
Коммит
9c8728e4a8
|
@ -1247,7 +1247,8 @@ private:
|
|||
MOZ_ASSERT(equal);
|
||||
|
||||
mWorkerPrivate->InitChannelInfo(aChannelInfo);
|
||||
mWorkerPrivate->SetPrincipalOnMainThread(responsePrincipal, loadGroup);
|
||||
rv = mWorkerPrivate->SetPrincipalOnMainThread(responsePrincipal, loadGroup);
|
||||
MOZ_DIAGNOSTIC_ASSERT(NS_SUCCEEDED(rv));
|
||||
}
|
||||
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
|
|
|
@ -1835,7 +1835,7 @@ WorkerLoadInfo::StealFrom(WorkerLoadInfo& aOther)
|
|||
mOriginAttributes = aOther.mOriginAttributes;
|
||||
}
|
||||
|
||||
void
|
||||
nsresult
|
||||
WorkerLoadInfo::SetPrincipalOnMainThread(nsIPrincipal* aPrincipal,
|
||||
nsILoadGroup* aLoadGroup)
|
||||
{
|
||||
|
@ -1846,7 +1846,8 @@ WorkerLoadInfo::SetPrincipalOnMainThread(nsIPrincipal* aPrincipal,
|
|||
mPrincipal = aPrincipal;
|
||||
mPrincipalIsSystem = nsContentUtils::IsSystemPrincipal(aPrincipal);
|
||||
|
||||
aPrincipal->GetCsp(getter_AddRefs(mCSP));
|
||||
nsresult rv = aPrincipal->GetCsp(getter_AddRefs(mCSP));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (mCSP) {
|
||||
mCSP->GetAllowsEval(&mReportCSPViolations, &mEvalAllowed);
|
||||
|
@ -1854,8 +1855,8 @@ WorkerLoadInfo::SetPrincipalOnMainThread(nsIPrincipal* aPrincipal,
|
|||
bool hasReferrerPolicy = false;
|
||||
uint32_t rp = mozilla::net::RP_Unset;
|
||||
|
||||
nsresult rv = mCSP->GetReferrerPolicy(&rp, &hasReferrerPolicy);
|
||||
NS_ENSURE_SUCCESS_VOID(rv);
|
||||
rv = mCSP->GetReferrerPolicy(&rp, &hasReferrerPolicy);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (hasReferrerPolicy) {
|
||||
mReferrerPolicy = static_cast<net::ReferrerPolicy>(rp);
|
||||
|
@ -1870,8 +1871,10 @@ WorkerLoadInfo::SetPrincipalOnMainThread(nsIPrincipal* aPrincipal,
|
|||
mPrincipalInfo = new PrincipalInfo();
|
||||
mOriginAttributes = nsContentUtils::GetOriginAttributes(aLoadGroup);
|
||||
|
||||
MOZ_ALWAYS_SUCCEEDS(
|
||||
PrincipalToPrincipalInfo(aPrincipal, mPrincipalInfo));
|
||||
rv = PrincipalToPrincipalInfo(aPrincipal, mPrincipalInfo);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
@ -1953,8 +1956,7 @@ WorkerLoadInfo::SetPrincipalFromChannel(nsIChannel* aChannel)
|
|||
getter_AddRefs(loadGroup));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
SetPrincipalOnMainThread(principal, loadGroup);
|
||||
return NS_OK;
|
||||
return SetPrincipalOnMainThread(principal, loadGroup);
|
||||
}
|
||||
|
||||
#if defined(DEBUG) || !defined(RELEASE_OR_BETA)
|
||||
|
@ -3803,11 +3805,11 @@ WorkerPrivateParent<Derived>::SetBaseURI(nsIURI* aBaseURI)
|
|||
}
|
||||
|
||||
template <class Derived>
|
||||
void
|
||||
nsresult
|
||||
WorkerPrivateParent<Derived>::SetPrincipalOnMainThread(nsIPrincipal* aPrincipal,
|
||||
nsILoadGroup* aLoadGroup)
|
||||
{
|
||||
mLoadInfo.SetPrincipalOnMainThread(aPrincipal, aLoadGroup);
|
||||
return mLoadInfo.SetPrincipalOnMainThread(aPrincipal, aLoadGroup);
|
||||
}
|
||||
|
||||
template <class Derived>
|
||||
|
|
|
@ -607,7 +607,7 @@ public:
|
|||
return mLoadInfo.mPrincipal;
|
||||
}
|
||||
|
||||
void
|
||||
nsresult
|
||||
SetPrincipalOnMainThread(nsIPrincipal* aPrincipal, nsILoadGroup* aLoadGroup);
|
||||
|
||||
nsresult
|
||||
|
|
|
@ -278,7 +278,7 @@ struct WorkerLoadInfo
|
|||
|
||||
void StealFrom(WorkerLoadInfo& aOther);
|
||||
|
||||
void
|
||||
nsresult
|
||||
SetPrincipalOnMainThread(nsIPrincipal* aPrincipal, nsILoadGroup* aLoadGroup);
|
||||
|
||||
nsresult
|
||||
|
|
Загрузка…
Ссылка в новой задаче