txErrorExpr.cpp (1133B)
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* This Source Code Form is subject to the terms of the Mozilla Public 3 * License, v. 2.0. If a copy of the MPL was not distributed with this 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 5 6 #include "nsError.h" 7 #include "nsString.h" 8 #include "txExpr.h" 9 #include "txIXPathContext.h" 10 11 nsresult txErrorExpr::evaluate(txIEvalContext* aContext, 12 txAExprResult** aResult) { 13 *aResult = nullptr; 14 15 nsAutoString err(u"Invalid expression evaluated"_ns); 16 #ifdef TX_TO_STRING 17 err.AppendLiteral(": "); 18 toString(err); 19 #endif 20 aContext->receiveError(err, NS_ERROR_XPATH_INVALID_EXPRESSION_EVALUATED); 21 22 return NS_ERROR_XPATH_INVALID_EXPRESSION_EVALUATED; 23 } 24 25 TX_IMPL_EXPR_STUBS_0(txErrorExpr, ANY_RESULT) 26 27 bool txErrorExpr::isSensitiveTo(ContextSensitivity aContext) { 28 // It doesn't really matter what we return here, but it might 29 // be a good idea to try to keep this as unoptimizable as possible 30 return true; 31 } 32 33 #ifdef TX_TO_STRING 34 void txErrorExpr::toString(nsAString& aStr) { aStr.Append(mStr); } 35 #endif