Bug 22994

Summary: Resources loaded from the memory cache do not get correctly inserted into the DocLoader resource map
Product: WebKit Reporter: Oliver Hunt <oliver>
Component: Page LoadingAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: ap, daniel.samuels1, eric, koivisto, oliver, timothy
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: Mac   
OS: OS X 10.5   
URL: http://nerget.com/bugs/JSInspectorBug.html
Bug Depends on:    
Bug Blocks: 61006    

Oliver Hunt
Reported 2008-12-25 02:35:07 PST
* SUMMARY When using the inspector on a page with unchanging js, reloading may cause the JS documents to disappear. The issue appears to be that cached js resources that do not trigger a reload do not provide any content to the inspector. * STEPS TO REPRODUCE 1. Go to http://nerget.com/bugs/JSInspectorBug.html 2. Open the inspector 3. Go to the resources panel 4. Focus the JSInspectorBug.js file, notice that it has content 5. Reload the main window (with cmd-r, or whatever) * RESULTS There is no longer any content shown in the inspector, this also makes debugging that file impossible <rdar://problem/6467206>
Attachments
Oliver Hunt
Comment 1 2008-12-31 05:56:18 PST
Okay, i've tracked this down to resources loaded from the memory cache not being put in the docloader, and so not providing any information to the inspectorator
Oliver Hunt
Comment 2 2008-12-31 06:28:52 PST
*** Bug 23035 has been marked as a duplicate of this bug. ***
Oliver Hunt
Comment 3 2008-12-31 06:31:29 PST
12/31/08 6:23 AM Oliver Hunt: Okay, the problem is that resources that validate as not needing to be refetched do not get put into the docloader resource map, this means that this also breaks Web Archives if you have reloaded the page. Have been discussing with Antti. He suggested mutable HashMap<String, CachedResource*> m_docResources -> mutable HashMap<String, CachedResourceHandle<CachedResource> > m_docResources Which after a quick patch did improve things (although some resources were still not refreshed correctly) , however we also then crashed on exit so it's perfectly possible my patch was doing something stupid.
Alexey Proskuryakov
Comment 4 2009-01-23 08:21:01 PST
This was fixed by Antti Koivisto in r39725.
Eric Seidel (no email)
Comment 5 2011-05-17 17:15:08 PDT
I believe that http://trac.webkit.org/changeset/39725 introduced a leak of all CachedResources. m_documentResources holds a CachedResourceHandle: typedef HashMap<String, CachedResourceHandle<CachedResource> > DocumentResourceMap; The only time that a CachedResource is ever destroyed is when its handle count hits 0: bool canDelete() const { return !hasClients() && !m_request && !m_preloadCount && !m_handleCount && !m_resourceToRevalidate && !m_proxyResource; } http://trac.webkit.org/browser/trunk/Source/WebCore/loader/cache/CachedResource.h#L176 But the only way to ever be removed from this map is from: void CachedResourceLoader::removeCachedResource(CachedResource* resource) const Which is only ever called from ~CachedResource(). This has been reported various times to Chromium (but affects all webkit implementations): http://code.google.com/p/chromium/issues/detail?id=36142 I'll file a WebKit bug shortly.
Note You need to log in before you can comment on or make changes to this bug.