bind on an insert changes the in-scope evaluation context

RESOLVED FIXED

Status

Core Graveyard
XForms
RESOLVED FIXED
10 years ago
11 months ago

People

(Reporter: John L. Clark, Assigned: Merle Sterling)

Tracking

({fixed1.8.1.12})

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(3 attachments, 1 obsolete attachment)

(Reporter)

Description

10 years ago
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
(Reporter)

Comment 1

10 years ago
Created attachment 276031 [details]
Demonstration of bug report

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).

Comment 2

10 years ago
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

Comment 3

10 years ago
I asked the W3C what the correct behavior is: http://lists.w3.org/Archives/Public/www-forms/2007Aug/0001.html

Comment 4

10 years ago
(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.
(Assignee)

Updated

10 years ago
Status: NEW → ASSIGNED
(Assignee)

Comment 5

10 years ago
Created attachment 277017 [details]
testcase: using @model

Additional testcase that uses @model instead of @bind.
(Assignee)

Comment 6

10 years ago
Created attachment 277019 [details] [diff] [review]
patch
Attachment #277019 - Flags: review?(aaronr)
(Assignee)

Updated

10 years ago
Attachment #277019 - Flags: review?(Olli.Pettay)

Comment 7

10 years ago
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+
(Assignee)

Comment 8

10 years ago
Created attachment 279597 [details] [diff] [review]
patch 2

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)

Updated

10 years ago
Attachment #279597 - Flags: review?(Olli.Pettay) → review+

Comment 9

10 years ago
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 10

10 years ago
Comment on attachment 279597 [details] [diff] [review]
patch 2

According to mozilla.dev.planning, this doesn't need approval
Attachment #279597 - Flags: approval1.9?

Comment 11

10 years ago
checked in
Status: ASSIGNED → RESOLVED
Last Resolved: 10 years ago
Resolution: --- → FIXED

Updated

10 years ago
Blocks: 398271

Updated

10 years ago
Whiteboard: xf-to-branch

Updated

10 years ago
Attachment #277017 - Attachment mime type: text/html → application/xhtml+xml

Updated

10 years ago
Blocks: 410239

Comment 12

10 years ago
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.