Bug 111528

Summary: View Source does not show trailing truncated tags
Product: WebKit Reporter: David Benjamin <davidben>
Component: WebCore Misc.Assignee: Nobody <webkit-unassigned>
Status: UNCONFIRMED ---    
Severity: Normal CC: abarth, eric, hsivonen
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   

Description David Benjamin 2013-03-05 23:34:32 PST
This is pretty minor, but if you view source on a file like:

Blah blah

The "<b" gets lost in View Source (tested in Chrome). I didn't look too closely at the details, but it seems this comes from View Source being based on the HTML tokenizer. If you get an EOF in the "tag name state", no token is emitted for the truncated tag and instead it goes straight to emitting an EOF token.

Comment 1 Eric Seidel (no email) 2013-03-06 11:02:29 PST
I think we could add a test for this with "failing" expectations and close this.  I don't think we plan to change this behavior anytime soon. :)  There are strong advantages to using the real HTML parser for view source.  I guess in this case we could special case EOF and check if there were any dropped chars from the last token.
Comment 2 Adam Barth 2013-03-06 14:35:50 PST
Maybe the SourceTracker can help us get any leftover source from an incomplete last token?
Comment 3 Henri Sivonen 2013-03-06 22:10:49 PST
FWIW, using a real HTML parser for View Source doesn't mean that you have to drop a trailing partial tag on the floor in the source view. See Gecko. :-)