Changeset 208135 in webkit
- Timestamp:
- Oct 30, 2016 3:36:07 PM (7 years ago)
- Location:
- trunk
- Files:
-
- 1 deleted
- 33 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r208128 r208135 1 2016-10-30 Darin Adler <darin@apple.com> 2 3 Move Element, NamedNodeMap, and DOMStringMap from ExceptionCode to Exception 4 https://bugs.webkit.org/show_bug.cgi?id=164206 5 6 Reviewed by Chris Dumez. 7 8 * fast/dom/resources/shadow-test-driver.js: Deleted. Unused. 9 1 10 2016-10-30 Frederic Wang <fwang@igalia.com> 2 11 -
trunk/Source/WebCore/ChangeLog
r208134 r208135 1 2016-10-30 Darin Adler <darin@apple.com> 2 3 Move Element, NamedNodeMap, and DOMStringMap from ExceptionCode to Exception 4 https://bugs.webkit.org/show_bug.cgi?id=164206 5 6 Reviewed by Chris Dumez. 7 8 * bindings/js/JSDOMStringMapCustom.cpp: 9 (WebCore::JSDOMStringMap::getOwnPropertyNames): Use modern for loop, and 10 updates since the names function now returns a vector. 11 (WebCore::JSDOMStringMap::putDelegate): Use propagateException. Also return 12 true any time an exception is raised. Since true tells the caller to return 13 without doing any work, we always want to return that on an exception. 14 * dom/DatasetDOMStringMap.cpp: 15 (WebCore::DatasetDOMStringMap::names): Renamed from getNames and made this 16 return a Vector instead of populating a passed-in vector. 17 (WebCore::DatasetDOMStringMap::setItem): Use ExceptionOr. 18 * dom/DatasetDOMStringMap.h: Updated for above. 19 20 * dom/Document.cpp: 21 (WebCore::Document::adoptNode): Updated to use ExceptionOr for 22 removeAttributeNode. Changed to use remove rather than removeChild for 23 better clarity. 24 25 * dom/Element.cpp: 26 (WebCore::Element::setAttribute): Use ExceptionOr. 27 (WebCore::Element::createShadowRoot): Deleted. Unused. 28 (WebCore::Element::attachShadow): Use ExceptionOr. 29 (WebCore::Element::shadowRootForBindings): Tweaked a bit. 30 (WebCore::Element::userAgentShadowRoot): Removed unneeded if statemment. 31 (WebCore::Element::ensureUserAgentShadowRoot): Tweaked a bit. 32 (WebCore::Element::setAttributeNode): Use ExceptionOr. 33 (WebCore::Element::setAttributeNodeNS): Ditto. 34 (WebCore::Element::removeAttributeNode): Ditto. 35 (WebCore::Element::parseAttributeName): Ditto. Also changed return result 36 to be a QualifiedName instead of using an out argument. 37 (WebCore::Element::setAttributeNS): Ditto. 38 (WebCore::Element::mergeWithNextTextNode): Ditto. 39 (WebCore::Element::setOuterHTML): Ditto. 40 (WebCore::Element::setInnerHTML): Ditto. 41 (WebCore::Element::matches): Ditto. 42 (WebCore::Element::closest): Ditto. 43 (WebCore::Element::insertAdjacent): Ditto. 44 (WebCore::Element::insertAdjacentElement): Ditto. 45 (WebCore::contextNodeForInsertion): Ditto. 46 (WebCore::contextElementForInsertion): Added. Helper for the 47 insertAdjacentHTML function to eliminate a local variable. 48 (WebCore::Element::insertAdjacentHTML): Use ExceptionOr. 49 (WebCore::Element::insertAdjacentText): Ditto. 50 * dom/Element.h: Updated for above. 51 * dom/Element.idl: Use non-legacy exceptions. 52 53 * dom/NamedNodeMap.cpp: 54 (WebCore::NamedNodeMap::removeNamedItem): Use ExceptionOr. 55 (WebCore::NamedNodeMap::supportedPropertyNames): Updated to check 56 which strings should be removed without copying the strings. 57 (WebCore::NamedNodeMap::removeNamedItemNS): Use ExceptionOr. 58 (WebCore::NamedNodeMap::setNamedItem): Ditto. Removed overload for 59 legacy bindings; move that to the bindings themselves. 60 * dom/NamedNodeMap.h: Updated for above. 61 * dom/NamedNodeMap.idl: Use non-legacy exceptions. 62 63 * html/HTMLElement.cpp: 64 (WebCore::HTMLElement::setOuterText): Updated since mergeWithNextTextNode 65 now uses ExceptionOr. 66 67 * inspector/DOMEditor.cpp: Updated to use ExceptionOr. 68 69 * inspector/InspectorDOMAgent.cpp: 70 (WebCore::InspectorDOMAgent::toErrorString): Added an overload for 71 Exception. 72 (WebCore::InspectorDOMAgent::setAttributesAsText): Updated to use ExceptionOr. 73 * inspector/InspectorDOMAgent.h: Updated for above. 74 75 * inspector/InspectorStyleSheet.cpp: 76 (WebCore::InspectorStyleSheetForInlineStyle::setStyleText): Updated to 77 use the correct version of setAttribute; there was never a risk that there 78 would be an exception, but now that's clearer. 79 80 * testing/Internals.cpp: 81 (WebCore::Internals::ensureShadowRoot): Deleted. Was unused. 82 (WebCore::Internals::createShadowRoot): Ditto. 83 * testing/Internals.idl: Updated for above. 84 85 * xml/parser/XMLDocumentParserLibxml2.cpp: 86 (WebCore::handleNamespaceAttributes): Use updated parseAttributeName, 87 which uses ExceptionOr and a return value instead of an out argument. 88 (WebCore::handleElementAttributes): Ditto. 89 1 90 2016-10-30 Sam Weinig <sam@webkit.org> 2 91 -
trunk/Source/WebCore/bindings/js/JSCSSStyleDeclarationCustom.cpp
r207912 r208135 343 343 if (setPropertyInternalResult.hasException()) { 344 344 propagateException(*state, setPropertyInternalResult.releaseException()); 345 return false;345 return true; 346 346 } 347 347 putResult = setPropertyInternalResult.releaseReturnValue(); -
trunk/Source/WebCore/bindings/js/JSDOMStringMapCustom.cpp
r208083 r208135 38 38 namespace WebCore { 39 39 40 bool JSDOMStringMap::getOwnPropertySlotDelegate(ExecState* exec, PropertyName propertyName, PropertySlot& slot)40 bool JSDOMStringMap::getOwnPropertySlotDelegate(ExecState* state, PropertyName propertyName, PropertySlot& slot) 41 41 { 42 42 if (propertyName.isSymbol()) … … 45 45 const AtomicString& item = wrapped().item(propertyNameToString(propertyName), nameIsValid); 46 46 if (nameIsValid) { 47 slot.setValue(this, 0, toJS<IDLDOMString>(* exec, item));47 slot.setValue(this, 0, toJS<IDLDOMString>(*state, item)); 48 48 return true; 49 49 } … … 51 51 } 52 52 53 void JSDOMStringMap::getOwnPropertyNames(JSObject* object, ExecState* exec, PropertyNameArray& propertyNames, EnumerationMode mode)53 void JSDOMStringMap::getOwnPropertyNames(JSObject* object, ExecState* state, PropertyNameArray& propertyNames, EnumerationMode mode) 54 54 { 55 JSDOMStringMap* thisObject = jsCast<JSDOMStringMap*>(object); 56 Vector<String> names; 57 thisObject->wrapped().getNames(names); 58 size_t length = names.size(); 59 for (size_t i = 0; i < length; ++i) 60 propertyNames.add(Identifier::fromString(exec, names[i])); 61 62 Base::getOwnPropertyNames(thisObject, exec, propertyNames, mode); 55 for (auto& name : jsCast<JSDOMStringMap*>(object)->wrapped().names()) 56 propertyNames.add(Identifier::fromString(state, name)); 57 Base::getOwnPropertyNames(object, state, propertyNames, mode); 63 58 } 64 59 65 bool JSDOMStringMap::deleteProperty(JSCell* cell, ExecState* exec, PropertyName propertyName)60 bool JSDOMStringMap::deleteProperty(JSCell* cell, ExecState* state, PropertyName propertyName) 66 61 { 67 62 #if ENABLE(CUSTOM_ELEMENTS) … … 69 64 #endif 70 65 71 JSDOMStringMap* thisObject = jsCast<JSDOMStringMap*>(cell);72 66 if (propertyName.isSymbol()) 73 return Base::deleteProperty( thisObject, exec, propertyName);74 return thisObject->wrapped().deleteItem(propertyNameToString(propertyName));67 return Base::deleteProperty(cell, state, propertyName); 68 return jsCast<JSDOMStringMap*>(cell)->wrapped().deleteItem(propertyNameToString(propertyName)); 75 69 } 76 70 77 bool JSDOMStringMap::deletePropertyByIndex(JSCell* cell, ExecState* exec, unsigned index)71 bool JSDOMStringMap::deletePropertyByIndex(JSCell* cell, ExecState* state, unsigned index) 78 72 { 79 return deleteProperty(cell, exec, Identifier::from(exec, index));73 return deleteProperty(cell, state, Identifier::from(state, index)); 80 74 } 81 75 82 bool JSDOMStringMap::putDelegate(ExecState* exec, PropertyName propertyName, JSValue value, PutPropertySlot&, bool& putResult)76 bool JSDOMStringMap::putDelegate(ExecState* state, PropertyName propertyName, JSValue value, PutPropertySlot&, bool& putResult) 83 77 { 84 VM& vm = exec->vm();78 VM& vm = state->vm(); 85 79 auto scope = DECLARE_THROW_SCOPE(vm); 86 80 … … 92 86 #endif 93 87 94 String stringValue = value.to String(exec)->value(exec);95 RETURN_IF_EXCEPTION(scope, false);88 String stringValue = value.toWTFString(state); 89 RETURN_IF_EXCEPTION(scope, true); 96 90 97 ExceptionCode ec = 0; 98 wrapped().setItem(propertyNameToString(propertyName), stringValue, ec); 99 setDOMException(exec, ec); 100 putResult = !ec; 101 return !ec; 91 auto result = wrapped().setItem(propertyNameToString(propertyName), WTFMove(stringValue)); 92 if (result.hasException()) { 93 propagateException(*state, scope, result.releaseException()); 94 return true; 95 } 96 97 putResult = true; 98 return true; 102 99 } 103 100 -
trunk/Source/WebCore/bindings/js/JSStorageCustom.cpp
r207522 r208135 112 112 // Since hasProperty() would end up calling canGetItemsForName() and be fooled, we need to check 113 113 // the native property slots manually. 114 PropertySlot slot (this, PropertySlot::InternalMethodType::GetOwnProperty);114 PropertySlot slot { this, PropertySlot::InternalMethodType::GetOwnProperty }; 115 115 116 116 JSValue prototype = this->getPrototypeDirect(); … … 121 121 return false; 122 122 123 String stringValue = value.toString(state)->value(state); 124 if (UNLIKELY(scope.exception())) { 125 // The return value indicates whether putDelegate() should handle the put operation (which 126 // if true, tells the caller not to execute the generic put). It does not indicate whether 127 // putDelegate() did successfully complete the operation or not (which it didn't in this 128 // case due to the exception). 129 putResult = false; 123 String stringValue = value.toWTFString(state); 124 RETURN_IF_EXCEPTION(scope, true); 125 126 auto setItemResult = wrapped().setItem(propertyNameToString(propertyName), stringValue); 127 if (setItemResult.hasException()) { 128 propagateException(*state, scope, setItemResult.releaseException()); 130 129 return true; 131 130 } 132 131 133 auto setItemResult = wrapped().setItem(propertyNameToString(propertyName), stringValue); 134 putResult = !setItemResult.hasException(); 135 propagateException(*state, scope, WTFMove(setItemResult)); 132 putResult = true; 136 133 return true; 137 134 } -
trunk/Source/WebCore/dom/DatasetDOMStringMap.cpp
r164176 r208135 32 32 #include <wtf/text/AtomicString.h> 33 33 #include <wtf/text/StringBuilder.h> 34 #include <wtf/text/WTFString.h>35 34 36 35 namespace WebCore { … … 153 152 } 154 153 155 void DatasetDOMStringMap::getNames(Vector<String>& names) 156 { 157 if (!m_element.hasAttributes()) 158 return; 159 160 for (const Attribute& attribute : m_element.attributesIterator()) { 161 if (isValidAttributeName(attribute.localName())) 162 names.append(convertAttributeNameToPropertyName(attribute.localName())); 163 } 164 } 165 166 const AtomicString& DatasetDOMStringMap::item(const String& propertyName, bool& isValid) 154 Vector<String> DatasetDOMStringMap::names() const 155 { 156 Vector<String> names; 157 158 if (m_element.hasAttributes()) { 159 for (auto& attribute : m_element.attributesIterator()) { 160 if (isValidAttributeName(attribute.localName())) 161 names.append(convertAttributeNameToPropertyName(attribute.localName())); 162 } 163 } 164 165 return names; 166 } 167 168 const AtomicString& DatasetDOMStringMap::item(const String& propertyName, bool& isValid) const 167 169 { 168 170 isValid = false; … … 192 194 } 193 195 194 void DatasetDOMStringMap::setItem(const String& name, const String& value, ExceptionCode& ec) 195 { 196 if (!isValidPropertyName(name)) { 197 ec = SYNTAX_ERR; 198 return; 199 } 200 201 m_element.setAttribute(convertPropertyNameToAttributeName(name), value, ec); 196 ExceptionOr<void> DatasetDOMStringMap::setItem(const String& name, const String& value) 197 { 198 if (!isValidPropertyName(name)) 199 return Exception { SYNTAX_ERR }; 200 return m_element.setAttribute(convertPropertyNameToAttributeName(name), value); 202 201 } 203 202 -
trunk/Source/WebCore/dom/DatasetDOMStringMap.h
r173890 r208135 24 24 */ 25 25 26 #ifndef DatasetDOMStringMap_h 27 #define DatasetDOMStringMap_h 26 #pragma once 28 27 28 #include "ExceptionOr.h" 29 29 #include "ScriptWrappable.h" 30 #include <wtf/Forward.h>31 #include <wtf/Noncopyable.h>32 #include <wtf/Vector.h>33 30 34 31 namespace WebCore { 35 32 36 33 class Element; 37 typedef int ExceptionCode;38 34 39 35 class DatasetDOMStringMap final : public ScriptWrappable { 40 WTF_MAKE_ NONCOPYABLE(DatasetDOMStringMap); WTF_MAKE_FAST_ALLOCATED;36 WTF_MAKE_FAST_ALLOCATED; 41 37 public: 42 38 explicit DatasetDOMStringMap(Element& element) … … 48 44 void deref(); 49 45 50 void getNames(Vector<String>&);51 const AtomicString& item(const String& name, bool& isValid) ;52 void setItem(const String& name, const String& value, ExceptionCode&);46 Vector<String> names() const; 47 const AtomicString& item(const String& name, bool& isValid) const; 48 ExceptionOr<void> setItem(const String& name, const String& value); 53 49 bool deleteItem(const String& name); 54 50 … … 60 56 61 57 } // namespace WebCore 62 63 #endif // DatasetDOMStringMap_h -
trunk/Source/WebCore/dom/Document.cpp
r208112 r208135 1014 1014 ec = NOT_SUPPORTED_ERR; 1015 1015 return nullptr; 1016 case ATTRIBUTE_NODE: { 1016 case ATTRIBUTE_NODE: { 1017 1017 auto& attr = downcast<Attr>(source); 1018 if (attr.ownerElement()) 1019 attr.ownerElement()->removeAttributeNode(attr, ec); 1018 if (auto* element = attr.ownerElement()) { 1019 auto result = element->removeAttributeNode(attr); 1020 if (result.hasException()) { 1021 ec = result.releaseException().code(); 1022 // FIXME: Why fall through here instead of returning early? 1023 } 1024 } 1020 1025 break; 1021 1026 } … … 1033 1038 } 1034 1039 } 1035 if (source.parentNode()) {1036 source.parentNode()->removeChild(source, ec);1037 if (ec)1038 1040 auto result = source.remove(); 1041 if (result.hasException()) { 1042 ec = result.releaseException().code(); 1043 return nullptr; 1039 1044 } 1040 1045 } -
trunk/Source/WebCore/dom/Element.cpp
r208112 r208135 1218 1218 } 1219 1219 1220 void Element::setAttribute(const AtomicString& localName, const AtomicString& value, ExceptionCode& ec) 1221 { 1222 if (!Document::isValidName(localName)) { 1223 ec = INVALID_CHARACTER_ERR; 1224 return; 1225 } 1220 ExceptionOr<void> Element::setAttribute(const AtomicString& localName, const AtomicString& value) 1221 { 1222 if (!Document::isValidName(localName)) 1223 return Exception { INVALID_CHARACTER_ERR }; 1226 1224 1227 1225 synchronizeAttribute(localName); 1228 const AtomicString& caseAdjustedLocalName = shouldIgnoreAttributeCase(*this) ? localName.convertToASCIILowercase() : localName; 1229 1226 auto caseAdjustedLocalName = shouldIgnoreAttributeCase(*this) ? localName.convertToASCIILowercase() : localName; 1230 1227 unsigned index = elementData() ? elementData()->findAttributeIndexByName(caseAdjustedLocalName, false) : ElementData::attributeNotFound; 1231 const QualifiedName& qName = index != ElementData::attributeNotFound ? attributeAt(index).name() : QualifiedName(nullAtom, caseAdjustedLocalName, nullAtom); 1232 setAttributeInternal(index, qName, value, NotInSynchronizationOfLazyAttribute); 1228 auto name = index != ElementData::attributeNotFound ? attributeAt(index).name() : QualifiedName { nullAtom, caseAdjustedLocalName, nullAtom }; 1229 setAttributeInternal(index, name, value, NotInSynchronizationOfLazyAttribute); 1230 1231 return { }; 1233 1232 } 1234 1233 … … 1757 1756 } 1758 1757 1759 1760 1758 void Element::addShadowRoot(Ref<ShadowRoot>&& newShadowRoot) 1761 1759 { 1762 1760 ASSERT(!shadowRoot()); 1763 1761 1764 ShadowRoot& shadowRoot = newShadowRoot .get();1762 ShadowRoot& shadowRoot = newShadowRoot; 1765 1763 ensureElementRareData().setShadowRoot(WTFMove(newShadowRoot)); 1766 1764 … … 1786 1784 if (!oldRoot) 1787 1785 return; 1786 1788 1787 InspectorInstrumentation::willPopShadowRoot(*this, *oldRoot); 1789 1788 document().removeFocusedNodeOfSubtree(oldRoot.get()); … … 1798 1797 notifyChildNodeRemoved(*this, *oldRoot); 1799 1798 } 1800 1801 ShadowRoot* Element::createShadowRoot(ExceptionCode& ec)1802 {1803 if (alwaysCreateUserAgentShadowRoot())1804 return &ensureUserAgentShadowRoot();1805 1806 ec = HIERARCHY_REQUEST_ERR;1807 return nullptr;1808 }1809 1810 1799 1811 1800 static bool canAttachAuthorShadowRoot(const Element& element) … … 1844 1833 } 1845 1834 1846 RefPtr<ShadowRoot> Element::attachShadow(const ShadowRootInit& init, ExceptionCode& ec) 1847 { 1848 if (!canAttachAuthorShadowRoot(*this)) { 1849 ec = NOT_SUPPORTED_ERR; 1850 return nullptr; 1851 } 1852 1853 if (shadowRoot()) { 1854 ec = INVALID_STATE_ERR; 1855 return nullptr; 1856 } 1857 1858 if (init.mode == ShadowRootMode::UserAgent) { 1859 ec = TypeError; 1860 return nullptr; 1861 } 1862 1835 ExceptionOr<Ref<ShadowRoot>> Element::attachShadow(const ShadowRootInit& init) 1836 { 1837 if (!canAttachAuthorShadowRoot(*this)) 1838 return Exception { NOT_SUPPORTED_ERR }; 1839 if (shadowRoot()) 1840 return Exception { INVALID_STATE_ERR }; 1841 if (init.mode == ShadowRootMode::UserAgent) 1842 return Exception { TypeError }; 1863 1843 auto shadow = ShadowRoot::create(document(), init.mode); 1864 1844 addShadowRoot(shadow.copyRef()); … … 1868 1848 ShadowRoot* Element::shadowRootForBindings(JSC::ExecState& state) const 1869 1849 { 1870 ShadowRoot* root= shadowRoot();1871 if (! root)1850 auto* shadow = shadowRoot(); 1851 if (!shadow) 1872 1852 return nullptr; 1873 1874 if (root->mode() != ShadowRootMode::Open) { 1875 if (!JSC::jsCast<JSDOMGlobalObject*>(state.lexicalGlobalObject())->world().shadowRootIsAlwaysOpen()) 1876 return nullptr; 1877 } 1878 return root; 1879 } 1880 1853 if (shadow->mode() == ShadowRootMode::Open) 1854 return shadow; 1855 if (JSC::jsCast<JSDOMGlobalObject*>(state.lexicalGlobalObject())->world().shadowRootIsAlwaysOpen()) 1856 return shadow; 1857 return nullptr; 1858 } 1881 1859 1882 1860 ShadowRoot* Element::userAgentShadowRoot() const 1883 1861 { 1884 if (ShadowRoot* shadowRoot = this->shadowRoot()) { 1885 ASSERT(shadowRoot->mode() == ShadowRootMode::UserAgent); 1886 return shadowRoot; 1887 } 1888 return nullptr; 1862 ASSERT(!shadowRoot() || shadowRoot()->mode() == ShadowRootMode::UserAgent); 1863 return shadowRoot(); 1889 1864 } 1890 1865 1891 1866 ShadowRoot& Element::ensureUserAgentShadowRoot() 1892 1867 { 1893 ShadowRoot* shadowRoot = userAgentShadowRoot(); 1894 if (!shadowRoot) { 1895 addShadowRoot(ShadowRoot::create(document(), ShadowRootMode::UserAgent)); 1896 shadowRoot = userAgentShadowRoot(); 1897 } 1898 return *shadowRoot; 1899 } 1900 1901 1868 if (auto* shadow = userAgentShadowRoot()) 1869 return *shadow; 1870 auto newShadow = ShadowRoot::create(document(), ShadowRootMode::UserAgent); 1871 ShadowRoot& shadow = newShadow; 1872 addShadowRoot(WTFMove(newShadow)); 1873 return shadow; 1874 } 1875 1902 1876 #if ENABLE(CUSTOM_ELEMENTS) 1903 1877 … … 1953 1927 1954 1928 #endif 1955 1956 1929 1957 1930 const AtomicString& Element::shadowPseudoId() const … … 2160 2133 } 2161 2134 2162 RefPtr<Attr> Element::setAttributeNode(Attr& attrNode, ExceptionCode& ec)2135 ExceptionOr<RefPtr<Attr>> Element::setAttributeNode(Attr& attrNode) 2163 2136 { 2164 2137 RefPtr<Attr> oldAttrNode = attrIfExists(attrNode.qualifiedName().localName(), shouldIgnoreAttributeCase(*this)); 2165 2138 if (oldAttrNode.get() == &attrNode) 2166 return &attrNode; // This Attr is already attached to the element.2139 return WTFMove(oldAttrNode); 2167 2140 2168 2141 // INUSE_ATTRIBUTE_ERR: Raised if node is an Attr that is already an attribute of another Element object. 2169 2142 // The DOM user must explicitly clone Attr nodes to re-use them in other elements. 2170 if (attrNode.ownerElement() && attrNode.ownerElement() != this) { 2171 ec = INUSE_ATTRIBUTE_ERR; 2172 return nullptr; 2173 } 2143 if (attrNode.ownerElement() && attrNode.ownerElement() != this) 2144 return Exception { INUSE_ATTRIBUTE_ERR }; 2174 2145 2175 2146 synchronizeAllAttributes(); 2176 UniqueElementData& elementData = ensureUniqueElementData(); 2177 2178 unsigned existingAttributeIndex = elementData.findAttributeIndexByName(attrNode.qualifiedName().localName(), shouldIgnoreAttributeCase(*this)); 2179 if (existingAttributeIndex != ElementData::attributeNotFound) { 2147 auto& elementData = ensureUniqueElementData(); 2148 2149 auto existingAttributeIndex = elementData.findAttributeIndexByName(attrNode.qualifiedName().localName(), shouldIgnoreAttributeCase(*this)); 2150 if (existingAttributeIndex == ElementData::attributeNotFound) 2151 setAttributeInternal(elementData.findAttributeIndexByName(attrNode.qualifiedName()), attrNode.qualifiedName(), attrNode.value(), NotInSynchronizationOfLazyAttribute); 2152 else { 2180 2153 const Attribute& attribute = attributeAt(existingAttributeIndex); 2181 2154 if (oldAttrNode) … … 2188 2161 else { 2189 2162 removeAttributeInternal(existingAttributeIndex, NotInSynchronizationOfLazyAttribute); 2190 unsigned existingAttributeIndexForFullQualifiedName = elementData.findAttributeIndexByName(attrNode.qualifiedName()); 2191 setAttributeInternal(existingAttributeIndexForFullQualifiedName, attrNode.qualifiedName(), attrNode.value(), NotInSynchronizationOfLazyAttribute); 2163 setAttributeInternal(elementData.findAttributeIndexByName(attrNode.qualifiedName()), attrNode.qualifiedName(), attrNode.value(), NotInSynchronizationOfLazyAttribute); 2192 2164 } 2193 } else {2194 unsigned existingAttributeIndexForFullQualifiedName = elementData.findAttributeIndexByName(attrNode.qualifiedName());2195 setAttributeInternal(existingAttributeIndexForFullQualifiedName, attrNode.qualifiedName(), attrNode.value(), NotInSynchronizationOfLazyAttribute);2196 2165 } 2197 2166 if (attrNode.ownerElement() != this) { … … 2200 2169 ensureAttrNodeListForElement(*this).append(&attrNode); 2201 2170 } 2202 return oldAttrNode;2203 } 2204 2205 RefPtr<Attr> Element::setAttributeNodeNS(Attr& attrNode, ExceptionCode& ec)2171 return WTFMove(oldAttrNode); 2172 } 2173 2174 ExceptionOr<RefPtr<Attr>> Element::setAttributeNodeNS(Attr& attrNode) 2206 2175 { 2207 2176 RefPtr<Attr> oldAttrNode = attrIfExists(attrNode.qualifiedName()); 2208 2177 if (oldAttrNode.get() == &attrNode) 2209 return &attrNode; // This Attr is already attached to the element.2178 return WTFMove(oldAttrNode); 2210 2179 2211 2180 // INUSE_ATTRIBUTE_ERR: Raised if node is an Attr that is already an attribute of another Element object. 2212 2181 // The DOM user must explicitly clone Attr nodes to re-use them in other elements. 2213 if (attrNode.ownerElement() && attrNode.ownerElement() != this) { 2214 ec = INUSE_ATTRIBUTE_ERR; 2215 return nullptr; 2216 } 2182 if (attrNode.ownerElement() && attrNode.ownerElement() != this) 2183 return Exception { INUSE_ATTRIBUTE_ERR }; 2217 2184 2218 2185 synchronizeAllAttributes(); 2219 UniqueElementData& elementData = ensureUniqueElementData();2220 2221 unsignedindex = elementData.findAttributeIndexByName(attrNode.qualifiedName());2186 auto& elementData = ensureUniqueElementData(); 2187 2188 auto index = elementData.findAttributeIndexByName(attrNode.qualifiedName()); 2222 2189 if (index != ElementData::attributeNotFound) { 2223 2190 if (oldAttrNode) … … 2233 2200 ensureAttrNodeListForElement(*this).append(&attrNode); 2234 2201 2235 return oldAttrNode; 2236 } 2237 2238 RefPtr<Attr> Element::removeAttributeNode(Attr& attr, ExceptionCode& ec) 2239 { 2240 if (attr.ownerElement() != this) { 2241 ec = NOT_FOUND_ERR; 2242 return nullptr; 2243 } 2202 return WTFMove(oldAttrNode); 2203 } 2204 2205 ExceptionOr<Ref<Attr>> Element::removeAttributeNode(Attr& attr) 2206 { 2207 if (attr.ownerElement() != this) 2208 return Exception { NOT_FOUND_ERR }; 2244 2209 2245 2210 ASSERT(&document() == &attr.document()); … … 2247 2212 synchronizeAllAttributes(); 2248 2213 2249 if (!m_elementData) { 2250 ec = NOT_FOUND_ERR; 2251 return nullptr; 2252 } 2253 2254 unsigned existingAttributeIndex = m_elementData->findAttributeIndexByName(attr.qualifiedName()); 2255 2256 if (existingAttributeIndex == ElementData::attributeNotFound) { 2257 ec = NOT_FOUND_ERR; 2258 return nullptr; 2259 } 2260 2261 RefPtr<Attr> attrNode = &attr; 2214 if (!m_elementData) 2215 return Exception { NOT_FOUND_ERR }; 2216 2217 auto existingAttributeIndex = m_elementData->findAttributeIndexByName(attr.qualifiedName()); 2218 if (existingAttributeIndex == ElementData::attributeNotFound) 2219 return Exception { NOT_FOUND_ERR }; 2220 2221 Ref<Attr> oldAttrNode { attr }; 2222 2262 2223 detachAttrNodeFromElementWithValue(&attr, m_elementData->attributeAt(existingAttributeIndex).value()); 2263 2224 removeAttributeInternal(existingAttributeIndex, NotInSynchronizationOfLazyAttribute); 2264 return attrNode; 2265 } 2266 2267 bool Element::parseAttributeName(QualifiedName& out, const AtomicString& namespaceURI, const AtomicString& qualifiedName, ExceptionCode& ec) 2268 { 2225 2226 return WTFMove(oldAttrNode); 2227 } 2228 2229 ExceptionOr<QualifiedName> Element::parseAttributeName(const AtomicString& namespaceURI, const AtomicString& qualifiedName) 2230 { 2231 ExceptionCode ec = 0; 2269 2232 String prefix, localName; 2270 2233 if (!Document::parseQualifiedName(qualifiedName, prefix, localName, ec)) 2271 return false;2234 return Exception { ec }; 2272 2235 ASSERT(!ec); 2273 2236 2274 QualifiedName qName(prefix, localName, namespaceURI); 2275 2276 if (!Document::hasValidNamespaceForAttributes(qName)) { 2277 ec = NAMESPACE_ERR; 2278 return false; 2279 } 2280 2281 out = qName; 2282 return true; 2283 } 2284 2285 void Element::setAttributeNS(const AtomicString& namespaceURI, const AtomicString& qualifiedName, const AtomicString& value, ExceptionCode& ec) 2286 { 2287 QualifiedName parsedName = anyName; 2288 if (!parseAttributeName(parsedName, namespaceURI, qualifiedName, ec)) 2289 return; 2290 setAttribute(parsedName, value); 2237 QualifiedName result { prefix, localName, namespaceURI }; 2238 2239 if (!Document::hasValidNamespaceForAttributes(result)) 2240 return Exception { NAMESPACE_ERR }; 2241 2242 return WTFMove(result); 2243 } 2244 2245 ExceptionOr<void> Element::setAttributeNS(const AtomicString& namespaceURI, const AtomicString& qualifiedName, const AtomicString& value) 2246 { 2247 auto result = parseAttributeName(namespaceURI, qualifiedName); 2248 if (result.hasException()) 2249 return result.releaseException(); 2250 setAttribute(result.releaseReturnValue(), value); 2251 return { }; 2291 2252 } 2292 2253 … … 2556 2517 } 2557 2518 2558 void Element::mergeWithNextTextNode(Text& node, ExceptionCode& ec)2519 ExceptionOr<void> Element::mergeWithNextTextNode(Text& node) 2559 2520 { 2560 2521 auto* next = node.nextSibling(); 2561 2522 if (!is<Text>(next)) 2562 return ;2523 return { }; 2563 2524 Ref<Text> textNext { downcast<Text>(*next) }; 2564 2565 2525 node.appendData(textNext->data()); 2566 auto result = textNext->remove(); 2567 if (result.hasException()) 2568 ec = result.releaseException().code(); 2526 return textNext->remove(); 2569 2527 } 2570 2528 … … 2579 2537 } 2580 2538 2581 void Element::setOuterHTML(const String& html, ExceptionCode& ec) 2582 { 2583 Element* p = parentElement(); 2584 if (!is<HTMLElement>(p)) { 2585 ec = NO_MODIFICATION_ALLOWED_ERR; 2586 return; 2587 } 2588 RefPtr<HTMLElement> parent = downcast<HTMLElement>(p); 2539 ExceptionOr<void> Element::setOuterHTML(const String& html) 2540 { 2541 auto* parentElement = this->parentElement(); 2542 if (!is<HTMLElement>(parentElement)) 2543 return Exception { NO_MODIFICATION_ALLOWED_ERR }; 2544 2545 Ref<HTMLElement> parent = downcast<HTMLElement>(*parentElement); 2589 2546 RefPtr<Node> prev = previousSibling(); 2590 2547 RefPtr<Node> next = nextSibling(); 2591 2548 2592 auto fragment = createFragmentForInnerOuterHTML(*parent, html, AllowScriptingContent); 2593 if (fragment.hasException()) { 2594 ec = fragment.releaseException().code(); 2595 return; 2596 } 2597 2549 auto fragment = createFragmentForInnerOuterHTML(parent, html, AllowScriptingContent); 2550 if (fragment.hasException()) 2551 return fragment.releaseException(); 2552 2553 ExceptionCode ec = 0; 2598 2554 parent->replaceChild(fragment.releaseReturnValue().get(), *this, ec); 2555 if (ec) 2556 return Exception { ec }; 2557 2599 2558 RefPtr<Node> node = next ? next->previousSibling() : nullptr; 2600 if (!ec && is<Text>(node.get())) 2601 mergeWithNextTextNode(downcast<Text>(*node), ec); 2602 if (!ec && is<Text>(prev.get())) 2603 mergeWithNextTextNode(downcast<Text>(*prev), ec); 2604 } 2605 2606 2607 void Element::setInnerHTML(const String& html, ExceptionCode& ec) 2559 if (is<Text>(node.get())) { 2560 auto result = mergeWithNextTextNode(downcast<Text>(*node)); 2561 if (result.hasException()) 2562 return result.releaseException(); 2563 } 2564 if (is<Text>(prev.get())) { 2565 auto result = mergeWithNextTextNode(downcast<Text>(*prev)); 2566 if (result.hasException()) 2567 return result.releaseException(); 2568 } 2569 return { }; 2570 } 2571 2572 2573 ExceptionOr<void> Element::setInnerHTML(const String& html) 2608 2574 { 2609 2575 auto fragment = createFragmentForInnerOuterHTML(*this, html, AllowScriptingContent); 2610 if (fragment.hasException()) { 2611 ec = fragment.releaseException().code(); 2612 return; 2613 } 2576 if (fragment.hasException()) 2577 return fragment.releaseException(); 2614 2578 2615 2579 ContainerNode* container; … … 2619 2583 container = &downcast<HTMLTemplateElement>(*this).content(); 2620 2584 2621 auto result = replaceChildrenWithFragment(*container, fragment.releaseReturnValue()); 2622 if (result.hasException()) 2623 ec = fragment.releaseException().code(); 2585 return replaceChildrenWithFragment(*container, fragment.releaseReturnValue()); 2624 2586 } 2625 2587 … … 2994 2956 } 2995 2957 2996 bool Element::matches(const String& selector, ExceptionCode& ec) 2997 { 2998 SelectorQuery* selectorQuery = document().selectorQueryForString(selector, ec); 2999 return selectorQuery && selectorQuery->matches(*this); 3000 } 3001 3002 Element* Element::closest(const String& selector, ExceptionCode& ec) 3003 { 3004 SelectorQuery* selectorQuery = document().selectorQueryForString(selector, ec); 3005 if (selectorQuery) 3006 return selectorQuery->closest(*this); 3007 return nullptr; 2958 ExceptionOr<bool> Element::matches(const String& selector) 2959 { 2960 ExceptionCode ec = 0; 2961 auto* query = document().selectorQueryForString(selector, ec); 2962 if (ec) 2963 return Exception { ec }; 2964 return query && query->matches(*this); 2965 } 2966 2967 ExceptionOr<Element*> Element::closest(const String& selector) 2968 { 2969 ExceptionCode ec = 0; 2970 auto* query = document().selectorQueryForString(selector, ec); 2971 if (ec) 2972 return Exception { ec }; 2973 if (!query) 2974 return nullptr; 2975 return query->closest(*this); 3008 2976 } 3009 2977 … … 3080 3048 3081 3049 #if ENABLE(INDIE_UI) 3050 3082 3051 void Element::setUIActions(const AtomicString& actions) 3083 3052 { … … 3089 3058 return getAttribute(uiactionsAttr); 3090 3059 } 3060 3091 3061 #endif 3092 3062 … … 3684 3654 } 3685 3655 3686 Node* Element::insertAdjacent(const String& where, Ref<Node>&& newChild, ExceptionCode& ec)3656 ExceptionOr<Node*> Element::insertAdjacent(const String& where, Ref<Node>&& newChild) 3687 3657 { 3688 3658 // In Internet Explorer if the element has no parent and where is "beforeBegin" or "afterEnd", … … 3694 3664 3695 3665 if (equalLettersIgnoringASCIICase(where, "beforebegin")) { 3696 ContainerNode* parent = this->parentNode(); 3697 return (parent && parent->insertBefore(newChild, this, ec)) ? newChild.ptr() : nullptr; 3698 } 3699 3700 if (equalLettersIgnoringASCIICase(where, "afterbegin")) 3701 return insertBefore(newChild, firstChild(), ec) ? newChild.ptr() : nullptr; 3702 3703 if (equalLettersIgnoringASCIICase(where, "beforeend")) 3704 return appendChild(newChild, ec) ? newChild.ptr() : nullptr; 3666 auto* parent = this->parentNode(); 3667 if (!parent) 3668 return nullptr; 3669 ExceptionCode ec = 0; 3670 bool success = parent->insertBefore(newChild, this, ec); 3671 if (ec) 3672 return Exception { ec }; 3673 return success ? newChild.ptr() : nullptr; 3674 } 3675 3676 if (equalLettersIgnoringASCIICase(where, "afterbegin")) { 3677 ExceptionCode ec = 0; 3678 bool success = insertBefore(newChild, firstChild(), ec); 3679 if (ec) 3680 return Exception { ec }; 3681 return success ? newChild.ptr() : nullptr; 3682 } 3683 3684 if (equalLettersIgnoringASCIICase(where, "beforeend")) { 3685 ExceptionCode ec = 0; 3686 bool success = appendChild(newChild, ec); 3687 if (ec) 3688 return Exception { ec }; 3689 return success ? newChild.ptr() : nullptr; 3690 } 3705 3691 3706 3692 if (equalLettersIgnoringASCIICase(where, "afterend")) { 3707 ContainerNode* parent = this->parentNode(); 3708 return (parent && parent->insertBefore(newChild, nextSibling(), ec)) ? newChild.ptr() : nullptr; 3709 } 3710 3711 ec = SYNTAX_ERR; 3712 return nullptr; 3713 } 3714 3715 Element* Element::insertAdjacentElement(const String& where, Element& newChild, ExceptionCode& ec) 3716 { 3717 Node* returnValue = insertAdjacent(where, newChild, ec); 3718 ASSERT_WITH_SECURITY_IMPLICATION(!returnValue || is<Element>(*returnValue)); 3719 return downcast<Element>(returnValue); 3693 auto* parent = this->parentNode(); 3694 if (!parent) 3695 return nullptr; 3696 ExceptionCode ec = 0; 3697 bool success = parent->insertBefore(newChild, nextSibling(), ec); 3698 if (ec) 3699 return Exception { ec }; 3700 return success ? newChild.ptr() : nullptr; 3701 } 3702 3703 return Exception { SYNTAX_ERR }; 3704 } 3705 3706 ExceptionOr<Element*> Element::insertAdjacentElement(const String& where, Element& newChild) 3707 { 3708 auto result = insertAdjacent(where, newChild); 3709 if (result.hasException()) 3710 return result.releaseException(); 3711 return downcast<Element>(result.releaseReturnValue()); 3720 3712 } 3721 3713 3722 3714 // Step 1 of https://w3c.github.io/DOM-Parsing/#dom-element-insertadjacenthtml. 3723 static ContainerNode* contextNodeForInsertion(const String& where, Element* element, ExceptionCode& ec)3715 static ExceptionOr<ContainerNode*> contextNodeForInsertion(const String& where, Element& element) 3724 3716 { 3725 3717 if (equalLettersIgnoringASCIICase(where, "beforebegin") || equalLettersIgnoringASCIICase(where, "afterend")) { 3726 auto* parent = element->parentNode(); 3727 if (!parent || is<Document>(*parent)) { 3728 ec = NO_MODIFICATION_ALLOWED_ERR; 3729 return nullptr; 3730 } 3718 auto* parent = element.parentNode(); 3719 if (!parent || is<Document>(*parent)) 3720 return Exception { NO_MODIFICATION_ALLOWED_ERR }; 3731 3721 return parent; 3732 3722 } 3733 3723 if (equalLettersIgnoringASCIICase(where, "afterbegin") || equalLettersIgnoringASCIICase(where, "beforeend")) 3734 return element; 3735 ec = SYNTAX_ERR; 3736 return nullptr; 3724 return &element; 3725 return Exception { SYNTAX_ERR }; 3726 } 3727 3728 // Step 2 of https://w3c.github.io/DOM-Parsing/#dom-element-insertadjacenthtml. 3729 static ExceptionOr<Ref<Element>> contextElementForInsertion(const String& where, Element& element) 3730 { 3731 auto contextNodeResult = contextNodeForInsertion(where, element); 3732 if (contextNodeResult.hasException()) 3733 return contextNodeResult.releaseException(); 3734 auto& contextNode = *contextNodeResult.releaseReturnValue(); 3735 if (!is<Element>(contextNode) || (contextNode.document().isHTMLDocument() && is<HTMLHtmlElement>(contextNode))) 3736 return Ref<Element> { HTMLBodyElement::create(contextNode.document()) }; 3737 return Ref<Element> { downcast<Element>(contextNode) }; 3737 3738 } 3738 3739 3739 3740 // https://w3c.github.io/DOM-Parsing/#dom-element-insertadjacenthtml 3740 void Element::insertAdjacentHTML(const String& where, const String& markup, ExceptionCode& ec) 3741 { 3742 // Step 1. 3743 auto* contextNode = contextNodeForInsertion(where, this, ec); 3744 if (!contextNode) 3745 return; 3746 RefPtr<Element> contextElement; 3747 // Step 2. 3748 if (!is<Element>(*contextNode) 3749 || (contextNode->document().isHTMLDocument() && is<HTMLHtmlElement>(*contextNode))) { 3750 contextElement = HTMLBodyElement::create(contextNode->document()); 3751 } else 3752 contextElement = downcast<Element>(contextNode); 3741 ExceptionOr<void> Element::insertAdjacentHTML(const String& where, const String& markup) 3742 { 3743 // Steps 1 and 2. 3744 auto contextElement = contextElementForInsertion(where, *this); 3745 if (contextElement.hasException()) 3746 return contextElement.releaseException(); 3753 3747 // Step 3. 3754 auto fragment = createFragmentForInnerOuterHTML(*contextElement, markup, AllowScriptingContent); 3755 if (fragment.hasException()) { 3756 ec = fragment.releaseException().code(); 3757 return; 3758 } 3748 auto fragment = createFragmentForInnerOuterHTML(contextElement.releaseReturnValue(), markup, AllowScriptingContent); 3749 if (fragment.hasException()) 3750 return fragment.releaseException(); 3759 3751 // Step 4. 3760 insertAdjacent(where, fragment.releaseReturnValue(), ec); 3761 } 3762 3763 void Element::insertAdjacentText(const String& where, const String& text, ExceptionCode& ec) 3764 { 3765 insertAdjacent(where, document().createTextNode(text), ec); 3752 auto result = insertAdjacent(where, fragment.releaseReturnValue()); 3753 if (result.hasException()) 3754 return result.releaseException(); 3755 return { }; 3756 } 3757 3758 ExceptionOr<void> Element::insertAdjacentText(const String& where, const String& text) 3759 { 3760 auto result = insertAdjacent(where, document().createTextNode(text)); 3761 if (result.hasException()) 3762 return result.releaseException(); 3763 return { }; 3766 3764 } 3767 3765 -
trunk/Source/WebCore/dom/Element.h
r208001 r208135 23 23 */ 24 24 25 #ifndef Element_h 26 #define Element_h 25 #pragma once 27 26 28 27 #include "AXTextStateChangeIntent.h" … … 113 112 WEBCORE_EXPORT const AtomicString& getAttributeNS(const AtomicString& namespaceURI, const AtomicString& localName) const; 114 113 115 WEBCORE_EXPORT void setAttribute(const AtomicString& name, const AtomicString& value, ExceptionCode&);116 static bool parseAttributeName(QualifiedName&, const AtomicString& namespaceURI, const AtomicString& qualifiedName, ExceptionCode&);117 WEBCORE_EXPORT void setAttributeNS(const AtomicString& namespaceURI, const AtomicString& qualifiedName, const AtomicString& value, ExceptionCode&);114 WEBCORE_EXPORT ExceptionOr<void> setAttribute(const AtomicString& name, const AtomicString& value); 115 static ExceptionOr<QualifiedName> parseAttributeName(const AtomicString& namespaceURI, const AtomicString& qualifiedName); 116 WEBCORE_EXPORT ExceptionOr<void> setAttributeNS(const AtomicString& namespaceURI, const AtomicString& qualifiedName, const AtomicString& value); 118 117 119 118 const AtomicString& getIdAttribute() const; … … 191 190 WEBCORE_EXPORT RefPtr<Attr> getAttributeNode(const AtomicString& name); 192 191 WEBCORE_EXPORT RefPtr<Attr> getAttributeNodeNS(const AtomicString& namespaceURI, const AtomicString& localName); 193 WEBCORE_EXPORT RefPtr<Attr> setAttributeNode(Attr&, ExceptionCode&);194 WEBCORE_EXPORT RefPtr<Attr> setAttributeNodeNS(Attr&, ExceptionCode&);195 WEBCORE_EXPORT RefPtr<Attr> removeAttributeNode(Attr&, ExceptionCode&);192 WEBCORE_EXPORT ExceptionOr<RefPtr<Attr>> setAttributeNode(Attr&); 193 WEBCORE_EXPORT ExceptionOr<RefPtr<Attr>> setAttributeNodeNS(Attr&); 194 WEBCORE_EXPORT ExceptionOr<Ref<Attr>> removeAttributeNode(Attr&); 196 195 197 196 RefPtr<Attr> attrIfExists(const QualifiedName&); … … 270 269 271 270 WEBCORE_EXPORT ShadowRoot* shadowRoot() const; 272 WEBCORE_EXPORT ShadowRoot* createShadowRoot(ExceptionCode&);271 ShadowRoot* shadowRootForBindings(JSC::ExecState&) const; 273 272 274 273 struct ShadowRootInit { 275 274 ShadowRootMode mode; 276 275 }; 277 278 ShadowRoot* shadowRootForBindings(JSC::ExecState&) const; 279 RefPtr<ShadowRoot> attachShadow(const ShadowRootInit&, ExceptionCode&); 276 ExceptionOr<Ref<ShadowRoot>> attachShadow(const ShadowRootInit&); 280 277 281 278 ShadowRoot* userAgentShadowRoot() const; … … 316 313 virtual Element* focusDelegate(); 317 314 318 WEBCORE_EXPORT E lement* insertAdjacentElement(const String& where, Element& newChild, ExceptionCode&);319 WEBCORE_EXPORT void insertAdjacentHTML(const String& where, const String& html, ExceptionCode&);320 WEBCORE_EXPORT void insertAdjacentText(const String& where, const String& text, ExceptionCode&);315 WEBCORE_EXPORT ExceptionOr<Element*> insertAdjacentElement(const String& where, Element& newChild); 316 WEBCORE_EXPORT ExceptionOr<void> insertAdjacentHTML(const String& where, const String& html); 317 WEBCORE_EXPORT ExceptionOr<void> insertAdjacentText(const String& where, const String& text); 321 318 322 319 bool ieForbidsInsertHTML() const; … … 381 378 WEBCORE_EXPORT String innerHTML() const; 382 379 WEBCORE_EXPORT String outerHTML() const; 383 WEBCORE_EXPORT void setInnerHTML(const String&, ExceptionCode&);384 WEBCORE_EXPORT void setOuterHTML(const String&, ExceptionCode&);380 WEBCORE_EXPORT ExceptionOr<void> setInnerHTML(const String&); 381 WEBCORE_EXPORT ExceptionOr<void> setOuterHTML(const String&); 385 382 WEBCORE_EXPORT String innerText(); 386 383 WEBCORE_EXPORT String outerText(); … … 430 427 virtual bool matchesIndeterminatePseudoClass() const; 431 428 virtual bool matchesDefaultPseudoClass() const; 432 WEBCORE_EXPORT bool matches(const String& selectors, ExceptionCode&);433 WEBCORE_EXPORT E lement* closest(const String& selectors, ExceptionCode&);429 WEBCORE_EXPORT ExceptionOr<bool> matches(const String& selectors); 430 WEBCORE_EXPORT ExceptionOr<Element*> closest(const String& selectors); 434 431 virtual bool shouldAppearIndeterminate() const; 435 432 … … 602 599 void addShadowRoot(Ref<ShadowRoot>&&); 603 600 604 static void mergeWithNextTextNode(Text& node, ExceptionCode&);601 static ExceptionOr<void> mergeWithNextTextNode(Text&); 605 602 606 603 private: … … 640 637 void updateLabel(TreeScope&, const AtomicString& oldForAttributeValue, const AtomicString& newForAttributeValue); 641 638 642 Node* insertAdjacent(const String& where, Ref<Node>&& newChild, ExceptionCode&);639 ExceptionOr<Node*> insertAdjacent(const String& where, Ref<Node>&& newChild); 643 640 644 641 void scrollByUnits(int units, ScrollGranularity); … … 839 836 static bool isType(const WebCore::Node& node) { return node.isElementNode(); } 840 837 SPECIALIZE_TYPE_TRAITS_END() 841 842 #endif -
trunk/Source/WebCore/dom/Element.idl
r208082 r208135 29 29 DOMString? getAttribute(DOMString name); 30 30 31 [CEReactions, MayThrow LegacyException] void setAttribute(DOMString name, DOMString value);31 [CEReactions, MayThrowException] void setAttribute(DOMString name, DOMString value); 32 32 33 33 [CEReactions] void removeAttribute(DOMString name); 34 34 Attr? getAttributeNode(DOMString name); 35 35 36 [CEReactions, MayThrow LegacyException] Attr? setAttributeNode(Attr newAttr);37 [CEReactions, MayThrow LegacyException] Attr removeAttributeNode(Attr oldAttr);36 [CEReactions, MayThrowException] Attr? setAttributeNode(Attr newAttr); 37 [CEReactions, MayThrowException] Attr removeAttributeNode(Attr oldAttr); 38 38 39 39 HTMLCollection getElementsByTagName(DOMString name); … … 44 44 DOMString? getAttributeNS(DOMString? namespaceURI, DOMString localName); 45 45 46 [CEReactions, MayThrow LegacyException] void setAttributeNS(DOMString? namespaceURI, DOMString qualifiedName, DOMString value);46 [CEReactions, MayThrowException] void setAttributeNS(DOMString? namespaceURI, DOMString qualifiedName, DOMString value); 47 47 [CEReactions] void removeAttributeNS(DOMString? namespaceURI, DOMString localName); 48 48 … … 50 50 51 51 Attr? getAttributeNodeNS(DOMString? namespaceURI, DOMString localName); 52 [CEReactions, MayThrow LegacyException] Attr? setAttributeNodeNS(Attr newAttr);52 [CEReactions, MayThrowException] Attr? setAttributeNodeNS(Attr newAttr); 53 53 boolean hasAttribute(DOMString name); 54 54 … … 98 98 99 99 HTMLCollection getElementsByClassName(DOMString name); 100 [CEReactions, TreatNullAs=EmptyString, SetterMayThrow LegacyException] attribute DOMString innerHTML;101 [CEReactions, TreatNullAs=EmptyString, SetterMayThrow LegacyException] attribute DOMString outerHTML;100 [CEReactions, TreatNullAs=EmptyString, SetterMayThrowException] attribute DOMString innerHTML; 101 [CEReactions, TreatNullAs=EmptyString, SetterMayThrowException] attribute DOMString outerHTML; 102 102 103 103 [CEReactions, Reflect=class] attribute DOMString className; 104 104 [PutForwards=value] readonly attribute DOMTokenList classList; 105 105 106 [MayThrow LegacyException] boolean matches(DOMString selectors);107 [MayThrow LegacyException] Element closest(DOMString selectors);108 [ImplementedAs=matches, MayThrow LegacyException] boolean webkitMatchesSelector(DOMString selectors);106 [MayThrowException] boolean matches(DOMString selectors); 107 [MayThrowException] Element closest(DOMString selectors); 108 [ImplementedAs=matches, MayThrowException] boolean webkitMatchesSelector(DOMString selectors); 109 109 110 110 // CSSOM View Module API … … 125 125 #endif 126 126 127 [CEReactions, MayThrow LegacyException] Element insertAdjacentElement(DOMString where, Element element);128 [CEReactions, MayThrow LegacyException] void insertAdjacentHTML(DOMString where, DOMString html);129 [MayThrow LegacyException] void insertAdjacentText(DOMString where, DOMString text);127 [CEReactions, MayThrowException] Element insertAdjacentElement(DOMString where, Element element); 128 [CEReactions, MayThrowException] void insertAdjacentHTML(DOMString where, DOMString html); 129 [MayThrowException] void insertAdjacentText(DOMString where, DOMString text); 130 130 131 131 [Conditional=POINTER_LOCK] void requestPointerLock(); … … 136 136 137 137 // Shadow DOM API 138 [EnabledAtRuntime=ShadowDOM, MayThrow LegacyException] ShadowRoot attachShadow(ShadowRootInit init);138 [EnabledAtRuntime=ShadowDOM, MayThrowException] ShadowRoot attachShadow(ShadowRootInit init); 139 139 [EnabledAtRuntime=ShadowDOM, ImplementedAs=shadowRootForBindings, CallWith=ScriptState] readonly attribute ShadowRoot shadowRoot; 140 140 [CEReactions, EnabledAtRuntime=ShadowDOM, Reflect] attribute DOMString slot; -
trunk/Source/WebCore/dom/NamedNodeMap.cpp
r204115 r208135 27 27 28 28 #include "Attr.h" 29 #include "Element.h"30 29 #include "ExceptionCode.h" 31 30 #include "HTMLDocument.h" … … 56 55 } 57 56 58 RefPtr<Attr> NamedNodeMap::removeNamedItem(const AtomicString& name, ExceptionCode& ec)57 ExceptionOr<Ref<Attr>> NamedNodeMap::removeNamedItem(const AtomicString& name) 59 58 { 60 unsigned index = m_element.hasAttributes() ? m_element.findAttributeIndexByName(name, shouldIgnoreAttributeCase(m_element)) : ElementData::attributeNotFound;61 if (index == ElementData::attributeNotFound) {62 ec = NOT_FOUND_ERR;63 return nullptr;64 }59 if (!m_element.hasAttributes()) 60 return Exception { NOT_FOUND_ERR }; 61 auto index = m_element.findAttributeIndexByName(name, shouldIgnoreAttributeCase(m_element)); 62 if (index == ElementData::attributeNotFound) 63 return Exception { NOT_FOUND_ERR }; 65 64 return m_element.detachAttribute(index); 66 65 } 67 66 68 Vector<String> NamedNodeMap::supportedPropertyNames() 67 Vector<String> NamedNodeMap::supportedPropertyNames() const 69 68 { 70 69 Vector<String> names = m_element.getAttributeNames(); 71 70 if (is<HTMLElement>(m_element) && is<HTMLDocument>(m_element.document())) { 72 71 names.removeAllMatching([](String& name) { 73 return name.convertToASCIILowercase() != name; 72 for (auto character : StringView { name }.codeUnits()) { 73 if (isASCIIUpper(character)) 74 return true; 75 } 76 return false; 74 77 }); 75 78 } … … 77 80 } 78 81 79 RefPtr<Attr> NamedNodeMap::removeNamedItemNS(const AtomicString& namespaceURI, const AtomicString& localName, ExceptionCode& ec)82 ExceptionOr<Ref<Attr>> NamedNodeMap::removeNamedItemNS(const AtomicString& namespaceURI, const AtomicString& localName) 80 83 { 81 unsigned index = m_element.hasAttributes() ? m_element.findAttributeIndexByName(QualifiedName(nullAtom, localName, namespaceURI)) : ElementData::attributeNotFound;82 if (index == ElementData::attributeNotFound) {83 ec = NOT_FOUND_ERR;84 return nullptr;85 }84 if (!m_element.hasAttributes()) 85 return Exception { NOT_FOUND_ERR }; 86 auto index = m_element.findAttributeIndexByName(QualifiedName { nullAtom, localName, namespaceURI }); 87 if (index == ElementData::attributeNotFound) 88 return Exception { NOT_FOUND_ERR }; 86 89 return m_element.detachAttribute(index); 87 90 } 88 91 89 RefPtr<Attr> NamedNodeMap::setNamedItem(Attr& attr, ExceptionCode& ec)92 ExceptionOr<RefPtr<Attr>> NamedNodeMap::setNamedItem(Attr& attr) 90 93 { 91 return m_element.setAttributeNode(attr, ec); 92 } 93 94 RefPtr<Attr> NamedNodeMap::setNamedItem(Node& node, ExceptionCode& ec) 95 { 96 if (!is<Attr>(node)) { 97 ec = TypeError; 98 return nullptr; 99 } 100 return setNamedItem(downcast<Attr>(node), ec); 94 return m_element.setAttributeNode(attr); 101 95 } 102 96 … … 104 98 { 105 99 if (index >= length()) 106 return 0;100 return nullptr; 107 101 return m_element.ensureAttr(m_element.attributeAt(index).name()); 108 102 } -
trunk/Source/WebCore/dom/NamedNodeMap.h
r204717 r208135 25 25 #pragma once 26 26 27 #include "Attr.h" 27 #include "ExceptionOr.h" 28 #include "ScriptWrappable.h" 28 29 29 30 namespace WebCore { 30 31 32 class Attr; 33 class Element; 34 31 35 class NamedNodeMap : public ScriptWrappable { 32 36 WTF_MAKE_FAST_ALLOCATED; 33 friend class Element;34 37 public: 35 38 explicit NamedNodeMap(Element& element) 36 39 : m_element(element) 37 40 { 38 // Only supports NamedNodeMaps with Element associated, DocumentType.entities and DocumentType.notations are not supported yet.39 41 } 40 42 … … 42 44 WEBCORE_EXPORT void deref(); 43 45 44 // Public DOM interface. 46 WEBCORE_EXPORT unsigned length() const; 47 WEBCORE_EXPORT RefPtr<Attr> item(unsigned index) const; 48 WEBCORE_EXPORT RefPtr<Attr> getNamedItem(const AtomicString&) const; 49 WEBCORE_EXPORT RefPtr<Attr> getNamedItemNS(const AtomicString& namespaceURI, const AtomicString& localName) const; 50 WEBCORE_EXPORT ExceptionOr<RefPtr<Attr>> setNamedItem(Attr&); 51 WEBCORE_EXPORT ExceptionOr<Ref<Attr>> removeNamedItem(const AtomicString& name); 52 WEBCORE_EXPORT ExceptionOr<Ref<Attr>> removeNamedItemNS(const AtomicString& namespaceURI, const AtomicString& localName); 45 53 46 WEBCORE_EXPORT RefPtr<Attr> getNamedItem(const AtomicString&) const; 47 WEBCORE_EXPORT RefPtr<Attr> removeNamedItem(const AtomicString& name, ExceptionCode&); 48 Vector<String> supportedPropertyNames(); 54 Vector<String> supportedPropertyNames() const; 49 55 50 WEBCORE_EXPORT RefPtr<Attr> getNamedItemNS(const AtomicString& namespaceURI, const AtomicString& localName) const; 51 WEBCORE_EXPORT RefPtr<Attr> removeNamedItemNS(const AtomicString& namespaceURI, const AtomicString& localName, ExceptionCode&); 52 53 RefPtr<Attr> setNamedItem(Attr&, ExceptionCode&); 54 WEBCORE_EXPORT RefPtr<Attr> setNamedItem(Node&, ExceptionCode&); // for legacy bindings. 55 56 WEBCORE_EXPORT RefPtr<Attr> item(unsigned index) const; 57 WEBCORE_EXPORT unsigned length() const; 58 59 Element& element() const { return m_element; } 56 Element& element() { return m_element; } 60 57 61 58 private: -
trunk/Source/WebCore/dom/NamedNodeMap.idl
r207170 r208135 25 25 ] interface NamedNodeMap { 26 26 readonly attribute unsigned long length; 27 27 getter Attr? item(unsigned long index); 28 28 getter Attr? getNamedItem(DOMString name); 29 [CEReactions, MayThrowLegacyException] Attr? setNamedItem(Attr attr);30 [CEReactions, MayThrowLegacyException] Attr removeNamedItem(DOMString name);31 getter Attr? item(unsigned long index);32 29 Attr? getNamedItemNS(DOMString? namespaceURI, DOMString localName); 33 [CEReactions, MayThrowLegacyException, ImplementedAs=setNamedItem] Attr? setNamedItemNS(Attr attr); 34 [CEReactions, MayThrowLegacyException] Attr removeNamedItemNS(DOMString? namespaceURI, DOMString localName); 30 [CEReactions, MayThrowException] Attr? setNamedItem(Attr attr); 31 [CEReactions, MayThrowException, ImplementedAs=setNamedItem] Attr? setNamedItemNS(Attr attr); 32 [CEReactions, MayThrowException] Attr removeNamedItem(DOMString name); 33 [CEReactions, MayThrowException] Attr removeNamedItemNS(DOMString? namespaceURI, DOMString localName); 35 34 }; -
trunk/Source/WebCore/html/HTMLElement.cpp
r208112 r208135 585 585 RefPtr<Node> node = next ? next->previousSibling() : nullptr; 586 586 if (is<Text>(node.get())) { 587 ExceptionCode ec = 0; 588 mergeWithNextTextNode(downcast<Text>(*node), ec); 589 if (ec) 590 return Exception { ec }; 587 auto result = mergeWithNextTextNode(downcast<Text>(*node)); 588 if (result.hasException()) 589 return result.releaseException(); 591 590 } 592 591 if (is<Text>(prev.get())) { 593 ExceptionCode ec = 0; 594 mergeWithNextTextNode(downcast<Text>(*prev), ec); 595 if (ec) 596 return Exception { ec }; 592 auto result = mergeWithNextTextNode(downcast<Text>(*prev)); 593 if (result.hasException()) 594 return result.releaseException(); 597 595 } 598 596 return { }; -
trunk/Source/WebCore/inspector/DOMEditor.cpp
r208118 r208135 139 139 bool undo(ExceptionCode& ec) override 140 140 { 141 m_element->setAttribute(m_name, m_value, ec); 141 auto result = m_element->setAttribute(m_name, m_value); 142 if (result.hasException()) 143 ec = result.releaseException().code(); 142 144 return true; 143 145 } … … 177 179 bool undo(ExceptionCode& ec) override 178 180 { 179 if (m_hadAttribute) 180 m_element->setAttribute(m_name, m_oldValue, ec); 181 else 181 if (m_hadAttribute) { 182 auto result = m_element->setAttribute(m_name, m_oldValue); 183 if (result.hasException()) 184 ec = result.releaseException().code(); 185 } else 182 186 m_element->removeAttribute(m_name); 183 187 return true; … … 186 190 bool redo(ExceptionCode& ec) override 187 191 { 188 m_element->setAttribute(m_name, m_value, ec); 192 auto result = m_element->setAttribute(m_name, m_value); 193 if (result.hasException()) 194 ec = result.releaseException().code(); 189 195 return true; 190 196 } -
trunk/Source/WebCore/inspector/InspectorDOMAgent.cpp
r208124 r208135 199 199 } 200 200 201 String InspectorDOMAgent::toErrorString( const ExceptionCode&ec)201 String InspectorDOMAgent::toErrorString(ExceptionCode ec) 202 202 { 203 203 if (ec) { … … 206 206 } 207 207 return emptyString(); 208 } 209 210 String InspectorDOMAgent::toErrorString(Exception&& exception) 211 { 212 return ExceptionCodeDescription { exception.code() }.name; 208 213 } 209 214 … … 661 666 return; 662 667 663 RefPtr<HTMLElement> parsedElement = createHTMLElement(element->document(), spanTag); 664 ExceptionCode ec = 0; 665 parsedElement.get()->setInnerHTML("<span " + text + "></span>", ec); 666 if (ec) { 667 errorString = toErrorString(ec); 668 auto parsedElement = createHTMLElement(element->document(), spanTag); 669 auto result = parsedElement.get().setInnerHTML("<span " + text + "></span>"); 670 if (result.hasException()) { 671 errorString = toErrorString(result.releaseException()); 668 672 return; 669 673 } -
trunk/Source/WebCore/inspector/InspectorDOMAgent.h
r206093 r208135 61 61 class Element; 62 62 class Event; 63 class Exception; 63 64 class FloatQuad; 64 65 class Frame; … … 108 109 virtual ~InspectorDOMAgent(); 109 110 110 static String toErrorString(const ExceptionCode&); 111 static String toErrorString(ExceptionCode); 112 static String toErrorString(Exception&&); 111 113 112 114 void didCreateFrontendAndBackend(Inspector::FrontendRouter*, Inspector::BackendDispatcher*) override; -
trunk/Source/WebCore/inspector/InspectorStyleSheet.cpp
r207767 r208135 1302 1302 { 1303 1303 InspectorCSSAgent::InlineStyleOverrideScope overrideScope(m_element->document()); 1304 m_element->setAttribute( "style", text, ec);1304 m_element->setAttribute(HTMLNames::styleAttr, text); 1305 1305 } 1306 1306 … … 1308 1308 m_isStyleTextValid = true; 1309 1309 m_ruleSourceData = nullptr; 1310 return !ec; 1310 1311 ec = 0; 1312 return true; 1311 1313 } 1312 1314 -
trunk/Source/WebCore/testing/Internals.cpp
r208001 r208135 781 781 } 782 782 783 ExceptionOr<Node*> Internals::ensureShadowRoot(Element& host)784 {785 if (ShadowRoot* shadowRoot = host.shadowRoot())786 return shadowRoot;787 788 ExceptionCode ec = 0;789 auto result = host.createShadowRoot(ec);790 if (ec)791 return Exception { ec };792 return result;793 }794 795 783 Node* Internals::ensureUserAgentShadowRoot(Element& host) 796 784 { 797 785 return &host.ensureUserAgentShadowRoot(); 798 }799 800 ExceptionOr<Node*> Internals::createShadowRoot(Element& host)801 {802 ExceptionCode ec = 0;803 auto result = host.createShadowRoot(ec);804 if (ec)805 return Exception { ec };806 return result;807 786 } 808 787 -
trunk/Source/WebCore/testing/Internals.idl
r207839 r208135 101 101 CSSStyleDeclaration computedStyleIncludingVisitedInfo(Element element); 102 102 103 [MayThrowException] Node ensureShadowRoot(Element host);104 103 Node ensureUserAgentShadowRoot(Element host); 105 [MayThrowException] Node createShadowRoot(Element host);106 104 Node shadowRoot(Element host); 107 105 -
trunk/Source/WebCore/xml/parser/XMLDocumentParserLibxml2.cpp
r208096 r208135 740 740 namespaceQName = "xmlns:" + toString(namespaces[i].prefix); 741 741 742 QualifiedName parsedName = anyName; 743 if (!Element::parseAttributeName(parsedName, XMLNSNames::xmlnsNamespaceURI, namespaceQName, ec)) 742 auto result = Element::parseAttributeName(XMLNSNames::xmlnsNamespaceURI, namespaceQName); 743 if (result.hasException()) { 744 ec = result.releaseException().code(); 744 745 return; 745 746 prefixedAttributes.append(Attribute(parsedName, namespaceURI)); 746 } 747 748 prefixedAttributes.append(Attribute(result.releaseReturnValue(), namespaceURI)); 747 749 } 748 750 } … … 767 769 AtomicString attrQName = attrPrefix.isEmpty() ? toAtomicString(attributes[i].localname) : attrPrefix + ":" + toString(attributes[i].localname); 768 770 769 QualifiedName parsedName = anyName; 770 if (!Element::parseAttributeName(parsedName, attrURI, attrQName, ec)) 771 auto result = Element::parseAttributeName(attrURI, attrQName); 772 if (result.hasException()) { 773 ec = result.releaseException().code(); 771 774 return; 772 773 prefixedAttributes.append(Attribute(parsedName, attrValue)); 775 } 776 777 prefixedAttributes.append(Attribute(result.releaseReturnValue(), attrValue)); 774 778 } 775 779 } -
trunk/Source/WebKit/mac/ChangeLog
r208118 r208135 1 2016-10-30 Darin Adler <darin@apple.com> 2 3 Move Element, NamedNodeMap, and DOMStringMap from ExceptionCode to Exception 4 https://bugs.webkit.org/show_bug.cgi?id=164206 5 6 Reviewed by Chris Dumez. 7 8 * DOM/DOMElement.mm: 9 (-[DOMElement setInnerHTML:]): Updated exception handling. 10 (-[DOMElement setOuterHTML:]): Ditto. 11 (-[DOMElement setAttribute:value:]): Ditto. 12 (-[DOMElement setAttributeNode:]): Ditto. 13 (-[DOMElement removeAttributeNode:]): Ditto. 14 (-[DOMElement setAttributeNS:qualifiedName:value:]): Ditto. 15 (-[DOMElement setAttributeNodeNS:]): Ditto. 16 (-[DOMElement matches:]): Ditto. 17 (-[DOMElement closest:]): Ditto. 18 (-[DOMElement webkitMatchesSelector:]): Ditto. 19 * DOM/DOMHTMLElement.mm: 20 (-[DOMHTMLElement insertAdjacentElement:element:]): Ditto. 21 (-[DOMHTMLElement insertAdjacentHTML:html:]): Ditto. 22 (-[DOMHTMLElement insertAdjacentText:text:]): Ditto. 23 * DOM/DOMNamedNodeMap.mm: 24 (-[DOMNamedNodeMap setNamedItem:]): Ditto. 25 (-[DOMNamedNodeMap removeNamedItem:]): Ditto. 26 (-[DOMNamedNodeMap setNamedItemNS:]): Ditto. 27 (-[DOMNamedNodeMap removeNamedItemNS:localName:]): Ditto. 28 1 29 2016-10-29 Darin Adler <darin@apple.com> 2 30 -
trunk/Source/WebKit/mac/DOM/DOMElement.mm
r208096 r208135 178 178 { 179 179 JSMainThreadNullState state; 180 ExceptionCode ec = 0; 181 unwrap(*self).setInnerHTML(newInnerHTML, ec); 182 raiseOnDOMError(ec); 180 raiseOnDOMError(unwrap(*self).setInnerHTML(newInnerHTML)); 183 181 } 184 182 … … 192 190 { 193 191 JSMainThreadNullState state; 194 ExceptionCode ec = 0; 195 unwrap(*self).setOuterHTML(newOuterHTML, ec); 196 raiseOnDOMError(ec); 192 raiseOnDOMError(unwrap(*self).setOuterHTML(newOuterHTML)); 197 193 } 198 194 … … 286 282 { 287 283 JSMainThreadNullState state; 288 ExceptionCode ec = 0; 289 unwrap(*self).setAttribute(name, value, ec); 290 raiseOnDOMError(ec); 284 raiseOnDOMError(unwrap(*self).setAttribute(name, value)); 291 285 } 292 286 … … 308 302 if (!newAttr) 309 303 raiseTypeErrorException(); 310 ExceptionCode ec = 0; 311 DOMAttr *result = kit(unwrap(*self).setAttributeNode(*core(newAttr), ec).get()); 312 raiseOnDOMError(ec); 313 return result; 304 return kit(raiseOnDOMError(unwrap(*self).setAttributeNode(*core(newAttr))).get()); 314 305 } 315 306 … … 319 310 if (!oldAttr) 320 311 raiseTypeErrorException(); 321 ExceptionCode ec = 0; 322 DOMAttr *result = kit(unwrap(*self).removeAttributeNode(*core(oldAttr), ec).get()); 323 raiseOnDOMError(ec); 324 return result; 312 return kit(raiseOnDOMError(unwrap(*self).removeAttributeNode(*core(oldAttr))).ptr()); 325 313 } 326 314 … … 344 332 { 345 333 JSMainThreadNullState state; 346 ExceptionCode ec = 0; 347 unwrap(*self).setAttributeNS(namespaceURI, qualifiedName, value, ec); 348 raiseOnDOMError(ec); 334 raiseOnDOMError(unwrap(*self).setAttributeNS(namespaceURI, qualifiedName, value)); 349 335 } 350 336 … … 376 362 if (!newAttr) 377 363 raiseTypeErrorException(); 378 ExceptionCode ec = 0; 379 DOMAttr *result = kit(unwrap(*self).setAttributeNodeNS(*core(newAttr), ec).get()); 380 raiseOnDOMError(ec); 381 return result; 364 return kit(raiseOnDOMError(unwrap(*self).setAttributeNodeNS(*core(newAttr))).get()); 382 365 } 383 366 … … 440 423 { 441 424 JSMainThreadNullState state; 442 ExceptionCode ec = 0; 443 BOOL result = unwrap(*self).matches(selectors, ec); 444 raiseOnDOMError(ec); 445 return result; 425 return raiseOnDOMError(unwrap(*self).matches(selectors)); 446 426 } 447 427 … … 449 429 { 450 430 JSMainThreadNullState state; 451 ExceptionCode ec = 0; 452 DOMElement *result = kit(unwrap(*self).closest(selectors, ec)); 453 raiseOnDOMError(ec); 454 return result; 431 return kit(raiseOnDOMError(unwrap(*self).closest(selectors))); 455 432 } 456 433 … … 458 435 { 459 436 JSMainThreadNullState state; 460 ExceptionCode ec = 0; 461 BOOL result = unwrap(*self).matches(selectors, ec); 462 raiseOnDOMError(ec); 463 return result; 437 return raiseOnDOMError(unwrap(*self).matches(selectors)); 464 438 } 465 439 -
trunk/Source/WebKit/mac/DOM/DOMHTMLElement.mm
r208096 r208135 236 236 if (!element) 237 237 raiseTypeErrorException(); 238 WebCore::ExceptionCode ec = 0; 239 DOMElement *result = kit(WTF::getPtr(IMPL->insertAdjacentElement(where, *core(element), ec))); 240 raiseOnDOMError(ec); 241 return result; 238 return kit(raiseOnDOMError(IMPL->insertAdjacentElement(where, *core(element)))); 242 239 } 243 240 … … 245 242 { 246 243 WebCore::JSMainThreadNullState state; 247 WebCore::ExceptionCode ec = 0; 248 IMPL->insertAdjacentHTML(where, html, ec); 249 raiseOnDOMError(ec); 244 raiseOnDOMError(IMPL->insertAdjacentHTML(where, html)); 250 245 } 251 246 … … 253 248 { 254 249 WebCore::JSMainThreadNullState state; 255 WebCore::ExceptionCode ec = 0; 256 IMPL->insertAdjacentText(where, text, ec); 257 raiseOnDOMError(ec); 250 raiseOnDOMError(IMPL->insertAdjacentText(where, text)); 258 251 } 259 252 -
trunk/Source/WebKit/mac/DOM/DOMNamedNodeMap.mm
r204717 r208135 69 69 if (!node) 70 70 raiseTypeErrorException(); 71 WebCore::ExceptionCode ec = 0;72 DOMNode *result = kit(WTF::getPtr(IMPL->setNamedItem(*core(node), ec)));73 raiseOnDOMError(ec);74 return result;71 auto& coreNode = *core(node); 72 if (!is<WebCore::Attr>(coreNode)) 73 raiseTypeErrorException(); 74 return kit(raiseOnDOMError(IMPL->setNamedItem(downcast<WebCore::Attr>(coreNode))).get()); 75 75 } 76 76 … … 78 78 { 79 79 WebCore::JSMainThreadNullState state; 80 WebCore::ExceptionCode ec = 0; 81 DOMNode *result = kit(WTF::getPtr(IMPL->removeNamedItem(name, ec))); 82 raiseOnDOMError(ec); 83 return result; 80 return kit(raiseOnDOMError(IMPL->removeNamedItem(name)).ptr()); 84 81 } 85 82 … … 98 95 - (DOMNode *)setNamedItemNS:(DOMNode *)node 99 96 { 100 WebCore::JSMainThreadNullState state; 101 if (!node) 102 raiseTypeErrorException(); 103 WebCore::ExceptionCode ec = 0; 104 DOMNode *result = kit(WTF::getPtr(IMPL->setNamedItem(*core(node), ec))); 105 raiseOnDOMError(ec); 106 return result; 97 return [self setNamedItem:node]; 107 98 } 108 99 … … 110 101 { 111 102 WebCore::JSMainThreadNullState state; 112 WebCore::ExceptionCode ec = 0; 113 DOMNode *result = kit(WTF::getPtr(IMPL->removeNamedItemNS(namespaceURI, localName, ec))); 114 raiseOnDOMError(ec); 115 return result; 103 return kit(raiseOnDOMError(IMPL->removeNamedItemNS(namespaceURI, localName)).ptr()); 116 104 } 117 105 -
trunk/Source/WebKit/win/ChangeLog
r208132 r208135 1 2016-10-30 Darin Adler <darin@apple.com> 2 3 Move Element, NamedNodeMap, and DOMStringMap from ExceptionCode to Exception 4 https://bugs.webkit.org/show_bug.cgi?id=164206 5 6 Reviewed by Chris Dumez. 7 8 * DOMCoreClasses.cpp: 9 (DOMElement::setAttribute): Updated exception handling. 10 * DOMHTMLClasses.cpp: 11 (DOMHTMLElement::setInnerHTML): Ditto. 12 1 13 2016-10-30 Brent Fulgham <bfulgham@apple.com> 2 14 -
trunk/Source/WebKit/win/DOMCoreClasses.cpp
r207522 r208135 32 32 #include "WebKitGraphics.h" 33 33 34 #include <WebCore/Attr.h> 34 35 #include <WebCore/BString.h> 35 36 #include <WebCore/COMPtr.h> … … 1071 1072 WTF::String nameString(name, SysStringLen(name)); 1072 1073 WTF::String valueString(value, SysStringLen(value)); 1073 WebCore::ExceptionCode ec = 0; 1074 m_element->setAttribute(nameString, valueString, ec); 1075 return ec ? E_FAIL : S_OK; 1074 auto result = m_element->setAttribute(nameString, valueString); 1075 return result.hasException() ? E_FAIL : S_OK; 1076 1076 } 1077 1077 -
trunk/Source/WebKit/win/DOMHTMLClasses.cpp
r208096 r208135 515 515 HTMLElement* htmlElement = downcast<HTMLElement>(m_element); 516 516 String htmlString(html, SysStringLen(html)); 517 ExceptionCode ec = 0; 518 htmlElement->setInnerHTML(htmlString, ec); 517 htmlElement->setInnerHTML(htmlString); 519 518 return S_OK; 520 519 } -
trunk/Source/WebKit2/ChangeLog
r208124 r208135 1 2016-10-30 Darin Adler <darin@apple.com> 2 3 Move Element, NamedNodeMap, and DOMStringMap from ExceptionCode to Exception 4 https://bugs.webkit.org/show_bug.cgi?id=164206 5 6 Reviewed by Chris Dumez. 7 8 * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMNamedNodeMap.cpp: 9 (webkit_dom_named_node_map_set_named_item): Updated exception handling. 10 (webkit_dom_named_node_map_remove_named_item): Ditto. 11 (webkit_dom_named_node_map_set_named_item_ns): Ditto. 12 (webkit_dom_named_node_map_remove_named_item_ns): Ditto. 13 * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMElement.cpp: 14 (webkit_dom_element_set_attribute): Ditto. 15 (webkit_dom_element_set_attribute_node): Ditto. 16 (webkit_dom_element_remove_attribute_node): Ditto. 17 (webkit_dom_element_set_attribute_ns): Ditto. 18 (webkit_dom_element_set_attribute_node_ns): Ditto. 19 (webkit_dom_element_matches): Ditto. 20 (webkit_dom_element_closest): Ditto. 21 (webkit_dom_element_webkit_matches_selector): Ditto. 22 (webkit_dom_element_insert_adjacent_element): Ditto. 23 (webkit_dom_element_insert_adjacent_html): Ditto. 24 (webkit_dom_element_insert_adjacent_text): Ditto. 25 (webkit_dom_element_set_inner_html): Ditto. 26 (webkit_dom_element_set_outer_html): Ditto. 27 * WebProcess/InjectedBundle/API/mac/WKDOMElement.mm: 28 (-[WKDOMElement setAttribute:value:]): Ditto. 29 1 30 2016-10-30 Yusuke Suzuki <utatane.tea@gmail.com> 2 31 -
trunk/Source/WebKit2/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMElement.cpp
r208096 r208135 614 614 WTF::String convertedName = WTF::String::fromUTF8(name); 615 615 WTF::String convertedValue = WTF::String::fromUTF8(value); 616 WebCore::ExceptionCode ec = 0; 617 item->setAttribute(convertedName, convertedValue, ec); 618 if (ec) { 619 WebCore::ExceptionCodeDescription ecdesc(ec); 616 auto result = item->setAttribute(convertedName, convertedValue); 617 if (result.hasException()) { 618 WebCore::ExceptionCodeDescription ecdesc(result.releaseException().code()); 620 619 g_set_error_literal(error, g_quark_from_string("WEBKIT_DOM"), ecdesc.code, ecdesc.name); 621 620 } … … 651 650 WebCore::Element* item = WebKit::core(self); 652 651 WebCore::Attr* convertedNewAttr = WebKit::core(newAttr); 653 WebCore::ExceptionCode ec = 0;654 RefPtr<WebCore::Attr> gobjectResult = WTF::getPtr(item->setAttributeNode(*convertedNewAttr, ec));655 if (ec) {656 WebCore::ExceptionCodeDescription ecdesc(ec);657 g_set_error_literal(error, g_quark_from_string("WEBKIT_DOM"), ecdesc.code, ecdesc.name);658 } 659 return WebKit::kit( gobjectResult.get());652 auto result = item->setAttributeNode(*convertedNewAttr); 653 if (result.hasException()) { 654 WebCore::ExceptionCodeDescription ecdesc(result.releaseException().code()); 655 g_set_error_literal(error, g_quark_from_string("WEBKIT_DOM"), ecdesc.code, ecdesc.name); 656 return nullptr; 657 } 658 return WebKit::kit(result.releaseReturnValue().get()); 660 659 } 661 660 … … 668 667 WebCore::Element* item = WebKit::core(self); 669 668 WebCore::Attr* convertedOldAttr = WebKit::core(oldAttr); 670 WebCore::ExceptionCode ec = 0;671 RefPtr<WebCore::Attr> gobjectResult = WTF::getPtr(item->removeAttributeNode(*convertedOldAttr, ec));672 if (ec) {673 WebCore::ExceptionCodeDescription ecdesc(ec);674 g_set_error_literal(error, g_quark_from_string("WEBKIT_DOM"), ecdesc.code, ecdesc.name);675 } 676 return WebKit::kit( gobjectResult.get());669 auto result = item->removeAttributeNode(*convertedOldAttr); 670 if (result.hasException()) { 671 WebCore::ExceptionCodeDescription ecdesc(result.releaseException().code()); 672 g_set_error_literal(error, g_quark_from_string("WEBKIT_DOM"), ecdesc.code, ecdesc.name); 673 return nullptr; 674 } 675 return WebKit::kit(result.releaseReturnValue().ptr()); 677 676 } 678 677 … … 721 720 WTF::String convertedQualifiedName = WTF::String::fromUTF8(qualifiedName); 722 721 WTF::String convertedValue = WTF::String::fromUTF8(value); 723 WebCore::ExceptionCode ec = 0; 724 item->setAttributeNS(convertedNamespaceURI, convertedQualifiedName, convertedValue, ec); 725 if (ec) { 726 WebCore::ExceptionCodeDescription ecdesc(ec); 722 auto result = item->setAttributeNS(convertedNamespaceURI, convertedQualifiedName, convertedValue); 723 if (result.hasException()) { 724 WebCore::ExceptionCodeDescription ecdesc(result.releaseException().code()); 727 725 g_set_error_literal(error, g_quark_from_string("WEBKIT_DOM"), ecdesc.code, ecdesc.name); 728 726 } … … 775 773 WebCore::Element* item = WebKit::core(self); 776 774 WebCore::Attr* convertedNewAttr = WebKit::core(newAttr); 777 WebCore::ExceptionCode ec = 0;778 RefPtr<WebCore::Attr> gobjectResult = WTF::getPtr(item->setAttributeNodeNS(*convertedNewAttr, ec));779 if (ec) {780 WebCore::ExceptionCodeDescription ecdesc(ec);781 g_set_error_literal(error, g_quark_from_string("WEBKIT_DOM"), ecdesc.code, ecdesc.name);782 } 783 return WebKit::kit( gobjectResult.get());775 auto result = item->setAttributeNodeNS(*convertedNewAttr); 776 if (result.hasException()) { 777 WebCore::ExceptionCodeDescription ecdesc(result.releaseException().code()); 778 g_set_error_literal(error, g_quark_from_string("WEBKIT_DOM"), ecdesc.code, ecdesc.name); 779 return nullptr; 780 } 781 return WebKit::kit(result.releaseReturnValue().get()); 784 782 } 785 783 … … 875 873 WebCore::Element* item = WebKit::core(self); 876 874 WTF::String convertedSelectors = WTF::String::fromUTF8(selectors); 877 WebCore::ExceptionCode ec = 0;878 gboolean result = item->matches(convertedSelectors, ec);879 if (ec) {880 WebCore::ExceptionCodeDescription ecdesc(ec);881 g_set_error_literal(error, g_quark_from_string("WEBKIT_DOM"), ecdesc.code, ecdesc.name);882 } 883 return result ;875 auto result = item->matches(convertedSelectors); 876 if (result.hasException()) { 877 WebCore::ExceptionCodeDescription ecdesc(result.releaseException().code()); 878 g_set_error_literal(error, g_quark_from_string("WEBKIT_DOM"), ecdesc.code, ecdesc.name); 879 return false; 880 } 881 return result.releaseReturnValue(); 884 882 } 885 883 … … 892 890 WebCore::Element* item = WebKit::core(self); 893 891 WTF::String convertedSelectors = WTF::String::fromUTF8(selectors); 894 WebCore::ExceptionCode ec = 0;895 RefPtr<WebCore::Element> gobjectResult = WTF::getPtr(item->closest(convertedSelectors, ec));896 if (ec) {897 WebCore::ExceptionCodeDescription ecdesc(ec);898 g_set_error_literal(error, g_quark_from_string("WEBKIT_DOM"), ecdesc.code, ecdesc.name);899 } 900 return WebKit::kit( gobjectResult.get());892 auto result = item->closest(convertedSelectors); 893 if (result.hasException()) { 894 WebCore::ExceptionCodeDescription ecdesc(result.releaseException().code()); 895 g_set_error_literal(error, g_quark_from_string("WEBKIT_DOM"), ecdesc.code, ecdesc.name); 896 return nullptr; 897 } 898 return WebKit::kit(result.releaseReturnValue()); 901 899 } 902 900 903 901 gboolean webkit_dom_element_webkit_matches_selector(WebKitDOMElement* self, const gchar* selectors, GError** error) 904 902 { 905 WebCore::JSMainThreadNullState state; 906 g_return_val_if_fail(WEBKIT_DOM_IS_ELEMENT(self), FALSE); 907 g_return_val_if_fail(selectors, FALSE); 908 g_return_val_if_fail(!error || !*error, FALSE); 909 WebCore::Element* item = WebKit::core(self); 910 WTF::String convertedSelectors = WTF::String::fromUTF8(selectors); 911 WebCore::ExceptionCode ec = 0; 912 gboolean result = item->matches(convertedSelectors, ec); 913 if (ec) { 914 WebCore::ExceptionCodeDescription ecdesc(ec); 915 g_set_error_literal(error, g_quark_from_string("WEBKIT_DOM"), ecdesc.code, ecdesc.name); 916 } 917 return result; 903 return webkit_dom_element_matches(self, selectors, error); 918 904 } 919 905 … … 936 922 WTF::String convertedWhere = WTF::String::fromUTF8(where); 937 923 WebCore::Element* convertedElement = WebKit::core(element); 938 WebCore::ExceptionCode ec = 0;939 RefPtr<WebCore::Element> gobjectResult = WTF::getPtr(item->insertAdjacentElement(convertedWhere, *convertedElement, ec));940 if (ec) {941 WebCore::ExceptionCodeDescription ecdesc(ec);942 g_set_error_literal(error, g_quark_from_string("WEBKIT_DOM"), ecdesc.code, ecdesc.name);943 } 944 return WebKit::kit( gobjectResult.get());924 auto result = item->insertAdjacentElement(convertedWhere, *convertedElement); 925 if (result.hasException()) { 926 WebCore::ExceptionCodeDescription ecdesc(result.releaseException().code()); 927 g_set_error_literal(error, g_quark_from_string("WEBKIT_DOM"), ecdesc.code, ecdesc.name); 928 return nullptr; 929 } 930 return WebKit::kit(result.releaseReturnValue()); 945 931 } 946 932 … … 955 941 WTF::String convertedWhere = WTF::String::fromUTF8(where); 956 942 WTF::String convertedHtml = WTF::String::fromUTF8(html); 957 WebCore::ExceptionCode ec = 0; 958 item->insertAdjacentHTML(convertedWhere, convertedHtml, ec); 959 if (ec) { 960 WebCore::ExceptionCodeDescription ecdesc(ec); 943 auto result = item->insertAdjacentHTML(convertedWhere, convertedHtml); 944 if (result.hasException()) { 945 WebCore::ExceptionCodeDescription ecdesc(result.releaseException().code()); 961 946 g_set_error_literal(error, g_quark_from_string("WEBKIT_DOM"), ecdesc.code, ecdesc.name); 962 947 } … … 973 958 WTF::String convertedWhere = WTF::String::fromUTF8(where); 974 959 WTF::String convertedText = WTF::String::fromUTF8(text); 975 WebCore::ExceptionCode ec = 0; 976 item->insertAdjacentText(convertedWhere, convertedText, ec); 977 if (ec) { 978 WebCore::ExceptionCodeDescription ecdesc(ec); 960 auto result = item->insertAdjacentText(convertedWhere, convertedText); 961 if (result.hasException()) { 962 WebCore::ExceptionCodeDescription ecdesc(result.releaseException().code()); 979 963 g_set_error_literal(error, g_quark_from_string("WEBKIT_DOM"), ecdesc.code, ecdesc.name); 980 964 } … … 1264 1248 WebCore::Element* item = WebKit::core(self); 1265 1249 WTF::String convertedValue = WTF::String::fromUTF8(value); 1266 WebCore::ExceptionCode ec = 0; 1267 item->setInnerHTML(convertedValue, ec); 1268 if (ec) { 1269 WebCore::ExceptionCodeDescription ecdesc(ec); 1250 auto result = item->setInnerHTML(convertedValue); 1251 if (result.hasException()) { 1252 WebCore::ExceptionCodeDescription ecdesc(result.releaseException().code()); 1270 1253 g_set_error_literal(error, g_quark_from_string("WEBKIT_DOM"), ecdesc.code, ecdesc.name); 1271 1254 } … … 1289 1272 WebCore::Element* item = WebKit::core(self); 1290 1273 WTF::String convertedValue = WTF::String::fromUTF8(value); 1291 WebCore::ExceptionCode ec = 0; 1292 item->setOuterHTML(convertedValue, ec); 1293 if (ec) { 1294 WebCore::ExceptionCodeDescription ecdesc(ec); 1274 auto result = item->setOuterHTML(convertedValue); 1275 if (result.hasException()) { 1276 WebCore::ExceptionCodeDescription ecdesc(result.releaseException().code()); 1295 1277 g_set_error_literal(error, g_quark_from_string("WEBKIT_DOM"), ecdesc.code, ecdesc.name); 1296 1278 } -
trunk/Source/WebKit2/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMNamedNodeMap.cpp
r207735 r208135 21 21 #include "WebKitDOMNamedNodeMap.h" 22 22 23 #include "ConvertToUTF8String.h" 24 #include "DOMObjectCache.h" 25 #include "WebKitDOMNamedNodeMapPrivate.h" 26 #include "WebKitDOMNodePrivate.h" 27 #include "WebKitDOMPrivate.h" 28 #include <WebCore/Attr.h> 23 29 #include <WebCore/CSSImportRule.h> 24 #include "DOMObjectCache.h"25 30 #include <WebCore/Document.h> 26 31 #include <WebCore/ExceptionCode.h> 27 32 #include <WebCore/ExceptionCodeDescription.h> 28 33 #include <WebCore/JSMainThreadExecState.h> 29 #include "WebKitDOMNamedNodeMapPrivate.h"30 #include "WebKitDOMNodePrivate.h"31 #include "WebKitDOMPrivate.h"32 #include "ConvertToUTF8String.h"33 34 #include <wtf/GetPtr.h> 34 35 #include <wtf/RefPtr.h> … … 153 154 WebCore::NamedNodeMap* item = WebKit::core(self); 154 155 WebCore::Node* convertedNode = WebKit::core(node); 155 WebCore::ExceptionCode ec = 0; 156 RefPtr<WebCore::Node> gobjectResult = WTF::getPtr(item->setNamedItem(*convertedNode, ec)); 157 if (ec) { 158 WebCore::ExceptionCodeDescription ecdesc(ec); 159 g_set_error_literal(error, g_quark_from_string("WEBKIT_DOM"), ecdesc.code, ecdesc.name); 160 } 161 return WebKit::kit(gobjectResult.get()); 156 if (!is<WebCore::Attr>(*convertedNode)) { 157 WebCore::ExceptionCodeDescription ecdesc(WebCore::TypeError); 158 g_set_error_literal(error, g_quark_from_string("WEBKIT_DOM"), ecdesc.code, ecdesc.name); 159 return nullptr; 160 } 161 auto result = item->setNamedItem(downcast<WebCore::Attr>(*convertedNode)); 162 if (result.hasException()) { 163 WebCore::ExceptionCodeDescription ecdesc(result.releaseException().code()); 164 g_set_error_literal(error, g_quark_from_string("WEBKIT_DOM"), ecdesc.code, ecdesc.name); 165 return nullptr; 166 } 167 return WebKit::kit(result.releaseReturnValue().get()); 162 168 } 163 169 … … 170 176 WebCore::NamedNodeMap* item = WebKit::core(self); 171 177 WTF::String convertedName = WTF::String::fromUTF8(name); 172 WebCore::ExceptionCode ec = 0;173 RefPtr<WebCore::Node> gobjectResult = WTF::getPtr(item->removeNamedItem(convertedName, ec));174 if (ec) {175 WebCore::ExceptionCodeDescription ecdesc(ec);176 g_set_error_literal(error, g_quark_from_string("WEBKIT_DOM"), ecdesc.code, ecdesc.name);177 } 178 return WebKit::kit( gobjectResult.get());178 auto result = item->removeNamedItem(convertedName); 179 if (result.hasException()) { 180 WebCore::ExceptionCodeDescription ecdesc(result.releaseException().code()); 181 g_set_error_literal(error, g_quark_from_string("WEBKIT_DOM"), ecdesc.code, ecdesc.name); 182 return nullptr; 183 } 184 return WebKit::kit(result.releaseReturnValue().ptr()); 179 185 } 180 186 … … 203 209 WebKitDOMNode* webkit_dom_named_node_map_set_named_item_ns(WebKitDOMNamedNodeMap* self, WebKitDOMNode* node, GError** error) 204 210 { 205 WebCore::JSMainThreadNullState state; 206 g_return_val_if_fail(WEBKIT_DOM_IS_NAMED_NODE_MAP(self), 0); 207 g_return_val_if_fail(WEBKIT_DOM_IS_NODE(node), 0); 208 g_return_val_if_fail(!error || !*error, 0); 209 WebCore::NamedNodeMap* item = WebKit::core(self); 210 WebCore::Node* convertedNode = WebKit::core(node); 211 WebCore::ExceptionCode ec = 0; 212 RefPtr<WebCore::Node> gobjectResult = WTF::getPtr(item->setNamedItem(*convertedNode, ec)); 213 if (ec) { 214 WebCore::ExceptionCodeDescription ecdesc(ec); 215 g_set_error_literal(error, g_quark_from_string("WEBKIT_DOM"), ecdesc.code, ecdesc.name); 216 } 217 return WebKit::kit(gobjectResult.get()); 211 return webkit_dom_named_node_map_set_named_item(self, node, error); 218 212 } 219 213 … … 228 222 WTF::String convertedNamespaceURI = WTF::String::fromUTF8(namespaceURI); 229 223 WTF::String convertedLocalName = WTF::String::fromUTF8(localName); 230 WebCore::ExceptionCode ec = 0;231 RefPtr<WebCore::Node> gobjectResult = WTF::getPtr(item->removeNamedItemNS(convertedNamespaceURI, convertedLocalName, ec));232 if (ec) {233 WebCore::ExceptionCodeDescription ecdesc(ec);234 g_set_error_literal(error, g_quark_from_string("WEBKIT_DOM"), ecdesc.code, ecdesc.name);235 } 236 return WebKit::kit( gobjectResult.get());224 auto result = item->removeNamedItemNS(convertedNamespaceURI, convertedLocalName); 225 if (result.hasException()) { 226 WebCore::ExceptionCodeDescription ecdesc(result.releaseException().code()); 227 g_set_error_literal(error, g_quark_from_string("WEBKIT_DOM"), ecdesc.code, ecdesc.name); 228 return nullptr; 229 } 230 return WebKit::kit(result.releaseReturnValue().ptr()); 237 231 } 238 232 -
trunk/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMElement.mm
r174125 r208135 46 46 - (void)setAttribute:(NSString *)name value:(NSString *)value 47 47 { 48 // FIXME: Do something about the exception. 49 WebCore::ExceptionCode ec; 50 downcast<WebCore::Element>(*_impl).setAttribute(name, value, ec); 48 downcast<WebCore::Element>(*_impl).setAttribute(name, value); 51 49 } 52 50
Note: See TracChangeset
for help on using the changeset viewer.