Bug 55120 - <input value="type=submit"> throws a warning (“HTML parse error”)
Summary: <input value="type=submit"> throws a warning (“HTML parse error”)
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: 528+ (Nightly build)
Hardware: All OS X 10.6
: P2 Normal
Assignee: Nobody
URL: data:text/html,<form><input value="ty...
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2011-02-24 00:45 PST by Mathias Bynens
Modified: 2022-08-06 07:46 PDT (History)
8 users (show)

See Also:


Attachments
Patch (1.42 KB, patch)
2011-02-24 19:00 PST, Adam Barth
no flags Details | Formatted Diff | Diff
Patch (1.67 KB, patch)
2011-02-26 22:13 PST, Adam Barth
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mathias Bynens 2011-02-24 00:45:13 PST
Open data:text/html,<form><input value="type=submit"></form> and open the Web Inspector Console. You’ll find that there’s a warning message: “HTML parse error (recovered gracefully)”.

There’s nothing wrong with this markup though, so it shouldn’t throw a warning.

This used to work fine. The latest stable Safari release, for example (version 5.0.3 / 6533.19.4) didn’t have this problem.
Comment 1 Mathias Bynens 2011-02-24 00:49:33 PST
Same goes for data:text/html,<form><input name="action|method|enctype"></form>
Comment 2 Alexey Proskuryakov 2011-02-24 13:39:13 PST
This document obviously isn't valid HTML, but I cannot tell what exactly the parser complains about. The warning printed to Web Inspector console is not helpful.
Comment 3 Adam Barth 2011-02-24 14:11:40 PST
Please feel free to remove the warnings.  I added them because folks complained about the warnings being missing.
Comment 4 Mathias Bynens 2011-02-24 14:58:32 PST
(In reply to comment #2)
> This document obviously isn't valid HTML, but I cannot tell what exactly the parser complains about. The warning printed to Web Inspector console is not helpful.

If you prefix them with <!doctype html><title></title> both documents are perfectly valid.
Comment 5 Adam Barth 2011-02-24 15:01:34 PST
Surely you need <html>, <head>, and <body> tags somewhere.
Comment 6 Theresa O'Connor 2011-02-24 15:09:18 PST
Adam: no, Mathias is right; adding the doctype and <title> will do the trick. <html>, <head>, and <body> have optional start and end tags.
Comment 7 Adam Barth 2011-02-24 15:14:06 PST
Ah, ok.
Comment 8 Alexey Proskuryakov 2011-02-24 15:44:33 PST
I think that there are two issues here:
1) What error does our parser think that it sees? No amount of boilerplate around this example seem to make the error go away.
2) The warning message should be improved or removed - it seems unlikely that it can help anyone in its current state (the only bit of information it has is a line number, which doesn't seem sufficient).
Comment 9 Adam Barth 2011-02-24 15:46:46 PST
> 1) What error does our parser think that it sees? No amount of boilerplate around this example seem to make the error go away.

If you set a breakpoint in HTMLTreeBuilder::parseError, you'll see the stack that generates the message.  From the stack, you can look at the spec to see the instruction to emit a parse error.  That will let us diagnose whether the bug is in the spec or in the code.

> 2) The warning message should be improved or removed - it seems unlikely that it can help anyone in its current state (the only bit of information it has is a line number, which doesn't seem sufficient).

I definitely agree.
Comment 10 Alexey Proskuryakov 2011-02-24 16:04:37 PST
> If you set a breakpoint in HTMLTreeBuilder::parseError, you'll see the stack that generates the message.

The stack is:

#0	0x1038072c3 in WebCore::HTMLTreeBuilder::parseError at HTMLTreeBuilder.cpp:2809
#1	0x103808345 in WebCore::HTMLTreeBuilder::processAnyOtherEndTagForInBody at HTMLTreeBuilder.cpp:1563
#2	0x103811e93 in WebCore::HTMLTreeBuilder::processEndTagForInBody at HTMLTreeBuilder.cpp:1991
#3	0x10380eb79 in WebCore::HTMLTreeBuilder::processEndTag at HTMLTreeBuilder.cpp:2103
#4	0x10380e551 in WebCore::HTMLTreeBuilder::processToken at HTMLTreeBuilder.cpp:472
#5	0x103813108 in WebCore::HTMLTreeBuilder::constructTreeFromAtomicToken at HTMLTreeBuilder.cpp:450
#6	0x1038134a2 in WebCore::HTMLTreeBuilder::constructTreeFromToken at HTMLTreeBuilder.cpp:445
#7	0x103796c9e in WebCore::HTMLDocumentParser::pumpTokenizer at HTMLDocumentParser.cpp:269

The node in question is a <body>. It is not easy enough for me to read the spec to see if the code follows it here.
Comment 11 Adam Barth 2011-02-24 18:55:53 PST
That code should match up with <http://www.whatwg.org/specs/web-apps/current-work/#parsing-main-inbody> under "Any other end tag."  Specifically:

"Otherwise, if node is in the special category, then this is a parse error; ignore the token, and abort these steps."

if (isSpecialNode(node)) {
    parseError(token);
    return;
}

From this list <http://www.whatwg.org/specs/web-apps/current-work/#special>, body is a special tag.
Comment 12 Adam Barth 2011-02-24 18:56:31 PST
The bug appears to be that we incorrect omit the "Otherwise" in the spec.
Comment 13 Adam Barth 2011-02-24 19:00:20 PST
Created attachment 83760 [details]
Patch
Comment 14 Adam Barth 2011-02-24 19:02:25 PST
Comment on attachment 83760 [details]
Patch

Nope.  That's not it.  There's no control flow from the previous if-block that reaches that line.
Comment 15 Adam Barth 2011-02-26 22:13:29 PST
Created attachment 83965 [details]
Patch
Comment 16 Adam Barth 2011-02-26 22:14:09 PST
These parse error messages aren't ready for prime time.  This patch just nukes them from obit.
Comment 17 Eric Seidel (no email) 2011-02-26 22:33:44 PST
Comment on attachment 83965 [details]
Patch

Someone recently posted a patch which plumbed all console messages up to the client.  That would make these testable.
Comment 18 WebKit Commit Bot 2011-02-26 22:53:37 PST
Comment on attachment 83965 [details]
Patch

Clearing flags on attachment: 83965

Committed r79816: <http://trac.webkit.org/changeset/79816>
Comment 19 Ahmad Saleem 2022-08-06 07:45:05 PDT
This was landed as per Comment 18 and never backed-out, I checked by typing bug number in Webkit Github repo. I am going to mark this as "RESOLVED FIXED", if I am incorrect, please mark it accordingly with updated comments. Thanks!
Comment 20 Radar WebKit Bug Importer 2022-08-06 07:46:16 PDT
<rdar://problem/98242250>