diff options
Diffstat (limited to 'chromium/third_party/WebKit/Source/core/xml/XPathResult.cpp')
-rw-r--r-- | chromium/third_party/WebKit/Source/core/xml/XPathResult.cpp | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/chromium/third_party/WebKit/Source/core/xml/XPathResult.cpp b/chromium/third_party/WebKit/Source/core/xml/XPathResult.cpp index 3647decc196..17aa9dd2061 100644 --- a/chromium/third_party/WebKit/Source/core/xml/XPathResult.cpp +++ b/chromium/third_party/WebKit/Source/core/xml/XPathResult.cpp @@ -67,7 +67,7 @@ XPathResult::~XPathResult() { } -void XPathResult::convertTo(unsigned short type, ExceptionState& es) +void XPathResult::convertTo(unsigned short type, ExceptionState& exceptionState) { switch (type) { case ANY_TYPE: @@ -89,14 +89,14 @@ void XPathResult::convertTo(unsigned short type, ExceptionState& es) case ANY_UNORDERED_NODE_TYPE: case FIRST_ORDERED_NODE_TYPE: // This is correct - singleNodeValue() will take care of ordering. if (!m_value.isNodeSet()) { - es.throwTypeError(); + exceptionState.throwTypeError("The result is not a node set, and therefore cannot be converted to the desired type."); return; } m_resultType = type; break; case ORDERED_NODE_ITERATOR_TYPE: if (!m_value.isNodeSet()) { - es.throwTypeError(); + exceptionState.throwTypeError("The result is not a node set, and therefore cannot be converted to the desired type."); return; } m_nodeSet.sort(); @@ -104,7 +104,7 @@ void XPathResult::convertTo(unsigned short type, ExceptionState& es) break; case ORDERED_NODE_SNAPSHOT_TYPE: if (!m_value.isNodeSet()) { - es.throwTypeError(); + exceptionState.throwTypeError("The result is not a node set, and therefore cannot be converted to the desired type."); return; } m_value.toNodeSet().sort(); @@ -118,37 +118,37 @@ unsigned short XPathResult::resultType() const return m_resultType; } -double XPathResult::numberValue(ExceptionState& es) const +double XPathResult::numberValue(ExceptionState& exceptionState) const { if (resultType() != NUMBER_TYPE) { - es.throwTypeError(); + exceptionState.throwTypeError("The result type is not a number."); return 0.0; } return m_value.toNumber(); } -String XPathResult::stringValue(ExceptionState& es) const +String XPathResult::stringValue(ExceptionState& exceptionState) const { if (resultType() != STRING_TYPE) { - es.throwTypeError(); + exceptionState.throwTypeError("The result type is not a string."); return String(); } return m_value.toString(); } -bool XPathResult::booleanValue(ExceptionState& es) const +bool XPathResult::booleanValue(ExceptionState& exceptionState) const { if (resultType() != BOOLEAN_TYPE) { - es.throwTypeError(); + exceptionState.throwTypeError("The result type is not a boolean."); return false; } return m_value.toBoolean(); } -Node* XPathResult::singleNodeValue(ExceptionState& es) const +Node* XPathResult::singleNodeValue(ExceptionState& exceptionState) const { if (resultType() != ANY_UNORDERED_NODE_TYPE && resultType() != FIRST_ORDERED_NODE_TYPE) { - es.throwTypeError(); + exceptionState.throwTypeError("The result type is not a single node."); return 0; } @@ -168,25 +168,25 @@ bool XPathResult::invalidIteratorState() const return m_document->domTreeVersion() != m_domTreeVersion; } -unsigned long XPathResult::snapshotLength(ExceptionState& es) const +unsigned long XPathResult::snapshotLength(ExceptionState& exceptionState) const { if (resultType() != UNORDERED_NODE_SNAPSHOT_TYPE && resultType() != ORDERED_NODE_SNAPSHOT_TYPE) { - es.throwTypeError(); + exceptionState.throwTypeError("The result type is not a snapshot."); return 0; } return m_value.toNodeSet().size(); } -Node* XPathResult::iterateNext(ExceptionState& es) +Node* XPathResult::iterateNext(ExceptionState& exceptionState) { if (resultType() != UNORDERED_NODE_ITERATOR_TYPE && resultType() != ORDERED_NODE_ITERATOR_TYPE) { - es.throwTypeError(); + exceptionState.throwTypeError("The result type is not an iterator."); return 0; } if (invalidIteratorState()) { - es.throwDOMException(InvalidStateError); + exceptionState.throwDOMException(InvalidStateError, "The document has mutated since the result was returned."); return 0; } @@ -200,10 +200,10 @@ Node* XPathResult::iterateNext(ExceptionState& es) return node; } -Node* XPathResult::snapshotItem(unsigned long index, ExceptionState& es) +Node* XPathResult::snapshotItem(unsigned long index, ExceptionState& exceptionState) { if (resultType() != UNORDERED_NODE_SNAPSHOT_TYPE && resultType() != ORDERED_NODE_SNAPSHOT_TYPE) { - es.throwTypeError(); + exceptionState.throwTypeError("The result type is not a snapshot."); return 0; } |