<?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>7393</bug_id>
          
          <creation_ts>2006-02-20 11:38:24 -0800</creation_ts>
          <short_desc>A stale comment about XMLHttpRequest responses being never cached</short_desc>
          <delta_ts>2019-02-06 09:03:14 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>DOM</component>
          <version>420+</version>
          <rep_platform>Mac</rep_platform>
          <op_sys>OS X 10.4</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</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="Alexey Proskuryakov">ap</reporter>
          <assigned_to name="Alexey Proskuryakov">ap</assigned_to>
          <cc>cdumez</cc>
    
    <cc>sen</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>33515</commentid>
    <comment_count>0</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2006-02-20 11:38:24 -0800</bug_when>
    <thetext>(split from bug 3810)

From -[WebFrameBridge syncLoadResourceWithURL:customHeaders:postData:finalURL:responseHeaders:statusCode:] :

    // Never use cached data for these requests (xmlhttprequests).
    [request setCachePolicy:[[[self dataSource] request] cachePolicy]];

From Web Applications spec draft:

UAs may set the If-Modified-Since, If-None-Match, If-Range, and Range headers if the resource is cached and has not expired (as allowed by HTTP), and must not allow those headers to be overridden.
&lt;...&gt;
In particular, UAs must not automatically set the Cache-Control or Pragma headers to defeat caching.

  Sounds like WebKit is violating the spec (although beware that it&apos;s a draft with many known issues). Worse, the current behavior seems to prevent any kind of caching - NSURLConnection is forbidden to do the caching internally, and conditional headers set by the calling code (which is not currently forbidden) make the request fail, because NSURLConnection unsuccessfully tries to process the 304 response itself.

  Or maybe the comment in WebFrameBridge is just misleading :)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>34659</commentid>
    <comment_count>1</comment_count>
      <attachid>6790</attachid>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2006-03-01 11:38:21 -0800</bug_when>
    <thetext>Created attachment 6790
proposed patch

OK, my tests show that caching of XMLHttpRequest responses does work properly (in Safari with current WebKit builds, at least). Just don&apos;t add an If-Modified-Since header manually, and NSURLConnection will take care of the rest, and will return a 200 response. It returns a cached response if possible, or issues a conditional request if re-validation is needed.

If this doesn&apos;t work for Dashboard widgets, which I haven&apos;t checked, then perhaps Dashboard always forces a reload of the main document, which defeats caching of subresources and XMLHttpRequests. Dashboard is closed source, so you&apos;d need to file a bug via &lt;http://bugreport.apple.com&gt;.

I think this comment is stale, the patch just removes it.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1502929</commentid>
    <comment_count>2</comment_count>
    <who name="Lucas Forschler">lforschler</who>
    <bug_when>2019-02-06 09:03:14 -0800</bug_when>
    <thetext>Mass moving XML DOM bugs to the &quot;DOM&quot; Component.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>6790</attachid>
            <date>2006-03-01 11:38:21 -0800</date>
            <delta_ts>2006-03-01 19:49:15 -0800</delta_ts>
            <desc>proposed patch</desc>
            <filename>7393r1_patch.txt</filename>
            <type>text/plain</type>
            <size>614</size>
            <attacher name="Alexey Proskuryakov">ap</attacher>
            
              <data encoding="base64">SW5kZXg6IFdlYktpdC9XZWJDb3JlU3VwcG9ydC9XZWJGcmFtZUJyaWRnZS5tCj09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0K
LS0tIFdlYktpdC9XZWJDb3JlU3VwcG9ydC9XZWJGcmFtZUJyaWRnZS5tCShyZXZpc2lvbiAxMzA3
MikKKysrIFdlYktpdC9XZWJDb3JlU3VwcG9ydC9XZWJGcmFtZUJyaWRnZS5tCSh3b3JraW5nIGNv
cHkpCkBAIC01NTAsNyArNTUwLDYgQEAgTlNTdHJpbmcgKldlYlBsdWdpbkNvbnRhaW5lcktleSA9
ICAgQCJXZQogICAgICAgICBbcmVxdWVzdCBhZGRWYWx1ZTpbcmVxdWVzdEhlYWRlcnMgb2JqZWN0
Rm9yS2V5OmtleV0gZm9ySFRUUEhlYWRlckZpZWxkOmtleV07CiAgICAgfQogICAgIAotICAgIC8v
IE5ldmVyIHVzZSBjYWNoZWQgZGF0YSBmb3IgdGhlc2UgcmVxdWVzdHMgKHhtbGh0dHByZXF1ZXN0
cykuCiAgICAgW3JlcXVlc3Qgc2V0Q2FjaGVQb2xpY3k6W1tbc2VsZiBkYXRhU291cmNlXSByZXF1
ZXN0XSBjYWNoZVBvbGljeV1dOwogICAgIGlmICghaGlkZVJlZmVycmVyKQogICAgICAgICBbcmVx
dWVzdCBfd2ViX3NldEhUVFBSZWZlcnJlcjpbc2VsZiByZWZlcnJlcl1dOwo=
</data>
<flag name="review"
          id="1739"
          type_id="1"
          status="+"
          setter="darin"
    />
          </attachment>
      

    </bug>

</bugzilla>