OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2005 Frerich Raabe <raabe@kde.org> | 2 * Copyright 2005 Frerich Raabe <raabe@kde.org> |
3 * Copyright (C) 2006 Apple Computer, Inc. | 3 * Copyright (C) 2006 Apple Computer, Inc. |
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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 { | 43 { |
44 return XPathExpression::createExpression(expression, resolver, exceptionStat
e); | 44 return XPathExpression::createExpression(expression, resolver, exceptionStat
e); |
45 } | 45 } |
46 | 46 |
47 PassRefPtrWillBeRawPtr<XPathNSResolver> XPathEvaluator::createNSResolver(Node* n
odeResolver) | 47 PassRefPtrWillBeRawPtr<XPathNSResolver> XPathEvaluator::createNSResolver(Node* n
odeResolver) |
48 { | 48 { |
49 return NativeXPathNSResolver::create(nodeResolver); | 49 return NativeXPathNSResolver::create(nodeResolver); |
50 } | 50 } |
51 | 51 |
52 PassRefPtrWillBeRawPtr<XPathResult> XPathEvaluator::evaluate(const String& expre
ssion, Node* contextNode, | 52 PassRefPtrWillBeRawPtr<XPathResult> XPathEvaluator::evaluate(const String& expre
ssion, Node* contextNode, |
53 PassRefPtrWillBeRawPtr<XPathNSResolver> resolver, unsigned short type, XPath
Result* result, ExceptionState& exceptionState) | 53 PassRefPtrWillBeRawPtr<XPathNSResolver> resolver, unsigned short type, const
ScriptValue&, ExceptionState& exceptionState) |
54 { | 54 { |
55 if (!contextNode) { | |
56 exceptionState.throwDOMException(NotSupportedError, "The context node pr
ovided is null."); | |
57 return nullptr; | |
58 } | |
59 | |
60 if (!isValidContextNode(contextNode)) { | 55 if (!isValidContextNode(contextNode)) { |
61 exceptionState.throwDOMException(NotSupportedError, "The node provided i
s '" + contextNode->nodeName() + "', which is not a valid context node type."); | 56 exceptionState.throwDOMException(NotSupportedError, "The node provided i
s '" + contextNode->nodeName() + "', which is not a valid context node type."); |
62 return nullptr; | 57 return nullptr; |
63 } | 58 } |
64 | 59 |
65 RefPtrWillBeRawPtr<XPathExpression> expr = createExpression(expression, reso
lver, exceptionState); | 60 RefPtrWillBeRawPtr<XPathExpression> expr = createExpression(expression, reso
lver, exceptionState); |
66 if (exceptionState.hadException()) | 61 if (exceptionState.hadException()) |
67 return nullptr; | 62 return nullptr; |
68 | 63 |
69 return expr->evaluate(contextNode, type, result, exceptionState); | 64 return expr->evaluate(contextNode, type, ScriptValue(), exceptionState); |
70 } | 65 } |
71 | 66 |
72 } | 67 } |
OLD | NEW |