Bug 42479 - [Chromium] Implement WebFormElement::userSubmitted().
Summary: [Chromium] Implement WebFormElement::userSubmitted().
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Other OS X 10.5
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-07-16 13:33 PDT by James Hawkins
Modified: 2010-07-20 16:23 PDT (History)
5 users (show)

See Also:


Attachments
Patch (4.97 KB, patch)
2010-07-16 13:34 PDT, James Hawkins
no flags Details | Formatted Diff | Diff
Patch (4.85 KB, patch)
2010-07-19 17:35 PDT, James Hawkins
no flags Details | Formatted Diff | Diff
Patch (5.51 KB, patch)
2010-07-20 13:27 PDT, James Hawkins
fishd: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description James Hawkins 2010-07-16 13:33:19 PDT
[Chromium] Implement WebFormElement::userSubmitted().
Comment 1 James Hawkins 2010-07-16 13:34:51 PDT
Created attachment 61843 [details]
Patch
Comment 2 David Holloway 2010-07-16 14:31:03 PDT
LGTM.
Comment 3 Jay Civelli 2010-07-16 16:22:33 PDT
LGTM
Comment 4 Kent Tamura 2010-07-17 05:19:14 PDT
Comment on attachment 61843 [details]
Patch

Could you explain why we need this change in ChangeLog please?
Comment 5 Darin Fisher (:fishd, Google) 2010-07-17 20:54:17 PDT
Comment on attachment 61843 [details]
Patch

WebCore/html/HTMLFormElement.cpp:409
 +      // common browsers( sick! ) allow it be canceled.
both spellings are correct according to the dictionary.  probably
better to leave the existing code unchanged.

WebKit/chromium/src/WebFormElement.cpp:71
 +      return constUnwrap<HTMLFormElement>()->submissionTrigger() == NotSubmittedByJavaScript;
are you sure you don't want to expose an enum for the variety
of submission trigger types?

WebKit/chromium/src/WebFormElement.cpp:69
 +  bool WebFormElement::userSubmitted() const
I'm having a hard time understanding what this method name implies.  Is
this telling me that the user already submitted this form?  what happens
if the form is submitted multiple times (e.g., suppose it has a target
that corresponds to an IFRAME)?  what if the form is submitted once by
javascript and then once by user action?

what if the user clicks on a link, and some javascript runs, which
then calls form.submit()?  would that be regarded as a non-user
submitted form?
Comment 6 James Hawkins 2010-07-19 17:03:41 PDT
(In reply to comment #4)
> (From update of attachment 61843 [details])
> Could you explain why we need this change in ChangeLog please?

Added more info to the ChangeLog.
Comment 7 James Hawkins 2010-07-19 17:08:16 PDT
(In reply to comment #5)
> (From update of attachment 61843 [details])
> WebCore/html/HTMLFormElement.cpp:409
>  +      // common browsers( sick! ) allow it be canceled.
> both spellings are correct according to the dictionary.  probably
> better to leave the existing code unchanged.
> 

Done.

> WebKit/chromium/src/WebFormElement.cpp:71
>  +      return constUnwrap<HTMLFormElement>()->submissionTrigger() == NotSubmittedByJavaScript;
> are you sure you don't want to expose an enum for the variety
> of submission trigger types?
> 

I thought about it, but decided not to over-engineer it for now (keeping it simple).  If a client needs to know more than just whether a user submitted the form, it's simple to add.

> WebKit/chromium/src/WebFormElement.cpp:69
>  +  bool WebFormElement::userSubmitted() const
> I'm having a hard time understanding what this method name implies.  Is
> this telling me that the user already submitted this form?  what happens
> if the form is submitted multiple times (e.g., suppose it has a target
> that corresponds to an IFRAME)?  what if the form is submitted once by
> javascript and then once by user action?
> 

What do you think about wasUserSubmitted()? The value returned is for the last submitted form, so in the case you mention, if the client calls this method after the user submitted the form, it will return true.

> what if the user clicks on a link, and some javascript runs, which
> then calls form.submit()?  would that be regarded as a non-user
> submitted form?

From my reading of the code, this latter case will not be consider user-submitted.
Comment 8 James Hawkins 2010-07-19 17:35:29 PDT
Created attachment 62018 [details]
Patch
Comment 9 Darin Fisher (:fishd, Google) 2010-07-19 22:50:25 PDT
(In reply to comment #7)
> I thought about it, but decided not to over-engineer it for now (keeping it 
> simple).  If a client needs to know more than just whether a user submitted 
> the form, it's simple to add.

OK


> What do you think about wasUserSubmitted()? The value returned is for the last 
> submitted form, so in the case you mention, if the client calls this method 
> after the user submitted the form, it will return true.

Sounds better.  The verb helps.


> > what if the user clicks on a link, and some javascript runs, which
> > then calls form.submit()?  would that be regarded as a non-user
> > submitted form?
> 
> From my reading of the code, this latter case will not be consider user-
> submitted.

OK
Comment 10 James Hawkins 2010-07-20 13:27:54 PDT
Created attachment 62105 [details]
Patch
Comment 11 James Hawkins 2010-07-20 13:31:05 PDT
(In reply to comment #9)
> (In reply to comment #7)
> 
> > What do you think about wasUserSubmitted()? The value returned is for the last 
> > submitted form, so in the case you mention, if the client calls this method 
> > after the user submitted the form, it will return true.
> 
> Sounds better.  The verb helps.
> 

Done
Comment 12 James Hawkins 2010-07-20 16:23:41 PDT
Committed r63786: <http://trac.webkit.org/changeset/63786>