Merge mozilla-central to mozilla-inbound
authorEd Morley <bmo@edmorley.co.uk>
Sat, 15 Oct 2011 14:51:19 +0100
changeset 79456 19b62df50cfff885f898342ae5be5872fddc3a0a
parent 79455 f861fcef59dacf17cda0d168a1852f91c3659f50 (current diff)
parent 79450 3b58a9df4c8cf6d95af64d2a64b4f10c339b0d2c (diff)
child 79457 b0d1d740821db3080b4497a1c5aa1fcdd560c229
push id506
push userclegnitto@mozilla.com
push dateWed, 09 Nov 2011 02:03:18 +0000
treeherdermozilla-aurora@63587fc7bb93 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
milestone10.0a1
Merge mozilla-central to mozilla-inbound
dom/interfaces/html/nsIDOMNSHTMLFrameElement.idl
layout/base/nsIDocumentViewer.h
--- a/browser/app/blocklist.xml
+++ b/browser/app/blocklist.xml
@@ -1,19 +1,21 @@
 <?xml version="1.0"?>
-<blocklist xmlns="http://www.mozilla.org/2006/addons-blocklist" lastupdate="1317659919000">
+<blocklist xmlns="http://www.mozilla.org/2006/addons-blocklist" lastupdate="1318359094000">
   <emItems>
       <emItem  blockID="i41" id="{99079a25-328f-4bd4-be04-00955acaa0a7}">
                         <versionRange  minVersion="0.1" maxVersion="4.3.1.00" severity="1">
                     </versionRange>
                   </emItem>
       <emItem  blockID="i8" id="{B13721C7-F507-4982-B2E5-502A71474FED}">
                         <versionRange  minVersion=" " severity="1">
                     </versionRange>
                   </emItem>
+      <emItem  blockID="i43" id="supportaccessplugin@gmail.com">
+                        </emItem>
       <emItem  blockID="i38" id="{B7082FAA-CB62-4872-9106-E42DD88EDE45}">
                         <versionRange  minVersion="0.1" maxVersion="3.3.0.*">
                       <targetApplication  id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
                               <versionRange  minVersion="3.7a1" maxVersion="*" />
                           </targetApplication>
                     </versionRange>
                                 <versionRange  minVersion="3.3.1" maxVersion="*">
                       <targetApplication  id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
@@ -81,16 +83,18 @@
                   </emItem>
       <emItem  blockID="i2" id="fdm_ffext@freedownloadmanager.org">
                         <versionRange  minVersion="1.0" maxVersion="1.3.1">
                       <targetApplication  id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
                               <versionRange  minVersion="3.0a1" maxVersion="*" />
                           </targetApplication>
                     </versionRange>
                   </emItem>
+      <emItem  blockID="i44" id="sigma@labs.mozilla">
+                        </emItem>
       <emItem  blockID="i5" id="support@daemon-tools.cc">
                         <versionRange  minVersion=" " maxVersion="1.0.0.5">
                     </versionRange>
                   </emItem>
       <emItem  blockID="i6" id="{3f963a5b-e555-4543-90e2-c3908898db71}">
                         <versionRange  minVersion=" " maxVersion="8.5">
                     </versionRange>
                   </emItem>
--- a/content/base/public/nsContentCID.h
+++ b/content/base/public/nsContentCID.h
@@ -40,17 +40,17 @@
 
 #define NS_DOC_ENCODER_CONTRACTID_BASE \
 "@mozilla.org/layout/documentEncoder;1?type="
 
 #define NS_HTMLCOPY_ENCODER_CONTRACTID \
 "@mozilla.org/layout/htmlCopyEncoder;1"
 
 // {972D8D8F-F0DA-11d4-9885-00C04FA0CF4B}
-#define NS_DOCUMENT_VIEWER_CID \
+#define NS_CONTENT_VIEWER_CID \
 { 0x972d8d8f, 0xf0da, 0x11d4, { 0x98, 0x85, 0x0, 0xc0, 0x4f, 0xa0, 0xcf, 0x4b } }
 
 // {FC886801-E768-11d4-9885-00C04FA0CF4B}
 #define NS_CONTENT_DOCUMENT_LOADER_FACTORY_CID \
  { 0xfc886801, 0xe768, 0x11d4, { 0x98, 0x85, 0x0, 0xc0, 0x4f, 0xa0, 0xcf, 0x4b } }
 
 #define NS_HTMLDOCUMENT_CID                       \
 { /* 5d0fcdd0-4daa-11d2-b328-00805f8a3859 */      \
--- a/content/base/public/nsDeprecatedOperationList.h
+++ b/content/base/public/nsDeprecatedOperationList.h
@@ -70,12 +70,9 @@ DEPRECATED_OPERATION(Normalize)
 DEPRECATED_OPERATION(IsSupported)
 DEPRECATED_OPERATION(IsEqualNode)
 DEPRECATED_OPERATION(TextContent)
 DEPRECATED_OPERATION(EnablePrivilege)
 DEPRECATED_OPERATION(Position)
 DEPRECATED_OPERATION(TotalSize)
 DEPRECATED_OPERATION(IsSameNode)
 DEPRECATED_OPERATION(GlobalStorage)
-DEPRECATED_OPERATION(XmlVersion)
 DEPRECATED_OPERATION(InputEncoding)
-DEPRECATED_OPERATION(XmlStandalone)
-DEPRECATED_OPERATION(IsElementContentWhitespace)
--- a/content/base/src/nsContentUtils.cpp
+++ b/content/base/src/nsContentUtils.cpp
@@ -195,19 +195,22 @@ static NS_DEFINE_CID(kXTFServiceCID, NS_
 #include "nsChannelPolicy.h"
 #include "nsIContentSecurityPolicy.h"
 #include "nsContentDLF.h"
 #ifdef MOZ_MEDIA
 #include "nsHTMLMediaElement.h"
 #endif
 #include "nsDOMTouchEvent.h"
 #include "nsIScriptElement.h"
+#include "nsIContentViewer.h"
+
 #include "prdtoa.h"
 
 #include "mozilla/Preferences.h"
+
 #include "nsWrapperCacheInlines.h"
 
 using namespace mozilla::dom;
 using namespace mozilla::layers;
 using namespace mozilla;
 
 const char kLoadAsData[] = "loadAsData";
 
--- a/content/base/src/nsDocument.cpp
+++ b/content/base/src/nsDocument.cpp
@@ -864,17 +864,17 @@ TransferShowingState(nsIDocument* aFromD
 
   if (aFromDoc->IsShowing()) {
     aToDoc->OnPageShow(PR_TRUE, nsnull);
   }
 }
 
 nsresult
 nsExternalResourceMap::AddExternalResource(nsIURI* aURI,
-                                           nsIDocumentViewer* aViewer,
+                                           nsIContentViewer* aViewer,
                                            nsILoadGroup* aLoadGroup,
                                            nsIDocument* aDisplayDocument)
 {
   NS_PRECONDITION(aURI, "Unexpected call");
   NS_PRECONDITION((aViewer && aLoadGroup) || (!aViewer && !aLoadGroup),
                   "Must have both or neither");
   
   nsRefPtr<PendingLoad> load;
@@ -946,17 +946,17 @@ NS_IMETHODIMP
 nsExternalResourceMap::PendingLoad::OnStartRequest(nsIRequest *aRequest,
                                                    nsISupports *aContext)
 {
   nsExternalResourceMap& map = mDisplayDocument->ExternalResourceMap();
   if (map.HaveShutDown()) {
     return NS_BINDING_ABORTED;
   }
 
-  nsCOMPtr<nsIDocumentViewer> viewer;
+  nsCOMPtr<nsIContentViewer> viewer;
   nsCOMPtr<nsILoadGroup> loadGroup;
   nsresult rv = SetupViewer(aRequest, getter_AddRefs(viewer),
                             getter_AddRefs(loadGroup));
 
   // Make sure to do this no matter what
   nsresult rv2 = map.AddExternalResource(mURI, viewer, loadGroup,
                                          mDisplayDocument);
   if (NS_FAILED(rv)) {
@@ -967,17 +967,17 @@ nsExternalResourceMap::PendingLoad::OnSt
     return rv2;
   }
   
   return mTargetListener->OnStartRequest(aRequest, aContext);
 }
 
 nsresult
 nsExternalResourceMap::PendingLoad::SetupViewer(nsIRequest* aRequest,
-                                                nsIDocumentViewer** aViewer,
+                                                nsIContentViewer** aViewer,
                                                 nsILoadGroup** aLoadGroup)
 {
   NS_PRECONDITION(!mTargetListener, "Unexpected call to OnStartRequest");
   *aViewer = nsnull;
   *aLoadGroup = nsnull;
   
   nsCOMPtr<nsIChannel> chan(do_QueryInterface(aRequest));
   NS_ENSURE_TRUE(chan, NS_ERROR_UNEXPECTED);
@@ -1025,36 +1025,34 @@ nsExternalResourceMap::PendingLoad::Setu
 
   nsCOMPtr<nsIContentViewer> viewer;
   nsCOMPtr<nsIStreamListener> listener;
   rv = docLoaderFactory->CreateInstance("external-resource", chan, newLoadGroup,
                                         type.get(), nsnull, nsnull,
                                         getter_AddRefs(listener),
                                         getter_AddRefs(viewer));
   NS_ENSURE_SUCCESS(rv, rv);
-
-  nsCOMPtr<nsIDocumentViewer> docViewer = do_QueryInterface(viewer);
-  NS_ENSURE_TRUE(docViewer, NS_ERROR_UNEXPECTED);
+  NS_ENSURE_TRUE(viewer, NS_ERROR_UNEXPECTED);
 
   nsCOMPtr<nsIParser> parser = do_QueryInterface(listener);
   if (!parser) {
     /// We don't want to deal with the various fake documents yet
     return NS_ERROR_NOT_IMPLEMENTED;
   }
 
   // We can't handle HTML and other weird things here yet.
   nsIContentSink* sink = parser->GetContentSink();
   nsCOMPtr<nsIXMLContentSink> xmlSink = do_QueryInterface(sink);
   if (!xmlSink) {
     return NS_ERROR_NOT_IMPLEMENTED;
   }
 
   listener.swap(mTargetListener);
-  docViewer.swap(*aViewer);
-  newLoadGroup.swap(*aLoadGroup);
+  viewer.forget(aViewer);
+  newLoadGroup.forget(aLoadGroup);
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsExternalResourceMap::PendingLoad::OnDataAvailable(nsIRequest* aRequest,
                                                     nsISupports* aContext,
                                                     nsIInputStream* aStream,
                                                     PRUint32 aOffset,
@@ -5899,86 +5897,36 @@ nsDocument::GetInputEncoding(nsAString& 
     return GetCharacterSet(aInputEncoding);
   }
 
   SetDOMStringToNull(aInputEncoding);
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsDocument::GetXmlStandalone(bool *aXmlStandalone)
-{
-  WarnOnceAbout(eXmlStandalone);
-  *aXmlStandalone = 
-    !IsHTML() &&
-    mXMLDeclarationBits & XML_DECLARATION_BITS_DECLARATION_EXISTS &&
-    mXMLDeclarationBits & XML_DECLARATION_BITS_STANDALONE_EXISTS &&
-    mXMLDeclarationBits & XML_DECLARATION_BITS_STANDALONE_YES;
-
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsDocument::SetXmlStandalone(bool aXmlStandalone)
-{
-  return IsHTML() ? NS_ERROR_DOM_NOT_SUPPORTED_ERR : NS_ERROR_NOT_IMPLEMENTED;
-}
-
-NS_IMETHODIMP
 nsDocument::GetMozSyntheticDocument(bool *aSyntheticDocument)
 {
   *aSyntheticDocument = mIsSyntheticDocument;
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsDocument::GetXmlVersion(nsAString& aXmlVersion)
-{
-  WarnOnceAbout(eXmlVersion);
-  if (IsHTML()) {
-    SetDOMStringToNull(aXmlVersion);
-    return NS_OK;
-  }
-
-  // If there is no declaration, the value is "1.0".
-
-  // XXX We only support "1.0", so always output "1.0" until that changes.
-  aXmlVersion.AssignLiteral("1.0");
-
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsDocument::SetXmlVersion(const nsAString& aXmlVersion)
-{
-  return IsHTML() ? NS_ERROR_DOM_NOT_SUPPORTED_ERR : NS_ERROR_NOT_IMPLEMENTED;
-}
-
-NS_IMETHODIMP
 nsDocument::GetDocumentURI(nsAString& aDocumentURI)
 {
   if (mDocumentURI) {
     nsCAutoString uri;
     mDocumentURI->GetSpec(uri);
     CopyUTF8toUTF16(uri, aDocumentURI);
   } else {
     SetDOMStringToNull(aDocumentURI);
   }
 
   return NS_OK;
 }
 
-NS_IMETHODIMP
-nsDocument::SetDocumentURI(const nsAString& aDocumentURI)
-{
-  // Not allowing this yet, need to think about security ramifications first.
-  // We use mDocumentURI to get principals for this document.
-  return NS_ERROR_NOT_IMPLEMENTED;
-}
-
 static void BlastSubtreeToPieces(nsINode *aNode);
 
 PLDHashOperator
 BlastFunc(nsAttrHashKey::KeyType aKey, nsDOMAttribute *aData, void* aUserArg)
 {
   nsCOMPtr<nsIAttribute> *attr =
     static_cast<nsCOMPtr<nsIAttribute>*>(aUserArg);
 
--- a/content/base/src/nsDocument.h
+++ b/content/base/src/nsDocument.h
@@ -83,17 +83,17 @@
 #include "nsGkAtoms.h"
 #include "nsIApplicationCache.h"
 #include "nsIApplicationCacheContainer.h"
 #include "nsStyleSet.h"
 #include "pldhash.h"
 #include "nsAttrAndChildArray.h"
 #include "nsDOMAttributeMap.h"
 #include "nsThreadUtils.h"
-#include "nsIDocumentViewer.h"
+#include "nsIContentViewer.h"
 #include "nsIDOMXPathNSResolver.h"
 #include "nsIInterfaceRequestor.h"
 #include "nsILoadContext.h"
 #include "nsIProgressEventSink.h"
 #include "nsISecurityEventSink.h"
 #include "nsIChannelEventSink.h"
 #include "imgIRequest.h"
 #include "nsIDOMDOMImplementation.h"
@@ -396,20 +396,20 @@ protected:
 
     /**
      * Start aURI loading.  This will perform the necessary security checks and
      * so forth.
      */
     nsresult StartLoad(nsIURI* aURI, nsINode* aRequestingNode);
 
     /**
-     * Set up an nsIDocumentViewer based on aRequest.  This is guaranteed to
+     * Set up an nsIContentViewer based on aRequest.  This is guaranteed to
      * put null in *aViewer and *aLoadGroup on all failures.
      */
-    nsresult SetupViewer(nsIRequest* aRequest, nsIDocumentViewer** aViewer,
+    nsresult SetupViewer(nsIRequest* aRequest, nsIContentViewer** aViewer,
                          nsILoadGroup** aLoadGroup);
 
   private:
     nsRefPtr<nsDocument> mDisplayDocument;
     nsCOMPtr<nsIStreamListener> mTargetListener;
     nsCOMPtr<nsIURI> mURI;
   };
   friend class PendingLoad;
@@ -462,17 +462,17 @@ protected:
   };
   
   /**
    * Add an ExternalResource for aURI.  aViewer and aLoadGroup might be null
    * when this is called if the URI didn't result in an XML document.  This
    * function makes sure to remove the pending load for aURI, if any, from our
    * hashtable, and to notify its observers, if any.
    */
-  nsresult AddExternalResource(nsIURI* aURI, nsIDocumentViewer* aViewer,
+  nsresult AddExternalResource(nsIURI* aURI, nsIContentViewer* aViewer,
                                nsILoadGroup* aLoadGroup,
                                nsIDocument* aDisplayDocument);
   
   nsClassHashtable<nsURIHashKey, ExternalResource> mMap;
   nsRefPtrHashtable<nsURIHashKey, PendingLoad> mPendingLoads;
   bool mHaveShutDown;
 };
 
--- a/content/base/src/nsGenericDOMDataNode.h
+++ b/content/base/src/nsGenericDOMDataNode.h
@@ -325,23 +325,16 @@ protected:
   {
     return static_cast<nsDataSlots*>(GetExistingSlots());
   }
 
   nsresult SplitText(PRUint32 aOffset, nsIDOMText** aReturn);
 
   nsresult GetWholeText(nsAString& aWholeText);
 
-  nsresult GetIsElementContentWhitespace(bool *aReturn)
-  {
-    GetOwnerDoc()->WarnOnceAbout(nsIDocument::eIsElementContentWhitespace);
-    *aReturn = TextIsOnlyWhitespace();
-    return NS_OK;
-  }
-
   static PRInt32 FirstLogicallyAdjacentTextNode(nsIContent* aParent,
                                                 PRInt32 aIndex);
 
   static PRInt32 LastLogicallyAdjacentTextNode(nsIContent* aParent,
                                                PRInt32 aIndex,
                                                PRUint32 aCount);
 
   nsresult SetTextInternal(PRUint32 aOffset, PRUint32 aCount,
--- a/content/html/content/src/nsGenericHTMLElement.cpp
+++ b/content/html/content/src/nsGenericHTMLElement.cpp
@@ -3170,18 +3170,17 @@ nsGenericHTMLFrameElement::~nsGenericHTM
 
 NS_IMPL_CYCLE_COLLECTION_CLASS(nsGenericHTMLFrameElement)
 NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsGenericHTMLFrameElement,
                                                   nsGenericHTMLElement)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR_AMBIGUOUS(mFrameLoader, nsIFrameLoader)
 NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
 
 NS_INTERFACE_TABLE_HEAD(nsGenericHTMLFrameElement)
-  NS_INTERFACE_TABLE_INHERITED2(nsGenericHTMLFrameElement,
-                                nsIDOMNSHTMLFrameElement,
+  NS_INTERFACE_TABLE_INHERITED1(nsGenericHTMLFrameElement,
                                 nsIFrameLoaderOwner)
   NS_INTERFACE_TABLE_TO_MAP_SEGUE_CYCLE_COLLECTION(nsGenericHTMLFrameElement)
 NS_INTERFACE_MAP_END_INHERITING(nsGenericHTMLElement)
 
 nsresult
 nsGenericHTMLFrameElement::GetContentDocument(nsIDOMDocument** aContentDocument)
 {
   NS_PRECONDITION(aContentDocument, "Null out param");
@@ -3192,17 +3191,17 @@ nsGenericHTMLFrameElement::GetContentDoc
 
   if (!win) {
     return NS_OK;
   }
 
   return win->GetDocument(aContentDocument);
 }
 
-NS_IMETHODIMP
+nsresult
 nsGenericHTMLFrameElement::GetContentWindow(nsIDOMWindow** aContentWindow)
 {
   NS_PRECONDITION(aContentWindow, "Null out param");
   *aContentWindow = nsnull;
 
   nsresult rv = EnsureFrameLoader();
   NS_ENSURE_SUCCESS(rv, rv);
 
--- a/content/html/content/src/nsGenericHTMLElement.h
+++ b/content/html/content/src/nsGenericHTMLElement.h
@@ -37,17 +37,17 @@
  * ***** END LICENSE BLOCK ***** */
 #ifndef nsGenericHTMLElement_h___
 #define nsGenericHTMLElement_h___
 
 #include "nsMappedAttributeElement.h"
 #include "nsIDOMHTMLElement.h"
 #include "nsINameSpaceManager.h"  // for kNameSpaceID_None
 #include "nsIFormControl.h"
-#include "nsIDOMNSHTMLFrameElement.h"
+#include "nsIDOMHTMLFrameElement.h"
 #include "nsFrameLoader.h"
 #include "nsGkAtoms.h"
 #include "nsContentCreatorFunctions.h"
 #include "nsDOMMemoryReporter.h"
 
 class nsIDOMAttr;
 class nsIDOMEventListener;
 class nsIDOMNodeList;
@@ -1012,36 +1012,32 @@ PR_STATIC_ASSERT(ELEMENT_TYPE_SPECIFIC_B
 
 //----------------------------------------------------------------------
 
 /**
  * A helper class for frame elements
  */
 
 class nsGenericHTMLFrameElement : public nsGenericHTMLElement,
-                                  public nsIDOMNSHTMLFrameElement,
                                   public nsIFrameLoaderOwner
 {
 public:
   nsGenericHTMLFrameElement(already_AddRefed<nsINodeInfo> aNodeInfo,
                             mozilla::dom::FromParser aFromParser)
     : nsGenericHTMLElement(aNodeInfo)
   {
     mNetworkCreated = aFromParser == mozilla::dom::FROM_PARSER_NETWORK;
   }
   virtual ~nsGenericHTMLFrameElement();
 
   NS_DECL_DOM_MEMORY_REPORTER_SIZEOF
 
   // nsISupports
   NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr);
 
-  // nsIDOMNSHTMLFrameElement
-  NS_DECL_NSIDOMNSHTMLFRAMEELEMENT
-
   // nsIFrameLoaderOwner
   NS_DECL_NSIFRAMELOADEROWNER
 
   // nsIContent
   virtual bool IsHTMLFocusable(bool aWithMouse, bool *aIsFocusable, PRInt32 *aTabIndex);
   virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
                               nsIContent* aBindingParent,
                               bool aCompileEventHandlers);
@@ -1067,16 +1063,17 @@ public:
                                                      nsGenericHTMLElement)
 
 protected:
   // This doesn't really ensure a frame loade in all cases, only when
   // it makes sense.
   nsresult EnsureFrameLoader();
   nsresult LoadSrc();
   nsresult GetContentDocument(nsIDOMDocument** aContentDocument);
+  nsresult GetContentWindow(nsIDOMWindow** aContentWindow);
 
   nsRefPtr<nsFrameLoader> mFrameLoader;
   // True when the element is created by the parser
   // using NS_FROM_PARSER_NETWORK flag.
   // If the element is modified, it may lose the flag.
   bool                    mNetworkCreated;
 };
 
--- a/content/html/content/src/nsHTMLFrameElement.cpp
+++ b/content/html/content/src/nsHTMLFrameElement.cpp
@@ -120,16 +120,22 @@ NS_IMPL_URI_ATTR(nsHTMLFrameElement, Src
 
 
 NS_IMETHODIMP
 nsHTMLFrameElement::GetContentDocument(nsIDOMDocument** aContentDocument)
 {
   return nsGenericHTMLFrameElement::GetContentDocument(aContentDocument);
 }
 
+NS_IMETHODIMP
+nsHTMLFrameElement::GetContentWindow(nsIDOMWindow** aContentWindow)
+{
+  return nsGenericHTMLFrameElement::GetContentWindow(aContentWindow);
+}
+
 bool
 nsHTMLFrameElement::ParseAttribute(PRInt32 aNamespaceID,
                                    nsIAtom* aAttribute,
                                    const nsAString& aValue,
                                    nsAttrValue& aResult)
 {
   if (aNamespaceID == kNameSpaceID_None) {
     if (aAttribute == nsGkAtoms::bordercolor) {
--- a/content/html/content/src/nsHTMLIFrameElement.cpp
+++ b/content/html/content/src/nsHTMLIFrameElement.cpp
@@ -135,16 +135,22 @@ NS_IMPL_BOOL_ATTR(nsHTMLIFrameElement, M
 
 NS_IMETHODIMP
 nsHTMLIFrameElement::GetContentDocument(nsIDOMDocument** aContentDocument)
 {
   return nsGenericHTMLFrameElement::GetContentDocument(aContentDocument);
 }
 
 NS_IMETHODIMP
+nsHTMLIFrameElement::GetContentWindow(nsIDOMWindow** aContentWindow)
+{
+  return nsGenericHTMLFrameElement::GetContentWindow(aContentWindow);
+}
+
+NS_IMETHODIMP
 nsHTMLIFrameElement::GetSVGDocument(nsIDOMDocument **aResult)
 {
   return GetContentDocument(aResult);
 }
 
 bool
 nsHTMLIFrameElement::ParseAttribute(PRInt32 aNamespaceID,
                                     nsIAtom* aAttribute,
--- a/content/html/content/src/nsHTMLSelectElement.cpp
+++ b/content/html/content/src/nsHTMLSelectElement.cpp
@@ -147,33 +147,28 @@ nsHTMLSelectElement::nsHTMLSelectElement
     mSelectionHasChanged(PR_FALSE),
     mDefaultSelectionSet(PR_FALSE),
     mCanShowInvalidUI(PR_TRUE),
     mCanShowValidUI(PR_TRUE),
     mNonOptionChildren(0),
     mOptGroupCount(0),
     mSelectedIndex(-1)
 {
-  // FIXME: Bug 328908, set mOptions in an Init function and get rid of null
-  // checks.
-
   // DoneAddingChildren() will be called later if it's from the parser,
   // otherwise it is
 
   // Set up our default state: enabled, optional, and valid.
   AddStatesSilently(NS_EVENT_STATE_ENABLED |
                     NS_EVENT_STATE_OPTIONAL |
                     NS_EVENT_STATE_VALID);
 }
 
 nsHTMLSelectElement::~nsHTMLSelectElement()
 {
-  if (mOptions) {
-    mOptions->DropReference();
-  }
+  mOptions->DropReference();
 }
 
 // ISupports
 
 NS_IMPL_CYCLE_COLLECTION_CLASS(nsHTMLSelectElement)
 NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsHTMLSelectElement,
                                                   nsGenericHTMLFormElement)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR_AMBIGUOUS(mOptions,
--- a/content/html/content/test/test_bug389797.html
+++ b/content/html/content/test/test_bug389797.html
@@ -154,17 +154,17 @@ HTML_TAG("h4", "Heading");
 HTML_TAG("h5", "Heading");
 HTML_TAG("h6", "Heading");
 HTML_TAG("head", "Head");
 HTML_TAG("header", "")
 HTML_TAG("hgroup", "")
 HTML_TAG("hr", "HR");
 HTML_TAG("html", "Html");
 HTML_TAG("i", "");
-HTML_TAG("iframe", "IFrame", [ "nsIDOMNSHTMLFrameElement", "nsIDOMGetSVGDocument" ],
+HTML_TAG("iframe", "IFrame", [ "nsIDOMGetSVGDocument" ],
                              [ "nsIFrameLoaderOwner" ]);
 HTML_TAG("image", "Span");
 HTML_TAG("img", "Image", [], [ "imgIDecoderObserver",
                                "nsIImageLoadingContent" ]);
 HTML_TAG("input", "Input", [], [ "imgIDecoderObserver",
                                  "nsIImageLoadingContent",
                                  "nsIDOMNSEditableElement" ]);
 HTML_TAG("ins", "Mod");
--- a/content/html/document/src/nsHTMLDocument.cpp
+++ b/content/html/document/src/nsHTMLDocument.cpp
@@ -106,17 +106,17 @@
 #include "nsICharsetAlias.h"
 #include "nsContentUtils.h"
 #include "nsJSUtils.h"
 #include "nsIDocumentCharsetInfo.h"
 #include "nsIDocumentEncoder.h" //for outputting selection
 #include "nsICharsetResolver.h"
 #include "nsICachingChannel.h"
 #include "nsIJSContextStack.h"
-#include "nsIDocumentViewer.h"
+#include "nsIContentViewer.h"
 #include "nsIWyciwygChannel.h"
 #include "nsIScriptElement.h"
 #include "nsIScriptError.h"
 #include "nsIMutableArray.h"
 #include "nsArrayUtils.h"
 #include "nsIEffectiveTLDService.h"
 
 #include "nsIPrompt.h"
@@ -1766,19 +1766,18 @@ nsHTMLDocument::Open(const nsAString& aC
   // entry for this load. Otherwise, make sure that we're doing a normal load,
   // not whatever type of load was previously done on this docshell.
   shell->SetLoadType(
     (aOptionalArgCount > 1 && aReplaceOrName.EqualsLiteral("replace"))
     ? LOAD_NORMAL_REPLACE : LOAD_NORMAL);
 
   nsCOMPtr<nsIContentViewer> cv;
   shell->GetContentViewer(getter_AddRefs(cv));
-  nsCOMPtr<nsIDocumentViewer> docViewer = do_QueryInterface(cv);
-  if (docViewer) {
-    docViewer->LoadStart(static_cast<nsIHTMLDocument *>(this));
+  if (cv) {
+    cv->LoadStart(static_cast<nsIHTMLDocument *>(this));
   }
 
   // Add a wyciwyg channel request into the document load group
   NS_ASSERTION(!mWyciwygChannel, "nsHTMLDocument::Open(): wyciwyg "
                "channel already exists!");
 
   // In case the editor is listening and will see the new channel
   // being added, make sure mWriteLevel is non-zero so that the editor
--- a/content/xml/document/src/nsXMLContentSink.cpp
+++ b/content/xml/document/src/nsXMLContentSink.cpp
@@ -81,17 +81,17 @@
 #include "nsICookieService.h"
 #include "nsIPrompt.h"
 #include "nsIChannel.h"
 #include "nsIPrincipal.h"
 #include "nsXMLPrettyPrinter.h"
 #include "nsNodeInfoManager.h"
 #include "nsContentCreatorFunctions.h"
 #include "nsIContentPolicy.h"
-#include "nsIDocumentViewer.h"
+#include "nsIContentViewer.h"
 #include "nsContentPolicyUtils.h"
 #include "nsContentErrors.h"
 #include "nsIDOMProcessingInstruction.h"
 #include "nsNodeUtils.h"
 #include "nsIScriptGlobalObject.h"
 #include "nsIHTMLDocument.h"
 #include "mozAutoDocUpdate.h"
 #include "nsMimeTypes.h"
@@ -370,19 +370,18 @@ nsXMLContentSink::OnDocumentCreated(nsID
 
   nsCOMPtr<nsIHTMLDocument> htmlDoc = do_QueryInterface(aResultDocument);
   if (htmlDoc) {
     htmlDoc->SetDocWriteDisabled(PR_TRUE);
   }
 
   nsCOMPtr<nsIContentViewer> contentViewer;
   mDocShell->GetContentViewer(getter_AddRefs(contentViewer));
-  nsCOMPtr<nsIDocumentViewer> docViewer = do_QueryInterface(contentViewer);
-  if (docViewer) {
-    return docViewer->SetDocumentInternal(aResultDocument, PR_TRUE);
+  if (contentViewer) {
+    return contentViewer->SetDocumentInternal(aResultDocument, PR_TRUE);
   }
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsXMLContentSink::OnTransformDone(nsresult aResult,
                                   nsIDocument* aResultDocument)
 {
--- a/docshell/base/nsDocShell.cpp
+++ b/docshell/base/nsDocShell.cpp
@@ -50,17 +50,17 @@
 #include "nsIComponentManager.h"
 #include "nsIContent.h"
 #include "mozilla/dom/Element.h"
 #include "nsIDocument.h"
 #include "nsIDOMDocument.h"
 #include "nsIDOMElement.h"
 #include "nsIDOMStorage.h"
 #include "nsPIDOMStorage.h"
-#include "nsIDocumentViewer.h"
+#include "nsIContentViewer.h"
 #include "nsIDocumentLoaderFactory.h"
 #include "nsCURILoader.h"
 #include "nsURILoader.h"
 #include "nsDocShellCID.h"
 #include "nsLayoutCID.h"
 #include "nsDOMCID.h"
 #include "nsIDOMScriptObjectFactory.h"
 #include "nsNetUtil.h"
@@ -1670,51 +1670,42 @@ nsDocShell::ValidateOrigin(nsIDocShellTr
         NS_SUCCEEDED(innerOriginURI->SchemeIs("file", &originIsFile)) &&
         NS_SUCCEEDED(innerTargetURI->SchemeIs("file", &targetIsFile)) &&
         originIsFile && targetIsFile;
 }
 
 NS_IMETHODIMP
 nsDocShell::GetEldestPresContext(nsPresContext** aPresContext)
 {
-    nsresult rv = NS_OK;
-
     NS_ENSURE_ARG_POINTER(aPresContext);
     *aPresContext = nsnull;
 
     nsCOMPtr<nsIContentViewer> viewer = mContentViewer;
     while (viewer) {
         nsCOMPtr<nsIContentViewer> prevViewer;
         viewer->GetPreviousViewer(getter_AddRefs(prevViewer));
-        if (prevViewer)
-            viewer = prevViewer;
-        else {
-            nsCOMPtr<nsIDocumentViewer> docv(do_QueryInterface(viewer));
-            if (docv)
-                rv = docv->GetPresContext(aPresContext);
-            break;
-        }
-    }
-
-    return rv;
+        if (!prevViewer) {
+            return viewer->GetPresContext(aPresContext);
+        }
+        viewer = prevViewer;
+    }
+
+    return NS_OK;
 }
 
 NS_IMETHODIMP
 nsDocShell::GetPresContext(nsPresContext ** aPresContext)
 {
     NS_ENSURE_ARG_POINTER(aPresContext);
     *aPresContext = nsnull;
 
     if (!mContentViewer)
       return NS_OK;
 
-    nsCOMPtr<nsIDocumentViewer> docv(do_QueryInterface(mContentViewer));
-    NS_ENSURE_TRUE(docv, NS_ERROR_NO_INTERFACE);
-
-    return docv->GetPresContext(aPresContext);
+    return mContentViewer->GetPresContext(aPresContext);
 }
 
 NS_IMETHODIMP
 nsDocShell::GetPresShell(nsIPresShell ** aPresShell)
 {
     nsresult rv = NS_OK;
 
     NS_ENSURE_ARG_POINTER(aPresShell);
@@ -7654,26 +7645,21 @@ nsDocShell::SetupNewViewer(nsIContentVie
     nsCOMPtr<nsIContentViewer> kungfuDeathGrip = mContentViewer;
     if (mContentViewer) {
         // Stop any activity that may be happening in the old document before
         // releasing it...
         mContentViewer->Stop();
 
         // Try to extract the canvas background color from the old
         // presentation shell, so we can use it for the next document.
-        nsCOMPtr<nsIDocumentViewer> docviewer =
-        do_QueryInterface(mContentViewer);
-
-        if (docviewer) {
-            nsCOMPtr<nsIPresShell> shell;
-            docviewer->GetPresShell(getter_AddRefs(shell));
-
-            if (shell) {
-                bgcolor = shell->GetCanvasBackground();
-            }
+        nsCOMPtr<nsIPresShell> shell;
+        mContentViewer->GetPresShell(getter_AddRefs(shell));
+
+        if (shell) {
+            bgcolor = shell->GetCanvasBackground();
         }
 
         mContentViewer->Close(mSavingOldViewer ? mOSHE.get() : nsnull);
         aNewViewer->SetPreviousViewer(mContentViewer);
     }
     if (mOSHE && (!mContentViewer || !mSavingOldViewer)) {
         // We don't plan to save a viewer in mOSHE; tell it to drop
         // any other state it's holding.
@@ -7688,21 +7674,17 @@ nsDocShell::SetupNewViewer(nsIContentVie
 
     mContentViewer = aNewViewer;
 
     nsCOMPtr<nsIWidget> widget;
     NS_ENSURE_SUCCESS(GetMainWidget(getter_AddRefs(widget)), NS_ERROR_FAILURE);
 
     nsIntRect bounds(x, y, cx, cy);
 
-    nsCOMPtr<nsIDocumentViewer> docviewer =
-        do_QueryInterface(mContentViewer);
-    if (docviewer) {
-        docviewer->SetNavigationTiming(mTiming);
-    }
+    mContentViewer->SetNavigationTiming(mTiming);
 
     if (NS_FAILED(mContentViewer->Init(widget, bounds))) {
         mContentViewer = nsnull;
         NS_ERROR("ContentViewer Initialization failed");
         return NS_ERROR_FAILURE;
     }
 
     // If we have old state to copy, set the old state onto the new content
@@ -7726,23 +7708,21 @@ nsDocShell::SetupNewViewer(nsIContentVie
         NS_ENSURE_SUCCESS(newMUDV->SetFullZoom(pageZoom),
                           NS_ERROR_FAILURE);
         NS_ENSURE_SUCCESS(newMUDV->SetAuthorStyleDisabled(styleDisabled),
                           NS_ERROR_FAILURE);
     }
 
     // Stuff the bgcolor from the old pres shell into the new
     // pres shell. This improves page load continuity.
-    if (docviewer) {
-        nsCOMPtr<nsIPresShell> shell;
-        docviewer->GetPresShell(getter_AddRefs(shell));
-
-        if (shell) {
-            shell->SetCanvasBackground(bgcolor);
-        }
+    nsCOMPtr<nsIPresShell> shell;
+    mContentViewer->GetPresShell(getter_AddRefs(shell));
+
+    if (shell) {
+        shell->SetCanvasBackground(bgcolor);
     }
 
 // XXX: It looks like the LayoutState gets restored again in Embed()
 //      right after the call to SetupNewViewer(...)
 
     // We don't show the mContentViewer yet, since we want to draw the old page
     // until we have enough of the new page to show.  Just return with the new
     // viewer still set to hidden.
--- a/docshell/base/nsIContentViewer.idl
+++ b/docshell/base/nsIContentViewer.idl
@@ -1,26 +1,71 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *   Ms2ger <ms2ger@gmail.com>
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
 #include "nsISupports.idl"
 
 interface nsIDOMDocument;
 interface nsISHEntry;
 interface nsIPrintSettings;
 
 
 %{ C++
 class nsIWidget;
 class nsIDocument;
 struct nsIntRect;
+class nsIPresShell;
+class nsPresContext;
+class nsIView;
+class nsDOMNavigationTiming;
 %}
 
 [ptr] native nsIWidgetPtr(nsIWidget);
 [ptr] native nsIDocumentPtr(nsIDocument);
 [ref] native nsIntRectRef(nsIntRect);
+[ptr] native nsIPresShellPtr(nsIPresShell);
+[ptr] native nsPresContextPtr(nsPresContext);
+[ptr] native nsIViewPtr(nsIView);
+[ptr] native nsDOMNavigationTimingPtr(nsDOMNavigationTiming);
 
-[scriptable, uuid(75306a89-e3ad-4a2b-9daf-ac4de06661a4)]
+[scriptable, builtinclass, uuid(26b2380b-4a1a-46cd-b7d8-7600e41c1688)]
 interface nsIContentViewer : nsISupports
 {
 
   [noscript] void init(in nsIWidgetPtr aParentWidget,
                        [const] in nsIntRectRef aBounds);
 
   attribute nsISupports container;
 
@@ -137,9 +182,25 @@ interface nsIContentViewer : nsISupports
   /*
    * Indicates when we're in a state where content shouldn't be allowed to
    * trigger a tab-modal prompt (as opposed to a window-modal prompt) because
    * we're part way through some operation (eg beforeunload) that shouldn't be
    * rentrant if the user closes the tab while the prompt is showing.
    * See bug 613800.
    */
   readonly attribute boolean isTabModalPromptAllowed;
+
+  [noscript] readonly attribute nsIPresShellPtr presShell;
+  [noscript] readonly attribute nsPresContextPtr presContext;
+  [noscript] void setDocumentInternal(in nsIDocumentPtr aDocument,
+                                      in boolean aForceReuseInnerWindow);
+  /**
+   * Find the view to use as the container view for MakeWindow. Returns
+   * null if this will be the root of a view manager hierarchy. In that
+   * case, if mParentWidget is null then this document should not even
+   * be displayed.
+   */
+  [noscript,notxpcom,nostdcall] nsIViewPtr findContainerView();
+  /**
+   * Set collector for navigation timing data (load, unload events).
+   */
+  [noscript,notxpcom,nostdcall] void setNavigationTiming(in nsDOMNavigationTimingPtr aTiming);
 };
--- a/dom/base/nsDOMClassInfo.cpp
+++ b/dom/base/nsDOMClassInfo.cpp
@@ -264,17 +264,17 @@
 #include "nsIDOMHTMLDListElement.h"
 #include "nsIDOMHTMLDirectoryElement.h"
 #include "nsIDOMHTMLDivElement.h"
 #include "nsIDOMHTMLEmbedElement.h"
 #include "nsIDOMHTMLFieldSetElement.h"
 #include "nsIDOMHTMLFontElement.h"
 #include "nsIDOMHTMLFrameElement.h"
 #include "nsIDOMHTMLFrameSetElement.h"
-#include "nsIDOMNSHTMLFrameElement.h"
+#include "nsIDOMHTMLFrameElement.h"
 #include "nsIDOMHTMLHRElement.h"
 #include "nsIDOMHTMLHeadElement.h"
 #include "nsIDOMHTMLHeadingElement.h"
 #include "nsIDOMHTMLHtmlElement.h"
 #include "nsIDOMHTMLIFrameElement.h"
 #include "nsIDOMHTMLImageElement.h"
 #include "nsIDOMHTMLInputElement.h"
 #include "nsIDOMHTMLLIElement.h"
@@ -2585,17 +2585,16 @@ nsDOMClassInfo::Init()
 
   DOM_CLASSINFO_MAP_BEGIN(HTMLFormElement, nsIDOMHTMLFormElement)
     DOM_CLASSINFO_MAP_ENTRY(nsIDOMHTMLFormElement)
     DOM_CLASSINFO_GENERIC_HTML_MAP_ENTRIES
   DOM_CLASSINFO_MAP_END
 
   DOM_CLASSINFO_MAP_BEGIN(HTMLFrameElement, nsIDOMHTMLFrameElement)
     DOM_CLASSINFO_MAP_ENTRY(nsIDOMHTMLFrameElement)
-    DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSHTMLFrameElement)
     DOM_CLASSINFO_GENERIC_HTML_MAP_ENTRIES
   DOM_CLASSINFO_MAP_END
 
   DOM_CLASSINFO_MAP_BEGIN(HTMLFrameSetElement, nsIDOMHTMLFrameSetElement)
     DOM_CLASSINFO_MAP_ENTRY(nsIDOMHTMLFrameSetElement)
     DOM_CLASSINFO_GENERIC_HTML_MAP_ENTRIES
   DOM_CLASSINFO_MAP_END
 
@@ -2616,17 +2615,16 @@ nsDOMClassInfo::Init()
 
   DOM_CLASSINFO_MAP_BEGIN(HTMLHtmlElement, nsIDOMHTMLHtmlElement)
     DOM_CLASSINFO_MAP_ENTRY(nsIDOMHTMLHtmlElement)
     DOM_CLASSINFO_GENERIC_HTML_MAP_ENTRIES
   DOM_CLASSINFO_MAP_END
 
   DOM_CLASSINFO_MAP_BEGIN(HTMLIFrameElement, nsIDOMHTMLIFrameElement)
     DOM_CLASSINFO_MAP_ENTRY(nsIDOMHTMLIFrameElement)
-    DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSHTMLFrameElement)
     DOM_CLASSINFO_MAP_ENTRY(nsIDOMGetSVGDocument)
     DOM_CLASSINFO_GENERIC_HTML_MAP_ENTRIES
   DOM_CLASSINFO_MAP_END
 
   DOM_CLASSINFO_MAP_BEGIN(HTMLImageElement, nsIDOMHTMLImageElement)
     DOM_CLASSINFO_MAP_ENTRY(nsIDOMHTMLImageElement)
     DOM_CLASSINFO_GENERIC_HTML_MAP_ENTRIES
   DOM_CLASSINFO_MAP_END
--- a/dom/base/nsFocusManager.cpp
+++ b/dom/base/nsFocusManager.cpp
@@ -44,17 +44,17 @@
 #include "nsIEnumerator.h"
 #include "nsGkAtoms.h"
 #include "nsContentUtils.h"
 #include "nsIDocument.h"
 #include "nsIDOMWindow.h"
 #include "nsPIDOMWindow.h"
 #include "nsIDOMElement.h"
 #include "nsIDOMXULElement.h"
-#include "nsIDOMNSHTMLFrameElement.h"
+#include "nsIDOMHTMLFrameElement.h"
 #include "nsIDOMHTMLInputElement.h"
 #include "nsIDOMHTMLMapElement.h"
 #include "nsIDOMHTMLLegendElement.h"
 #include "nsIDOMDocument.h"
 #include "nsIDOMRange.h"
 #include "nsIHTMLDocument.h"
 #include "nsIFormControlFrame.h"
 #include "nsGenericHTMLElement.h"
--- a/dom/base/nsWindowRoot.cpp
+++ b/dom/base/nsWindowRoot.cpp
@@ -1,11 +1,10 @@
-/* -*- Mode: C++; tab-width: 3; indent-tabs-mode: nil; c-basic-offset: 2 -*-
- *
- * ***** BEGIN LICENSE BLOCK *****
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
  *
  * The contents of this file are subject to the Mozilla Public License Version
  * 1.1 (the "License"); you may not use this file except in compliance with
  * the License. You may obtain a copy of the License at
  * http://www.mozilla.org/MPL/
  *
  * Software distributed under the License is distributed on an "AS IS" basis,
@@ -234,49 +233,46 @@ nsWindowRoot::GetControllers(nsIControll
 
 nsresult
 nsWindowRoot::GetControllerForCommand(const char * aCommand,
                                       nsIController** _retval)
 {
   NS_ENSURE_ARG_POINTER(_retval);
   *_retval = nsnull;
 
-  nsCOMPtr<nsIControllers> controllers;
-  nsCOMPtr<nsIController> controller;
-
-  GetControllers(getter_AddRefs(controllers));
-  if (controllers) {
-    controllers->GetControllerForCommand(aCommand, getter_AddRefs(controller));
-    if (controller) {
-      controller.swap(*_retval);
-      return NS_OK;
+  {
+    nsCOMPtr<nsIControllers> controllers;
+    GetControllers(getter_AddRefs(controllers));
+    if (controllers) {
+      nsCOMPtr<nsIController> controller;
+      controllers->GetControllerForCommand(aCommand, getter_AddRefs(controller));
+      if (controller) {
+        controller.forget(_retval);
+        return NS_OK;
+      }
     }
   }
 
   nsCOMPtr<nsPIDOMWindow> focusedWindow;
   nsFocusManager::GetFocusedDescendant(mWindow, PR_TRUE, getter_AddRefs(focusedWindow));
   while (focusedWindow) {
-    nsCOMPtr<nsIDOMWindow> domWindow(do_QueryInterface(focusedWindow));
-
-    nsCOMPtr<nsIControllers> controllers2;
-    domWindow->GetControllers(getter_AddRefs(controllers2));
-    if (controllers2) {
-      controllers2->GetControllerForCommand(aCommand,
-                                            getter_AddRefs(controller));
+    nsCOMPtr<nsIControllers> controllers;
+    focusedWindow->GetControllers(getter_AddRefs(controllers));
+    if (controllers) {
+      nsCOMPtr<nsIController> controller;
+      controllers->GetControllerForCommand(aCommand,
+                                           getter_AddRefs(controller));
       if (controller) {
-        controller.swap(*_retval);
+        controller.forget(_retval);
         return NS_OK;
       }
     }
 
     // XXXndeakin P3 is this casting safe?
-    nsCOMPtr<nsPIDOMWindow> piWindow = do_QueryInterface(focusedWindow); 
-    nsGlobalWindow *win =
-      static_cast<nsGlobalWindow *>
-                 (static_cast<nsIDOMWindow*>(piWindow));
+    nsGlobalWindow *win = static_cast<nsGlobalWindow*>(focusedWindow.get());
     focusedWindow = win->GetPrivateParent();
   }
   
   return NS_OK;
 }
 
 nsIDOMNode*
 nsWindowRoot::GetPopupNode()
@@ -291,13 +287,11 @@ nsWindowRoot::SetPopupNode(nsIDOMNode* a
 }
 
 ///////////////////////////////////////////////////////////////////////////////////
 
 nsresult
 NS_NewWindowRoot(nsPIDOMWindow* aWindow, nsIDOMEventTarget** aResult)
 {
   *aResult = new nsWindowRoot(aWindow);
-  if (!*aResult)
-    return NS_ERROR_OUT_OF_MEMORY;
   NS_ADDREF(*aResult);
   return NS_OK;
 }
--- a/dom/interfaces/core/nsIDOMCDATASection.idl
+++ b/dom/interfaces/core/nsIDOMCDATASection.idl
@@ -44,12 +44,12 @@
  * that would otherwise be regarded as markup.
  * Their primary purpose is for including material such as XML fragments, 
  * without needing to escape all the delimiters.
  * 
  * For more information on this interface please see 
  * http://www.w3.org/TR/DOM-Level-2-Core/
  */
 
-[scriptable, uuid(08a05c75-23de-4937-a45b-89bdcbe4f467)]
+[scriptable, uuid(92cfb4d4-7456-44fa-9c76-c70fdee78e2f)]
 interface nsIDOMCDATASection : nsIDOMText
 {
 };
--- a/dom/interfaces/core/nsIDOMDocument.idl
+++ b/dom/interfaces/core/nsIDOMDocument.idl
@@ -61,17 +61,17 @@ interface nsIDOMLocation;
  * cannot exist outside the context of a Document, the nsIDOMDocument 
  * interface also contains the factory methods needed to create these 
  * objects.
  *
  * For more information on this interface please see 
  * http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html
  */
 
-[scriptable, uuid(CD4CD7C3-C688-4E50-9A72-4A00EABE66AB)]
+[scriptable, uuid(256a15f4-126f-48f9-90b6-7f5b2b1e30e6)]
 interface nsIDOMDocument : nsIDOMNode
 {
   readonly attribute nsIDOMDocumentType         doctype;
   readonly attribute nsIDOMDOMImplementation    implementation;
   readonly attribute nsIDOMElement              documentElement;
   nsIDOMElement                 createElement(in DOMString tagName)
                                   raises(DOMException);
   nsIDOMDocumentFragment        createDocumentFragment();
@@ -101,23 +101,17 @@ interface nsIDOMDocument : nsIDOMNode
   // Introduced in DOM Level 2:
   nsIDOMNodeList                getElementsByTagNameNS(in DOMString namespaceURI,
                                                        in DOMString localName);
   // Introduced in DOM Level 2:
   nsIDOMElement                 getElementById(in DOMString elementId);
   // Introduced in DOM Level 3:
   readonly attribute DOMString       inputEncoding;
   // Introduced in DOM Level 3:
-           attribute boolean         xmlStandalone;
-                                        // raises(DOMException) on setting
-  // Introduced in DOM Level 3:
-           attribute DOMString       xmlVersion;
-                                        // raises(DOMException) on setting
-  // Introduced in DOM Level 3:
-           attribute DOMString       documentURI;
+  readonly attribute DOMString       documentURI;
   // Introduced in DOM Level 3:
   nsIDOMNode         adoptNode(in nsIDOMNode source)
                                         raises(DOMException);
 
   /**
    * Create a range
    *
    * @see http://html5.org/specs/dom-range.html#dom-document-createrange
--- a/dom/interfaces/core/nsIDOMText.idl
+++ b/dom/interfaces/core/nsIDOMText.idl
@@ -42,30 +42,22 @@
 /**
  * The nsIDOMText interface inherits from nsIDOMCharacterData and represents 
  * the textual content (termed character data in XML) of an Element or Attr.
  *
  * For more information on this interface please see 
  * http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html
  */
 
-[scriptable, uuid(8a876308-7891-468c-8f7a-9f2b81160c3c)]
+[scriptable, uuid(437ed60c-febd-4bd0-892f-cf358adc3c96)]
 interface nsIDOMText : nsIDOMCharacterData
 {
   nsIDOMText                      splitText(in unsigned long offset)
                                        raises(DOMException);
 
   /**
-   * Indicates whether this text node contains element content whitespace.
-   * A text node is element content whitespace if it contains only XML
-   * white space characters and is a child of an element whose content
-   * model allows only child elements optionally separated by white space.
-   */
-  readonly attribute boolean isElementContentWhitespace;
-
-  /**
    * The concatenation of all logically adjacent text nodes with this text
    * node, where "logically adjacent" consists of all text nodes which can be
    * reached by traversing the document tree in either direction without
    * passing an element, comment, or processing-instruction boundary.  
    */
   readonly attribute DOMString wholeText;
 };
--- a/dom/interfaces/core/nsIDOMXMLDocument.idl
+++ b/dom/interfaces/core/nsIDOMXMLDocument.idl
@@ -33,17 +33,17 @@
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include "nsIDOMDocument.idl"
 
-[scriptable, uuid(BB4D4D76-3802-4191-88E2-933BA609C4E1)]
+[scriptable, uuid(f349fb58-544d-4254-b1b9-902e459d7b5c)]
 interface nsIDOMXMLDocument : nsIDOMDocument
 {
   // DOM Level 3 Load & Save, DocumentLS
   // http://www.w3.org/TR/DOM-Level-3-LS/load-save.html#LS-DocumentLS
   /**
    * Whether to load synchronously or asynchronously.
    * The default is async==true.
    */
--- a/dom/interfaces/html/Makefile.in
+++ b/dom/interfaces/html/Makefile.in
@@ -117,12 +117,11 @@ SDK_XPIDLSRCS =					\
 	nsIDOMValidityState.idl		\
 	nsIDOMDOMStringMap.idl		\
 	$(NULL)
 
 XPIDLSRCS = 					\
 	nsIDOMHTMLCanvasElement.idl		\
 	nsIDOMHTMLUnknownElement.idl \
 	nsIDOMNSHTMLElement.idl			\
-	nsIDOMNSHTMLFrameElement.idl		\
 	$(NULL)
 
 include $(topsrcdir)/config/rules.mk
--- a/dom/interfaces/html/nsIDOMHTMLDocument.idl
+++ b/dom/interfaces/html/nsIDOMHTMLDocument.idl
@@ -42,17 +42,17 @@
 /**
  * The nsIDOMHTMLDocument interface is the interface to a [X]HTML
  * document object.
  *
  * @see <http://www.whatwg.org/html/>
  */
 interface nsISelection;
 
-[scriptable, uuid(C94A5F14-F79F-4054-A93C-E8FF35623460)]
+[scriptable, uuid(3d94491d-fd74-4710-bfa8-83724b674177)]
 interface nsIDOMHTMLDocument : nsIDOMDocument
 {
   readonly attribute DOMString            URL;
            attribute DOMString            domain;
            attribute DOMString            cookie;
   // returns "BackCompat" if we're in quirks mode,
   // or "CSS1Compat" if we're in strict mode
   readonly attribute DOMString            compatMode;
--- a/dom/interfaces/html/nsIDOMHTMLFrameElement.idl
+++ b/dom/interfaces/html/nsIDOMHTMLFrameElement.idl
@@ -45,22 +45,23 @@
  *
  * This interface is trying to follow the DOM Level 2 HTML specification:
  * http://www.w3.org/TR/DOM-Level-2-HTML/
  *
  * with changes from the work-in-progress WHATWG HTML specification:
  * http://www.whatwg.org/specs/web-apps/current-work/
  */
 
-[scriptable, uuid(6e141f6c-c22e-4b3c-9835-b234913dfd38)]
+[scriptable, uuid(1c913d18-db4d-444e-860d-e7cd4b0aeaf2)]
 interface nsIDOMHTMLFrameElement : nsIDOMHTMLElement
 {
            attribute DOMString        frameBorder;
            attribute DOMString        longDesc;
            attribute DOMString        marginHeight;
            attribute DOMString        marginWidth;
            attribute DOMString        name;
            attribute boolean          noResize;
            attribute DOMString        scrolling;
            attribute DOMString        src;
   // Introduced in DOM Level 2:
   readonly attribute nsIDOMDocument   contentDocument;
+  readonly attribute nsIDOMWindow     contentWindow;
 };
--- a/dom/interfaces/html/nsIDOMHTMLIFrameElement.idl
+++ b/dom/interfaces/html/nsIDOMHTMLIFrameElement.idl
@@ -45,29 +45,32 @@
  *
  * This interface is trying to follow the DOM Level 2 HTML specification:
  * http://www.w3.org/TR/DOM-Level-2-HTML/
  *
  * with changes from the work-in-progress WHATWG HTML specification:
  * http://www.whatwg.org/specs/web-apps/current-work/
  */
 
-[scriptable, uuid(712586b2-b229-4730-9019-b02c6d371275)]
+[scriptable, uuid(77fc0727-2803-41a7-ae2c-9a012777fa1d)]
 interface nsIDOMHTMLIFrameElement : nsIDOMHTMLElement
 {
            attribute DOMString        align;
            attribute DOMString        frameBorder;
            attribute DOMString        height;
            attribute DOMString        longDesc;
            attribute DOMString        marginHeight;
            attribute DOMString        marginWidth;
            attribute DOMString        name;
            attribute DOMString        scrolling;
            attribute DOMString        src;
            attribute DOMString        width;
   // Introduced in DOM Level 2:
   readonly attribute nsIDOMDocument   contentDocument;
+  readonly attribute nsIDOMWindow     contentWindow;
 
+
+  // Mozilla extensions
   // iframe elements require the mozAllowFullScreen attribute to be present
   // if they're to allow content in the sub document to go into DOM full-screen
   // mode. See https://wiki.mozilla.org/index.php?title=Gecko:FullScreenAPI
            attribute boolean          mozAllowFullScreen;
 };
deleted file mode 100644
--- a/dom/interfaces/html/nsIDOMNSHTMLFrameElement.idl
+++ /dev/null
@@ -1,46 +0,0 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is mozilla.org code.
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corporation.
- * Portions created by the Initial Developer are Copyright (C) 2000
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *   Vidur Apparao <vidur@netscape.com> (original author)
- *   Johnny Stenback <jst@netscape.com>
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either of the GNU General Public License Version 2 or later (the "GPL"),
- * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-#include "domstubs.idl"
-
-[scriptable, uuid(d67bd267-f984-4993-b378-95851b71f0a3)]
-interface nsIDOMNSHTMLFrameElement : nsISupports
-{
-  readonly attribute nsIDOMWindow     contentWindow;
-};
--- a/dom/interfaces/svg/nsIDOMSVGDocument.idl
+++ b/dom/interfaces/svg/nsIDOMSVGDocument.idl
@@ -34,15 +34,15 @@
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include "nsIDOMDocument.idl"
 
 interface nsIDOMSVGSVGElement;
 
-[scriptable, uuid(B3806DF6-7ED4-4426-84E6-545EEFE5AA9A)]
+[scriptable, uuid(872c2e8f-80cb-4405-981d-ba3474e7925e)]
 interface nsIDOMSVGDocument : nsIDOMDocument
 {
   readonly attribute DOMString domain;
   readonly attribute DOMString URL;
   readonly attribute nsIDOMSVGSVGElement rootElement;
 };
--- a/dom/ipc/TabParent.cpp
+++ b/dom/ipc/TabParent.cpp
@@ -56,17 +56,17 @@
 #include "nsPIDOMWindow.h"
 #include "TabChild.h"
 #include "nsIDOMEvent.h"
 #include "nsIPrivateDOMEvent.h"
 #include "nsFrameLoader.h"
 #include "nsNetUtil.h"
 #include "nsContentUtils.h"
 #include "nsContentPermissionHelper.h"
-#include "nsIDOMNSHTMLFrameElement.h"
+#include "nsIDOMHTMLFrameElement.h"
 #include "nsIDialogCreator.h"
 #include "nsThreadUtils.h"
 #include "nsSerializationHelper.h"
 #include "nsIPromptFactory.h"
 #include "nsIContent.h"
 #include "nsIWidget.h"
 #include "nsIViewManager.h"
 #include "mozilla/unused.h"
--- a/dom/locales/en-US/chrome/dom/dom.properties
+++ b/dom/locales/en-US/chrome/dom/dom.properties
@@ -109,13 +109,10 @@ IsEqualNodeWarning=Use of attributes' is
 TextContentWarning=Use of attributes' textContent attribute is deprecated. Use value instead.
 EnablePrivilegeWarning=Use of enablePrivilege is deprecated.  Please use code that runs with the system principal (e.g. an extension) instead.
 PositionWarning=Use of XMLHttpRequest's progress events' position attribute is deprecated.
 TotalSizeWarning=Use of XMLHttpRequest's progress events' totalSize attribute is deprecated.
 nsIJSONDecodeDeprecatedWarning=nsIJSON.decode is deprecated.  Please use JSON.parse instead.
 nsIJSONEncodeDeprecatedWarning=nsIJSON.encode is deprecated.  Please use JSON.stringify instead.
 nsIDOMWindowInternalWarning=Use of nsIDOMWindowInternal is deprecated. Use nsIDOMWindow instead.
 IsSameNodeWarning=Use of isSameNode is deprecated.  Please use A == B to test for equality instead.
-XmlVersionWarning=Use of xmlVersion is deprecated.
 InputEncodingWarning=Use of inputEncoding is deprecated.
-XmlStandaloneWarning=Use of xmlStandalone is deprecated.
-IsElementContentWhitespaceWarning=Use of isElementContentWhitespaceWarning is deprecated.
 GlobalStorageWarning=Use of globalStorage is deprecated. Please use localStorage instead.
--- a/dom/tests/mochitest/bugs/test_bug42976.html
+++ b/dom/tests/mochitest/bugs/test_bug42976.html
@@ -31,19 +31,16 @@ function runTest() {
     var doc = iframes[i].contentDocument;
     var clonefalse = doc.cloneNode(false);
     // doc.compatMode
     ok(doc.compatMode == clonefalse.compatMode, "compatMode not preserved correctly; " + iframes[i].id);
   
     // doc.contentType
     ok(doc.contentType == clonefalse.contentType, "contentType not preserved correctly; " + iframes[i].id);
   
-    // doc.xmlStandalone
-    ok(doc.xmlStandalone == clonefalse.xmlStandalone, "xmlStandalone not preserved correctly; " + iframes[i].id);
-  
     // doc.characterSet
     ok(doc.characterSet == clonefalse.characterSet, "charset not preserved correctly; " + iframes[i].id);
   
     // innerHTML+tag case test
     var clonetrue = doc.cloneNode(true);
     doc.documentElement.firstChild.innerHTML="<div><dD></dD></div>";
     clonetrue.documentElement.firstChild.innerHTML="<div><dD></dD></div>";
     ok(doc.documentElement.innerHTML == clonetrue.documentElement.innerHTML,
--- a/embedding/components/windowwatcher/src/nsWindowWatcher.cpp
+++ b/embedding/components/windowwatcher/src/nsWindowWatcher.cpp
@@ -73,17 +73,16 @@
 #include "nsIWebBrowserChrome.h"
 #include "nsIWebNavigation.h"
 #include "nsIWindowCreator.h"
 #include "nsIWindowCreator2.h"
 #include "nsIXPConnect.h"
 #include "nsPIDOMWindow.h"
 #include "nsIMarkupDocumentViewer.h"
 #include "nsIContentViewer.h"
-#include "nsIDocumentViewer.h"
 #include "nsIWindowProvider.h"
 #include "nsIMutableArray.h"
 #include "nsISupportsArray.h"
 #include "nsIDOMStorageObsolete.h"
 #include "nsIDOMStorage.h"
 #include "nsPIDOMStorage.h"
 #include "nsIWidget.h"
 #include "nsFocusManager.h"
--- a/js/xpconnect/src/dom_quickstubs.qsconf
+++ b/js/xpconnect/src/dom_quickstubs.qsconf
@@ -233,21 +233,23 @@ members = [
     'nsIDOMHTMLFormElement.elements',
     'nsIDOMHTMLFormElement.name',
     'nsIDOMHTMLFormElement.submit',
     'nsIDOMHTMLFormElement.length',
     'nsIDOMHTMLFormElement.target',
     'nsIDOMHTMLFormElement.action',
     'nsIDOMHTMLFrameElement.src',
     'nsIDOMHTMLFrameElement.contentDocument',
+    'nsIDOMHTMLFrameElement.contentWindow',
     'nsIDOMHTMLFrameElement.name',
     'nsIDOMHTMLFrameSetElement.rows',
     'nsIDOMHTMLFrameSetElement.cols',
     'nsIDOMHTMLIFrameElement.src',
     'nsIDOMHTMLIFrameElement.contentDocument',
+    'nsIDOMHTMLIFrameElement.contentWindow',
     'nsIDOMHTMLImageElement.src',
     'nsIDOMHTMLImageElement.name',
     'nsIDOMHTMLImageElement.height',
     'nsIDOMHTMLImageElement.width',
     'nsIDOMHTMLImageElement.complete',
     'nsIDOMHTMLInputElement.defaultChecked',
     'nsIDOMHTMLInputElement.disabled',
     'nsIDOMHTMLInputElement.select',
@@ -335,17 +337,16 @@ members = [
     'nsIDOMNSHTMLElement.isContentEditable',
     'nsIDOMNSHTMLElement.offsetParent',
     'nsIDOMNSHTMLElement.innerHTML',
     'nsIDOMNSHTMLElement.offsetLeft',
     'nsIDOMNSHTMLElement.offsetTop',
     'nsIDOMNSHTMLElement.offsetHeight',
     'nsIDOMNSHTMLElement.offsetWidth',
     'nsIDOMNSHTMLElement.scrollIntoView',
-    'nsIDOMNSHTMLFrameElement.contentWindow',
     'nsIDOMHTMLOptionsCollection.selectedIndex',
     'nsIDOMHTMLOptionsCollection.add',
 
     # dom/interfaces/json - None.
     # All methods of nsIJSON call GetCurrentNativeCallContext.
 
     # dom/interfaces/load-save - None.
 
--- a/layout/base/Makefile.in
+++ b/layout/base/Makefile.in
@@ -69,17 +69,16 @@ EXPORTS		= \
 		nsCSSFrameConstructor.h \
 		nsChangeHint.h \
 		nsCompatibility.h \
 		nsDisplayItemTypes.h \
 		nsDisplayList.h \
 		nsFrameManager.h \
 		nsFrameManagerBase.h \
 		nsFrameTraversal.h \
-		nsIDocumentViewer.h \
 		nsIFrameTraversal.h \
 		nsILayoutDebugger.h \
 		nsILayoutHistoryState.h \
 		nsIPercentHeightObserver.h  \
 		nsIPresShell.h \
 		nsIReflowCallback.h \
 		nsLayoutErrors.h \
 		nsLayoutUtils.h \
--- a/layout/base/nsDocumentViewer.cpp
+++ b/layout/base/nsDocumentViewer.cpp
@@ -44,17 +44,17 @@
 #include "nscore.h"
 #include "nsCOMPtr.h"
 #include "nsCRT.h"
 #include "nsString.h"
 #include "nsReadableUtils.h"
 #include "nsISupports.h"
 #include "nsIContent.h"
 #include "nsIContentViewerContainer.h"
-#include "nsIDocumentViewer.h"
+#include "nsIContentViewer.h"
 #include "mozilla/FunctionTimer.h"
 #include "nsIDocumentViewerPrint.h"
 #include "nsIPrivateDOMEvent.h"
 #include "nsIDOMBeforeUnloadEvent.h"
 #include "nsIDocument.h"
 #include "nsPresContext.h"
 #include "nsIPresShell.h"
 #include "nsStyleSet.h"
@@ -277,17 +277,17 @@ public:
   nsresult             Init(DocumentViewerImpl *aDocViewer);
 
 private:
     DocumentViewerImpl*  mDocViewer;
 };
 
 
 //-------------------------------------------------------------
-class DocumentViewerImpl : public nsIDocumentViewer,
+class DocumentViewerImpl : public nsIContentViewer,
                            public nsIContentViewerEdit,
                            public nsIContentViewerFile,
                            public nsIMarkupDocumentViewer,
                            public nsIDocumentViewerPrint
 
 #ifdef NS_PRINTING
                            , public nsIWebBrowserPrint
 #endif
@@ -303,34 +303,16 @@ public:
   NS_DECL_AND_IMPL_ZEROING_OPERATOR_NEW
 
   // nsISupports interface...
   NS_DECL_ISUPPORTS
 
   // nsIContentViewer interface...
   NS_DECL_NSICONTENTVIEWER
 
-  // nsIDocumentViewer interface...
-  NS_IMETHOD GetPresShell(nsIPresShell** aResult);
-  NS_IMETHOD GetPresContext(nsPresContext** aResult);
-  NS_IMETHOD SetDocumentInternal(nsIDocument* aDocument,
-                                 bool aForceReuseInnerWindow);
-  /**
-   * Find the view to use as the container view for MakeWindow. Returns
-   * null if this will be the root of a view manager hierarchy. In that
-   * case, if mParentWidget is null then this document should not even
-   * be displayed.
-   */
-  virtual nsIView* FindContainerView();
-
-  /**
-   * Set collector for navigation timing data (load, unload events).
-   */
-  virtual void SetNavigationTiming(nsDOMNavigationTiming* timing);
-
   // nsIContentViewerEdit
   NS_DECL_NSICONTENTVIEWEREDIT
 
   // nsIContentViewerFile
   NS_DECL_NSICONTENTVIEWERFILE
 
   // nsIMarkupDocumentViewer
   NS_DECL_NSIMARKUPDOCUMENTVIEWER
@@ -531,17 +513,17 @@ public:
 //------------------------------------------------------------------
 // DocumentViewerImpl
 //------------------------------------------------------------------
 // Class IDs
 static NS_DEFINE_CID(kViewManagerCID,       NS_VIEW_MANAGER_CID);
 
 //------------------------------------------------------------------
 nsresult
-NS_NewDocumentViewer(nsIDocumentViewer** aResult)
+NS_NewContentViewer(nsIContentViewer** aResult)
 {
   *aResult = new DocumentViewerImpl();
 
   NS_ADDREF(*aResult);
 
   return NS_OK;
 }
 
@@ -588,17 +570,16 @@ DocumentViewerImpl::DocumentViewerImpl()
   PrepareToStartLoad();
 }
 
 NS_IMPL_ADDREF(DocumentViewerImpl)
 NS_IMPL_RELEASE(DocumentViewerImpl)
 
 NS_INTERFACE_MAP_BEGIN(DocumentViewerImpl)
     NS_INTERFACE_MAP_ENTRY(nsIContentViewer)
-    NS_INTERFACE_MAP_ENTRY(nsIDocumentViewer)
     NS_INTERFACE_MAP_ENTRY(nsIMarkupDocumentViewer)
     NS_INTERFACE_MAP_ENTRY(nsIContentViewerFile)
     NS_INTERFACE_MAP_ENTRY(nsIContentViewerEdit)
     NS_INTERFACE_MAP_ENTRY(nsIDocumentViewerPrint)
     NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIContentViewer)
 #ifdef NS_PRINTING
     NS_INTERFACE_MAP_ENTRY(nsIWebBrowserPrint)
 #endif
@@ -1010,17 +991,17 @@ NS_IMETHODIMP
 DocumentViewerImpl::LoadComplete(nsresult aStatus)
 {
   NS_TIME_FUNCTION;
   /* We need to protect ourself against auto-destruction in case the
      window is closed while processing the OnLoad event.  See bug
      http://bugzilla.mozilla.org/show_bug.cgi?id=78445 for more
      explanation.
   */
-  nsCOMPtr<nsIDocumentViewer> kungFuDeathGrip(this);
+  nsRefPtr<DocumentViewerImpl> kungFuDeathGrip(this);
 
   // Flush out layout so it's up-to-date by the time onload is called.
   // Note that this could destroy the window, so do this before
   // checking for our mDocument and its window.
   if (mPresShell && !mStopped) {
     // Hold strong ref because this could conceivably run script
     nsCOMPtr<nsIPresShell> shell = mPresShell;
     shell->FlushPendingNotifications(Flush_Layout);
@@ -1328,30 +1309,29 @@ DocumentViewerImpl::PageHide(bool aIsUnl
   return NS_OK;
 }
 
 static void
 AttachContainerRecurse(nsIDocShell* aShell)
 {
   nsCOMPtr<nsIContentViewer> viewer;
   aShell->GetContentViewer(getter_AddRefs(viewer));
-  nsCOMPtr<nsIDocumentViewer> docViewer = do_QueryInterface(viewer);
-  if (docViewer) {
-    nsIDocument* doc = docViewer->GetDocument();
+  if (viewer) {
+    nsIDocument* doc = viewer->GetDocument();
     if (doc) {
       doc->SetContainer(aShell);
     }
     nsRefPtr<nsPresContext> pc;
-    docViewer->GetPresContext(getter_AddRefs(pc));
+    viewer->GetPresContext(getter_AddRefs(pc));
     if (pc) {
       pc->SetContainer(aShell);
       pc->SetLinkHandler(nsCOMPtr<nsILinkHandler>(do_QueryInterface(aShell)));
     }
     nsCOMPtr<nsIPresShell> presShell;
-    docViewer->GetPresShell(getter_AddRefs(presShell));
+    viewer->GetPresShell(getter_AddRefs(presShell));
     if (presShell) {
       presShell->SetForwardingContainer(nsnull);
     }
   }
 
   // Now recurse through the children
   nsCOMPtr<nsIDocShellTreeNode> node = do_QueryInterface(aShell);
   NS_ASSERTION(node, "docshells must implement nsIDocShellTreeNode");
@@ -1486,30 +1466,29 @@ DocumentViewerImpl::Close(nsISHEntry *aS
 }
 
 static void
 DetachContainerRecurse(nsIDocShell *aShell)
 {
   // Unhook this docshell's presentation
   nsCOMPtr<nsIContentViewer> viewer;
   aShell->GetContentViewer(getter_AddRefs(viewer));
-  nsCOMPtr<nsIDocumentViewer> docViewer = do_QueryInterface(viewer);
-  if (docViewer) {
-    nsIDocument* doc = docViewer->GetDocument();
+  if (viewer) {
+    nsIDocument* doc = viewer->GetDocument();
     if (doc) {
       doc->SetContainer(nsnull);
     }
     nsRefPtr<nsPresContext> pc;
-    docViewer->GetPresContext(getter_AddRefs(pc));
+    viewer->GetPresContext(getter_AddRefs(pc));
     if (pc) {
       pc->SetContainer(nsnull);
       pc->SetLinkHandler(nsnull);
     }
     nsCOMPtr<nsIPresShell> presShell;
-    docViewer->GetPresShell(getter_AddRefs(presShell));
+    viewer->GetPresShell(getter_AddRefs(presShell));
     if (presShell) {
       presShell->SetForwardingContainer(nsWeakPtr(do_GetWeakReference(aShell)));
     }
   }
 
   // Now recurse through the children
   nsCOMPtr<nsIDocShellTreeNode> node = do_QueryInterface(aShell);
   NS_ASSERTION(node, "docshells must implement nsIDocShellTreeNode");
deleted file mode 100644
--- a/layout/base/nsIDocumentViewer.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is Mozilla Communicator client code.
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corporation.
- * Portions created by the Initial Developer are Copyright (C) 1998
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either of the GNU General Public License Version 2 or later (the "GPL"),
- * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-/* container for a document and its presentation */
-
-#ifndef nsIDocumentViewer_h___
-#define nsIDocumentViewer_h___
-
-#include "nsIContentViewer.h"
-
-class nsIDocument;
-class nsPresContext;
-class nsIPresShell;
-class nsIStyleSheet;
-class nsIView;
-
-class nsDOMNavigationTiming;
-
-#define NS_IDOCUMENT_VIEWER_IID \
-  { 0x5a5c9a1d, 0x49c4, 0x4f3f, \
-    { 0x80, 0xcd, 0x12, 0x09, 0x5b, 0x1e, 0x1f, 0x61 } }
-
-/**
- * A document viewer is a kind of content viewer that uses NGLayout
- * to manage the presentation of the content.
- */
-class nsIDocumentViewer : public nsIContentViewer
-{
-public:
-  NS_DECLARE_STATIC_IID_ACCESSOR(NS_IDOCUMENT_VIEWER_IID)
-  
-  NS_IMETHOD GetPresShell(nsIPresShell** aResult) = 0;
-  
-  NS_IMETHOD GetPresContext(nsPresContext** aResult) = 0;
-
-  NS_IMETHOD SetDocumentInternal(nsIDocument* aDocument,
-                                 bool aForceReuseInnerWindow) = 0;
-
-  virtual nsIView* FindContainerView() = 0;
-
-  virtual void SetNavigationTiming(nsDOMNavigationTiming* timing) = 0;
-};
-
-NS_DEFINE_STATIC_IID_ACCESSOR(nsIDocumentViewer, NS_IDOCUMENT_VIEWER_IID)
-
-#endif /* nsIDocumentViewer_h___ */
--- a/layout/base/nsPresContext.cpp
+++ b/layout/base/nsPresContext.cpp
@@ -41,17 +41,16 @@
 
 #include "nsCOMPtr.h"
 #include "nsPresContext.h"
 #include "nsIPresShell.h"
 #include "nsILinkHandler.h"
 #include "nsIDocShellTreeItem.h"
 #include "nsIDocShell.h"
 #include "nsIContentViewer.h"
-#include "nsIDocumentViewer.h"
 #include "nsPIDOMWindow.h"
 #include "nsStyleSet.h"
 #include "nsImageLoader.h"
 #include "nsIContent.h"
 #include "nsIFrame.h"
 #include "nsIURL.h"
 #include "nsIDocument.h"
 #include "nsStyleContext.h"
@@ -1730,20 +1729,19 @@ nsPresContext::SetPrintSettings(nsIPrint
 bool
 nsPresContext::EnsureVisible()
 {
   nsCOMPtr<nsIDocShell> docShell(do_QueryReferent(mContainer));
   if (docShell) {
     nsCOMPtr<nsIContentViewer> cv;
     docShell->GetContentViewer(getter_AddRefs(cv));
     // Make sure this is the content viewer we belong with
-    nsCOMPtr<nsIDocumentViewer> docV(do_QueryInterface(cv));
-    if (docV) {
+    if (cv) {
       nsRefPtr<nsPresContext> currentPresContext;
-      docV->GetPresContext(getter_AddRefs(currentPresContext));
+      cv->GetPresContext(getter_AddRefs(currentPresContext));
       if (currentPresContext == this) {
         // OK, this is us.  We want to call Show() on the content viewer.
         cv->Show();
         return PR_TRUE;
       }
     }
   }
   return PR_FALSE;
--- a/layout/build/nsContentDLF.cpp
+++ b/layout/build/nsContentDLF.cpp
@@ -36,20 +36,20 @@
  *
  * ***** END LICENSE BLOCK ***** */
 #include "nsCOMPtr.h"
 #include "nsContentDLF.h"
 #include "nsGenericHTMLElement.h"
 #include "nsGkAtoms.h"
 #include "nsIComponentManager.h"
 #include "nsIComponentRegistrar.h"
+#include "nsIContentViewer.h"
 #include "nsICategoryManager.h"
 #include "nsIDocumentLoaderFactory.h"
 #include "nsIDocument.h"
-#include "nsIDocumentViewer.h"
 #include "nsIURL.h"
 #include "nsNodeInfo.h"
 #include "nsNodeInfoManager.h"
 #include "nsIScriptSecurityManager.h"
 #include "nsString.h"
 #include "nsContentCID.h"
 #include "prprf.h"
 #include "nsNetUtil.h"
@@ -79,17 +79,17 @@ static NS_DEFINE_IID(kXMLDocumentCID, NS
 static NS_DEFINE_IID(kSVGDocumentCID, NS_SVGDOCUMENT_CID);
 #ifdef MOZ_MEDIA
 static NS_DEFINE_IID(kVideoDocumentCID, NS_VIDEODOCUMENT_CID);
 #endif
 static NS_DEFINE_IID(kImageDocumentCID, NS_IMAGEDOCUMENT_CID);
 static NS_DEFINE_IID(kXULDocumentCID, NS_XULDOCUMENT_CID);
 
 nsresult
-NS_NewDocumentViewer(nsIDocumentViewer** aResult);
+NS_NewContentViewer(nsIContentViewer** aResult);
 
 // XXXbz if you change the MIME types here, be sure to update
 // nsIParser.h and DetermineParseMode in nsParser.cpp accordingly.
 static const char* const gHTMLTypes[] = {
   TEXT_HTML,
   TEXT_PLAIN,
   TEXT_CSS,
   TEXT_JAVASCRIPT,
@@ -320,34 +320,27 @@ nsContentDLF::CreateInstance(const char*
   return NS_ERROR_FAILURE;
 }
 
 
 NS_IMETHODIMP
 nsContentDLF::CreateInstanceForDocument(nsISupports* aContainer,
                                         nsIDocument* aDocument,
                                         const char *aCommand,
-                                        nsIContentViewer** aDocViewerResult)
+                                        nsIContentViewer** aContentViewer)
 {
   NS_TIME_FUNCTION;
 
-  nsresult rv = NS_ERROR_FAILURE;  
+  nsCOMPtr<nsIContentViewer> contentViewer;
+  nsresult rv = NS_NewContentViewer(getter_AddRefs(contentViewer));
+  NS_ENSURE_SUCCESS(rv, rv);
 
-  do {
-    nsCOMPtr<nsIDocumentViewer> docv;
-    rv = NS_NewDocumentViewer(getter_AddRefs(docv));
-    if (NS_FAILED(rv))
-      break;
-
-    // Bind the document to the Content Viewer
-    nsIContentViewer* cv = static_cast<nsIContentViewer*>(docv.get());
-    rv = cv->LoadStart(aDocument);
-    NS_ADDREF(*aDocViewerResult = cv);
-  } while (PR_FALSE);
-
+  // Bind the document to the Content Viewer
+  rv = contentViewer->LoadStart(aDocument);
+  contentViewer.forget(aContentViewer);
   return rv;
 }
 
 NS_IMETHODIMP
 nsContentDLF::CreateBlankDocument(nsILoadGroup *aLoadGroup,
                                   nsIPrincipal* aPrincipal,
                                   nsIDocument **aDocument)
 {
@@ -426,17 +419,17 @@ nsContentDLF::CreateBlankDocument(nsILoa
 
 nsresult
 nsContentDLF::CreateDocument(const char* aCommand,
                              nsIChannel* aChannel,
                              nsILoadGroup* aLoadGroup,
                              nsISupports* aContainer,
                              const nsCID& aDocumentCID,
                              nsIStreamListener** aDocListener,
-                             nsIContentViewer** aDocViewer)
+                             nsIContentViewer** aContentViewer)
 {
   NS_TIME_FUNCTION;
 
   nsresult rv = NS_ERROR_FAILURE;
 
   nsCOMPtr<nsIURI> aURL;
   rv = aChannel->GetURI(getter_AddRefs(aURL));
   if (NS_FAILED(rv)) return rv;
@@ -445,90 +438,80 @@ nsContentDLF::CreateDocument(const char*
   if (nsnull != aURL) {
     nsAutoString tmp;
     aURL->ToString(tmp);
     fputs(NS_LossyConvertUTF16toASCII(tmp).get(), stdout);
     printf(": creating document\n");
   }
 #endif
 
-  nsCOMPtr<nsIDocument> doc;
-  nsCOMPtr<nsIDocumentViewer> docv;
-  do {
-    // Create the document
-    doc = do_CreateInstance(aDocumentCID, &rv);
-    if (NS_FAILED(rv))
-      break;
+  // Create the document
+  nsCOMPtr<nsIDocument> doc = do_CreateInstance(aDocumentCID, &rv);
+  NS_ENSURE_SUCCESS(rv, rv);
 
-    // Create the document viewer  XXX: could reuse document viewer here!
-    rv = NS_NewDocumentViewer(getter_AddRefs(docv));
-    if (NS_FAILED(rv))
-      break;
+  // Create the content viewer  XXX: could reuse content viewer here!
+  nsCOMPtr<nsIContentViewer> contentViewer;
+  rv = NS_NewContentViewer(getter_AddRefs(contentViewer));
+  NS_ENSURE_SUCCESS(rv, rv);
 
-    doc->SetContainer(aContainer);
+  doc->SetContainer(aContainer);
 
-    // Initialize the document to begin loading the data.  An
-    // nsIStreamListener connected to the parser is returned in
-    // aDocListener.
-    rv = doc->StartDocumentLoad(aCommand, aChannel, aLoadGroup, aContainer, aDocListener, PR_TRUE);
-    if (NS_FAILED(rv))
-      break;
+  // Initialize the document to begin loading the data.  An
+  // nsIStreamListener connected to the parser is returned in
+  // aDocListener.
+  rv = doc->StartDocumentLoad(aCommand, aChannel, aLoadGroup, aContainer, aDocListener, true);
+  NS_ENSURE_SUCCESS(rv, rv);
 
-    // Bind the document to the Content Viewer
-    rv = docv->LoadStart(doc);
-    *aDocViewer = docv;
-    NS_IF_ADDREF(*aDocViewer);
-  } while (PR_FALSE);
-
+  // Bind the document to the Content Viewer
+  rv = contentViewer->LoadStart(doc);
+  contentViewer.forget(aContentViewer);
   return rv;
 }
 
 nsresult
 nsContentDLF::CreateXULDocument(const char* aCommand,
                                 nsIChannel* aChannel,
                                 nsILoadGroup* aLoadGroup,
                                 const char* aContentType,
                                 nsISupports* aContainer,
                                 nsISupports* aExtraInfo,
                                 nsIStreamListener** aDocListener,
-                                nsIContentViewer** aDocViewer)
+                                nsIContentViewer** aContentViewer)
 {
   NS_TIME_FUNCTION;
 
   nsresult rv;
   nsCOMPtr<nsIDocument> doc = do_CreateInstance(kXULDocumentCID, &rv);
   if (NS_FAILED(rv)) return rv;
 
-  nsCOMPtr<nsIDocumentViewer> docv;
-  rv = NS_NewDocumentViewer(getter_AddRefs(docv));
+  nsCOMPtr<nsIContentViewer> contentViewer;
+  rv = NS_NewContentViewer(getter_AddRefs(contentViewer));
   if (NS_FAILED(rv)) return rv;
 
   nsCOMPtr<nsIURI> aURL;
   rv = aChannel->GetURI(getter_AddRefs(aURL));
   if (NS_FAILED(rv)) return rv;
 
   /* 
    * Initialize the document to begin loading the data...
    *
    * An nsIStreamListener connected to the parser is returned in
    * aDocListener.
    */
 
   doc->SetContainer(aContainer);
 
   rv = doc->StartDocumentLoad(aCommand, aChannel, aLoadGroup, aContainer, aDocListener, PR_TRUE);
-  if (NS_SUCCEEDED(rv)) {
-    /*
-     * Bind the document to the Content Viewer...
-     */
-    rv = docv->LoadStart(doc);
-    *aDocViewer = docv;
-    NS_IF_ADDREF(*aDocViewer);
-  }
-   
+  if (NS_FAILED(rv)) return rv;
+
+  /*
+   * Bind the document to the Content Viewer...
+   */
+  rv = contentViewer->LoadStart(doc);
+  contentViewer.forget(aContentViewer);
   return rv;
 }
 
 bool nsContentDLF::IsImageContentType(const char* aContentType) {
   nsCOMPtr<imgILoader> loader(do_GetService("@mozilla.org/image/loader;1"));
   bool isDecoderAvailable = false;
   loader->SupportImageWithMimeType(aContentType, &isDecoderAvailable);
   return isDecoderAvailable;
--- a/layout/build/nsContentDLF.h
+++ b/layout/build/nsContentDLF.h
@@ -34,23 +34,21 @@
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #ifndef nsContentDLF_h__
 #define nsContentDLF_h__
 
 #include "nsIDocumentLoaderFactory.h"
-#include "nsIDocumentViewer.h"
 #include "nsIDocument.h"
 #include "nsMimeTypes.h"
 
 class nsIChannel;
 class nsIContentViewer;
-class nsIDocumentViewer;
 class nsIFile;
 class nsIInputStream;
 class nsILoadGroup;
 class nsIStreamListener;
 
 #define CONTENT_DLF_CONTRACTID "@mozilla.org/content/document-loader-factory;1"
 #define PLUGIN_DLF_CONTRACTID "@mozilla.org/content/plugin/document-loader-factory;1"
 
@@ -66,26 +64,26 @@ public:
   nsresult InitUAStyleSheet();
 
   nsresult CreateDocument(const char* aCommand,
                           nsIChannel* aChannel,
                           nsILoadGroup* aLoadGroup,
                           nsISupports* aContainer,
                           const nsCID& aDocumentCID,
                           nsIStreamListener** aDocListener,
-                          nsIContentViewer** aDocViewer);
+                          nsIContentViewer** aContentViewer);
 
   nsresult CreateXULDocument(const char* aCommand,
                              nsIChannel* aChannel,
                              nsILoadGroup* aLoadGroup,
                              const char* aContentType,
                              nsISupports* aContainer,
                              nsISupports* aExtraInfo,
                              nsIStreamListener** aDocListener,
-                             nsIContentViewer** aDocViewer);
+                             nsIContentViewer** aContentViewer);
 
 private:
   static nsresult EnsureUAStyleSheet();
   static bool IsImageContentType(const char* aContentType);
 };
 
 nsresult
 NS_NewContentDocumentLoaderFactory(nsIDocumentLoaderFactory** aResult);
--- a/layout/build/nsLayoutModule.cpp
+++ b/layout/build/nsLayoutModule.cpp
@@ -48,23 +48,23 @@
 #include "nsNoDataProtocolContentPolicy.h"
 #include "nsDOMCID.h"
 #include "nsHTMLContentSerializer.h"
 #include "nsHTMLParts.h"
 #include "nsGenericHTMLElement.h"
 #include "nsIComponentManager.h"
 #include "nsIContentIterator.h"
 #include "nsIContentSerializer.h"
+#include "nsIContentViewer.h"
 #include "nsIController.h"
 #include "nsIControllers.h"
 #include "nsIDOMDOMImplementation.h"
 #include "nsIDOMRange.h"
 #include "nsIDocument.h"
 #include "nsIDocumentEncoder.h"
-#include "nsIDocumentViewer.h"
 #include "nsIFactory.h"
 #include "nsIFrameUtil.h"
 #include "nsHTMLStyleSheet.h"
 #include "nsIHTMLToTextSink.h"
 #include "nsILayoutDebugger.h"
 #include "nsINameSpaceManager.h"
 #include "nsINodeInfo.h"
 #include "nsIObserver.h"
@@ -436,17 +436,17 @@ nsresult NS_NewTreeBoxObject(nsIBoxObjec
 
 nsresult NS_NewCanvasRenderingContext2D(nsIDOMCanvasRenderingContext2D** aResult);
 nsresult NS_NewCanvasRenderingContext2DThebes(nsIDOMCanvasRenderingContext2D** aResult);
 nsresult NS_NewCanvasRenderingContextWebGL(nsIDOMWebGLRenderingContext** aResult);
 
 nsresult NS_CreateFrameTraversal(nsIFrameTraversal** aResult);
 
 nsresult NS_NewDomSelection(nsISelection** aResult);
-nsresult NS_NewDocumentViewer(nsIDocumentViewer** aResult);
+nsresult NS_NewContentViewer(nsIContentViewer** aResult);
 nsresult NS_NewRange(nsIDOMRange** aResult);
 nsresult NS_NewRangeUtils(nsIRangeUtils** aResult);
 nsresult NS_NewContentIterator(nsIContentIterator** aResult);
 nsresult NS_NewPreContentIterator(nsIContentIterator** aResult);
 nsresult NS_NewGenRegularIterator(nsIContentIterator** aResult);
 nsresult NS_NewContentSubtreeIterator(nsIContentIterator** aResult);
 nsresult NS_NewGenSubtreeIterator(nsIContentIterator** aInstancePtrResult);
 nsresult NS_NewContentDocumentLoaderFactory(nsIDocumentLoaderFactory** aResult);
@@ -500,17 +500,17 @@ MAKE_CTOR(CreateNewContainerBoxObject,  
 NS_GENERIC_FACTORY_CONSTRUCTOR(inDOMView)
 #endif
 NS_GENERIC_FACTORY_CONSTRUCTOR(inDeepTreeWalker)
 NS_GENERIC_FACTORY_CONSTRUCTOR(inFlasher)
 NS_GENERIC_FACTORY_CONSTRUCTOR(inCSSValueSearch)
 NS_GENERIC_FACTORY_CONSTRUCTOR(inDOMUtils)
 
 MAKE_CTOR(CreateNameSpaceManager,         nsINameSpaceManager,         NS_GetNameSpaceManager)
-MAKE_CTOR(CreateDocumentViewer,           nsIDocumentViewer,           NS_NewDocumentViewer)
+MAKE_CTOR(CreateContentViewer,            nsIContentViewer,            NS_NewContentViewer)
 MAKE_CTOR(CreateHTMLDocument,             nsIDocument,                 NS_NewHTMLDocument)
 MAKE_CTOR(CreateXMLDocument,              nsIDocument,                 NS_NewXMLDocument)
 MAKE_CTOR(CreateSVGDocument,              nsIDocument,                 NS_NewSVGDocument)
 MAKE_CTOR(CreateImageDocument,            nsIDocument,                 NS_NewImageDocument)
 MAKE_CTOR(CreateDOMSelection,             nsISelection,                NS_NewDomSelection)
 MAKE_CTOR(CreateRange,                    nsIDOMRange,                 NS_NewRange)
 MAKE_CTOR(CreateRangeUtils,               nsIRangeUtils,               NS_NewRangeUtils)
 MAKE_CTOR(CreateContentIterator,          nsIContentIterator,          NS_NewContentIterator)
@@ -735,17 +735,17 @@ NS_DEFINE_NAMED_CID(NS_TREEBOXOBJECT_CID
 #ifdef MOZ_XUL
 NS_DEFINE_NAMED_CID(IN_DOMVIEW_CID);
 #endif
 NS_DEFINE_NAMED_CID(IN_DEEPTREEWALKER_CID);
 NS_DEFINE_NAMED_CID(IN_FLASHER_CID);
 NS_DEFINE_NAMED_CID(IN_CSSVALUESEARCH_CID);
 NS_DEFINE_NAMED_CID(IN_DOMUTILS_CID);
 NS_DEFINE_NAMED_CID(NS_NAMESPACEMANAGER_CID);
-NS_DEFINE_NAMED_CID(NS_DOCUMENT_VIEWER_CID);
+NS_DEFINE_NAMED_CID(NS_CONTENT_VIEWER_CID);
 NS_DEFINE_NAMED_CID(NS_HTMLDOCUMENT_CID);
 NS_DEFINE_NAMED_CID(NS_XMLDOCUMENT_CID);
 NS_DEFINE_NAMED_CID(NS_SVGDOCUMENT_CID);
 NS_DEFINE_NAMED_CID(NS_IMAGEDOCUMENT_CID);
 NS_DEFINE_NAMED_CID(NS_DOMSELECTION_CID);
 NS_DEFINE_NAMED_CID(NS_RANGE_CID);
 NS_DEFINE_NAMED_CID(NS_RANGEUTILS_CID);
 NS_DEFINE_NAMED_CID(NS_CONTENTITERATOR_CID);
@@ -869,17 +869,17 @@ static const mozilla::Module::CIDEntry k
 #ifdef MOZ_XUL
   { &kIN_DOMVIEW_CID, false, NULL, inDOMViewConstructor },
 #endif
   { &kIN_DEEPTREEWALKER_CID, false, NULL, inDeepTreeWalkerConstructor },
   { &kIN_FLASHER_CID, false, NULL, inFlasherConstructor },
   { &kIN_CSSVALUESEARCH_CID, false, NULL, inCSSValueSearchConstructor },
   { &kIN_DOMUTILS_CID, false, NULL, inDOMUtilsConstructor },
   { &kNS_NAMESPACEMANAGER_CID, false, NULL, CreateNameSpaceManager },
-  { &kNS_DOCUMENT_VIEWER_CID, false, NULL, CreateDocumentViewer },
+  { &kNS_CONTENT_VIEWER_CID, false, NULL, CreateContentViewer },
   { &kNS_HTMLDOCUMENT_CID, false, NULL, CreateHTMLDocument },
   { &kNS_XMLDOCUMENT_CID, false, NULL, CreateXMLDocument },
   { &kNS_SVGDOCUMENT_CID, false, NULL, CreateSVGDocument },
   { &kNS_IMAGEDOCUMENT_CID, false, NULL, CreateImageDocument },
   { &kNS_DOMSELECTION_CID, false, NULL, CreateDOMSelection },
   { &kNS_RANGE_CID, false, NULL, CreateRange },
   { &kNS_RANGEUTILS_CID, false, NULL, CreateRangeUtils },
   { &kNS_CONTENTITERATOR_CID, false, NULL, CreateContentIterator },
--- a/layout/generic/nsSubDocumentFrame.cpp
+++ b/layout/generic/nsSubDocumentFrame.cpp
@@ -50,17 +50,16 @@
 #include "nsGenericHTMLElement.h"
 #include "nsIDocShell.h"
 #include "nsIDocShellLoadInfo.h"
 #include "nsIDocShellTreeItem.h"
 #include "nsIDocShellTreeNode.h"
 #include "nsIDocShellTreeOwner.h"
 #include "nsIBaseWindow.h"
 #include "nsIContentViewer.h"
-#include "nsIDocumentViewer.h"
 #include "nsPresContext.h"
 #include "nsIPresShell.h"
 #include "nsIComponentManager.h"
 #include "nsFrameManager.h"
 #include "nsIStreamListener.h"
 #include "nsIURL.h"
 #include "nsNetUtil.h"
 #include "nsIDocument.h"
@@ -959,25 +958,22 @@ EndSwapDocShellsForDocument(nsIDocument*
   // Now also update all nsDeviceContext::mWidget to that of the
   // container view in the new hierarchy.
   nsCOMPtr<nsISupports> container = aDocument->GetContainer();
   nsCOMPtr<nsIDocShell> ds = do_QueryInterface(container);
   if (ds) {
     nsCOMPtr<nsIContentViewer> cv;
     ds->GetContentViewer(getter_AddRefs(cv));
     while (cv) {
-      nsCOMPtr<nsIDocumentViewer> dv = do_QueryInterface(cv);
-      if (dv) {
-        nsCOMPtr<nsPresContext> pc;
-        dv->GetPresContext(getter_AddRefs(pc));
-        nsDeviceContext* dc = pc ? pc->DeviceContext() : nsnull;
-        if (dc) {
-          nsIView* v = dv->FindContainerView();
-          dc->Init(v ? v->GetNearestWidget(nsnull) : nsnull);
-        }
+      nsCOMPtr<nsPresContext> pc;
+      cv->GetPresContext(getter_AddRefs(pc));
+      nsDeviceContext* dc = pc ? pc->DeviceContext() : nsnull;
+      if (dc) {
+        nsIView* v = cv->FindContainerView();
+        dc->Init(v ? v->GetNearestWidget(nsnull) : nsnull);
       }
       nsCOMPtr<nsIContentViewer> prev;
       cv->GetPreviousViewer(getter_AddRefs(prev));
       cv = prev;
     }
   }
 
   aDocument->EnumerateFreezableElements(
--- a/layout/printing/nsPrintEngine.cpp
+++ b/layout/printing/nsPrintEngine.cpp
@@ -149,17 +149,16 @@ static const char kPrintingPromptService
 #include "nsGUIEvent.h"
 #include "nsHTMLReflowState.h"
 #include "nsIDOMHTMLAnchorElement.h"
 #include "nsIDOMHTMLAreaElement.h"
 #include "nsIDOMHTMLLinkElement.h"
 #include "nsIDOMHTMLImageElement.h"
 #include "nsIContentViewerContainer.h"
 #include "nsIContentViewer.h"
-#include "nsIDocumentViewer.h"
 #include "nsIDocumentViewerPrint.h"
 
 #include "nsPIDOMWindow.h"
 #include "nsFocusManager.h"
 #include "nsRange.h"
 #include "nsCDefaultURIFixup.h"
 #include "nsIURIFixup.h"
 #include "mozilla/dom/Element.h"
@@ -1909,19 +1908,19 @@ nsPrintEngine::ReflowPrintObject(nsPrint
     }
   } else {
     nscoord pageWidth, pageHeight;
     mPrt->mPrintDC->GetDeviceSurfaceDimensions(pageWidth, pageHeight);
     adjSize = nsSize(pageWidth, pageHeight);
     documentIsTopLevel = PR_TRUE;
 
     if (mIsCreatingPrintPreview) {
-      nsCOMPtr<nsIDocumentViewer> dv = do_QueryInterface(mDocViewerPrint);
-      if (dv) {
-        parentView = dv->FindContainerView();
+      nsCOMPtr<nsIContentViewer> cv = do_QueryInterface(mDocViewerPrint);
+      if (cv) {
+        parentView = cv->FindContainerView();
       }
     }
   }
 
   NS_ASSERTION(!aPO->mPresContext, "Recreating prescontext");
 
   // create the PresContext
   aPO->mPresContext = new nsPresContext(aPO->mDocument,
--- a/layout/tools/layout-debug/src/nsLayoutDebuggingTools.cpp
+++ b/layout/tools/layout-debug/src/nsLayoutDebuggingTools.cpp
@@ -38,17 +38,17 @@
  * ***** END LICENSE BLOCK ***** */
 
 #include "nsLayoutDebuggingTools.h"
 
 #include "nsIDocShell.h"
 #include "nsIDocShellTreeNode.h"
 #include "nsIDocShellTreeItem.h"
 #include "nsPIDOMWindow.h"
-#include "nsIDocumentViewer.h"
+#include "nsIContentViewer.h"
 
 #include "nsIServiceManager.h"
 #include "nsIAtom.h"
 #include "nsQuickSort.h"
 
 #include "nsIContent.h"
 #include "nsIDocument.h"
 #include "nsIDOMDocument.h"
@@ -75,39 +75,24 @@ doc_viewer(nsIDocShell *aDocShell)
     nsIContentViewer *result = nsnull;
     aDocShell->GetContentViewer(&result);
     return result;
 }
 
 static already_AddRefed<nsIPresShell>
 pres_shell(nsIDocShell *aDocShell)
 {
-    nsCOMPtr<nsIDocumentViewer> dv =
-        do_QueryInterface(nsCOMPtr<nsIContentViewer>(doc_viewer(aDocShell)));
-    if (!dv)
+    nsCOMPtr<nsIContentViewer> cv = doc_viewer(aDocShell);
+    if (!cv)
         return nsnull;
-    nsIPresShell *result = nsnull;
-    dv->GetPresShell(&result);
-    return result;
+    nsCOMPtr<nsIPresShell> result;
+    cv->GetPresShell(getter_AddRefs(result));
+    return result.forget();
 }
 
-#if 0 // not currently needed
-static already_AddRefed<nsPresContext>
-pres_context(nsIDocShell *aDocShell)
-{
-    nsCOMPtr<nsIDocumentViewer> dv =
-        do_QueryInterface(nsCOMPtr<nsIContentViewer>(doc_viewer(aDocShell)));
-    if (!dv)
-        return nsnull;
-    nsPresContext *result = nsnull;
-    dv->GetPresContext(result);
-    return result;
-}
-#endif
-
 static nsIViewManager*
 view_manager(nsIDocShell *aDocShell)
 {
     nsCOMPtr<nsIPresShell> shell(pres_shell(aDocShell));
     if (!shell)
         return nsnull;
     return shell->GetViewManager();
 }
--- a/modules/libpr0n/src/SVGDocumentWrapper.cpp
+++ b/modules/libpr0n/src/SVGDocumentWrapper.cpp
@@ -32,23 +32,24 @@
  * decision by deleting the provisions above and replace them with the notice
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include "SVGDocumentWrapper.h"
+
 #include "mozilla/dom/Element.h"
 #include "nsIAtom.h"
 #include "nsICategoryManager.h"
 #include "nsIChannel.h"
+#include "nsIContentViewer.h"
 #include "nsIDocument.h"
 #include "nsIDocumentLoaderFactory.h"
-#include "nsIDocumentViewer.h"
 #include "nsIDOMSVGAnimatedLength.h"
 #include "nsIDOMSVGLength.h"
 #include "nsIHttpChannel.h"
 #include "nsIObserverService.h"
 #include "nsIParser.h"
 #include "nsIPresShell.h"
 #include "nsIRequest.h"
 #include "nsIStreamListener.h"
@@ -347,17 +348,17 @@ SVGDocumentWrapper::Observe(nsISupports*
 }
 
 /** Private helper methods **/
 
 // This method is largely cribbed from
 // nsExternalResourceMap::PendingLoad::SetupViewer.
 nsresult
 SVGDocumentWrapper::SetupViewer(nsIRequest* aRequest,
-                                nsIDocumentViewer** aViewer,
+                                nsIContentViewer** aViewer,
                                 nsILoadGroup** aLoadGroup)
 {
   nsCOMPtr<nsIChannel> chan(do_QueryInterface(aRequest));
   NS_ENSURE_TRUE(chan, NS_ERROR_UNEXPECTED);
 
   // Check for HTTP error page
   nsCOMPtr<nsIHttpChannel> httpChannel(do_QueryInterface(aRequest));
   if (httpChannel) {
@@ -392,30 +393,29 @@ SVGDocumentWrapper::SetupViewer(nsIReque
   nsCOMPtr<nsIStreamListener> listener;
   rv = docLoaderFactory->CreateInstance("external-resource", chan,
                                         newLoadGroup,
                                         SVG_MIMETYPE, nsnull, nsnull,
                                         getter_AddRefs(listener),
                                         getter_AddRefs(viewer));
   NS_ENSURE_SUCCESS(rv, rv);
 
-  nsCOMPtr<nsIDocumentViewer> docViewer = do_QueryInterface(viewer);
-  NS_ENSURE_TRUE(docViewer, NS_ERROR_UNEXPECTED);
+  NS_ENSURE_TRUE(viewer, NS_ERROR_UNEXPECTED);
 
   nsCOMPtr<nsIParser> parser = do_QueryInterface(listener);
   NS_ENSURE_TRUE(parser, NS_ERROR_UNEXPECTED);
 
   // XML-only, because this is for SVG content
   nsIContentSink* sink = parser->GetContentSink();
   nsCOMPtr<nsIXMLContentSink> xmlSink = do_QueryInterface(sink);
   NS_ENSURE_TRUE(sink, NS_ERROR_UNEXPECTED);
 
   listener.swap(mListener);
-  docViewer.swap(*aViewer);
-  newLoadGroup.swap(*aLoadGroup);
+  viewer.forget(aViewer);
+  newLoadGroup.forget(aLoadGroup);
 
   RegisterForXPCOMShutdown();
   return NS_OK;
 }
 
 void
 SVGDocumentWrapper::RegisterForXPCOMShutdown()
 {
--- a/modules/libpr0n/src/SVGDocumentWrapper.h
+++ b/modules/libpr0n/src/SVGDocumentWrapper.h
@@ -39,23 +39,22 @@
 /* This class wraps an SVG document, for use by VectorImage objects. */
 
 #ifndef mozilla_imagelib_SVGDocumentWrapper_h_
 #define mozilla_imagelib_SVGDocumentWrapper_h_
 
 #include "nsCOMPtr.h"
 #include "nsIStreamListener.h"
 #include "nsIObserver.h"
-#include "nsIDocumentViewer.h"
+#include "nsIContentViewer.h"
 #include "nsWeakReference.h"
 
 class nsIAtom;
 class nsIPresShell;
 class nsIRequest;
-class nsIDocumentViewer;
 class nsILoadGroup;
 class nsIFrame;
 struct nsIntSize;
 class nsSVGSVGElement;
 
 #define SVG_MIMETYPE     "image/svg+xml"
 #define OBSERVER_SVC_CID "@mozilla.org/observer-service;1"
 
@@ -166,25 +165,25 @@ public:
    * Methods to control animation.
    */
   void StartAnimation();
   void StopAnimation();
   void ResetAnimation();
 
 private:
   nsresult SetupViewer(nsIRequest *aRequest,
-                       nsIDocumentViewer** aViewer,
+                       nsIContentViewer** aViewer,
                        nsILoadGroup** aLoadGroup);
   void     DestroyViewer();
   void     RegisterForXPCOMShutdown();
   void     UnregisterForXPCOMShutdown();
 
   void     FlushLayout();
 
-  nsCOMPtr<nsIDocumentViewer> mViewer;
+  nsCOMPtr<nsIContentViewer>  mViewer;
   nsCOMPtr<nsILoadGroup>      mLoadGroup;
   nsCOMPtr<nsIStreamListener> mListener;
   bool                        mIgnoreInvalidation;
   bool                        mRegisteredForXPCOMShutdown;
 
   // Lazily-initialized pointer to nsGkAtoms::svg, to make life easier in
   // non-libxul builds, which don't let us reference nsGkAtoms from imagelib.
   static nsIAtom* kSVGAtom;
--- a/modules/libpr0n/src/VectorImage.cpp
+++ b/modules/libpr0n/src/VectorImage.cpp
@@ -32,37 +32,38 @@
  * decision by deleting the provisions above and replace them with the notice
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include "VectorImage.h"
+
 #include "imgIDecoderObserver.h"
 #include "SVGDocumentWrapper.h"
 #include "gfxContext.h"
 #include "gfxPlatform.h"
 #include "nsPresContext.h"
 #include "nsRect.h"
-#include "nsIDocumentViewer.h"
 #include "nsIObserverService.h"
 #include "nsIPresShell.h"
 #include "nsIStreamListener.h"
 #include "nsComponentManagerUtils.h"
 #include "nsServiceManagerUtils.h"
 #include "nsSVGUtils.h"  // for nsSVGUtils::ConvertToSurfaceSize
 #include "nsSVGEffects.h" // for nsSVGRenderingObserver
 #include "gfxDrawable.h"
 #include "gfxUtils.h"
 #include "nsSVGSVGElement.h"
 
-using namespace mozilla::dom;
+namespace mozilla {
 
-namespace mozilla {
+using namespace dom;
+
 namespace imagelib {
 
 // Helper-class: SVGRootRenderingObserver
 class SVGRootRenderingObserver : public nsSVGRenderingObserver {
 public:
   SVGRootRenderingObserver(SVGDocumentWrapper* aDocWrapper,
                            VectorImage*        aVectorImage)
     : nsSVGRenderingObserver(),
--- a/security/manager/boot/src/nsSecureBrowserUIImpl.cpp
+++ b/security/manager/boot/src/nsSecureBrowserUIImpl.cpp
@@ -53,17 +53,16 @@
 #include "nsSecureBrowserUIImpl.h"
 #include "nsCOMPtr.h"
 #include "nsIInterfaceRequestor.h"
 #include "nsIInterfaceRequestorUtils.h"
 #include "nsIServiceManager.h"
 #include "nsIObserverService.h"
 #include "nsCURILoader.h"
 #include "nsIDocShell.h"
-#include "nsIDocumentViewer.h"
 #include "nsIDocument.h"
 #include "nsIPrincipal.h"
 #include "nsIDOMElement.h"
 #include "nsPIDOMWindow.h"
 #include "nsIContent.h"
 #include "nsIWebProgress.h"
 #include "nsIWebProgressListener.h"
 #include "nsIChannel.h"
--- a/widget/src/xpwidgets/nsBaseFilePicker.cpp
+++ b/widget/src/xpwidgets/nsBaseFilePicker.cpp
@@ -39,18 +39,16 @@
  * ***** END LICENSE BLOCK ***** */
 
 #include "nsCOMPtr.h"
 #include "nsPIDOMWindow.h"
 #include "nsIDocShell.h"
 #include "nsIDocShellTreeItem.h"
 #include "nsIInterfaceRequestorUtils.h"
 #include "nsIBaseWindow.h"
-#include "nsIContentViewer.h"
-#include "nsIDocumentViewer.h"
 #include "nsIWidget.h"
 
 #include "nsIStringBundle.h"
 #include "nsXPIDLString.h"
 #include "nsIServiceManager.h"
 #include "nsCOMArray.h"
 #include "nsILocalFile.h"
 #include "nsEnumeratorUtils.h"
--- a/xpfe/appshell/src/nsAppShellWindowEnumerator.cpp
+++ b/xpfe/appshell/src/nsAppShellWindowEnumerator.cpp
@@ -30,29 +30,29 @@
  * use your version of this file under the terms of the MPL, indicate your
  * decision by deleting the provisions above and replace them with the notice
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
+#include "nsAppShellWindowEnumerator.h"
+
 #include "nsIContentViewer.h"
 #include "nsIDocShell.h"
-#include "nsIDocumentViewer.h"
 #include "nsIDocument.h"
 #include "nsIDOMDocument.h"
 #include "nsIDOMElement.h"
 #include "nsIDOMWindow.h"
 #include "nsIFactory.h"
 #include "nsIInterfaceRequestor.h"
 #include "nsIInterfaceRequestorUtils.h"
 #include "nsIXULWindow.h"
 
-#include "nsAppShellWindowEnumerator.h"
 #include "nsWindowMediator.h"
 
 //
 // static helper functions
 //
 
 static nsresult GetDOMWindow(nsIXULWindow* inWindow,
                              nsCOMPtr<nsIDOMWindow> &outDOMWindow);
@@ -78,17 +78,17 @@ nsCOMPtr<nsIDOMNode> GetDOMNodeFromDocSh
   nsCOMPtr<nsIContentViewer> cv;
   aShell->GetContentViewer(getter_AddRefs(cv));
   if (cv) {
     nsCOMPtr<nsIDOMDocument> domdoc(do_QueryInterface(cv->GetDocument()));
     if (domdoc) {
       nsCOMPtr<nsIDOMElement> element;
       domdoc->GetDocumentElement(getter_AddRefs(element));
       if (element)
-        node = do_QueryInterface(element);
+        node = element;
     }
   }
 
   return node;
 }
 
 // generic "retrieve the value of a XUL attribute" function
 void GetAttribute(nsIXULWindow *inWindow, const nsAString &inAttribute,
--- a/xpfe/appshell/src/nsWebShellWindow.cpp
+++ b/xpfe/appshell/src/nsWebShellWindow.cpp
@@ -37,17 +37,17 @@
  * ***** END LICENSE BLOCK ***** */
 
 
 #include "nsWebShellWindow.h"
 
 #include "nsLayoutCID.h"
 #include "nsContentCID.h"
 #include "nsIWeakReference.h"
-
+#include "nsIContentViewer.h"
 #include "nsIComponentManager.h"
 #include "nsIServiceManager.h"
 #include "nsIURL.h"
 #include "nsIIOService.h"
 #include "nsIURL.h"
 #include "nsNetCID.h"
 #include "nsIStringBundle.h"
 #include "nsReadableUtils.h"
@@ -75,17 +75,16 @@
 
 #include "nsIDOMXULDocument.h"
 
 #include "nsFocusManager.h"
 
 #include "nsIWebProgress.h"
 #include "nsIWebProgressListener.h"
 
-#include "nsIDocumentViewer.h"
 #include "nsIDocument.h"
 #include "nsIDOMDocument.h"
 #include "nsIDOMNode.h"
 #include "nsIDOMElement.h"
 #include "nsIDocumentLoaderFactory.h"
 #include "nsIObserverService.h"
 #include "prprf.h"
 
@@ -714,21 +713,19 @@ bool nsWebShellWindow::ExecuteCloseHandl
   nsCOMPtr<nsIXULWindow> kungFuDeathGrip(this);
 
   nsCOMPtr<nsPIDOMWindow> window(do_GetInterface(mDocShell));
   nsCOMPtr<nsIDOMEventTarget> eventTarget = do_QueryInterface(window);
 
   if (eventTarget) {
     nsCOMPtr<nsIContentViewer> contentViewer;
     mDocShell->GetContentViewer(getter_AddRefs(contentViewer));
-    nsCOMPtr<nsIDocumentViewer> docViewer(do_QueryInterface(contentViewer));
-
-    if (docViewer) {
+    if (contentViewer) {
       nsRefPtr<nsPresContext> presContext;
-      docViewer->GetPresContext(getter_AddRefs(presContext));
+      contentViewer->GetPresContext(getter_AddRefs(presContext));
 
       nsEventStatus status = nsEventStatus_eIgnore;
       nsMouseEvent event(PR_TRUE, NS_XUL_CLOSE, nsnull,
                          nsMouseEvent::eReal);
 
       nsresult rv =
         eventTarget->DispatchDOMEvent(&event, nsnull, presContext, &status);
       if (NS_SUCCEEDED(rv) && status == nsEventStatus_eConsumeNoDefault)
--- a/xpfe/appshell/src/nsWindowMediator.cpp
+++ b/xpfe/appshell/src/nsWindowMediator.cpp
@@ -39,20 +39,16 @@
 #include "nsCOMPtr.h"
 #include "nsString.h"
 #include "nsReadableUtils.h"
 #include "nsUnicharUtils.h"
 #include "nsTArray.h"
 #include "nsIBaseWindow.h"
 #include "nsIWidget.h"
 #include "nsIDOMWindow.h"
-#include "nsIDOMElement.h"
-#include "nsIDocumentViewer.h"
-#include "nsIDocument.h"
-#include "nsIDOMDocument.h"
 #include "nsIObserverService.h"
 #include "nsIServiceManager.h"
 #include "nsISimpleEnumerator.h"
 #include "nsAppShellWindowEnumerator.h"
 #include "nsWindowMediator.h"
 #include "nsIWindowMediatorListener.h"
 #include "nsXPIDLString.h"
 
--- a/xpfe/appshell/src/nsXULWindow.cpp
+++ b/xpfe/appshell/src/nsXULWindow.cpp
@@ -49,17 +49,17 @@
 #include "nsCRT.h"
 #include "nsThreadUtils.h"
 #include "nsNetCID.h"
 
 //Interfaces needed to be included
 #include "nsIAppShell.h"
 #include "nsIAppShellService.h"
 #include "nsIServiceManager.h"
-#include "nsIDocumentViewer.h"
+#include "nsIContentViewer.h"
 #include "nsIDocument.h"
 #include "nsIDOMBarProp.h"
 #include "nsIDOMDocument.h"
 #include "nsIDOMXULDocument.h"
 #include "nsIDOMElement.h"
 #include "nsIPrivateDOMEvent.h"
 #include "nsIDOMEventTarget.h"
 #include "nsIDOMXULElement.h"