Diff
Modified: trunk/LayoutTests/ChangeLog (199391 => 199392)
--- trunk/LayoutTests/ChangeLog 2016-04-12 21:52:08 UTC (rev 199391)
+++ trunk/LayoutTests/ChangeLog 2016-04-12 22:38:35 UTC (rev 199392)
@@ -1,3 +1,18 @@
+2016-04-12 Chris Dumez <[email protected]>
+
+ Attr.value should not be nullable
+ https://bugs.webkit.org/show_bug.cgi?id=156515
+
+ Reviewed by Benjamin Poulain.
+
+ Add layout test and rebaseline existing one now that Attr.value is no
+ longer nullable.
+
+ * fast/dom/Attr/value-not-nullable-expected.txt: Added.
+ * fast/dom/Attr/value-not-nullable.html: Added.
+ * fast/dom/coreDOM-element-attribute-js-null-expected.txt:
+ * fast/dom/coreDOM-element-attribute-js-null.xhtml:
+
2016-04-12 David Kilzer <[email protected]>
Web Inspector: inspector/heap/getRemoteObject.html is flakey
Added: trunk/LayoutTests/fast/dom/Attr/value-not-nullable-expected.txt (0 => 199392)
--- trunk/LayoutTests/fast/dom/Attr/value-not-nullable-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/dom/Attr/value-not-nullable-expected.txt 2016-04-12 22:38:35 UTC (rev 199392)
@@ -0,0 +1,15 @@
+Tests that Attr.value is not nullable
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+attr = document.createAttribute('test')
+PASS attr.value is ""
+PASS attr.value = null did not throw exception.
+PASS attr.value is "null"
+PASS attr.value = undefined did not throw exception.
+PASS attr.value is "undefined"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/fast/dom/Attr/value-not-nullable.html (0 => 199392)
--- trunk/LayoutTests/fast/dom/Attr/value-not-nullable.html (rev 0)
+++ trunk/LayoutTests/fast/dom/Attr/value-not-nullable.html 2016-04-12 22:38:35 UTC (rev 199392)
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<body>
+<script src=""
+<script>
+description("Tests that Attr.value is not nullable");
+
+evalAndLog("attr = document.createAttribute('test')");
+shouldBeEmptyString("attr.value");
+shouldNotThrow("attr.value = null");
+shouldBeEqualToString("attr.value", "null");
+shouldNotThrow("attr.value = undefined");
+shouldBeEqualToString("attr.value", "undefined");
+
+</script>
+<script src=""
+</body>
Modified: trunk/LayoutTests/fast/dom/coreDOM-element-attribute-js-null-expected.txt (199391 => 199392)
--- trunk/LayoutTests/fast/dom/coreDOM-element-attribute-js-null-expected.txt 2016-04-12 21:52:08 UTC (rev 199391)
+++ trunk/LayoutTests/fast/dom/coreDOM-element-attribute-js-null-expected.txt 2016-04-12 22:38:35 UTC (rev 199392)
@@ -1,6 +1,6 @@
This test setting various attributes of a elements to _javascript_ null.
-TEST SUCCEEDED: The value was null. [tested Attr.value]
+TEST SUCCEEDED: The value was the string 'null'. [tested Attr.value]
TEST SUCCEEDED: The value was the empty string. [tested ProcessingInstruction.data]
Modified: trunk/LayoutTests/fast/dom/coreDOM-element-attribute-js-null.xhtml (199391 => 199392)
--- trunk/LayoutTests/fast/dom/coreDOM-element-attribute-js-null.xhtml 2016-04-12 21:52:08 UTC (rev 199391)
+++ trunk/LayoutTests/fast/dom/coreDOM-element-attribute-js-null.xhtml 2016-04-12 22:38:35 UTC (rev 199392)
@@ -50,7 +50,7 @@
type: 'Attr',
elementToUse: document.createAttributeNS('http://www.w3.org/1999/xhtml','anAttribute'),
attributes: [
- {name: 'value', expectedNull: null}
+ {name: 'value', expectedNull: 'null'}
]
},
{
Modified: trunk/Source/WebCore/ChangeLog (199391 => 199392)
--- trunk/Source/WebCore/ChangeLog 2016-04-12 21:52:08 UTC (rev 199391)
+++ trunk/Source/WebCore/ChangeLog 2016-04-12 22:38:35 UTC (rev 199392)
@@ -1,3 +1,24 @@
+2016-04-12 Chris Dumez <[email protected]>
+
+ Attr.value should not be nullable
+ https://bugs.webkit.org/show_bug.cgi?id=156515
+
+ Reviewed by Benjamin Poulain.
+
+ Update Attr.value so that it is no longer nullable, as per:
+ https://dom.spec.whatwg.org/#interface-attr
+
+ This aligns our behavior with Firefox and Chrome as well.
+
+ Test: fast/dom/Attr/value-not-nullable.html
+
+ * dom/Attr.cpp:
+ (WebCore::Attr::setValueForBindings):
+ (WebCore::Attr::setNodeValue):
+ (WebCore::Attr::setValue):
+ * dom/Attr.h:
+ * dom/Attr.idl:
+
2016-04-12 Konstantin Tokarev <[email protected]>
Fixed uninitialization of Node::DataUnion with GCC 4.8.
Modified: trunk/Source/WebCore/dom/Attr.cpp (199391 => 199392)
--- trunk/Source/WebCore/dom/Attr.cpp 2016-04-12 21:52:08 UTC (rev 199391)
+++ trunk/Source/WebCore/dom/Attr.cpp 2016-04-12 22:38:35 UTC (rev 199392)
@@ -120,7 +120,7 @@
invalidateNodeListAndCollectionCachesInAncestors(&m_name, m_element);
}
-void Attr::setValue(const AtomicString& value, ExceptionCode&)
+void Attr::setValueForBindings(const AtomicString& value)
{
AtomicString oldValue = this->value();
if (m_element)
@@ -132,9 +132,9 @@
m_element->didModifyAttribute(qualifiedName(), oldValue, value);
}
-void Attr::setNodeValue(const String& v, ExceptionCode& ec)
+void Attr::setNodeValue(const String& v, ExceptionCode&)
{
- setValue(v, ec);
+ setValueForBindings(v);
}
Ref<Node> Attr::cloneNodeInternal(Document& targetDocument, CloningOperation)
Modified: trunk/Source/WebCore/dom/Attr.h (199391 => 199392)
--- trunk/Source/WebCore/dom/Attr.h 2016-04-12 21:52:08 UTC (rev 199391)
+++ trunk/Source/WebCore/dom/Attr.h 2016-04-12 22:38:35 UTC (rev 199392)
@@ -51,8 +51,9 @@
Element* ownerElement() const { return m_element; }
const AtomicString& value() const;
- void setValue(const AtomicString&, ExceptionCode&);
void setValue(const AtomicString&);
+ const AtomicString& valueForBindings() const { return value(); }
+ void setValueForBindings(const AtomicString&);
const QualifiedName& qualifiedName() const { return m_name; }
Modified: trunk/Source/WebCore/dom/Attr.idl (199391 => 199392)
--- trunk/Source/WebCore/dom/Attr.idl 2016-04-12 21:52:08 UTC (rev 199391)
+++ trunk/Source/WebCore/dom/Attr.idl 2016-04-12 22:38:35 UTC (rev 199392)
@@ -30,7 +30,7 @@
readonly attribute boolean specified;
- [SetterRaisesException] attribute DOMString? value;
+ [ImplementedAs=valueForBindings] attribute DOMString value;
// DOM Level 2