Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(216)

Unified Diff: third_party/WebKit/Source/core/editing/commands/RemoveNodeCommand.cpp

Issue 1690513002: Editing: Pass failure information of RemoveNodeCommand to ReplaceSelectionCommand. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add a comment Created 4 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: third_party/WebKit/Source/core/editing/commands/RemoveNodeCommand.cpp
diff --git a/third_party/WebKit/Source/core/editing/commands/RemoveNodeCommand.cpp b/third_party/WebKit/Source/core/editing/commands/RemoveNodeCommand.cpp
index a9b8eade27f555d254c08ed0f069fde070dfa466..ddc352d0e1fb88e4946f9b79eaf87ba026fac8ce 100644
--- a/third_party/WebKit/Source/core/editing/commands/RemoveNodeCommand.cpp
+++ b/third_party/WebKit/Source/core/editing/commands/RemoveNodeCommand.cpp
@@ -27,6 +27,7 @@
#include "bindings/core/v8/ExceptionStatePlaceholder.h"
#include "core/dom/Node.h"
+#include "core/editing/commands/EditingState.h"
#include "wtf/Assertions.h"
namespace blink {
@@ -40,7 +41,7 @@ RemoveNodeCommand::RemoveNodeCommand(PassRefPtrWillBeRawPtr<Node> node, ShouldAs
ASSERT(m_node->parentNode());
}
-void RemoveNodeCommand::doApply(EditingState*)
+void RemoveNodeCommand::doApply(EditingState* editingState)
{
ContainerNode* parent = m_node->parentNode();
if (!parent || (m_shouldAssumeContentIsAlwaysEditable == DoNotAssumeContentIsAlwaysEditable
@@ -52,6 +53,11 @@ void RemoveNodeCommand::doApply(EditingState*)
m_refChild = m_node->nextSibling();
m_node->remove(IGNORE_EXCEPTION);
+ // Node::remove dispatch synchronous events such as IFRAME unload events,
+ // and event handlers may break the document. We check the document state
+ // here in order to prevent further processing in bad situation.
+ ASSERT_IN_EDITING_COMMAND(m_node->document().frame());
+ ASSERT_IN_EDITING_COMMAND(m_node->document().documentElement());
}
void RemoveNodeCommand::doUnapply()

Powered by Google App Engine
This is Rietveld 408576698