Bug 148874 - formaction must return document's address when formaction is missing
Summary: formaction must return document's address when formaction is missing
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Forms (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Ryosuke Niwa
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2015-09-04 19:48 PDT by Ryosuke Niwa
Modified: 2016-01-13 16:05 PST (History)
7 users (show)

See Also:


Attachments
Fixes the bug (11.28 KB, patch)
2016-01-12 18:25 PST, Ryosuke Niwa
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ews103 for mac-yosemite (846.57 KB, application/zip)
2016-01-12 19:20 PST, Build Bot
no flags Details
Archive of layout-test-results from ews113 for mac-yosemite (755.21 KB, application/zip)
2016-01-12 19:22 PST, Build Bot
no flags Details
Archive of layout-test-results from ews105 for mac-yosemite-wk2 (733.47 KB, application/zip)
2016-01-12 19:23 PST, Build Bot
no flags Details
Rebaselined a test (13.05 KB, patch)
2016-01-12 19:26 PST, Ryosuke Niwa
cdumez: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ryosuke Niwa 2015-09-04 19:48:15 PDT
See https://html.spec.whatwg.org/multipage/forms.html#dom-fs-formaction

"The formAction IDL attribute must reflect the formaction content attribute, except that on getting,
when the content attribute is missing or its value is the empty string, the document's address must be returned instead.
The formEnctype IDL attribute must reflect the formenctype content attribute, limited to only known values."

This bug was found by the newly added test:
LayoutTests/http/tests/w3c/html/semantics/forms/attributes-common-to-form-controls/formaction.html

Chrome passes this test whereas Firefox fail.
Comment 1 Radar WebKit Bug Importer 2015-09-04 19:48:35 PDT
<rdar://problem/22590190>
Comment 2 Ryosuke Niwa 2015-09-04 19:49:07 PDT
html/semantics/forms/attributes-common-to-form-controls/formAction_document_address.html also fails for the same reason.
Comment 3 Ryosuke Niwa 2016-01-12 18:25:34 PST
Created attachment 268833 [details]
Fixes the bug
Comment 4 Build Bot 2016-01-12 19:20:29 PST
Comment on attachment 268833 [details]
Fixes the bug

Attachment 268833 [details] did not pass mac-ews (mac):
Output: http://webkit-queues.webkit.org/results/684670

New failing tests:
imported/w3c/web-platform-tests/html/semantics/forms/attributes-common-to-form-controls/formAction_document_address.html
Comment 5 Build Bot 2016-01-12 19:20:31 PST
Created attachment 268838 [details]
Archive of layout-test-results from ews103 for mac-yosemite

The attached test failures were seen while running run-webkit-tests on the mac-ews.
Bot: ews103  Port: mac-yosemite  Platform: Mac OS X 10.10.5
Comment 6 Build Bot 2016-01-12 19:22:30 PST
Comment on attachment 268833 [details]
Fixes the bug

Attachment 268833 [details] did not pass mac-debug-ews (mac):
Output: http://webkit-queues.webkit.org/results/684663

New failing tests:
imported/w3c/web-platform-tests/html/semantics/forms/attributes-common-to-form-controls/formAction_document_address.html
Comment 7 Build Bot 2016-01-12 19:22:33 PST
Created attachment 268839 [details]
Archive of layout-test-results from ews113 for mac-yosemite

The attached test failures were seen while running run-webkit-tests on the mac-debug-ews.
Bot: ews113  Port: mac-yosemite  Platform: Mac OS X 10.10.5
Comment 8 Build Bot 2016-01-12 19:23:18 PST
Comment on attachment 268833 [details]
Fixes the bug

Attachment 268833 [details] did not pass mac-wk2-ews (mac-wk2):
Output: http://webkit-queues.webkit.org/results/684671

New failing tests:
imported/w3c/web-platform-tests/html/semantics/forms/attributes-common-to-form-controls/formAction_document_address.html
Comment 9 Build Bot 2016-01-12 19:23:20 PST
Created attachment 268840 [details]
Archive of layout-test-results from ews105 for mac-yosemite-wk2

The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews.
Bot: ews105  Port: mac-yosemite-wk2  Platform: Mac OS X 10.10.5
Comment 10 Ryosuke Niwa 2016-01-12 19:26:53 PST
Created attachment 268842 [details]
Rebaselined a test
Comment 11 Chris Dumez 2016-01-13 14:17:05 PST
Comment on attachment 268842 [details]
Rebaselined a test

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

r=me with nits.

> Source/WebCore/html/HTMLFormControlElement.cpp:110
> +    if (value.isNull() || value.isEmpty())

The second check is sufficient as isEmpty() will return true if null.

> Source/WebCore/html/HTMLFormControlElement.cpp:112
> +    return getURLAttribute(formactionAttr);

return document().completeURL(stripLeadingAndTrailingHTMLSpaces(value)); ? to avoid looking up the attribute again.

> Source/WebCore/html/HTMLFormControlElement.h:57
> +    void setFormAction(const String&);

Could take a const AtomicString& in parameter.

> LayoutTests/fast/forms/formaction-attribute-with-empty-value.html:6
> +

No description() ?

> LayoutTests/fast/forms/formaction-attribute-with-empty-value.html:25
> +var successfullyParsed = true;

Why this?
Comment 12 Ryosuke Niwa 2016-01-13 14:23:43 PST
Comment on attachment 268842 [details]
Rebaselined a test

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

>> Source/WebCore/html/HTMLFormControlElement.cpp:110
>> +    if (value.isNull() || value.isEmpty())
> 
> The second check is sufficient as isEmpty() will return true if null.

Fixed.

>> Source/WebCore/html/HTMLFormControlElement.cpp:112
>> +    return getURLAttribute(formactionAttr);
> 
> return document().completeURL(stripLeadingAndTrailingHTMLSpaces(value)); ? to avoid looking up the attribute again.

I didn't want to duplicate the code here so I'd keep it as is since I don't think this property is performance critical.

>> Source/WebCore/html/HTMLFormControlElement.h:57
>> +    void setFormAction(const String&);
> 
> Could take a const AtomicString& in parameter.

Fixed.

>> LayoutTests/fast/forms/formaction-attribute-with-empty-value.html:6
>> +
> 
> No description() ?

Added.

>> LayoutTests/fast/forms/formaction-attribute-with-empty-value.html:25
>> +var successfullyParsed = true;
> 
> Why this?

Removed.
Comment 13 Ryosuke Niwa 2016-01-13 16:05:08 PST
Committed r194999: <http://trac.webkit.org/changeset/194999>