Bug 1452183 part 1. Stop using nsIDOMDocumentFragment in IDL files. r=mccr8
authorBoris Zbarsky <bzbarsky@mit.edu>
Tue, 17 Apr 2018 21:13:03 -0400
changeset 467745 a437a5c0f2ae18cc3ed35f8d6db47f3873d0d3ec
parent 467744 b4a8080506760e23743261517f95b79515a42d6e
child 467746 f4872ef01b2387fbd3fe86355a2fe12c33ebf042
push id9165
push userasasaki@mozilla.com
push dateThu, 26 Apr 2018 21:04:54 +0000
treeherdermozilla-beta@064c3804de2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmccr8
bugs1452183
milestone61.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1452183 part 1. Stop using nsIDOMDocumentFragment in IDL files. r=mccr8
dom/base/nsContentUtils.cpp
dom/base/nsContentUtils.h
dom/media/TextTrackCue.cpp
dom/media/webvtt/nsIWebVTTParserWrapper.idl
dom/xml/nsXMLFragmentContentSink.cpp
dom/xslt/txIEXSLTRegExFunctions.idl
dom/xslt/xslt/txEXSLTFunctions.cpp
parser/html/nsIParserUtils.idl
parser/html/nsIScriptableUnescapeHTML.idl
parser/html/nsParserUtils.cpp
parser/htmlparser/nsIFragmentContentSink.h
toolkit/components/feeds/nsIFeedTextConstruct.idl
--- a/dom/base/nsContentUtils.cpp
+++ b/dom/base/nsContentUtils.cpp
@@ -5048,21 +5048,21 @@ nsContentUtils::CreateContextualFragment
         tagName.Append(uriStr);
         tagName.Append('"');
       }
     }
 
     content = content->GetParent();
   }
 
-  nsCOMPtr<nsIDOMDocumentFragment> frag;
+  RefPtr<DocumentFragment> frag;
   aRv = ParseFragmentXML(aFragment, document, tagStack,
                          aPreventScriptExecution, getter_AddRefs(frag),
                          aSanitize);
-  return frag.forget().downcast<DocumentFragment>();
+  return frag.forget();
 }
 
 /* static */
 void
 nsContentUtils::DropFragmentParsers()
 {
   NS_IF_RELEASE(sHTMLFragmentParser);
   NS_IF_RELEASE(sXMLFragmentParser);
@@ -5163,17 +5163,17 @@ nsContentUtils::ParseDocumentHTML(const 
 }
 
 /* static */
 nsresult
 nsContentUtils::ParseFragmentXML(const nsAString& aSourceBuffer,
                                  nsIDocument* aDocument,
                                  nsTArray<nsString>& aTagStack,
                                  bool aPreventScriptExecution,
-                                 nsIDOMDocumentFragment** aReturn,
+                                 DocumentFragment** aReturn,
                                  SanitizeFragments aSanitize)
 {
   AutoTimelineMarker m(aDocument->GetDocShell(), "Parse XML");
 
   if (nsContentUtils::sFragmentParsingActive) {
     NS_NOTREACHED("Re-entrant fragment parsing attempted.");
     return NS_ERROR_DOM_INVALID_STATE_ERR;
   }
@@ -5212,23 +5212,21 @@ nsContentUtils::ParseFragmentXML(const n
 
   // If this is a chrome-privileged document, sanitize the fragment before
   // returning.
   if (aSanitize != NeverSanitize &&
       IsSystemPrincipal(aDocument->NodePrincipal())) {
     // Don't fire mutation events for nodes removed by the sanitizer.
     nsAutoScriptBlockerSuppressNodeRemoved scriptBlocker;
 
-    RefPtr<DocumentFragment> fragment = static_cast<DocumentFragment*>(*aReturn);
-
     nsTreeSanitizer sanitizer(nsIParserUtils::SanitizerAllowStyle |
                               nsIParserUtils::SanitizerAllowComments |
                               nsIParserUtils::SanitizerDropForms |
                               nsIParserUtils::SanitizerLogRemovals);
-    sanitizer.Sanitize(fragment);
+    sanitizer.Sanitize(*aReturn);
   }
 
   return rv;
 }
 
 /* static */
 nsresult
 nsContentUtils::ConvertToPlainText(const nsAString& aSourceBuffer,
--- a/dom/base/nsContentUtils.h
+++ b/dom/base/nsContentUtils.h
@@ -1685,17 +1685,17 @@ public:
    *        injection
    * @return NS_ERROR_DOM_INVALID_STATE_ERR if a re-entrant attempt to parse
    *         fragments is made, a return code from the XML parser.
    */
   static nsresult ParseFragmentXML(const nsAString& aSourceBuffer,
                                    nsIDocument* aDocument,
                                    nsTArray<nsString>& aTagStack,
                                    bool aPreventScriptExecution,
-                                   nsIDOMDocumentFragment** aReturn,
+                                   mozilla::dom::DocumentFragment** aReturn,
                                    SanitizeFragments aSanitize = SanitizeSystemPrivileged);
 
   /**
    * Parse a string into a document using the HTML parser.
    * Script elements are marked unexecutable.
    *
    * @param aSourceBuffer the string to parse as an HTML document
    * @param aTargetDocument the document object to parse into. Must not have
--- a/dom/media/TextTrackCue.cpp
+++ b/dom/media/TextTrackCue.cpp
@@ -132,23 +132,23 @@ TextTrackCue::GetCueAsHTML()
     ClearOnShutdown(&sParserWrapper);
   }
 
   nsPIDOMWindowInner* window = mDocument->GetInnerWindow();
   if (!window) {
     return mDocument->CreateDocumentFragment();
   }
 
-  nsCOMPtr<nsIDOMDocumentFragment> frag;
+  RefPtr<DocumentFragment> frag;
   sParserWrapper->ConvertCueToDOMTree(window, this,
                                       getter_AddRefs(frag));
   if (!frag) {
     return mDocument->CreateDocumentFragment();
   }
-  return frag.forget().downcast<DocumentFragment>();
+  return frag.forget();
 }
 
 void
 TextTrackCue::SetTrackElement(HTMLTrackElement* aTrackElement)
 {
   mTrackElement = aTrackElement;
 }
 
--- a/dom/media/webvtt/nsIWebVTTParserWrapper.idl
+++ b/dom/media/webvtt/nsIWebVTTParserWrapper.idl
@@ -1,19 +1,20 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nsISupports.idl"
 
-interface nsIDOMDocumentFragment;
 interface nsIWebVTTListener;
 interface mozIDOMWindow;
 interface nsIVariant;
 
+webidl DocumentFragment;
+
 /**
  * Interface for a wrapper of a JS WebVTT parser (vtt.js).
  */
 [scriptable, uuid(8dfe016e-1701-4618-9f5e-9a6154e853f0)]
 interface nsIWebVTTParserWrapper : nsISupports
 {
   /**
    * Loads the JS WebVTTParser and sets it to use the passed window to create
@@ -55,18 +56,18 @@ interface nsIWebVTTParserWrapper : nsISu
    * Convert the text content of a WebVTT cue to a document fragment so that
    * we can display it on the page.
    *
    * @param window A window object with which the document fragment will be
    *               created.
    * @param cue    The cue whose content will be converted to a document
    *               fragment.
    */
-  nsIDOMDocumentFragment convertCueToDOMTree(in mozIDOMWindow window,
-                                             in nsISupports cue);
+  DocumentFragment convertCueToDOMTree(in mozIDOMWindow window,
+				       in nsISupports cue);
 
 
   /**
    * Compute the display state of the VTTCues in cues along with any VTTRegions
    * that they might be in. First, it computes the positioning and styling of
    * the cues and regions passed and converts them into a DOM tree rooted at
    * a containing HTMLDivElement. It then adjusts those computed divs for
    * overlap avoidance using the dimensions of 'overlay'. Finally, it adds the
--- a/dom/xml/nsXMLFragmentContentSink.cpp
+++ b/dom/xml/nsXMLFragmentContentSink.cpp
@@ -7,17 +7,16 @@
 #include "nsCOMPtr.h"
 #include "nsXMLContentSink.h"
 #include "nsIFragmentContentSink.h"
 #include "nsIXMLContentSink.h"
 #include "nsContentSink.h"
 #include "nsIExpatSink.h"
 #include "nsIDTD.h"
 #include "nsIDocument.h"
-#include "nsIDOMDocumentFragment.h"
 #include "nsIContent.h"
 #include "nsGkAtoms.h"
 #include "mozilla/dom/NodeInfo.h"
 #include "nsContentCreatorFunctions.h"
 #include "nsError.h"
 #include "nsIConsoleService.h"
 #include "nsIScriptError.h"
 #include "nsTHashtable.h"
@@ -64,17 +63,17 @@ public:
   NS_IMETHOD DidBuildModel(bool aTerminated) override;
   virtual void SetDocumentCharset(NotNull<const Encoding*> aEncoding) override;
   virtual nsISupports* GetTarget() override;
   NS_IMETHOD DidProcessATokenImpl();
 
   // nsIXMLContentSink
 
   // nsIFragmentContentSink
-  NS_IMETHOD FinishFragmentParsing(nsIDOMDocumentFragment** aFragment) override;
+  NS_IMETHOD FinishFragmentParsing(DocumentFragment** aFragment) override;
   NS_IMETHOD SetTargetDocument(nsIDocument* aDocument) override;
   NS_IMETHOD WillBuildContent() override;
   NS_IMETHOD DidBuildContent() override;
   NS_IMETHOD IgnoreFirstContainer() override;
   NS_IMETHOD SetPreventScriptExecution(bool aPreventScriptExecution) override;
 
 protected:
   virtual ~nsXMLFragmentContentSink();
@@ -107,17 +106,17 @@ protected:
     const nsAString& aTitle,
     const nsAString& aType,
     const nsAString& aMedia,
     const nsAString& aReferrerPolicy,
     bool* aWasXSLT = nullptr) override;
 
   nsCOMPtr<nsIDocument> mTargetDocument;
   // the fragment
-  nsCOMPtr<nsIContent>  mRoot;
+  RefPtr<DocumentFragment> mRoot;
   bool                  mParseError;
 };
 
 static nsresult
 NewXMLFragmentContentSinkHelper(nsIFragmentContentSink** aResult)
 {
   nsXMLFragmentContentSink* it = new nsXMLFragmentContentSink();
 
@@ -355,40 +354,37 @@ nsXMLFragmentContentSink::MaybeProcessXS
 {
   MOZ_ASSERT(!aWasXSLT, "Our one caller doesn't care about whether we're XSLT");
   return NS_OK;
 }
 
 ////////////////////////////////////////////////////////////////////////
 
 NS_IMETHODIMP
-nsXMLFragmentContentSink::FinishFragmentParsing(nsIDOMDocumentFragment** aFragment)
+nsXMLFragmentContentSink::FinishFragmentParsing(DocumentFragment** aFragment)
 {
-  *aFragment = nullptr;
   mTargetDocument = nullptr;
   mNodeInfoManager = nullptr;
   mScriptLoader = nullptr;
   mCSSLoader = nullptr;
   mContentStack.Clear();
   mDocumentURI = nullptr;
   mDocShell = nullptr;
   mDocElement = nullptr;
   mCurrentHead = nullptr;
   if (mParseError) {
     //XXX PARSE_ERR from DOM3 Load and Save would be more appropriate
     mRoot = nullptr;
     mParseError = false;
+    *aFragment = nullptr;
     return NS_ERROR_DOM_SYNTAX_ERR;
-  } else if (mRoot) {
-    nsresult rv = CallQueryInterface(mRoot, aFragment);
-    mRoot = nullptr;
-    return rv;
-  } else {
-    return NS_OK;
   }
+
+  mRoot.forget(aFragment);
+  return NS_OK;
 }
 
 NS_IMETHODIMP
 nsXMLFragmentContentSink::SetTargetDocument(nsIDocument* aTargetDocument)
 {
   NS_ENSURE_ARG_POINTER(aTargetDocument);
 
   mTargetDocument = aTargetDocument;
--- a/dom/xslt/txIEXSLTRegExFunctions.idl
+++ b/dom/xslt/txIEXSLTRegExFunctions.idl
@@ -1,23 +1,21 @@
 /* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nsISupports.idl"
 
-interface nsIDOMDocument;
-interface nsIDOMDocumentFragment;
+webidl Document;
+webidl DocumentFragment;
 
 [scriptable, uuid(c180e993-aced-4839-95a0-ecd5ff138be9)]
 interface txIEXSLTRegExFunctions : nsISupports
 {
-    // Make this take Document and return DocumentFragment once https://bugzil.la/1444991
-    // is fixed.
-    nsIDOMDocumentFragment match(in DOMString aString, in DOMString aRegEx,
-                                 in DOMString aFlags,
-                                 in nsIDOMDocument aResultDocument);
+    DocumentFragment match(in DOMString aString, in DOMString aRegEx,
+                           in DOMString aFlags,
+                           in Document aResultDocument);
     DOMString replace(in DOMString aString, in DOMString aRegEx,
                       in DOMString aFlags, in DOMString aReplace);
     boolean test(in DOMString aString, in DOMString aRegEx,
                  in DOMString aFlags);
 };
--- a/dom/xslt/xslt/txEXSLTFunctions.cpp
+++ b/dom/xslt/xslt/txEXSLTFunctions.cpp
@@ -19,17 +19,16 @@
 #include "txOutputFormat.h"
 #include "txRtfHandler.h"
 #include "txXPathTreeWalker.h"
 #include "nsPrintfCString.h"
 #include "nsComponentManagerUtils.h"
 #include "nsContentCID.h"
 #include "nsContentCreatorFunctions.h"
 #include "nsIContent.h"
-#include "nsIDOMDocumentFragment.h"
 #include "txMozillaXMLOutput.h"
 #include "nsTextNode.h"
 #include "mozilla/dom/DocumentFragment.h"
 #include "prtime.h"
 #include "txIEXSLTRegExFunctions.h"
 
 using namespace mozilla;
 using namespace mozilla::dom;
@@ -738,27 +737,24 @@ txEXSLTRegExFunctionCall::evaluate(txIEv
     if (mParams.Length() >= 3) {
         rv = mParams[2]->evaluateToString(aContext, flags);
         NS_ENSURE_SUCCESS(rv, rv);
     }
 
     switch (mType) {
         case txEXSLTType::MATCH:
         {
-            nsCOMPtr<nsIDOMDocument> sourceDoc =
-                do_QueryInterface(getSourceDocument(aContext));
+            nsCOMPtr<nsIDocument> sourceDoc = getSourceDocument(aContext);
             NS_ENSURE_STATE(sourceDoc);
 
-            nsCOMPtr<nsIDOMDocumentFragment> domDocFrag;
+            RefPtr<DocumentFragment> docFrag;
             rv = mRegExService->Match(string, regex, flags, sourceDoc,
-                                      getter_AddRefs(domDocFrag));
+                                      getter_AddRefs(docFrag));
             NS_ENSURE_SUCCESS(rv, rv);
-
-            nsCOMPtr<nsIContent> docFrag = do_QueryInterface(domDocFrag, &rv);
-            NS_ENSURE_SUCCESS(rv, rv);
+            NS_ENSURE_STATE(docFrag);
 
             RefPtr<txNodeSet> resultSet;
             rv = aContext->recycler()->getNodeSet(getter_AddRefs(resultSet));
             NS_ENSURE_SUCCESS(rv, rv);
 
             nsAutoPtr<txXPathNode> node;
             for (nsIContent* result = docFrag->GetFirstChild(); result;
                  result = result->GetNextSibling()) {
--- a/parser/html/nsIParserUtils.idl
+++ b/parser/html/nsIParserUtils.idl
@@ -1,18 +1,19 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nsISupports.idl"
 
 interface nsIDOMElement;
-interface nsIDOMDocumentFragment;
 interface nsIURI;
 
+webidl DocumentFragment;
+
 /**
  * Non-Web HTML parser functionality to Firefox extensions and XULRunner apps. 
  * Don't use this from within Gecko--use nsContentUtils, nsTreeSanitizer, etc.
  * directly instead.
  */
 [scriptable, uuid(a1101145-0025-411e-8873-fdf57bf28128)]
 interface nsIParserUtils : nsISupports
 {
@@ -115,21 +116,21 @@ interface nsIParserUtils : nsISupports
    * Parses markup into a sanitized document fragment.
    *
    * @param fragment the input markup
    * @param flags sanitization option flags defined above
    * @param isXML true if |fragment| is XML and false if HTML
    * @param baseURI the base URL for this fragment
    * @param element the context node for the fragment parsing algorithm
    */
-  nsIDOMDocumentFragment parseFragment(in AString fragment,
-                                       in unsigned long flags,
-                                       in boolean isXML,
-                                       in nsIURI baseURI,
-                                       in nsIDOMElement element);
+  DocumentFragment parseFragment(in AString fragment,
+				 in unsigned long flags,
+				 in boolean isXML,
+				 in nsIURI baseURI,
+				 in nsIDOMElement element);
 
 };
 
 %{ C++
 #define NS_PARSERUTILS_CONTRACTID \
     "@mozilla.org/parserutils;1"
 #define NS_PARSERUTILS_CID  \
 { 0xaf7b24cb, 0x893f, 0x41bb, { 0x96, 0x1f, 0x5a, 0x69, 0x38, 0x8e, 0x27, 0xc3 } }
--- a/parser/html/nsIScriptableUnescapeHTML.idl
+++ b/parser/html/nsIScriptableUnescapeHTML.idl
@@ -1,19 +1,20 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nsISupports.idl"
 
 interface nsIDOMElement;
-interface nsIDOMDocumentFragment;
 interface nsIURI;
 
+webidl DocumentFragment;
+
 /**
  * This interface is OBSOLETE and exists solely for legacy extensions.
  */
 [scriptable, uuid(3ab244a9-f09d-44da-9e3f-ee4d67367f2d)]
 interface nsIScriptableUnescapeHTML : nsISupports 
 {
   /** 
    * Converts HTML to plain text. This is equivalent to calling
@@ -35,20 +36,20 @@ interface nsIScriptableUnescapeHTML : ns
    *
    * You should call nsIParserUtils::parseFragment() instead of calling this 
    * method.
    * @param fragment the input markup
    * @param isXML true if |fragment| is XML and false if HTML
    * @param baseURI the base URL for this fragment
    * @param element the context node for the fragment parsing algorithm
    */
-  nsIDOMDocumentFragment parseFragment(in AString fragment,
-                                       in boolean isXML,
-                                       in nsIURI baseURI,
-                                       in nsIDOMElement element);
+  DocumentFragment parseFragment(in AString fragment,
+                                 in boolean isXML,
+                                 in nsIURI baseURI,
+                                 in nsIDOMElement element);
 };
 
 %{ C++
 #define NS_SCRIPTABLEUNESCAPEHTML_CONTRACTID \
   "@mozilla.org/feed-unescapehtml;1"
 #define NS_SCRIPTABLEUNESCAPEHTML_CID  \
 { 0x10f2f5f0, 0xf103, 0x4901, { 0x98, 0x0f, 0xba, 0x11, 0xbd, 0x70, 0xd6, 0x0d} }
 %}
--- a/parser/html/nsParserUtils.cpp
+++ b/parser/html/nsParserUtils.cpp
@@ -105,29 +105,29 @@ nsParserUtils::Sanitize(const nsAString&
   return encoder->EncodeToString(aToStr);
 }
 
 NS_IMETHODIMP
 nsParserUtils::ParseFragment(const nsAString& aFragment,
                              bool aIsXML,
                              nsIURI* aBaseURI,
                              nsIDOMElement* aContextElement,
-                             nsIDOMDocumentFragment** aReturn)
+                             DocumentFragment** aReturn)
 {
   return nsParserUtils::ParseFragment(
     aFragment, 0, aIsXML, aBaseURI, aContextElement, aReturn);
 }
 
 NS_IMETHODIMP
 nsParserUtils::ParseFragment(const nsAString& aFragment,
                              uint32_t aFlags,
                              bool aIsXML,
                              nsIURI* aBaseURI,
                              nsIDOMElement* aContextElement,
-                             nsIDOMDocumentFragment** aReturn)
+                             DocumentFragment** aReturn)
 {
   NS_ENSURE_ARG(aContextElement);
   *aReturn = nullptr;
 
   nsCOMPtr<nsIDocument> document;
   nsCOMPtr<nsINode> contextNode;
   contextNode = do_QueryInterface(aContextElement);
   document = contextNode->OwnerDoc();
@@ -144,32 +144,31 @@ nsParserUtils::ParseFragment(const nsASt
   if (scripts_enabled) {
     loader->SetEnabled(false);
   }
 
   // Wrap things in a div or body for parsing, but it won't show up in
   // the fragment.
   nsresult rv = NS_OK;
   AutoTArray<nsString, 2> tagStack;
-  nsCOMPtr<nsIContent> fragment;
+  RefPtr<DocumentFragment> fragment;
   if (aIsXML) {
     // XHTML
     tagStack.AppendElement(NS_LITERAL_STRING(XHTML_DIV_TAG));
     rv = nsContentUtils::ParseFragmentXML(
-      aFragment, document, tagStack, true, aReturn);
-    fragment = do_QueryInterface(*aReturn);
+      aFragment, document, tagStack, true, getter_AddRefs(fragment));
   } else {
-    NS_ADDREF(*aReturn = new DocumentFragment(document->NodeInfoManager()));
-    fragment = do_QueryInterface(*aReturn);
+    fragment = new DocumentFragment(document->NodeInfoManager());
     rv = nsContentUtils::ParseFragmentHTML(
       aFragment, fragment, nsGkAtoms::body, kNameSpaceID_XHTML, false, true);
   }
   if (fragment) {
     nsTreeSanitizer sanitizer(aFlags);
     sanitizer.Sanitize(fragment);
   }
 
   if (scripts_enabled) {
     loader->SetEnabled(true);
   }
 
+  fragment.forget(aReturn);
   return rv;
 }
--- a/parser/htmlparser/nsIFragmentContentSink.h
+++ b/parser/htmlparser/nsIFragmentContentSink.h
@@ -2,19 +2,24 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 #ifndef nsIFragmentContentSink_h___
 #define nsIFragmentContentSink_h___
 
 #include "nsISupports.h"
 
-class nsIDOMDocumentFragment;
 class nsIDocument;
 
+namespace mozilla {
+namespace dom {
+class DocumentFragment;
+} // namespace dom
+} // namespace mozilla
+
 #define NS_I_FRAGMENT_CONTENT_SINK_IID \
   { 0x1a8ce30b, 0x63fc, 0x441a, \
     { 0xa3, 0xaa, 0xf7, 0x16, 0xc0, 0xfe, 0x96, 0x69 } }
 
 /**
  * The fragment sink allows a client to parse a fragment of sink, possibly
  * surrounded in context. Also see nsIParser::ParseFragment().
  * Note: once you've parsed a fragment, the fragment sink must be re-set on
@@ -24,17 +29,17 @@ class nsIFragmentContentSink : public ns
 public:
   NS_DECLARE_STATIC_IID_ACCESSOR(NS_I_FRAGMENT_CONTENT_SINK_IID)
   /**
    * This method is used to obtain the fragment created by
    * a fragment content sink and to release resources held by the parser.
    *
    * The sink drops its reference to the fragment.
    */
-  NS_IMETHOD FinishFragmentParsing(nsIDOMDocumentFragment** aFragment) = 0;
+  NS_IMETHOD FinishFragmentParsing(mozilla::dom::DocumentFragment** aFragment) = 0;
 
   /**
    * This method is used to set the target document for this fragment
    * sink.  This document's nodeinfo manager will be used to create
    * the content objects.  This MUST be called before the sink is used.
    *
    * @param aDocument the document the new nodes will belong to
    * (should not be null)
--- a/toolkit/components/feeds/nsIFeedTextConstruct.idl
+++ b/toolkit/components/feeds/nsIFeedTextConstruct.idl
@@ -2,17 +2,18 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nsISupports.idl"
 
 interface nsIURI;
 interface nsIDOMElement;
-interface nsIDOMDocumentFragment;
+
+webidl DocumentFragment;
 
 /**
  * nsIFeedTextConstructs represent feed text fields that can contain
  * one of text, HTML, or XHTML. Some extension elements also have "type"
  * parameters, and this interface could be used there as well.
  */ 
 [scriptable, uuid(fc97a2a9-d649-4494-931e-db81a156c873)]
 interface nsIFeedTextConstruct : nsISupports 
@@ -47,11 +48,11 @@ interface nsIFeedTextConstruct : nsISupp
    * and all entities decoded. If the type attribute's value is "text",
    * this function returns the value of the text attribute unchanged.
    */
   AString plainText();
 
   /**
    * Return an nsIDocumentFragment containing the text and markup.
    */
-  nsIDOMDocumentFragment createDocumentFragment(in nsIDOMElement element);
+  DocumentFragment createDocumentFragment(in nsIDOMElement element);
 };