As per Dimitri's comments on bug https://bugs.webkit.org/show_bug.cgi?id=48345, we should prevent direct event-type() querying in various places e.g. void ImageEventListener::handleEvent(ScriptExecutionContext*, Event* event) { if (event->type() == eventNames().resizeEvent) m_doc->windowSizeChanged(); else if (event->type() == eventNames().clickEvent) { MouseEvent* mouseEvent = static_cast<MouseEvent*>(event); And replace with a generic wrapper like isMouseClickEvent(event) which does the 1) event type check - event->type() == eventNames().clickEvent 2) event cast check - event->isMouseEvent
When searching for "ImageEventListener", I can only find single source in Webkit Github: https://github.com/WebKit/WebKit/blob/50d7e0b0b808afca93e5ede9cd7c0d44b1ed8130/Source/WebCore/html/ImageDocument.cpp#L62 Is this in relation to above? Or this is no longer applicable. Thanks!
We don't have this idea implemented, but we use safer casting. I'll leave it to others to decide if this is still worth tracking. Currently, the code looks like this: void ImageEventListener::handleEvent(ScriptExecutionContext&, Event& event) { if (event.type() == eventNames().resizeEvent) m_document.windowSizeChanged(); else if (event.type() == eventNames().clickEvent && is<MouseEvent>(event)) { MouseEvent& mouseEvent = downcast<MouseEvent>(event);