Bug 99179 - Web Inspector: Saving HAR, snapshots and timeline data do not work in remote debugging mode
Summary: Web Inspector: Saving HAR, snapshots and timeline data do not work in remote ...
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: eustas.bug
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-10-12 08:19 PDT by eustas.bug
Modified: 2012-11-15 18:43 PST (History)
12 users (show)

See Also:


Attachments
Patch (6.03 KB, patch)
2012-10-12 08:40 PDT, eustas.bug
no flags Details | Formatted Diff | Diff
Patch (9.06 KB, patch)
2012-10-15 00:22 PDT, eustas.bug
no flags Details | Formatted Diff | Diff
Patch (11.52 KB, patch)
2012-10-15 08:25 PDT, eustas.bug
no flags Details | Formatted Diff | Diff
Patch (11.47 KB, patch)
2012-10-15 22:03 PDT, eustas.bug
no flags Details | Formatted Diff | Diff
Patch (11.50 KB, patch)
2012-10-16 00:50 PDT, eustas.bug
no flags Details | Formatted Diff | Diff
Patch (11.50 KB, patch)
2012-10-16 06:26 PDT, eustas.bug
no flags Details | Formatted Diff | Diff
Patch (11.52 KB, patch)
2012-10-17 04:48 PDT, eustas.bug
no flags Details | Formatted Diff | Diff
Patch (11.96 KB, patch)
2012-10-17 07:30 PDT, eustas.bug
yurys: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Comment 1 eustas.bug 2012-10-12 08:40:20 PDT
Created attachment 168426 [details]
Patch
Comment 2 Andrey Kosyakov 2012-10-12 08:59:45 PDT
Comment on attachment 168426 [details]
Patch

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

> Source/WebCore/inspector/front-end/FileManager.js:58
> +        return InspectorFrontendHost.canSave() && ("append" in InspectorFrontendHost) && (!("canAppend" in InspectorFrontendHost) || InspectorFrontendHost.canAppend());

Looks like InspectorFrontendHost.canAppend() is always false.

> Source/WebCore/inspector/front-end/FileUtils.js:350
> +    this._isBuffering = !WebInspector.fileManager.canAppend();

So now each method of the class looks like if (this._isBuffering) { ... } else { ... }. I think that's an indication that we should be using a different implementation of OutputStream instead of abusing FileOutputStrem. I'd suggest adding BlobOutputStream and a factory method that creates either of the streams based on whether we canAppend().

> Source/WebCore/inspector/front-end/FileUtils.js:391
> +        function callbackWrapper()
> +        {
> +            callback(this);
> +        }

why not bind to callback directly?

> Source/WebCore/inspector/front-end/InspectorFrontendHostStub.js:151
> +        function cleanup() {
> +            window.URL.revokeObjectURL(objectUrl);
>          }

style: { => next line
I think this could also be inlined into setTimeout()
Comment 3 eustas.bug 2012-10-15 00:20:50 PDT
Comment on attachment 168426 [details]
Patch

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

>> Source/WebCore/inspector/front-end/FileManager.js:58
>> +        return InspectorFrontendHost.canSave() && ("append" in InspectorFrontendHost) && (!("canAppend" in InspectorFrontendHost) || InspectorFrontendHost.canAppend());
> 
> Looks like InspectorFrontendHost.canAppend() is always false.

Addressed.

>> Source/WebCore/inspector/front-end/FileUtils.js:350
>> +    this._isBuffering = !WebInspector.fileManager.canAppend();
> 
> So now each method of the class looks like if (this._isBuffering) { ... } else { ... }. I think that's an indication that we should be using a different implementation of OutputStream instead of abusing FileOutputStrem. I'd suggest adding BlobOutputStream and a factory method that creates either of the streams based on whether we canAppend().

Done.

>> Source/WebCore/inspector/front-end/FileUtils.js:391
>> +        }
> 
> why not bind to callback directly?

Fixed.

>> Source/WebCore/inspector/front-end/InspectorFrontendHostStub.js:151
>>          }
> 
> style: { => next line
> I think this could also be inlined into setTimeout()

Done.
Comment 4 eustas.bug 2012-10-15 00:22:13 PDT
Created attachment 168636 [details]
Patch
Comment 5 eustas.bug 2012-10-15 08:25:19 PDT
Created attachment 168714 [details]
Patch
Comment 6 Build Bot 2012-10-15 08:34:40 PDT
Comment on attachment 168714 [details]
Patch

Attachment 168714 [details] did not pass mac-ews (mac):
Output: http://queues.webkit.org/results/14299700
Comment 7 eustas.bug 2012-10-15 22:03:58 PDT
Created attachment 168851 [details]
Patch
Comment 8 Andrey Kosyakov 2012-10-15 23:05:01 PDT
Comment on attachment 168851 [details]
Patch

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

> Source/WebCore/inspector/front-end/HeapSnapshotView.js:956
> +        return !this.fromFile() && !!this._snapshotProxy && !this._receiver;

nit: I don't think !! has any effect here.

> Source/WebCore/inspector/front-end/InspectorFrontendHostStub.js:151
> +        setTimeout(function() {

style: { => next line.
consider bind?

> Source/WebCore/inspector/front-end/InspectorFrontendHostStub.js:163
> +        setTimeout(function() {

ditto.

> Source/WebCore/inspector/front-end/InspectorFrontendHostStub.js:179
> +        setTimeout(function() {

ditto
Comment 9 eustas.bug 2012-10-16 00:43:39 PDT
Comment on attachment 168851 [details]
Patch

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

>> Source/WebCore/inspector/front-end/HeapSnapshotView.js:956
>> +        return !this.fromFile() && !!this._snapshotProxy && !this._receiver;
> 
> nit: I don't think !! has any effect here.

This makes influence on return value type.
Without cast, return value is {boolean|null} instead of {boolean}.

>> Source/WebCore/inspector/front-end/InspectorFrontendHostStub.js:151
>> +        setTimeout(function() {
> 
> style: { => next line.
> consider bind?

OK.

>> Source/WebCore/inspector/front-end/InspectorFrontendHostStub.js:163
>> +        setTimeout(function() {
> 
> ditto.

Done

>> Source/WebCore/inspector/front-end/InspectorFrontendHostStub.js:179
>> +        setTimeout(function() {
> 
> ditto

Binding is impossible. Explicitly declared nested function.
Comment 10 eustas.bug 2012-10-16 00:50:05 PDT
Created attachment 168879 [details]
Patch
Comment 11 Andrey Kosyakov 2012-10-16 05:56:06 PDT
Comment on attachment 168879 [details]
Patch

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

LGTM with a nit.

> Source/WebCore/inspector/front-end/InspectorFrontendHostStub.js:176
> +        function cleanup() {

{ => next line, please.
Comment 12 eustas.bug 2012-10-16 06:26:36 PDT
Created attachment 168934 [details]
Patch
Comment 13 Yury Semikhatsky 2012-10-17 01:36:23 PDT
Comment on attachment 168934 [details]
Patch

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

> Source/WebCore/inspector/InspectorFrontendHost.cpp:253
> +void InspectorFrontendHost::close(const String& /* url */) { }

style: remove comment and put each brace on its own line.

> Source/WebCore/inspector/front-end/InspectorFrontendHostStub.js:151
> +        setTimeout(WebInspector.fileManager.savedURL.bind(WebInspector.fileManager, url), 0);

Why do you need setTimeout here?

> Source/WebCore/inspector/front-end/InspectorFrontendHostStub.js:161
> +        setTimeout(WebInspector.fileManager.appendedToURL.bind(WebInspector.fileManager, url), 0);

Why do you need setTimeout here?

> Source/WebCore/inspector/front-end/InspectorFrontendHostStub.js:180
> +        setTimeout(cleanup, 0);

Is there an event that we could listen to instead of scheduling revokeObjectURL on timeout?
Comment 14 eustas.bug 2012-10-17 04:10:52 PDT
Comment on attachment 168934 [details]
Patch

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

>> Source/WebCore/inspector/InspectorFrontendHost.cpp:253
>> +void InspectorFrontendHost::close(const String& /* url */) { }
> 
> style: remove comment and put each brace on its own line.

Done.

>> Source/WebCore/inspector/front-end/InspectorFrontendHostStub.js:151
>> +        setTimeout(WebInspector.fileManager.savedURL.bind(WebInspector.fileManager, url), 0);
> 
> Why do you need setTimeout here?

It is expected (by caller) that callback is invoked asynchronously.

>> Source/WebCore/inspector/front-end/InspectorFrontendHostStub.js:161
>> +        setTimeout(WebInspector.fileManager.appendedToURL.bind(WebInspector.fileManager, url), 0);
> 
> Why do you need setTimeout here?

Ditto.

>> Source/WebCore/inspector/front-end/InspectorFrontendHostStub.js:180
>> +        setTimeout(cleanup, 0);
> 
> Is there an event that we could listen to instead of scheduling revokeObjectURL on timeout?

There are no specific events for Blobs.
window events do not fire either.
Comment 15 eustas.bug 2012-10-17 04:48:17 PDT
Created attachment 169158 [details]
Patch
Comment 16 Yury Semikhatsky 2012-10-17 05:36:41 PDT
Comment on attachment 169158 [details]
Patch

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

> Source/WebCore/inspector/front-end/InspectorFrontendHostStub.js:174
> +        window.location = objectUrl + "#" + url;

Can we use hostname instead?
Comment 17 eustas.bug 2012-10-17 07:29:53 PDT
Comment on attachment 169158 [details]
Patch

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

>> Source/WebCore/inspector/front-end/InspectorFrontendHostStub.js:174
>> +        window.location = objectUrl + "#" + url;
> 
> Can we use hostname instead?

addressed
Comment 18 eustas.bug 2012-10-17 07:30:33 PDT
Created attachment 169182 [details]
Patch
Comment 19 WebKit Review Bot 2012-10-18 23:13:02 PDT
Comment on attachment 169182 [details]
Patch

Rejecting attachment 169182 [details] from commit-queue.

Failed to run "['/mnt/git/webkit-commit-queue/Tools/Scripts/webkit-patch', '--status-host=queues.webkit.org', '-..." exit_code: 1

ERROR: /mnt/git/webkit-commit-queue/Source/WebKit/chromium/ChangeLog neither lists a valid reviewer nor contains the string "Unreviewed" or "Rubber stamp" (case insensitive).

Full output: http://queues.webkit.org/results/14412891
Comment 20 Andrey Kosyakov 2012-10-19 01:02:43 PDT
Committed r131872: <http://trac.webkit.org/changeset/131872>