Bug 737122 - Attr nodes shouldn't have children; r=sicking
authorMs2ger <ms2ger@gmail.com>
Tue Apr 03 09:25:39 2012 +0200 (at Tue Apr 03 09:25:39 2012 +0200)
changeset 90888af7362ead6e5
parent 9088766101542ba09
child 90889c0d3b3b6e2fb
pushlog:af7362ead6e5
Bug 737122 - Attr nodes shouldn't have children; r=sicking
content/base/public/Makefile.in
content/base/public/nsIMutationObserver2.h
content/base/src/nsDOMAttribute.cpp
content/base/src/nsDOMAttribute.h
content/base/src/nsNodeIterator.cpp
content/base/src/nsNodeIterator.h
content/base/src/nsNodeUtils.cpp
content/base/src/nsNodeUtils.h
content/base/src/nsStubMutationObserver.cpp
content/base/src/nsStubMutationObserver.h
content/base/src/nsTextNode.cpp
content/base/src/nsTextNode.h
content/base/test/Makefile.in
content/base/test/test_bug590771.html
content/base/test/test_bug598877.html
content/base/test/test_bug600466.html
content/base/test/test_bug600468.html
content/base/test/test_bug600471.html
dom/tests/mochitest/dom-level1-core/exclusions.js
     1.1 --- a/content/base/public/Makefile.in
     1.2 +++ b/content/base/public/Makefile.in
     1.3 @@ -52,17 +52,16 @@ nsIAttribute.h \
     1.4  nsIContentIterator.h \
     1.5  nsContentErrors.h \
     1.6  nsContentPolicyUtils.h \
     1.7  nsContentUtils.h \
     1.8  nsIDocument.h \
     1.9  nsDeprecatedOperationList.h \
    1.10  nsIDocumentObserver.h \
    1.11  nsIMutationObserver.h \
    1.12 -nsIMutationObserver2.h \
    1.13  nsINameSpaceManager.h \
    1.14  nsINode.h \
    1.15  nsINodeInfo.h \
    1.16  nsINodeList.h \
    1.17  nsIScriptElement.h \
    1.18  nsIStyleSheetLinkingElement.h \
    1.19  nsIContentSerializer.h \
    1.20  nsIXPathEvaluatorInternal.h \
     2.1 deleted file mode 100644
     2.2 --- a/content/base/public/nsIMutationObserver2.h
     2.3 +++ /dev/null
     2.4 @@ -1,93 +0,0 @@
     2.5 -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     2.6 -/* ***** BEGIN LICENSE BLOCK *****
     2.7 - * Version: MPL 1.1/GPL 2.0/LGPL 2.1
     2.8 - *
     2.9 - * The contents of this file are subject to the Mozilla Public License Version
    2.10 - * 1.1 (the "License"); you may not use this file except in compliance with
    2.11 - * the License. You may obtain a copy of the License at
    2.12 - * http://www.mozilla.org/MPL/
    2.13 - *
    2.14 - * Software distributed under the License is distributed on an "AS IS" basis,
    2.15 - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
    2.16 - * for the specific language governing rights and limitations under the
    2.17 - * License.
    2.18 - *
    2.19 - * The Original Code is mozilla.org code.
    2.20 - *
    2.21 - * The Initial Developer of the Original Code is Mozilla Foundation.
    2.22 - * Portions created by the Initial Developer are Copyright (C) 1998
    2.23 - * the Initial Developer. All Rights Reserved.
    2.24 - *
    2.25 - * Contributor(s):
    2.26 - * Mounir Lamouri <mounir.lamouri@mozilla.com> (Original author)
    2.27 - *
    2.28 - * Alternatively, the contents of this file may be used under the terms of
    2.29 - * either of the GNU General Public License Version 2 or later (the "GPL"),
    2.30 - * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
    2.31 - * in which case the provisions of the GPL or the LGPL are applicable instead
    2.32 - * of those above. If you wish to allow use of your version of this file only
    2.33 - * under the terms of either the GPL or the LGPL, and not to allow others to
    2.34 - * use your version of this file under the terms of the MPL, indicate your
    2.35 - * decision by deleting the provisions above and replace them with the notice
    2.36 - * and other provisions required by the GPL or the LGPL. If you do not delete
    2.37 - * the provisions above, a recipient may use your version of this file under
    2.38 - * the terms of any one of the MPL, the GPL or the LGPL.
    2.39 - *
    2.40 - * ***** END LICENSE BLOCK ***** */
    2.41 -
    2.42 -#ifndef nsIMutationObserver2_h___
    2.43 -#define nsIMutationObserver2_h___
    2.44 -
    2.45 -#include "nsIMutationObserver.h"
    2.46 -
    2.47 -class nsIContent;
    2.48 -class nsINode;
    2.49 -
    2.50 -#define NS_IMUTATION_OBSERVER_2_IID \
    2.51 -{0x61ac1cfd, 0xf3ef, 0x4408, \
    2.52 -  {0x8a, 0x72, 0xee, 0xf0, 0x41, 0xbe, 0xc7, 0xe9 } }
    2.53 -
    2.54 -/**
    2.55 - * Mutation observer interface 2 is adding AttributeChildRemoved to
    2.56 - * nsIMutationObserver.
    2.57 - *
    2.58 - * @see nsIMutationObserver.
    2.59 - */
    2.60 -class nsIMutationObserver2 : public nsIMutationObserver
    2.61 -{
    2.62 -public:
    2.63 -  NS_DECLARE_STATIC_IID_ACCESSOR(NS_IMUTATION_OBSERVER_2_IID)
    2.64 -
    2.65 -  /**
    2.66 -   * Notification that an attribute's child has been removed.
    2.67 -   *
    2.68 -   * @param aContainer The attribute that had its child removed.
    2.69 -   * @param aChild     The child that was removed.
    2.70 -   *
    2.71 -   * @note Attributes can't have more than one child so it will be always the
    2.72 -   *       first one being removed.
    2.73 -   */
    2.74 -  virtual void AttributeChildRemoved(nsINode* aAttribute,
    2.75 -                                     nsIContent* aChild) = 0;
    2.76 -};
    2.77 -
    2.78 -NS_DEFINE_STATIC_IID_ACCESSOR(nsIMutationObserver2, NS_IMUTATION_OBSERVER_2_IID)
    2.79 -
    2.80 -#define NS_DECL_NSIMUTATIONOBSERVER2_ATTRIBUTECHILDREMOVED                \
    2.81 -    virtual void AttributeChildRemoved(nsINode* aAttribute,               \
    2.82 -                                       nsIContent* aChild);
    2.83 -
    2.84 -#define NS_DECL_NSIMUTATIONOBSERVER2                                      \
    2.85 -    NS_DECL_NSIMUTATIONOBSERVER                                           \
    2.86 -    NS_DECL_NSIMUTATIONOBSERVER2_ATTRIBUTECHILDREMOVED
    2.87 -
    2.88 -#define NS_IMPL_NSIMUTATIONOBSERVER2_CONTENT(_class)                      \
    2.89 -NS_IMPL_NSIMUTATIONOBSERVER_CONTENT(_class)                               \
    2.90 -void                                                                      \
    2.91 -_class::AttributeChildRemoved(nsINode* aAttribute, nsIContent *aChild)    \
    2.92 -{                                                                         \
    2.93 -}
    2.94 -
    2.95 -
    2.96 -#endif /* nsIMutationObserver2_h___ */
    2.97 -
     3.1 --- a/content/base/src/nsDOMAttribute.cpp
     3.2 +++ b/content/base/src/nsDOMAttribute.cpp
     3.3 @@ -65,79 +65,51 @@
     3.4  using namespace mozilla::dom;
     3.5  
     3.6  //----------------------------------------------------------------------
     3.7  bool nsDOMAttribute::sInitialized;
     3.8  
     3.9  nsDOMAttribute::nsDOMAttribute(nsDOMAttributeMap *aAttrMap,
    3.10                                 already_AddRefed<nsINodeInfo> aNodeInfo,
    3.11                                 const nsAString   &aValue, bool aNsAware)
    3.12 -  : nsIAttribute(aAttrMap, aNodeInfo, aNsAware), mValue(aValue), mChild(nsnull)
    3.13 +  : nsIAttribute(aAttrMap, aNodeInfo, aNsAware), mValue(aValue)
    3.14  {
    3.15    NS_ABORT_IF_FALSE(mNodeInfo, "We must get a nodeinfo here!");
    3.16    NS_ABORT_IF_FALSE(mNodeInfo->NodeType() == nsIDOMNode::ATTRIBUTE_NODE,
    3.17                      "Wrong nodeType");
    3.18  
    3.19    // We don't add a reference to our content. It will tell us
    3.20    // to drop our reference when it goes away.
    3.21 -
    3.22 -  EnsureChildState();
    3.23 -
    3.24 -  nsIContent* content = GetContentInternal();
    3.25 -  if (content) {
    3.26 -    content->AddMutationObserver(this);
    3.27 -  }
    3.28 -}
    3.29 -
    3.30 -nsDOMAttribute::~nsDOMAttribute()
    3.31 -{
    3.32 -  if (mChild) {
    3.33 -    static_cast<nsTextNode*>(mChild)->UnbindFromAttribute();
    3.34 -    NS_RELEASE(mChild);
    3.35 -    mFirstChild = nsnull;
    3.36 -  }
    3.37 -
    3.38 -  nsIContent* content = GetContentInternal();
    3.39 -  if (content) {
    3.40 -    content->RemoveMutationObserver(this);
    3.41 -  }
    3.42  }
    3.43  
    3.44  NS_IMPL_CYCLE_COLLECTION_CLASS(nsDOMAttribute)
    3.45  
    3.46  NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsDOMAttribute)
    3.47    NS_IMPL_CYCLE_COLLECTION_TRAVERSE_SCRIPT_OBJECTS
    3.48  
    3.49    if (!nsINode::Traverse(tmp, cb)) {
    3.50      return NS_SUCCESS_INTERRUPTED_TRAVERSE;
    3.51    }
    3.52 -
    3.53 -  NS_IMPL_CYCLE_COLLECTION_TRAVERSE_RAWPTR(mChild)
    3.54  NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
    3.55  
    3.56  NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN(nsDOMAttribute)
    3.57    nsINode::Trace(tmp, aCallback, aClosure);
    3.58  NS_IMPL_CYCLE_COLLECTION_TRACE_END
    3.59  
    3.60  NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsDOMAttribute)
    3.61    nsINode::Unlink(tmp);
    3.62 -  if (tmp->mChild) {
    3.63 -    static_cast<nsTextNode*>(tmp->mChild)->UnbindFromAttribute();
    3.64 -    NS_RELEASE(tmp->mChild);
    3.65 -    tmp->mFirstChild = nsnull;
    3.66 -  }
    3.67  NS_IMPL_CYCLE_COLLECTION_UNLINK_END
    3.68  
    3.69  DOMCI_NODE_DATA(Attr, nsDOMAttribute)
    3.70  
    3.71  // QueryInterface implementation for nsDOMAttribute
    3.72  NS_INTERFACE_TABLE_HEAD(nsDOMAttribute)
    3.73    NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
    3.74 -  NS_NODE_INTERFACE_TABLE5(nsDOMAttribute, nsIDOMAttr, nsIAttribute, nsIDOMNode,
    3.75 -                           nsIDOMEventTarget, nsIMutationObserver)
    3.76 +  NS_NODE_INTERFACE_TABLE4(nsDOMAttribute, nsIDOMAttr, nsIAttribute, nsIDOMNode,
    3.77 +                           nsIDOMEventTarget)
    3.78    NS_INTERFACE_MAP_ENTRIES_CYCLE_COLLECTION(nsDOMAttribute)
    3.79    NS_INTERFACE_MAP_ENTRY_TEAROFF(nsISupportsWeakReference,
    3.80                                   new nsNodeSupportsWeakRefTearoff(this))
    3.81    NS_INTERFACE_MAP_ENTRY_TEAROFF(nsIDOMXPathNSResolver,
    3.82                                   new nsNode3Tearoff(this))
    3.83    NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(Attr)
    3.84  NS_INTERFACE_MAP_END
    3.85  
    3.86 @@ -149,28 +121,17 @@ void
    3.87  nsDOMAttribute::SetMap(nsDOMAttributeMap *aMap)
    3.88  {
    3.89    if (mAttrMap && !aMap && sInitialized) {
    3.90      // We're breaking a relationship with content and not getting a new one,
    3.91      // need to locally cache value. GetValue() does that.
    3.92      GetValue(mValue);
    3.93    }
    3.94  
    3.95 -  nsIContent* content = GetContentInternal();
    3.96 -  if (content) {
    3.97 -    content->RemoveMutationObserver(this);
    3.98 -  }
    3.99 -
   3.100    mAttrMap = aMap;
   3.101 -
   3.102 -  // If we have a new content, we sholud start listening to it.
   3.103 -  content = GetContentInternal();
   3.104 -  if (content) {
   3.105 -    content->AddMutationObserver(this);
   3.106 -  }
   3.107  }
   3.108  
   3.109  nsIContent*
   3.110  nsDOMAttribute::GetContent() const
   3.111  {
   3.112    return GetContentInternal();
   3.113  }
   3.114  
   3.115 @@ -236,41 +197,28 @@ nsDOMAttribute::GetValue(nsAString& aVal
   3.116    }
   3.117  
   3.118    return NS_OK;
   3.119  }
   3.120  
   3.121  NS_IMETHODIMP
   3.122  nsDOMAttribute::SetValue(const nsAString& aValue)
   3.123  {
   3.124 -  nsresult rv = NS_OK;
   3.125    nsIContent* content = GetContentInternal();
   3.126 -  if (content) {
   3.127 -    nsCOMPtr<nsIAtom> nameAtom = GetNameAtom(content);
   3.128 -    rv = content->SetAttr(mNodeInfo->NamespaceID(),
   3.129 +  if (!content) {
   3.130 +    mValue = aValue;
   3.131 +    return NS_OK;
   3.132 +  }
   3.133 +
   3.134 +  nsCOMPtr<nsIAtom> nameAtom = GetNameAtom(content);
   3.135 +  return content->SetAttr(mNodeInfo->NamespaceID(),
   3.136                            nameAtom,
   3.137                            mNodeInfo->GetPrefixAtom(),
   3.138                            aValue,
   3.139                            true);
   3.140 -  }
   3.141 -  else {
   3.142 -    mValue = aValue;
   3.143 -
   3.144 -    if (mChild) {
   3.145 -      if (mValue.IsEmpty()) {
   3.146 -        doRemoveChild(true);
   3.147 -      } else {
   3.148 -        mChild->SetText(mValue, false);
   3.149 -      }
   3.150 -    } else {
   3.151 -      EnsureChildState();
   3.152 -    }
   3.153 -  }
   3.154 -
   3.155 -  return rv;
   3.156  }
   3.157  
   3.158  
   3.159  NS_IMETHODIMP
   3.160  nsDOMAttribute::GetSpecified(bool* aSpecified)
   3.161  {
   3.162    NS_ENSURE_ARG_POINTER(aSpecified);
   3.163    OwnerDoc()->WarnOnceAbout(nsIDocument::eSpecified);
   3.164 @@ -354,17 +302,17 @@ nsDOMAttribute::GetChildNodes(nsIDOMNode
   3.165    return nsINode::GetChildNodes(aChildNodes);
   3.166  }
   3.167  
   3.168  NS_IMETHODIMP
   3.169  nsDOMAttribute::HasChildNodes(bool* aHasChildNodes)
   3.170  {
   3.171    OwnerDoc()->WarnOnceAbout(nsIDocument::eHasChildNodes);
   3.172  
   3.173 -  *aHasChildNodes = mFirstChild != nsnull;
   3.174 +  *aHasChildNodes = false;
   3.175  
   3.176    return NS_OK;
   3.177  }
   3.178  
   3.179  NS_IMETHODIMP
   3.180  nsDOMAttribute::HasAttributes(bool* aHasAttributes)
   3.181  {
   3.182    NS_ENSURE_ARG_POINTER(aHasAttributes);
   3.183 @@ -377,20 +325,16 @@ nsDOMAttribute::HasAttributes(bool* aHas
   3.184  
   3.185  NS_IMETHODIMP
   3.186  nsDOMAttribute::GetFirstChild(nsIDOMNode** aFirstChild)
   3.187  {
   3.188    *aFirstChild = nsnull;
   3.189  
   3.190    OwnerDoc()->WarnOnceAbout(nsIDocument::eFirstChild);
   3.191  
   3.192 -  if (mFirstChild) {
   3.193 -    CallQueryInterface(mFirstChild, aFirstChild);
   3.194 -  }
   3.195 -  
   3.196    return NS_OK;
   3.197  }
   3.198  
   3.199  NS_IMETHODIMP
   3.200  nsDOMAttribute::GetLastChild(nsIDOMNode** aLastChild)
   3.201  {
   3.202    OwnerDoc()->WarnOnceAbout(nsIDocument::eLastChild);
   3.203  
   3.204 @@ -653,40 +597,36 @@ bool
   3.205  nsDOMAttribute::IsNodeOfType(PRUint32 aFlags) const
   3.206  {
   3.207      return !(aFlags & ~eATTRIBUTE);
   3.208  }
   3.209  
   3.210  PRUint32
   3.211  nsDOMAttribute::GetChildCount() const
   3.212  {
   3.213 -  return mFirstChild ? 1 : 0;
   3.214 +  return 0;
   3.215  }
   3.216  
   3.217  nsIContent *
   3.218  nsDOMAttribute::GetChildAt(PRUint32 aIndex) const
   3.219  {
   3.220 -  return aIndex == 0 ? mFirstChild : nsnull;
   3.221 +  return nsnull;
   3.222  }
   3.223  
   3.224  nsIContent * const *
   3.225  nsDOMAttribute::GetChildArray(PRUint32* aChildCount) const
   3.226  {
   3.227 -  *aChildCount = GetChildCount();
   3.228 -  return &mFirstChild;
   3.229 +  *aChildCount = 0;
   3.230 +  return NULL;
   3.231  }
   3.232  
   3.233  PRInt32
   3.234  nsDOMAttribute::IndexOf(nsINode* aPossibleChild) const
   3.235  {
   3.236 -  if (!aPossibleChild || aPossibleChild != mFirstChild) {
   3.237 -    return -1;
   3.238 -  }
   3.239 -
   3.240 -  return 0;
   3.241 +  return -1;
   3.242  }
   3.243  
   3.244  nsresult
   3.245  nsDOMAttribute::InsertChildAt(nsIContent* aKid, PRUint32 aIndex,
   3.246                                bool aNotify)
   3.247  {
   3.248    return NS_ERROR_NOT_IMPLEMENTED;
   3.249  }
   3.250 @@ -695,106 +635,28 @@ nsresult
   3.251  nsDOMAttribute::AppendChildTo(nsIContent* aKid, bool aNotify)
   3.252  {
   3.253    return NS_ERROR_NOT_IMPLEMENTED;
   3.254  }
   3.255  
   3.256  void
   3.257  nsDOMAttribute::RemoveChildAt(PRUint32 aIndex, bool aNotify)
   3.258  {
   3.259 -  if (aIndex != 0 || !mChild) {
   3.260 -    return;
   3.261 -  }
   3.262 -
   3.263 -  doRemoveChild(aNotify);
   3.264 -
   3.265 -  nsString nullString;
   3.266 -  SetDOMStringToNull(nullString);
   3.267 -  SetValue(nullString);
   3.268  }
   3.269  
   3.270  nsresult
   3.271  nsDOMAttribute::PreHandleEvent(nsEventChainPreVisitor& aVisitor)
   3.272  {
   3.273    aVisitor.mCanHandle = true;
   3.274    return NS_OK;
   3.275  }
   3.276  
   3.277  void
   3.278 -nsDOMAttribute::EnsureChildState()
   3.279 -{
   3.280 -  NS_PRECONDITION(!mChild, "Someone screwed up");
   3.281 -
   3.282 -  nsAutoString value;
   3.283 -  GetValue(value);
   3.284 -
   3.285 -  if (!value.IsEmpty()) {
   3.286 -    NS_NewTextNode(&mChild, mNodeInfo->NodeInfoManager());
   3.287 -
   3.288 -    static_cast<nsTextNode*>(mChild)->BindToAttribute(this);
   3.289 -    mFirstChild = mChild;
   3.290 -
   3.291 -    mChild->SetText(value, false);
   3.292 -  }
   3.293 -}
   3.294 -
   3.295 -void
   3.296 -nsDOMAttribute::AttributeChanged(nsIDocument* aDocument,
   3.297 -                                 Element* aElement,
   3.298 -                                 PRInt32 aNameSpaceID,
   3.299 -                                 nsIAtom* aAttribute,
   3.300 -                                 PRInt32 aModType)
   3.301 -{
   3.302 -  nsIContent* content = GetContentInternal();
   3.303 -  if (aElement != content) {
   3.304 -    return;
   3.305 -  }
   3.306 -
   3.307 -  if (aNameSpaceID != mNodeInfo->NamespaceID()) {
   3.308 -    return;
   3.309 -  }
   3.310 -
   3.311 -  nsCOMPtr<nsIAtom> nameAtom = GetNameAtom(content);
   3.312 -  if (nameAtom != aAttribute) {
   3.313 -    return;
   3.314 -  }
   3.315 -
   3.316 -  nsCOMPtr<nsIMutationObserver> kungFuDeathGrip(this);
   3.317 -  
   3.318 -  // Just blow away our mChild and recreate it if needed
   3.319 -  if (mChild) {
   3.320 -    doRemoveChild(true);
   3.321 -  }
   3.322 -  EnsureChildState();
   3.323 -}
   3.324 -
   3.325 -void
   3.326  nsDOMAttribute::Initialize()
   3.327  {
   3.328    sInitialized = true;
   3.329  }
   3.330  
   3.331  void
   3.332  nsDOMAttribute::Shutdown()
   3.333  {
   3.334    sInitialized = false;
   3.335  }
   3.336 -
   3.337 -void
   3.338 -nsDOMAttribute::doRemoveChild(bool aNotify)
   3.339 -{
   3.340 -  NS_ASSERTION(mChild && mFirstChild, "Why are we here?");
   3.341 -  NS_ASSERTION(mChild == mFirstChild, "Something got out of sync!");
   3.342 -
   3.343 -  nsRefPtr<nsTextNode> child = static_cast<nsTextNode*>(mChild);
   3.344 -  nsMutationGuard::DidMutate();
   3.345 -  mozAutoDocUpdate updateBatch(OwnerDoc(), UPDATE_CONTENT_MODEL, aNotify);
   3.346 -
   3.347 -  NS_RELEASE(mChild);
   3.348 -  mFirstChild = nsnull;
   3.349 -
   3.350 -  if (aNotify) {
   3.351 -    nsNodeUtils::AttributeChildRemoved(this, child);
   3.352 -  }
   3.353 -
   3.354 -  child->UnbindFromAttribute();
   3.355 -}
   3.356 -
     4.1 --- a/content/base/src/nsDOMAttribute.h
     4.2 +++ b/content/base/src/nsDOMAttribute.h
     4.3 @@ -51,25 +51,24 @@
     4.4  #include "nsINodeInfo.h"
     4.5  #include "nsDOMAttributeMap.h"
     4.6  #include "nsCycleCollectionParticipant.h"
     4.7  #include "nsStubMutationObserver.h"
     4.8  
     4.9  // Attribute helper class used to wrap up an attribute with a dom
    4.10  // object that implements nsIDOMAttr and nsIDOMNode
    4.11  class nsDOMAttribute : public nsIAttribute,
    4.12 -                       public nsIDOMAttr,
    4.13 -                       public nsStubMutationObserver
    4.14 +                       public nsIDOMAttr
    4.15  {
    4.16  public:
    4.17    nsDOMAttribute(nsDOMAttributeMap* aAttrMap,
    4.18                   already_AddRefed<nsINodeInfo> aNodeInfo,
    4.19                   const nsAString& aValue,
    4.20                   bool aNsAware);
    4.21 -  virtual ~nsDOMAttribute();
    4.22 +  virtual ~nsDOMAttribute() {}
    4.23  
    4.24    NS_DECL_CYCLE_COLLECTING_ISUPPORTS
    4.25  
    4.26    // nsIDOMNode interface
    4.27    NS_DECL_NSIDOMNODE
    4.28  
    4.29    // nsIDOMAttr interface
    4.30    NS_DECL_NSIDOMATTR
    4.31 @@ -95,43 +94,29 @@ public:
    4.32    virtual already_AddRefed<nsIURI> GetBaseURI() const;
    4.33  
    4.34    static void Initialize();
    4.35    static void Shutdown();
    4.36  
    4.37    NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_AMBIGUOUS(nsDOMAttribute,
    4.38                                                           nsIAttribute)
    4.39  
    4.40 -  NS_DECL_NSIMUTATIONOBSERVER_ATTRIBUTECHANGED
    4.41 -
    4.42    virtual nsXPCClassInfo* GetClassInfo();
    4.43  protected:
    4.44    virtual mozilla::dom::Element* GetNameSpaceElement()
    4.45    {
    4.46      return GetContentInternal();
    4.47    }
    4.48  
    4.49    static bool sInitialized;
    4.50  
    4.51  private:
    4.52    already_AddRefed<nsIAtom> GetNameAtom(nsIContent* aContent);
    4.53 -
    4.54 -  void EnsureChildState();
    4.55 -
    4.56 -  /**
    4.57 -   * Really removing the attribute child (unbind and release).
    4.58 -   */
    4.59 -  void doRemoveChild(bool aNotify);
    4.60 -
    4.61 -  nsString mValue;
    4.62 -  // XXX For now, there's only a single child - a text element
    4.63 -  // representing the value.  This is strong ref, but we use a raw
    4.64 -  // pointer so we can implement GetChildArray().
    4.65 -  nsIContent* mChild;
    4.66 -
    4.67    mozilla::dom::Element *GetContentInternal() const
    4.68    {
    4.69      return mAttrMap ? mAttrMap->GetContent() : nsnull;
    4.70    }
    4.71 +
    4.72 +  nsString mValue;
    4.73  };
    4.74  
    4.75  
    4.76  #endif /* nsDOMAttribute_h___ */
     5.1 --- a/content/base/src/nsNodeIterator.cpp
     5.2 +++ b/content/base/src/nsNodeIterator.cpp
     5.3 @@ -202,17 +202,16 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(
     5.4  NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
     5.5  
     5.6  DOMCI_DATA(NodeIterator, nsNodeIterator)
     5.7  
     5.8  // QueryInterface implementation for nsNodeIterator
     5.9  NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsNodeIterator)
    5.10      NS_INTERFACE_MAP_ENTRY(nsIDOMNodeIterator)
    5.11      NS_INTERFACE_MAP_ENTRY(nsIMutationObserver)
    5.12 -    NS_INTERFACE_MAP_ENTRY(nsIMutationObserver2)
    5.13      NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMNodeIterator)
    5.14      NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(NodeIterator)
    5.15  NS_INTERFACE_MAP_END
    5.16  
    5.17  NS_IMPL_CYCLE_COLLECTING_ADDREF(nsNodeIterator)
    5.18  NS_IMPL_CYCLE_COLLECTING_RELEASE(nsNodeIterator)
    5.19  
    5.20  /* readonly attribute nsIDOMNode root; */
    5.21 @@ -340,16 +339,8 @@ void nsNodeIterator::ContentRemoved(nsID
    5.22                                      PRInt32 aIndexInContainer,
    5.23                                      nsIContent *aPreviousSibling)
    5.24  {
    5.25      nsINode *container = NODE_FROM(aContainer, aDocument);
    5.26  
    5.27      mPointer.AdjustAfterRemoval(mRoot, container, aChild, aPreviousSibling);
    5.28      mWorkingPointer.AdjustAfterRemoval(mRoot, container, aChild, aPreviousSibling);
    5.29  }
    5.30 -
    5.31 -void nsNodeIterator::AttributeChildRemoved(nsINode* aAttribute,
    5.32 -                                           nsIContent* aChild)
    5.33 -{
    5.34 -  mPointer.AdjustAfterRemoval(mRoot, aAttribute, aChild, 0);
    5.35 -  mWorkingPointer.AdjustAfterRemoval(mRoot, aAttribute, aChild, 0);
    5.36 -}
    5.37 -
     6.1 --- a/content/base/src/nsNodeIterator.h
     6.2 +++ b/content/base/src/nsNodeIterator.h
     6.3 @@ -50,29 +50,28 @@
     6.4  #include "nsStubMutationObserver.h"
     6.5  
     6.6  class nsINode;
     6.7  class nsIDOMNode;
     6.8  class nsIDOMNodeFilter;
     6.9  
    6.10  class nsNodeIterator : public nsIDOMNodeIterator,
    6.11                         public nsTraversal,
    6.12 -                       public nsStubMutationObserver2
    6.13 +                       public nsStubMutationObserver
    6.14  {
    6.15  public:
    6.16      NS_DECL_CYCLE_COLLECTING_ISUPPORTS
    6.17      NS_DECL_NSIDOMNODEITERATOR
    6.18  
    6.19      nsNodeIterator(nsINode *aRoot,
    6.20                     PRUint32 aWhatToShow,
    6.21                     nsIDOMNodeFilter *aFilter);
    6.22      virtual ~nsNodeIterator();
    6.23  
    6.24      NS_DECL_NSIMUTATIONOBSERVER_CONTENTREMOVED
    6.25 -    NS_DECL_NSIMUTATIONOBSERVER2_ATTRIBUTECHILDREMOVED
    6.26  
    6.27      NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsNodeIterator, nsIDOMNodeIterator)
    6.28  
    6.29  private:
    6.30      struct NodePointer {
    6.31          NodePointer() : mNode(nsnull) {};
    6.32          NodePointer(nsINode *aNode, bool aBeforeNode);
    6.33  
     7.1 --- a/content/base/src/nsNodeUtils.cpp
     7.2 +++ b/content/base/src/nsNodeUtils.cpp
     7.3 @@ -37,21 +37,19 @@
     7.4   * ***** END LICENSE BLOCK ***** */
     7.5  
     7.6  #include "nsNodeUtils.h"
     7.7  #include "nsContentUtils.h"
     7.8  #include "nsINode.h"
     7.9  #include "nsIContent.h"
    7.10  #include "mozilla/dom/Element.h"
    7.11  #include "nsIMutationObserver.h"
    7.12 -#include "nsIMutationObserver2.h"
    7.13  #include "nsIDocument.h"
    7.14  #include "nsIDOMUserDataHandler.h"
    7.15  #include "nsEventListenerManager.h"
    7.16 -#include "nsIAttribute.h"
    7.17  #include "nsIXPConnect.h"
    7.18  #include "nsGenericElement.h"
    7.19  #include "pldhash.h"
    7.20  #include "nsIDOMAttr.h"
    7.21  #include "nsCOMArray.h"
    7.22  #include "nsPIDOMWindow.h"
    7.23  #include "nsDocument.h"
    7.24  #ifdef MOZ_XUL
    7.25 @@ -67,18 +65,16 @@
    7.26  #include "nsWrapperCacheInlines.h"
    7.27  #include "nsObjectLoadingContent.h"
    7.28  #include "nsDOMMutationObserver.h"
    7.29  
    7.30  using namespace mozilla::dom;
    7.31  
    7.32  // This macro expects the ownerDocument of content_ to be in scope as
    7.33  // |nsIDocument* doc|
    7.34 -// NOTE: AttributeChildRemoved doesn't use this macro but has a very similar use.
    7.35 -// If you change how this macro behave please update AttributeChildRemoved.
    7.36  #define IMPL_MUTATION_NOTIFICATION(func_, content_, params_)      \
    7.37    PR_BEGIN_MACRO                                                  \
    7.38    bool needsEnterLeave = doc->MayHaveDOMMutationObservers();      \
    7.39    if (needsEnterLeave) {                                          \
    7.40      nsDOMMutationObserver::EnterMutationHandling();               \
    7.41    }                                                               \
    7.42    nsINode* node = content_;                                       \
    7.43    NS_ASSERTION(node->OwnerDoc() == doc, "Bogus document");        \
    7.44 @@ -202,42 +198,16 @@ nsNodeUtils::ContentRemoved(nsINode* aCo
    7.45    }
    7.46  
    7.47    IMPL_MUTATION_NOTIFICATION(ContentRemoved, aContainer,
    7.48                               (document, container, aChild, aIndexInContainer,
    7.49                                aPreviousSibling));
    7.50  }
    7.51  
    7.52  void
    7.53 -nsNodeUtils::AttributeChildRemoved(nsINode* aAttribute,
    7.54 -                                   nsIContent* aChild)
    7.55 -{
    7.56 -  NS_PRECONDITION(aAttribute->IsNodeOfType(nsINode::eATTRIBUTE),
    7.57 -                  "container must be a nsIAttribute");
    7.58 -
    7.59 -  // This is a variant of IMPL_MUTATION_NOTIFICATION.
    7.60 -  do {
    7.61 -    nsINode::nsSlots* slots = aAttribute->GetExistingSlots();
    7.62 -    if (slots && !slots->mMutationObservers.IsEmpty()) {
    7.63 -      // This is a variant of NS_OBSERVER_ARRAY_NOTIFY_OBSERVERS.
    7.64 -      nsTObserverArray<nsIMutationObserver*>::ForwardIterator iter_ =
    7.65 -        slots->mMutationObservers;
    7.66 -      nsCOMPtr<nsIMutationObserver2> obs_;
    7.67 -      while (iter_.HasMore()) {
    7.68 -        obs_ = do_QueryInterface(iter_.GetNext());
    7.69 -        if (obs_) {
    7.70 -          obs_->AttributeChildRemoved(aAttribute, aChild);
    7.71 -        }
    7.72 -      }
    7.73 -    }
    7.74 -    aAttribute = aAttribute->GetNodeParent();
    7.75 -  } while (aAttribute);
    7.76 -}
    7.77 -
    7.78 -void
    7.79  nsNodeUtils::LastRelease(nsINode* aNode)
    7.80  {
    7.81    nsINode::nsSlots* slots = aNode->GetExistingSlots();
    7.82    if (slots) {
    7.83      if (!slots->mMutationObservers.IsEmpty()) {
    7.84        NS_OBSERVER_ARRAY_NOTIFY_OBSERVERS(slots->mMutationObservers,
    7.85                                           nsIMutationObserver,
    7.86                                           NodeWillBeDestroyed, (aNode));
    7.87 @@ -605,42 +575,21 @@ nsNodeUtils::CloneAndAdopt(nsINode *aNod
    7.88      }
    7.89    }
    7.90  
    7.91    // XXX If there are any attribute nodes on this element with UserDataHandlers
    7.92    // we should technically adopt/clone/import such attribute nodes and notify
    7.93    // those handlers. However we currently don't have code to do so without
    7.94    // also notifying when it's not safe so we're not doing that at this time.
    7.95  
    7.96 -  // The DOM spec says to always adopt/clone/import the children of attribute
    7.97 -  // nodes.
    7.98 -  // XXX The following block is here because our implementation of attribute
    7.99 -  //     nodes is broken when it comes to inserting children. Instead of cloning
   7.100 -  //     their children we force creation of the only child by calling
   7.101 -  //     GetChildAt(0). We can remove this when
   7.102 -  //     https://bugzilla.mozilla.org/show_bug.cgi?id=56758 is fixed.
   7.103 -  if (aClone && aNode->IsNodeOfType(nsINode::eATTRIBUTE)) {
   7.104 -    nsCOMPtr<nsINode> attrChildNode = aNode->GetChildAt(0);
   7.105 -    // We only need to do this if the child node has properties (because we
   7.106 -    // might need to call a userdata handler).
   7.107 -    if (attrChildNode && attrChildNode->HasProperties()) {
   7.108 -      nsCOMPtr<nsINode> clonedAttrChildNode = clone->GetChildAt(0);
   7.109 -      if (clonedAttrChildNode) {
   7.110 -        bool ok = aNodesWithProperties.AppendObject(attrChildNode) &&
   7.111 -                    aNodesWithProperties.AppendObject(clonedAttrChildNode);
   7.112 -        NS_ENSURE_TRUE(ok, NS_ERROR_OUT_OF_MEMORY);
   7.113 -      }
   7.114 -    }
   7.115 -  }
   7.116 -  // XXX End of workaround for broken attribute nodes.
   7.117 -  else if (aDeep || aNode->IsNodeOfType(nsINode::eATTRIBUTE)) {
   7.118 +  if (aDeep && (!aClone || !aNode->IsNodeOfType(nsINode::eATTRIBUTE))) {
   7.119      // aNode's children.
   7.120      for (nsIContent* cloneChild = aNode->GetFirstChild();
   7.121           cloneChild;
   7.122 -       cloneChild = cloneChild->GetNextSibling()) {
   7.123 +         cloneChild = cloneChild->GetNextSibling()) {
   7.124        nsCOMPtr<nsINode> child;
   7.125        rv = CloneAndAdopt(cloneChild, aClone, true, nodeInfoManager,
   7.126                           aCx, aNewScope, aNodesWithProperties, clone,
   7.127                           getter_AddRefs(child));
   7.128        NS_ENSURE_SUCCESS(rv, rv);
   7.129      }
   7.130    }
   7.131  
     8.1 --- a/content/base/src/nsNodeUtils.h
     8.2 +++ b/content/base/src/nsNodeUtils.h
     8.3 @@ -125,23 +125,16 @@ public:
     8.4     * @param aIndexInContainer Index of removed child
     8.5     * @see nsIMutationObserver::ContentRemoved
     8.6     */
     8.7    static void ContentRemoved(nsINode* aContainer,
     8.8                               nsIContent* aChild,
     8.9                               PRInt32 aIndexInContainer,
    8.10                               nsIContent* aPreviousSibling);
    8.11    /**
    8.12 -   * Send AttributeChildRemoved notifications to nsIMutationObservers.
    8.13 -   * @param aAttribute Attribute from which the child has been removed.
    8.14 -   * @param aChild     Removed child.
    8.15 -   * @see nsIMutationObserver2::AttributeChildRemoved.
    8.16 -   */
    8.17 -  static void AttributeChildRemoved(nsINode* aAttribute, nsIContent* aChild);
    8.18 -  /**
    8.19     * Send ParentChainChanged notifications to nsIMutationObservers
    8.20     * @param aContent  The piece of content that had its parent changed.
    8.21     * @see nsIMutationObserver::ParentChainChanged
    8.22     */
    8.23    static inline void ParentChainChanged(nsIContent *aContent)
    8.24    {
    8.25      nsINode::nsSlots* slots = aContent->GetExistingSlots();
    8.26      if (slots && !slots->mMutationObservers.IsEmpty()) {
     9.1 --- a/content/base/src/nsStubMutationObserver.cpp
     9.2 +++ b/content/base/src/nsStubMutationObserver.cpp
     9.3 @@ -41,11 +41,8 @@
     9.4   * used as a base class within the content/layout library.  All methods do
     9.5   * nothing.
     9.6   */
     9.7  
     9.8  #include "nsStubMutationObserver.h"
     9.9  
    9.10  NS_IMPL_NSIMUTATIONOBSERVER_CORE_STUB(nsStubMutationObserver)
    9.11  NS_IMPL_NSIMUTATIONOBSERVER_CONTENT(nsStubMutationObserver)
    9.12 -
    9.13 -NS_IMPL_NSIMUTATIONOBSERVER_CORE_STUB(nsStubMutationObserver2)
    9.14 -NS_IMPL_NSIMUTATIONOBSERVER2_CONTENT(nsStubMutationObserver2)
    10.1 --- a/content/base/src/nsStubMutationObserver.h
    10.2 +++ b/content/base/src/nsStubMutationObserver.h
    10.3 @@ -41,30 +41,25 @@
    10.4   * used as a base class within the content/layout library.  All methods do
    10.5   * nothing.
    10.6   */
    10.7  
    10.8  #ifndef nsStubMutationObserver_h_
    10.9  #define nsStubMutationObserver_h_
   10.10  
   10.11  #include "nsIMutationObserver.h"
   10.12 -#include "nsIMutationObserver2.h"
   10.13  
   10.14  /**
   10.15   * There are two advantages to inheriting from nsStubMutationObserver
   10.16   * rather than directly from nsIMutationObserver:
   10.17   *  1. smaller compiled code size (since there's no need for the code
   10.18   *     for the empty virtual function implementations for every
   10.19   *     nsIMutationObserver implementation)
   10.20   *  2. the performance of document's loop over observers benefits from
   10.21   *     the fact that more of the functions called are the same (which
   10.22   *     can reduce instruction cache misses and perhaps improve branch
   10.23   *     prediction)
   10.24   */
   10.25  class nsStubMutationObserver : public nsIMutationObserver {
   10.26    NS_DECL_NSIMUTATIONOBSERVER
   10.27  };
   10.28  
   10.29 -class nsStubMutationObserver2 : public nsIMutationObserver2 {
   10.30 -  NS_DECL_NSIMUTATIONOBSERVER2
   10.31 -};
   10.32 -
   10.33  #endif /* !defined(nsStubMutationObserver_h_) */
    11.1 --- a/content/base/src/nsTextNode.cpp
    11.2 +++ b/content/base/src/nsTextNode.cpp
    11.3 @@ -38,17 +38,16 @@
    11.4  /*
    11.5   * Implementation of DOM Core's nsIDOMText node.
    11.6   */
    11.7  
    11.8  #include "nsTextNode.h"
    11.9  #include "nsContentUtils.h"
   11.10  #include "nsIDOMEventListener.h"
   11.11  #include "nsIDOMMutationEvent.h"
   11.12 -#include "nsIAttribute.h"
   11.13  #include "nsIDocument.h"
   11.14  #include "nsThreadUtils.h"
   11.15  #ifdef DEBUG
   11.16  #include "nsRange.h"
   11.17  #endif
   11.18  
   11.19  using namespace mozilla::dom;
   11.20  
   11.21 @@ -179,39 +178,16 @@ nsTextNode::CloneDataNode(nsINodeInfo *a
   11.22    nsTextNode *it = new nsTextNode(ni.forget());
   11.23    if (it && aCloneText) {
   11.24      it->mText = mText;
   11.25    }
   11.26  
   11.27    return it;
   11.28  }
   11.29  
   11.30 -void
   11.31 -nsTextNode::BindToAttribute(nsIAttribute* aAttr)
   11.32 -{
   11.33 -  NS_ASSERTION(!IsInDoc(), "Unbind before binding!");
   11.34 -  NS_ASSERTION(!GetNodeParent(), "Unbind before binding!");
   11.35 -  NS_ASSERTION(HasSameOwnerDoc(aAttr), "Wrong owner document!");
   11.36 -
   11.37 -  mParent = aAttr;
   11.38 -  SetParentIsContent(false);
   11.39 -  ClearInDocument();
   11.40 -  SetSubtreeRootPointer(aAttr->SubtreeRoot());
   11.41 -}
   11.42 -
   11.43 -void
   11.44 -nsTextNode::UnbindFromAttribute()
   11.45 -{
   11.46 -  NS_ASSERTION(GetNodeParent(), "Bind before unbinding!");
   11.47 -  NS_ASSERTION(GetNodeParent()->IsNodeOfType(nsINode::eATTRIBUTE),
   11.48 -               "Use this method only to unbind from an attribute!");
   11.49 -  mParent = nsnull;
   11.50 -  SetSubtreeRootPointer(this);
   11.51 -}
   11.52 -
   11.53  nsresult
   11.54  nsTextNode::AppendTextForNormalize(const PRUnichar* aBuffer, PRUint32 aLength,
   11.55                                     bool aNotify, nsIContent* aNextSibling)
   11.56  {
   11.57    CharacterDataChangeInfo::Details details = {
   11.58      CharacterDataChangeInfo::Details::eMerge, aNextSibling
   11.59    };
   11.60    return SetTextInternal(mText.GetLength(), 0, aBuffer, aLength, aNotify, &details);
    12.1 --- a/content/base/src/nsTextNode.h
    12.2 +++ b/content/base/src/nsTextNode.h
    12.3 @@ -37,20 +37,16 @@
    12.4  
    12.5  /*
    12.6   * Implementation of DOM Core's nsIDOMText node.
    12.7   */
    12.8  
    12.9  #include "nsGenericDOMDataNode.h"
   12.10  #include "nsIDOMText.h"
   12.11  
   12.12 -#include "nsIAttribute.h"
   12.13 -#include "nsIDocument.h"
   12.14 -#include "nsThreadUtils.h"
   12.15 -
   12.16  /**
   12.17   * Class used to implement DOM text nodes
   12.18   */
   12.19  class nsTextNode : public nsGenericDOMDataNode,
   12.20                     public nsIDOMText
   12.21  {
   12.22  public:
   12.23    nsTextNode(already_AddRefed<nsINodeInfo> aNodeInfo);
   12.24 @@ -69,19 +65,16 @@ public:
   12.25    NS_FORWARD_NSIDOMTEXT(nsGenericDOMDataNode::)
   12.26  
   12.27    // nsINode
   12.28    virtual bool IsNodeOfType(PRUint32 aFlags) const;
   12.29  
   12.30    virtual nsGenericDOMDataNode* CloneDataNode(nsINodeInfo *aNodeInfo,
   12.31                                                bool aCloneText) const;
   12.32  
   12.33 -  void BindToAttribute(nsIAttribute* aAttr);
   12.34 -  void UnbindFromAttribute();
   12.35 -
   12.36    virtual nsXPCClassInfo* GetClassInfo();
   12.37  
   12.38    nsresult AppendTextForNormalize(const PRUnichar* aBuffer, PRUint32 aLength,
   12.39                                    bool aNotify, nsIContent* aNextSibling);
   12.40  
   12.41  #ifdef DEBUG
   12.42    virtual void List(FILE* out, PRInt32 aIndent) const;
   12.43    virtual void DumpContent(FILE* out, PRInt32 aIndent, bool aDumpAll) const;
    13.1 --- a/content/base/test/Makefile.in
    13.2 +++ b/content/base/test/Makefile.in
    13.3 @@ -436,21 +436,17 @@ include $(topsrcdir)/config/rules.mk
    13.4  		test_bug564047.html \
    13.5  		test_bug567350.html \
    13.6  		test_bug578096.html \
    13.7  		test_bug585978.html \
    13.8  		test_bug592366.html \
    13.9  		test_bug597345.html \
   13.10  		script-1_bug597345.sjs \
   13.11  		script-2_bug597345.js \
   13.12 -		test_bug598877.html \
   13.13  		test_bug599588.html \
   13.14 -		test_bug600466.html \
   13.15 -		test_bug600468.html \
   13.16 -		test_bug600471.html \
   13.17  		test_bug601803.html \
   13.18  		file_bug601803a.html \
   13.19  		file_bug601803b.html \
   13.20  		test_bug602838.html \
   13.21  		script_bug602838.sjs \
   13.22  		test_bug614583.html \
   13.23  		test_bug604660.html \
   13.24  		file_bug604660-1.xml \
   13.25 @@ -458,17 +454,16 @@ include $(topsrcdir)/config/rules.mk
   13.26  		file_bug604660-3.js \
   13.27  		file_bug604660-4.js \
   13.28  		file_bug604660-5.xml \
   13.29  		file_bug604660-6.xsl \
   13.30  		test_bug605982.html \
   13.31  		test_bug606729.html \
   13.32  		test_treewalker_nextsibling.xml \
   13.33  		test_bug614058.html \
   13.34 -		test_bug590771.html \
   13.35  		test_bug622117.html \
   13.36  		test_base.xhtml \
   13.37  		file_base_xbl.xml \
   13.38  		test_bug622246.html \
   13.39  		test_bug484396.html \
   13.40  		test_bug466080.html \
   13.41  		bug466080.sjs \
   13.42  		test_bug625722.html \
    14.1 deleted file mode 100644
    14.2 --- a/content/base/test/test_bug590771.html
    14.3 +++ /dev/null
    14.4 @@ -1,73 +0,0 @@
    14.5 -<!DOCTYPE HTML>
    14.6 -<html>
    14.7 -<!--
    14.8 -https://bugzilla.mozilla.org/show_bug.cgi?id=590771
    14.9 --->
   14.10 -<head>
   14.11 -  <title>Test for Bug 590771</title>
   14.12 -  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
   14.13 -  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
   14.14 -</head>
   14.15 -<body>
   14.16 -<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=590771">Mozilla Bug 590771</a>
   14.17 -<p id="display"></p>
   14.18 -<pre id="test">
   14.19 -<script type="application/javascript">
   14.20 -
   14.21 -/** Test for Bug 590771 **/
   14.22 -
   14.23 -function test1()
   14.24 -{
   14.25 -  var attr = document.createAttribute("foo");
   14.26 -  attr.value = "bar";
   14.27 -  var ni = document.createNodeIterator(attr, -1, null, false);
   14.28 -  ni.nextNode();
   14.29 -  ni.nextNode();
   14.30 -  is(ni.referenceNode, attr.firstChild,
   14.31 -      "iterator should be on the first child attribute");
   14.32 -
   14.33 -  attr.removeChild(attr.firstChild);
   14.34 -  is(ni.referenceNode, attr,
   14.35 -     "iterator should be on the attribute now");
   14.36 -}
   14.37 -
   14.38 -function test2()
   14.39 -{
   14.40 -  var attr = document.createAttribute("foo");
   14.41 -  attr.value = "bar";
   14.42 -  var ni = document.createNodeIterator(attr, -1, null, false);
   14.43 -  ni.nextNode();
   14.44 -  ni.nextNode();
   14.45 -  is(ni.referenceNode, attr.firstChild,
   14.46 -      "iterator should be on the first child attribute");
   14.47 -
   14.48 -  attr.value = "";
   14.49 -  is(ni.referenceNode, attr,
   14.50 -     "iterator should be on the attribute now");
   14.51 -}
   14.52 -
   14.53 -function test3()
   14.54 -{
   14.55 -  var attr = document.createAttribute("foo");
   14.56 -  attr.value = "bar";
   14.57 -  var node = document.createElement("div");
   14.58 -  node.setAttributeNode(attr);
   14.59 -  var ni = document.createNodeIterator(attr, -1, null, false);
   14.60 -  ni.nextNode();
   14.61 -  ni.nextNode();
   14.62 -  is(ni.referenceNode, attr.firstChild,
   14.63 -      "iterator should be on the first child attribute");
   14.64 -
   14.65 -  node.setAttribute("foo", "");
   14.66 -  is(ni.referenceNode, attr,
   14.67 -     "iterator should be on the attribute now");
   14.68 -}
   14.69 -
   14.70 -test1();
   14.71 -test2();
   14.72 -test3();
   14.73 -
   14.74 -</script>
   14.75 -</pre>
   14.76 -</body>
   14.77 -</html>
    15.1 deleted file mode 100644
    15.2 --- a/content/base/test/test_bug598877.html
    15.3 +++ /dev/null
    15.4 @@ -1,27 +0,0 @@
    15.5 -<!DOCTYPE HTML>
    15.6 -<html>
    15.7 -<!--
    15.8 -https://bugzilla.mozilla.org/show_bug.cgi?id=598877
    15.9 --->
   15.10 -<head>
   15.11 -  <title>Test for Bug 598877</title>
   15.12 -  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
   15.13 -  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
   15.14 -</head>
   15.15 -<body>
   15.16 -<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=598877">Mozilla Bug 598877</a>
   15.17 -<p id="display"></p>
   15.18 -<pre id="test">
   15.19 -<script type="application/javascript">
   15.20 -
   15.21 -/** Test for Bug 598877 **/
   15.22 -
   15.23 -var attr = document.createAttribute("foo");
   15.24 -attr.value = "bar";
   15.25 -ok(attr.firstChild, "attr.firstChild should be a text node");
   15.26 -is(attr.firstChild.nodeValue, "bar", "the text node value should be 'bar'");
   15.27 -
   15.28 -</script>
   15.29 -</pre>
   15.30 -</body>
   15.31 -</html>
    16.1 deleted file mode 100644
    16.2 --- a/content/base/test/test_bug600466.html
    16.3 +++ /dev/null
    16.4 @@ -1,29 +0,0 @@
    16.5 -<!DOCTYPE HTML>
    16.6 -<html>
    16.7 -<!--
    16.8 -https://bugzilla.mozilla.org/show_bug.cgi?id=600466
    16.9 --->
   16.10 -<head>
   16.11 -  <title>Test for Bug 600466</title>
   16.12 -  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
   16.13 -  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
   16.14 -</head>
   16.15 -<body>
   16.16 -<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=600466">Mozilla Bug 600466</a>
   16.17 -<p id="display"></p>
   16.18 -<pre id="test">
   16.19 -<script type="application/javascript">
   16.20 -
   16.21 -/** Test for Bug 600466 **/
   16.22 -
   16.23 -var attr = document.createAttribute("foo");
   16.24 -attr.value = "bar";
   16.25 -ok(attr.firstChild, "attr should have a first child");
   16.26 -
   16.27 -attr.removeChild(attr.firstChild);
   16.28 -ok(!attr.firstChild, "attr should not have a first child anymore");
   16.29 -
   16.30 -</script>
   16.31 -</pre>
   16.32 -</body>
   16.33 -</html>
    17.1 deleted file mode 100644
    17.2 --- a/content/base/test/test_bug600468.html
    17.3 +++ /dev/null
    17.4 @@ -1,29 +0,0 @@
    17.5 -<!DOCTYPE HTML>
    17.6 -<html>
    17.7 -<!--
    17.8 -https://bugzilla.mozilla.org/show_bug.cgi?id=600468
    17.9 --->
   17.10 -<head>
   17.11 -  <title>Test for Bug 600468</title>
   17.12 -  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
   17.13 -  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
   17.14 -</head>
   17.15 -<body>
   17.16 -<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=600468">Mozilla Bug 600468</a>
   17.17 -<p id="display"></p>
   17.18 -<pre id="test">
   17.19 -<script type="application/javascript">
   17.20 -
   17.21 -/** Test for Bug 600468 **/
   17.22 -
   17.23 -var attr = document.createAttribute("foo");
   17.24 -attr.value = "bar";
   17.25 -ok(attr.firstChild, "attr should have a first child");
   17.26 -
   17.27 -attr.value = "";
   17.28 -ok(!attr.firstChild, "attr should not have a first child");
   17.29 -
   17.30 -</script>
   17.31 -</pre>
   17.32 -</body>
   17.33 -</html>
    18.1 deleted file mode 100644
    18.2 --- a/content/base/test/test_bug600471.html
    18.3 +++ /dev/null
    18.4 @@ -1,30 +0,0 @@
    18.5 -<!DOCTYPE HTML>
    18.6 -<html>
    18.7 -<!--
    18.8 -https://bugzilla.mozilla.org/show_bug.cgi?id=600471
    18.9 --->
   18.10 -<head>
   18.11 -  <title>Test for Bug 600471</title>
   18.12 -  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
   18.13 -  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
   18.14 -</head>
   18.15 -<body>
   18.16 -<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=600471">Mozilla Bug 600471</a>
   18.17 -<p id="display"></p>
   18.18 -<pre id="test">
   18.19 -<script type="application/javascript">
   18.20 -
   18.21 -/** Test for Bug 600471 **/
   18.22 -
   18.23 -var attr = document.createAttribute("foo");
   18.24 -attr.value = "bar";
   18.25 -var node = document.createElement("div");
   18.26 -node.setAttributeNode(attr);
   18.27 -
   18.28 -node.setAttribute("foo", "newvalue");
   18.29 -is(attr.firstChild.nodeValue, "newvalue", "the value should be updated");
   18.30 -
   18.31 -</script>
   18.32 -</pre>
   18.33 -</body>
   18.34 -</html>
    19.1 --- a/dom/tests/mochitest/dom-level1-core/exclusions.js
    19.2 +++ b/dom/tests/mochitest/dom-level1-core/exclusions.js
    19.3 @@ -74,17 +74,20 @@ var indexErrTests = ["characterdataindex
    19.4                       "characterdataindexsizeerrsubstringcountnegative", "hc_characterdataindexsizeerrdeletedatacountnegative",
    19.5                       "hc_characterdataindexsizeerrreplacedatacountnegative", "hc_characterdataindexsizeerrsubstringcountnegative"];
    19.6  
    19.7  var attributeModTests = ["hc_attrappendchild1", "hc_attrappendchild3", "hc_attrappendchild5",
    19.8                           "hc_attrappendchild6", "hc_attrchildnodes2", "hc_attrclonenode1", "hc_attrinsertbefore1",
    19.9                           "hc_attrinsertbefore2", "hc_attrinsertbefore3", "hc_attrinsertbefore4", "hc_attrinsertbefore6",
   19.10                           "hc_attrnormalize", "hc_attrreplacechild1", "hc_attrreplacechild2",
   19.11                           "hc_attrsetvalue2", "hc_elementnormalize2", "hc_elementnotfounderr", "hc_elementremoveattribute", "hc_elementnormalize2",
   19.12 -                         "hc_elementnotfounderr", "hc_elementremoveattribute", ];
   19.13 +                         "hc_elementnotfounderr", "hc_elementremoveattribute",
   19.14 +                         "hc_attrchildnodes1", "hc_attrfirstchild",
   19.15 +                         "hc_attrhaschildnodes", "hc_attrlastchild",
   19.16 +                         "hc_attrremovechild1", "hc_attrsetvalue1"];
   19.17  var modTests = ["hc_elementwrongdocumenterr", "hc_namednodemapwrongdocumenterr", "hc_nodeappendchildnewchilddiffdocument", "hc_nodeinsertbeforenewchilddiffdocument",
   19.18                  "hc_nodereplacechildnewchilddiffdocument", "hc_elementwrongdocumenterr", "hc_namednodemapwrongdocumenterr", "hc_nodeappendchildnewchilddiffdocument",
   19.19                  "hc_nodeinsertbeforenewchilddiffdocument", "hc_nodereplacechildnewchilddiffdocument", "elementwrongdocumenterr", "namednodemapwrongdocumenterr",
   19.20                  "nodeappendchildnewchilddiffdocument", "nodeinsertbeforenewchilddiffdocument", "nodereplacechildnewchilddiffdocument"];
   19.21  // These tests rely on an implementation of document.createEntityReference.
   19.22  var createEntityRef = ["documentinvalidcharacterexceptioncreateentref",
   19.23                         "documentinvalidcharacterexceptioncreateentref1",
   19.24                         "hc_attrgetvalue2", "hc_nodevalue03"];