Changeset 96893 in webkit
- Timestamp:
- Oct 6, 2011, 7:44:52 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/fast/dom/dataset-expected.txt (modified) (2 diffs)
-
LayoutTests/fast/dom/script-tests/dataset.js (modified) (2 diffs)
-
LayoutTests/platform/chromium/test_expectations.txt (modified) (1 diff)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/bindings/js/JSDOMStringMapCustom.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r96891 r96893 1 2011-10-06 Kent Tamura <tkent@chromium.org> 2 3 [JSC binding] Fix inconsistent behavior of DOMStringMap 4 https://bugs.webkit.org/show_bug.cgi?id=53752 5 6 Reviewed by Darin Adler. 7 8 * fast/dom/dataset-expected.txt: 9 * fast/dom/script-tests/dataset.js: 10 - Change the expectation for a case deleting a property of which name can't be a data-* attribute. 11 This behavior matches to Firefox and Opera. 12 - Add test cases to check put/get/delete priorities. 13 * platform/chromium/test_expectations.txt: 14 V8 binding is not ready for this change. 15 1 16 2011-10-06 Jer Noble <jer.noble@apple.com> 2 17 -
trunk/LayoutTests/fast/dom/dataset-expected.txt
r96166 r96893 40 40 PASS testDelete('data-à', 'à') is true 41 41 42 PASS testDelete('dummy', '-foo') threw exception Error: SYNTAX_ERR: DOM Exception 12.42 PASS testDelete('dummy', '-foo') is false 43 43 44 44 PASS testForIn(['data-foo', 'data-bar', 'data-baz']) is 3 … … 46 46 PASS testForIn(['data-foo', 'data-bar', 'style']) is 2 47 47 PASS testForIn(['data-foo', 'data-bar', 'data-']) is 3 48 49 Property override: 50 PASS Object.prototype.foo = 'on Object'; div.dataset.foo is 'on Object' 51 PASS div.dataset['foo'] = 'on dataset'; div.dataset.foo is 'on dataset' 52 PASS div.hasAttribute('data-foo') is true 53 PASS div.setAttribute('data-foo', 'attr'); div.dataset.foo is 'attr' 54 Update the JavaScript property: 55 PASS div.dataset.foo = 'updated'; div.dataset.foo is 'updated' 56 PASS div.getAttribute('data-foo') is 'updated' 57 PASS div.dataset.Bar = 'on dataset'; div.dataset.Bar is 'on dataset' 58 PASS div.hasAttribute('data-Bar') is false 59 Make the JavaScript property empty: 60 PASS div.dataset.foo = ''; div.dataset.foo is '' 61 PASS div.getAttribute('data-foo') is '' 62 Remove the attribute: 63 PASS div.removeAttribute('data-foo'); div.dataset.foo is 'on Object' 64 Remove the JavaScript property: 65 PASS div.setAttribute('data-foo', 'attr'); delete div.dataset.foo; div.dataset.foo is 'on Object' 66 PASS div.hasAttribute('foo') is false 67 PASS delete div.dataset.Bar; div.dataset.Bar is undefined. 68 48 69 PASS successfullyParsed is true 49 70 -
trunk/LayoutTests/fast/dom/script-tests/dataset.js
r96166 r96893 75 75 debug(""); 76 76 77 should Throw("testDelete('dummy', '-foo')", "'Error: SYNTAX_ERR: DOM Exception 12'");77 shouldBeFalse("testDelete('dummy', '-foo')"); 78 78 debug(""); 79 79 … … 97 97 shouldBe("testForIn(['data-foo', 'data-bar', 'data-'])", "3"); 98 98 99 100 debug(""); 101 debug("Property override:"); 102 var div = document.createElement("div"); 103 // If the Object prorotype already has "foo", dataset doesn't create the 104 // corresponding attribute for "foo". 105 shouldBe("Object.prototype.foo = 'on Object'; div.dataset.foo", "'on Object'"); 106 shouldBe("div.dataset['foo'] = 'on dataset'; div.dataset.foo", "'on dataset'"); 107 shouldBeTrue("div.hasAttribute('data-foo')"); 108 shouldBe("div.setAttribute('data-foo', 'attr'); div.dataset.foo", "'attr'"); 109 debug("Update the JavaScript property:"); 110 shouldBe("div.dataset.foo = 'updated'; div.dataset.foo", "'updated'"); 111 shouldBe("div.getAttribute('data-foo')", "'updated'"); 112 // "Bar" can't be represented as a data- attribute. 113 shouldBe("div.dataset.Bar = 'on dataset'; div.dataset.Bar", "'on dataset'"); 114 shouldBeFalse("div.hasAttribute('data-Bar')"); 115 debug("Make the JavaScript property empty:"); 116 shouldBe("div.dataset.foo = ''; div.dataset.foo", "''"); 117 shouldBe("div.getAttribute('data-foo')", "''"); 118 debug("Remove the attribute:"); 119 shouldBe("div.removeAttribute('data-foo'); div.dataset.foo", "'on Object'"); 120 debug("Remove the JavaScript property:"); 121 shouldBe("div.setAttribute('data-foo', 'attr'); delete div.dataset.foo; div.dataset.foo", "'on Object'"); 122 shouldBeFalse("div.hasAttribute('foo')"); 123 shouldBeUndefined("delete div.dataset.Bar; div.dataset.Bar"); 124 125 debug(""); 99 126 var successfullyParsed = true; -
trunk/LayoutTests/platform/chromium/test_expectations.txt
r96888 r96893 3746 3746 BUGWK68982 : svg/custom/transformed-pattern-clamp-svg-root.svg = IMAGE PASS 3747 3747 3748 // Need to follow a JSC binding change. See webkit.org/b/53752. 3749 BUGWK53578 : fast/dom/dataset.html = TEXT 3750 3748 3751 // Need rebaselines after r96257 3749 3752 BUGWK62092 MAC : editing/pasteboard/paste-xml.xhtml = TEXT -
trunk/Source/WebCore/ChangeLog
r96892 r96893 1 2011-10-06 Kent Tamura <tkent@chromium.org> 2 3 [JSC binding] Fix inconsistent behavior of DOMStringMap 4 https://bugs.webkit.org/show_bug.cgi?id=53752 5 6 Reviewed by Darin Adler. 7 8 The dataset behavior was inconsistent. The get operation handled 9 data-* attributes first, and the put and delete operations handled 10 JavaScript properties first. 11 12 Like Firefox and Opera, the put and delete operations should 13 handle data-* attribute first. 14 15 * bindings/js/JSDOMStringMapCustom.cpp: 16 (WebCore::JSDOMStringMap::deleteProperty): 17 Handles DOMStringMap first, then returns false if the DOMStringMap makes an error. 18 (WebCore::JSDOMStringMap::putDelegate): ditto. 19 1 20 2011-10-06 Nico Weber <thakis@chromium.org> 2 21 -
trunk/Source/WebCore/bindings/js/JSDOMStringMapCustom.cpp
r95901 r96893 60 60 bool JSDOMStringMap::deleteProperty(ExecState* exec, const Identifier& propertyName) 61 61 { 62 // Only perform the custom delete if the object doesn't have a native property by this name. 63 // Since hasProperty() would end up calling canGetItemsForName() and be fooled, we need to check 64 // the native property slots manually. 65 PropertySlot slot; 66 if (getStaticValueSlot<JSDOMStringMap, Base>(exec, s_info.propHashTable(exec), this, propertyName, slot)) 62 AtomicString stringName = identifierToAtomicString(propertyName); 63 if (!m_impl->contains(stringName)) 67 64 return false; 68 69 JSValue prototype = this->prototype();70 if (prototype.isObject() && asObject(prototype)->hasProperty(exec, propertyName))71 return false;72 73 65 ExceptionCode ec = 0; 74 m_impl->deleteItem( identifierToString(propertyName), ec);66 m_impl->deleteItem(stringName, ec); 75 67 setDOMException(exec, ec); 76 77 return true; 68 return !ec; 78 69 } 79 70 80 71 bool JSDOMStringMap::putDelegate(ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot&) 81 72 { 82 // Only perform the custom put if the object doesn't have a native property by this name.83 // Since hasProperty() would end up calling canGetItemsForName() and be fooled, we need to check84 // the native property slots manually.85 PropertySlot slot;86 if (getStaticValueSlot<JSDOMStringMap, Base>(exec, s_info.propHashTable(exec), this, propertyName, slot))87 return false;88 89 JSValue prototype = this->prototype();90 if (prototype.isObject() && asObject(prototype)->hasProperty(exec, propertyName))91 return false;92 93 73 String stringValue = ustringToString(value.toString(exec)); 94 74 if (exec->hadException()) 95 return true; 96 75 return false; 97 76 ExceptionCode ec = 0; 98 77 impl()->setItem(identifierToString(propertyName), stringValue, ec); 99 78 setDOMException(exec, ec); 100 101 return true; 79 return !ec; 102 80 } 103 81
Note:
See TracChangeset
for help on using the changeset viewer.