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

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 {

View File

@ -681,7 +681,7 @@ JSDependentString::dumpRepresentation(FILE* fp, int indent) const
indent += 2;
if (mozilla::Maybe<size_t> offset = baseOffset())
fprintf(fp, "%*soffset: %" PRIuSIZE "\n", indent, "", *offset);
fprintf(fp, "%*soffset: %zu\n", indent, "", *offset);
fprintf(fp, "%*sbase: ", indent, "");
base()->dumpRepresentation(fp, indent);