Closed Bug 274697 Opened 20 years ago Closed 20 years ago

Using wrong contextNode in XPath evaluation

Categories

(Core Graveyard :: XForms, defect)

x86
All
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED INVALID

People

(Reporter: aaronr, Assigned: aaronr)

Details

Attachments

(2 files)

I implemented boolean-from-string but got errors running a testcase that I will
post next.  It is because I was binding a xforms:input element to a bind with a
readonly model item property that used an expression -> for example
boolean-from-string(/values/value).  I found that when the expression was
evaluated by the MDG, it worked, but when it was later evaluated inside
nsXFormsInputElement::Refresh(), I wasn't getting a proper parameter.

I then noticed that the evaluation inside nsXFormsInputElement::Refresh() used
mElement (the xforms:input element) as the contextNode.  However, /values/value
would have no meaning with this contextNode.  When I fixed it to use the same
node as the context node that it uses to grab the readonly expression to
evaluate (similar to what the MDG does), it worked.
Attached file testcase that fails
this is the testcase that fails.  NOTE: to recreate, you'll need my latest code
for bug 258472, which I haven't posted, yet.  But with the testcase you can see
how using the xforms:input as the context node of the evaluation will cause the
problem.
Status: NEW → ASSIGNED
Attached patch proposed fixSplinter Review
Here is my proposed fix.  Eventually I think that it would be a better idea to
get the readonly property directly from the MDG for our controls.  Maybe a
nsXFormsUtility function that can take a nsIDOMNode xtf element parameter and
do the work to figure out which instance node to ask the MDG about.  But for
now, this fix will keep input element working as things currently stand.
Attachment #168753 - Flags: superreview?(bryner)
Attachment #168753 - Flags: review?(allan)
(In reply to comment #2)
> Eventually I think that it would be a better idea to
> get the readonly property directly from the MDG for our controls.  Maybe a
> nsXFormsUtility function that can take a nsIDOMNode xtf element parameter and
> do the work to figure out which instance node to ask the MDG about.  But for
> now, this fix will keep input element working as things currently stand.

Pretty please, with sugar and cream on top, look at bug 265467, there's the
answer you are looking for. Look at the patch to nsXFormsInput::Refresh().
The code is changed in bug 265467, invalidating this one.
Status: ASSIGNED → RESOLVED
Closed: 20 years ago
Resolution: --- → INVALID
Attachment #168753 - Flags: superreview?(bryner)
Attachment #168753 - Flags: review?(allan)
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: