Bug 213341

Summary: Move some form submission logic into HTMLFormElement
Product: WebKit Reporter: Rob Buis <rbuis>
Component: FormsAssignee: Rob Buis <rbuis>
Status: RESOLVED LATER    
Severity: Normal CC: cdumez, changseok, darin, esprehn+autocc, ews-watchlist, gyuyoung.kim, japhet, mifenton, mkwst, wenson_hsieh
Priority: P2    
Version: Safari Technology Preview   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch
none
Patch
none
Patch
none
Patch
none
Patch
none
Patch none

Description Rob Buis 2020-06-18 07:40:09 PDT
Move form submission logic into HTMLFrameElement, this allows us to remove some state and complexity out of FrameLoader.
Comment 1 Rob Buis 2020-06-18 07:59:35 PDT
Created attachment 402208 [details]
Patch
Comment 2 Chris Dumez 2020-06-18 08:30:03 PDT
Comment on attachment 402208 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=402208&action=review

> Source/WebCore/ChangeLog:3
> +        Move form submission logic into HTMLFrameElement

You probably mean HTMLFormElement. HTMLFrameElement would not make much sense.
Comment 3 Rob Buis 2020-06-18 08:44:20 PDT
Comment on attachment 402208 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=402208&action=review

>> Source/WebCore/ChangeLog:3
>> +        Move form submission logic into HTMLFrameElement
> 
> You probably mean HTMLFormElement. HTMLFrameElement would not make much sense.

Thanks Chris, you are correct, will fix. I was doing too many things at the same time...
Comment 4 Rob Buis 2020-06-18 09:11:58 PDT
Created attachment 402210 [details]
Patch
Comment 5 Rob Buis 2020-06-18 11:49:25 PDT
Created attachment 402220 [details]
Patch
Comment 6 Rob Buis 2020-06-23 02:09:06 PDT
Created attachment 402539 [details]
Patch
Comment 7 Rob Buis 2020-06-23 05:46:09 PDT
Created attachment 402548 [details]
Patch
Comment 8 Rob Buis 2020-06-23 08:38:07 PDT
Created attachment 402562 [details]
Patch
Comment 9 Rob Buis 2020-06-24 10:43:06 PDT
Created attachment 402662 [details]
Patch
Comment 10 Darin Adler 2020-06-24 12:52:52 PDT
Comment on attachment 402662 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=402662&action=review

> Source/WebCore/ChangeLog:9
> +        Move some form submission logic into HTMLFormElement, this
> +        allows us to remove some state and complexity out of FrameLoader.

Generally looks OK. It’s a little sad when an HTML element class has so much of this sort of logic, but on balance I agree that this is an improvement.

> Source/WebCore/html/HTMLFormElement.cpp:383
> +    ASSERT(!formSubmission->state().sourceDocument().frame() || formSubmission->state().sourceDocument().frame() == frame.get());

I think this should be something you can write without "get()".

> Source/WebCore/html/HTMLFormElement.cpp:386
> +    if (!frame->page())
> +        return;

This is a significant change in behavior. Before, in a case like this, the code below would run. We will leave m_shouldSubmit set to true now, for example. Is this a desirable change?

> Source/WebCore/html/HTMLFormElement.cpp:389
> +        return;

Ditto.

> Source/WebCore/html/HTMLFormElement.cpp:394
> +        return;

Ditto.

> Source/WebCore/loader/FrameLoader.cpp:2222
> -    m_quickRedirectComing = (lockBackForwardList == LockBackForwardList::Yes || history().currentItemShouldBeReplaced()) && m_documentLoader && !m_isExecutingJavaScriptFormAction;
> +    m_quickRedirectComing = (lockBackForwardList == LockBackForwardList::Yes || history().currentItemShouldBeReplaced()) && m_documentLoader;

What makes this change safe? Was this boolean doing anything useful before? If so, why isn’t it needed now?