Bug 1384162 part 1 - DeCOMtaminate nsContentDLF::CreateBlankDocument. r?bz
MozReview-Commit-ID: 1KNNSIqrmZh
--- a/docshell/base/nsDocShell.cpp
+++ b/docshell/base/nsDocShell.cpp
@@ -42,16 +42,17 @@
#include "nsArray.h"
#include "nsArrayUtils.h"
#include "nsICaptivePortalService.h"
#include "nsIDOMStorage.h"
#include "nsIContentViewer.h"
#include "nsIDocumentLoaderFactory.h"
#include "nsCURILoader.h"
+#include "nsContentDLF.h"
#include "nsDocShellCID.h"
#include "nsDOMCID.h"
#include "nsNetCID.h"
#include "nsNetUtil.h"
#include "mozilla/net/ReferrerPolicy.h"
#include "nsRect.h"
#include "prenv.h"
#include "nsIDOMWindow.h"
@@ -8181,18 +8182,18 @@ nsDocShell::CreateAboutBlankContentViewe
principal = NullPrincipal::CreateWithInheritedAttributes(aPrincipal);
} else {
principal = NullPrincipal::CreateWithInheritedAttributes(this);
}
} else {
principal = aPrincipal;
}
// generate (about:blank) document to load
- docFactory->CreateBlankDocument(mLoadGroup, principal,
- getter_AddRefs(blankDoc));
+ nsContentDLF::CreateBlankDocument(mLoadGroup, principal,
+ getter_AddRefs(blankDoc));
if (blankDoc) {
// Hack: set the base URI manually, since this document never
// got Reset() with a channel.
blankDoc->SetBaseURI(aBaseURI);
blankDoc->SetContainer(this);
// Copy our sandbox flags to the document. These are immutable
--- a/docshell/base/nsIDocumentLoaderFactory.idl
+++ b/docshell/base/nsIDocumentLoaderFactory.idl
@@ -30,17 +30,9 @@ interface nsIDocumentLoaderFactory : nsI
in ACString aContentType,
in nsIDocShell aContainer,
in nsISupports aExtraInfo,
out nsIStreamListener aDocListenerResult);
nsIContentViewer createInstanceForDocument(in nsISupports aContainer,
in nsIDocument aDocument,
in string aCommand);
-
- /**
- * Create a blank document using the given loadgroup and given
- * principal. aPrincipal is allowed to be null, in which case the
- * new document will get the about:blank codebase principal.
- */
- nsIDocument createBlankDocument(in nsILoadGroup aLoadGroup,
- in nsIPrincipal aPrincipal);
};
--- a/layout/build/nsContentDLF.cpp
+++ b/layout/build/nsContentDLF.cpp
@@ -258,20 +258,20 @@ nsContentDLF::CreateInstanceForDocument(
nsCOMPtr<nsIContentViewer> contentViewer = NS_NewContentViewer();
// Bind the document to the Content Viewer
contentViewer->LoadStart(aDocument);
contentViewer.forget(aContentViewer);
return NS_OK;
}
-NS_IMETHODIMP
-nsContentDLF::CreateBlankDocument(nsILoadGroup *aLoadGroup,
+/* static */ nsresult
+nsContentDLF::CreateBlankDocument(nsILoadGroup* aLoadGroup,
nsIPrincipal* aPrincipal,
- nsIDocument **aDocument)
+ nsIDocument** aDocument)
{
*aDocument = nullptr;
nsresult rv = NS_ERROR_FAILURE;
// create a new blank HTML document
nsCOMPtr<nsIDocument> blankDoc(do_CreateInstance(kHTMLDocumentCID));
--- a/layout/build/nsContentDLF.h
+++ b/layout/build/nsContentDLF.h
@@ -41,16 +41,25 @@ public:
nsresult CreateXULDocument(const char* aCommand,
nsIChannel* aChannel,
nsILoadGroup* aLoadGroup,
nsIDocShell* aContainer,
nsISupports* aExtraInfo,
nsIStreamListener** aDocListener,
nsIContentViewer** aContentViewer);
+ /**
+ * Create a blank document using the given loadgroup and given
+ * principal. aPrincipal is allowed to be null, in which case the
+ * new document will get the about:blank codebase principal.
+ */
+ static nsresult CreateBlankDocument(nsILoadGroup* aLoadGroup,
+ nsIPrincipal* aPrincipal,
+ nsIDocument** aDocument);
+
private:
static nsresult EnsureUAStyleSheet();
static bool IsImageContentType(const char* aContentType);
};
nsresult
NS_NewContentDocumentLoaderFactory(nsIDocumentLoaderFactory** aResult);
--- a/xpfe/components/directory/nsDirectoryViewer.cpp
+++ b/xpfe/components/directory/nsDirectoryViewer.cpp
@@ -1387,17 +1387,8 @@ NS_IMETHODIMP
nsDirectoryViewerFactory::CreateInstanceForDocument(nsISupports* aContainer,
nsIDocument* aDocument,
const char *aCommand,
nsIContentViewer** aDocViewerResult)
{
NS_NOTYETIMPLEMENTED("didn't expect to get here");
return NS_ERROR_NOT_IMPLEMENTED;
}
-
-NS_IMETHODIMP
-nsDirectoryViewerFactory::CreateBlankDocument(nsILoadGroup *aLoadGroup,
- nsIPrincipal *aPrincipal,
- nsIDocument **_retval) {
-
- NS_NOTYETIMPLEMENTED("didn't expect to get here");
- return NS_ERROR_NOT_IMPLEMENTED;
-}