<?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>97596</bug_id>
          
          <creation_ts>2012-09-25 12:26:51 -0700</creation_ts>
          <short_desc>ApplicationCache and WebCore::MemoryCache don&apos;t always play well together.</short_desc>
          <delta_ts>2012-10-01 12:39:47 -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>WebCore Misc.</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Michael Nordman">michaeln</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>ap</cc>
    
    <cc>beidson</cc>
    
    <cc>koivisto</cc>
    
    <cc>michaeln</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>727876</commentid>
    <comment_count>0</comment_count>
    <who name="Michael Nordman">michaeln</who>
    <bug_when>2012-09-25 12:26:51 -0700</bug_when>
    <thetext>ApplicationCache and WebCore::MemoryCache don&apos;t always play well together. There&apos;s at least one way in which this can do the wrong thing.

A document associated with an appcache can mistakenly load resources contained in the memcache instead of loading the particular version pinned in the appcache. This breaks its guarantee of loading the particular version of the resource at the time the associated cache was updated.

I think the reciprocal could happen too, where an appcache response is loaded into the memcache. And that response is then used to satisfy a request to load a resource into a document that is not associated with the appcache. That unassociated document could be loading stale data.

Using only the &lt;url&gt; as the key is problematic given how appcache&apos;ing is supposed to work, where which resource to load is dependent on which document is doing the loading.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>729720</commentid>
    <comment_count>1</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2012-09-27 11:20:14 -0700</bug_when>
    <thetext>Do you have a test case for this? I&apos;m not sure what code path you have in mind - we just load from application cache without consulting other loader machinery.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>729753</commentid>
    <comment_count>2</comment_count>
    <who name="Michael Nordman">michaeln</who>
    <bug_when>2012-09-27 11:58:52 -0700</bug_when>
    <thetext>The pages referenced in this email thread demonstrate the problem.

I was looking at CachedResourceLoader, methods like requestCSSStyleSheet and requestResource). Looks like that class sits in on top of ResourceLoader which is where the appcache gets consulted. If the CachedResourceLoader finds something in the memory cache for &lt;url&gt;... it doesn&apos;t get as far as ResourceLoader.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>729757</commentid>
    <comment_count>3</comment_count>
    <who name="Michael Nordman">michaeln</who>
    <bug_when>2012-09-27 12:03:14 -0700</bug_when>
    <thetext>oh... i forgot the link to the discussion in comment #2
http://lists.w3.org/Archives/Public/public-fixing-appcache/2012Sep/0028.html</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>731758</commentid>
    <comment_count>4</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2012-10-01 09:46:29 -0700</bug_when>
    <thetext>Indeed, we should be checking with appcache before checking memory cache (and then appcache needs to become smarter, keeping pre-parsed stylesheets etc.)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>731911</commentid>
    <comment_count>5</comment_count>
    <who name="Michael Nordman">michaeln</who>
    <bug_when>2012-10-01 12:39:47 -0700</bug_when>
    <thetext>(In reply to comment #4)
&gt; Indeed, we should be checking with appcache before checking memory cache (and then appcache needs to become smarter, keeping pre-parsed stylesheets etc.)

Having the appcache replicate the logic of the memcache worries me. Alternatively, the appcache could remain dumb if the memcached uses a different &apos;key&apos; to identify resources. If the key were &lt;url,appcacheid&gt; instead of just &lt;url&gt;, i think resources could be loaded out of the appcache and then deposited in the memcache and available for quick access just like resources loaded from the network or the httpcache are.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>