Bug 1384162 part 1 - DeCOMtaminate nsContentDLF::CreateBlankDocument. r=bz
authorXidorn Quan <me@upsuper.org>
Wed, 26 Jul 2017 19:32:45 +1000
changeset 419900 d2b2de8c314b98c466ab8309d32eb9114ab36c69
parent 419899 ac03688d438263275bd4c1b5dd801a41cc786847
child 419901 e0a391cfa6d6d97f0e6c5b59ca3fa550ace414a5
push id7566
push usermtabara@mozilla.com
push dateWed, 02 Aug 2017 08:25:16 +0000
treeherdermozilla-beta@86913f512c3c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz
bugs1384162
milestone56.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1384162 part 1 - DeCOMtaminate nsContentDLF::CreateBlankDocument. r=bz MozReview-Commit-ID: 1KNNSIqrmZh
docshell/base/nsDocShell.cpp
docshell/base/nsIDocumentLoaderFactory.idl
layout/build/nsContentDLF.cpp
layout/build/nsContentDLF.h
xpfe/components/directory/nsDirectoryViewer.cpp
--- 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;
-}