Submission in non-default model doesn't work



13 years ago
2 years ago


(Reporter: aaronr, Assigned: aaronr)


Firefox Tracking Flags

(Not tracked)



(2 attachments, 1 obsolete attachment)

1.67 KB, application/xhtml+xml
5.49 KB, patch
: review+
Details | Diff | Splinter Review


13 years ago
If you reference a submission that lives in a non-default model and has no
@model or @bind, then the submission won't work.  This is because
nsXFormsSubmissionElement::GetSelectedInstanceData uses
nsXFormsUtils::EvaluateNodeBinding to find the nodeset to submit.  However, the
rules that EvaluateNodeBinding uses to determine the model to use when resolving
the single node binding is not the same rules that submission should use. 
Submission's default model should be its parent, but for EvaluateNodeBinding the
default model is the first model in the xforms document (because that is what
controls need).

The proper fix is to either put a test in the chain of logic initiated by the
call to EvaluateNodeBinding to special case submission element or to do the
xpath resolution by hand in the submission element.  It really doesn't need a
lot of the context node logic, for example, that EvaluateNodeBinding has.

Comment 1

13 years ago
Created attachment 186231 [details]

Testcase.  Both submissions should submit identical looking data.  But because
of this bug, the submission in the second model won't do anything

Comment 2

13 years ago
Haven't looked too much at it, but an easy fix would be to let the model
implement nsIXFormsContextControl. FindParentContext() will then find it.

Comment 3

13 years ago
Created attachment 186620 [details] [diff] [review]
first attempt

Went with Allan's excellent suggestion.  All the logic is in
nsXFormsModelElement::GetContext.  Just returning the id of the model and the
first instance document's root node as the context node.
Attachment #186620 - Flags: review?(doronr)

Comment 4

13 years ago
Comment on attachment 186620 [details] [diff] [review]
first attempt

Please change it to use NS_ENSURE_TRUE on firstInstanceDoc and comment why
without it, we should fail.  You probably want to also set the return arguments
to their values only if the NS_ENSURE_TRUE succeds.
Attachment #186620 - Flags: review?(doronr) → review+

Comment 5

13 years ago
Created attachment 186623 [details] [diff] [review]
comments fixed

fixed doron's comments.  Smaug, can you second review?	Doron, please correct
any review comments that smaug may have and check this in?  Then it won't have
to wait until I get back from vacation.  Thanks.
Attachment #186620 - Attachment is obsolete: true
Attachment #186623 - Flags: review?(smaug)


13 years ago
Attachment #186623 - Flags: review?(smaug) → review+

Comment 6

13 years ago
Checked in
Last Resolved: 13 years ago
Resolution: --- → FIXED
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.