Bug 90518 - Web Inspector: Add OtherText resourceType and text/plain tokenizer
Summary: Web Inspector: Add OtherText resourceType and text/plain tokenizer
Status: RESOLVED INVALID
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (Deprecated) (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Taiju Tsuiki
URL:
Keywords:
Depends on:
Blocks: 68203 90529 90592
  Show dependency treegraph
 
Reported: 2012-07-03 23:57 PDT by Taiju Tsuiki
Modified: 2012-07-09 02:06 PDT (History)
10 users (show)

See Also:


Attachments
Patch (8.33 KB, patch)
2012-07-03 23:59 PDT, Taiju Tsuiki
no flags Details | Formatted Diff | Diff
Patch (8.30 KB, patch)
2012-07-04 00:06 PDT, Taiju Tsuiki
vsevik: review-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.