зеркало из https://github.com/mozilla/pjs.git
Bug 485643. Remove some unnecessary code, r+sr=jst
This commit is contained in:
Родитель
80290050ba
Коммит
801efadc57
|
@ -822,43 +822,12 @@ nsWebShell::OnLinkClickSync(nsIContent *aContent,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
nsCOMPtr<nsIDOMNode> node(do_QueryInterface(aContent));
|
|
||||||
NS_ENSURE_TRUE(node, NS_ERROR_UNEXPECTED);
|
|
||||||
|
|
||||||
PRBool inherit;
|
|
||||||
nsresult rv = URIInheritsSecurityContext(aURI, &inherit);
|
|
||||||
if (NS_FAILED(rv) || inherit) {
|
|
||||||
nsCOMPtr<nsIDocument> 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<nsIPresShell> 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
|
// 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
|
// 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
|
// 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
|
// referer, since the current URI in this webshell/docshell may be a
|
||||||
// new document that we're in the process of loading.
|
// new document that we're in the process of loading.
|
||||||
nsCOMPtr<nsIDOMDocument> refererOwnerDoc;
|
nsCOMPtr<nsIDocument> refererDoc = aContent->GetOwnerDoc();
|
||||||
node->GetOwnerDocument(getter_AddRefs(refererOwnerDoc));
|
|
||||||
|
|
||||||
nsCOMPtr<nsIDocument> refererDoc(do_QueryInterface(refererOwnerDoc));
|
|
||||||
NS_ENSURE_TRUE(refererDoc, NS_ERROR_UNEXPECTED);
|
NS_ENSURE_TRUE(refererDoc, NS_ERROR_UNEXPECTED);
|
||||||
|
|
||||||
nsCOMPtr<nsIURI> referer = refererDoc->GetDocumentURI();
|
nsCOMPtr<nsIURI> referer = refererDoc->GetDocumentURI();
|
||||||
|
@ -875,19 +844,20 @@ nsWebShell::OnLinkClickSync(nsIContent *aContent,
|
||||||
anchor->GetType(typeHint);
|
anchor->GetType(typeHint);
|
||||||
}
|
}
|
||||||
|
|
||||||
rv = InternalLoad(aURI, // New URI
|
nsresult rv = InternalLoad(aURI, // New URI
|
||||||
referer, // Referer URI
|
referer, // Referer URI
|
||||||
aContent->NodePrincipal(), // Owner is our node's principal
|
aContent->NodePrincipal(), // Owner is our node's
|
||||||
INTERNAL_LOAD_FLAGS_NONE,
|
// principal
|
||||||
target.get(), // Window target
|
INTERNAL_LOAD_FLAGS_NONE,
|
||||||
NS_LossyConvertUTF16toASCII(typeHint).get(),
|
target.get(), // Window target
|
||||||
aPostDataStream, // Post data stream
|
NS_LossyConvertUTF16toASCII(typeHint).get(),
|
||||||
aHeadersDataStream, // Headers stream
|
aPostDataStream, // Post data stream
|
||||||
LOAD_LINK, // Load type
|
aHeadersDataStream, // Headers stream
|
||||||
nsnull, // No SHEntry
|
LOAD_LINK, // Load type
|
||||||
PR_TRUE, // first party site
|
nsnull, // No SHEntry
|
||||||
aDocShell, // DocShell out-param
|
PR_TRUE, // first party site
|
||||||
aRequest); // Request out-param
|
aDocShell, // DocShell out-param
|
||||||
|
aRequest); // Request out-param
|
||||||
if (NS_SUCCEEDED(rv)) {
|
if (NS_SUCCEEDED(rv)) {
|
||||||
DispatchPings(aContent, referer);
|
DispatchPings(aContent, referer);
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче