fix debug bustage, shutdown crash

This commit is contained in:
Cameron Kaiser
2017-07-24 18:00:30 -07:00
parent 5bcd1c4610
commit be4d0ed865
2 changed files with 9 additions and 3 deletions
+8 -2
View File
@@ -13876,9 +13876,15 @@ DocShellOriginAttributes
nsDocShell::GetOriginAttributes()
{
DocShellOriginAttributes attrs;
nsCOMPtr<nsIDocument> doc;
// It is possible to have a null document. If so, act as if we are
// the topmost docshell, since this usually occurs on shutdown.
RefPtr<nsDocShell> parent = GetParentDocshell();
if (parent) {
nsCOMPtr<nsIPrincipal> parentPrin = parent->GetDocument()->NodePrincipal();
if (MOZ_LIKELY(parent))
doc = parent->GetDocument();
if (MOZ_LIKELY(doc)) {
nsCOMPtr<nsIPrincipal> parentPrin = doc->NodePrincipal();
PrincipalOriginAttributes poa = BasePrincipal::Cast(parentPrin)->OriginAttributesRef();
attrs.InheritFromDocToChildDocShell(poa);
} else {