diff --git a/dom/base/nsContentUtils.cpp b/dom/base/nsContentUtils.cpp index 073151cb8c01..d3aa7eb90ea4 100644 --- a/dom/base/nsContentUtils.cpp +++ b/dom/base/nsContentUtils.cpp @@ -8688,8 +8688,12 @@ nsContentUtils::StorageAllowedForWindow(nsPIDOMWindowInner* aWindow) { if (nsIDocument* document = aWindow->GetExtantDoc()) { nsCOMPtr principal = document->NodePrincipal(); + // Note that GetChannel() below may return null, but that's OK, since the + // callee is able to deal with a null channel argument, and if passed null, + // will only fail to notify the UI in case storage gets blocked. + nsIChannel* channel = document->GetChannel(); return InternalStorageAllowedForPrincipal(principal, aWindow, nullptr, - nullptr); + channel); } return StorageAccess::eDeny; @@ -8703,8 +8707,12 @@ nsContentUtils::StorageAllowedForDocument(nsIDocument* aDoc) if (nsPIDOMWindowInner* inner = aDoc->GetInnerWindow()) { nsCOMPtr principal = aDoc->NodePrincipal(); + // Note that GetChannel() below may return null, but that's OK, since the + // callee is able to deal with a null channel argument, and if passed null, + // will only fail to notify the UI in case storage gets blocked. + nsIChannel* channel = aDoc->GetChannel(); return InternalStorageAllowedForPrincipal(principal, inner, nullptr, - nullptr); + channel); } return StorageAccess::eDeny;