From 801efadc577f26085ecb9b1c3da88128e5d338cf Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Mon, 13 Apr 2009 11:33:27 -0400 Subject: [PATCH] Bug 485643. Remove some unnecessary code, r+sr=jst --- docshell/base/nsWebShell.cpp | 60 +++++++++--------------------------- 1 file changed, 15 insertions(+), 45 deletions(-) diff --git a/docshell/base/nsWebShell.cpp b/docshell/base/nsWebShell.cpp index fa8d788be00..848daaff8e1 100644 --- a/docshell/base/nsWebShell.cpp +++ b/docshell/base/nsWebShell.cpp @@ -822,43 +822,12 @@ nsWebShell::OnLinkClickSync(nsIContent *aContent, } } - nsCOMPtr node(do_QueryInterface(aContent)); - NS_ENSURE_TRUE(node, NS_ERROR_UNEXPECTED); - - PRBool inherit; - nsresult rv = URIInheritsSecurityContext(aURI, &inherit); - if (NS_FAILED(rv) || inherit) { - nsCOMPtr sourceDoc = aContent->GetDocument(); - - if (!sourceDoc) { - // The source is in a 'zombie' document, or not part of a - // document any more. Don't let it perform loads in this docshell. - // XXXbz why only for the inherit case? - - return NS_OK; - } - - nsCOMPtr presShell; - GetPresShell(getter_AddRefs(presShell)); - NS_ENSURE_TRUE(presShell, NS_ERROR_FAILURE); - - if (presShell->GetDocument() != sourceDoc) { - // The source is not in the current document, don't let it load anything - // that would inherit the principals of the current document. - - return NS_OK; - } - } - // Get the owner document of the link that was clicked, this will be // the document that the link is in, or the last document that the // link was in. From that document, we'll get the URI to use as the // referer, since the current URI in this webshell/docshell may be a // new document that we're in the process of loading. - nsCOMPtr refererOwnerDoc; - node->GetOwnerDocument(getter_AddRefs(refererOwnerDoc)); - - nsCOMPtr refererDoc(do_QueryInterface(refererOwnerDoc)); + nsCOMPtr refererDoc = aContent->GetOwnerDoc(); NS_ENSURE_TRUE(refererDoc, NS_ERROR_UNEXPECTED); nsCOMPtr referer = refererDoc->GetDocumentURI(); @@ -875,19 +844,20 @@ nsWebShell::OnLinkClickSync(nsIContent *aContent, anchor->GetType(typeHint); } - rv = InternalLoad(aURI, // New URI - referer, // Referer URI - aContent->NodePrincipal(), // Owner is our node's principal - INTERNAL_LOAD_FLAGS_NONE, - target.get(), // Window target - NS_LossyConvertUTF16toASCII(typeHint).get(), - aPostDataStream, // Post data stream - aHeadersDataStream, // Headers stream - LOAD_LINK, // Load type - nsnull, // No SHEntry - PR_TRUE, // first party site - aDocShell, // DocShell out-param - aRequest); // Request out-param + nsresult rv = InternalLoad(aURI, // New URI + referer, // Referer URI + aContent->NodePrincipal(), // Owner is our node's + // principal + INTERNAL_LOAD_FLAGS_NONE, + target.get(), // Window target + NS_LossyConvertUTF16toASCII(typeHint).get(), + aPostDataStream, // Post data stream + aHeadersDataStream, // Headers stream + LOAD_LINK, // Load type + nsnull, // No SHEntry + PR_TRUE, // first party site + aDocShell, // DocShell out-param + aRequest); // Request out-param if (NS_SUCCEEDED(rv)) { DispatchPings(aContent, referer); }