From 6011112b41e6e0d0cf8b7b44ba8d5de0213481ad Mon Sep 17 00:00:00 2001 From: Olli Pettay Date: Fri, 5 Oct 2012 02:01:34 +0300 Subject: [PATCH] Bug 797909, null principal for initial about:blank, r=bz --- docshell/base/nsDocShell.cpp | 8 +++- docshell/test/Makefile.in | 1 + docshell/test/test_bug797909.html | 66 +++++++++++++++++++++++++++++++ 3 files changed, 74 insertions(+), 1 deletion(-) create mode 100644 docshell/test/test_bug797909.html diff --git a/docshell/base/nsDocShell.cpp b/docshell/base/nsDocShell.cpp index c2b96a23acd5..f165f4382fd6 100644 --- a/docshell/base/nsDocShell.cpp +++ b/docshell/base/nsDocShell.cpp @@ -6777,8 +6777,14 @@ nsDocShell::CreateAboutBlankContentViewer(nsIPrincipal* aPrincipal, nsContentUtils::FindInternalContentViewer("text/html"); if (docFactory) { + nsCOMPtr principal; + if (mSandboxFlags & SANDBOXED_ORIGIN) { + principal = do_CreateInstance("@mozilla.org/nullprincipal;1"); + } else { + principal = aPrincipal; + } // generate (about:blank) document to load - docFactory->CreateBlankDocument(mLoadGroup, aPrincipal, + docFactory->CreateBlankDocument(mLoadGroup, principal, getter_AddRefs(blankDoc)); if (blankDoc) { // Hack: set the base URI manually, since this document never diff --git a/docshell/test/Makefile.in b/docshell/test/Makefile.in index 6eab422212c9..59921ee96602 100644 --- a/docshell/test/Makefile.in +++ b/docshell/test/Makefile.in @@ -100,6 +100,7 @@ MOCHITEST_FILES = \ test_bug713825.html \ test_bug728939.html \ file_bug728939.html \ + test_bug797909.html \ $(NULL) ifeq ($(MOZ_WIDGET_TOOLKIT),cocoa) diff --git a/docshell/test/test_bug797909.html b/docshell/test/test_bug797909.html new file mode 100644 index 000000000000..a47aa0c6d142 --- /dev/null +++ b/docshell/test/test_bug797909.html @@ -0,0 +1,66 @@ + + + + + + Test for Bug 797909 + + + + +Mozilla Bug 797909 +

+ +
+
+
+ + +