Title: [183589] trunk
Revision
183589
Author
[email protected]
Date
2015-04-29 16:22:39 -0700 (Wed, 29 Apr 2015)

Log Message

NodeList has issues with Symbol and empty string
https://bugs.webkit.org/show_bug.cgi?id=144310

Reviewed by Darin Adler.

Source/_javascript_Core:

* 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.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (183588 => 183589)


--- trunk/LayoutTests/ChangeLog	2015-04-29 23:19:00 UTC (rev 183588)
+++ trunk/LayoutTests/ChangeLog	2015-04-29 23:22:39 UTC (rev 183589)
@@ -1,3 +1,21 @@
+2015-04-29  Joseph Pecoraro  <[email protected]>
+
+        NodeList has issues with Symbol and empty string
+        https://bugs.webkit.org/show_bug.cgi?id=144310
+
+        Reviewed by Darin Adler.
+
+        * 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.
+
 2015-04-29  Simon Fraser  <[email protected]>
 
         Allow testing of plug-ins that handle wheel events.

Added: trunk/LayoutTests/fast/dom/StyleSheet/stylesheet-symbol-names-expected.txt (0 => 183589)


--- trunk/LayoutTests/fast/dom/StyleSheet/stylesheet-symbol-names-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/StyleSheet/stylesheet-symbol-names-expected.txt	2015-04-29 23:22:39 UTC (rev 183589)
@@ -0,0 +1,16 @@
+This tests document.styelSheets with Symbol property names.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS document.styleSheets.length is 3
+PASS document.styleSheets[''] is undefined
+PASS document.styleSheets['test'] is styleElement2.sheet
+PASS document.styleSheets[Symbol()] is undefined
+PASS delete document.styleSheets['test'] did not throw exception.
+PASS delete document.styleSheets[Symbol()] did not throw exception.
+PASS document.styleSheets.length is 3
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/fast/dom/StyleSheet/stylesheet-symbol-names.html (0 => 183589)


--- trunk/LayoutTests/fast/dom/StyleSheet/stylesheet-symbol-names.html	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/StyleSheet/stylesheet-symbol-names.html	2015-04-29 23:22:39 UTC (rev 183589)
@@ -0,0 +1,29 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<script>
+description("This tests document.styelSheets with Symbol property names.");
+
+styleElement1 = document.createElement("style");
+styleElement1.setAttribute("id", "");
+document.head.appendChild(styleElement1);
+
+styleElement2 = document.createElement("style");
+styleElement2.setAttribute("id", "test");
+document.head.appendChild(styleElement2);
+
+shouldBe("document.styleSheets.length", "3");
+shouldBe("document.styleSheets['']", "undefined");
+shouldBe("document.styleSheets['test']", "styleElement2.sheet");
+shouldBe("document.styleSheets[Symbol()]", "undefined");
+shouldNotThrow("delete document.styleSheets['test']");
+shouldNotThrow("delete document.styleSheets[Symbol()]");
+shouldBe("document.styleSheets.length", "3");
+
+</script>
+<script src=""
+</body>
+</html>

Added: trunk/LayoutTests/fast/dom/dataset-name-getter-symbols-expected.txt (0 => 183589)


--- trunk/LayoutTests/fast/dom/dataset-name-getter-symbols-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/dataset-name-getter-symbols-expected.txt	2015-04-29 23:22:39 UTC (rev 183589)
@@ -0,0 +1,22 @@
+Test the name getters on DOMStringMap (dataset).
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS document.body.dataset.webkitRocks === 'yes' is true
+PASS Object.keys(document.body.dataset).length === 1 is true
+PASS document.body.dataset[''] = 'test' did not throw exception.
+PASS document.body.dataset[''] === 'test' is true
+PASS document.body.dataset[Symbol()] === undefined is true
+PASS Object.keys(document.body.dataset).length === 2 is true
+PASS document.body.dataset[knownSymbol] === undefined is true
+PASS Object.keys(document.body.dataset).length === 2 is true
+PASS document.body.dataset[knownSymbol] = 'symbol property' did not throw exception.
+PASS document.body.dataset[knownSymbol] === 'symbol property' is true
+PASS delete document.body.dataset[knownSymbol] is true
+PASS document.body.dataset[knownSymbol] === undefined is true
+PASS Object.keys(document.body.dataset).length === 2 is true
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/fast/dom/dataset-name-getter-symbols.html (0 => 183589)


--- trunk/LayoutTests/fast/dom/dataset-name-getter-symbols.html	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/dataset-name-getter-symbols.html	2015-04-29 23:22:39 UTC (rev 183589)
@@ -0,0 +1,30 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src=""
+</head>
+<body data-webkit-rocks=yes>
+<script>
+description('Test the name getters on DOMStringMap (dataset).');
+
+knownSymbol = Symbol();
+
+shouldBeTrue("document.body.dataset.webkitRocks === 'yes'");
+shouldBeTrue("Object.keys(document.body.dataset).length === 1");
+
+shouldNotThrow("document.body.dataset[''] = 'test'");
+shouldBeTrue("document.body.dataset[''] === 'test'");
+shouldBeTrue("document.body.dataset[Symbol()] === undefined");
+shouldBeTrue("Object.keys(document.body.dataset).length === 2");
+
+shouldBeTrue("document.body.dataset[knownSymbol] === undefined");
+shouldBeTrue("Object.keys(document.body.dataset).length === 2");
+shouldNotThrow("document.body.dataset[knownSymbol] = 'symbol property'");
+shouldBeTrue("document.body.dataset[knownSymbol] === 'symbol property'");
+shouldBeTrue("delete document.body.dataset[knownSymbol]");
+shouldBeTrue("document.body.dataset[knownSymbol] === undefined");
+shouldBeTrue("Object.keys(document.body.dataset).length === 2");
+</script>
+<script src=""
+</body>
+</html>

Added: trunk/LayoutTests/fast/dom/named-items-with-empty-name-expected.txt (0 => 183589)


--- trunk/LayoutTests/fast/dom/named-items-with-empty-name-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/named-items-with-empty-name-expected.txt	2015-04-29 23:22:39 UTC (rev 183589)
@@ -0,0 +1,10 @@
+This tests empty strings do not return a value in collections or named items cases.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS document.querySelectorAll('div')[''] === undefined is true
+PASS document.getElementsByTagName('div')[''] === undefined is true
+PASS document.body.children[''] === undefined is true
+PASS document.all[''] === undefined is true
+

Added: trunk/LayoutTests/fast/dom/named-items-with-empty-name.html (0 => 183589)


--- trunk/LayoutTests/fast/dom/named-items-with-empty-name.html	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/named-items-with-empty-name.html	2015-04-29 23:22:39 UTC (rev 183589)
@@ -0,0 +1,20 @@
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<div id=""></div>
+    
+<script>
+description('This tests empty strings do not return a value in collections or named items cases.');
+
+shouldBeTrue("document.querySelectorAll('div')[''] === undefined");
+shouldBeTrue("document.getElementsByTagName('div')[''] === undefined");
+shouldBeTrue("document.body.children[''] === undefined");
+shouldBeTrue("document.all[''] === undefined");
+</script>
+<script src=""
+</body>
+</html>

Added: trunk/LayoutTests/fast/dom/named-items-with-symbol-name-expected.txt (0 => 183589)


--- trunk/LayoutTests/fast/dom/named-items-with-symbol-name-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/named-items-with-symbol-name-expected.txt	2015-04-29 23:22:39 UTC (rev 183589)
@@ -0,0 +1,42 @@
+This tests Symbol property names with a number of named items collections.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+[object NodeList]
+PASS querySelectorAllList.length === 4 is true
+PASS querySelectorAllList[Symbol()] === undefined is true
+PASS querySelectorAllList[Symbol('div')] === undefined is true
+PASS querySelectorAllList['Symbol(div)'] instanceof HTMLDivElement is true
+
+[object NodeList]
+PASS getElementsByTagNameList.length === 4 is true
+PASS getElementsByTagNameList[Symbol()] === undefined is true
+PASS getElementsByTagNameList[Symbol('div')] === undefined is true
+PASS getElementsByTagNameList['Symbol(div)'] instanceof HTMLDivElement is true
+
+[object Window]
+PASS window[Symbol()] === undefined is true
+PASS window[Symbol('div')] === undefined is true
+PASS window['Symbol(div)'] instanceof HTMLDivElement is true
+
+[object HTMLCollection]
+PASS document.images.length === 3 is true
+PASS document.images[Symbol()] === undefined is true
+PASS document.images[Symbol('img')] === undefined is true
+PASS document.images['Symbol(img)'] instanceof HTMLImageElement is true
+
+[object HTMLAllCollection]
+PASS document.all.length > 10 is true
+PASS document.all[Symbol()] === undefined is true
+PASS document.all[Symbol('div')] === undefined is true
+PASS document.all['Symbol(div)'] instanceof HTMLDivElement is true
+
+[object HTMLCollection]
+PASS document.forms[Symbol()] === undefined is true
+
+[object HTMLFormElement]
+PASS document.forms[0][Symbol()] === undefined is true
+PASS document.forms[0][Symbol('input')] === undefined is true
+PASS document.forms[0]['Symbol(input)'] instanceof HTMLInputElement is true
+

Added: trunk/LayoutTests/fast/dom/named-items-with-symbol-name.html (0 => 183589)


--- trunk/LayoutTests/fast/dom/named-items-with-symbol-name.html	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/named-items-with-symbol-name.html	2015-04-29 23:22:39 UTC (rev 183589)
@@ -0,0 +1,59 @@
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+
+<div style="display:none">
+    <div>text1</div><div id='Symbol(div)'>text2</div>
+    <img><img id="img"><img id="Symbol(img)">
+    <form><input><input name="input"><input name="Symbol(input)"></form>
+</div>
+    
+<script>
+description('This tests Symbol property names with a number of named items collections.');
+
+var querySelectorAllList = document.querySelectorAll('div');
+debug(String(querySelectorAllList));
+shouldBeTrue("querySelectorAllList.length === 4");
+shouldBeTrue("querySelectorAllList[Symbol()] === undefined");
+shouldBeTrue("querySelectorAllList[Symbol('div')] === undefined");
+shouldBeTrue("querySelectorAllList['Symbol(div)'] instanceof HTMLDivElement");
+
+var getElementsByTagNameList = document.getElementsByTagName('div');
+debug("\n" + String(getElementsByTagNameList));
+shouldBeTrue("getElementsByTagNameList.length === 4");
+shouldBeTrue("getElementsByTagNameList[Symbol()] === undefined");
+shouldBeTrue("getElementsByTagNameList[Symbol('div')] === undefined");
+shouldBeTrue("getElementsByTagNameList['Symbol(div)'] instanceof HTMLDivElement");
+
+debug("\n" + String(window));
+shouldBeTrue("window[Symbol()] === undefined");
+shouldBeTrue("window[Symbol('div')] === undefined");
+shouldBeTrue("window['Symbol(div)'] instanceof HTMLDivElement");
+
+debug("\n" + String(document.images));
+shouldBeTrue("document.images.length === 3");
+shouldBeTrue("document.images[Symbol()] === undefined");
+shouldBeTrue("document.images[Symbol('img')] === undefined");
+shouldBeTrue("document.images['Symbol(img)'] instanceof HTMLImageElement");
+
+debug("\n" + String(document.all));
+shouldBeTrue("document.all.length > 10");
+shouldBeTrue("document.all[Symbol()] === undefined");
+shouldBeTrue("document.all[Symbol('div')] === undefined");
+shouldBeTrue("document.all['Symbol(div)'] instanceof HTMLDivElement");
+
+debug("\n" + String(document.forms));
+shouldBeTrue("document.forms[Symbol()] === undefined");
+
+debug("\n" + String(document.forms[0]));
+shouldBeTrue("document.forms[0][Symbol()] === undefined");
+shouldBeTrue("document.forms[0][Symbol('input')] === undefined");
+shouldBeTrue("document.forms[0]['Symbol(input)'] instanceof HTMLInputElement");
+</script>
+<script src=""
+</body>
+</html>

Added: trunk/LayoutTests/storage/domstorage/localstorage/named-items-expected.txt (0 => 183589)


--- trunk/LayoutTests/storage/domstorage/localstorage/named-items-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/storage/domstorage/localstorage/named-items-expected.txt	2015-04-29 23:22:39 UTC (rev 183589)
@@ -0,0 +1,28 @@
+Tests storage with named item access and Symbol properties.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS localStorage.length === 0 is true
+PASS localStorage[Symbol()] === undefined is true
+PASS localStorage.length === 0 is true
+PASS localStorage[knownSymbol] === 2 is true
+PASS delete localStorage[knownSymbol] did not throw exception.
+PASS localStorage.length === 0 is true
+PASS localStorage[knownSymbol] === undefined is true
+PASS localStorage.length === 1 is true
+PASS localStorage['Symbol()'] === '3' is true
+PASS localStorage.key(0) === 'Symbol()' is true
+PASS localStorage[''] === undefined is true
+PASS localStorage[''] === '4' is true
+PASS localStorage.length === 2 is true
+PASS delete localStorage['Symbol()'] did not throw exception.
+PASS localStorage.length === 1 is true
+PASS localStorage['Symbol()'] === undefined is true
+PASS delete localStorage[''] did not throw exception.
+PASS localStorage.length === 0 is true
+PASS localStorage[''] === undefined is true
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/storage/domstorage/localstorage/named-items.html (0 => 183589)


--- trunk/LayoutTests/storage/domstorage/localstorage/named-items.html	                        (rev 0)
+++ trunk/LayoutTests/storage/domstorage/localstorage/named-items.html	2015-04-29 23:22:39 UTC (rev 183589)
@@ -0,0 +1,43 @@
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<script>
+description("Tests storage with named item access and Symbol properties.");
+
+knownSymbol = Symbol();
+localStorage.clear();
+
+localStorage[Symbol()] = 1;
+shouldBeTrue("localStorage.length === 0");
+shouldBeTrue("localStorage[Symbol()] === undefined");
+
+localStorage[knownSymbol] = 2;
+shouldBeTrue("localStorage.length === 0");
+shouldBeTrue("localStorage[knownSymbol] === 2"); // number
+shouldNotThrow("delete localStorage[knownSymbol]");
+shouldBeTrue("localStorage.length === 0");
+shouldBeTrue("localStorage[knownSymbol] === undefined");
+
+localStorage["Symbol()"] = 3;
+shouldBeTrue("localStorage.length === 1");
+shouldBeTrue("localStorage['Symbol()'] === '3'"); // string
+shouldBeTrue("localStorage.key(0) === 'Symbol()'");
+
+shouldBeTrue("localStorage[''] === undefined");
+localStorage[''] = 4;
+shouldBeTrue("localStorage[''] === '4'"); // string
+shouldBeTrue("localStorage.length === 2");
+
+shouldNotThrow("delete localStorage['Symbol()']");
+shouldBeTrue("localStorage.length === 1");
+shouldBeTrue("localStorage['Symbol()'] === undefined"); // string
+
+shouldNotThrow("delete localStorage['']");
+shouldBeTrue("localStorage.length === 0");
+shouldBeTrue("localStorage[''] === undefined"); // string
+</script>
+<script src=""
+</body>
+</html>

Modified: trunk/Source/_javascript_Core/ChangeLog (183588 => 183589)


--- trunk/Source/_javascript_Core/ChangeLog	2015-04-29 23:19:00 UTC (rev 183588)
+++ trunk/Source/_javascript_Core/ChangeLog	2015-04-29 23:22:39 UTC (rev 183589)
@@ -1,3 +1,14 @@
+2015-04-29  Joseph Pecoraro  <[email protected]>
+
+        NodeList has issues with Symbol and empty string
+        https://bugs.webkit.org/show_bug.cgi?id=144310
+
+        Reviewed by Darin Adler.
+
+        * runtime/PropertyName.h:
+        (JSC::PropertyName::isSymbol):
+        Helper to check if the PropertyName is a string or symbol property.
+
 2015-04-29  Alex Christensen  <[email protected]>
 
         Fix non-cygwin incremental builds on Windows.

Modified: trunk/Source/_javascript_Core/runtime/PropertyName.h (183588 => 183589)


--- trunk/Source/_javascript_Core/runtime/PropertyName.h	2015-04-29 23:19:00 UTC (rev 183588)
+++ trunk/Source/_javascript_Core/runtime/PropertyName.h	2015-04-29 23:22:39 UTC (rev 183589)
@@ -52,6 +52,11 @@
         ASSERT(m_impl->isSymbol());
     }
 
+    bool isSymbol()
+    {
+        return m_impl && m_impl->isSymbol();
+    }
+
     AtomicStringImpl* uid() const
     {
         return m_impl;

Modified: trunk/Source/WebCore/ChangeLog (183588 => 183589)


--- trunk/Source/WebCore/ChangeLog	2015-04-29 23:19:00 UTC (rev 183588)
+++ trunk/Source/WebCore/ChangeLog	2015-04-29 23:22:39 UTC (rev 183589)
@@ -1,3 +1,49 @@
+2015-04-29  Joseph Pecoraro  <[email protected]>
+
+        NodeList has issues with Symbol and empty string
+        https://bugs.webkit.org/show_bug.cgi?id=144310
+
+        Reviewed by Darin Adler.
+
+        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.
+
 2015-04-29  Eric Carlson  <[email protected]>
 
         [Mac] Register with device picker whenever a page has <video>

Modified: trunk/Source/WebCore/bindings/js/JSDOMBinding.h (183588 => 183589)


--- trunk/Source/WebCore/bindings/js/JSDOMBinding.h	2015-04-29 23:19:00 UTC (rev 183588)
+++ trunk/Source/WebCore/bindings/js/JSDOMBinding.h	2015-04-29 23:22:39 UTC (rev 183589)
@@ -567,12 +567,13 @@
 
 inline String propertyNameToString(JSC::PropertyName propertyName)
 {
-    return propertyName.publicName();
+    ASSERT(!propertyName.isSymbol());
+    return propertyName.uid() ? propertyName.uid() : propertyName.publicName();
 }
 
 inline AtomicString propertyNameToAtomicString(JSC::PropertyName propertyName)
 {
-    return AtomicString(propertyName.publicName());
+    return AtomicString(propertyName.uid() ? propertyName.uid() : propertyName.publicName());
 }
 
 template<typename DOMClass> inline const JSC::HashTableValue* getStaticValueSlotEntryWithoutCaching(JSC::ExecState* exec, JSC::PropertyName propertyName)

Modified: trunk/Source/WebCore/bindings/js/JSDOMStringMapCustom.cpp (183588 => 183589)


--- trunk/Source/WebCore/bindings/js/JSDOMStringMapCustom.cpp	2015-04-29 23:19:00 UTC (rev 183588)
+++ trunk/Source/WebCore/bindings/js/JSDOMStringMapCustom.cpp	2015-04-29 23:22:39 UTC (rev 183589)
@@ -37,6 +37,8 @@
 
 bool JSDOMStringMap::getOwnPropertySlotDelegate(ExecState* exec, PropertyName propertyName, PropertySlot& slot)
 {
+    if (propertyName.isSymbol())
+        return false;
     bool nameIsValid;
     const AtomicString& item = impl().item(propertyNameToString(propertyName), nameIsValid);
     if (nameIsValid) {
@@ -58,9 +60,11 @@
     Base::getOwnPropertyNames(thisObject, exec, propertyNames, mode);
 }
 
-bool JSDOMStringMap::deleteProperty(JSCell* cell, ExecState*, PropertyName propertyName)
+bool JSDOMStringMap::deleteProperty(JSCell* cell, ExecState* exec, PropertyName propertyName)
 {
     JSDOMStringMap* thisObject = jsCast<JSDOMStringMap*>(cell);
+    if (propertyName.isSymbol())
+        return Base::deleteProperty(thisObject, exec, propertyName);
     return thisObject->m_impl->deleteItem(propertyNameToString(propertyName));
 }
 
@@ -71,9 +75,13 @@
 
 bool JSDOMStringMap::putDelegate(ExecState* exec, PropertyName propertyName, JSValue value, PutPropertySlot&)
 {
+    if (propertyName.isSymbol())
+        return false;
+
     String stringValue = value.toString(exec)->value(exec);
     if (exec->hadException())
         return false;
+
     ExceptionCode ec = 0;
     impl().setItem(propertyNameToString(propertyName), stringValue, ec);
     setDOMException(exec, ec);

Modified: trunk/Source/WebCore/bindings/js/JSStorageCustom.cpp (183588 => 183589)


--- trunk/Source/WebCore/bindings/js/JSStorageCustom.cpp	2015-04-29 23:19:00 UTC (rev 183588)
+++ trunk/Source/WebCore/bindings/js/JSStorageCustom.cpp	2015-04-29 23:22:39 UTC (rev 183589)
@@ -37,6 +37,9 @@
 
 bool JSStorage::canGetItemsForName(ExecState* exec, Storage* impl, PropertyName propertyName)
 {
+    if (propertyName.isSymbol())
+        return false;
+
     ExceptionCode ec = 0;
     bool result = impl->contains(propertyNameToString(propertyName), ec);
     setDOMException(exec, ec);
@@ -51,6 +54,9 @@
     if (prototype.isObject() && asObject(prototype)->getPropertySlot(exec, propertyName, slot))
         return JSValue::encode(slot.getValue(exec, propertyName));
 
+    if (propertyName.isSymbol())
+        return false;
+
     ExceptionCode ec = 0;
     JSValue result = jsStringOrNull(exec, thisObject->impl().getItem(propertyNameToString(propertyName), ec));
     setDOMException(exec, ec);
@@ -65,12 +71,15 @@
     // the native property slots manually.
     PropertySlot slot(thisObject);
     if (getStaticValueSlot<JSStorage, Base>(exec, *s_info.staticPropHashTable, thisObject, propertyName, slot))
-        return false;
-        
+        return Base::deleteProperty(thisObject, exec, propertyName);
+
     JSValue prototype = thisObject->prototype();
     if (prototype.isObject() && asObject(prototype)->getPropertySlot(exec, propertyName, slot))
-        return false;
+        return Base::deleteProperty(thisObject, exec, propertyName);
 
+    if (propertyName.isSymbol())
+        return Base::deleteProperty(thisObject, exec, propertyName);
+
     ExceptionCode ec = 0;
     thisObject->m_impl->removeItem(propertyNameToString(propertyName), ec);
     setDOMException(exec, ec);
@@ -113,10 +122,13 @@
     if (prototype.isObject() && asObject(prototype)->getPropertySlot(exec, propertyName, slot))
         return false;
 
+    if (propertyName.isSymbol())
+        return false;
+
     String stringValue = value.toString(exec)->value(exec);
     if (exec->hadException())
         return true;
-    
+
     ExceptionCode ec = 0;
     impl().setItem(propertyNameToString(propertyName), stringValue, ec);
     setDOMException(exec, ec);

Modified: trunk/Source/WebCore/bindings/js/JSStyleSheetListCustom.cpp (183588 => 183589)


--- trunk/Source/WebCore/bindings/js/JSStyleSheetListCustom.cpp	2015-04-29 23:19:00 UTC (rev 183588)
+++ trunk/Source/WebCore/bindings/js/JSStyleSheetListCustom.cpp	2015-04-29 23:22:39 UTC (rev 183589)
@@ -37,6 +37,8 @@
 
 bool JSStyleSheetList::canGetItemsForName(ExecState*, StyleSheetList* styleSheetList, PropertyName propertyName)
 {
+    if (propertyName.isSymbol())
+        return false;
     return styleSheetList->getNamedItem(propertyNameToString(propertyName));
 }
 

Modified: trunk/Source/WebCore/dom/StaticNodeList.cpp (183588 => 183589)


--- trunk/Source/WebCore/dom/StaticNodeList.cpp	2015-04-29 23:19:00 UTC (rev 183588)
+++ trunk/Source/WebCore/dom/StaticNodeList.cpp	2015-04-29 23:22:39 UTC (rev 183589)
@@ -45,6 +45,8 @@
 
 Node* StaticNodeList::namedItem(const AtomicString& elementId) const
 {
+    if (elementId.isEmpty())
+        return nullptr;
     for (unsigned i = 0, length = m_nodes.size(); i < length; ++i) {
         Node& node = const_cast<Node&>(m_nodes[i].get());
         if (is<Element>(node) && downcast<Element>(node).getIdAttribute() == elementId)
@@ -67,6 +69,8 @@
 
 Node* StaticElementList::namedItem(const AtomicString& elementId) const
 {
+    if (elementId.isEmpty())
+        return nullptr;
     for (unsigned i = 0, length = m_elements.size(); i < length; ++i) {
         Element& element = const_cast<Element&>(m_elements[i].get());
         if (element.getIdAttribute() == elementId)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to