Shink attribute event listener code
authordarin@apple.com <darin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 21 Sep 2013 18:25:43 +0000 (18:25 +0000)
committerdarin@apple.com <darin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 21 Sep 2013 18:25:43 +0000 (18:25 +0000)
commit11731c3ba787c9b7556e1a6a35ab46873780c996
tree97bf59b6312569be593633eb5ddd86680e8156c6
parentf365f6d5a4c2913f0b956b8e9206c6b6d8739066
Shink attribute event listener code
https://bugs.webkit.org/show_bug.cgi?id=121735

Reviewed by Antti Koivisto.

* GNUmakefile.list.am: Eliminate ScriptEventListener source files.
* Target.pri: Ditto.
* UseJSC.cmake: Ditto.
* WebCore.vcxproj/WebCore.vcxproj: Ditto.
* WebCore.vcxproj/WebCore.vcxproj.filters: Ditto.
* WebCore.xcodeproj/project.pbxproj: Ditto.
* bindings/js/JSBindingsAllInOne.cpp: Ditto.

* bindings/js/JSDOMGlobalObject.h: Removed unneeded forward declarations
of JSEventListener and JSLazyEventListener.

* bindings/js/JSLazyEventListener.cpp:
(WebCore::JSLazyEventListener::JSLazyEventListener): Changed type to
ContainerNode because the node pointer is only ever used for elements
and documents.
(WebCore::eventParameterName): Moved this function here from
ScriptEventListener.cpp, but also rewrote to use NeverDestroyed.
(WebCore::JSLazyEventListener::createForNode): Moved this function
here from ScriptEventListener.cpp, cleaned up a bit.
(WebCore::JSLazyEventListener::createForDOMWindow): Ditto.

* bindings/js/JSLazyEventListener.h: Replaced the old create function
with two new create functions we can use directly. Also used some
OVERRIDE, some FINAL, and a bit of WTF_DELETED_FUNCTION so we don't
accidentally call create and create a non-lazy listener.

* bindings/js/ScriptEventListener.cpp: Removed.
* bindings/js/ScriptEventListener.h: Removed.

* dom/ContainerNode.cpp:
(WebCore::ContainerNode::setAttributeEventListener): Added.
Calls JSLazyEventListener::createForNode and then calls the other
overload of setAttributeEventListener, to obviate having more code
at the call site.
* dom/ContainerNode.h: Added overload of setAttributeEventListener
for convenient use in Document and Element implementations.

* dom/Document.cpp:
(WebCore::Document::prepareForDestruction): Use m_domWindow instead
of the domWindow() function.
(WebCore::Document::removeAllEventListeners): Ditto.
(WebCore::Document::errorEventTarget): Ditto.
(WebCore::Document::takeDOMWindowFrom): Ditto.
(WebCore::Document::setWindowAttributeEventListener): Ditto. Also
added an overload that calls JSLazyEventListener::createForDOMWindow.
(WebCore::Document::getWindowAttributeEventListener): Use m_domWindow.
(WebCore::Document::dispatchWindowEvent): Ditto.
(WebCore::Document::dispatchWindowLoadEvent): Ditto.
(WebCore::Document::enqueueWindowEvent): Ditto.
(WebCore::Document::enqueuePopstateEvent): Ditto.
* dom/Document.h: Added overload of setWindowAttributeEventListener.

* html/HTMLBodyElement.cpp: Removed unnneded include.
(WebCore::HTMLBodyElement::parseAttribute): Removed all the calls to
createAttributeEventListener, and use the setAttributeEventListener
overloads instead.
* html/HTMLButtonElement.cpp: Ditto.
* html/HTMLElement.cpp:
(WebCore::HTMLElement::parseAttribute): Ditto.
* html/HTMLFormControlElement.cpp: Ditto.
* html/HTMLFormElement.cpp: Ditto.
* html/HTMLFrameElementBase.cpp:
(WebCore::HTMLFrameElementBase::parseAttribute): Ditto.
* html/HTMLFrameSetElement.cpp:
(WebCore::HTMLFrameSetElement::parseAttribute): Ditto.
* html/HTMLImageElement.cpp:
(WebCore::HTMLImageElement::parseAttribute): Ditto.
* html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::parseAttribute): Ditto.
* html/HTMLLinkElement.cpp:
(WebCore::HTMLLinkElement::parseAttribute): Ditto.
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::parseAttribute): Ditto.
* html/HTMLObjectElement.cpp:
(WebCore::HTMLObjectElement::parseAttribute): Ditto.
* html/HTMLScriptElement.cpp:
(WebCore::HTMLScriptElement::parseAttribute): Ditto.
* html/HTMLSelectElement.cpp: Ditto.
* html/HTMLStyleElement.cpp: Ditto.
* html/HTMLTextFormControlElement.cpp: Ditto.
* html/HTMLTrackElement.cpp: Ditto.
* html/track/LoadableTextTrack.cpp: Ditto.
* svg/SVGElement.cpp:
(WebCore::SVGElement::parseAttribute): Ditto.
* svg/SVGSVGElement.cpp:
(WebCore::SVGSVGElement::parseAttribute): Ditto.
* svg/SVGScriptElement.cpp:
(WebCore::SVGScriptElement::parseAttribute): Ditto.

* inspector/InspectorDOMAgent.cpp:
(WebCore::InspectorDOMAgent::buildObjectForEventListener):
Moved the code here to dig inside a JSEventListener for things like
the source location. This used to be spread across multiple function
calls in ScriptEventListener.h, which were doing and redoing the same
things, so better to just get it all at once.

* html/parser/XSSAuditor.cpp:
(WebCore::XSSAuditor::init): Fixed "minium" typo.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@156231 268f45cc-cd09-0410-ab3c-d52691b4dbfc
40 files changed:
Source/WebCore/ChangeLog
Source/WebCore/GNUmakefile.list.am
Source/WebCore/Target.pri
Source/WebCore/UseJSC.cmake
Source/WebCore/WebCore.vcxproj/WebCore.vcxproj
Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/bindings/js/JSBindingsAllInOne.cpp
Source/WebCore/bindings/js/JSDOMGlobalObject.h
Source/WebCore/bindings/js/JSLazyEventListener.cpp
Source/WebCore/bindings/js/JSLazyEventListener.h
Source/WebCore/bindings/js/ScriptEventListener.cpp [deleted file]
Source/WebCore/bindings/js/ScriptEventListener.h [deleted file]
Source/WebCore/dom/ContainerNode.cpp
Source/WebCore/dom/ContainerNode.h
Source/WebCore/dom/Document.cpp
Source/WebCore/dom/Document.h
Source/WebCore/html/HTMLBodyElement.cpp
Source/WebCore/html/HTMLButtonElement.cpp
Source/WebCore/html/HTMLElement.cpp
Source/WebCore/html/HTMLFormControlElement.cpp
Source/WebCore/html/HTMLFormElement.cpp
Source/WebCore/html/HTMLFrameElementBase.cpp
Source/WebCore/html/HTMLFrameSetElement.cpp
Source/WebCore/html/HTMLImageElement.cpp
Source/WebCore/html/HTMLInputElement.cpp
Source/WebCore/html/HTMLLinkElement.cpp
Source/WebCore/html/HTMLMediaElement.cpp
Source/WebCore/html/HTMLObjectElement.cpp
Source/WebCore/html/HTMLScriptElement.cpp
Source/WebCore/html/HTMLSelectElement.cpp
Source/WebCore/html/HTMLStyleElement.cpp
Source/WebCore/html/HTMLTextFormControlElement.cpp
Source/WebCore/html/HTMLTrackElement.cpp
Source/WebCore/html/parser/XSSAuditor.cpp
Source/WebCore/html/track/LoadableTextTrack.cpp
Source/WebCore/inspector/InspectorDOMAgent.cpp
Source/WebCore/svg/SVGElement.cpp
Source/WebCore/svg/SVGSVGElement.cpp
Source/WebCore/svg/SVGScriptElement.cpp