Bug 158086

Summary: Web Inspector: console.takeHeapSnapshot takes snapshots even if allocations timeline is not enabled or not recording
Product: WebKit Reporter: BJ Burg <bburg>
Component: Web InspectorAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Normal CC: graouts, inspector-bugzilla-changes, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: All   
OS: All   
Attachments:
Description Flags
[HTML] reduction none

Description BJ Burg 2016-05-25 14:02:59 PDT
Created attachment 279806 [details]
[HTML] reduction

STEPS TO REPRODUCE:

0. Open the page
1. Open the inspector
2. Show the allocations timeline

EXPECTED:

Nothing shows up

ACTUAL:

Lots of snapshots populate the timeline even if not recording
Comment 1 Joseph Pecoraro 2016-05-25 14:19:29 PDT
I think this is expected. Like other console commands, they do nothing if Web Inspector is not open, but do things when Web Inspector is open. The same here. Requiring that someone be recording would be rather annoying.

That said, I can see how showing the [S] in the Timeline randomly popping up would be rather annoying.
Comment 2 BJ Burg 2016-05-25 15:58:05 PDT
Poke for the importer.
Comment 3 Timothy Hatcher 2016-05-25 16:01:28 PDT
This does match console.profile, which is the behavior I talked to Joe about following. I would consider this behaves correctly.
Comment 4 BJ Burg 2016-05-25 16:18:55 PDT
(In reply to comment #3)
> This does match console.profile, which is the behavior I talked to Joe about
> following. I would consider this behaves correctly.

Ok. I did find it very jarring to see my timeline fill up with snapshots without having done anything on my part.
Comment 5 BJ Burg 2016-05-25 16:19:35 PDT
(In reply to comment #4)
> (In reply to comment #3)
> > This does match console.profile, which is the behavior I talked to Joe about
> > following. I would consider this behaves correctly.
> 
> Ok. I did find it very jarring to see my timeline fill up with snapshots
> without having done anything on my part.

But then, does toggling the Allocations timeline only change whether it's visible?
Comment 6 Timothy Hatcher 2016-05-25 17:07:24 PDT
No, console.takeHeapSnapshot forces it on. If that isn't used, it will remain off and high performance.

I could buy the argument that console.profile and console.takeHeapSnapshot should only work if the timeline is already enabled. That way you can basically make console.profile and console.takeHeapSnapshot no-ops if you disable the right timelines.
Comment 7 BJ Burg 2016-05-27 07:19:50 PDT
(In reply to comment #6)
> No, console.takeHeapSnapshot forces it on. If that isn't used, it will
> remain off and high performance.
> 
> I could buy the argument that console.profile and console.takeHeapSnapshot
> should only work if the timeline is already enabled. That way you can
> basically make console.profile and console.takeHeapSnapshot no-ops if you
> disable the right timelines.

I would like there to be a way to disable it from within the inspector, otherwise it will cause GC to take way longer, and we wouldn't be able to get useful script profiles.
Comment 8 Radar WebKit Bug Importer 2016-05-27 07:24:20 PDT
<rdar://problem/26516717>