upload doesn't generate xforms-value-changed event

RESOLVED FIXED

Status

Core Graveyard
XForms
RESOLVED FIXED
13 years ago
2 years ago

People

(Reporter: aaronr, Assigned: aaronr)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(2 attachments, 1 obsolete attachment)

1.39 KB, application/xhtml+xml
Details
2.69 KB, patch
smaug
: review+
Doron Rosenberg (IBM)
: review+
Details | Diff | Splinter Review
(Assignee)

Description

13 years ago
the upload control doesn't make the model recalculate, revalidate or refresh
after it updates the bound node.  So controls also bound to the instance data
don't refresh with the new value and xforms-value-changed event isn't fired.
(Assignee)

Comment 1

13 years ago
Created attachment 188817 [details]
testcase

changing the value of the upload filename field and then tabbing should change
the value of the output field and generate a xforms-value-changed message
(Assignee)

Comment 2

13 years ago
Created attachment 188818 [details] [diff] [review]
proposed fix

just added the appropriate checks to make sure that the node value actually got
changed and then dispatched the events for recalc, etc.  Once upload is
xbl-ized, this will need to be done in ::SetValue instead of ::Blur.  Just like
in nsXFormsInputElement.cpp.  But this will work just dandy for now.
Attachment #188818 - Flags: review?(smaug)
(Assignee)

Updated

13 years ago
Status: NEW → ASSIGNED
(In reply to comment #2)
> Created an attachment (id=188818) [edit]
> proposed fix
> 

In Linux I get the xforms-value-changed message and the <output> shows that the
value is file:// when I first time click the |browse...| button.
Then I get the event second time when actually selecting some file. 

On the second time I don't see the extra xforms-value-changed event 
when clicking |browse...|, apparently because the upload already has a value -
i.e. xforms-value-changed does work properly this time.

(Assignee)

Comment 4

13 years ago
(In reply to comment #3)
> (In reply to comment #2)
> > Created an attachment (id=188818) [edit] [edit]
> > proposed fix
> > 
> 
> In Linux I get the xforms-value-changed message and the <output> shows that the
> value is file:// when I first time click the |browse...| button.
> Then I get the event second time when actually selecting some file. 
> 
> On the second time I don't see the extra xforms-value-changed event 
> when clicking |browse...|, apparently because the upload already has a value -
> i.e. xforms-value-changed does work properly this time.
> 
> 

Thanks for catching this smaug!  

I don't think that I see the problem as you describe it, but I recreated it
another way.  If I click on browse and then cancel it without changing anything
(so that the input field is still blank) and then tab, then I see the output
update with "file:///" and get the xforms-value-changed event.

The problem is that in nsXFormsUpdateElement::Blur(), we get the value from the
input field and then call NS_GetURLSpecFromFile and then I set the boundNode to
have this value and the MDG comes back and says whether this is a change or not.
 If it is a change, then I'll send out the proper recalculate, revalidate and
refresh events.  Well, the problem with this logic is that if the input field is
initially blank and we call NS_GetURLSpecFromFile, it will still return us
"file:///".  So if we go ahead and set the bound node to have this value, then
of course the MDG will tell me that the value has changed.  Doh!

I'll update my patch.
(Assignee)

Updated

13 years ago
Attachment #188818 - Flags: review?(smaug)
(Assignee)

Comment 5

13 years ago
Created attachment 189985 [details] [diff] [review]
second try

fixed bug noticed by smaug.  Also noticed a couple of console errors that were
happening in ::Refresh when mBoundNode hadn't been set, yet, so fixed them up.
Attachment #188818 - Attachment is obsolete: true
Attachment #189985 - Flags: review?(smaug)
Attachment #189985 - Flags: review?(smaug) → review+
Attachment #189985 - Flags: review?(doronr)

Updated

13 years ago
Attachment #189985 - Flags: review?(doronr) → review+
(Assignee)

Comment 6

13 years ago
doron, could you please check it in for me?

Comment 7

13 years ago
checked in
Status: ASSIGNED → RESOLVED
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.