Chromium Code Reviews (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out

Unified Diff: Source/core/dom/Range.cpp

Issue 181283002: Fixing a crash in InsertListCommand. (Closed) Base URL:
Patch Set: Update Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/dom/Range.cpp
diff --git a/Source/core/dom/Range.cpp b/Source/core/dom/Range.cpp
index 85906a831541882178e89be7e9c85b864e07bc3a..53a081d175f13e58a51dee60b31a953d1ef101cc 100644
--- a/Source/core/dom/Range.cpp
+++ b/Source/core/dom/Range.cpp
@@ -901,7 +901,10 @@ PassRefPtr<Node> Range::processAncestorsAndTheirSiblings(ActionType action, Node
Node* child = it->get();
switch (action) {
- ancestor->removeChild(child, exceptionState);
+ // Prior call of ancestor->removeChild() may cause a tree change due to DOMSubtreeModified event.
+ // Therefore, we need to make sure |ancestor| is still |child|'s parent.
+ if (ancestor == child->parentNode())
+ ancestor->removeChild(child, exceptionState);
case EXTRACT_CONTENTS: // will remove child from ancestor
if (direction == ProcessContentsForward)
« no previous file with comments | « LayoutTests/editing/execCommand/insert-ordered-list-crash-expected.txt ('k') | Source/core/editing/InsertListCommand.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698