Settings a reflected DOMString attribute to null should set it to the "null" string...
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 27 Jan 2016 23:42:46 +0000 (23:42 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 27 Jan 2016 23:42:46 +0000 (23:42 +0000)
commit7d1e7fd41e981e4cea8716ec86575249d47bad18
tree1cf6dc1da8ea2b4ad57444588792d04e981bbb04
parentb4d29916e27a3a5489256cc92cd5997ff8023b66
Settings a reflected DOMString attribute to null should set it to the "null" string rather than the empty string
https://bugs.webkit.org/show_bug.cgi?id=153504
<rdar://problem/24353072>

Reviewed by Ryosuke Niwa.

Source/WebCore:

Settings a reflected DOMString attribute to null should set it to the "null"
string rather than the empty string:
- https://html.spec.whatwg.org/#reflecting-content-attributes-in-idl-attributes
- http://heycam.github.io/webidl/#es-DOMString
- http://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring

Firefox and Chrome match the specification here.

This is causing a lot of W3C HTML reflection tests to fail on WebKit, e.g.:
- http://w3c-test.org/html/dom/reflection-text.html

No new tests, already covered by existing tests.

* bindings/scripts/CodeGeneratorJS.pm:
(JSValueToNative):
Call toString() instead of valueToStringWithNullCheck() for reflected
attributes. This way, null gets converted to the string "null", as
expected, instead of a null String object.

* html/HTMLInputElement.idl:
Dropping [TreatNullAs=NullString] IDL extended attribute for
input.defaultValue, as this is not present in the specification:
- https://html.spec.whatwg.org/#htmlinputelement

Without this change, assigning null to input.defaultValue would not
set to to the "null" string, as is expected.

* html/HTMLTextAreaElement.idl:
Dropping [TreatNullAs=NullString] IDL extended attribute for
textArea.defaultValue, as this is not present in the specification:
- https://html.spec.whatwg.org/#htmltextareaelement

Without this change, assigning null to textArea.defaultValue would not
set to to the "null" string, as is expected.

* html/HTMLTitleElement.idl:
Dropping [TreatNullAs=NullString] IDL extended attribute for
title.text, as this is not present in the specification:
- https://html.spec.whatwg.org/#htmltitleelement

Without this change, assigning null to title.text would not
set to to the "null" string, as is expected.

LayoutTests:

Update existing tests as a lot of them were expecting that setting
a reflected DOMString attribute to null would set it to the empty
string instead of the string "null".

* fast/dom/domstring-attribute-reflection-expected.txt:
* fast/dom/domstring-attribute-reflection.html:
* fast/dom/element-attribute-js-null-expected.txt:
* fast/dom/element-attribute-js-null.html:
* fast/dom/ping-attribute-dom-binding-expected.txt:
* fast/dom/ping-attribute-dom-binding.html:
* fast/forms/fieldset/fieldset-name-expected.txt:
* fast/forms/fieldset/fieldset-name.html:
* fast/forms/input-minmax-expected.txt:
* fast/forms/input-minmax.html:
* fast/forms/input-pattern-expected.txt:
* fast/forms/input-pattern.html:
* fast/forms/submit-form-attributes-expected.txt:
* fast/forms/submit-form-attributes.html:
* fast/shadow-dom/HTMLSlotElement-interface.html:
* fast/shadow-dom/NonDocumentTypeChildNode-interface-assignedSlot.html:
* fast/shadow-dom/shadow-layout-after-slot-changes.html:
* svg/dom/svg-element-attribute-js-null-expected.txt:
* svg/dom/svg-element-attribute-js-null.xhtml:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@195700 268f45cc-cd09-0410-ab3c-d52691b4dbfc
25 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/dom/domstring-attribute-reflection-expected.txt
LayoutTests/fast/dom/domstring-attribute-reflection.html
LayoutTests/fast/dom/element-attribute-js-null-expected.txt
LayoutTests/fast/dom/element-attribute-js-null.html
LayoutTests/fast/dom/ping-attribute-dom-binding-expected.txt
LayoutTests/fast/dom/ping-attribute-dom-binding.html
LayoutTests/fast/forms/fieldset/fieldset-name-expected.txt
LayoutTests/fast/forms/fieldset/fieldset-name.html
LayoutTests/fast/forms/input-minmax-expected.txt
LayoutTests/fast/forms/input-minmax.html
LayoutTests/fast/forms/input-pattern-expected.txt
LayoutTests/fast/forms/input-pattern.html
LayoutTests/fast/forms/submit-form-attributes-expected.txt
LayoutTests/fast/forms/submit-form-attributes.html
LayoutTests/fast/shadow-dom/HTMLSlotElement-interface.html
LayoutTests/fast/shadow-dom/NonDocumentTypeChildNode-interface-assignedSlot.html
LayoutTests/fast/shadow-dom/shadow-layout-after-slot-changes.html
LayoutTests/svg/dom/svg-element-attribute-js-null-expected.txt
LayoutTests/svg/dom/svg-element-attribute-js-null.xhtml
Source/WebCore/ChangeLog
Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
Source/WebCore/html/HTMLInputElement.idl
Source/WebCore/html/HTMLTextAreaElement.idl
Source/WebCore/html/HTMLTitleElement.idl