Closed Bug 391586 Opened 17 years ago Closed 17 years ago

bind on an insert changes the in-scope evaluation context

Categories

(Core Graveyard :: XForms, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: jlc6, Assigned: msterlin)

References

Details

(Keywords: fixed1.8.1.12)

Attachments

(3 files, 1 obsolete file)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6
Build Identifier: 2007-08-09-03-mozilla1.8

When an `xf:insert` uses a bind reference to identify the Node Set Binding node-set, then it also changes the in-scope evaluation context, which means that a relative XPath expression in the `origin` attribute will be evaluated with respect to the bind location, not the original in-scope evaluation context.

Reproducible: Always
The insert should copy (i.e. insert) a date element with a text node content, but instead it copies a date element with an empty element child, which is only present at the bind location (not the origin location).
Orbeon and Sidewinder both behave the same, which is different from our processor.  We need to figure out why and who is right.  According to the spec, "1. The insert context is determined. If the bind attribute is present or if the context attribute is not given, the insert context is the in-scope evaluation context".  So to me, that means in this testcase the evaluation context should be: instance('containers')/target/date since that is the nodeset that @bind gives.  So to me we are behaving correctly, but we certainly aren't behaving like the other processors.
Assignee: nobody → msterlin
Status: UNCONFIRMED → NEW
Ever confirmed: true
I asked the W3C what the correct behavior is: http://lists.w3.org/Archives/Public/www-forms/2007Aug/0001.html
(In reply to comment #3)
> I asked the W3C what the correct behavior is:
> http://lists.w3.org/Archives/Public/www-forms/2007Aug/0001.html
> 

The WG has spoken...the result from @bind should NOT provide the context for xpath evaluations on the xf:insert element.  Orbeon and Sidewinder's behaviors are correct.  Merle, please fix this accordingly.  If this points out a flaw in the testsuite testcase, please mention that to Steve or Keith.  Thanks.
Status: NEW → ASSIGNED
Attached file testcase: using @model
Additional testcase that uses @model instead of @bind.
Attached patch patch (obsolete) — Splinter Review
Attachment #277019 - Flags: review?(aaronr)
Attachment #277019 - Flags: review?(Olli.Pettay)
Comment on attachment 277019 [details] [diff] [review]
patch

>Index: nsXFormsInsertDeleteElement.cpp
>===================================================================

>+  rv = nsXFormsUtils::GetNodeContext(mElement,
>+                                     nsXFormsUtils::ELEMENT_WITH_MODEL_ATTR,
>+                                     getter_AddRefs(model),
>+                                     getter_AddRefs(bindElement),
>+                                     &outerBind,
>+                                     getter_AddRefs(parentControl),
>+                                     getter_AddRefs(contextNode),
>+                                     nsnull, nsnull, PR_FALSE);

nit: perhaps a comment here to point out that we are passing in PR_FALSE to tell GetNodeContext not to grab the context node from @bind.

>+  // The insert/delete action is terminated with no effect if the context
>+  // is the empty node-set.
>+  //if (!model || !contextNode)

nit: remove this commented out line if you don't need it.

with those, r=me
Attachment #277019 - Flags: review?(aaronr) → review+
Attached patch patch 2Splinter Review
Add comment; remove extraneous commented out code.
Attachment #277019 - Attachment is obsolete: true
Attachment #279597 - Flags: review?(Olli.Pettay)
Attachment #277019 - Flags: review?(Olli.Pettay)
Attachment #279597 - Flags: review?(Olli.Pettay) → review+
Comment on attachment 279597 [details] [diff] [review]
patch 2

Not sure if XForms patches need approval while in
M8 freeze. XForms is not part of the build.
Attachment #279597 - Flags: approval1.9?
Comment on attachment 279597 [details] [diff] [review]
patch 2

According to mozilla.dev.planning, this doesn't need approval
Attachment #279597 - Flags: approval1.9?
checked in
Status: ASSIGNED → RESOLVED
Closed: 17 years ago
Resolution: --- → FIXED
Whiteboard: xf-to-branch
Attachment #277017 - Attachment mime type: text/html → application/xhtml+xml
Blocks: 410239
checked into 1.8 branch via bug 410239.
Keywords: fixed1.8.1.12
Whiteboard: xf-to-branch
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: