Bug 793370 - crash in nsWebShellWindow::Initialize, r=smaug+bz

This commit is contained in:
bobbyholley+bmo@gmail.com 2012-09-30 22:10:37 +03:00
parent 38529e6433
commit a0d60e7f8f

View File

@ -204,17 +204,18 @@ nsresult nsWebShellWindow::Initialize(nsIXULWindow* aParent,
// top-level chrome window case. See bug 789773.
nsCOMPtr<nsIScriptSecurityManager> ssm =
do_GetService(NS_SCRIPTSECURITYMANAGER_CONTRACTID, &rv);
MOZ_ASSERT(NS_SUCCEEDED(rv) && ssm);
nsCOMPtr<nsIPrincipal> principal;
ssm->GetSubjectPrincipal(getter_AddRefs(principal));
if (!principal) {
ssm->GetSystemPrincipal(getter_AddRefs(principal));
if (ssm) { // Sometimes this happens really early See bug 793370.
nsCOMPtr<nsIPrincipal> principal;
ssm->GetSubjectPrincipal(getter_AddRefs(principal));
if (!principal) {
ssm->GetSystemPrincipal(getter_AddRefs(principal));
}
rv = mDocShell->CreateAboutBlankContentViewer(principal);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIDocument> doc = do_GetInterface(mDocShell);
NS_ENSURE_TRUE(!!doc, NS_ERROR_FAILURE);
doc->SetIsInitialDocument(true);
}
rv = mDocShell->CreateAboutBlankContentViewer(principal);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIDocument> doc = do_GetInterface(mDocShell);
NS_ENSURE_TRUE(!!doc, NS_ERROR_FAILURE);
doc->SetIsInitialDocument(true);
if (nullptr != aUrl) {
nsCString tmpStr;