[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677

kocienda kocienda at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 08:18:06 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit bc18cf8b9728b9cdcbe88d275d4d080d53e7728a
Author: kocienda <kocienda at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Dec 11 16:11:47 2003 +0000

    WebCore:
    
            Reviewed by Darin
    
            <rdar://problem/3505444>: WebCore cache does not use expiration dates on cache items
    
            * khtml/misc/loader.cpp:
            (Loader::slotFinished): Don't reset expiration date. We set this once in
            slotReceivedResponse.
            (Loader::slotReceivedResponse): Call new KWQ function to get a cache object's
            expiration date using its NSURLResponse data.
            (Cache::requestImage): Don't reset expiration date. We set this once in
            slotReceivedResponse, and we do not want the value from the DocLoader
    	anyway.
            (Cache::requestStyleSheet): Ditto.
            (Cache::requestScript): Ditto.
            * kwq/KWQLoader.h:
            * kwq/KWQLoader.mm:
            (KWQCacheObjectExpiresTime): New function. Call over bridge to get access
            to SPI in NSURLResponse to calculate expiration time.
            * kwq/WebCoreBridge.h: Declare bridge method.
    
    WebKit:
    
            Reviewed by Darin
    
            <rdar://problem/3505444>: WebCore cache does not use expiration dates on cache items
    
            * WebCoreSupport.subproj/WebBridge.m:
            (-[WebBridge expiresTimeForResponse:]): New method. Call response
            freshness lifetime method and add it to the current time to yield
            an expiration time.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@5761 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index dba58c8..cd11eea 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,25 @@
+2003-12-09  Ken Kocienda  <kocienda at apple.com>
+
+        Reviewed by Darin
+        
+        <rdar://problem/3505444>: WebCore cache does not use expiration dates on cache items
+        
+        * khtml/misc/loader.cpp:
+        (Loader::slotFinished): Don't reset expiration date. We set this once in
+        slotReceivedResponse.
+        (Loader::slotReceivedResponse): Call new KWQ function to get a cache object's
+        expiration date using its NSURLResponse data.
+        (Cache::requestImage): Don't reset expiration date. We set this once in
+        slotReceivedResponse, and we do not want the value from the DocLoader
+	anyway.
+        (Cache::requestStyleSheet): Ditto.
+        (Cache::requestScript): Ditto.
+        * kwq/KWQLoader.h:
+        * kwq/KWQLoader.mm:
+        (KWQCacheObjectExpiresTime): New function. Call over bridge to get access
+        to SPI in NSURLResponse to calculate expiration time.
+        * kwq/WebCoreBridge.h: Declare bridge method.
+
 2003-12-10  Maciej Stachowiak  <mjs at apple.com>
 
         Reviewed by Darin.
diff --git a/WebCore/khtml/misc/loader.cpp b/WebCore/khtml/misc/loader.cpp
index 97818c2..828ba67 100644
--- a/WebCore/khtml/misc/loader.cpp
+++ b/WebCore/khtml/misc/loader.cpp
@@ -1264,11 +1264,11 @@ void Loader::slotFinished( KIO::Job* job )
   {
       r->object->data(r->m_buffer, true);
       emit requestDone( r->m_docLoader, r->object );
-      time_t expireDate = j->queryMetaData("expire-date").toLong();
 #if !APPLE_CHANGES
+      time_t expireDate = j->queryMetaData("expire-date").toLong();
 kdDebug(6060) << "Loader::slotFinished, url = " << j->url().url() << " expires " << ctime(&expireDate) << endl;
-#endif
       r->object->setExpireDate(expireDate, false);
+#endif
   }
 
 #if APPLE_CHANGES
@@ -1294,6 +1294,7 @@ void Loader::slotReceivedResponse(KIO::Job* job, void *response)
     ASSERT(r);
     ASSERT(response);
     r->object->setResponse(response);
+    r->object->setExpireDate(KWQCacheObjectExpiresTime(r->m_docLoader, response), false);
 }
 #endif
 
@@ -1511,8 +1512,10 @@ CachedImage *Cache::requestImage( DocLoader* dl, const DOMString & url, bool rel
         o = im;
     }
 
+#if !APPLE_CHANGES
     o->setExpireDate(_expireDate, true);
-
+#endif
+    
     if(o->type() != CachedObject::Image)
     {
 #ifdef CACHE_DEBUG
@@ -1585,8 +1588,10 @@ CachedCSSStyleSheet *Cache::requestStyleSheet( DocLoader* dl, const DOMString &
         o = sheet;
     }
 
+#if !APPLE_CHANGES
     o->setExpireDate(_expireDate, true);
-
+#endif
+    
     if(o->type() != CachedObject::CSSStyleSheet)
     {
 #ifdef CACHE_DEBUG
@@ -1669,8 +1674,10 @@ CachedScript *Cache::requestScript( DocLoader* dl, const DOM::DOMString &url, bo
         o = script;
     }
 
+#if !APPLE_CHANGES
     o->setExpireDate(_expireDate, true);
-
+#endif
+    
     if(!(o->type() == CachedObject::Script))
     {
 #ifdef CACHE_DEBUG
diff --git a/WebCore/kwq/KWQLoader.h b/WebCore/kwq/KWQLoader.h
index 0653d8b..3cef60f 100644
--- a/WebCore/kwq/KWQLoader.h
+++ b/WebCore/kwq/KWQLoader.h
@@ -49,6 +49,7 @@ void KWQReleaseResponse(void *response);
 void *KWQResponseMIMEType(void *response);
 void *KWQResponseHeaderString(void *response);
 int KWQNumberOfPendingOrLoadingRequests(khtml::DocLoader *dl);
+time_t KWQCacheObjectExpiresTime(khtml::DocLoader *docLoader, void *response);
 
 class KWQLoader
 {
diff --git a/WebCore/kwq/KWQLoader.mm b/WebCore/kwq/KWQLoader.mm
index 07fa3d8..c2bb7fc 100644
--- a/WebCore/kwq/KWQLoader.mm
+++ b/WebCore/kwq/KWQLoader.mm
@@ -296,6 +296,21 @@ void *KWQResponseHeaderString(void *response)
     return NULL;
 }
 
+time_t KWQCacheObjectExpiresTime(khtml::DocLoader *docLoader, void *response)
+{
+    time_t result = 0;
+
+    KWQ_BLOCK_EXCEPTIONS;
+    
+    KWQKHTMLPart *part = static_cast<KWQKHTMLPart *>(docLoader->part());
+    WebCoreBridge *bridge = part->bridge();
+    result = [bridge expiresTimeForResponse:(NSURLResponse *)response];
+    
+    KWQ_UNBLOCK_EXCEPTIONS;
+    
+    return result;
+}
+
 KWQLoader::KWQLoader(Loader *loader)
     : _requestStarted(loader, SIGNAL(requestStarted(khtml::DocLoader *, khtml::CachedObject *)))
     , _requestDone(loader, SIGNAL(requestDone(khtml::DocLoader *, khtml::CachedObject *)))
diff --git a/WebCore/kwq/WebCoreBridge.h b/WebCore/kwq/WebCoreBridge.h
index 76b948c..7f76012 100644
--- a/WebCore/kwq/WebCoreBridge.h
+++ b/WebCore/kwq/WebCoreBridge.h
@@ -303,6 +303,7 @@ typedef enum {
 - (NSData *)syncLoadResourceWithURL:(NSURL *)URL customHeaders:(NSDictionary *)requestHeaders postData:(NSData *)postData finalURL:(NSURL **)finalNSURL responseHeaders:(NSDictionary **)responseHeaderDict statusCode:(int *)statusCode;
 
 - (BOOL)isReloading;
+- (time_t)expiresTimeForResponse:(NSURLResponse *)response;
 
 - (void)reportClientRedirectToURL:(NSURL *)URL delay:(NSTimeInterval)seconds fireDate:(NSDate *)date lockHistory:(BOOL)lockHistory isJavaScriptFormAction:(BOOL)isJavaScriptFormAction;
 - (void)reportClientRedirectCancelled:(BOOL)cancelWithLoadInProgress;
diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index fb5feb0..ab254fb 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,14 @@
+2003-12-09  Ken Kocienda  <kocienda at apple.com>
+
+        Reviewed by Darin
+        
+        <rdar://problem/3505444>: WebCore cache does not use expiration dates on cache items
+        
+        * WebCoreSupport.subproj/WebBridge.m:
+        (-[WebBridge expiresTimeForResponse:]): New method. Call response
+        freshness lifetime method and add it to the current time to yield
+        an expiration time.
+
 2003-12-10  Maciej Stachowiak  <mjs at apple.com>
 
         Reviewed by Richard.
diff --git a/WebKit/WebCoreSupport.subproj/WebBridge.m b/WebKit/WebCoreSupport.subproj/WebBridge.m
index 036fba2..9622e16 100644
--- a/WebKit/WebCoreSupport.subproj/WebBridge.m
+++ b/WebKit/WebCoreSupport.subproj/WebBridge.m
@@ -47,6 +47,7 @@
 #import <Foundation/NSDictionary_NSURLExtras.h>
 #import <Foundation/NSURLConnection.h>
 #import <Foundation/NSURLResponse.h>
+#import <Foundation/NSURLResponsePrivate.h>
 #import <Foundation/NSURLFileTypeMappings.h>
 
 #import <WebKit/WebLocalizableStrings.h>
@@ -483,6 +484,21 @@
     return [[[self dataSource] request] cachePolicy] == NSURLRequestReloadIgnoringCacheData;
 }
 
+#define MAX_TIME_T ((time_t)-1)    
+
+- (time_t)expiresTimeForResponse:(NSURLResponse *)response
+{
+    time_t now = time(NULL);
+    NSTimeInterval lifetime = [response _freshnessLifetime];
+    if (lifetime < 0)
+        lifetime = 0;
+    
+    if (now + lifetime > MAX_TIME_T)
+        return MAX_TIME_T;
+    
+    return now + lifetime;
+}
+
 - (void)reportClientRedirectToURL:(NSURL *)URL delay:(NSTimeInterval)seconds fireDate:(NSDate *)date lockHistory:(BOOL)lockHistory isJavaScriptFormAction:(BOOL)isJavaScriptFormAction
 {
     [_frame _clientRedirectedTo:URL delay:seconds fireDate:date lockHistory:lockHistory isJavaScriptFormAction:(BOOL)isJavaScriptFormAction];

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list