From 64337e24f1bda9ce050b28b15e5bd4aa1a366c93 Mon Sep 17 00:00:00 2001 From: Bob Owen Date: Tue, 6 May 2014 19:48:33 +0100 Subject: [PATCH] Bug 996280 - Use the docshell's sandbox flags if we can't get the active document in IsSandboxedFrom(). r=smaug --- docshell/base/nsDocShell.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/docshell/base/nsDocShell.cpp b/docshell/base/nsDocShell.cpp index adfda61a884..6a65a5a80ec 100644 --- a/docshell/base/nsDocShell.cpp +++ b/docshell/base/nsDocShell.cpp @@ -3466,11 +3466,14 @@ nsDocShell::IsSandboxedFrom(nsIDocShell* aTargetDocShell) return false; } - uint32_t sandboxFlags = 0; - - nsCOMPtr doc = mContentViewer->GetDocument(); - if (doc) { - sandboxFlags = doc->GetSandboxFlags(); + // Default the sandbox flags to our flags, so that if we can't retrieve the + // active document, we will still enforce our own. + uint32_t sandboxFlags = mSandboxFlags; + if (mContentViewer) { + nsCOMPtr doc = mContentViewer->GetDocument(); + if (doc) { + sandboxFlags = doc->GetSandboxFlags(); + } } // If no flags, we are not sandboxed at all.