Changeset 166793 in webkit


Ignore:
Timestamp:
Apr 4, 2014 11:07:44 AM (10 years ago)
Author:
ap@apple.com
Message:

REGRESSION (r166615): Pressing return doesn’t submit search term at bing.com
https://bugs.webkit.org/show_bug.cgi?id=131212
<rdar://problem/16521788>

Reviewed by Dan Bernstein.

Source/WebCore:

Test: fast/forms/submit-while-you-submit.html

Turns out that m_shouldSubmit can actually be modified in a code path where we can't
directly return the result. I'm not sure if the current behavior is entirely correct
(we have open bugs about submitting forms multiple times), but let's restore it to
pre-r166615 state.

  • html/HTMLFormElement.cpp:

(WebCore::HTMLFormElement::HTMLFormElement):
(WebCore::HTMLFormElement::prepareForSubmission):
(WebCore::HTMLFormElement::submit):

  • html/HTMLFormElement.h:

LayoutTests:

  • fast/forms/submit-while-you-submit-expected.txt: Added.
  • fast/forms/submit-while-you-submit.html: Added.
Location:
trunk
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r166789 r166793  
     12014-04-04  Alexey Proskuryakov  <ap@apple.com>
     2
     3        REGRESSION (r166615): Pressing return doesn’t submit search term at bing.com
     4        https://bugs.webkit.org/show_bug.cgi?id=131212
     5        <rdar://problem/16521788>
     6
     7        Reviewed by Dan Bernstein.
     8
     9        * fast/forms/submit-while-you-submit-expected.txt: Added.
     10        * fast/forms/submit-while-you-submit.html: Added.
     11
    1122014-04-04  Brent Fulgham  <bfulgham@apple.com>
    213
  • trunk/Source/WebCore/ChangeLog

    r166791 r166793  
     12014-04-04  Alexey Proskuryakov  <ap@apple.com>
     2
     3        REGRESSION (r166615): Pressing return doesn’t submit search term at bing.com
     4        https://bugs.webkit.org/show_bug.cgi?id=131212
     5        <rdar://problem/16521788>
     6
     7        Reviewed by Dan Bernstein.
     8
     9        Test: fast/forms/submit-while-you-submit.html
     10
     11        Turns out that m_shouldSubmit can actually be modified in a code path where we can't
     12        directly return the result. I'm not sure if the current behavior is entirely correct
     13        (we have open bugs about submitting forms multiple times), but let's restore it to
     14        pre-r166615 state.
     15
     16        * html/HTMLFormElement.cpp:
     17        (WebCore::HTMLFormElement::HTMLFormElement):
     18        (WebCore::HTMLFormElement::prepareForSubmission):
     19        (WebCore::HTMLFormElement::submit):
     20        * html/HTMLFormElement.h:
     21
    1222014-04-04  Martin Hock  <mhock@apple.com>
    223
  • trunk/Source/WebCore/html/HTMLFormElement.cpp

    r166684 r166793  
    5858    , m_wasUserSubmitted(false)
    5959    , m_isSubmittingOrPreparingForSubmission(false)
     60    , m_shouldSubmit(false)
    6061    , m_isInResetFunction(false)
    6162    , m_wasDemoted(false)
     
    267268
    268269    m_isSubmittingOrPreparingForSubmission = true;
    269     bool shouldSubmit = false;
     270    m_shouldSubmit = false;
    270271
    271272    // Interactive validation must be done before dispatching the submit event.
     
    280281    frame->loader().client().dispatchWillSendSubmitEvent(formState.release());
    281282
     283    // Event handling can result in m_shouldSubmit becoming true, regardless of dispatchEvent() return value.
    282284    if (dispatchEvent(Event::create(eventNames().submitEvent, true, true)))
    283         shouldSubmit = true;
     285        m_shouldSubmit = true;
    284286
    285287    m_isSubmittingOrPreparingForSubmission = false;
    286288
    287     if (shouldSubmit)
     289    if (m_shouldSubmit)
    288290        submit(event, true, true, NotSubmittedByJavaScript);
    289291}
     
    323325        return;
    324326
    325     if (m_isSubmittingOrPreparingForSubmission)
    326         return;
     327    if (m_isSubmittingOrPreparingForSubmission) {
     328        m_shouldSubmit = true;
     329        return;
     330    }
    327331
    328332    m_isSubmittingOrPreparingForSubmission = true;
     
    354358        firstSuccessfulSubmitButton->setActivatedSubmit(false);
    355359
     360    m_shouldSubmit = false;
    356361    m_isSubmittingOrPreparingForSubmission = false;
    357362}
  • trunk/Source/WebCore/html/HTMLFormElement.h

    r166615 r166793  
    8282    void removeImgElement(HTMLImageElement*);
    8383
    84     void prepareForSubmission(Event*); // FIXME: This function doesn't only prepare, it sometimes calls sumbit() itself.
     84    void prepareForSubmission(Event*); // FIXME: This function doesn't only prepare, it sometimes calls submit() itself.
    8585    void submit();
    8686    void submitFromJavaScript();
     
    173173    bool m_wasUserSubmitted;
    174174    bool m_isSubmittingOrPreparingForSubmission;
     175    bool m_shouldSubmit;
    175176
    176177    bool m_isInResetFunction;
Note: See TracChangeset for help on using the changeset viewer.