Bug 96482 - Web Inspector: [Styles] Styles not updated when there is a heavy stream of DOM updates
Summary: Web Inspector: [Styles] Styles not updated when there is a heavy stream of DO...
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (Deprecated) (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Alexander Pavlov (apavlov)
Depends on:
Reported: 2012-09-12 01:53 PDT by Alexander Pavlov (apavlov)
Modified: 2012-09-12 23:45 PDT (History)
10 users (show)

See Also:

Patch (8.01 KB, patch)
2012-09-12 05:50 PDT, Alexander Pavlov (apavlov)
no flags Details | Formatted Diff | Diff
Patch (6.32 KB, patch)
2012-09-12 07:30 PDT, Alexander Pavlov (apavlov)
vsevik: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Pavlov (apavlov) 2012-09-12 01:53:11 PDT
Consider the following call sequence in StylesSidebarPane:

1. this._rebuildUpdateInProgress is false AND there are pending DOM update events in the RPC queue for the Web Inspector frontend. _rebuildUpdate() is invoked, which results in a few WebInspector.cssModel.get*Async() calls (fetching data from the backend). this._rebuildUpdateInProgress is now true.
2. A pending DOM update is processed and is deemed to result in a Styles rebuild. _rebuildUpdate() is called, but since this._rebuildUpdateInProgress is true, this._lastNodeForInnerRebuild is set to this.node.
3. The backend data from the 1st _rebuildUpdate() call are ready, and stylesCallback(matchedResult) is invoked. But, since this._lastNodeForInnerRebuild === this.node, the following snippet is executed:
if (this._lastNodeForInnerRebuild) {
    delete this._lastNodeForInnerRebuild;

This loop goes on forever, until the DOM updates from the backend stop (which may not be the case,) and the Styles pane is never updated.
Comment 1 Alexander Pavlov (apavlov) 2012-09-12 05:50:45 PDT
Created attachment 163608 [details]
Comment 2 Alexander Pavlov (apavlov) 2012-09-12 07:30:44 PDT
Created attachment 163624 [details]
Comment 3 Vsevolod Vlasov 2012-09-12 08:01:54 PDT
Comment on attachment 163624 [details]

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

> LayoutTests/inspector/styles/force-pseudo-state.html:34
> +        InspectorTest.waitForStyles("div", divSelected2, true, 1);

I think more readable and flexible approach would be to wait for styles update after each pseudo class change explicitly.
Please fix this before landing.
Comment 4 Alexander Pavlov (apavlov) 2012-09-12 23:45:46 PDT
Committed r128407: <http://trac.webkit.org/changeset/128407>