Re-checking-in workaround fix for 79775 - don't call GetSubjectPrincipal for chrome URLs, as this sometimes causes a failure and is not necessary for chrome URLs anyway. Fixed a crasher by moving the initialization of LoadInfo out of the if block. r=vidur, sr=jst.

git-svn-id: svn://10.0.0.236/trunk@95494 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
mstoltz%netscape.com 2001-05-19 01:40:52 +00:00
parent dc278f10de
commit c0d9b31b40

View File

@ -630,17 +630,21 @@ nsWindowWatcher::OpenWindowJS(nsIDOMWindow *aParent,
nsCOMPtr<nsIDocShell> newDocShell(do_QueryInterface(newDocShellItem));
if (uriToLoad) { // Get script principal and pass to docshell
nsCOMPtr<nsIPrincipal> principal;
if (NS_FAILED(secMan->GetSubjectPrincipal(getter_AddRefs(principal))))
return NS_ERROR_FAILURE;
nsCOMPtr<nsIDocShellLoadInfo> loadInfo;
newDocShell->CreateLoadInfo(getter_AddRefs(loadInfo));
NS_ENSURE_TRUE(loadInfo, NS_ERROR_FAILURE);
if (principal) {
nsCOMPtr<nsISupports> owner(do_QueryInterface(principal));
loadInfo->SetOwner(owner);
PRBool isChrome = PR_FALSE;
rv = uriToLoad->SchemeIs("chrome", &isChrome);
if (NS_FAILED(rv) || !isChrome) {
nsCOMPtr<nsIPrincipal> principal;
if (NS_FAILED(secMan->GetSubjectPrincipal(getter_AddRefs(principal))))
return NS_ERROR_FAILURE;
if (principal) {
nsCOMPtr<nsISupports> owner(do_QueryInterface(principal));
loadInfo->SetOwner(owner);
}
}
// Get the calling context off the JS context stack