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

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: 2014-07-04T05:04:32 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
« no previous file with comments | « LayoutTests/fast/dom/Range/surroundContents-iframe-crash-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/Range.cpp
diff --git a/Source/core/dom/Range.cpp b/Source/core/dom/Range.cpp
index 645bdf5cbeedac7db4fe83c644799172e78acaa1..d211ca03c2abfaa9090bd2ed705809f9442b6bd2 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())
m_end.setToBeforeChild(*newText);
} else {
RefPtrWillBeRawPtr<Node> lastChild = (newNodeType == Node::DOCUMENT_FRAGMENT_NODE) ? toDocumentFragment(newNode)->lastChild() : newNode.get();
« no previous file with comments | « LayoutTests/fast/dom/Range/surroundContents-iframe-crash-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698