Title: [154765] trunk
- Revision
- 154765
- Author
- [email protected]
- Date
- 2013-08-28 12:00:01 -0700 (Wed, 28 Aug 2013)
Log Message
REGRESSION(r154586): Past names map should only be used when named item is empty
https://bugs.webkit.org/show_bug.cgi?id=120432
Reviewed by Anders Carlsson.
Source/WebCore:
Don't add the element from the past names map if we've found elements of the given name.
Test: fast/forms/past-names-map-should-be-used-only-when-named-item-is-empty.html
* html/HTMLFormElement.cpp:
(WebCore::HTMLFormElement::getNamedElements):
LayoutTests:
Add a regression test so that we never regress again.
* fast/forms/past-names-map-should-be-used-only-when-named-item-is-empty-expected.txt: Added.
* fast/forms/past-names-map-should-be-used-only-when-named-item-is-empty.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (154764 => 154765)
--- trunk/LayoutTests/ChangeLog 2013-08-28 18:44:20 UTC (rev 154764)
+++ trunk/LayoutTests/ChangeLog 2013-08-28 19:00:01 UTC (rev 154765)
@@ -1,5 +1,17 @@
2013-08-28 Ryosuke Niwa <[email protected]>
+ REGRESSION(r154586): Past names map should only be used when named item is empty
+ https://bugs.webkit.org/show_bug.cgi?id=120432
+
+ Reviewed by Anders Carlsson.
+
+ Add a regression test so that we never regress again.
+
+ * fast/forms/past-names-map-should-be-used-only-when-named-item-is-empty-expected.txt: Added.
+ * fast/forms/past-names-map-should-be-used-only-when-named-item-is-empty.html: Added.
+
+2013-08-28 Ryosuke Niwa <[email protected]>
+
Fix a typo in the test name.
* fast/forms/past-names-map-should-not-contain-disassociated-elements-expected.txt: Copied from LayoutTests/fast/forms/past-names-map-should-not-contained-disassociated-elements-expected.txt.
Added: trunk/LayoutTests/fast/forms/past-names-map-should-be-used-only-when-named-item-is-empty-expected.txt (0 => 154765)
--- trunk/LayoutTests/fast/forms/past-names-map-should-be-used-only-when-named-item-is-empty-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/forms/past-names-map-should-be-used-only-when-named-item-is-empty-expected.txt 2013-08-28 19:00:01 UTC (rev 154765)
@@ -0,0 +1,8 @@
+PASS form['foo'] is form.childNodes[0]
+PASS form['bar'][0] is form.childNodes[1]
+PASS form['bar'][1] is form.childNodes[2]
+PASS form.childNodes[0].name = 'bar'; form.childNodes[1].name = form.childNodes[2].name = 'foo'; form['foo'].length is 2
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/fast/forms/past-names-map-should-be-used-only-when-named-item-is-empty.html (0 => 154765)
--- trunk/LayoutTests/fast/forms/past-names-map-should-be-used-only-when-named-item-is-empty.html (rev 0)
+++ trunk/LayoutTests/fast/forms/past-names-map-should-be-used-only-when-named-item-is-empty.html 2013-08-28 19:00:01 UTC (rev 154765)
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<html>
+<body>
+<form><input type="text" name="foo"><input type="text" name="bar"><input type="text" name="bar"></form>
+<script src=""
+<script>
+
+var form = document.querySelector('form');
+shouldBe("form['foo']", "form.childNodes[0]");
+shouldBe("form['bar'][0]", "form.childNodes[1]");
+shouldBe("form['bar'][1]", "form.childNodes[2]");
+shouldBe("form.childNodes[0].name = 'bar'; form.childNodes[1].name = form.childNodes[2].name = 'foo'; form['foo'].length", "2");
+
+var successfullyParsed = true;
+
+</script>
+<script src=""
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (154764 => 154765)
--- trunk/Source/WebCore/ChangeLog 2013-08-28 18:44:20 UTC (rev 154764)
+++ trunk/Source/WebCore/ChangeLog 2013-08-28 19:00:01 UTC (rev 154765)
@@ -1,3 +1,17 @@
+2013-08-28 Ryosuke Niwa <[email protected]>
+
+ REGRESSION(r154586): Past names map should only be used when named item is empty
+ https://bugs.webkit.org/show_bug.cgi?id=120432
+
+ Reviewed by Anders Carlsson.
+
+ Don't add the element from the past names map if we've found elements of the given name.
+
+ Test: fast/forms/past-names-map-should-be-used-only-when-named-item-is-empty.html
+
+ * html/HTMLFormElement.cpp:
+ (WebCore::HTMLFormElement::getNamedElements):
+
2013-08-27 Ryosuke Niwa <[email protected]>
Don't keep unassociated elements in the past names map
Modified: trunk/Source/WebCore/html/HTMLFormElement.cpp (154764 => 154765)
--- trunk/Source/WebCore/html/HTMLFormElement.cpp 2013-08-28 18:44:20 UTC (rev 154764)
+++ trunk/Source/WebCore/html/HTMLFormElement.cpp 2013-08-28 19:00:01 UTC (rev 154765)
@@ -678,11 +678,10 @@
// http://www.whatwg.org/specs/web-apps/current-work/multipage/forms.html#dom-form-nameditem
elements()->namedItems(name, namedItems);
- // FIXME: The specification says we should not add the element from the past when names map when namedItems is not empty.
HTMLElement* elementFromPast = elementFromPastNamesMap(name);
if (namedItems.size() == 1 && namedItems.first() != elementFromPast)
addToPastNamesMap(toHTMLElement(namedItems.first().get())->asFormNamedItem(), name);
- else if (elementFromPast && namedItems.find(elementFromPast) == notFound)
+ else if (elementFromPast && namedItems.isEmpty())
namedItems.append(elementFromPast);
}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes