haikuwebkit/LayoutTests/editing/undo
commit-queue@webkit.org f784a970c8 Nullptr crash in EventPath::eventTargetRespectingTargetRules
https://bugs.webkit.org/show_bug.cgi?id=222718

Patch by Frédéric Wang <fwang@igalia.com> on 2021-04-06
Reviewed by Ryosuke Niwa.

Source/WebCore:

During executions of "undo" and "redo" commands, beforeinput and input events are dispatched
on root editable elements. It is however possible that these elements had been disconnected,
causing nullptr crash. This patch exits the command execution early if that's the case.

Test: editing/undo/undo-with-disconnected-editable-element-crash.html

* editing/CompositeEditCommand.cpp:
(WebCore::EditCommandComposition::areRootEditabledElementsConnected): Add helper function
to check whether m_startingRootEditableElement and m_endingRootEditableElement are still
connected.
(WebCore::EditCommandComposition::unapply): Exit early if root editable elements are no
longer connected. Put this after the layout update.
(WebCore::EditCommandComposition::reapply): Ditto.
* editing/CompositeEditCommand.h: Declare new helper function.

LayoutTests:

Add regression test.

* editing/undo/undo-with-disconnected-editable-element-crash-expected.txt: Added.
* editing/undo/undo-with-disconnected-editable-element-crash.html: Added.
* editing/undo/undo-with-disconnected-editable-element-crash.js: Added.
(runTests.window.parent.onwebkitanimationiteration):
(runTests):

Canonical link: https://commits.webkit.org/236155@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@275498 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-04-06 09:22:20 +00:00
..
4059423-1-expected.txt
4059423-1.html
4059423-2-expected.txt
4059423-2.html
4063751.html
5378473-expected.txt
5378473.html
5658727-expected.txt
5658727.html
5738768-expected.txt
5738768.html
audio-in-undo-stack-crash-expected.txt
audio-in-undo-stack-crash.html
orphaned-selection-crash-bug32823-1-expected.txt
orphaned-selection-crash-bug32823-1.html
orphaned-selection-crash-bug32823-2-expected.txt
orphaned-selection-crash-bug32823-2.html
orphaned-selection-crash-bug32823-3-expected.txt
orphaned-selection-crash-bug32823-3.html
orphaned-selection-crash-bug32823-4-expected.txt
orphaned-selection-crash-bug32823-4.html
redo-after-detach-expected.txt
redo-after-detach.html
redo-split-text-node-expected.txt
redo-split-text-node.html
redo-split-text-with-removal-expected.txt
redo-split-text-with-removal.html
redo-style-expected.txt
redo-style.html
redo-text-insertion-in-non-editable-node-expected.txt
redo-text-insertion-in-non-editable-node.html
redo-typing-001-expected.txt
redo-typing-001.html
remove-css-property-and-remove-style-expected.txt
remove-css-property-and-remove-style.html
replace-by-span-then-remove-expected.txt
replace-by-span-then-remove.html
replace-text-in-node-preserving-markers-crash-expected.txt
replace-text-in-node-preserving-markers-crash.html
undo-after-event-edited-expected.txt
undo-after-event-edited.html Selection API: Fix more editing tests that rely on non-standard selection API behavior 2020-10-05 19:57:42 +00:00
undo-after-setting-value-expected.txt
undo-after-setting-value.html
undo-combined-delete-boundary.html
undo-combined-delete.html
undo-delete-boundary.html
undo-delete.html
undo-deleteWord-expected.txt
undo-deleteWord.html
undo-forward-delete-boundary.html
undo-forward-delete.html
undo-iframe-location-change-expected.txt
undo-iframe-location-change.html
undo-indent-expected.txt
undo-indent-noneditable-expected.txt
undo-indent-noneditable.html
undo-indent.html
undo-misspellings-expected.txt
undo-misspellings.html
undo-paste-when-caret-is-not-in-range-expected.txt
undo-paste-when-caret-is-not-in-range.html
undo-smart-delete-reversed-selection-expected.txt
undo-smart-delete-reversed-selection.html
undo-smart-delete-word-expected.txt
undo-smart-delete-word.html
undo-typing-001-expected.txt
undo-typing-001.html
undo-with-disconnected-editable-element-crash-expected.txt Nullptr crash in EventPath::eventTargetRespectingTargetRules 2021-04-06 09:22:20 +00:00
undo-with-disconnected-editable-element-crash.html Nullptr crash in EventPath::eventTargetRespectingTargetRules 2021-04-06 09:22:20 +00:00
undo-with-disconnected-editable-element-crash.js Nullptr crash in EventPath::eventTargetRespectingTargetRules 2021-04-06 09:22:20 +00:00