Closed
Bug 581194
Opened 14 years ago
Closed 14 years ago
Multiple context() calls in the same expression cause an xpath evaluation error
Categories
(Core Graveyard :: XForms, defect)
Core Graveyard
XForms
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: dion.sole, Assigned: dion.sole)
Details
Attachments
(2 files, 1 obsolete file)
421 bytes,
application/xhtml+xml
|
Details | |
1.88 KB,
patch
|
smaug
:
review+
|
Details | Diff | Splinter Review |
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-GB; rv:1.9.2.7) Gecko/20100713 Firefox/3.6.7
Build Identifier:
There's currently a bug in the nsXFormsUtils::TranslateExpression() function, such that an xpath expression that has more than one call to context() in it
e.g. "context()/@a + context()/@b" will fail.
This is due to only the first occurance of "context()" being replaced by TranslateExpression().
I'll attach a patch and testcase soon.
Reproducible: Always
This file will cause an error when it tries to evaluate the "context()/@a + context()/@b" expression.
This just adds a loop to the TranslateExpression function so that it handles more than one context() call within an expression.
Attachment #459624 -
Flags: review?(aaronr)
Comment on attachment 459624 [details] [diff] [review]
Patch to handle multiple context() calls
>+
>+ if (start + contextExpr.Length() < remainder.Length()) {
>+ remainder = Substring(remainder, start + contextExpr.Length());
>+ start = remainder.Find(contextExpr);
>+
>+ if (start == kNotFound) {
>+ // No more context()s to translate, so append the remainder of the
>+ // string.
>+ aResult.Append(remainder);
>+ }
> }
>- } else {
>- aResult = aExpression;
>- }
>+ else {
>+ // "context()" was the last part of the string, so we've processed
>+ // the entire thing.
Code looks good. But please put the else up a line with the closing if bracket so that it looks like '} else {' for code consistency. Thanks.
Attachment #459624 -
Flags: review?(aaronr) → review+
Same patch with the "else" change.
Attachment #459624 -
Attachment is obsolete: true
Attachment #462315 -
Flags: review?(Olli.Pettay)
Updated•14 years ago
|
Attachment #462315 -
Flags: review?(Olli.Pettay) → review+
Not sure if this needs any special checkin instructions or not...
Aaron's review+ carries over from the first version of the patch.
Keywords: checkin-needed
Updated•14 years ago
|
Assignee: nobody → dion.sole
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Comment 6•14 years ago
|
||
Updated•8 years ago
|
Product: Core → Core Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•