Bug 1258205 - Make setAttribute throw InvalidCharacterError if the attribute already exists. r=baku
authorOriol <oriol-bugzilla@hotmail.com>
Fri, 15 Apr 2016 09:01:00 -0400
changeset 331364 9f21863863d0fec6a1d55a880b06e58ed297448b
parent 331363 ee2eb4c37c5cb22c7b92f053a0123e5897108abd
child 331365 105b3fba6454606849bae897756ad4babfc5527b
push id6048
push userkmoir@mozilla.com
push dateMon, 06 Jun 2016 19:02:08 +0000
treeherdermozilla-beta@46d72a56c57d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbaku
bugs1258205
milestone48.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 1258205 - Make setAttribute throw InvalidCharacterError if the attribute already exists. r=baku
dom/base/Element.cpp
testing/web-platform/meta/dom/nodes/attributes.html.ini
--- a/dom/base/Element.cpp
+++ b/dom/base/Element.cpp
@@ -1172,24 +1172,22 @@ Element::GetAttribute(const nsAString& a
   }
 }
 
 void
 Element::SetAttribute(const nsAString& aName,
                       const nsAString& aValue,
                       ErrorResult& aError)
 {
+  aError = nsContentUtils::CheckQName(aName, false);
+  if (aError.Failed()) {
+    return;
+  }
   const nsAttrName* name = InternalGetExistingAttrNameFromQName(aName);
-
   if (!name) {
-    aError = nsContentUtils::CheckQName(aName, false);
-    if (aError.Failed()) {
-      return;
-    }
-
     nsCOMPtr<nsIAtom> nameAtom;
     if (IsHTMLElement() && IsInHTMLDocument()) {
       nsAutoString lower;
       nsContentUtils::ASCIIToLower(aName, lower);
       nameAtom = NS_Atomize(lower);
     }
     else {
       nameAtom = NS_Atomize(aName);
--- a/testing/web-platform/meta/dom/nodes/attributes.html.ini
+++ b/testing/web-platform/meta/dom/nodes/attributes.html.ini
@@ -1,11 +1,8 @@
 [attributes.html]
   type: testharness
   [AttrExodus]
     expected: FAIL
 
   [First set attribute is returned with mapped attribute set first]
     expected: FAIL
 
-  [When qualifiedName does not match the Name production, an INVALID_CHARACTER_ERR exception is to be thrown, even if the attribute is already present. (setAttribute)]
-    expected: FAIL
-