Fix error in XPath analyzer. Bug 296812, r=smaug+aaronr, a=mkaply

This commit is contained in:
allan%beaufour.dk 2005-06-08 11:10:47 +00:00
parent 27e477cd1c
commit 99861d4dfc
2 changed files with 25 additions and 3 deletions

View File

@ -165,14 +165,21 @@ nsXFormsXPathAnalyzer::AnalyzeRecursively(nsIDOMNode *aContextNode,
if (aNode->mCon) {
// Remove the leading /
xp = Substring(*mCurExprString, aNode->mStartIndex + 1, aNode->mEndIndex - aNode->mStartIndex + 1);
xp = Substring(*mCurExprString, aNode->mStartIndex + 1,
aNode->mEndIndex - aNode->mStartIndex + 2);
} else {
xp = Substring(*mCurExprString, aNode->mStartIndex, aNode->mEndIndex - aNode->mStartIndex);
xp = Substring(*mCurExprString, aNode->mStartIndex,
aNode->mEndIndex - aNode->mStartIndex);
}
rv = mEvaluator->Evaluate(xp, aContextNode, mCurPosition, mCurSize,
mResolver, nsIDOMXPathResult::ANY_TYPE,
nsnull, getter_AddRefs(result));
NS_ENSURE_SUCCESS(rv, rv);
if (NS_FAILED(rv)) {
const PRUnichar *strings[] = { xp.get() };
nsXFormsUtils::ReportError(NS_LITERAL_STRING("exprEvaluateError"),
strings, 1, nsnull, nsnull);
return rv;
}
PRUint16 type;
rv = result->GetResultType(&type);

View File

@ -49,13 +49,28 @@
*/
class nsXFormsXPathNode {
public:
/** Children of the node */
nsXFormsXPathNode* mChild;
/** Siblings to the node */
nsXFormsXPathNode* mSibling;
/** The starting position of the node in the expression string */
PRInt32 mStartIndex;
/** The ending position of the node in the expression string */
PRInt32 mEndIndex;
/** @todo Write dox. (XXX) */
PRBool mCon;
/** Is node a predicate? */
PRBool mPredicate;
/** Is node a literal? */
PRBool mLiteral;
/** Is node an index() call? */
PRBool mIsIndex;
nsXFormsXPathNode(nsXFormsXPathNode* aParent, PRBool aContinue = PR_FALSE);