OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2005 Frerich Raabe <raabe@kde.org> | 2 * Copyright (C) 2005 Frerich Raabe <raabe@kde.org> |
3 * Copyright (C) 2006, 2009 Apple Inc. All rights reserved. | 3 * Copyright (C) 2006, 2009 Apple Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * | 8 * |
9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 NotSupportedError, "The node provided is '" + contextNode->nodeName() + | 69 NotSupportedError, "The node provided is '" + contextNode->nodeName() + |
70 "', which is not a valid context node type."); | 70 "', which is not a valid context node type."); |
71 return nullptr; | 71 return nullptr; |
72 } | 72 } |
73 | 73 |
74 EvaluationContext evaluationContext(*contextNode); | 74 EvaluationContext evaluationContext(*contextNode); |
75 XPathResult* result = XPathResult::create( | 75 XPathResult* result = XPathResult::create( |
76 evaluationContext, m_topExpression->evaluate(evaluationContext)); | 76 evaluationContext, m_topExpression->evaluate(evaluationContext)); |
77 | 77 |
78 if (evaluationContext.hadTypeConversionError) { | 78 if (evaluationContext.hadTypeConversionError) { |
79 // It is not specified what to do if type conversion fails while evaluating
an expression. | 79 // It is not specified what to do if type conversion fails while evaluating |
| 80 // an expression. |
80 exceptionState.throwDOMException( | 81 exceptionState.throwDOMException( |
81 SyntaxError, "Type conversion failed while evaluating the expression."); | 82 SyntaxError, "Type conversion failed while evaluating the expression."); |
82 return nullptr; | 83 return nullptr; |
83 } | 84 } |
84 | 85 |
85 if (type != XPathResult::kAnyType) { | 86 if (type != XPathResult::kAnyType) { |
86 result->convertTo(type, exceptionState); | 87 result->convertTo(type, exceptionState); |
87 if (exceptionState.hadException()) | 88 if (exceptionState.hadException()) |
88 return nullptr; | 89 return nullptr; |
89 } | 90 } |
90 | 91 |
91 return result; | 92 return result; |
92 } | 93 } |
93 | 94 |
94 } // namespace blink | 95 } // namespace blink |
OLD | NEW |