Bug 96482

Summary: Web Inspector: [Styles] Styles not updated when there is a heavy stream of DOM updates
Product: WebKit Reporter: Alexander Pavlov (apavlov) <apavlov>
Component: Web Inspector (Deprecated)Assignee: Alexander Pavlov (apavlov) <apavlov>
Status: RESOLVED FIXED    
Severity: Normal CC: apavlov, bweinstein, joepeck, keishi, loislo, pfeldman, pmuellr, rik, timothy, yurys
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Attachments:
Description Flags
Patch
none
Patch vsevik: review+

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._rebuildUpdate(userCallback);
    return;
}

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]
Patch
Comment 2 Alexander Pavlov (apavlov) 2012-09-12 07:30:44 PDT
Created attachment 163624 [details]
Patch
Comment 3 Vsevolod Vlasov 2012-09-12 08:01:54 PDT
Comment on attachment 163624 [details]
Patch

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>