Bug 95954 - Web Inspector: [REGRESSION] Content is not available for dynamically loaded script sometimes.
Summary: Web Inspector: [REGRESSION] Content is not available for dynamically loaded s...
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (Deprecated) (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Vsevolod Vlasov
Depends on:
Reported: 2012-09-06 02:02 PDT by Vsevolod Vlasov
Modified: 2012-09-07 11:51 PDT (History)
10 users (show)

See Also:

Patch (8.61 KB, patch)
2012-09-06 02:38 PDT, Vsevolod Vlasov
yurys: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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]
Comment 2 Yury Semikhatsky 2012-09-07 09:02:50 PDT
Comment on attachment 162457 [details]

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>