Bug 178799 - Web Inspector: Canvas Tab: no way to see backtrace of where a canvas context was created
Summary: Web Inspector: Canvas Tab: no way to see backtrace of where a canvas context ...
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (show other bugs)
Version: WebKit Nightly Build
Hardware: All All
: P2 Normal
Assignee: Devin Rousso
Keywords: InRadar
Depends on:
Blocks: WebInspectorCanvasTab
  Show dependency treegraph
Reported: 2017-10-25 09:50 PDT by BJ Burg
Modified: 2017-12-04 17:31 PST (History)
11 users (show)

See Also:

Patch (23.11 KB, patch)
2017-10-27 01:47 PDT, Devin Rousso
no flags Details | Formatted Diff | Diff
[Image] After Patch is applied (108.93 KB, image/png)
2017-10-27 01:47 PDT, Devin Rousso
no flags Details
Patch (25.61 KB, patch)
2017-10-27 16:35 PDT, Devin Rousso
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description BJ Burg 2017-10-25 09:50:47 PDT
Acko.net has several canvases and I have no way to tell which one was made where. There should be a way to see this, perhaps in an "Initiator" field in the details sidebar.
Comment 1 Radar WebKit Bug Importer 2017-10-25 09:51:01 PDT
Comment 2 Devin Rousso 2017-10-27 01:47:28 PDT
Created attachment 325138 [details]
Comment 3 Devin Rousso 2017-10-27 01:47:42 PDT
Created attachment 325139 [details]
[Image] After Patch is applied
Comment 4 BJ Burg 2017-10-27 08:59:25 PDT
Comment on attachment 325138 [details]

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


> Source/WebCore/inspector/InspectorCanvas.cpp:194
> +Ref<Inspector::Protocol::Canvas::Canvas> InspectorCanvas::buildObjectForCanvas(InstrumentingAgents& instrumentingAgents, bool captureBacktrace)

This sort of implicitly assumes this method is called underneath canvasAdded and equivalent JS code that creates the context. Perhaps you should write this into the description of the protocol parameter so that the semantics are more clear. For example, "Backtrace that was captured when this canvas context is created".

> Source/WebCore/inspector/InspectorCanvas.cpp:261
> +    if (captureBacktrace) {

It would be cool to extract common stack walking code. It could take a lambda(ScriptCallFrame&) to perform the extraction (swizzled index or buildInspectorObject()). Please re-EWS if you do that.

> Source/WebCore/inspector/InspectorCanvasAgent.cpp:395
> +        m_frontendDispatcher->canvasAdded(inspectorCanvas->buildObjectForCanvas(m_instrumentingAgents, true));

I would remove the default parameter value and add 'false' to the other call site just so it's explicit. (If we called this in dozens of places, my opinion would be different.) Can you extract 'true' or 'false' into a local variable with a better name?
Comment 5 Devin Rousso 2017-10-27 16:35:48 PDT
Created attachment 325216 [details]
Comment 6 WebKit Commit Bot 2017-10-27 18:58:56 PDT
Comment on attachment 325216 [details]

Clearing flags on attachment: 325216

Committed r224142: <https://trac.webkit.org/changeset/224142>
Comment 7 WebKit Commit Bot 2017-10-27 18:58:57 PDT
All reviewed patches have been landed.  Closing bug.