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

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

Issue 364293004: CANCEL: Make Range::insertNode to validate new end boundary point before using it (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 5 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 645bdf5cbeedac7db4fe83c644799172e78acaa1..626e0b77a9824e4d7422c2019f4c09a0897e4ac7 100644
--- a/Source/core/dom/Range.cpp
+++ b/Source/core/dom/Range.cpp
@@ -895,11 +895,13 @@ void Range::insertNode(PassRefPtrWillBeRawPtr<Node> prpNewNode, ExceptionState&
return;
container = m_start.container();
+ // When |newNode| is IFRAME, |newText| can be removed from current
+ // document by "load" event handler.
container->parentNode()->insertBefore(newNode.release(), newText.get(), exceptionState);
if (exceptionState.hadException())
return;
- if (collapsed)
+ if (collapsed && newText->parentNode() && newText->ownerDocument() == m_ownerDocument)
Yuta Kitamura 2014/07/04 07:11:33 Is "newText->parentNode()" necessary?
yosin_UTC9 2014/07/04 08:45:16 Yes, the issue is caused by |newText->parentNode()
m_end.setToBeforeChild(*newText);
} else {
RefPtrWillBeRawPtr<Node> lastChild = (newNodeType == Node::DOCUMENT_FRAGMENT_NODE) ? toDocumentFragment(newNode)->lastChild() : newNode.get();

Powered by Google App Engine
This is Rietveld 408576698