Index: Source/core/dom/Range.cpp |
diff --git a/Source/core/dom/Range.cpp b/Source/core/dom/Range.cpp |
index 0020d59410cc9e7d97e78678df1c14b96fb39b8b..eb1ef036103a84722028992973a2850e404e933e 100644 |
--- a/Source/core/dom/Range.cpp |
+++ b/Source/core/dom/Range.cpp |
@@ -894,8 +894,13 @@ void Range::insertNode(PassRefPtrWillBeRawPtr<Node> prpNewNode, ExceptionState& |
if (exceptionState.hadException()) |
return; |
- if (collapsed) |
+ if (collapsed) { |
+ if (!newText->parentNode()) { |
Yuta Kitamura
2014/08/07 09:30:41
I wonder how newText->parentNode() becomes null.
kangil_
2014/08/07 09:59:50
insertBefore() will trigger Container::insertBefor
Yuta Kitamura
2014/08/08 04:27:55
That's weird. We are within a scope of EventQueueS
kangil_
2014/08/08 04:52:25
load event is fired.
When range.surroundContents(
Yuta Kitamura
2014/08/08 05:25:07
I'm lost somewhere between ContainerNode::notifyNo
|
+ exceptionState.throwDOMException(HierarchyRequestError, "This operation would set range's end to parent with new offset, but there's no parent into which to continue."); |
+ return; |
+ } |
m_end.setToBeforeChild(*newText); |
+ } |
} else { |
RefPtrWillBeRawPtr<Node> lastChild = (newNodeType == Node::DOCUMENT_FRAGMENT_NODE) ? toDocumentFragment(newNode)->lastChild() : newNode.get(); |
if (lastChild && lastChild == m_start.childBefore()) { |