<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>22994</bug_id>
          
          <creation_ts>2008-12-25 02:35:07 -0800</creation_ts>
          <short_desc>Resources loaded from the memory cache do not get correctly inserted into the DocLoader resource map</short_desc>
          <delta_ts>2011-05-17 17:17:28 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>Page Loading</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>Mac</rep_platform>
          <op_sys>OS X 10.5</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc>http://nerget.com/bugs/JSInspectorBug.html</bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          <blocked>61006</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Oliver Hunt">oliver</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>ap</cc>
    
    <cc>daniel.samuels1</cc>
    
    <cc>eric</cc>
    
    <cc>koivisto</cc>
    
    <cc>oliver</cc>
    
    <cc>timothy</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>103407</commentid>
    <comment_count>0</comment_count>
    <who name="Oliver Hunt">oliver</who>
    <bug_when>2008-12-25 02:35:07 -0800</bug_when>
    <thetext>* 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

&lt;rdar://problem/6467206&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>103899</commentid>
    <comment_count>1</comment_count>
    <who name="Oliver Hunt">oliver</who>
    <bug_when>2008-12-31 05:56:18 -0800</bug_when>
    <thetext>Okay, i&apos;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</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>103904</commentid>
    <comment_count>2</comment_count>
    <who name="Oliver Hunt">oliver</who>
    <bug_when>2008-12-31 06:28:52 -0800</bug_when>
    <thetext>*** Bug 23035 has been marked as a duplicate of this bug. ***</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>103905</commentid>
    <comment_count>3</comment_count>
    <who name="Oliver Hunt">oliver</who>
    <bug_when>2008-12-31 06:31:29 -0800</bug_when>
    <thetext>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&lt;String, CachedResource*&gt; m_docResources -&gt; 
mutable HashMap&lt;String, CachedResourceHandle&lt;CachedResource&gt; &gt; 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&apos;s perfectly possible my patch was doing something stupid.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>106755</commentid>
    <comment_count>4</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2009-01-23 08:21:01 -0800</bug_when>
    <thetext>This was fixed by Antti Koivisto in r39725.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>405413</commentid>
    <comment_count>5</comment_count>
    <who name="Eric Seidel (no email)">eric</who>
    <bug_when>2011-05-17 17:15:08 -0700</bug_when>
    <thetext>I believe that http://trac.webkit.org/changeset/39725 introduced a leak of all CachedResources.

m_documentResources holds a CachedResourceHandle:
    typedef HashMap&lt;String, CachedResourceHandle&lt;CachedResource&gt; &gt; DocumentResourceMap;

The only time that a CachedResource is ever destroyed is when its handle count hits 0:

    bool canDelete() const { return !hasClients() &amp;&amp; !m_request &amp;&amp; !m_preloadCount &amp;&amp; !m_handleCount &amp;&amp; !m_resourceToRevalidate &amp;&amp; !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&apos;ll file a WebKit bug shortly.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>