Open Bug 1731033 Opened 3 years ago Updated 2 years ago

Ignore console.profile() calls performed on other tabs than the inspected one

Categories

(DevTools :: Performance Tools (Profiler/Timeline), defect, P3)

defect

Tracking

(Not tracked)

People

(Reporter: jdescottes, Unassigned)

References

(Blocks 1 open bug)

Details

Currently we rely on an observer in order to react to console.profile calls.
The Console will notify observers with "console-api-profiler", but the payload doesn't contain any information to know which browsing-context or which browser this comes from:
https://searchfox.org/mozilla-central/rev/4d90ff4537330d6b17cb956c0fadf759086d9bb7/dom/console/Console.cpp#1211

So if two tabs (tab1 and tab2) are running in the same process, a Toolbox opened for tab1 will react to console.profile() calls performed in tab2.

STRs:

  • start two tabs running in the same process
  • open DevTools in both tabs (with the old perf panel)
  • run console.profile() + profileEnd() in 1 of the tabs

ER: A profile should only be recorded in the toolbox where console.profile() was executed.
AR: Both toolboxes have profiles recorded.

When the new performance recorder is enabled, and we instead log a warning message, we will similarly leak messages coming from console.profile calls occurring in other tabs.

We can have similar issues with toolboxes monitoring several same process targets

  • several remote frames running in the same process
  • or just with frames in general once we create one target per frame

To fix this we should make sure to only handle relevant events, and only handle them once. console-api-profiler is monitored from the browsing-context target actor (see patch from Bug 1730106) as well as from the performance profiler (searchfox)

Console.profile usage is not very high, P3/S3

Severity: -- → S3
Priority: -- → P3
You need to log in before you can comment on or make changes to this bug.