⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 167569 in webkit


Ignore:
Timestamp:
Apr 20, 2014, 12:02:13 PM (12 years ago)
Author:
ap@apple.com
Message:

Crashes in HTMLFormElement::submit.
https://bugs.webkit.org/show_bug.cgi?id=131910
<rdar://problem/15661790>

Source/WebCore:
Based on a patch by Kent Tamura.

Reviewed by Anders Carlsson.

Tests: fast/forms/form-submission-crash-2.html

fast/forms/form-submission-crash.html

Code that executes arbitrary JS needs to protect objects that it uses afterwards.

  • html/HTMLFormElement.cpp:

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

  • loader/FrameLoader.cpp:

(WebCore::FrameLoader::submitForm):

LayoutTests:
Reviewed by Anders Carlsson.

  • fast/forms/form-submission-crash-2-expected.txt: Added.
  • fast/forms/form-submission-crash-2.html: Added.
  • fast/forms/form-submission-crash-expected.txt: Added.
  • fast/forms/form-submission-crash.html: Added.
Location:
trunk
Files:
4 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r167568 r167569  
     12014-04-19  Alexey Proskuryakov  <ap@apple.com>
     2
     3        Crashes in HTMLFormElement::submit.
     4        https://bugs.webkit.org/show_bug.cgi?id=131910
     5        <rdar://problem/15661790>
     6
     7        Reviewed by Anders Carlsson.
     8
     9        * fast/forms/form-submission-crash-2-expected.txt: Added.
     10        * fast/forms/form-submission-crash-2.html: Added.
     11        * fast/forms/form-submission-crash-expected.txt: Added.
     12        * fast/forms/form-submission-crash.html: Added.
     13
    1142014-04-20  Antti Koivisto  <antti@apple.com>
    215
  • trunk/Source/WebCore/ChangeLog

    r167568 r167569  
     12014-04-19  Alexey Proskuryakov  <ap@apple.com>
     2
     3        Crashes in HTMLFormElement::submit.
     4        https://bugs.webkit.org/show_bug.cgi?id=131910
     5        <rdar://problem/15661790>
     6
     7        Based on a patch by Kent Tamura.
     8
     9        Reviewed by Anders Carlsson.
     10
     11        Tests: fast/forms/form-submission-crash-2.html
     12               fast/forms/form-submission-crash.html
     13
     14        Code that executes arbitrary JS needs to protect objects that it uses afterwards.
     15
     16        * html/HTMLFormElement.cpp:
     17        (WebCore::HTMLFormElement::prepareForSubmission):
     18        (WebCore::HTMLFormElement::submit):
     19        * loader/FrameLoader.cpp:
     20        (WebCore::FrameLoader::submitForm):
     21
    1222014-04-20  Antti Koivisto  <antti@apple.com>
    223
  • trunk/Source/WebCore/html/HTMLFormElement.cpp

    r166793 r167569  
    281281    frame->loader().client().dispatchWillSendSubmitEvent(formState.release());
    282282
     283    Ref<HTMLFormElement> protect(*this);
    283284    // Event handling can result in m_shouldSubmit becoming true, regardless of dispatchEvent() return value.
    284285    if (dispatchEvent(Event::create(eventNames().submitEvent, true, true)))
     
    353354
    354355    LockHistory lockHistory = processingUserGesture ? LockHistory::No : LockHistory::Yes;
     356    Ref<HTMLFormElement> protect(*this); // Form submission can execute arbitary JavaScript.
    355357    frame->loader().submitForm(FormSubmission::create(this, m_attributes, event, lockHistory, formSubmissionTrigger));
    356358
  • trunk/Source/WebCore/loader/FrameLoader.cpp

    r167523 r167569  
    379379            return;
    380380        m_isExecutingJavaScriptFormAction = true;
     381        Ref<Frame> protect(m_frame);
    381382        m_frame.script().executeIfJavaScriptURL(submission->action(), DoNotReplaceDocumentIfJavaScriptURL);
    382383        m_isExecutingJavaScriptFormAction = false;
Note: See TracChangeset for help on using the changeset viewer.