Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: Source/core/xml/XPathExpression.cpp

Issue 17239008: Remove XPathException (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 10 matching lines...) Expand all
21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */ 25 */
26 26
27 #include "config.h" 27 #include "config.h"
28 #include "core/xml/XPathExpression.h" 28 #include "core/xml/XPathExpression.h"
29 29
30 #include "core/dom/ExceptionCode.h" 30 #include "core/dom/ExceptionCode.h"
31 #include "core/xml/XPathException.h"
32 #include "core/xml/XPathExpressionNode.h" 31 #include "core/xml/XPathExpressionNode.h"
33 #include "core/xml/XPathNSResolver.h" 32 #include "core/xml/XPathNSResolver.h"
34 #include "core/xml/XPathParser.h" 33 #include "core/xml/XPathParser.h"
35 #include "core/xml/XPathResult.h" 34 #include "core/xml/XPathResult.h"
36 #include "core/xml/XPathUtil.h" 35 #include "core/xml/XPathUtil.h"
37 #include <wtf/text/WTFString.h> 36 #include <wtf/text/WTFString.h>
38 37
39 namespace WebCore { 38 namespace WebCore {
40 39
41 using namespace XPath; 40 using namespace XPath;
(...skipping 24 matching lines...) Expand all
66 65
67 EvaluationContext& evaluationContext = Expression::evaluationContext(); 66 EvaluationContext& evaluationContext = Expression::evaluationContext();
68 evaluationContext.node = contextNode; 67 evaluationContext.node = contextNode;
69 evaluationContext.size = 1; 68 evaluationContext.size = 1;
70 evaluationContext.position = 1; 69 evaluationContext.position = 1;
71 evaluationContext.hadTypeConversionError = false; 70 evaluationContext.hadTypeConversionError = false;
72 RefPtr<XPathResult> result = XPathResult::create(contextNode->document(), m_ topExpression->evaluate()); 71 RefPtr<XPathResult> result = XPathResult::create(contextNode->document(), m_ topExpression->evaluate());
73 evaluationContext.node = 0; // Do not hold a reference to the context node, as this may prevent the whole document from being destroyed in time. 72 evaluationContext.node = 0; // Do not hold a reference to the context node, as this may prevent the whole document from being destroyed in time.
74 73
75 if (evaluationContext.hadTypeConversionError) { 74 if (evaluationContext.hadTypeConversionError) {
76 // It is not specified what to do if type conversion fails while evaluat ing an expression, and INVALID_EXPRESSION_ERR is not exactly right 75 // It is not specified what to do if type conversion fails while evaluat ing an expression.
77 // when the failure happens in an otherwise valid expression because of a variable. But XPathEvaluator does not support variables, so it's close enough. 76 ec = SYNTAX_ERR;
arv (Not doing code reviews) 2013/06/18 19:15:05 It seems like TypeError would be a better fit here
abarth-chromium 2013/06/18 19:30:33 Ok.
78 ec = XPathException::INVALID_EXPRESSION_ERR;
79 return 0; 77 return 0;
80 } 78 }
81 79
82 if (type != XPathResult::ANY_TYPE) { 80 if (type != XPathResult::ANY_TYPE) {
83 ec = 0; 81 ec = 0;
84 result->convertTo(type, ec); 82 result->convertTo(type, ec);
85 if (ec) 83 if (ec)
86 return 0; 84 return 0;
87 } 85 }
88 86
89 return result; 87 return result;
90 } 88 }
91 89
92 } 90 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698