[Webkit-unassigned] [Bug 19724] New: Submitting a form with no text input fields doesn't trigger dispatchWillSubmitForm

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Jun 23 07:23:29 PDT 2008


           Summary: Submitting a form with no text input fields doesn't
                    trigger dispatchWillSubmitForm
           Product: WebKit
           Version: 525.x (Safari 3.1)
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: Forms
        AssignedTo: webkit-unassigned at lists.webkit.org
        ReportedBy: timmmaaayyy at gmail.com

Throughout FrameLoader::post and some flavors of FrameLoader::load, there is
code like the following

  RefPtr<FormState> formState;
   if (form && !formValues.isEmpty())
       formState = FormState::create(form, formValues, m_frame);

The formState variable is checked later on (if not null) to decide whether or
not to call dispatchWillSubmitForm on its client. In general, this means when a
post/load originates from HTMLFormElement.submit(), dispatchWillSubmitForm will
get triggered. 

This is not the case when the form element in question has no input fields,
which happens on many pages that submit blank forms onload for navigation
purposes. The post occurs (and navigation can take place as a result), but
since the form was "empty", the FrameLoader never sets its
m_formAboutToBeSubmitted variable, implying a FormState is never created and
the client is left unaware that the navigation was due to a form submit.  

I think the FrameLoader should have a setFormAboutToBeSubmitted method that
sets this member after HTMLFormElement::submit(), so that this callback will
get fired (and have the empty but non-null form* passed in). Currently, the
member is only set in a method called recordFormValue which is called for each
text input field on the form.

There is some other code that uses a similar check though and I'm not positive
of the side-effects. 
(e.g, some one FrameLoader::load does
 bool isFormSubmission = formState
and uses isFormSubmission to decide whether or not to do scroll-to-anchor

So perhaps my proposed sol'n isn't the best way to go and
dispatchWillSubmitForm should just be manually invoked with a NULL form* in
this case, leaving the rest of the code intact.

Bug 17598 is related, since fixing the issue discussed here would at least let
clients use "if(form submit && userGesture()==false)" to get a hint at
otherwise uncaught client redirects.

Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

More information about the webkit-unassigned mailing list