зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1361823 Fail the worker script load instead of crashing if the load group is torn down. r=baku
This commit is contained in:
Родитель
c1d1748428
Коммит
4a9335fcd3
|
@ -902,7 +902,9 @@ private:
|
|||
nsIPrincipal* principal = mWorkerPrivate->GetPrincipal();
|
||||
nsCOMPtr<nsILoadGroup> loadGroup = mWorkerPrivate->GetLoadGroup();
|
||||
MOZ_DIAGNOSTIC_ASSERT(principal);
|
||||
MOZ_ASSERT(NS_LoadGroupMatchesPrincipal(loadGroup, principal));
|
||||
|
||||
NS_ENSURE_TRUE(NS_LoadGroupMatchesPrincipal(loadGroup, principal),
|
||||
NS_ERROR_FAILURE);
|
||||
|
||||
// Figure out our base URI.
|
||||
nsCOMPtr<nsIURI> baseURI = GetBaseURI(mIsMainScript, mWorkerPrivate);
|
||||
|
|
|
@ -4798,6 +4798,7 @@ WorkerPrivate::GetLoadInfo(JSContext* aCx, nsPIDOMWindowInner* aWindow,
|
|||
|
||||
loadInfo.mBaseURI = document->GetDocBaseURI();
|
||||
loadInfo.mLoadGroup = document->GetDocumentLoadGroup();
|
||||
NS_ENSURE_TRUE(loadInfo.mLoadGroup, NS_ERROR_FAILURE);
|
||||
|
||||
// Use the document's NodePrincipal as our principal if we're not being
|
||||
// called from chrome.
|
||||
|
@ -4833,6 +4834,10 @@ WorkerPrivate::GetLoadInfo(JSContext* aCx, nsPIDOMWindowInner* aWindow,
|
|||
}
|
||||
}
|
||||
|
||||
NS_ENSURE_TRUE(NS_LoadGroupMatchesPrincipal(loadInfo.mLoadGroup,
|
||||
loadInfo.mPrincipal),
|
||||
NS_ERROR_FAILURE);
|
||||
|
||||
nsCOMPtr<nsIPermissionManager> permMgr =
|
||||
do_GetService(NS_PERMISSIONMANAGER_CONTRACTID, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
@ -4951,6 +4956,9 @@ WorkerPrivate::OverrideLoadInfoLoadGroup(WorkerLoadInfo& aLoadInfo)
|
|||
MOZ_ALWAYS_SUCCEEDS(rv);
|
||||
|
||||
aLoadInfo.mLoadGroup = loadGroup.forget();
|
||||
|
||||
MOZ_ASSERT(NS_LoadGroupMatchesPrincipal(aLoadInfo.mLoadGroup,
|
||||
aLoadInfo.mPrincipal));
|
||||
}
|
||||
|
||||
void
|
||||
|
|
Загрузка…
Ссылка в новой задаче