2005-11-02 07:42:38 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2012-05-21 11:12:37 +00:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2005-11-02 07:42:38 +00:00
|
|
|
|
2012-07-27 14:03:27 +00:00
|
|
|
#include "nsError.h"
|
2005-11-02 17:34:14 +00:00
|
|
|
#include "txExpr.h"
|
2005-11-02 07:42:38 +00:00
|
|
|
#include "nsString.h"
|
|
|
|
#include "txIXPathContext.h"
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
txErrorExpr::evaluate(txIEvalContext* aContext, txAExprResult** aResult)
|
|
|
|
{
|
2012-07-30 14:20:58 +00:00
|
|
|
*aResult = nullptr;
|
2005-11-02 07:42:38 +00:00
|
|
|
|
|
|
|
nsAutoString err(NS_LITERAL_STRING("Invalid expression evaluated"));
|
|
|
|
#ifdef TX_TO_STRING
|
|
|
|
err.AppendLiteral(": ");
|
|
|
|
toString(err);
|
|
|
|
#endif
|
|
|
|
aContext->receiveError(err,
|
|
|
|
NS_ERROR_XPATH_INVALID_EXPRESSION_EVALUATED);
|
|
|
|
|
|
|
|
return NS_ERROR_XPATH_INVALID_EXPRESSION_EVALUATED;
|
|
|
|
}
|
|
|
|
|
2006-01-26 01:50:30 +00:00
|
|
|
TX_IMPL_EXPR_STUBS_0(txErrorExpr, ANY_RESULT)
|
|
|
|
|
2011-09-29 06:19:26 +00:00
|
|
|
bool
|
2006-01-26 01:50:30 +00:00
|
|
|
txErrorExpr::isSensitiveTo(ContextSensitivity aContext)
|
|
|
|
{
|
|
|
|
// It doesn't really matter what we return here, but it might
|
|
|
|
// be a good idea to try to keep this as unoptimizable as possible
|
2011-10-17 14:59:28 +00:00
|
|
|
return true;
|
2006-01-26 01:50:30 +00:00
|
|
|
}
|
|
|
|
|
2005-11-02 07:42:38 +00:00
|
|
|
#ifdef TX_TO_STRING
|
|
|
|
void
|
|
|
|
txErrorExpr::toString(nsAString& aStr)
|
|
|
|
{
|
|
|
|
aStr.Append(mStr);
|
|
|
|
}
|
|
|
|
#endif
|