diff --git a/docshell/base/nsDocShell.cpp b/docshell/base/nsDocShell.cpp index f4ddc7647..c36aaaa63 100644 --- a/docshell/base/nsDocShell.cpp +++ b/docshell/base/nsDocShell.cpp @@ -13876,9 +13876,15 @@ DocShellOriginAttributes nsDocShell::GetOriginAttributes() { DocShellOriginAttributes attrs; + nsCOMPtr 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 parent = GetParentDocshell(); - if (parent) { - nsCOMPtr parentPrin = parent->GetDocument()->NodePrincipal(); + if (MOZ_LIKELY(parent)) + doc = parent->GetDocument(); + if (MOZ_LIKELY(doc)) { + nsCOMPtr parentPrin = doc->NodePrincipal(); PrincipalOriginAttributes poa = BasePrincipal::Cast(parentPrin)->OriginAttributesRef(); attrs.InheritFromDocToChildDocShell(poa); } else { diff --git a/js/src/vm/String.cpp b/js/src/vm/String.cpp index 22336bd36..37ad492d4 100644 --- a/js/src/vm/String.cpp +++ b/js/src/vm/String.cpp @@ -681,7 +681,7 @@ JSDependentString::dumpRepresentation(FILE* fp, int indent) const indent += 2; if (mozilla::Maybe offset = baseOffset()) - fprintf(fp, "%*soffset: %" PRIuSIZE "\n", indent, "", *offset); + fprintf(fp, "%*soffset: %zu\n", indent, "", *offset); fprintf(fp, "%*sbase: ", indent, ""); base()->dumpRepresentation(fp, indent);