Bug 234113

Summary: Add test case for execCommand to verify inserting an ordered list and deletion
Product: WebKit Reporter: Brandon <brandonstewart>
Component: HTML EditingAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: ap, cdumez, changseok, esprehn+autocc, ews-watchlist, gyuyoung.kim, rniwa, sabouhallawa, simon.fraser, webkit-bug-importer, wenson_hsieh
Priority: P2 Keywords: InRadar
Version: Other   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
patch
cdumez: review-, cdumez: commit-queue-
patch
ews-feeder: commit-queue-
patch
none
patch none

Brandon
Reported 2021-12-09 17:21:39 PST
Do not immediately execute an event if another event is ongoing
Attachments
patch (4.35 KB, patch)
2021-12-09 17:37 PST, Brandon
cdumez: review-
cdumez: commit-queue-
patch (4.82 KB, patch)
2021-12-10 13:19 PST, Brandon
ews-feeder: commit-queue-
patch (2.58 KB, patch)
2021-12-13 13:16 PST, Brandon
no flags
patch (2.58 KB, patch)
2021-12-13 13:32 PST, Brandon
no flags
Brandon
Comment 1 2021-12-09 17:23:10 PST
Brandon
Comment 2 2021-12-09 17:37:01 PST
Chris Dumez
Comment 3 2021-12-09 17:42:41 PST
Comment on attachment 446644 [details] patch View in context: https://bugs.webkit.org/attachment.cgi?id=446644&action=review > LayoutTests/ChangeLog:3 > + Do not immediately execute an event if another event is ongoing The title doesn't match the patch. Should be something like: The load & error events of an <img> element should be dispatched asynchronously.
Chris Dumez
Comment 4 2021-12-09 17:45:18 PST
Comment on attachment 446644 [details] patch View in context: https://bugs.webkit.org/attachment.cgi?id=446644&action=review > LayoutTests/ChangeLog:4 > + https://bugs.webkit.org/show_bug.cgi?id=234113 Please add the radar number on the next line: <rdar://86153015>
Chris Dumez
Comment 5 2021-12-10 07:58:15 PST
Comment on attachment 446644 [details] patch View in context: https://bugs.webkit.org/attachment.cgi?id=446644&action=review > Source/WebCore/html/HTMLImageLoader.cpp:64 > + element().document().queueTaskToDispatchEvent(TaskSource::DOMManipulation, WTFMove(event)); I was wrong, despite us setting the event target, Document::queueTaskToDispatchEvent() will dispatch the event at the Document (not the image element). You'll likely need to do something like this instead: ``` element.document().eventLoop().queueTask(TaskSource::DOMManipulation, [element = Ref { element() }, errorOccurred] { element.dispatchEvent(Event::create(errorOccurred ? eventNames().errorEvent : eventNames().loadEvent, Event::CanBubble::No, Event::IsCancelable::No)); }); ```
Brandon
Comment 6 2021-12-10 13:16:33 PST
<rdar://85926354> Radar number should be this one instead.
Brandon
Comment 7 2021-12-10 13:19:09 PST
Chris Dumez
Comment 8 2021-12-10 16:09:48 PST
Comment on attachment 446794 [details] patch View in context: https://bugs.webkit.org/attachment.cgi?id=446794&action=review > Source/WebCore/html/HTMLImageLoader.cpp:65 > + element().document().eventLoop().queueTask(TaskSource::DOMManipulation, [element = Ref { element() }, errorOccurred] { Many tests are failing. I think the issue is that the page load event can now fire *before* an image's load/error event. We likely need to delay the firing of the page's load event somehow. Or maybe we need to make something asynchronous earlier in the call stack instead. Do you have a stack trace of this event getting called synchronously in the context of your test? It would help determinate how to best fix this.
Chris Dumez
Comment 9 2021-12-10 16:15:28 PST
Comment on attachment 446794 [details] patch View in context: https://bugs.webkit.org/attachment.cgi?id=446794&action=review >> Source/WebCore/html/HTMLImageLoader.cpp:65 >> + element().document().eventLoop().queueTask(TaskSource::DOMManipulation, [element = Ref { element() }, errorOccurred] { > > Many tests are failing. I think the issue is that the page load event can now fire *before* an image's load/error event. We likely need to delay the firing of the page's load event somehow. Or maybe we need to make something asynchronous earlier in the call stack instead. > Do you have a stack trace of this event getting called synchronously in the context of your test? It would help determinate how to best fix this. Yes, I think it is likely one of the callers need to be fixed instead. You can see that some callers already call this function asynchronously (e.g. via `loadEventSender().dispatchEventSoon(*this);`) so adding a queueTask() here delays it one run loop iteration further.
Brandon
Comment 10 2021-12-13 13:16:13 PST
Brandon
Comment 11 2021-12-13 13:32:34 PST
Chris Dumez
Comment 12 2021-12-13 13:34:32 PST
Comment on attachment 447051 [details] patch r=me assuming the bots are happy.
EWS
Comment 13 2021-12-14 10:04:21 PST
Committed r287029 (245232@main): <https://commits.webkit.org/245232@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 447051 [details].
Note You need to log in before you can comment on or make changes to this bug.