[SVG] load events shouldn't be fired during Node::insrtedInto()
https://bugs.webkit.org/show_bug.cgi?id=92969

Reviewed by Ryosuke Niwa.

Source/WebCore:

Event dispatches during insertedInto() allow event handlers to
break DOM tree cosistency. This chagne makes them async for load
events which are dispatched during insertedInto() call. This
prevents event handlers from breaking tree consistency while the
notification traversal.

Test: svg/custom/loadevents-async.html

* svg/SVGElement.cpp:
(WebCore::SVGElement::sendSVGLoadEventIfPossibleAsynchronously): Added.
(WebCore):
(WebCore::SVGElement::svgLoadEventTimerFired): Added.
(WebCore::SVGElement::svgLoadEventTimer):
- Added a stub. Implemented in SVGScriptElement, SVGStopElement, SVGUseElement
  where the load event happens.
* svg/SVGElement.h:
(SVGElement):
* svg/SVGExternalResourcesRequired.cpp:
(WebCore::SVGExternalResourcesRequired::insertedIntoDocument):
- Replaces event dispatch call with async version.
* svg/SVGScriptElement.h:
* svg/SVGStyleElement.h:
* svg/SVGUseElement.h:

LayoutTests:

* svg/custom/loadevents-async-expected.txt: Added.
* svg/custom/loadevents-async.html: Added.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@125147 268f45cc-cd09-0410-ab3c-d52691b4dbfc
13 files changed