WebCore:
authorcblu <cblu@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 4 Dec 2004 18:37:32 +0000 (18:37 +0000)
committercblu <cblu@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 4 Dec 2004 18:37:32 +0000 (18:37 +0000)
New fixes for:
<rdar://problem/3685766> WebDataSource is missing subresources when they use cached WebCore data
<rdar://problem/3722434> REGRESSION?: Assertion failure trying to drag image in iframe (itapema.sc.gov.br)
<rdar://problem/3903173> REGRESSION (172-TOT): assertion failure and crash in slotAllData logging into hotmail account
<rdar://problem/3902749> REGRESSION (Tiger): missing image symbol does not appear

        Reviewed by darin, rjw, kocienda.

        * khtml/misc/loader.cpp:
        (CachedObject::~CachedObject):
        (CachedCSSStyleSheet::checkNotify):
        (Loader::servePendingRequests):
        (Loader::slotFinished):
        (Loader::slotReceivedResponse):
        (Cache::requestImage):
        (Cache::requestScript):
        * khtml/misc/loader.h:
        (khtml::CachedObject::CachedObject):
        (khtml::CachedObject::response):
        (khtml::CachedObject::allData):
        * kwq/KWQKJobClasses.h:
        * kwq/KWQKJobClasses.mm:
        (KIO::TransferJobPrivate::TransferJobPrivate):
        (KIO::TransferJobPrivate::~TransferJobPrivate):
        (KIO::TransferJob::TransferJob):
        (KIO::TransferJob::assembleResponseHeaders):
        (KIO::TransferJob::retrieveCharset):
        (KIO::TransferJob::emitResult):
        (KIO::TransferJob::emitReceivedResponse):
        * kwq/KWQLoader.h:
        * kwq/KWQLoader.mm:
        (KWQHeaderStringFromDictionary):
        (KWQCheckCacheObjectStatus):
        (KWQIsResponseURLEqualToURL):
        (KWQResponseURL):
        (KWQResponseMIMEType):
        (KWQCacheObjectExpiresTime):
        (khtml::CachedObject::setResponse):
        (khtml::CachedObject::setAllData):
        * kwq/KWQPixmap.h:
        * kwq/KWQPixmap.mm:
        (QPixmap::QPixmap):
        * kwq/KWQResourceLoader.mm:
        (-[KWQResourceLoader finishJobAndHandle:]):
        (-[KWQResourceLoader cancel]):
        (-[KWQResourceLoader reportError]):
        (-[KWQResourceLoader finishWithData:]):
        * kwq/KWQSignal.h:
        * kwq/KWQSignal.mm:
        (KWQSignal::call):
        * kwq/KWQSlot.h:
        * kwq/KWQSlot.mm:
        (KWQSlot::KWQSlot):
        (KWQSlot::call):
        * kwq/WebCoreBridge.h:
        * kwq/WebCoreResourceLoader.h:

WebKit:

New fixes for:
<rdar://problem/3685766> WebDataSource is missing subresources when they use cached WebCore data
<rdar://problem/3722434> REGRESSION?: Assertion failure trying to drag image in iframe (itapema.sc.gov.br)
<rdar://problem/3903173> REGRESSION (172-TOT): assertion failure and crash in slotAllData logging into hotmail account
<rdar://problem/3902749> REGRESSION (Tiger): missing image symbol does not appear

        Reviewed by darin, rjw, kocienda.

        * WebCoreSupport.subproj/WebBridge.m:
        (-[WebBridge objectLoadedFromCacheWithURL:response:data:]):
        (-[WebBridge syncLoadResourceWithURL:customHeaders:postData:finalURL:responseHeaders:statusCode:]):
        * WebCoreSupport.subproj/WebSubresourceClient.m:
        (-[WebSubresourceClient didFinishLoading]):
        * WebView.subproj/WebFrame.m:
        (-[WebFrame _opened]):
        (-[WebFrame _internalLoadDelegate]):
        (-[WebFrame _sendResourceLoadDelegateMessagesForURL:response:length:]):
        * WebView.subproj/WebFrameInternal.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@8121 268f45cc-cd09-0410-ab3c-d52691b4dbfc

22 files changed:
WebCore/ChangeLog-2005-08-23
WebCore/khtml/misc/loader.cpp
WebCore/khtml/misc/loader.h
WebCore/kwq/KWQKJobClasses.h
WebCore/kwq/KWQKJobClasses.mm
WebCore/kwq/KWQLoader.h
WebCore/kwq/KWQLoader.mm
WebCore/kwq/KWQPixmap.h
WebCore/kwq/KWQPixmap.mm
WebCore/kwq/KWQResourceLoader.mm
WebCore/kwq/KWQSignal.h
WebCore/kwq/KWQSignal.mm
WebCore/kwq/KWQSlot.h
WebCore/kwq/KWQSlot.mm
WebCore/kwq/WebCoreBridge.h
WebCore/kwq/WebCoreResourceLoader.h
WebKit/ChangeLog
WebKit/WebCoreSupport.subproj/WebBridge.m
WebKit/WebCoreSupport.subproj/WebSubresourceClient.m
WebKit/WebCoreSupport.subproj/WebSubresourceLoader.m
WebKit/WebView.subproj/WebFrame.m
WebKit/WebView.subproj/WebFrameInternal.h

index 943ab65edfa6e8b453ff6c69589af68d7b81eaac..4a594d8b2b7e8836c057d6dc8f5000d33b9a8686 100644 (file)
@@ -1,3 +1,62 @@
+2004-12-03  Chris Blumenberg  <cblu@apple.com>
+
+       New fixes for:
+       <rdar://problem/3685766> WebDataSource is missing subresources when they use cached WebCore data
+       <rdar://problem/3722434> REGRESSION?: Assertion failure trying to drag image in iframe (itapema.sc.gov.br)
+       <rdar://problem/3903173> REGRESSION (172-TOT): assertion failure and crash in slotAllData logging into hotmail account
+       <rdar://problem/3902749> REGRESSION (Tiger): missing image symbol does not appear
+
+        Reviewed by darin, rjw, kocienda.
+
+        * khtml/misc/loader.cpp:
+        (CachedObject::~CachedObject):
+        (CachedCSSStyleSheet::checkNotify):
+        (Loader::servePendingRequests):
+        (Loader::slotFinished):
+        (Loader::slotReceivedResponse):
+        (Cache::requestImage):
+        (Cache::requestScript):
+        * khtml/misc/loader.h:
+        (khtml::CachedObject::CachedObject):
+        (khtml::CachedObject::response):
+        (khtml::CachedObject::allData):
+        * kwq/KWQKJobClasses.h:
+        * kwq/KWQKJobClasses.mm:
+        (KIO::TransferJobPrivate::TransferJobPrivate):
+        (KIO::TransferJobPrivate::~TransferJobPrivate):
+        (KIO::TransferJob::TransferJob):
+        (KIO::TransferJob::assembleResponseHeaders):
+        (KIO::TransferJob::retrieveCharset):
+        (KIO::TransferJob::emitResult):
+        (KIO::TransferJob::emitReceivedResponse):
+        * kwq/KWQLoader.h:
+        * kwq/KWQLoader.mm:
+        (KWQHeaderStringFromDictionary):
+        (KWQCheckCacheObjectStatus):
+        (KWQIsResponseURLEqualToURL):
+        (KWQResponseURL):
+        (KWQResponseMIMEType):
+        (KWQCacheObjectExpiresTime):
+        (khtml::CachedObject::setResponse):
+        (khtml::CachedObject::setAllData):
+        * kwq/KWQPixmap.h:
+        * kwq/KWQPixmap.mm:
+        (QPixmap::QPixmap):
+        * kwq/KWQResourceLoader.mm:
+        (-[KWQResourceLoader finishJobAndHandle:]):
+        (-[KWQResourceLoader cancel]):
+        (-[KWQResourceLoader reportError]):
+        (-[KWQResourceLoader finishWithData:]):
+        * kwq/KWQSignal.h:
+        * kwq/KWQSignal.mm:
+        (KWQSignal::call):
+        * kwq/KWQSlot.h:
+        * kwq/KWQSlot.mm:
+        (KWQSlot::KWQSlot):
+        (KWQSlot::call):
+        * kwq/WebCoreBridge.h:
+        * kwq/WebCoreResourceLoader.h:
+
 2004-12-04  Darin Adler  <darin@apple.com>
 
         Reviewed by John.
index 2168446d82b09ef8743647cd3ece1875bb13c8d4..ff1d2dbc4cb809d7e1a60aa59b549483d0e68e14 100644 (file)
@@ -4,7 +4,7 @@
     Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de)
     Copyright (C) 2001 Dirk Mueller (mueller@kde.org)
     Copyright (C) 2002 Waldo Bastian (bastian@kde.org)
-    Copyright (C) 2003 Apple Computer, Inc.
+    Copyright (C) 2004 Apple Computer, Inc.
 
     This library is free software; you can redistribute it and/or
     modify it under the terms of the GNU Library General Public
@@ -89,7 +89,8 @@ CachedObject::~CachedObject()
     Cache::removeFromLRUList(this);
     m_deleted = true;
 #if APPLE_CHANGES
-    KWQReleaseResponse(m_response);
+    setResponse(0);
+    setAllData(0);
 #endif
 }
 
@@ -134,17 +135,6 @@ bool CachedObject::isExpired() const
     return (difftime(now, m_expireDate) >= 0);
 }
 
-#if APPLE_CHANGES
-
-void CachedObject::setResponse(void *response)
-{
-    KWQRetainResponse(response);
-    KWQReleaseResponse(m_response);
-    m_response = response;
-}
-
-#endif
-
 void CachedObject::setRequest(Request *_request)
 {
     if ( _request && !m_request )
@@ -252,8 +242,8 @@ void CachedCSSStyleSheet::checkNotify()
 
     CachedObjectClientWalker w(m_clients);
     while (CachedObjectClient *c = w.next()) {
-        if (m_response && !KWQIsResponseURLEqualToURL(m_response,m_url))
-            c->setStyleSheet(DOMString (KWQResponseURL(m_response)), m_sheet);
+        if (m_response && !KWQIsResponseURLEqualToURL(m_response, m_url))
+            c->setStyleSheet(DOMString(KWQResponseURL(m_response)), m_sheet);
         else
             c->setStyleSheet(m_url, m_sheet);
     }
@@ -1426,12 +1416,16 @@ void Loader::servePendingRequests()
          job->addMetaData("cross-domain", "true");
   }
 
+#if APPLE_CHANGES
+  connect( job, SIGNAL( result( KIO::Job *, NSData *) ), this, SLOT( slotFinished( KIO::Job *, NSData *) ) );
+#else
   connect( job, SIGNAL( result( KIO::Job * ) ), this, SLOT( slotFinished( KIO::Job * ) ) );
-
+#endif
+  
 #if APPLE_CHANGES
   connect( job, SIGNAL( data( KIO::Job*, const char *, int)),
            SLOT( slotData( KIO::Job*, const char *, int)));
-  connect( job, SIGNAL( receivedResponse( KIO::Job *, void *)), SLOT( slotReceivedResponse( KIO::Job *, void *)) );
+  connect( job, SIGNAL( receivedResponse( KIO::Job *, NSURLResponse *)), SLOT( slotReceivedResponse( KIO::Job *, NSURLResponse *)) );
 
   if (KWQServeRequest(this, req, job))
       m_requestsLoading.insert(job, req);
@@ -1446,7 +1440,11 @@ void Loader::servePendingRequests()
 #endif // APPLE_CHANGES
 }
 
+#if APPLE_CHANGES
+void Loader::slotFinished( KIO::Job* job, NSData *allData)
+#else
 void Loader::slotFinished( KIO::Job* job )
+#endif
 {
   Request *r = m_requestsLoading.take( job );
   KIO::TransferJob* j = static_cast<KIO::TransferJob*>(job);
@@ -1463,6 +1461,9 @@ void Loader::slotFinished( KIO::Job* job )
   else
   {
       r->object->data(r->m_buffer, true);
+#if APPLE_CHANGES
+      r->object->setAllData(allData);
+#endif 
       emit requestDone( r->m_docLoader, r->object );
 #if !APPLE_CHANGES
       time_t expireDate = j->queryMetaData("expire-date").toLong();
@@ -1488,7 +1489,8 @@ kdDebug(6060) << "Loader::slotFinished, url = " << j->url().url() << " expires "
 }
 
 #if APPLE_CHANGES
-void Loader::slotReceivedResponse(KIO::Job* job, void *response)
+
+void Loader::slotReceivedResponse(KIO::Job* job, NSURLResponse *response)
 {
     Request *r = m_requestsLoading[job];
     ASSERT(r);
@@ -1496,6 +1498,7 @@ void Loader::slotReceivedResponse(KIO::Job* job, void *response)
     r->object->setResponse(response);
     r->object->setExpireDate(KWQCacheObjectExpiresTime(r->m_docLoader, response), false);
 }
+
 #endif
 
 #if APPLE_CHANGES
@@ -1692,7 +1695,6 @@ CachedImage *Cache::requestImage( DocLoader* dl, const KURL & url, bool reload,
     }
 #endif
 
-
     CachedObject *o = 0;
     if (!reload)
         o = cache->find(url.url());
@@ -1889,7 +1891,8 @@ CachedScript *Cache::requestScript( DocLoader* dl, const DOM::DOMString &url, bo
 #endif
         return 0;
     }
-
+    
+    
 #ifdef CACHE_DEBUG
     if( o->status() == CachedObject::Pending )
         kdDebug( 6060 ) << "Cache: loading in progress: " << kurl.url() << endl;
index 00c7c811ff4368c379f7ed69c6d26a5c82660522..a80c652198cb2d215ea845359ebb61f371897560 100644 (file)
@@ -3,7 +3,7 @@
 
     Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de)
     Copyright (C) 2001 Dirk Mueller <mueller@kde.org>
-    Copyright (C) 2003 Apple Computer, Inc.
+    Copyright (C) 2004 Apple Computer, Inc.
 
     This library is free software; you can redistribute it and/or
     modify it under the terms of the GNU Library General Public
@@ -68,7 +68,17 @@ namespace DOM
 };
 
 #if APPLE_CHANGES
+
 class KWQLoader;
+
+#if __OBJC__
+@class NSData;
+@class NSURLResponse;
+#else
+class NSData;
+class NSURLResponse;
+#endif
+
 #endif
 
 namespace khtml
@@ -131,6 +141,7 @@ namespace khtml
            m_request = 0;
 #if APPLE_CHANGES
         m_response = 0;
+        m_allData = 0;
 #endif            
            m_expireDate = _expireDate;
         m_deleted = false;
@@ -180,9 +191,12 @@ namespace khtml
         void setRequest(Request *_request);
 
 #if APPLE_CHANGES
-        void *response() { return m_response; }
-        void setResponse (void *response);
+        NSURLResponse *response() const { return m_response; }
+        void setResponse(NSURLResponse *response);
+        NSData *allData() const { return m_allData; }
+        void setAllData (NSData *data);
 #endif
+
         bool canDelete() const { return (m_clients.count() == 0 && !m_request); }
 
        void setExpireDate(time_t _expireDate, bool changeHttpCache);
@@ -207,7 +221,8 @@ namespace khtml
         QString m_accept;
         Request *m_request;
 #if APPLE_CHANGES
-        void *m_response;
+        NSURLResponse *m_response;
+        NSData *m_allData;
 #endif
        Type m_type;
        Status m_status;
@@ -508,11 +523,12 @@ protected:
        void requestFailed( khtml::DocLoader* dl, khtml::CachedObject *obj );
 
     protected slots:
-       void slotFinished( KIO::Job * );
 #if APPLE_CHANGES
+        void slotFinished( KIO::Job * , NSData *allData);
        void slotData( KIO::Job *, const char *data, int size );
-        void slotReceivedResponse ( KIO::Job *, void *response );
+        void slotReceivedResponse ( KIO::Job *, NSURLResponse *response );
 #else
+        void slotFinished( KIO::Job * );
        void slotData( KIO::Job *, const QByteArray & );
 #endif
 
@@ -541,7 +557,7 @@ protected:
         * before using it.
         */
        static void init();
-
+        
        /**
         * Ask the cache for some url. Will return a cachedObject, and
         * load the requested data in case it's not cahced
index fe5664f6d1aad69ddbb0c113e0ec828cf4d9e3aa..b9e8833ad958b02422f5782455460384fdfeac89 100644 (file)
 
 #ifdef __OBJC__
 @class KWQResourceLoader;
+@class NSData;
+@class NSURLResponse;
 #else
 class KWQResourceLoader;
+class NSData;
+class NSURLResponse;
 #endif
 
 namespace khtml {
@@ -74,7 +78,8 @@ public:
     void emitData(const char *, int);
     void emitRedirection(const KURL &);
     void emitResult();
-    void emitReceivedResponse(void *);
+    void emitResult(NSData *);
+    void emitReceivedResponse(NSURLResponse *);
 
     khtml::FormData postData() const;
     QString method() const;
@@ -87,7 +92,8 @@ private:
 
     KWQSignal m_data;
     KWQSignal m_redirection;
-    KWQSignal m_result;
+    KWQSignal m_result1;
+    KWQSignal m_result2;
     KWQSignal m_receivedResponse;
 };
 
index 3049360be6c70bbce8fe9ef75cffefb8cb006322..04736bc1e231ecca0ae4501d761809145f7f5689 100644 (file)
@@ -52,7 +52,7 @@ public:
        , URL(kurl)
        , loader(nil)
        , method("GET")
-       , response(0)
+       , response(nil)
         , assembledResponseHeaders(true)
         , retrievedCharset(true)
     {
@@ -65,7 +65,7 @@ public:
        , loader(nil)
        , method("POST")
        , postData(_postData)
-       , response(0)
+       , response(nil)
        , assembledResponseHeaders(true)
         , retrievedCharset(true)
     {
@@ -73,7 +73,7 @@ public:
 
     ~TransferJobPrivate()
     {
-       KWQReleaseResponse(response);
+       KWQRelease(response);
         KWQRelease(metaData);
         KWQRelease(loader);
     }
@@ -85,7 +85,7 @@ public:
     QString method;
     FormData postData;
 
-    void *response;
+    NSURLResponse *response;
     bool assembledResponseHeaders;
     bool retrievedCharset;
     QString responseHeaders;
@@ -95,8 +95,9 @@ TransferJob::TransferJob(const KURL &url, bool reload)
     : d(new TransferJobPrivate(url)),
       m_data(this, SIGNAL(data(KIO::Job*, const char*, int))),
       m_redirection(this, SIGNAL(redirection(KIO::Job*, const KURL&))),
-      m_result(this, SIGNAL(result(KIO::Job*))),
-      m_receivedResponse(this, SIGNAL(receivedResponse(KIO::Job*, void *)))
+      m_result1(this, SIGNAL(result(KIO::Job*))),
+      m_result2(this, SIGNAL(result(KIO::Job*, NSData *))),
+      m_receivedResponse(this, SIGNAL(receivedResponse(KIO::Job*, NSURLResponse *)))
 {
 }
 
@@ -104,8 +105,9 @@ TransferJob::TransferJob(const KURL &url, const FormData &postData)
     : d(new TransferJobPrivate(url, postData)),
       m_data(this, SIGNAL(data(KIO::Job*, const char*, int))),
       m_redirection(this, SIGNAL(redirection(KIO::Job*, const KURL&))),
-      m_result(this, SIGNAL(result(KIO::Job*))),
-      m_receivedResponse(this, SIGNAL(receivedResponse(KIO::Job*, void *)))
+      m_result1(this, SIGNAL(result(KIO::Job*))),
+      m_result2(this, SIGNAL(result(KIO::Job*, NSData *))),
+      m_receivedResponse(this, SIGNAL(receivedResponse(KIO::Job*, NSURLResponse *)))
 {
 }
 
@@ -142,7 +144,11 @@ QString TransferJob::errorText() const
 void TransferJob::assembleResponseHeaders() const
 {
     if (!d->assembledResponseHeaders) {
-       d->responseHeaders = QString::fromNSString((NSString *)KWQResponseHeaderString(d->response));
+        if ([d->response isKindOfClass:[NSHTTPURLResponse class]]) {
+            NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *)d->response;
+            NSDictionary *headers = [httpResponse allHeaderFields];
+            d->responseHeaders = QString::fromNSString(KWQHeaderStringFromDictionary(headers, [httpResponse statusCode]));
+        }
        d->assembledResponseHeaders = true;
     }
 }
@@ -150,7 +156,7 @@ void TransferJob::assembleResponseHeaders() const
 void TransferJob::retrieveCharset() const
 {
     if (!d->retrievedCharset) {
-        NSString *charset = (NSString *)KWQResponseTextEncodingName(d->response);
+        NSString *charset = [d->response textEncodingName];
         if (charset) {
             [d->metaData setObject:charset forKey:@"charset"];
         }
@@ -228,15 +234,20 @@ void TransferJob::emitRedirection(const KURL &url)
 
 void TransferJob::emitResult()
 {
-    m_result.call(this);
+    m_result1.call(this);
+}
+
+void TransferJob::emitResult(NSData *allData)
+{
+    m_result2.call(this, allData);
 }
 
-void TransferJob::emitReceivedResponse(void *response)
+void TransferJob::emitReceivedResponse(NSURLResponse *response)
 {
     d->assembledResponseHeaders = false;
     d->retrievedCharset = false;
     d->response = response;
-    KWQRetainResponse(d->response);
+    KWQRetain(d->response);
 
     m_receivedResponse.call(this, response);
 }
index 5893ee2dd1cc4cf17a2931a06d2d342360ba6719..694212ad0131baa7780a5a658706c551961c5740 100644 (file)
 #include "KWQCString.h"
 #include "KWQSignal.h"
 
+#if __OBJC__
+@class NSDictionary;
+@class NSString;
+@class NSURLResponse;
+#else
+class NSDictionary;
+class NSString;
+class NSURLResponse;
+#endif
+
 namespace khtml {
     class CachedObject;
     class DocLoader;
@@ -48,15 +58,12 @@ QByteArray KWQServeSynchronousRequest(khtml::Loader *, khtml::DocLoader *, KIO::
 
 void KWQCheckCacheObjectStatus(khtml::DocLoader *, khtml::CachedObject *);
 bool KWQCheckIfReloading(khtml::DocLoader *loader);
-void KWQRetainResponse(void *response);
-void KWQReleaseResponse(void *response);
-bool KWQIsResponseURLEqualToURL(void *response, const DOM::DOMString &m_url);
-QString KWQResponseURL(void *response);
-void *KWQResponseMIMEType(void *response);
-void *KWQResponseTextEncodingName(void *response);
-void *KWQResponseHeaderString(void *response);
+bool KWQIsResponseURLEqualToURL(NSURLResponse *response, const DOM::DOMString &m_url);
+QString KWQResponseURL(NSURLResponse *response);
+NSString *KWQResponseMIMEType(NSURLResponse *response);
 int KWQNumberOfPendingOrLoadingRequests(khtml::DocLoader *dl);
-time_t KWQCacheObjectExpiresTime(khtml::DocLoader *docLoader, void *response);
+time_t KWQCacheObjectExpiresTime(khtml::DocLoader *docLoader, NSURLResponse *response);
+NSString *KWQHeaderStringFromDictionary(NSDictionary *headers, int statusCode);
 
 class KWQLoader
 {
index c5f9cba0e48c2397632e7aee14e8c7aa0a0472ab..ce17807b2e4c6e503cb096e97680ff5986e89e48 100644 (file)
@@ -139,7 +139,7 @@ bool KWQServeRequest(Loader *loader, DocLoader *docLoader, TransferJob *job)
     return true;
 }
 
-static NSString *KWQHeaderStringFromDictionary(NSDictionary *headers, int statusCode)
+NSString *KWQHeaderStringFromDictionary(NSDictionary *headers, int statusCode)
 {
     NSMutableString *headerString = [[NSMutableString alloc] init];
     [headerString appendString:[NSString stringWithFormat:@"HTTP/1.0 %d OK\n", statusCode]];
@@ -246,35 +246,20 @@ void KWQCheckCacheObjectStatus(DocLoader *loader, CachedObject *cachedObject)
 
     if (!part->haveToldBridgeAboutLoad(urlString)) {
        WebCoreBridge *bridge = part->bridge();
-       CachedImage *cachedImage = dynamic_cast<CachedImage *>(cachedObject);
 
        KWQ_BLOCK_EXCEPTIONS;
        [bridge objectLoadedFromCacheWithURL:KURL(cachedObject->url().string()).getNSURL()
-               response:(id)cachedObject->response()
-               size:cachedImage ? cachedImage->dataSize() : cachedObject->size()];
+                                    response:(NSURLResponse *)cachedObject->response()
+                                        data:(NSData *)cachedObject->allData()];
        KWQ_UNBLOCK_EXCEPTIONS;
 
        part->didTellBridgeAboutLoad(urlString);
     }
 }
 
-void KWQRetainResponse(void *response)
-{
-    // There's no way a retain can raise
-    KWQRetain((id)response);
-}
-
-void KWQReleaseResponse(void *response)
-{
-    // A release could raise if it deallocs.
-    KWQ_BLOCK_EXCEPTIONS;
-    KWQRelease((id)response);
-    KWQ_UNBLOCK_EXCEPTIONS;
-}
-
 #define LOCAL_STRING_BUFFER_SIZE 1024
 
-bool KWQIsResponseURLEqualToURL(void *response, const DOM::DOMString &m_url)
+bool KWQIsResponseURLEqualToURL(NSURLResponse *response, const DOM::DOMString &m_url)
 {
     unichar _buffer[LOCAL_STRING_BUFFER_SIZE];
     unichar *urlStringCharacters;
@@ -305,7 +290,7 @@ bool KWQIsResponseURLEqualToURL(void *response, const DOM::DOMString &m_url)
     return ret;
 }
 
-QString KWQResponseURL(void *response)
+QString KWQResponseURL(NSURLResponse *response)
 {
     KWQ_BLOCK_EXCEPTIONS;
 
@@ -321,7 +306,7 @@ QString KWQResponseURL(void *response)
     return NULL;
 }
 
-void *KWQResponseMIMEType(void *response)
+NSString *KWQResponseMIMEType(NSURLResponse *response)
 {
     KWQ_BLOCK_EXCEPTIONS;
     return [(NSURLResponse *)response MIMEType];
@@ -330,32 +315,7 @@ void *KWQResponseMIMEType(void *response)
     return NULL;
 }
 
-void *KWQResponseTextEncodingName(void *response)
-{
-    KWQ_BLOCK_EXCEPTIONS;
-    return [(NSURLResponse *)response textEncodingName];
-    KWQ_UNBLOCK_EXCEPTIONS;
-
-    return NULL;
-}
-
-void *KWQResponseHeaderString(void *response)
-{
-    KWQ_BLOCK_EXCEPTIONS;
-    NSURLResponse *nsResponse = (NSURLResponse *)response;
-    if ([nsResponse isKindOfClass:[NSHTTPURLResponse class]]) {
-       NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *)nsResponse;
-       NSDictionary *headers = [httpResponse allHeaderFields];
-
-       return KWQHeaderStringFromDictionary(headers, [httpResponse statusCode]);
-    }
-
-    KWQ_UNBLOCK_EXCEPTIONS;
-
-    return NULL;
-}
-
-time_t KWQCacheObjectExpiresTime(khtml::DocLoader *docLoader, void *response)
+time_t KWQCacheObjectExpiresTime(khtml::DocLoader *docLoader, NSURLResponse *response)
 {
     KWQ_BLOCK_EXCEPTIONS;
     
@@ -374,3 +334,27 @@ KWQLoader::KWQLoader(Loader *loader)
     , _requestFailed(loader, SIGNAL(requestFailed(khtml::DocLoader *, khtml::CachedObject *)))
 {
 }
+
+namespace khtml {
+    
+void CachedObject::setResponse(NSURLResponse *response)
+{
+    KWQRetain(response);
+    KWQ_BLOCK_EXCEPTIONS;
+    KWQRelease(m_response);
+    KWQ_UNBLOCK_EXCEPTIONS;
+
+    m_response = response;
+}
+
+void CachedObject::setAllData(NSData *allData)
+{
+    KWQRetain(allData);
+    KWQ_BLOCK_EXCEPTIONS;
+    KWQRelease(m_allData);
+    KWQ_UNBLOCK_EXCEPTIONS;
+
+    m_allData = allData;
+}
+
+} // namespace
index 30094df3f525a45af53acbd67c7971bd5638ef25..481b7b77c9b3ad7df343d2aac6fedbad93d032d8 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2003 Apple Computer, Inc.  All rights reserved.
+ * Copyright (C) 2004 Apple Computer, Inc.  All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -56,10 +56,10 @@ public:
     QPixmap(void *MIMEType);
     QPixmap(const QSize&);
     QPixmap(const QByteArray&);
-    QPixmap(const QByteArray&, void *MIMEType);
+    QPixmap(const QByteArray&, NSString *MIMEType);
     QPixmap(int, int);
-    QPixmap(const QPixmap &);
     QPixmap(WebCoreImageRendererPtr);
+    QPixmap(const QPixmap &);
     ~QPixmap();
     
     bool isNull() const;
index de228cf407e8654fa381e93a0cf69c3eac4c688b..082d434bec7e1951eae34cef8a980e3715f3ae14 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2003 Apple Computer, Inc.  All rights reserved.
+ * Copyright (C) 2004 Apple Computer, Inc.  All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -43,50 +43,49 @@ bool canRenderImageType(const QString &type)
 QPixmap::QPixmap()
 {
     imageRenderer = nil;
-    MIMEType = 0;
+    MIMEType = nil;
     needCopyOnWrite = false;
 }
 
 QPixmap::QPixmap(WebCoreImageRendererPtr r)
 {
     imageRenderer = KWQRetain(r);
-    MIMEType = 0;
+    MIMEType = nil;
     needCopyOnWrite = false;
 }
 
-
 QPixmap::QPixmap(void *MIME)
 {
     imageRenderer = nil;
-    MIMEType = (NSString *)[((NSString *)MIME) copy];
+    MIMEType = KWQRetainNSRelease([(NSString *)MIME copy]);
     needCopyOnWrite = false;
 }
 
 QPixmap::QPixmap(const QSize &sz)
 {
     imageRenderer = KWQRetain([[WebCoreImageRendererFactory sharedFactory] imageRendererWithSize:NSMakeSize(sz.width(), sz.height())]);
-    MIMEType = 0;
+    MIMEType = nil;
     needCopyOnWrite = false;
 }
 
 QPixmap::QPixmap(const QByteArray &bytes)
 {
     imageRenderer = KWQRetain([[WebCoreImageRendererFactory sharedFactory] imageRendererWithBytes:bytes.data() length:bytes.size()]);
-    MIMEType = 0;
+    MIMEType = nil;
     needCopyOnWrite = false;
 }
 
-QPixmap::QPixmap(const QByteArray &bytes, void *MIME)
+QPixmap::QPixmap(const QByteArray &bytes, NSString *MIME)
 {
-    MIMEType = (NSString *)[((NSString *)MIME) copy];
-    imageRenderer = KWQRetain([[WebCoreImageRendererFactory sharedFactory] imageRendererWithBytes:bytes.data() length:bytes.size() MIMEType:(NSString *)MIMEType]);
+    MIMEType = KWQRetainNSRelease([MIME copy]);
+    imageRenderer = KWQRetain([[WebCoreImageRendererFactory sharedFactory] imageRendererWithBytes:bytes.data() length:bytes.size() MIMEType:MIMEType]);
     needCopyOnWrite = false;
 }
 
 QPixmap::QPixmap(int w, int h)
 {
     imageRenderer = KWQRetain([[WebCoreImageRendererFactory sharedFactory] imageRendererWithSize:NSMakeSize(w, h)]);
-    MIMEType = 0;
+    MIMEType = nil;
     needCopyOnWrite = false;
 }
 
index 75f12a5988f8deb78b82e0da47c8295140c0cd7d..2ff977fe9a92519de4c120b14b60235c08fc79fe 100644 (file)
@@ -82,7 +82,7 @@ using KIO::TransferJob;
     [handle release];
 }
 
-- (void)finishJobAndHandle
+- (void)finishJobAndHandle:(NSData *)data
 {
     TransferJob *job = _job;
     id <WebCoreResourceHandle> handle = _handle;
@@ -90,7 +90,7 @@ using KIO::TransferJob;
     _handle = nil;
 
     if (job) {
-        job->emitResult();
+        job->emitResult(data);
     }
     delete job;
     [handle release];
@@ -101,21 +101,21 @@ using KIO::TransferJob;
     if (_job) {
         _job->setError(1);
     }
-    [self finishJobAndHandle];
+    [self finishJobAndHandle:nil];
 }
 
 - (void)reportError
 {
     ASSERT(_job);
     _job->setError(1);
-    [self finishJobAndHandle];
+    [self finishJobAndHandle:nil];
 }
 
-- (void)finish
+- (void)finishWithData:(NSData *)data
 {
     ASSERT(_job);
     ASSERT(_handle);
-    [self finishJobAndHandle];
+    [self finishJobAndHandle:data];
 }
 
 @end
index bdf56c73c6a05b9a0d137a26e68b8f36433ff68a..9b59c9184c8d1947c382eeaa2590075e4aa925a9 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2003 Apple Computer, Inc.  All rights reserved.
+ * Copyright (C) 2004 Apple Computer, Inc.  All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -45,7 +45,8 @@ public:
     void call(khtml::DocLoader *, khtml::CachedObject *) const;
     void call(KIO::Job *, const char *data, int size) const;
     void call(KIO::Job *, const KURL &) const;
-    void call(KIO::Job *, void *) const;
+    void call(KIO::Job *, NSData *) const;
+    void call(KIO::Job *, NSURLResponse *) const;
     
 private:
     // forbid copying and assignment
index 8b6196efc757ee8232c7e497218320f70ca5806d..2ed63df4d65c0707c55d98a0efdc50c61dff1bb2 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2003 Apple Computer, Inc.  All rights reserved.
+ * Copyright (C) 2004 Apple Computer, Inc.  All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -173,7 +173,7 @@ void KWQSignal::call(Job *j, const KURL &u) const
     }
 }
 
-void KWQSignal::call(Job *j, void *d) const
+void KWQSignal::call(Job *j, NSData *d) const
 {
     if (!_object->_signalsBlocked) {
         KWQObjectSenderScope senderScope(_object);
@@ -185,3 +185,14 @@ void KWQSignal::call(Job *j, void *d) const
     }
 }
 
+void KWQSignal::call(Job *j, NSURLResponse *r) const
+{
+    if (!_object->_signalsBlocked) {
+        KWQObjectSenderScope senderScope(_object);
+        QValueList<KWQSlot> copiedSlots(_slots);
+        QValueListConstIterator<KWQSlot> end = copiedSlots.end();
+        for (QValueListConstIterator<KWQSlot> it = copiedSlots.begin(); it != end; ++it) {
+            (*it).call(j, r);
+        }
+    }
+}
index 3e79b3c72ffcf003cdc5ea244446d03100db86b0..855dc5039a7506076e860bd80909938c87f9b713 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2003 Apple Computer, Inc.  All rights reserved.
+ * Copyright (C) 2004 Apple Computer, Inc.  All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
 
 #include "KWQGuardedPtr.h"
 
+#if __OBJC__
+@class NSData;
+@class NSURLResponse;
+#else
+class NSData;
+class NSURLResponse;
+#endif
+
 class QString;
 class KURL;
 
@@ -59,7 +67,8 @@ public:
     void call(khtml::DocLoader *, khtml::CachedObject *) const;
     void call(KIO::Job *, const char *, int) const;
     void call(KIO::Job *, const KURL &) const;
-    void call(KIO::Job *, void *) const;
+    void call(KIO::Job *, NSData *) const;
+    void call(KIO::Job *, NSURLResponse *) const;
 
     friend bool operator==(const KWQSlot &, const KWQSlot &);
 
index 0b06bb475c761fb55965c2ebceb11eb48f61c53a..d89bed83373cdb0e2bba8f9aeb06eca5d177197b 100644 (file)
@@ -83,7 +83,7 @@ enum FunctionNumber {
     slotFinished_KHTMLPart,
     slotFinished_Loader,
     slotFinished_XMLHttpRequest,
-    slotReceivedResponse
+    slotReceivedResponse,
 };
 
 KWQSlot::KWQSlot(QObject *object, const char *member)
@@ -148,16 +148,17 @@ KWQSlot::KWQSlot(QObject *object, const char *member)
        } else {
            m_function = slotRedirection_XMLHttpRequest;
        }
+    } else if (KWQNamesMatch(member, SLOT(slotFinished(KIO::Job *, NSData *)))) {
+       ASSERT(dynamic_cast<khtml::Loader *>(object));
+       m_function = slotFinished_Loader;        
     } else if (KWQNamesMatch(member, SLOT(slotFinished(KIO::Job *)))) {
-       ASSERT(dynamic_cast<khtml::Loader *>(object) || dynamic_cast<KHTMLPart *>(object) || dynamic_cast<XMLHttpRequestQObject *>(object));
-       if (dynamic_cast<khtml::Loader *>(object)) {
-           m_function = slotFinished_Loader;
-       } else if (dynamic_cast<KHTMLPart *>(object)) {
+       ASSERT(dynamic_cast<KHTMLPart *>(object) || dynamic_cast<XMLHttpRequestQObject *>(object));
+       if (dynamic_cast<KHTMLPart *>(object)) {
            m_function = slotFinished_KHTMLPart;
        } else {
            m_function = slotFinished_XMLHttpRequest;
        }
-    } else if (KWQNamesMatch(member, SLOT(slotReceivedResponse(KIO::Job *, void *)))) {
+    } else if (KWQNamesMatch(member, SLOT(slotReceivedResponse(KIO::Job *, NSURLResponse *)))) {
        ASSERT(dynamic_cast<khtml::Loader *>(object));
        m_function = slotReceivedResponse;
     } else {
@@ -272,9 +273,6 @@ void KWQSlot::call(Job *job) const
         case slotFinished_KHTMLPart:
             static_cast<KHTMLPart *>(m_object.pointer())->slotFinished(job);
             return;
-        case slotFinished_Loader:
-            static_cast<Loader *>(m_object.pointer())->slotFinished(job);
-            return;
         case slotFinished_XMLHttpRequest:
             static_cast<XMLHttpRequestQObject *>(m_object.pointer())->slotFinished(job);
             return;
@@ -319,7 +317,22 @@ void KWQSlot::call(Job *job, const KURL &url) const
     call();
 }
 
-void KWQSlot::call(KIO::Job *job, void *response) const
+void KWQSlot::call(KIO::Job *job, NSData *allData) const
+{
+    if (m_object.isNull()) {
+        return;
+    }
+    
+    switch (m_function) {
+        case slotFinished_Loader:
+            static_cast<Loader *>(m_object.pointer())->slotFinished(job, allData);
+            return;
+    }
+    
+    call();
+}
+
+void KWQSlot::call(KIO::Job *job, NSURLResponse *response) const
 {
     if (m_object.isNull()) {
         return;
@@ -330,7 +343,7 @@ void KWQSlot::call(KIO::Job *job, void *response) const
            static_cast<Loader *>(m_object.pointer())->slotReceivedResponse(job, response);
            return;
     }
-
+    
     call();
 }
 
index d609a7bf37c308cf27fec7d56b22d181997c49fd..df672bdae21c0cd92d507c860bf33dd2120a1fdc 100644 (file)
@@ -446,7 +446,7 @@ typedef enum {
 
 - (id <WebCoreResourceHandle>)startLoadingResource:(id <WebCoreResourceLoader>)loader withURL:(NSURL *)URL customHeaders:(NSDictionary *)customHeaders;
 - (id <WebCoreResourceHandle>)startLoadingResource:(id <WebCoreResourceLoader>)loader withURL:(NSURL *)URL customHeaders:(NSDictionary *)customHeaders postData:(NSArray *)data;
-- (void)objectLoadedFromCacheWithURL:(NSURL *)URL response:(id)response size:(unsigned)bytes;
+- (void)objectLoadedFromCacheWithURL:(NSURL *)URL response:(NSURLResponse *)response data:(NSData *)data;
 
 - (NSData *)syncLoadResourceWithURL:(NSURL *)URL customHeaders:(NSDictionary *)requestHeaders postData:(NSArray *)postData finalURL:(NSURL **)finalNSURL responseHeaders:(NSDictionary **)responseHeaderDict statusCode:(int *)statusCode;
 
index 42f3ba39bba0cd53d1bd6ad03d9e7a4c87a017bd..a6c9242051ce904925370e8b0efcc60cb10c7a43 100644 (file)
@@ -32,9 +32,9 @@
 
 - (void)addData:(NSData *)data;
 
-// Either finish, reportError, or cancel must be called before the
+// Either finishWithData:, reportError, or cancel must be called before the
 // loader is released, but never more than one.
-- (void)finish;
+- (void)finishWithData:(NSData *)data;
 - (void)reportError;
 - (void)cancel;
 
index 05207faa7ca1e1d1b04acd388e633b2eaf235b2b..48ad056fbe4c0d03ffe73b4829cbac14b9383a56 100644 (file)
@@ -1,3 +1,24 @@
+2004-12-04  Chris Blumenberg  <cblu@apple.com>
+
+       New fixes for:
+       <rdar://problem/3685766> WebDataSource is missing subresources when they use cached WebCore data
+       <rdar://problem/3722434> REGRESSION?: Assertion failure trying to drag image in iframe (itapema.sc.gov.br)
+       <rdar://problem/3903173> REGRESSION (172-TOT): assertion failure and crash in slotAllData logging into hotmail account
+       <rdar://problem/3902749> REGRESSION (Tiger): missing image symbol does not appear
+
+        Reviewed by darin, rjw, kocienda.
+
+        * WebCoreSupport.subproj/WebBridge.m:
+        (-[WebBridge objectLoadedFromCacheWithURL:response:data:]):
+        (-[WebBridge syncLoadResourceWithURL:customHeaders:postData:finalURL:responseHeaders:statusCode:]):
+        * WebCoreSupport.subproj/WebSubresourceClient.m:
+        (-[WebSubresourceClient didFinishLoading]):
+        * WebView.subproj/WebFrame.m:
+        (-[WebFrame _opened]):
+        (-[WebFrame _internalLoadDelegate]):
+        (-[WebFrame _sendResourceLoadDelegateMessagesForURL:response:length:]):
+        * WebView.subproj/WebFrameInternal.h:
+
 2004-12-04  Darin Adler  <darin@apple.com>
 
         Reviewed by Maciej.
index 918447ac647899160487f0d0915ad06f1596bd16..4c80482ad29dfa9e0f324e9fc81826fa13d590aa 100644 (file)
 #import <WebKit/WebBasePluginPackage.h>
 #import <WebKit/WebBaseResourceHandleDelegate.h>
 #import <WebKit/WebDataSourcePrivate.h>
-#import <WebKit/WebDefaultResourceLoadDelegate.h>
 #import <WebKit/WebDefaultUIDelegate.h>
 #import <WebKit/WebEditingDelegate.h>
 #import <WebKit/WebFileButton.h>
 #import <WebKit/WebFormDelegate.h>
+#import <WebKit/WebFrameInternal.h>
 #import <WebKit/WebFrameLoadDelegate.h>
-#import <WebKit/WebFramePrivate.h>
 #import <WebKit/WebFrameViewInternal.h>
 #import <WebKit/WebHistoryItemPrivate.h>
 #import <WebKit/WebHTMLRepresentationPrivate.h>
@@ -41,7 +40,7 @@
 #import <WebKit/WebPluginViewFactoryPrivate.h>
 #import <WebKit/WebNetscapePluginDocumentView.h>
 #import <WebKit/WebPreferencesPrivate.h>
-#import <WebKit/WebResourceLoadDelegate.h>
+#import <WebKit/WebResource.h>
 #import <WebKit/WebSubresourceClient.h>
 #import <WebKit/WebViewInternal.h>
 #import <WebKit/WebViewPrivate.h>
@@ -443,42 +442,18 @@ NSString *WebPluginContainerKey =   @"WebPluginContainer";
                                         forDataSource:[self dataSource]];
 }
 
-- (void)objectLoadedFromCacheWithURL:(NSURL *)URL response: response size:(unsigned)bytes
+- (void)objectLoadedFromCacheWithURL:(NSURL *)URL response:(NSURLResponse *)response data:(NSData *)data
 {
-    ASSERT(_frame != nil);
-    ASSERT(response != nil);
-
-    NSURLRequest *request = [[NSURLRequest alloc] initWithURL:URL];
-    WebView *wv = [_frame webView];
-    id delegate = [wv resourceLoadDelegate];
-    id sharedDelegate = [WebDefaultResourceLoadDelegate sharedResourceLoadDelegate];
-    id identifier;
-    WebResourceDelegateImplementationCache implementations = [wv _resourceLoadDelegateImplementations];
+    WebResource *resource = [[WebResource alloc] initWithData:data
+                                                          URL:URL
+                                                     MIMEType:[response MIMEType]
+                                             textEncodingName:[response textEncodingName]
+                                                    frameName:nil];
+    ASSERT(resource != nil);
+    [[self dataSource] addSubresource:resource];
+    [resource release];
     
-    // No chance for delegate to modify request, so we don't send a willSendRequest:redirectResponse: message.
-    if (implementations.delegateImplementsIdentifierForRequest)
-        identifier = [delegate webView:wv identifierForInitialRequest: request fromDataSource: [self dataSource]];
-    else
-        identifier = [sharedDelegate webView:wv identifierForInitialRequest:request fromDataSource:[self dataSource]];
-    
-    if (implementations.delegateImplementsDidReceiveResponse)
-        [delegate webView:wv resource: identifier didReceiveResponse: response fromDataSource: [self dataSource]];
-    else
-        [sharedDelegate webView:wv resource: identifier didReceiveResponse: response fromDataSource: [self dataSource]];
-
-    if (implementations.delegateImplementsDidReceiveContentLength)
-        [delegate webView:wv resource: identifier didReceiveContentLength: bytes fromDataSource: [self dataSource]];
-    else
-        [sharedDelegate webView:wv resource: identifier didReceiveContentLength: bytes fromDataSource: [self dataSource]];
-
-    if (implementations.delegateImplementsDidFinishLoadingFromDataSource)
-        [delegate webView:wv resource: identifier didFinishLoadingFromDataSource: [self dataSource]];
-    else
-        [sharedDelegate webView:wv resource: identifier didFinishLoadingFromDataSource: [self dataSource]];
-    
-    [[_frame webView] _finishedLoadingResourceFromDataSource:[self dataSource]];
-
-    [request release];
+    [_frame _sendResourceLoadDelegateMessagesForURL:URL response:response length:[data length]];    
 }
 
 - (NSData *)syncLoadResourceWithURL:(NSURL *)URL customHeaders:(NSDictionary *)requestHeaders postData:(NSArray *)postData finalURL:(NSURL **)finalURL responseHeaders:(NSDictionary **)responseHeaderDict statusCode:(int *)statusCode
@@ -529,7 +504,7 @@ NSString *WebPluginContainerKey =   @"WebPluginContainer";
     }
 
     // notify the delegates
-    [self objectLoadedFromCacheWithURL:URL response:response size:[result length]];
+    [self objectLoadedFromCacheWithURL:URL response:response data:result];
 
     return result;
 }
index e0de2b93f920a776d88bf0852039e224afbbe0aa..d78e79cb7abbcc6c7b093e344a29a25c49bbba35 100644 (file)
     // Calling _removeSubresourceClient will likely result in a call to release, so we must retain.
     [self retain];
     
-    [loader finish];
+    [loader finishWithData:[self resourceData]];
     
     [dataSource _removeSubresourceClient:self];
     
index e0de2b93f920a776d88bf0852039e224afbbe0aa..d78e79cb7abbcc6c7b093e344a29a25c49bbba35 100644 (file)
     // Calling _removeSubresourceClient will likely result in a call to release, so we must retain.
     [self retain];
     
-    [loader finish];
+    [loader finishWithData:[self resourceData]];
     
     [dataSource _removeSubresourceClient:self];
     
index e345a50c2025f3fde89a27c8e0247e88f29c3e38..19f9794e4bffac4d361a82b0e5f0cc7978ded03b 100644 (file)
@@ -11,6 +11,7 @@
 #import <WebKit/WebBridge.h>
 #import <WebKit/WebDataProtocol.h>
 #import <WebKit/WebDataSourcePrivate.h>
+#import <WebKit/WebDefaultResourceLoadDelegate.h>
 #import <WebKit/WebDefaultUIDelegate.h>
 #import <WebKit/WebDocumentInternal.h>
 #import <WebKit/WebFrameLoadDelegate.h>
@@ -31,6 +32,7 @@
 #import <WebKit/WebPlugin.h>
 #import <WebKit/WebPluginController.h>
 #import <WebKit/WebPluginDocumentView.h>
+#import <WebKit/WebResourceLoadDelegate.h>
 #import <WebKit/WebResourcePrivate.h>
 #import <WebKit/WebViewInternal.h>
 #import <WebKit/WebUIDelegate.h>
@@ -1001,9 +1003,9 @@ static CFAbsoluteTime _timeOfLastCompletedLoad;
         int i, count = [responses count];
         for (i = 0; i < count; i++){
             response = [responses objectAtIndex: i];
-            [_private->bridge objectLoadedFromCacheWithURL:[response URL]
-                    response: response
-                    size: [response expectedContentLength]];
+            [self _sendResourceLoadDelegateMessagesForURL:[response URL]
+                                                 response:response
+                                                   length:[response expectedContentLength]];
         }
         
         // Release the resources kept in the page cache.  They will be
@@ -2507,6 +2509,44 @@ static CFAbsoluteTime _timeOfLastCompletedLoad;
     return _private->internalLoadDelegate;
 }
 
+- (void)_sendResourceLoadDelegateMessagesForURL:(NSURL *)URL response:(NSURLResponse *)response length:(unsigned)length
+{
+    ASSERT(response != nil);
+    
+    NSURLRequest *request = [[NSURLRequest alloc] initWithURL:URL];
+    WebView *wv = [self webView];
+    id delegate = [wv resourceLoadDelegate];
+    id sharedDelegate = [WebDefaultResourceLoadDelegate sharedResourceLoadDelegate];
+    id identifier;
+    WebResourceDelegateImplementationCache implementations = [wv _resourceLoadDelegateImplementations];
+    WebDataSource *dataSource = [self dataSource];
+    
+    // No chance for delegate to modify request, so we don't send a willSendRequest:redirectResponse: message.
+    if (implementations.delegateImplementsIdentifierForRequest)
+        identifier = [delegate webView:wv identifierForInitialRequest: request fromDataSource:dataSource];
+    else
+        identifier = [sharedDelegate webView:wv identifierForInitialRequest:request fromDataSource:dataSource];
+    
+    if (implementations.delegateImplementsDidReceiveResponse)
+        [delegate webView:wv resource: identifier didReceiveResponse: response fromDataSource:dataSource];
+    else
+        [sharedDelegate webView:wv resource: identifier didReceiveResponse: response fromDataSource:dataSource];
+    
+    if (implementations.delegateImplementsDidReceiveContentLength)
+        [delegate webView:wv resource: identifier didReceiveContentLength:length fromDataSource:dataSource];
+    else
+        [sharedDelegate webView:wv resource: identifier didReceiveContentLength:length fromDataSource:dataSource];
+    
+    if (implementations.delegateImplementsDidFinishLoadingFromDataSource)
+        [delegate webView:wv resource: identifier didFinishLoadingFromDataSource:dataSource];
+    else
+        [sharedDelegate webView:wv resource: identifier didFinishLoadingFromDataSource:dataSource];
+    
+    [wv _finishedLoadingResourceFromDataSource:dataSource];
+    
+    [request release];
+}
+
 @end
 
 @implementation WebFormState : NSObject
index 9581bed4b9a4fff892c66517cf9c5d782fd757c6..6b7188ff0383b48f72d03a9a54b6e52394680a36 100644 (file)
@@ -7,6 +7,7 @@
 - (void)_updateDrawsBackground;
 - (void)_setInternalLoadDelegate:(id)internalLoadDelegate;
 - (id)_internalLoadDelegate;
+- (void)_sendResourceLoadDelegateMessagesForURL:(NSURL *)URL response:(NSURLResponse *)response length:(unsigned)length;
 
 @end