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

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

Issue 983123003: Add [TypeChecking=Interface] to XPath interfaces (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: revert test change; no longer needed Created 5 years, 9 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
« no previous file with comments | « Source/core/xml/XPathExpression.h ('k') | Source/core/xml/XPathExpression.idl » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 return nullptr; 56 return nullptr;
57 57
58 return expr.release(); 58 return expr.release();
59 } 59 }
60 60
61 DEFINE_TRACE(XPathExpression) 61 DEFINE_TRACE(XPathExpression)
62 { 62 {
63 visitor->trace(m_topExpression); 63 visitor->trace(m_topExpression);
64 } 64 }
65 65
66 PassRefPtrWillBeRawPtr<XPathResult> XPathExpression::evaluate(Node* contextNode, unsigned short type, XPathResult*, ExceptionState& exceptionState) 66 PassRefPtrWillBeRawPtr<XPathResult> XPathExpression::evaluate(Node* contextNode, unsigned short type, const ScriptValue&, ExceptionState& exceptionState)
67 { 67 {
68 if (!contextNode) {
69 exceptionState.throwDOMException(NotSupportedError, "The context node pr ovided is null.");
70 return nullptr;
71 }
72
73 if (!isValidContextNode(contextNode)) { 68 if (!isValidContextNode(contextNode)) {
74 exceptionState.throwDOMException(NotSupportedError, "The node provided i s '" + contextNode->nodeName() + "', which is not a valid context node type."); 69 exceptionState.throwDOMException(NotSupportedError, "The node provided i s '" + contextNode->nodeName() + "', which is not a valid context node type.");
75 return nullptr; 70 return nullptr;
76 } 71 }
77 72
78 EvaluationContext evaluationContext(*contextNode); 73 EvaluationContext evaluationContext(*contextNode);
79 RefPtrWillBeRawPtr<XPathResult> result = XPathResult::create(evaluationConte xt, m_topExpression->evaluate(evaluationContext)); 74 RefPtrWillBeRawPtr<XPathResult> result = XPathResult::create(evaluationConte xt, m_topExpression->evaluate(evaluationContext));
80 75
81 if (evaluationContext.hadTypeConversionError) { 76 if (evaluationContext.hadTypeConversionError) {
82 // It is not specified what to do if type conversion fails while evaluat ing an expression. 77 // It is not specified what to do if type conversion fails while evaluat ing an expression.
83 exceptionState.throwDOMException(SyntaxError, "Type conversion failed wh ile evaluating the expression."); 78 exceptionState.throwDOMException(SyntaxError, "Type conversion failed wh ile evaluating the expression.");
84 return nullptr; 79 return nullptr;
85 } 80 }
86 81
87 if (type != XPathResult::ANY_TYPE) { 82 if (type != XPathResult::ANY_TYPE) {
88 result->convertTo(type, exceptionState); 83 result->convertTo(type, exceptionState);
89 if (exceptionState.hadException()) 84 if (exceptionState.hadException())
90 return nullptr; 85 return nullptr;
91 } 86 }
92 87
93 return result; 88 return result;
94 } 89 }
95 90
96 } 91 }
OLDNEW
« no previous file with comments | « Source/core/xml/XPathExpression.h ('k') | Source/core/xml/XPathExpression.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698