Changeset 17682 in webkit
- Timestamp:
- Nov 8, 2006 10:49:17 PM (17 years ago)
- Location:
- trunk
- Files:
-
- 3 added
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/http/tests/xmlhttprequest/cache-override.html
r15150 r17682 111 111 log("async: Automatically cached response body is correct; status = " + req.status); 112 112 else 113 log("async: Automatically cached response body is different from the expected one; status = " + req.status );113 log("async: Automatically cached response body is different from the expected one; status = " + req.status + "; req.responseText='" + req.responseText + "' (expected '<?xml version=\"1.0\" encoding=\"windows-1251\"?>\n<node>Проверка</node>\n')"); 114 114 115 115 req = new XMLHttpRequest(); -
trunk/WebCore/ChangeLog
r17681 r17682 1 2006-11-08 Maciej Stachowiak <mjs@apple.com> 2 3 Reviewed by Geoff. 4 5 - added ResourceError class and didFailWithError client method 6 7 * WebCore.xcodeproj/project.pbxproj: 8 * loader/icon/IconLoader.cpp: 9 (WebCore::IconLoader::didFailWithError): 10 (WebCore::IconLoader::didFinishLoading): 11 * loader/icon/IconLoader.h: 12 * loader/loader.cpp: 13 (WebCore::Loader::receivedAllData): 14 (WebCore::Loader::didFailWithError): 15 * loader/loader.h: 16 * loader/mac/SubresourceLoaderMac.mm: 17 (WebCore::SubresourceLoader::didFail): 18 (WebCore::SubresourceLoader::didCancel): 19 * platform/cf/RetainPtr.h: 20 (WebCore::): 21 (WebCore::adoptCFReference): 22 (WebCore::RetainPtr::RetainPtr): 23 (WebCore::::adopt): 24 * platform/network/ResourceError.cpp: Added. 25 * platform/network/ResourceError.h: Added. 26 (WebCore::ResourceError::ResourceError): 27 (WebCore::ResourceError::domain): 28 (WebCore::ResourceError::errorCode): 29 (WebCore::ResourceError::failingURL): 30 (WebCore::ResourceError::localizedDescription): 31 (WebCore::ResourceError::unpackPlatformErrorIfNeeded): 32 * platform/network/ResourceHandle.cpp: 33 * platform/network/ResourceHandle.h: 34 * platform/network/ResourceHandleClient.h: 35 (WebCore::ResourceHandleClient::didFailWithError): 36 * platform/network/cf/ResourceHandleCFNet.cpp: 37 (WebCore::didFail): 38 (WebCore::ResourceHandle::cancel): 39 * platform/network/mac/ResourceErrorMac.mm: Added. 40 (-[NSError WebCore]): 41 * platform/network/mac/ResourceHandleMac.mm: 42 (WebCore::ResourceHandle::reportError): 43 * xml/xmlhttprequest.cpp: 44 (WebCore::XMLHttpRequest::didFailWithError): 45 (WebCore::XMLHttpRequest::didFinishLoading): 46 * xml/xmlhttprequest.h: 47 1 48 2006-11-08 Krzysztof Kowalczyk <kkowalczyk@gmail.com> 2 49 -
trunk/WebCore/WebCore.xcodeproj/project.pbxproj
r17670 r17682 288 288 650F53DC09D15DDA00C9B0C8 /* CSSGrammar.h in Headers */ = {isa = PBXBuildFile; fileRef = 650F53DB09D15DDA00C9B0C8 /* CSSGrammar.h */; }; 289 289 650F53DD09D15DDF00C9B0C8 /* CSSGrammar.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6565814409D13043000E61D7 /* CSSGrammar.cpp */; }; 290 651888880AFF3BF700164720 /* ResourceError.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 651888860AFF3BF700164720 /* ResourceError.cpp */; }; 291 651888890AFF3BF700164720 /* ResourceError.h in Headers */ = {isa = PBXBuildFile; fileRef = 651888870AFF3BF700164720 /* ResourceError.h */; }; 292 6518888B0AFF3C1400164720 /* ResourceErrorMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 6518888A0AFF3C1400164720 /* ResourceErrorMac.mm */; }; 290 293 651B4D8509AC83370029F1EF /* DeprecatedStringList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 651B4D8309AC83370029F1EF /* DeprecatedStringList.cpp */; }; 291 294 651B4D8609AC83370029F1EF /* DeprecatedStringList.h in Headers */ = {isa = PBXBuildFile; fileRef = 651B4D8409AC83370029F1EF /* DeprecatedStringList.h */; }; … … 3190 3193 650E3F680AF6C168001FA3AD /* ResourceRequestMac.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = ResourceRequestMac.mm; sourceTree = "<group>"; }; 3191 3194 650F53DB09D15DDA00C9B0C8 /* CSSGrammar.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CSSGrammar.h; sourceTree = "<group>"; }; 3195 651888860AFF3BF700164720 /* ResourceError.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = ResourceError.cpp; sourceTree = "<group>"; }; 3196 651888870AFF3BF700164720 /* ResourceError.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = ResourceError.h; sourceTree = "<group>"; }; 3197 6518888A0AFF3C1400164720 /* ResourceErrorMac.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = ResourceErrorMac.mm; sourceTree = "<group>"; }; 3192 3198 651B4D8309AC83370029F1EF /* DeprecatedStringList.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = DeprecatedStringList.cpp; sourceTree = "<group>"; }; 3193 3199 651B4D8409AC83370029F1EF /* DeprecatedStringList.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = DeprecatedStringList.h; sourceTree = "<group>"; }; … … 6363 6369 children = ( 6364 6370 65DADA170AFD878000CE53ED /* FormData.h */, 6371 651888860AFF3BF700164720 /* ResourceError.cpp */, 6372 651888870AFF3BF700164720 /* ResourceError.h */, 6365 6373 65DAD9FA0AFD86B400CE53ED /* FormData.cpp */, 6366 6374 656B84E70AEA1DAE00A095B4 /* mac */, … … 6379 6387 isa = PBXGroup; 6380 6388 children = ( 6389 6518888A0AFF3C1400164720 /* ResourceErrorMac.mm */, 6381 6390 65DAD9FE0AFD86BF00CE53ED /* FormDataStreamMac.h */, 6382 6391 65DAD9FF0AFD86BF00CE53ED /* FormDataStreamMac.mm */, … … 10505 10514 65DADA000AFD86BF00CE53ED /* FormDataStreamMac.h in Headers */, 10506 10515 65DADA180AFD878000CE53ED /* FormData.h in Headers */, 10516 651888890AFF3BF700164720 /* ResourceError.h in Headers */, 10507 10517 148CF65E0B00561400A997FC /* Screen.h in Headers */, 10508 10518 ); … … 11747 11757 65DAD9FC0AFD86B400CE53ED /* FormData.cpp in Sources */, 11748 11758 65DADA010AFD86BF00CE53ED /* FormDataStreamMac.mm in Sources */, 11759 651888880AFF3BF700164720 /* ResourceError.cpp in Sources */, 11760 6518888B0AFF3C1400164720 /* ResourceErrorMac.mm in Sources */, 11749 11761 ); 11750 11762 runOnlyForDeploymentPostprocessing = 0; -
trunk/WebCore/loader/icon/IconLoader.cpp
r17652 r17682 114 114 } 115 115 116 void IconLoader::didFailWithError(ResourceHandle* handle, const ResourceError&) 117 { 118 finishLoading(handle->url()); 119 } 120 116 121 void IconLoader::didFinishLoading(ResourceHandle* handle) 117 122 { 123 ASSERT(handle == m_handle); 118 124 finishLoading(handle->url()); 119 125 } -
trunk/WebCore/loader/icon/IconLoader.h
r17655 r17682 51 51 virtual void didReceiveData(ResourceHandle*, const char*, int); 52 52 virtual void didFinishLoading(ResourceHandle*); 53 virtual void didFailWithError(ResourceHandle*, const ResourceError&); 53 54 54 55 void finishLoading(const KURL&); -
trunk/WebCore/loader/loader.cpp
r17652 r17682 104 104 DocLoader* docLoader = req->docLoader(); 105 105 106 if (job->error() || job->isErrorPage()) { 107 docLoader->setLoadInProgress(true); 108 object->error(); 109 docLoader->setLoadInProgress(false); 110 cache()->remove(object); 111 } else { 112 docLoader->setLoadInProgress(true); 113 object->data(req->buffer(), true); 114 object->setAllData(allData); 115 docLoader->setLoadInProgress(false); 116 object->finish(); 117 } 106 docLoader->setLoadInProgress(true); 107 object->data(req->buffer(), true); 108 object->setAllData(allData); 109 docLoader->setLoadInProgress(false); 110 object->finish(); 111 112 delete req; 113 114 servePendingRequests(); 115 } 116 117 void Loader::didFailWithError(ResourceHandle* handle, const ResourceError& error) 118 { 119 RequestMap::iterator i = m_requestsLoading.find(handle); 120 if (i == m_requestsLoading.end()) 121 return; 122 123 Request* req = i->second; 124 m_requestsLoading.remove(i); 125 126 CachedResource* object = req->cachedResource(); 127 DocLoader* docLoader = req->docLoader(); 128 129 docLoader->setLoadInProgress(true); 130 object->error(); 131 docLoader->setLoadInProgress(false); 132 cache()->remove(object); 118 133 119 134 delete req; -
trunk/WebCore/loader/loader.h
r17595 r17682 65 65 private: 66 66 virtual void receivedResponse(ResourceHandle*, PlatformResponse); 67 virtual void didReceiveResponse(ResourceHandle* handle, const ResourceResponse& response);67 virtual void didReceiveResponse(ResourceHandle*, const ResourceResponse&); 68 68 virtual void didReceiveData(ResourceHandle*, const char*, int); 69 69 virtual void receivedAllData(ResourceHandle*, PlatformData); 70 virtual void didFailWithError(ResourceHandle*, const ResourceError&); 70 71 71 72 void servePendingRequests(); -
trunk/WebCore/loader/mac/SubresourceLoaderMac.mm
r17652 r17682 184 184 185 185 if (RefPtr<ResourceHandle> handle = m_handle.release()) 186 handle->reportError( );186 handle->reportError(error); 187 187 188 188 if (cancelled()) … … 200 200 201 201 if (RefPtr<ResourceHandle> handle = m_handle.release()) 202 handle->reportError( );202 handle->reportError(error); 203 203 204 204 if (cancelled()) -
trunk/WebCore/platform/cf/RetainPtr.h
r17206 r17682 40 40 // so both RetainPtr<NSDictionary> and RetainPtr<CFDictionaryRef> will work. 41 41 42 enum AdoptTag { Adopt }; 43 44 template <typename T> inline void adoptCFReference(T* ptr) 45 { 46 } 47 48 #ifdef __OBJC__ 49 inline void adoptCFReference(id ptr) 50 { 51 CFRetain(ptr); 52 [ptr release]; 53 } 54 #endif 55 42 56 template <typename T> class RetainPtr 43 57 { … … 49 63 RetainPtr() : m_ptr(0) {} 50 64 RetainPtr(PtrType ptr) : m_ptr(ptr) { if (ptr) CFRetain(ptr); } 65 66 RetainPtr(AdoptTag, PtrType ptr) : m_ptr(ptr) { adoptCFReference(ptr); } 67 51 68 RetainPtr(const RetainPtr& o) : m_ptr(o.m_ptr) { if (PtrType ptr = m_ptr) CFRetain(ptr); } 52 69 … … 71 88 template <typename U> RetainPtr& operator=(U*); 72 89 90 void adopt(PtrType); 91 73 92 void swap(RetainPtr&); 74 93 … … 112 131 } 113 132 133 template <typename T> inline void RetainPtr<T>::adopt(PtrType optr) 134 { 135 if (optr) 136 adoptCFReference(optr); 137 PtrType ptr = m_ptr; 138 m_ptr = optr; 139 if (ptr) 140 CFRelease(ptr); 141 } 142 114 143 template <typename T> template <typename U> inline RetainPtr<T>& RetainPtr<T>::operator=(U* optr) 115 144 { -
trunk/WebCore/platform/network/ResourceHandle.cpp
r17435 r17682 48 48 } 49 49 50 bool ResourceHandle::isErrorPage() const51 {52 return d->status != 0;53 }54 55 int ResourceHandle::error() const56 {57 return d->status;58 }59 60 void ResourceHandle::setError(int e)61 {62 d->status = e;63 }64 65 50 void ResourceHandle::kill() 66 51 { -
trunk/WebCore/platform/network/ResourceHandle.h
r17597 r17682 46 46 @class NSURLRequest; 47 47 @class NSURLResponse; 48 @class NSError; 48 49 #else 49 50 class NSURLRequest; 50 51 class NSURLResponse; 52 class NSError; 51 53 #endif 52 54 #endif … … 73 75 ~ResourceHandle(); 74 76 75 int error() const;76 void setError(int);77 String errorText() const;78 bool isErrorPage() const;79 80 77 void kill(); 81 78 … … 84 81 void addData(NSData *); 85 82 void finishJobAndHandle(NSData *); 86 void reportError( );83 void reportError(NSError* error); 87 84 #endif 88 85 -
trunk/WebCore/platform/network/ResourceHandleClient.h
r17597 r17682 75 75 class KURL; 76 76 class ResourceHandle; 77 class ResourceError; 77 78 class ResourceRequest; 78 79 class ResourceResponse; … … 91 92 virtual void didReceiveData(ResourceHandle*, const char*, int) { } 92 93 virtual void didFinishLoading(ResourceHandle*) { } 93 // void didFailWithError(ResourceError*) { }94 virtual void didFailWithError(ResourceHandle*, const ResourceError&) { } 94 95 95 96 // cached response may be modified -
trunk/WebCore/platform/network/cf/ResourceHandleCFNet.cpp
r17652 r17682 30 30 #include "DocLoader.h" 31 31 #include "Frame.h" 32 #include "ResourceError.h" 32 33 #include "FrameLoader.h" 33 34 #include "ResourceHandle.h" … … 120 121 void didFail(CFURLConnectionRef conn, CFStreamError error, const void* clientInfo) 121 122 { 122 ResourceHandle* job= (ResourceHandle*)clientInfo;123 ResourceHandle* handle = (ResourceHandle*)clientInfo; 123 124 124 125 #if defined(LOG_RESOURCELOADER_EVENTS) … … 128 129 #endif 129 130 130 job->setError(1); 131 job->client()->receivedAllData(job, 0); 132 job->client()->didFinishLoading(job); 133 job->kill(); 131 String domain; 132 switch(error.domain) { 133 case kCFStreamErrorDomainPOSIX: 134 domain = "NSPOSIXErrorDomain"; 135 break; 136 case kCFStreamErrorDomainMacOSStatus: 137 domain = "NSOSStatusErrorDomain"; 138 break; 139 } 140 141 // FIXME: we'd really like to include a failing URL and a localized description but you can't 142 // get a CFErrorRef out of an NSURLConnection, only a CFStreamError 143 handle->client()->didFailWithError(handle, ResourceError(domain, error.error, String(), String())); 144 handle->kill(); 134 145 } 135 146 … … 270 281 } 271 282 272 // Copied directly from ResourceHandleWin.cpp 273 setError(1); 274 d->m_client->receivedAllData(this, 0); 275 d->m_client->didFinishLoading(this); 283 // FIXME: need real cancel error 284 d->m_client->didFailWithError(this, ResourceError()); 276 285 } 277 286 -
trunk/WebCore/platform/network/mac/ResourceHandleMac.mm
r17652 r17682 32 32 #import "FrameLoader.h" 33 33 #import "FrameMac.h" 34 #import "ResourceError.h" 34 35 #import "ResourceRequestMac.h" 35 36 #import "ResourceResponse.h" … … 131 132 } 132 133 133 void ResourceHandle::reportError( )134 void ResourceHandle::reportError(NSError* error) 134 135 { 135 setError(1); 136 finishJobAndHandle(nil); 136 if (ResourceHandleClient* c = client()) 137 c->didFailWithError(this, error); 138 kill(); 137 139 } 138 140 -
trunk/WebCore/xml/xmlhttprequest.cpp
r17661 r17682 484 484 } 485 485 486 void XMLHttpRequest::didFinishLoading(ResourceHandle* loader) 486 void XMLHttpRequest::didFailWithError(ResourceHandle* handle, const ResourceError&) 487 { 488 didFinishLoading(handle); 489 } 490 491 void XMLHttpRequest::didFinishLoading(ResourceHandle* handle) 487 492 { 488 493 if (m_aborted) 489 494 return; 490 495 491 ASSERT( loader== m_loader);496 ASSERT(handle == m_loader); 492 497 493 498 if (m_state < Sent) -
trunk/WebCore/xml/xmlhttprequest.h
r17595 r17682 86 86 virtual void didReceiveResponse(ResourceHandle*, const ResourceResponse&); 87 87 virtual void didReceiveData(ResourceHandle*, const char* data, int size); 88 virtual void didFailWithError(ResourceHandle*, const ResourceError&); 88 89 virtual void didFinishLoading(ResourceHandle*); 89 90
Note: See TracChangeset
for help on using the changeset viewer.