Bug 89642 - Web Inspector: Add requestFileContent command and fileContentReceived event
Summary: Web Inspector: Add requestFileContent command and fileContentReceived event
Status: RESOLVED FIXED
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: 73301 89420
Blocks: 68203
  Show dependency treegraph
 
Reported: 2012-06-21 01:12 PDT by Taiju Tsuiki
Modified: 2012-07-02 07:12 PDT (History)
11 users (show)

See Also:


Attachments
Patch (17.84 KB, patch)
2012-06-21 01:15 PDT, Taiju Tsuiki
no flags Details | Formatted Diff | Diff
Patch (17.66 KB, patch)
2012-06-24 20:50 PDT, Taiju Tsuiki
no flags Details | Formatted Diff | Diff
Patch (18.30 KB, patch)
2012-07-01 23:19 PDT, Taiju Tsuiki
no flags 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-06-21 01:12:00 PDT
Preparing for adding FileContentView to Inspector, I'd like to add a command to read file content.
Comment 1 Taiju Tsuiki 2012-06-21 01:15:44 PDT
Created attachment 148744 [details]
Patch
Comment 2 Taiju Tsuiki 2012-06-24 20:50:27 PDT
Created attachment 149234 [details]
Patch
Comment 3 Vsevolod Vlasov 2012-06-28 12:19:17 PDT
Comment on attachment 149234 [details]
Patch

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

Could you please share your plans on using the data loaded as a dataURL on front-end?
Why do think dataURL is the best format for passing it to front-end?

We already have some methods for loading content (including base64 encoded) in InspectorPageAgent. Can we reuse something to make code simpler?

> Source/WebCore/inspector/Inspector.json:1479
> +                    { "name": "end", "type": "integer", "description": "Index of the next of last byte to read." }

next of last?
Comment 4 Taiju Tsuiki 2012-06-29 00:38:43 PDT
I (In reply to comment #3)
> (From update of attachment 149234 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=149234&action=review
> 
> Could you please share your plans on using the data loaded as a dataURL on front-end?
> Why do think dataURL is the best format for passing it to front-end?
> 
> We already have some methods for loading content (including base64 encoded) in InspectorPageAgent. Can we reuse something to make code simpler?
> 

OK.
I'd like to preview text files, images and fonts on Inspector, like other resources in initial version.
And also as a next step, I want to add "save as". Considering remote debugging, we need to store whole file content in front-end to implement it, because filesystem: URL is available only on back-end.
I'll use sliced retrieving to avoid blocking channel to backend.

I don't have strong opinion for what format we should use. It's OK for me to use base64.
# Of course, it's best to use binary format if we could.
Data URL was from a old code when I tried to read it with XHR in earlier version, which not allowed in WebKit.

InspectorPageAgent::getResourceContent() looks nice, but it can load only a resource on the frame, can't it?
For my use, I need to load other resources, not already loaded nor on cache.

> > Source/WebCore/inspector/Inspector.json:1479
> > +                    { "name": "end", "type": "integer", "description": "Index of the next of last byte to read." }
> 
> next of last?
Comment 5 Taiju Tsuiki 2012-06-29 00:39:13 PDT
Comment on attachment 149234 [details]
Patch

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

>> Source/WebCore/inspector/Inspector.json:1479
>> +                    { "name": "end", "type": "integer", "description": "Index of the next of last byte to read." }
> 
> next of last?

I mean, the range to read does not include end'th byte, as {String,Array,Blob}.slice do.
I'll replace it with "Specifies the end of range to read exclusively." in next patch.
Comment 6 Taiju Tsuiki 2012-07-01 23:19:03 PDT
Created attachment 150361 [details]
Patch
Comment 7 Vsevolod Vlasov 2012-07-02 04:56:57 PDT
Comment on attachment 150361 [details]
Patch

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

> Source/WebCore/inspector/InspectorFileSystemAgent.cpp:528
> +    String encodedResult = base64Encode(static_cast<char*>(result->data()), result->byteLength());

I think we will need to use FileReader::getAsText to deal with text files encodings at some point, but we can add it later.
Comment 8 WebKit Review Bot 2012-07-02 07:12:22 PDT
Comment on attachment 150361 [details]
Patch

Clearing flags on attachment: 150361

Committed r121676: <http://trac.webkit.org/changeset/121676>
Comment 9 WebKit Review Bot 2012-07-02 07:12:27 PDT
All reviewed patches have been landed.  Closing bug.