Bug 90518

Summary: Web Inspector: Add OtherText resourceType and text/plain tokenizer
Product: WebKit Reporter: Taiju Tsuiki <tzik>
Component: Web Inspector (Deprecated)Assignee: Taiju Tsuiki <tzik>
Status: RESOLVED INVALID    
Severity: Normal CC: apavlov, bweinstein, joepeck, keishi, loislo, pfeldman, pmuellr, rik, timothy, yurys
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Bug Depends on:    
Bug Blocks: 68203, 90529, 90592    
Attachments:
Description Flags
Patch
none
Patch vsevik: review-

Description Taiju Tsuiki 2012-07-03 23:57:36 PDT
Inspector in ToT has tokenizer for HTML, CSS and JS now, and TextEditorHighlighter uses HTML tokenizer as default.
But, I'd like to show a preview for other text file as plain text.

IMO, a possible solution is adding OtherText as another ResourceType and using SourceTokenizer as tokenizer for "text/plain".
Comment 1 Taiju Tsuiki 2012-07-03 23:59:14 PDT
Created attachment 150721 [details]
Patch
Comment 2 Taiju Tsuiki 2012-07-04 00:06:05 PDT
Created attachment 150722 [details]
Patch
Comment 3 Vsevolod Vlasov 2012-07-05 13:46:41 PDT
Comment on attachment 150722 [details]
Patch

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

> Source/WebCore/ChangeLog:3
> +        Web Inspector: Add OtherText resource type and text/plain tokenizer

I don't think we should add another resource type for this. Resource type are essentially duplicating CachedResource types and we don't want to extend this list.
You should use Other instead.
Backend could decide whether file has text content or not based on the mime type. Binary content should be served to frontend base64 encoded.
(We already have some text detecting heuristics in NetworkResourcesData: http://code.google.com/p/chromium/source/search?q=file%3Ainspector+%22.mimetype+%3D+%22&origq=file%3Ainspector+%22.mimetype+%3D+%22&btnG=Search+Trunk )
Frontend can then show content as text if it is not base64 encoded.
Comment 4 Pavel Feldman 2012-07-05 21:32:23 PDT
As per comment #3.
Comment 5 Taiju Tsuiki 2012-07-09 02:06:26 PDT
Comment on attachment 150722 [details]
Patch

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

>> Source/WebCore/ChangeLog:3
>> +        Web Inspector: Add OtherText resource type and text/plain tokenizer
> 
> I don't think we should add another resource type for this. Resource type are essentially duplicating CachedResource types and we don't want to extend this list.
> You should use Other instead.
> Backend could decide whether file has text content or not based on the mime type. Binary content should be served to frontend base64 encoded.
> (We already have some text detecting heuristics in NetworkResourcesData: http://code.google.com/p/chromium/source/search?q=file%3Ainspector+%22.mimetype+%3D+%22&origq=file%3Ainspector+%22.mimetype+%3D+%22&btnG=Search+Trunk )
> Frontend can then show content as text if it is not base64 encoded.

I see. OK, I'll go other way than adding OtherText.
As back-end side of NetworkResourcesData does, DOMImplementation::is{Text,XML}MIMEType seems to work for detecting text file.