1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/xslt/xpath/txErrorExpr.cpp Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,43 @@ 1.4 +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 +#include "nsError.h" 1.10 +#include "txExpr.h" 1.11 +#include "nsString.h" 1.12 +#include "txIXPathContext.h" 1.13 + 1.14 +nsresult 1.15 +txErrorExpr::evaluate(txIEvalContext* aContext, txAExprResult** aResult) 1.16 +{ 1.17 + *aResult = nullptr; 1.18 + 1.19 + nsAutoString err(NS_LITERAL_STRING("Invalid expression evaluated")); 1.20 +#ifdef TX_TO_STRING 1.21 + err.AppendLiteral(": "); 1.22 + toString(err); 1.23 +#endif 1.24 + aContext->receiveError(err, 1.25 + NS_ERROR_XPATH_INVALID_EXPRESSION_EVALUATED); 1.26 + 1.27 + return NS_ERROR_XPATH_INVALID_EXPRESSION_EVALUATED; 1.28 +} 1.29 + 1.30 +TX_IMPL_EXPR_STUBS_0(txErrorExpr, ANY_RESULT) 1.31 + 1.32 +bool 1.33 +txErrorExpr::isSensitiveTo(ContextSensitivity aContext) 1.34 +{ 1.35 + // It doesn't really matter what we return here, but it might 1.36 + // be a good idea to try to keep this as unoptimizable as possible 1.37 + return true; 1.38 +} 1.39 + 1.40 +#ifdef TX_TO_STRING 1.41 +void 1.42 +txErrorExpr::toString(nsAString& aStr) 1.43 +{ 1.44 + aStr.Append(mStr); 1.45 +} 1.46 +#endif