Bug 723808: don't allow loads in type=content docshells to inherit the system principal, r=bz
This commit is contained in:
@@ -8644,9 +8644,11 @@ nsIPrincipal*
|
||||
nsDocShell::GetInheritedPrincipal(bool aConsiderCurrentDocument)
|
||||
{
|
||||
nsCOMPtr<nsIDocument> document;
|
||||
bool inheritedFromCurrent = false;
|
||||
|
||||
if (aConsiderCurrentDocument && mContentViewer) {
|
||||
document = mContentViewer->GetDocument();
|
||||
inheritedFromCurrent = true;
|
||||
}
|
||||
|
||||
if (!document) {
|
||||
@@ -8674,7 +8676,17 @@ nsDocShell::GetInheritedPrincipal(bool aConsiderCurrentDocument)
|
||||
|
||||
//-- Get the document's principal
|
||||
if (document) {
|
||||
return document->NodePrincipal();
|
||||
nsIPrincipal *docPrincipal = document->NodePrincipal();
|
||||
|
||||
// Don't allow loads in typeContent docShells to inherit the system
|
||||
// principal from existing documents.
|
||||
if (inheritedFromCurrent &&
|
||||
mItemType == typeContent &&
|
||||
nsContentUtils::IsSystemPrincipal(docPrincipal)) {
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
return docPrincipal;
|
||||
}
|
||||
|
||||
return nsnull;
|
||||
|
||||
Reference in New Issue
Block a user