Bug 90153

Summary: Web Inspector: [Regression] Resource content is not loaded if Resource.requestContent method is called before network request is finished.
Product: WebKit Reporter: Vsevolod Vlasov <vsevik>
Component: Web Inspector (Deprecated)Assignee: Vsevolod Vlasov <vsevik>
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 yurys: review+

Description Vsevolod Vlasov 2012-06-28 03:36:24 PDT
Steps to reproduce:
1) Open webkit.org
2) open main.css in Sources Panel
3) reload several times, try pressing ctrl+r several times very often

Sometimes (quite often) main.css is shown in sources panel without any content.

This is happening since Resource-NetworkRequest split because Resource.requestContent does not check that associated request was already loaded.

Patch to follow.
Comment 1 Vsevolod Vlasov 2012-06-28 05:34:10 PDT
Created attachment 149932 [details]
Patch
Comment 2 Yury Semikhatsky 2012-06-29 01:43:35 PDT
Comment on attachment 149932 [details]
Patch

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

> LayoutTests/http/tests/inspector/resource-tree/resource-request-content-while-loading.html:27
> +          contentWasRequested = true;

No need to set it second time

> LayoutTests/http/tests/inspector/resource-tree/resource-request-content-while-loading.html:38
> +          if (contentWasLoaded)

Page reload reply should always come before _addRequest unless you receive _addRequest for the page that was not reloaded yet. Probably using a synchronously loaded resources would allow to avoid this non-determinism.
Comment 3 Vsevolod Vlasov 2012-06-29 02:15:23 PDT
Regression introduced in r114116
Comment 4 Vsevolod Vlasov 2012-06-29 02:33:14 PDT
Committed r121537: <http://trac.webkit.org/changeset/121537>
Comment 5 Vsevolod Vlasov 2012-06-29 02:35:39 PDT
(In reply to comment #2)
> (From update of attachment 149932 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=149932&action=review
> 
> > LayoutTests/http/tests/inspector/resource-tree/resource-request-content-while-loading.html:27
> > +          contentWasRequested = true;
> 
> No need to set it second time
Done.

> > LayoutTests/http/tests/inspector/resource-tree/resource-request-content-while-loading.html:38
> > +          if (contentWasLoaded)
> 
> Page reload reply should always come before _addRequest unless you receive _addRequest for the page that was not reloaded yet. Probably using a synchronously loaded resources would allow to avoid this non-determinism.
It turned out I didn't need all this page reloaded events, landed without listening to them.