Move Element, NamedNodeMap, and DOMStringMap from ExceptionCode to Exception
authordarin@apple.com <darin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 30 Oct 2016 22:36:07 +0000 (22:36 +0000)
committerdarin@apple.com <darin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 30 Oct 2016 22:36:07 +0000 (22:36 +0000)
commitc1f6f30f0314d797eb072f629184508dfae77043
tree7dd94cfb6a72d196e3fdc403b72df3fe5479cfa0
parentfc9afe89e9653d6d60dab7eb459dfa4b984d0623
Move Element, NamedNodeMap, and DOMStringMap from ExceptionCode to Exception
https://bugs.webkit.org/show_bug.cgi?id=164206

Reviewed by Chris Dumez.

Source/WebCore:

* bindings/js/JSDOMStringMapCustom.cpp:
(WebCore::JSDOMStringMap::getOwnPropertyNames): Use modern for loop, and
updates since the names function now returns a vector.
(WebCore::JSDOMStringMap::putDelegate): Use propagateException. Also return
true any time an exception is raised. Since true tells the caller to return
without doing any work, we always want to return that on an exception.
* dom/DatasetDOMStringMap.cpp:
(WebCore::DatasetDOMStringMap::names): Renamed from getNames and made this
return a Vector instead of populating a passed-in vector.
(WebCore::DatasetDOMStringMap::setItem): Use ExceptionOr.
* dom/DatasetDOMStringMap.h: Updated for above.

* dom/Document.cpp:
(WebCore::Document::adoptNode): Updated to use ExceptionOr for
removeAttributeNode. Changed to use remove rather than removeChild for
better clarity.

* dom/Element.cpp:
(WebCore::Element::setAttribute): Use ExceptionOr.
(WebCore::Element::createShadowRoot): Deleted. Unused.
(WebCore::Element::attachShadow): Use ExceptionOr.
(WebCore::Element::shadowRootForBindings): Tweaked a bit.
(WebCore::Element::userAgentShadowRoot): Removed unneeded if statemment.
(WebCore::Element::ensureUserAgentShadowRoot): Tweaked a bit.
(WebCore::Element::setAttributeNode): Use ExceptionOr.
(WebCore::Element::setAttributeNodeNS): Ditto.
(WebCore::Element::removeAttributeNode): Ditto.
(WebCore::Element::parseAttributeName): Ditto. Also changed return result
to be a QualifiedName instead of using an out argument.
(WebCore::Element::setAttributeNS): Ditto.
(WebCore::Element::mergeWithNextTextNode): Ditto.
(WebCore::Element::setOuterHTML): Ditto.
(WebCore::Element::setInnerHTML): Ditto.
(WebCore::Element::matches): Ditto.
(WebCore::Element::closest): Ditto.
(WebCore::Element::insertAdjacent): Ditto.
(WebCore::Element::insertAdjacentElement): Ditto.
(WebCore::contextNodeForInsertion): Ditto.
(WebCore::contextElementForInsertion): Added. Helper for the
insertAdjacentHTML function to eliminate a local variable.
(WebCore::Element::insertAdjacentHTML): Use ExceptionOr.
(WebCore::Element::insertAdjacentText): Ditto.
* dom/Element.h: Updated for above.
* dom/Element.idl: Use non-legacy exceptions.

* dom/NamedNodeMap.cpp:
(WebCore::NamedNodeMap::removeNamedItem): Use ExceptionOr.
(WebCore::NamedNodeMap::supportedPropertyNames): Updated to check
which strings should be removed without copying the strings.
(WebCore::NamedNodeMap::removeNamedItemNS): Use ExceptionOr.
(WebCore::NamedNodeMap::setNamedItem): Ditto. Removed overload for
legacy bindings; move that to the bindings themselves.
* dom/NamedNodeMap.h: Updated for above.
* dom/NamedNodeMap.idl: Use non-legacy exceptions.

* html/HTMLElement.cpp:
(WebCore::HTMLElement::setOuterText): Updated since mergeWithNextTextNode
now uses ExceptionOr.

* inspector/DOMEditor.cpp: Updated to use ExceptionOr.

* inspector/InspectorDOMAgent.cpp:
(WebCore::InspectorDOMAgent::toErrorString): Added an overload for
Exception.
(WebCore::InspectorDOMAgent::setAttributesAsText): Updated to use ExceptionOr.
* inspector/InspectorDOMAgent.h: Updated for above.

* inspector/InspectorStyleSheet.cpp:
(WebCore::InspectorStyleSheetForInlineStyle::setStyleText): Updated to
use the correct version of setAttribute; there was never a risk that there
would be an exception, but now that's clearer.

* testing/Internals.cpp:
(WebCore::Internals::ensureShadowRoot): Deleted. Was unused.
(WebCore::Internals::createShadowRoot): Ditto.
* testing/Internals.idl: Updated for above.

* xml/parser/XMLDocumentParserLibxml2.cpp:
(WebCore::handleNamespaceAttributes): Use updated parseAttributeName,
which uses ExceptionOr and a return value instead of an out argument.
(WebCore::handleElementAttributes): Ditto.

Source/WebKit/mac:

* DOM/DOMElement.mm:
(-[DOMElement setInnerHTML:]): Updated exception handling.
(-[DOMElement setOuterHTML:]): Ditto.
(-[DOMElement setAttribute:value:]): Ditto.
(-[DOMElement setAttributeNode:]): Ditto.
(-[DOMElement removeAttributeNode:]): Ditto.
(-[DOMElement setAttributeNS:qualifiedName:value:]): Ditto.
(-[DOMElement setAttributeNodeNS:]): Ditto.
(-[DOMElement matches:]): Ditto.
(-[DOMElement closest:]): Ditto.
(-[DOMElement webkitMatchesSelector:]): Ditto.
* DOM/DOMHTMLElement.mm:
(-[DOMHTMLElement insertAdjacentElement:element:]): Ditto.
(-[DOMHTMLElement insertAdjacentHTML:html:]): Ditto.
(-[DOMHTMLElement insertAdjacentText:text:]): Ditto.
* DOM/DOMNamedNodeMap.mm:
(-[DOMNamedNodeMap setNamedItem:]): Ditto.
(-[DOMNamedNodeMap removeNamedItem:]): Ditto.
(-[DOMNamedNodeMap setNamedItemNS:]): Ditto.
(-[DOMNamedNodeMap removeNamedItemNS:localName:]): Ditto.

Source/WebKit/win:

* DOMCoreClasses.cpp:
(DOMElement::setAttribute): Updated exception handling.
* DOMHTMLClasses.cpp:
(DOMHTMLElement::setInnerHTML): Ditto.

Source/WebKit2:

* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMNamedNodeMap.cpp:
(webkit_dom_named_node_map_set_named_item): Updated exception handling.
(webkit_dom_named_node_map_remove_named_item): Ditto.
(webkit_dom_named_node_map_set_named_item_ns): Ditto.
(webkit_dom_named_node_map_remove_named_item_ns): Ditto.
* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMElement.cpp:
(webkit_dom_element_set_attribute): Ditto.
(webkit_dom_element_set_attribute_node): Ditto.
(webkit_dom_element_remove_attribute_node): Ditto.
(webkit_dom_element_set_attribute_ns): Ditto.
(webkit_dom_element_set_attribute_node_ns): Ditto.
(webkit_dom_element_matches): Ditto.
(webkit_dom_element_closest): Ditto.
(webkit_dom_element_webkit_matches_selector): Ditto.
(webkit_dom_element_insert_adjacent_element): Ditto.
(webkit_dom_element_insert_adjacent_html): Ditto.
(webkit_dom_element_insert_adjacent_text): Ditto.
(webkit_dom_element_set_inner_html): Ditto.
(webkit_dom_element_set_outer_html): Ditto.
* WebProcess/InjectedBundle/API/mac/WKDOMElement.mm:
(-[WKDOMElement setAttribute:value:]): Ditto.

LayoutTests:

* fast/dom/resources/shadow-test-driver.js: Deleted. Unused.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@208135 268f45cc-cd09-0410-ab3c-d52691b4dbfc
34 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/dom/resources/shadow-test-driver.js [deleted file]
Source/WebCore/ChangeLog
Source/WebCore/bindings/js/JSCSSStyleDeclarationCustom.cpp
Source/WebCore/bindings/js/JSDOMStringMapCustom.cpp
Source/WebCore/bindings/js/JSStorageCustom.cpp
Source/WebCore/dom/DatasetDOMStringMap.cpp
Source/WebCore/dom/DatasetDOMStringMap.h
Source/WebCore/dom/Document.cpp
Source/WebCore/dom/Element.cpp
Source/WebCore/dom/Element.h
Source/WebCore/dom/Element.idl
Source/WebCore/dom/NamedNodeMap.cpp
Source/WebCore/dom/NamedNodeMap.h
Source/WebCore/dom/NamedNodeMap.idl
Source/WebCore/html/HTMLElement.cpp
Source/WebCore/inspector/DOMEditor.cpp
Source/WebCore/inspector/InspectorDOMAgent.cpp
Source/WebCore/inspector/InspectorDOMAgent.h
Source/WebCore/inspector/InspectorStyleSheet.cpp
Source/WebCore/testing/Internals.cpp
Source/WebCore/testing/Internals.idl
Source/WebCore/xml/parser/XMLDocumentParserLibxml2.cpp
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/DOM/DOMElement.mm
Source/WebKit/mac/DOM/DOMHTMLElement.mm
Source/WebKit/mac/DOM/DOMNamedNodeMap.mm
Source/WebKit/win/ChangeLog
Source/WebKit/win/DOMCoreClasses.cpp
Source/WebKit/win/DOMHTMLClasses.cpp
Source/WebKit2/ChangeLog
Source/WebKit2/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMElement.cpp
Source/WebKit2/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMNamedNodeMap.cpp
Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMElement.mm