Bug 150065 - REGRESSION: Web Inspector hangs for many seconds when trying to reload page
Summary: REGRESSION: Web Inspector hangs for many seconds when trying to reload page
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (show other bugs)
Version: WebKit Nightly Build
Hardware: All All
: P2 Normal
Assignee: Joseph Pecoraro
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2015-10-12 17:20 PDT by Joseph Pecoraro
Modified: 2015-10-14 20:54 PDT (History)
11 users (show)

See Also:


Attachments
[PATCH] Proposed Fix (2.78 KB, patch)
2015-10-12 20:23 PDT, Joseph Pecoraro
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Joseph Pecoraro 2015-10-12 17:20:39 PDT
* SUMMARY
Inspector hangs for many seconds when trying to reload page.

* STEPS TO REPRODUCE
1. Inspect cnn.com
2. Show Timeline tab
3. Reload
  => hangs for quite a while, may never show data

* NOTES
- Samples show lots of time spent under Inspector::ScriptDebugServer::sourceParsed (ContentSearchUtilities)
- Seems like this may have been exposed by these recent changes:
  - <https://webkit.org/b/148347> REGRESSION(r188792): broke lots of tests, ggaren is going to investigate and reland (Requested by thorton on #webkit).
  - <https://webkit.org/b/148280> Unify code paths for manually deleting all code

* RELATED:
- We could eliminate the inspector's regex searching by having the JS Parser parse SourceURL / SourceURLMapping comments. This information would also be beneficial for expiation messages in the engine itself (e.g. exceptions in eval code).
Comment 1 Radar WebKit Bug Importer 2015-10-12 17:21:53 PDT
<rdar://problem/23081124>
Comment 2 Joseph Pecoraro 2015-10-12 17:26:12 PDT
It sounds like each time a Debugger is attached to a JSGlobalObject it will send sourceParsed for each source provider. Seems like we could be getting duplicate messages then. Since on a Web Page the same Debugger is shared across all Frames / Isolated Worlds.
Comment 3 Joseph Pecoraro 2015-10-12 20:04:03 PDT
(In reply to comment #2)
> It sounds like each time a Debugger is attached to a JSGlobalObject it will
> send sourceParsed for each source provider. Seems like we could be getting
> duplicate messages then. Since on a Web Page the same Debugger is shared
> across all Frames / Isolated Worlds.

Yes, in the case of Safari on OS X as many as 6 or more isolated worlds get debuggers attached when loading a page (Inspector, Reader, Autofill, Extensions). In the case of the debugger being attached to each of these the inspector was re-pushing all scripts seen so far each time. In general I think there are improvements to be made here, but reducing this to just once (the first time a Debugger is attached) brings this back to what looks like original performance.
Comment 4 Joseph Pecoraro 2015-10-12 20:23:40 PDT
Created attachment 262969 [details]
[PATCH] Proposed Fix
Comment 5 BJ Burg 2015-10-13 12:37:27 PDT
Comment on attachment 262969 [details]
[PATCH] Proposed Fix

I suppose we can't test this because of the reloadPage issues in inspector tests?
Comment 6 Joseph Pecoraro 2015-10-13 16:10:05 PDT
(In reply to comment #5)
> Comment on attachment 262969 [details]
> [PATCH] Proposed Fix
> 
> I suppose we can't test this because of the reloadPage issues in inspector
> tests?

I treated this as a performance issue, so I didn't write a test for that.

But now that you mention it, I would be weary of testing for the reload page issues. It would be worth writing tests to ensure the frontend gets a list of all scripts when the inspector _opens_.
Comment 7 Mark Lam 2015-10-14 19:45:08 PDT
Comment on attachment 262969 [details]
[PATCH] Proposed Fix

r=me
Comment 8 WebKit Commit Bot 2015-10-14 20:54:25 PDT
Comment on attachment 262969 [details]
[PATCH] Proposed Fix

Clearing flags on attachment: 262969

Committed r191081: <http://trac.webkit.org/changeset/191081>
Comment 9 WebKit Commit Bot 2015-10-14 20:54:29 PDT
All reviewed patches have been landed.  Closing bug.