NodeList has issues with Symbol and empty string
authorjoepeck@webkit.org <joepeck@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 29 Apr 2015 23:22:39 +0000 (23:22 +0000)
committerjoepeck@webkit.org <joepeck@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 29 Apr 2015 23:22:39 +0000 (23:22 +0000)
commit944a062164e483986a246aef74f92ab432ac4a54
tree9d7dc801c81987a213bdabb66c829789f943ef9e
parent756dd9e0823da50cb42c39283c1da15f9f23a799
NodeList has issues with Symbol and empty string
https://bugs.webkit.org/show_bug.cgi?id=144310

Reviewed by Darin Adler.

Source/JavaScriptCore:

* runtime/PropertyName.h:
(JSC::PropertyName::isSymbol):
Helper to check if the PropertyName is a string or symbol property.

Source/WebCore:

Tests: fast/dom/StyleSheet/stylesheet-symbol-names.html
       fast/dom/dataset-name-getter-symbols.html
       fast/dom/named-items-with-empty-name.html
       fast/dom/named-items-with-symbol-name.html
       storage/domstorage/localstorage/named-items.html

Test different bindings objects with custom named setter
and getter handlers. Ensure that they handle Symbol properties
gracefully. Often times avoiding the string path.

* dom/StaticNodeList.cpp:
(WebCore::StaticNodeList::namedItem):
(WebCore::StaticElementList::namedItem):
Better handle the empty string. It should not match an item.

* bindings/js/JSDOMBinding.h:
(WebCore::propertyNameToString):
In cases where we would use this, we should have handled
Symbol properties.

(WebCore::propertyNameToAtomicString):
For Symbols, use the unique string. This should result
in no matches for a Symbol property.

* bindings/js/JSDOMStringMapCustom.cpp:
(WebCore::JSDOMStringMap::getOwnPropertySlotDelegate):
(WebCore::JSDOMStringMap::deleteProperty):
(WebCore::JSDOMStringMap::putDelegate):
* bindings/js/JSStorageCustom.cpp:
(WebCore::JSStorage::canGetItemsForName):
(WebCore::JSStorage::nameGetter):
(WebCore::JSStorage::deleteProperty):
(WebCore::JSStorage::putDelegate):
* bindings/js/JSStyleSheetListCustom.cpp:
(WebCore::JSStyleSheetList::canGetItemsForName):
Treat Symbol properties as private properties. They just
go directly through to the Object, and avoid the string
getter/setter property path.

LayoutTests:

* fast/dom/StyleSheet/stylesheet-symbol-names-expected.txt: Added.
* fast/dom/StyleSheet/stylesheet-symbol-names.html: Added.
* fast/dom/dataset-name-getter-symbols-expected.txt: Added.
* fast/dom/dataset-name-getter-symbols.html: Added.
* fast/dom/named-items-with-empty-name-expected.txt: Added.
* fast/dom/named-items-with-empty-name.html: Added.
* fast/dom/named-items-with-symbol-name-expected.txt: Added.
* fast/dom/named-items-with-symbol-name.html: Added.
* storage/domstorage/localstorage/named-items-expected.txt: Added.
* storage/domstorage/localstorage/named-items.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@183589 268f45cc-cd09-0410-ab3c-d52691b4dbfc
19 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/dom/StyleSheet/stylesheet-symbol-names-expected.txt [new file with mode: 0644]
LayoutTests/fast/dom/StyleSheet/stylesheet-symbol-names.html [new file with mode: 0644]
LayoutTests/fast/dom/dataset-name-getter-symbols-expected.txt [new file with mode: 0644]
LayoutTests/fast/dom/dataset-name-getter-symbols.html [new file with mode: 0644]
LayoutTests/fast/dom/named-items-with-empty-name-expected.txt [new file with mode: 0644]
LayoutTests/fast/dom/named-items-with-empty-name.html [new file with mode: 0644]
LayoutTests/fast/dom/named-items-with-symbol-name-expected.txt [new file with mode: 0644]
LayoutTests/fast/dom/named-items-with-symbol-name.html [new file with mode: 0644]
LayoutTests/storage/domstorage/localstorage/named-items-expected.txt [new file with mode: 0644]
LayoutTests/storage/domstorage/localstorage/named-items.html [new file with mode: 0644]
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/runtime/PropertyName.h
Source/WebCore/ChangeLog
Source/WebCore/bindings/js/JSDOMBinding.h
Source/WebCore/bindings/js/JSDOMStringMapCustom.cpp
Source/WebCore/bindings/js/JSStorageCustom.cpp
Source/WebCore/bindings/js/JSStyleSheetListCustom.cpp
Source/WebCore/dom/StaticNodeList.cpp