Bug 95954

Summary: Web Inspector: [REGRESSION] Content is not available for dynamically loaded script sometimes.
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-09-06 02:02:44 PDT
Reproduction scenario:

1. Script element with src attribute is inserted in the page dynamically.
2. Corresponding resource is added to inspector.
3. CachedResource is garbage collected by CachedResourceLoader once its loading is finished (See m_document->cachedResourceLoader()->loadDone(); call in SubresourceLoader::releaseResources())
4. After some more loading happening the corresponding Cachedresource is evicted from memory cache.
5. from this moment on it is not possible to get resource content via PageAgent, we can only use NetworkAgent for that.

This has become a major problem since web developers are switching to RequireJS to load dependencies which is using script element with src approach to load scripts dynamically.
Comment 1 Vsevolod Vlasov 2012-09-06 02:38:30 PDT
Created attachment 162457 [details]
Patch
Comment 2 Yury Semikhatsky 2012-09-07 09:02:50 PDT
Comment on attachment 162457 [details]
Patch

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

> Source/WebCore/inspector/front-end/Resource.js:345
> +        function requestContentLoaded(content, contentEncoded, mimeType)

Please move this into the if block.
Comment 3 Vsevolod Vlasov 2012-09-07 11:51:18 PDT
Committed r127902: <http://trac.webkit.org/changeset/127902>