diff --git a/content/html/document/src/MediaDocument.cpp b/content/html/document/src/MediaDocument.cpp
index 17bb5596fff..03ab8034eb9 100644
--- a/content/html/document/src/MediaDocument.cpp
+++ b/content/html/document/src/MediaDocument.cpp
@@ -19,6 +19,8 @@
#include "nsNodeInfoManager.h"
#include "nsContentUtils.h"
#include "nsDocElementCreatedNotificationRunner.h"
+#include "mozilla/Services.h"
+#include "nsServiceManagerUtils.h"
namespace mozilla {
namespace dom {
diff --git a/content/html/document/src/nsHTMLDocument.h b/content/html/document/src/nsHTMLDocument.h
index a64834e37c8..364e4173db4 100644
--- a/content/html/document/src/nsHTMLDocument.h
+++ b/content/html/document/src/nsHTMLDocument.h
@@ -19,11 +19,6 @@
#include "nsIHttpChannel.h"
#include "nsHTMLStyleSheet.h"
-// Document.Write() related
-#include "nsIWyciwygChannel.h"
-#include "nsILoadGroup.h"
-#include "nsNetUtil.h"
-
#include "nsICommandManager.h"
#include "mozilla/dom/HTMLSharedElement.h"
#include "nsDOMEvent.h"
@@ -34,6 +29,8 @@ class nsIURI;
class nsIMarkupDocumentViewer;
class nsIDocShell;
class nsICachingChannel;
+class nsIWyciwygChannel;
+class nsILoadGroup;
class nsHTMLDocument : public nsDocument,
public nsIHTMLDocument,