Chromium Code Reviews| Index: Source/core/dom/Range.cpp |
| diff --git a/Source/core/dom/Range.cpp b/Source/core/dom/Range.cpp |
| index 0020d59410cc9e7d97e78678df1c14b96fb39b8b..0344cc667814a83245425880a2e2bcf4ad7cecc0 100644 |
| --- a/Source/core/dom/Range.cpp |
| +++ b/Source/core/dom/Range.cpp |
| @@ -894,8 +894,16 @@ void Range::insertNode(PassRefPtrWillBeRawPtr<Node> prpNewNode, ExceptionState& |
| if (exceptionState.hadException()) |
| return; |
| - if (collapsed) |
| + if (collapsed) { |
| + // The event would be fired regardless of EventQueueScope; |
|
Yuta Kitamura
2014/08/08 09:17:34
Please be clear that this is for the load event.
kangil_
2014/08/08 10:47:13
Done.
|
| + // e.g. by ContainerNode::updateTreeAfterInsertion |
| + // Given circumstance may mutate the tree so newText->parentNode() may become null |
| + if (!newText->parentNode()) { |
| + 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()) { |