| Index: Source/core/dom/Range.cpp
|
| diff --git a/Source/core/dom/Range.cpp b/Source/core/dom/Range.cpp
|
| index 48c83b83e67f3e398550ae5af3e41797d57ae7bc..2ee4214a653b9575a8471f46c5ea5b98cef6231f 100644
|
| --- a/Source/core/dom/Range.cpp
|
| +++ b/Source/core/dom/Range.cpp
|
| @@ -131,7 +131,7 @@ void Range::setDocument(Document& document)
|
| Node* Range::startContainer(ExceptionState& es) const
|
| {
|
| if (!m_start.container()) {
|
| - es.throwDOMException(InvalidStateError);
|
| + es.throwDOMException(InvalidStateError, ExceptionMessages::failedToExecute("startContainer", "Range", "The range has no container. Perhaps 'detatch()' has been invoked on this object?"));
|
| return 0;
|
| }
|
|
|
| @@ -141,7 +141,7 @@ Node* Range::startContainer(ExceptionState& es) const
|
| int Range::startOffset(ExceptionState& es) const
|
| {
|
| if (!m_start.container()) {
|
| - es.throwDOMException(InvalidStateError);
|
| + es.throwDOMException(InvalidStateError, ExceptionMessages::failedToExecute("startOffset", "Range", "The range has no container. Perhaps 'detatch()' has been invoked on this object?"));
|
| return 0;
|
| }
|
|
|
| @@ -151,7 +151,7 @@ int Range::startOffset(ExceptionState& es) const
|
| Node* Range::endContainer(ExceptionState& es) const
|
| {
|
| if (!m_start.container()) {
|
| - es.throwDOMException(InvalidStateError);
|
| + es.throwDOMException(InvalidStateError, ExceptionMessages::failedToExecute("endContainer", "Range", "The range has no container. Perhaps 'detatch()' has been invoked on this object?"));
|
| return 0;
|
| }
|
|
|
| @@ -161,7 +161,7 @@ Node* Range::endContainer(ExceptionState& es) const
|
| int Range::endOffset(ExceptionState& es) const
|
| {
|
| if (!m_start.container()) {
|
| - es.throwDOMException(InvalidStateError);
|
| + es.throwDOMException(InvalidStateError, ExceptionMessages::failedToExecute("endOffset", "Range", "The range has no container. Perhaps 'detatch()' has been invoked on this object?"));
|
| return 0;
|
| }
|
|
|
| @@ -171,7 +171,7 @@ int Range::endOffset(ExceptionState& es) const
|
| Node* Range::commonAncestorContainer(ExceptionState& es) const
|
| {
|
| if (!m_start.container()) {
|
| - es.throwDOMException(InvalidStateError);
|
| + es.throwDOMException(InvalidStateError, ExceptionMessages::failedToExecute("commonAncestorContainer", "Range", "The range has no container. Perhaps 'detatch()' has been invoked on this object?"));
|
| return 0;
|
| }
|
|
|
| @@ -192,7 +192,7 @@ Node* Range::commonAncestorContainer(Node* containerA, Node* containerB)
|
| bool Range::collapsed(ExceptionState& es) const
|
| {
|
| if (!m_start.container()) {
|
| - es.throwDOMException(InvalidStateError);
|
| + es.throwDOMException(InvalidStateError, ExceptionMessages::failedToExecute("collapsed", "Range", "The range has no container. Perhaps 'detatch()' has been invoked on this object?"));
|
| return 0;
|
| }
|
|
|
| @@ -214,7 +214,7 @@ static inline bool checkForDifferentRootContainer(const RangeBoundaryPoint& star
|
| void Range::setStart(PassRefPtr<Node> refNode, int offset, ExceptionState& es)
|
| {
|
| if (!m_start.container()) {
|
| - es.throwDOMException(InvalidStateError);
|
| + es.throwDOMException(InvalidStateError, ExceptionMessages::failedToExecute("setStart", "Range", "The range has no container. Perhaps 'detatch()' has been invoked on this object?"));
|
| return;
|
| }
|
|
|
| @@ -242,7 +242,7 @@ void Range::setStart(PassRefPtr<Node> refNode, int offset, ExceptionState& es)
|
| void Range::setEnd(PassRefPtr<Node> refNode, int offset, ExceptionState& es)
|
| {
|
| if (!m_start.container()) {
|
| - es.throwDOMException(InvalidStateError);
|
| + es.throwDOMException(InvalidStateError, ExceptionMessages::failedToExecute("setEnd", "Range", "The range has no container. Perhaps 'detatch()' has been invoked on this object?"));
|
| return;
|
| }
|
|
|
| @@ -282,7 +282,7 @@ void Range::setEnd(const Position& end, ExceptionState& es)
|
| void Range::collapse(bool toStart, ExceptionState& es)
|
| {
|
| if (!m_start.container()) {
|
| - es.throwDOMException(InvalidStateError);
|
| + es.throwDOMException(InvalidStateError, ExceptionMessages::failedToExecute("collapse", "Range", "The range has no container. Perhaps 'detatch()' has been invoked on this object?"));
|
| return;
|
| }
|
|
|
| @@ -295,7 +295,7 @@ void Range::collapse(bool toStart, ExceptionState& es)
|
| bool Range::isPointInRange(Node* refNode, int offset, ExceptionState& es)
|
| {
|
| if (!m_start.container()) {
|
| - es.throwDOMException(InvalidStateError);
|
| + es.throwDOMException(InvalidStateError, ExceptionMessages::failedToExecute("isPointInRange", "Range", "The range has no container. Perhaps 'detatch()' has been invoked on this object?"));
|
| return false;
|
| }
|
|
|
| @@ -323,7 +323,7 @@ short Range::comparePoint(Node* refNode, int offset, ExceptionState& es) const
|
| // refNode node and an offset within the node is before, same as, or after the range respectively.
|
|
|
| if (!m_start.container()) {
|
| - es.throwDOMException(InvalidStateError);
|
| + es.throwDOMException(InvalidStateError, ExceptionMessages::failedToExecute("comparePoint", "Range", "The range has no container. Perhaps 'detatch()' has been invoked on this object?"));
|
| return 0;
|
| }
|
|
|
| @@ -406,7 +406,7 @@ Range::CompareResults Range::compareNode(Node* refNode, ExceptionState& es) cons
|
| short Range::compareBoundaryPoints(CompareHow how, const Range* sourceRange, ExceptionState& es) const
|
| {
|
| if (!m_start.container()) {
|
| - es.throwDOMException(InvalidStateError);
|
| + es.throwDOMException(InvalidStateError, ExceptionMessages::failedToExecute("compareBoundaryPoints", "Range", "The range has no container. Perhaps 'detatch()' has been invoked on this object?"));
|
| return 0;
|
| }
|
|
|
| @@ -559,7 +559,7 @@ bool Range::boundaryPointsValid() const
|
|
|
| void Range::deleteContents(ExceptionState& es)
|
| {
|
| - checkDeleteExtract(es);
|
| + checkDeleteExtract("deleteContents", es);
|
| if (es.hadException())
|
| return;
|
|
|
| @@ -573,7 +573,7 @@ bool Range::intersectsNode(Node* refNode, ExceptionState& es)
|
|
|
| // Throw exception if the range is already detached.
|
| if (!m_start.container()) {
|
| - es.throwDOMException(InvalidStateError);
|
| + es.throwDOMException(InvalidStateError, ExceptionMessages::failedToExecute("intersectsNode", "Range", "The range has no container. Perhaps 'detatch()' has been invoked on this object?"));
|
| return false;
|
| }
|
| if (!refNode) {
|
| @@ -928,7 +928,7 @@ PassRefPtr<Node> Range::processAncestorsAndTheirSiblings(ActionType action, Node
|
|
|
| PassRefPtr<DocumentFragment> Range::extractContents(ExceptionState& es)
|
| {
|
| - checkDeleteExtract(es);
|
| + checkDeleteExtract("extractContents", es);
|
| if (es.hadException())
|
| return 0;
|
|
|
| @@ -938,7 +938,7 @@ PassRefPtr<DocumentFragment> Range::extractContents(ExceptionState& es)
|
| PassRefPtr<DocumentFragment> Range::cloneContents(ExceptionState& es)
|
| {
|
| if (!m_start.container()) {
|
| - es.throwDOMException(InvalidStateError);
|
| + es.throwDOMException(InvalidStateError, ExceptionMessages::failedToExecute("cloneContents", "Range", "The range has no container. Perhaps 'detatch()' has been invoked on this object?"));
|
| return 0;
|
| }
|
|
|
| @@ -950,7 +950,7 @@ void Range::insertNode(PassRefPtr<Node> prpNewNode, ExceptionState& es)
|
| RefPtr<Node> newNode = prpNewNode;
|
|
|
| if (!m_start.container()) {
|
| - es.throwDOMException(InvalidStateError);
|
| + es.throwDOMException(InvalidStateError, ExceptionMessages::failedToExecute("insertNode", "Range", "The range has no container. Perhaps 'detatch()' has been invoked on this object?"));
|
| return;
|
| }
|
|
|
| @@ -1055,7 +1055,7 @@ void Range::insertNode(PassRefPtr<Node> prpNewNode, ExceptionState& es)
|
| String Range::toString(ExceptionState& es) const
|
| {
|
| if (!m_start.container()) {
|
| - es.throwDOMException(InvalidStateError);
|
| + es.throwDOMException(InvalidStateError, ExceptionMessages::failedToExecute("toString", "Range", "The range has no container. Perhaps 'detatch()' has been invoked on this object?"));
|
| return String();
|
| }
|
|
|
| @@ -1095,7 +1095,7 @@ String Range::text() const
|
| PassRefPtr<DocumentFragment> Range::createContextualFragment(const String& markup, ExceptionState& es)
|
| {
|
| if (!m_start.container()) {
|
| - es.throwDOMException(InvalidStateError);
|
| + es.throwDOMException(InvalidStateError, ExceptionMessages::failedToExecute("createContextualFragment", "Range", "The range has no container. Perhaps 'detatch()' has been invoked on this object?"));
|
| return 0;
|
| }
|
|
|
| @@ -1117,7 +1117,7 @@ void Range::detach(ExceptionState& es)
|
| {
|
| // Check first to see if we've already detached:
|
| if (!m_start.container()) {
|
| - es.throwDOMException(InvalidStateError);
|
| + es.throwDOMException(InvalidStateError, ExceptionMessages::failedToExecute("detach", "Range", "The range has no container. Perhaps 'detatch()' has been invoked on this object?"));
|
| return;
|
| }
|
|
|
| @@ -1162,10 +1162,10 @@ Node* Range::checkNodeWOffset(Node* n, int offset, ExceptionState& es) const
|
| return 0;
|
| }
|
|
|
| -void Range::checkNodeBA(Node* n, ExceptionState& es, const char* methodName) const
|
| +void Range::checkNodeBA(Node* n, const String& methodName, ExceptionState& es) const
|
| {
|
| if (!m_start.container()) {
|
| - es.throwDOMException(InvalidStateError);
|
| + es.throwDOMException(InvalidStateError, ExceptionMessages::failedToExecute(methodName, "Range", "The range has no container. Perhaps 'detatch()' has been invoked on this object?"));
|
| return;
|
| }
|
|
|
| @@ -1227,7 +1227,7 @@ void Range::checkNodeBA(Node* n, ExceptionState& es, const char* methodName) con
|
| PassRefPtr<Range> Range::cloneRange(ExceptionState& es) const
|
| {
|
| if (!m_start.container()) {
|
| - es.throwDOMException(InvalidStateError);
|
| + es.throwDOMException(InvalidStateError, ExceptionMessages::failedToExecute("cloneRange", "Range", "The range has no container. Perhaps 'detatch()' has been invoked on this object?"));
|
| return 0;
|
| }
|
|
|
| @@ -1236,7 +1236,7 @@ PassRefPtr<Range> Range::cloneRange(ExceptionState& es) const
|
|
|
| void Range::setStartAfter(Node* refNode, ExceptionState& es)
|
| {
|
| - checkNodeBA(refNode, es, "setStartAfter");
|
| + checkNodeBA(refNode, "setStartAfter", es);
|
| if (es.hadException())
|
| return;
|
|
|
| @@ -1245,7 +1245,7 @@ void Range::setStartAfter(Node* refNode, ExceptionState& es)
|
|
|
| void Range::setEndBefore(Node* refNode, ExceptionState& es)
|
| {
|
| - checkNodeBA(refNode, es, "setEndBefore");
|
| + checkNodeBA(refNode, "setEndBefore", es);
|
| if (es.hadException())
|
| return;
|
|
|
| @@ -1254,7 +1254,7 @@ void Range::setEndBefore(Node* refNode, ExceptionState& es)
|
|
|
| void Range::setEndAfter(Node* refNode, ExceptionState& es)
|
| {
|
| - checkNodeBA(refNode, es, "setEndAfter");
|
| + checkNodeBA(refNode, "setEndAfter", es);
|
| if (es.hadException())
|
| return;
|
|
|
| @@ -1264,7 +1264,7 @@ void Range::setEndAfter(Node* refNode, ExceptionState& es)
|
| void Range::selectNode(Node* refNode, ExceptionState& es)
|
| {
|
| if (!m_start.container()) {
|
| - es.throwDOMException(InvalidStateError);
|
| + es.throwDOMException(InvalidStateError, ExceptionMessages::failedToExecute("selectNode", "Range", "The range has no container. Perhaps 'detatch()' has been invoked on this object?"));
|
| return;
|
| }
|
|
|
| @@ -1329,7 +1329,7 @@ void Range::selectNode(Node* refNode, ExceptionState& es)
|
| void Range::selectNodeContents(Node* refNode, ExceptionState& es)
|
| {
|
| if (!m_start.container()) {
|
| - es.throwDOMException(InvalidStateError);
|
| + es.throwDOMException(InvalidStateError, ExceptionMessages::failedToExecute("selectNodeContents", "Range", "The range has no container. Perhaps 'detatch()' has been invoked on this object?"));
|
| return;
|
| }
|
|
|
| @@ -1372,7 +1372,7 @@ void Range::surroundContents(PassRefPtr<Node> passNewParent, ExceptionState& es)
|
| RefPtr<Node> newParent = passNewParent;
|
|
|
| if (!m_start.container()) {
|
| - es.throwDOMException(InvalidStateError);
|
| + es.throwDOMException(InvalidStateError, ExceptionMessages::failedToExecute("surroundContents", "Range", "The range has no container. Perhaps 'detatch()' has been invoked on this object?"));
|
| return;
|
| }
|
|
|
| @@ -1453,17 +1453,17 @@ void Range::surroundContents(PassRefPtr<Node> passNewParent, ExceptionState& es)
|
|
|
| void Range::setStartBefore(Node* refNode, ExceptionState& es)
|
| {
|
| - checkNodeBA(refNode, es, "setStartBefore");
|
| + checkNodeBA(refNode, "setStartBefore", es);
|
| if (es.hadException())
|
| return;
|
|
|
| setStart(refNode->parentNode(), refNode->nodeIndex(), es);
|
| }
|
|
|
| -void Range::checkDeleteExtract(ExceptionState& es)
|
| +void Range::checkDeleteExtract(const String& methodName, ExceptionState& es)
|
| {
|
| if (!m_start.container()) {
|
| - es.throwDOMException(InvalidStateError);
|
| + es.throwDOMException(InvalidStateError, ExceptionMessages::failedToExecute(methodName, "Range", "The range has no container. Perhaps 'detatch()' has been invoked on this object?"));
|
| return;
|
| }
|
|
|
|
|