Bug 516906: Remove XLink support from nsXMLElement. r/sr=jst
authorJonas Sicking <jonas@sicking.cc>
Sat, 24 Oct 2009 21:33:47 -0700
changeset 34165 2411c713a49974bb126d31f92a83dfcfe6f91afe
parent 34164 33a5c5092caf95f686181bbe831595419f15a23b
child 34166 6ced393c6387937bea82b76840ed4889c9c4a72c
push id9916
push usersicking@mozilla.com
push dateSun, 25 Oct 2009 04:34:49 +0000
treeherdermozilla-central@2411c713a499 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs516906
milestone1.9.3a1pre
Bug 516906: Remove XLink support from nsXMLElement. r/sr=jst
content/base/public/nsContentErrors.h
content/base/public/nsIContent.h
content/xml/content/src/nsXMLElement.cpp
content/xml/content/src/nsXMLElement.h
content/xml/document/src/nsXMLContentSink.cpp
content/xml/document/src/nsXMLContentSink.h
parser/html/nsHtml5TreeBuilderCppSupplement.h
--- a/content/base/public/nsContentErrors.h
+++ b/content/base/public/nsContentErrors.h
@@ -40,62 +40,51 @@
 #ifndef nsContentErrors_h___
 #define nsContentErrors_h___
 
 /** Error codes for nsHTMLStyleSheet */
 // XXX this is not really used
 #define NS_HTML_STYLE_PROPERTY_NOT_THERE \
   NS_ERROR_GENERATE_SUCCESS(NS_ERROR_MODULE_CONTENT, 2)
 
-
-/** Error codes for MaybeTriggerAutoLink */
-#define NS_XML_AUTOLINK_EMBED \
-  NS_ERROR_GENERATE_SUCCESS(NS_ERROR_MODULE_CONTENT, 3)
-#define NS_XML_AUTOLINK_NEW \
-  NS_ERROR_GENERATE_SUCCESS(NS_ERROR_MODULE_CONTENT, 4)
-#define NS_XML_AUTOLINK_REPLACE \
-  NS_ERROR_GENERATE_SUCCESS(NS_ERROR_MODULE_CONTENT, 5)
-#define NS_XML_AUTOLINK_UNDEFINED \
-  NS_ERROR_GENERATE_SUCCESS(NS_ERROR_MODULE_CONTENT, 6)
-
 /** Error codes for nsScriptLoader */
 #define NS_CONTENT_SCRIPT_IS_EVENTHANDLER \
-  NS_ERROR_GENERATE_SUCCESS(NS_ERROR_MODULE_CONTENT, 7)
+  NS_ERROR_GENERATE_SUCCESS(NS_ERROR_MODULE_CONTENT, 3)
 
 /** Error codes for image loading */
 #define NS_ERROR_IMAGE_SRC_CHANGED \
-  NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_CONTENT, 8)
+  NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_CONTENT, 4)
 
 #define NS_ERROR_IMAGE_BLOCKED \
-  NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_CONTENT, 9)
+  NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_CONTENT, 5)
 
 /** Error codes for content policy blocking */
 #define NS_ERROR_CONTENT_BLOCKED \
-  NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_CONTENT, 10)
+  NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_CONTENT, 6)
 
 #define NS_ERROR_CONTENT_BLOCKED_SHOW_ALT \
-  NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_CONTENT, 11)
+  NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_CONTENT, 7)
 
 /** Success variations of content policy blocking */
 #define NS_CONTENT_BLOCKED \
-  NS_ERROR_GENERATE_SUCCESS(NS_ERROR_MODULE_CONTENT, 12)
+  NS_ERROR_GENERATE_SUCCESS(NS_ERROR_MODULE_CONTENT, 8)
 
 #define NS_CONTENT_BLOCKED_SHOW_ALT \
-  NS_ERROR_GENERATE_SUCCESS(NS_ERROR_MODULE_CONTENT, 13)
+  NS_ERROR_GENERATE_SUCCESS(NS_ERROR_MODULE_CONTENT, 9)
 
 #define NS_PROPTABLE_PROP_NOT_THERE \
-  NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_CONTENT, 14)
+  NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_CONTENT, 10)
 
 #define NS_PROPTABLE_PROP_OVERWRITTEN \
-  NS_ERROR_GENERATE_SUCCESS(NS_ERROR_MODULE_CONTENT, 15)
+  NS_ERROR_GENERATE_SUCCESS(NS_ERROR_MODULE_CONTENT, 11)
 
 /* Error codes for FindBroadcaster in nsXULDocument.cpp */
 
 #define NS_FINDBROADCASTER_NOT_FOUND \
-  NS_ERROR_GENERATE_SUCCESS(NS_ERROR_MODULE_CONTENT, 16)
+  NS_ERROR_GENERATE_SUCCESS(NS_ERROR_MODULE_CONTENT, 12)
 
 #define NS_FINDBROADCASTER_FOUND \
-  NS_ERROR_GENERATE_SUCCESS(NS_ERROR_MODULE_CONTENT, 17)
+  NS_ERROR_GENERATE_SUCCESS(NS_ERROR_MODULE_CONTENT, 13)
 
 #define NS_FINDBROADCASTER_AWAIT_OVERLAYS \
-  NS_ERROR_GENERATE_SUCCESS(NS_ERROR_MODULE_CONTENT, 18)
+  NS_ERROR_GENERATE_SUCCESS(NS_ERROR_MODULE_CONTENT, 14)
 
 #endif // nsContentErrors_h___
--- a/content/base/public/nsIContent.h
+++ b/content/base/public/nsIContent.h
@@ -65,20 +65,20 @@ class nsIDOMCSSStyleDeclaration;
 enum nsLinkState {
   eLinkState_Unknown    = 0,
   eLinkState_Unvisited  = 1,
   eLinkState_Visited    = 2,
   eLinkState_NotLink    = 3
 };
 
 // IID for the nsIContent interface
-// d510382f-f5eb-48bb-9ad9-b3dc4806faaf
+// c726e716-a4be-4202-8a5e-32d0525903e8
 #define NS_ICONTENT_IID       \
-{ 0xd510382f, 0xf5eb, 0x48bb, \
-  { 0x9a, 0xd9, 0xb3, 0xdc, 0x48, 0x06, 0xfa, 0xaf } }
+{ 0xc726e716, 0xa4be, 0x4202, \
+  { 0x8a, 0x5e, 0x32, 0xd0, 0x52, 0x59, 0x03, 0xe8 } }
 
 /**
  * A node of content in a document's content model. This interface
  * is supported by all content objects.
  */
 class nsIContent : public nsINode {
 public:
 #ifdef MOZILLA_INTERNAL_API
@@ -669,36 +669,16 @@ public:
     *         has no HREF attribute.
     */
   virtual already_AddRefed<nsIURI> GetHrefURI() const
   {
     return nsnull;
   }
 
   /**
-   * Give this element a chance to fire links that should be fired
-   * automatically when loaded. If the element was an autoloading link
-   * and it was successfully handled, we will throw special nsresult values.
-   *
-   * @param aShell the current doc shell (to possibly load the link on)
-   * @throws NS_OK if nothing happened
-   * @throws NS_XML_AUTOLINK_EMBED if the caller is loading the link embedded
-   * @throws NS_XML_AUTOLINK_NEW if the caller is loading the link in a new
-   *         window
-   * @throws NS_XML_AUTOLINK_REPLACE if it is loading a link that will replace
-   *         the current window (and thus the caller must stop parsing)
-   * @throws NS_XML_AUTOLINK_UNDEFINED if it is loading in any other way--in
-   *         which case, the caller should stop parsing as well.
-   */
-  virtual nsresult MaybeTriggerAutoLink(nsIDocShell *aShell)
-  {
-    return NS_OK;
-  }
-
-  /**
    * This method is called when the parser finishes creating the element.  This
    * particularly means that it has done everything you would expect it to have
    * done after it encounters the > at the end of the tag (for HTML or XML).
    * This includes setting the attributes, setting the document / form, and
    * placing the element into the tree at its proper place.
    *
    * For container elements, this is called *before* any of the children are
    * created or added into the tree.
--- a/content/xml/content/src/nsXMLElement.cpp
+++ b/content/xml/content/src/nsXMLElement.cpp
@@ -32,244 +32,37 @@
  * 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 "nsXMLElement.h"
-#include "nsIDocShell.h"
-#include "nsIDocShellTreeItem.h"
-#include "nsIRefreshURI.h"
-#include "nsPresContext.h"
-#include "nsContentErrors.h"
-#include "nsIDocument.h"
 
 nsresult
 NS_NewXMLElement(nsIContent** aInstancePtrResult, nsINodeInfo *aNodeInfo)
 {
   nsXMLElement* it = new nsXMLElement(aNodeInfo);
   if (!it) {
     return NS_ERROR_OUT_OF_MEMORY;
   }
 
   NS_ADDREF(*aInstancePtrResult = it);
 
   return NS_OK;
 }
 
-nsXMLElement::nsXMLElement(nsINodeInfo *aNodeInfo)
-  : nsGenericElement(aNodeInfo)
-{
-}
-
-
 // QueryInterface implementation for nsXMLElement
 NS_INTERFACE_TABLE_HEAD(nsXMLElement)
   NS_NODE_OFFSET_AND_INTERFACE_TABLE_BEGIN(nsXMLElement)
     NS_INTERFACE_TABLE_ENTRY(nsXMLElement, nsIDOMNode)
     NS_INTERFACE_TABLE_ENTRY(nsXMLElement, nsIDOMElement)
   NS_OFFSET_AND_INTERFACE_TABLE_END
   NS_ELEMENT_INTERFACE_TABLE_TO_MAP_SEGUE
   NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(Element)
 NS_ELEMENT_INTERFACE_MAP_END
 
 
 NS_IMPL_ADDREF_INHERITED(nsXMLElement, nsGenericElement)
 NS_IMPL_RELEASE_INHERITED(nsXMLElement, nsGenericElement)
 
-
-static nsresult
-DocShellToPresContext(nsIDocShell *aShell, nsPresContext **aPresContext)
-{
-  *aPresContext = nsnull;
-
-  nsresult rv;
-  nsCOMPtr<nsIDocShell> ds = do_QueryInterface(aShell,&rv);
-  if (NS_FAILED(rv))
-    return rv;
-
-  return ds->GetPresContext(aPresContext);
-}
-
-nsresult
-nsXMLElement::PreHandleEvent(nsEventChainPreVisitor& aVisitor)
-{
-  nsresult rv = nsGenericElement::PreHandleEvent(aVisitor);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  return PreHandleEventForLinks(aVisitor);
-}
-
-nsresult
-nsXMLElement::PostHandleEvent(nsEventChainPostVisitor& aVisitor)
-{
-  return PostHandleEventForLinks(aVisitor);
-}
-
-nsresult
-nsXMLElement::MaybeTriggerAutoLink(nsIDocShell *aShell)
-{
-  NS_ENSURE_ARG_POINTER(aShell);
-
-  // We require an xlink:href, xlink:type="simple" and xlink:actuate="onLoad"
-  // XXX: as of XLink 1.1, elements will be links even without xlink:type set
-  if (!HasAttr(kNameSpaceID_XLink, nsGkAtoms::href) ||
-      !AttrValueIs(kNameSpaceID_XLink, nsGkAtoms::type,
-                   nsGkAtoms::simple, eCaseMatters) ||
-      !AttrValueIs(kNameSpaceID_XLink, nsGkAtoms::actuate,
-                   nsGkAtoms::onLoad, eCaseMatters)) {
-    return NS_OK;
-  }
-
-  // Disable in Mail/News for now. We may want a pref to control
-  // this at some point.
-  nsCOMPtr<nsIDocShellTreeItem> docShellItem = do_QueryInterface(aShell);
-  if (docShellItem) {
-    nsCOMPtr<nsIDocShellTreeItem> rootItem;
-    docShellItem->GetRootTreeItem(getter_AddRefs(rootItem));
-    nsCOMPtr<nsIDocShell> docshell = do_QueryInterface(rootItem);
-    if (docshell) {
-      PRUint32 appType;
-      if (NS_SUCCEEDED(docshell->GetAppType(&appType)) &&
-          appType == nsIDocShell::APP_TYPE_MAIL) {
-        return NS_OK;
-      }
-    }
-  }
-
-  // Get absolute URI
-  nsCOMPtr<nsIURI> absURI;
-  nsAutoString href;
-  GetAttr(kNameSpaceID_XLink, nsGkAtoms::href, href);
-  nsCOMPtr<nsIURI> baseURI = GetBaseURI();
-  nsContentUtils::NewURIWithDocumentCharset(getter_AddRefs(absURI), href,
-                                            GetOwnerDoc(), baseURI);
-  if (!absURI) {
-    return NS_OK;
-  }
-
-  // Check that the link's URI isn't the same as its document's URI, or else
-  // we'll recursively load the document forever (possibly in new windows!)
-  PRBool isDocURI;
-  absURI->Equals(GetOwnerDoc()->GetDocumentURI(), &isDocURI);
-  if (isDocURI) {
-    return NS_OK;
-  }
-
-  // Get target
-  nsAutoString target;
-  nsresult special_rv = GetLinkTargetAndAutoType(target);
-  // Ignore this link if xlink:show has a value we don't implement
-  if (NS_FAILED(special_rv)) return NS_OK;
-
-  // Attempt to load the URI
-  nsCOMPtr<nsPresContext> pc;
-  nsresult rv = DocShellToPresContext(aShell, getter_AddRefs(pc));
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  if (pc) {
-    nsContentUtils::TriggerLink(this, pc, absURI, target, PR_TRUE, PR_FALSE);
-  }
-
-  return special_rv; // return GetLinkTargetAndAutoType's special rv!
-}
-
-PRBool
-nsXMLElement::IsFocusable(PRInt32 *aTabIndex)
-{
-  nsCOMPtr<nsIURI> absURI;
-  if (IsLink(getter_AddRefs(absURI))) {
-    if (aTabIndex) {
-      *aTabIndex = ((sTabFocusModel & eTabFocus_linksMask) == 0 ? -1 : 0);
-    }
-    return PR_TRUE;
-  }
-
-  if (aTabIndex) {
-    *aTabIndex = -1;
-  }
-
-  return PR_FALSE;
-}
-
-PRBool
-nsXMLElement::IsLink(nsIURI** aURI) const
-{
-  NS_PRECONDITION(aURI, "Must provide aURI out param");
-
-  // To be an XLink for styling and interaction purposes, we require:
-  //
-  //   xlink:href          - must be set
-  //   xlink:type          - must be set to "simple"
-  //     xlink:_moz_target - must be set, OR
-  //     xlink:show        - must be unset or set to "", "new" or "replace"
-  //   xlink:actuate       - must be unset or set to "" or "onRequest"
-  //
-  // For any other values, we're either not a *clickable* XLink, or the end
-  // result is poorly specified. Either way, we return PR_FALSE.
-
-  static nsIContent::AttrValuesArray sShowVals[] =
-    { &nsGkAtoms::_empty, &nsGkAtoms::_new, &nsGkAtoms::replace, nsnull };
-
-  static nsIContent::AttrValuesArray sActuateVals[] =
-    { &nsGkAtoms::_empty, &nsGkAtoms::onRequest, nsnull };
-
-  // Optimization: check for href first for early return
-  const nsAttrValue* href = mAttrsAndChildren.GetAttr(nsGkAtoms::href,
-                                                      kNameSpaceID_XLink);
-  if (href &&
-      AttrValueIs(kNameSpaceID_XLink, nsGkAtoms::type,
-                  nsGkAtoms::simple, eCaseMatters) &&
-      (HasAttr(kNameSpaceID_XLink, nsGkAtoms::_moz_target) ||
-       FindAttrValueIn(kNameSpaceID_XLink, nsGkAtoms::show,
-                       sShowVals, eCaseMatters) !=
-                       nsIContent::ATTR_VALUE_NO_MATCH) &&
-      FindAttrValueIn(kNameSpaceID_XLink, nsGkAtoms::actuate,
-                      sActuateVals, eCaseMatters) !=
-                      nsIContent::ATTR_VALUE_NO_MATCH) {
-    // Get absolute URI
-    nsCOMPtr<nsIURI> baseURI = GetBaseURI();
-    nsContentUtils::NewURIWithDocumentCharset(aURI, href->GetStringValue(),
-                                              GetOwnerDoc(), baseURI);
-    return !!*aURI; // must promise out param is non-null if we return true
-  }
-
-  *aURI = nsnull;
-  return PR_FALSE;
-}
-
-void
-nsXMLElement::GetLinkTarget(nsAString& aTarget)
-{
-  GetLinkTargetAndAutoType(aTarget);
-}
-
-nsresult
-nsXMLElement::GetLinkTargetAndAutoType(nsAString& aTarget)
-{
-  // Mozilla extension xlink:_moz_target overrides xlink:show
-  if (GetAttr(kNameSpaceID_XLink, nsGkAtoms::_moz_target, aTarget)) {
-    return aTarget.IsEmpty() ? NS_XML_AUTOLINK_REPLACE : NS_OK;
-  }
-
-  // Try xlink:show if no xlink:_moz_target
-  GetAttr(kNameSpaceID_XLink, nsGkAtoms::show, aTarget);
-  if (aTarget.IsEmpty()) {
-    return NS_XML_AUTOLINK_UNDEFINED;
-  }
-  if (aTarget.EqualsLiteral("new")) {
-    aTarget.AssignLiteral("_blank");
-    return NS_XML_AUTOLINK_NEW;
-  }
-  if (aTarget.EqualsLiteral("replace")) {
-    aTarget.Truncate();
-    return NS_XML_AUTOLINK_REPLACE;
-  }
-  // xlink:show="embed" isn't handled by this code path
-
-  aTarget.Truncate();
-  return NS_ERROR_FAILURE;
-}
-
-
 NS_IMPL_ELEMENT_CLONE(nsXMLElement)
--- a/content/xml/content/src/nsXMLElement.h
+++ b/content/xml/content/src/nsXMLElement.h
@@ -37,43 +37,31 @@
  * ***** END LICENSE BLOCK ***** */
 
 #ifndef nsXMLElement_h___
 #define nsXMLElement_h___
 
 #include "nsIDOMElement.h"
 #include "nsGenericElement.h"
 
-class nsIDocShell;
-
 class nsXMLElement : public nsGenericElement,
                      public nsIDOMElement
 {
 public:
-  nsXMLElement(nsINodeInfo *aNodeInfo);
+  nsXMLElement(nsINodeInfo *aNodeInfo)
+    : nsGenericElement(aNodeInfo)
+  {
+  }
 
   // nsISupports
   NS_DECL_ISUPPORTS_INHERITED
 
   // nsIDOMNode
   NS_FORWARD_NSIDOMNODE(nsGenericElement::)
 
   // nsIDOMElement
   NS_FORWARD_NSIDOMELEMENT(nsGenericElement::)
 
   // nsINode interface methods
-  virtual nsresult PreHandleEvent(nsEventChainPreVisitor& aVisitor);
-  virtual nsresult PostHandleEvent(nsEventChainPostVisitor& aVisitor);
   virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
-
-  // nsIContent
-  virtual PRBool IsLink(nsIURI** aURI) const;
-  virtual nsresult MaybeTriggerAutoLink(nsIDocShell *aShell);
-  virtual PRBool IsFocusable(PRInt32 *aTabIndex = nsnull);
-
-  // nsGenericElement specializations
-  virtual void GetLinkTarget(nsAString& aTarget);
-
-  // Get target plus a special rv for MaybeTriggerAutoLink's caller
-  nsresult GetLinkTargetAndAutoType(nsAString& aTarget);
 };
 
 #endif // nsXMLElement_h___
--- a/content/xml/document/src/nsXMLContentSink.cpp
+++ b/content/xml/document/src/nsXMLContentSink.cpp
@@ -134,18 +134,17 @@ NS_NewXMLContentSink(nsIXMLContentSink**
   nsresult rv = it->Init(aDoc, aURI, aContainer, aChannel);
   NS_ENSURE_SUCCESS(rv, rv);
   
   return CallQueryInterface(it, aResult);
 }
 
 nsXMLContentSink::nsXMLContentSink()
   : mConstrainSize(PR_TRUE),
-    mPrettyPrintXML(PR_TRUE),
-    mAllowAutoXLinks(PR_TRUE)
+    mPrettyPrintXML(PR_TRUE)
 {
 }
 
 nsXMLContentSink::~nsXMLContentSink()
 {
   NS_IF_RELEASE(mDocElement);
   if (mText) {
     PR_Free(mText);  //  Doesn't null out, unlike PR_FREEIF
@@ -975,17 +974,16 @@ nsXMLContentSink::SetDocElement(PRInt32 
        aTagName == nsGkAtoms::bindings) ||
       (aNameSpaceID == kNameSpaceID_XSLT &&
        (aTagName == nsGkAtoms::stylesheet ||
         aTagName == nsGkAtoms::transform))) {
     mPrettyPrintHasSpecialRoot = PR_TRUE;
     if (mPrettyPrintXML) {
       // In this case, disable script execution, stylesheet
       // loading, and auto XLinks since we plan to prettyprint.
-      mAllowAutoXLinks = PR_FALSE;
       mDocument->ScriptLoader()->SetEnabled(PR_FALSE);
       if (mCSSLoader) {
         mCSSLoader->SetEnabled(PR_FALSE);
       }
     }        
   }
 
   mDocElement = aContent;
@@ -1534,27 +1532,16 @@ nsXMLContentSink::AddAttributes(const PR
                                    getter_AddRefs(localName), &nameSpaceID);
 
     // Add attribute to content
     aContent->SetAttr(nameSpaceID, localName, prefix,
                       nsDependentString(aAtts[1]), PR_FALSE);
     aAtts += 2;
   }
 
-  // Give autoloading links a chance to fire
-  if (mDocShell && mAllowAutoXLinks) {
-    nsresult rv = aContent->MaybeTriggerAutoLink(mDocShell);
-    if (rv == NS_XML_AUTOLINK_REPLACE ||
-        rv == NS_XML_AUTOLINK_UNDEFINED) {
-      // If we do not terminate the parse, we just keep generating link trigger
-      // events. We want to parse only up to the first replace link, and stop.
-      mParser->Terminate();
-    }
-  }
-
   return NS_OK;
 }
 
 #define NS_ACCUMULATION_BUFFER_SIZE 4096
 
 nsresult
 nsXMLContentSink::AddText(const PRUnichar* aText, 
                           PRInt32 aLength)
--- a/content/xml/document/src/nsXMLContentSink.h
+++ b/content/xml/document/src/nsXMLContentSink.h
@@ -202,19 +202,17 @@ protected:
   nsCOMPtr<nsIContent> mLastTextNode;
   PRInt32 mLastTextNodeSize;
 
   PRUint8 mConstrainSize : 1;
   PRUint8 mPrettyPrintXML : 1;
   PRUint8 mPrettyPrintHasSpecialRoot : 1;
   PRUint8 mPrettyPrintHasFactoredElements : 1;
   PRUint8 mHasProcessedBase : 1;
-  PRUint8 mAllowAutoXLinks : 1;
   PRUint8 mPrettyPrinting : 1;  // True if we called PrettyPrint() and it
                                 // decided we should in fact prettyprint.
-  PRUint8 unused : 1;  // bits available if someone needs one
   
   nsTArray<StackNode>              mContentStack;
 
   nsCOMPtr<nsIDocumentTransformer> mXSLTProcessor;
 };
 
 #endif // nsXMLContentSink_h__
--- a/parser/html/nsHtml5TreeBuilderCppSupplement.h
+++ b/parser/html/nsHtml5TreeBuilderCppSupplement.h
@@ -305,30 +305,16 @@ nsHtml5TreeBuilder::elementPushed(PRInt3
       treeOp->Init(eTreeOpStartLayout, nsnull);
     } else if (aName == nsHtml5Atoms::html) {
       nsHtml5TreeOperation* treeOp = mOpQueue.AppendElement();
       // XXX if null, OOM!
       treeOp->Init(eTreeOpProcessOfflineManifest, aElement);
       return;
     }
   }
-  #if 0
-    else {
-    nsIDocShell* docShell = parser->GetDocShell();
-    if (docShell) {
-      nsresult rv = aElement->MaybeTriggerAutoLink(docShell);
-      if (rv == NS_XML_AUTOLINK_REPLACE ||
-          rv == NS_XML_AUTOLINK_UNDEFINED) {
-        // If we do not terminate the parse, we just keep generating link trigger
-        // events. We want to parse only up to the first replace link, and stop.
-        parser->Terminate();
-      }
-    }
-  }
-  #endif
   mExecutor->MaybeSuspend();
 }
 
 void
 nsHtml5TreeBuilder::elementPopped(PRInt32 aNamespace, nsIAtom* aName, nsIContent* aElement)
 {
   NS_ASSERTION(aNamespace == kNameSpaceID_XHTML || aNamespace == kNameSpaceID_SVG || aNamespace == kNameSpaceID_MathML, "Element isn't HTML, SVG or MathML!");
   NS_ASSERTION(aName, "Element doesn't have local name!");