Bug 996280 - Use the docshell's sandbox flags if we can't get the active document in IsSandboxedFrom(). r=smaug

This commit is contained in:
Bob Owen 2014-05-06 19:48:33 +01:00
parent 985067ff31
commit 64337e24f1

View File

@ -3466,11 +3466,14 @@ nsDocShell::IsSandboxedFrom(nsIDocShell* aTargetDocShell)
return false;
}
uint32_t sandboxFlags = 0;
nsCOMPtr<nsIDocument> 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<nsIDocument> doc = mContentViewer->GetDocument();
if (doc) {
sandboxFlags = doc->GetSandboxFlags();
}
}
// If no flags, we are not sandboxed at all.