Bug 153634 - Web Inspector: some background tabs think they are the foreground tab and do unnecessary work
Summary: Web Inspector: some background tabs think they are the foreground tab and do ...
Status: RESOLVED CONFIGURATION CHANGED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (show other bugs)
Version: WebKit Nightly Build
Hardware: All All
: P2 Normal
Assignee: Matt Baker
URL:
Keywords: InRadar
: 156076 (view as bug list)
Depends on:
Blocks:
 
Reported: 2016-01-28 20:44 PST by Joseph Pecoraro
Modified: 2022-02-12 19:16 PST (History)
5 users (show)

See Also:


Attachments
[IMAGE] Profile of reloading page with inspector (220.73 KB, image/png)
2016-01-28 20:44 PST, Joseph Pecoraro
no flags Details
Clean profile (262.63 KB, image/png)
2016-05-29 08:41 PDT, BJ Burg
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Joseph Pecoraro 2016-01-28 20:44:28 PST
Created attachment 270177 [details]
[IMAGE] Profile of reloading page with inspector

* SUMMARY
Background Tabs waste a lot of time on reload populating editor content.

* STEPS TO REPRODUCE
1. Inspect webkit.org
2. Resources > select a resource
3. Debugger > select a different resource
4. Show Console Tab
5. Reload
  => ~300ms of frontend time (85%) is spent populating source code text editor content for the resources in the background tabs

* NOTES
- It may be fine for the background tabs to fetch the content, but not to process it!
- See attached screenshot for a profile
Comment 1 Radar WebKit Bug Importer 2016-01-28 20:44:50 PST
<rdar://problem/24404173>
Comment 2 Joseph Pecoraro 2016-01-28 20:52:53 PST
This seems to be another case where the background view thinks it is visible!

The background tab's SourceCodeTextEditor thinks "this.visible" is true.
Comment 3 Joseph Pecoraro 2016-01-28 21:01:12 PST
Wow, merely opening the inspector all ContentViews that are initially created are marked as visible:

    Resources/Views/ContentView.js:209:22: CONSOLE TRACE visible (true) OverviewTimelineView
    Resources/Views/ContentView.js:209:22: CONSOLE TRACE visible (true) OverviewTimelineView
    Resources/Views/ContentView.js:209:22: CONSOLE TRACE visible (true) OverviewTimelineView
    Resources/Views/ContentView.js:209:22: CONSOLE TRACE visible (true) TimelineRecordingContentView
    Resources/Views/ContentView.js:209:22: CONSOLE TRACE visible (true) OverviewTimelineView
    Resources/Views/ContentView.js:209:22: CONSOLE TRACE visible (true) ConsoleTabContentView
    Resources/Views/ContentView.js:209:22: CONSOLE TRACE visible (true) LogContentView
    Resources/Views/ContentView.js:209:22: CONSOLE TRACE visible (true) TextResourceContentView
    Resources/Views/ContentView.js:209:22: CONSOLE TRACE visible (true) ResourceClusterContentView
    Resources/Views/ContentView.js:209:22: CONSOLE TRACE visible (true) TextResourceContentView
    Resources/Views/ContentView.js:209:22: CONSOLE TRACE visible (true) TextResourceContentView
    Resources/Views/ContentView.js:209:22: CONSOLE TRACE visible (true) FrameDOMTreeContentView
    Resources/Views/ContentView.js:209:22: CONSOLE TRACE visible (true) TextResourceContentView
    Resources/Views/ContentView.js:209:22: CONSOLE TRACE visible (true) ResourceClusterContentView
    Resources/Views/ContentView.js:209:22: CONSOLE TRACE visible (true) TextResourceContentView
    Resources/Views/ContentView.js:209:22: CONSOLE TRACE visible (true) TextResourceContentView

This was me opening to the Console tab.

This could be contributing to inspector launch time performance issues as well. The background tabs shouldn't need to do anything until they are first interacted with.
Comment 4 BJ Burg 2016-01-29 08:49:49 PST
Nice find!
Comment 5 Matt Baker 2016-02-03 15:12:04 PST
I have a patch in progress for https://webkit.org/b/150741, which pushes visibility state management into the View base class. I'll check that it resolves this issue.
Comment 6 Timothy Hatcher 2016-04-05 13:41:42 PDT
*** Bug 156076 has been marked as a duplicate of this bug. ***
Comment 7 BJ Burg 2016-05-29 08:41:01 PDT
Seems to be resolved. I attached a profile of Web Inspector^1 while reloading CNN.com, following Joe's steps to reproduce. Codemirror does not appear anywhere in the profile.
Comment 8 BJ Burg 2016-05-29 08:41:27 PDT
Created attachment 280060 [details]
Clean profile
Comment 9 Joseph Pecoraro 2016-06-01 13:16:03 PDT
This is definitely not fixed. We are just fortunate that most of the work (Formatting, unnecessarily inserting for color widgets in JavaScript, etc) have been eliminated (moved to a Worker, unnecessary work eliminated) as part of the performance work done in the last 6 months.

While the performance impacts of cases we knew about have diminished, its certainly possible that a future issue could be introduced. We also know of correctness issues caused by this (a background tab, thinking it is active, steals a SourceCodeTextEditor from the foreground tab).

I'm going to reopen.
Comment 10 BJ Burg 2016-06-01 13:57:17 PDT
(In reply to comment #9)
> This is definitely not fixed. We are just fortunate that most of the work
> (Formatting, unnecessarily inserting for color widgets in JavaScript, etc)
> have been eliminated (moved to a Worker, unnecessary work eliminated) as
> part of the performance work done in the last 6 months.
> 
> While the performance impacts of cases we knew about have diminished, its
> certainly possible that a future issue could be introduced. We also know of
> correctness issues caused by this (a background tab, thinking it is active,
> steals a SourceCodeTextEditor from the foreground tab).
> 
> I'm going to reopen.

OK. Can you please retitle appropriately? If you have steps to reproduce the correctness issue, that would be great too.
Comment 11 Joseph Pecoraro 2016-11-16 15:59:38 PST
In recent months this issues means the Timeline Tab and Network Tab are constantly doing empty rAF loops, and in some cases causing non-stop console assertions. Short term fix on bug 164841, but just another indication that we should fix this.