[iOS Debug] ASSERTION FAILED: !m_originalNode in WebCore::JSLazyEventListener::checkV...
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 9 May 2019 01:34:05 +0000 (01:34 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 9 May 2019 01:34:05 +0000 (01:34 +0000)
commitfed5e73c80225718b45a3604413073e576b17114
tree10a4151cd6e696eddd8b9520e45c5e02147a1589
parentde2319983e55b430f34ce3e3d8eff6d02684df2c
[iOS Debug] ASSERTION FAILED: !m_originalNode in WebCore::JSLazyEventListener::checkValidityForEventTarget(WebCore::EventTarget &)
https://bugs.webkit.org/show_bug.cgi?id=197696
<rdar://problem/50586956>

Reviewed by Simon Fraser.

Source/WebCore:

Setting the onorientationchange / onresize event handler on the body should set the event handler on the
window object, as per the HTML specification. However, calling body.addEventListener() with 'orientationchange'
or 'resize' should not set the event listener on the window object, only the body. Blink and Gecko seem to
behave as per specification but WebKit had a quirk for the addEventListener case. The quirk's implementation
is slightly wrong (because it is unsafe to take a JSLazyEventListener from a body element and add it to the
window, given that the JSLazyEventListener keeps a raw pointer to its element) and was causing crashes such
as <rdar://problem/24314027>. As a result, this patch simply drops the WebKit quirk, which will align our
behavior with other browsers and fix the crashes altogether.

Test: fast/events/ios/rotation/orientationchange-event-listener-on.body.html

* dom/Node.cpp:
(WebCore::tryAddEventListener):
(WebCore::tryRemoveEventListener):

LayoutTests:

Add layout test coverage.

* fast/events/ios/rotation/orientationchange-event-listener-on.body-expected.txt: Added.
* fast/events/ios/rotation/orientationchange-event-listener-on.body.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@245086 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/fast/events/ios/rotation/orientationchange-event-listener-on.body-expected.txt [new file with mode: 0644]
LayoutTests/fast/events/ios/rotation/orientationchange-event-listener-on.body.html [new file with mode: 0644]
LayoutTests/platform/ios/fast/dom/event-handler-attributes-expected.txt [deleted file]
LayoutTests/platform/ios/legacy-animation-engine/fast/dom/event-handler-attributes-expected.txt [deleted file]
Source/WebCore/ChangeLog
Source/WebCore/dom/Node.cpp