Bug 101910 - Web Inspector: line number of script should be search-able in Timeline Panel
Summary: Web Inspector: line number of script should be search-able in Timeline Panel
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: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-11-12 01:52 PST by pdeng6
Modified: 2012-11-19 22:52 PST (History)
10 users (show)

See Also:


Attachments
the expected result of searching a line number of js. (92.12 KB, image/png)
2012-11-12 01:55 PST, pdeng6
no flags Details
Patch (1.67 KB, patch)
2012-11-12 02:46 PST, pdeng6
no flags Details | Formatted Diff | Diff
Patch (2.44 KB, patch)
2012-11-13 07:33 PST, pdeng6
no flags Details | Formatted Diff | Diff
Patch (5.35 KB, patch)
2012-11-14 03:37 PST, pdeng6
no flags Details | Formatted Diff | Diff
Patch (11.39 KB, patch)
2012-11-14 23:34 PST, pdeng6
no flags Details | Formatted Diff | Diff
Patch (10.27 KB, patch)
2012-11-15 01:42 PST, pdeng6
no flags Details | Formatted Diff | Diff
Patch (10.25 KB, patch)
2012-11-16 05:56 PST, pdeng6
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description pdeng6 2012-11-12 01:52:00 PST
In timeline panel, line number of script is not search-able, such as item:
Function Call(codesite_head.pack.04102009.js:75)
04102009.js is search-able, however, it is not search-able if with line number "75", it makes folks confused I think.
Comment 1 pdeng6 2012-11-12 01:55:33 PST
Created attachment 173588 [details]
the expected result of searching a line number of js.
Comment 2 pdeng6 2012-11-12 02:46:59 PST
Created attachment 173598 [details]
Patch
Comment 3 Yury Semikhatsky 2012-11-13 01:25:21 PST
Comment on attachment 173598 [details]
Patch

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

> Source/WebCore/inspector/front-end/TimelinePanel.js:1361
> +    if (details && details.hasOwnProperty('textContent'))

Would be nice if we could hide this logic in record and have something like record.textForSearch()
Comment 4 eustas.bug 2012-11-13 01:35:45 PST
Comment on attachment 173598 [details]
Patch

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

>> Source/WebCore/inspector/front-end/TimelinePanel.js:1361
>> +    if (details && details.hasOwnProperty('textContent'))
> 
> Would be nice if we could hide this logic in record and have something like record.textForSearch()

WebInspector.Linkifier.prototype._updateAnchor and WebInspector.linkifyURLAsNode should be changed to supply resulting anchor with corresponding expando attribute.
Comment 5 pdeng6 2012-11-13 07:33:49 PST
Created attachment 173890 [details]
Patch
Comment 6 pdeng6 2012-11-13 07:34:34 PST
(In reply to comment #3)
> (From update of attachment 173598 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=173598&action=review
> 
> > Source/WebCore/inspector/front-end/TimelinePanel.js:1361
> > +    if (details && details.hasOwnProperty('textContent'))
> 
> Would be nice if we could hide this logic in record and have something like record.textForSearch()

done, thanks:)
Comment 7 pdeng6 2012-11-13 07:36:09 PST
(In reply to comment #4)
> (From update of attachment 173598 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=173598&action=review
> 
> >> Source/WebCore/inspector/front-end/TimelinePanel.js:1361
> >> +    if (details && details.hasOwnProperty('textContent'))
> > 
> > Would be nice if we could hide this logic in record and have something like record.textForSearch()
> 
> WebInspector.Linkifier.prototype._updateAnchor and WebInspector.linkifyURLAsNode should be changed to supply resulting anchor with corresponding expando attribute.

Could you please describe the reason? thanks.
Comment 8 Pavel Feldman 2012-11-14 00:20:26 PST
Comment on attachment 173890 [details]
Patch

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

> Source/WebCore/inspector/front-end/TimelinePresentationModel.js:930
> +        if (details && details.hasOwnProperty('textContent'))

You should check for (details instanceof Node) and then use textContent.

But as Eugene mentioned, the fact that details() returns either string or Node is the root of the problem. I'd rename details() to detailsNode() and create a span with text in case of text content there. Then I would use detailsNode.textContent in testContentMatching and removed the similar type check from WebInspector.TimelineRecordListRow.prototype.update + would also use appendElementRow in _generatePopupContentWithImagePreview.
Comment 9 pdeng6 2012-11-14 03:37:34 PST
Created attachment 174122 [details]
Patch
Comment 10 pdeng6 2012-11-14 03:38:29 PST
(In reply to comment #8)
> (From update of attachment 173890 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=173890&action=review
> 
> > Source/WebCore/inspector/front-end/TimelinePresentationModel.js:930
> > +        if (details && details.hasOwnProperty('textContent'))
> 
> You should check for (details instanceof Node) and then use textContent.
> 
> But as Eugene mentioned, the fact that details() returns either string or Node is the root of the problem. I'd rename details() to detailsNode() and create a span with text in case of text content there. Then I would use detailsNode.textContent in testContentMatching and removed the similar type check from WebInspector.TimelineRecordListRow.prototype.update + would also use appendElementRow in _generatePopupContentWithImagePreview.

Good point, thanks, Done!
Comment 11 Pavel Feldman 2012-11-14 03:47:03 PST
Comment on attachment 174122 [details]
Patch

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

> Source/WebCore/inspector/front-end/TimelinePresentationModel.js:888
> +                    contentHelper._appendTextRow(WebInspector.UIString("Details"), this.detailsNode().textContent);

I wonder if you should do appendElementRow here in order to not lose the formatting and save on operations.

> Source/WebCore/inspector/front-end/TimelinePresentationModel.js:930
> +                detailsContainer.appendChild(document.createTextNode("("));

I'd bring this back - otherwise, you can't reuse it in the popup above and you add "(" twice in the search matcher.

I would simply replace 
return this.data ? this.data["type"] : null;
with
return this.data ? createSpan(this.data["type"]) : null;
in _getRecordDetails

I think it is Ok to have it nullable Node. I.e. 
/**
 * @return {?Node}
 */
_getRecordDetails

caching could be done via testing for (typeof this._details === "undefined") so that you don't compute null over and over.
Comment 12 pdeng6 2012-11-14 23:34:36 PST
Created attachment 174361 [details]
Patch
Comment 13 pdeng6 2012-11-14 23:46:25 PST
(In reply to comment #11)
> (From update of attachment 174122 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=174122&action=review
> 
> > Source/WebCore/inspector/front-end/TimelinePresentationModel.js:888
> > +                    contentHelper._appendTextRow(WebInspector.UIString("Details"), this.detailsNode().textContent);
> 
> I wonder if you should do appendElementRow here in order to not lose the formatting and save on operations.
> 
> > Source/WebCore/inspector/front-end/TimelinePresentationModel.js:930
> > +                detailsContainer.appendChild(document.createTextNode("("));
> 
> I'd bring this back - otherwise, you can't reuse it in the popup above and you add "(" twice in the search matcher.

agree, TimelineRecordListRow.prototype.update and testContentMatching need "()", however popup won't use it, so I write detailsNode() & details()

> 
> I would simply replace 
> return this.data ? this.data["type"] : null;
> with
> return this.data ? createSpan(this.data["type"]) : null;
> in _getRecordDetails
Good point, original _getRecordDetails may return {null|undefined|Node|string}
now, changed to {null|Node}

> 
> I think it is Ok to have it nullable Node. I.e. 

> /**
>  * @return {?Node}
>  */
> _getRecordDetails
> 
> caching could be done via testing for (typeof this._details === "undefined") so that you don't compute null over and over.
Good idea, done!
Comment 14 Pavel Feldman 2012-11-15 00:52:18 PST
Comment on attachment 174361 [details]
Patch

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

> Source/WebCore/inspector/front-end/TimelinePanel.js:1344
> +    toSearchText += record.detailsNode() ? (" " + record.detailsNode().textContent) : "";

Nit: you don't need ternary operator when second part is noop.
if (record.detailsNode())
    toSearchText += record.detailsNode();

> Source/WebCore/inspector/front-end/TimelinePresentationModel.js:925
> +            this._details = this._getRecordDetails() ? this._getRecordDetails().textContent : this._getRecordDetails();

This way you build record details node twice. I don't think you need this method at all btw.

> Source/WebCore/inspector/front-end/TimelinePresentationModel.js:959
> +        case WebInspector.TimelineModel.RecordType.GCEvent:

Please separate formatting changes from the semantics ones. I can't track what has changed here. I wouldn't change it at this point since we'll lose blame capabilities.

> Source/WebCore/inspector/front-end/TimelinePresentationModel.js:1020
> +        if (typeof details !== "object")

typeof details === "string"
Comment 15 pdeng6 2012-11-15 01:42:21 PST
Created attachment 174369 [details]
Patch
Comment 16 pdeng6 2012-11-15 01:44:32 PST
(In reply to comment #14)
> (From update of attachment 174361 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=174361&action=review
> 
> > Source/WebCore/inspector/front-end/TimelinePanel.js:1344
> > +    toSearchText += record.detailsNode() ? (" " + record.detailsNode().textContent) : "";
> 
> Nit: you don't need ternary operator when second part is noop.
> if (record.detailsNode())
>     toSearchText += record.detailsNode();
> 
thanks, done
> > Source/WebCore/inspector/front-end/TimelinePresentationModel.js:925
> > +            this._details = this._getRecordDetails() ? this._getRecordDetails().textContent : this._getRecordDetails();
> 
> This way you build record details node twice. I don't think you need this method at all btw.
agree, removed this method.
> 
> > Source/WebCore/inspector/front-end/TimelinePresentationModel.js:959
> > +        case WebInspector.TimelineModel.RecordType.GCEvent:
> 
> Please separate formatting changes from the semantics ones. I can't track what has changed here. I wouldn't change it at this point since we'll lose blame capabilities.
see :), formats will be changed in another patch.
> 
> > Source/WebCore/inspector/front-end/TimelinePresentationModel.js:1020
> > +        if (typeof details !== "object")
> 
> typeof details === "string"

done, thanks.
Comment 17 WebKit Review Bot 2012-11-15 02:45:21 PST
Comment on attachment 174369 [details]
Patch

Attachment 174369 [details] did not pass chromium-ews (chromium-xvfb):
Output: http://queues.webkit.org/results/14845397

New failing tests:
inspector-protocol/debugger-terminate-dedicated-worker-while-paused.html
Comment 18 Pavel Feldman 2012-11-15 06:03:49 PST
Comment on attachment 174369 [details]
Patch

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

> Source/WebCore/inspector/front-end/TimelinePresentationModel.js:888
> +                    contentHelper._appendTextRow(WebInspector.UIString("Details"), this.detailsNode().childNodes[1].textContent);

So this is a third time I am suggesting to call appendElementRow here :) Is there a reason why this is bad?

> Source/WebCore/inspector/front-end/TimelinePresentationModel.js:1006
> +        if (!details)

You don't need this check now.
Comment 19 pdeng6 2012-11-15 21:01:34 PST
(In reply to comment #18)
> (From update of attachment 174369 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=174369&action=review
> 
> > Source/WebCore/inspector/front-end/TimelinePresentationModel.js:888
> > +                    contentHelper._appendTextRow(WebInspector.UIString("Details"), this.detailsNode().childNodes[1].textContent);
> 
> So this is a third time I am suggesting to call appendElementRow here :) Is there a reason why this is bad?
I've tested it, appendElementRow will move the node from TimelineRecordListRow to contentHelper, did I mis-use this function? or a deep cloned node needed?
> 
> > Source/WebCore/inspector/front-end/TimelinePresentationModel.js:1006
> > +        if (!details)
> 
> You don't need this check now.

without this, this method may return undefined, and the testing for (typeof this._details === "undefined") will not work.
I would like to change as < return details ? details : null >, how do you think of it?
Comment 20 Pavel Feldman 2012-11-16 04:56:16 PST
Comment on attachment 174369 [details]
Patch

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

>>> Source/WebCore/inspector/front-end/TimelinePresentationModel.js:888
>>> +                    contentHelper._appendTextRow(WebInspector.UIString("Details"), this.detailsNode().childNodes[1].textContent);
>> 
>> So this is a third time I am suggesting to call appendElementRow here :) Is there a reason why this is bad?
> 
> I've tested it, appendElementRow will move the node from TimelineRecordListRow to contentHelper, did I mis-use this function? or a deep cloned node needed?

Yeah, you probably want to clone it and you don't want ( and ) to be a part of the details node, right?

>>> Source/WebCore/inspector/front-end/TimelinePresentationModel.js:1006
>>> +        if (!details)
>> 
>> You don't need this check now.
> 
> without this, this method may return undefined, and the testing for (typeof this._details === "undefined") will not work.
> I would like to change as < return details ? details : null >, how do you think of it?

Just put var details = null; above?
Comment 21 pdeng6 2012-11-16 05:56:57 PST
Created attachment 174659 [details]
Patch
Comment 22 pdeng6 2012-11-16 06:10:59 PST
(In reply to comment #20)
> (From update of attachment 174369 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=174369&action=review
> 
> >>> Source/WebCore/inspector/front-end/TimelinePresentationModel.js:888
> >>> +                    contentHelper._appendTextRow(WebInspector.UIString("Details"), this.detailsNode().childNodes[1].textContent);
> >> 
> >> So this is a third time I am suggesting to call appendElementRow here :) Is there a reason why this is bad?
> > 
> > I've tested it, appendElementRow will move the node from TimelineRecordListRow to contentHelper, did I mis-use this function? or a deep cloned node needed?
> 
> Yeah, you probably want to clone it and you don't want ( and ) to be a part of the details node, right?
thanks. cloned it.
> 
> >>> Source/WebCore/inspector/front-end/TimelinePresentationModel.js:1006
> >>> +        if (!details)
> >> 
> >> You don't need this check now.
> > 
> > without this, this method may return undefined, and the testing for (typeof this._details === "undefined") will not work.
> > I would like to change as < return details ? details : null >, how do you think of it?
> 
> Just put var details = null; above?
I think "var details = null" won't solve, "details" may be set undefined during switch..
Comment 23 WebKit Review Bot 2012-11-19 05:01:59 PST
Comment on attachment 174659 [details]
Patch

Rejecting attachment 174659 [details] from commit-queue.

pan.deng@intel.com does not have committer permissions according to http://trac.webkit.org/browser/trunk/Tools/Scripts/webkitpy/common/config/committers.py.

- If you do not have committer rights please read http://webkit.org/coding/contributing.html for instructions on how to use bugzilla flags.

- If you have committer rights please correct the error in Tools/Scripts/webkitpy/common/config/committers.py by adding yourself to the file (no review needed).  The commit-queue restarts itself every 2 hours.  After restart the commit-queue will correctly respect your committer rights.
Comment 24 WebKit Review Bot 2012-11-19 22:52:34 PST
Comment on attachment 174659 [details]
Patch

Clearing flags on attachment: 174659

Committed r135254: <http://trac.webkit.org/changeset/135254>
Comment 25 WebKit Review Bot 2012-11-19 22:52:39 PST
All reviewed patches have been landed.  Closing bug.