diff --git a/dom/base/nsContentPolicy.cpp b/dom/base/nsContentPolicy.cpp index b4f10f2253f3..225de02555f1 100644 --- a/dom/base/nsContentPolicy.cpp +++ b/dom/base/nsContentPolicy.cpp @@ -160,7 +160,9 @@ nsContentPolicy::CheckPolicy(CPMethod policyMethod, if (window) { nsCOMPtr docShell = window->GetDocShell(); nsCOMPtr loadContext = do_QueryInterface(docShell); - loadContext->GetTopFrameElement(getter_AddRefs(topFrameElement)); + if (loadContext) { + loadContext->GetTopFrameElement(getter_AddRefs(topFrameElement)); + } MOZ_ASSERT(window->IsOuterWindow());