Changeset 201856 in webkit
- Timestamp:
- Jun 8, 2016, 11:55:26 PM (10 years ago)
- Location:
- trunk/Source
- Files:
-
- 16 edited
-
WebCore/ChangeLog (modified) (1 diff)
-
WebCore/loader/DocumentLoader.cpp (modified) (1 diff)
-
WebCore/loader/DocumentThreadableLoader.cpp (modified) (1 diff)
-
WebCore/loader/EmptyClients.h (modified) (1 diff)
-
WebCore/loader/FrameLoader.cpp (modified) (2 diffs)
-
WebCore/loader/WorkerThreadableLoader.cpp (modified) (1 diff)
-
WebCore/platform/network/ResourceErrorBase.cpp (modified) (4 diffs)
-
WebCore/platform/network/ResourceErrorBase.h (modified) (5 diffs)
-
WebCore/platform/network/cf/ResourceError.h (modified) (1 diff)
-
WebCore/platform/network/cf/ResourceErrorCF.cpp (modified) (3 diffs)
-
WebCore/platform/network/curl/ResourceError.h (modified) (1 diff)
-
WebCore/platform/network/mac/ResourceErrorMac.mm (modified) (3 diffs)
-
WebCore/platform/network/soup/ResourceError.h (modified) (1 diff)
-
WebCore/platform/network/soup/ResourceErrorSoup.cpp (modified) (1 diff)
-
WebKit2/ChangeLog (modified) (1 diff)
-
WebKit2/Shared/soup/WebCoreArgumentCodersSoup.cpp (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r201854 r201856 1 2016-06-08 Youenn Fablet <youenn.fablet@crf.canon.fr> 2 3 Introduce ResourceErrorBase::type 4 https://bugs.webkit.org/show_bug.cgi?id=158299 5 6 Reviewed by Alex Christensen. 7 8 Introducing an enum type for ResourceErrorBase. 9 In most cases, the type is set at construction time. 10 By default, constructor with no parameters will set type to Null. 11 Constructor with parameters will set type to General. 12 13 Removed boolean state error fields. 14 15 Introduced a type setter. It should only be used to make the type 16 more precise (when type is Null or General). 17 18 Updating related calling code. 19 20 No change of behavior. 21 22 * loader/DocumentLoader.cpp: 23 (WebCore::DocumentLoader::stopLoadingForPolicyChange): 24 * loader/DocumentThreadableLoader.cpp: 25 (WebCore::DocumentThreadableLoader::cancel): 26 * loader/EmptyClients.h: 27 * loader/FrameLoader.cpp: 28 (WebCore::FrameLoader::cancelledError): 29 (WebCore::FrameLoader::blockedError): 30 * loader/WorkerThreadableLoader.cpp: 31 (WebCore::WorkerThreadableLoader::MainThreadBridge::cancel): 32 * platform/network/ResourceErrorBase.cpp: 33 (WebCore::ResourceErrorBase::isolatedCopy): 34 (WebCore::ResourceErrorBase::setType): 35 (WebCore::ResourceErrorBase::compare): 36 * platform/network/ResourceErrorBase.h: 37 (WebCore::ResourceErrorBase::isNull): 38 (WebCore::ResourceErrorBase::isCancellation): 39 (WebCore::ResourceErrorBase::isTimeout): 40 (WebCore::ResourceErrorBase::type): 41 (WebCore::ResourceErrorBase::ResourceErrorBase): 42 (WebCore::ResourceErrorBase::domain): 43 * platform/network/cf/ResourceError.h: 44 (WebCore::ResourceError::ResourceError): 45 * platform/network/cf/ResourceErrorCF.cpp: 46 (WebCore::ResourceError::ResourceError): 47 (WebCore::ResourceError::cfError): 48 * platform/network/curl/ResourceError.h: 49 (WebCore::ResourceError::ResourceError): 50 * platform/network/mac/ResourceErrorMac.mm: 51 (WebCore::m_platformError): 52 (WebCore::ResourceError::nsError): 53 (WebCore::ResourceError::ResourceError): 54 (WebCore::ResourceError::platformLazyInit): 55 * platform/network/soup/ResourceError.h: 56 (WebCore::ResourceError::ResourceError): 57 * platform/network/soup/ResourceErrorSoup.cpp: 58 (WebCore::ResourceError::timeoutError): 59 1 60 2016-06-08 Frederic Wang <fwang@igalia.com> 2 61 -
trunk/Source/WebCore/loader/DocumentLoader.cpp
r201761 r201856 843 843 { 844 844 ResourceError error = interruptedForPolicyChangeError(); 845 error.set IsCancellation(true);845 error.setType(ResourceError::Type::Cancellation); 846 846 cancelMainResourceLoad(error); 847 847 } -
trunk/Source/WebCore/loader/DocumentThreadableLoader.cpp
r201414 r201856 161 161 if (m_client && m_resource) { 162 162 // FIXME: This error is sent to the client in didFail(), so it should not be an internal one. Use FrameLoaderClient::cancelledError() instead. 163 ResourceError error(errorDomainWebKitInternal, 0, m_resource->url(), "Load cancelled"); 164 error.setIsCancellation(true); 163 ResourceError error(errorDomainWebKitInternal, 0, m_resource->url(), "Load cancelled", ResourceError::Type::Cancellation); 165 164 didFail(m_resource->identifier(), error); 166 165 } -
trunk/Source/WebCore/loader/EmptyClients.h
r201056 r201856 331 331 void finishedLoading(DocumentLoader*) override { } 332 332 333 ResourceError cancelledError(const ResourceRequest&) override { ResourceError error("", 0, URL(), ""); error.setIsCancellation(true); return error; }334 ResourceError blockedError(const ResourceRequest&) override { return ResourceError("", 0, URL(), ""); }335 ResourceError blockedByContentBlockerError(const ResourceRequest&) override { return ResourceError("", 0, URL(), ""); }336 ResourceError cannotShowURLError(const ResourceRequest&) override { return ResourceError("", 0, URL(), ""); }337 ResourceError interruptedForPolicyChangeError(const ResourceRequest&) override { return ResourceError("", 0, URL(), ""); }338 339 ResourceError cannotShowMIMETypeError(const ResourceResponse&) override { return ResourceError("", 0, URL(), ""); }340 ResourceError fileDoesNotExistError(const ResourceResponse&) override { return ResourceError("", 0, URL(), ""); }341 ResourceError pluginWillHandleLoadError(const ResourceResponse&) override { return ResourceError("", 0, URL(), ""); }333 ResourceError cancelledError(const ResourceRequest&) override { return ResourceError(ResourceError::Type::Cancellation); } 334 ResourceError blockedError(const ResourceRequest&) override { return { }; } 335 ResourceError blockedByContentBlockerError(const ResourceRequest&) override { return { }; } 336 ResourceError cannotShowURLError(const ResourceRequest&) override { return { }; } 337 ResourceError interruptedForPolicyChangeError(const ResourceRequest&) override { return { }; } 338 339 ResourceError cannotShowMIMETypeError(const ResourceResponse&) override { return { }; } 340 ResourceError fileDoesNotExistError(const ResourceResponse&) override { return { }; } 341 ResourceError pluginWillHandleLoadError(const ResourceResponse&) override { return { }; } 342 342 343 343 bool shouldFallBack(const ResourceError&) override { return false; } -
trunk/Source/WebCore/loader/FrameLoader.cpp
r201753 r201856 3424 3424 { 3425 3425 ResourceError error = m_client.cancelledError(request); 3426 error.set IsCancellation(true);3426 error.setType(ResourceError::Type::Cancellation); 3427 3427 return error; 3428 3428 } … … 3436 3436 { 3437 3437 ResourceError error = m_client.blockedError(request); 3438 error.set IsCancellation(true);3438 error.setType(ResourceError::Type::Cancellation); 3439 3439 return error; 3440 3440 } -
trunk/Source/WebCore/loader/WorkerThreadableLoader.cpp
r201637 r201856 139 139 // If the client hasn't reached a termination state, then transition it by sending a cancellation error. 140 140 // Note: no more client callbacks will be done after this method -- the clearClientWrapper() call ensures that. 141 ResourceError error(String(), 0, URL(), String()); 142 error.setIsCancellation(true); 141 ResourceError error(ResourceError::Type::Cancellation); 143 142 clientWrapper->didFail(error); 144 143 } -
trunk/Source/WebCore/platform/network/ResourceErrorBase.cpp
r201623 r201856 46 46 errorCopy.m_failingURL = m_failingURL.isolatedCopy(); 47 47 errorCopy.m_localizedDescription = m_localizedDescription.isolatedCopy(); 48 errorCopy.m_isNull = m_isNull; 49 errorCopy.m_isCancellation = m_isCancellation; 50 errorCopy.m_isTimeout = m_isTimeout; 48 errorCopy.m_type = m_type; 51 49 52 50 errorCopy.doPlatformIsolatedCopy(asResourceError()); … … 60 58 } 61 59 60 void ResourceErrorBase::setType(Type type) 61 { 62 ASSERT(m_type == Type::General || m_type == Type::Null); 63 m_type = type; 64 } 65 62 66 bool ResourceErrorBase::compare(const ResourceError& a, const ResourceError& b) 63 67 { … … 65 69 return true; 66 70 67 if (a. isNull() || b.isNull())71 if (a.type() != b.type()) 68 72 return false; 69 73 … … 80 84 return false; 81 85 82 if (a.isCancellation() != b.isCancellation())83 return false;84 85 if (a.isTimeout() != b.isTimeout())86 return false;87 88 86 return ResourceError::platformCompare(a, b); 89 87 } -
trunk/Source/WebCore/platform/network/ResourceErrorBase.h
r201623 r201856 1 1 /* 2 2 * Copyright (C) 2006 Apple Inc. All rights reserved. 3 * Copyright (C) 2016 Canon Inc. All rights reserved. 3 4 * 4 5 * Redistribution and use in source and binary forms, with or without … … 21 22 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 25 */ 25 26 … … 39 40 ResourceError isolatedCopy() const; 40 41 41 bool isNull() const { return m_isNull; }42 43 42 const String& domain() const { lazyInit(); return m_domain; } 44 43 int errorCode() const { lazyInit(); return m_errorCode; } … … 46 45 const String& localizedDescription() const { lazyInit(); return m_localizedDescription; } 47 46 48 void setIsCancellation(bool isCancellation) { m_isCancellation = isCancellation; } 49 bool isCancellation() const { return m_isCancellation; } 47 enum class Type { 48 Null, 49 General, 50 Cancellation, 51 Timeout 52 }; 50 53 51 void setIsTimeout(bool isTimeout) { m_isTimeout = isTimeout; } 52 bool isTimeout() const { return m_isTimeout; } 54 bool isNull() const { return m_type == Type::Null; } 55 bool isCancellation() const { return m_type == Type::Cancellation; } 56 bool isTimeout() const { return m_type == Type::Timeout; } 53 57 54 58 static bool compare(const ResourceError&, const ResourceError&); 55 59 60 void setType(Type); 61 Type type() const { return m_type; } 62 56 63 protected: 57 ResourceErrorBase() 58 : m_errorCode(0) 59 , m_isNull(true) 60 , m_isCancellation(false) 61 , m_isTimeout(false) 62 { 63 } 64 ResourceErrorBase(Type type) : m_type(type) { } 64 65 65 ResourceErrorBase(const String& domain, int errorCode, const URL& failingURL, const String& localizedDescription )66 ResourceErrorBase(const String& domain, int errorCode, const URL& failingURL, const String& localizedDescription, Type type) 66 67 : m_domain(domain) 67 68 , m_failingURL(failingURL) 68 69 , m_localizedDescription(localizedDescription) 69 70 , m_errorCode(errorCode) 70 , m_isNull(false) 71 , m_isCancellation(false) 72 , m_isTimeout(false) 71 , m_type(type) 73 72 { 74 73 } … … 85 84 URL m_failingURL; 86 85 String m_localizedDescription; 87 int m_errorCode; 88 bool m_isNull : 1; 89 bool m_isCancellation : 1; 90 bool m_isTimeout : 1; 86 int m_errorCode { 0 }; 87 Type m_type { Type::General }; 91 88 92 89 private: -
trunk/Source/WebCore/platform/network/cf/ResourceError.h
r201623 r201856 45 45 class ResourceError : public ResourceErrorBase { 46 46 public: 47 ResourceError() 48 : m_dataIsUpToDate(true) 47 ResourceError(Type type = Type::Null) 48 : ResourceErrorBase(type) 49 , m_dataIsUpToDate(true) 49 50 { 50 51 } 51 52 52 ResourceError(const String& domain, int errorCode, const URL& failingURL, const String& localizedDescription )53 : ResourceErrorBase(domain, errorCode, failingURL, localizedDescription )53 ResourceError(const String& domain, int errorCode, const URL& failingURL, const String& localizedDescription, Type type = Type::General) 54 : ResourceErrorBase(domain, errorCode, failingURL, localizedDescription, type) 54 55 , m_dataIsUpToDate(true) 55 56 { -
trunk/Source/WebCore/platform/network/cf/ResourceErrorCF.cpp
r201623 r201856 41 41 42 42 ResourceError::ResourceError(CFErrorRef cfError) 43 : m_dataIsUpToDate(false) 43 : ResourceErrorBase(Type::Null) 44 , m_dataIsUpToDate(false) 44 45 , m_platformError(cfError) 45 46 { 46 m_isNull = !cfError; 47 if (!m_isNull) 48 m_isTimeout = CFErrorGetCode(m_platformError.get()) == kCFURLErrorTimedOut; 47 if (cfError) 48 setType((CFErrorGetCode(m_platformError.get()) == kCFURLErrorTimedOut) ? Type::Timeout : Type::General); 49 49 } 50 50 51 51 #if PLATFORM(WIN) 52 52 ResourceError::ResourceError(const String& domain, int errorCode, const URL& failingURL, const String& localizedDescription, CFDataRef certificate) 53 : ResourceErrorBase(domain, errorCode, failingURL, localizedDescription )53 : ResourceErrorBase(domain, errorCode, failingURL, localizedDescription, Type::General) 54 54 , m_dataIsUpToDate(true) 55 55 , m_certificate(certificate) … … 137 137 CFErrorRef ResourceError::cfError() const 138 138 { 139 if ( m_isNull) {139 if (isNull()) { 140 140 ASSERT(!m_platformError); 141 141 return 0; … … 173 173 // FIXME: Once <rdar://problem/5050841> is fixed we can remove this constructor. 174 174 ResourceError::ResourceError(CFStreamError error) 175 : m_dataIsUpToDate(true)176 { 177 m_isNull = false; 175 : ResourceErrorBase(Type::General) 176 , m_dataIsUpToDate(true) 177 { 178 178 m_errorCode = error.error; 179 179 -
trunk/Source/WebCore/platform/network/curl/ResourceError.h
r201623 r201856 41 41 { 42 42 public: 43 ResourceError() : m_sslErrors(0) 43 ResourceError(Type type = Type::Null) 44 : ResourceErrorBase(type) 45 , m_sslErrors(0) 44 46 { 45 47 } 46 48 47 ResourceError(const String& domain, int errorCode, const URL& failingURL, const String& localizedDescription) 48 : ResourceErrorBase(domain, errorCode, failingURL, localizedDescription), m_sslErrors(0) 49 ResourceError(const String& domain, int errorCode, const URL& failingURL, const String& localizedDescription, Type type = Type::Null) 50 : ResourceErrorBase(domain, errorCode, failingURL, localizedDescription, type) 51 , m_sslErrors(0) 49 52 { 50 53 } -
trunk/Source/WebCore/platform/network/mac/ResourceErrorMac.mm
r201623 r201856 194 194 195 195 ResourceError::ResourceError(NSError *error) 196 :m_dataIsUpToDate(false)196 , m_dataIsUpToDate(false) 197 197 , m_platformError(reinterpret_cast<CFErrorRef>(error)) 198 198 { 199 m_isNull = !error; 200 if (!m_isNull) 201 m_isTimeout = [error code] == NSURLErrorTimedOut; 199 if (error) 200 setType(([error code] == NSURLErrorTimedOut) ? Type::Timeout : Type::General); 202 201 } 203 202 204 203 NSError *ResourceError::nsError() const 205 204 { 206 if ( m_isNull) {205 if (isNull()) { 207 206 ASSERT(!m_platformError); 208 207 return nil; … … 239 238 240 239 ResourceError::ResourceError(NSError *nsError) 241 : m_dataIsUpToDate(false) 240 : ResourceErrorBase(Type::Null) 241 , m_dataIsUpToDate(false) 242 242 , m_platformError(nsError) 243 243 { 244 m_isNull = !nsError; 245 if (!m_isNull) 246 m_isTimeout = [m_platformError.get() code] == NSURLErrorTimedOut; 244 if (nsError) 245 setType(([m_platformError.get() code] == NSURLErrorTimedOut) ? Type::Timeout : Type::General); 247 246 } 248 247 249 248 ResourceError::ResourceError(CFErrorRef cfError) 250 : m_dataIsUpToDate(false) 251 , m_platformError((NSError *)cfError) 252 { 253 m_isNull = !cfError; 254 if (!m_isNull) 255 m_isTimeout = [m_platformError.get() code] == NSURLErrorTimedOut; 249 : ResourceError((NSError *)cfError) 250 { 256 251 } 257 252 … … 288 283 NSError *ResourceError::nsError() const 289 284 { 290 if ( m_isNull) {285 if (isNull()) { 291 286 ASSERT(!m_platformError); 292 287 return nil; -
trunk/Source/WebCore/platform/network/soup/ResourceError.h
r201623 r201856 42 42 { 43 43 public: 44 ResourceError( const String& domain, int errorCode, const URL& failingURL, const String& localizedDescription)45 : ResourceErrorBase( domain, errorCode, failingURL, localizedDescription)44 ResourceError(Type type = Type::Null) 45 : ResourceErrorBase(type) 46 46 , m_tlsErrors(0) 47 47 { 48 48 } 49 49 50 ResourceError() 51 : m_tlsErrors(0) 50 ResourceError(const String& domain, int errorCode, const URL& failingURL, const String& localizedDescription, Type type = Type::General) 51 : ResourceErrorBase(domain, errorCode, failingURL, localizedDescription, type) 52 , m_tlsErrors(0) 52 53 { 53 54 } -
trunk/Source/WebCore/platform/network/soup/ResourceErrorSoup.cpp
r201623 r201856 93 93 static const int timeoutError = -1001; 94 94 static const char* const errorDomain = "WebKitNetworkError"; 95 ResourceError error = ResourceError(errorDomain, timeoutError, failingURL, "Request timed out"); 96 error.setIsTimeout(true); 97 return error; 95 return ResourceError(errorDomain, timeoutError, failingURL, "Request timed out", ResourceError::Type::Timeout); 98 96 } 99 97 -
trunk/Source/WebKit2/ChangeLog
r201838 r201856 1 2016-06-08 Youenn Fablet <youenn.fablet@crf.canon.fr> 2 3 Introduce ResourceErrorBase::type 4 https://bugs.webkit.org/show_bug.cgi?id=158299 5 6 Reviewed by Alex Christensen. 7 8 * Shared/soup/WebCoreArgumentCodersSoup.cpp: 9 (IPC::ArgumentCoder<ResourceError>::encodePlatformData): 10 (IPC::ArgumentCoder<ResourceError>::decodePlatformData): 11 1 12 2016-06-08 Beth Dakin <bdakin@apple.com> 2 13 -
trunk/Source/WebKit2/Shared/soup/WebCoreArgumentCodersSoup.cpp
r194496 r201856 187 187 void ArgumentCoder<ResourceError>::encodePlatformData(ArgumentEncoder& encoder, const ResourceError& resourceError) 188 188 { 189 bool errorIsNull = resourceError.isNull(); 190 encoder << errorIsNull; 191 if (errorIsNull) 189 encoder.encodeEnum(resourceError.type()); 190 if (resourceError.isNull()) 192 191 return; 193 192 … … 196 195 encoder << resourceError.failingURL().string(); 197 196 encoder << resourceError.localizedDescription(); 198 encoder << resourceError.isCancellation();199 encoder << resourceError.isTimeout();200 197 201 198 encoder << CertificateInfo(resourceError); … … 204 201 bool ArgumentCoder<ResourceError>::decodePlatformData(ArgumentDecoder& decoder, ResourceError& resourceError) 205 202 { 206 bool errorIsNull;207 if (!decoder.decode (errorIsNull))208 return false; 209 if (error IsNull) {210 resourceError = ResourceError();203 ResourceErrorBase::Type errorType; 204 if (!decoder.decodeEnum(errorType)) 205 return false; 206 if (errorType == ResourceErrorBase::Type::Null) { 207 resourceError = { }; 211 208 return true; 212 209 } … … 228 225 return false; 229 226 230 bool isCancellation;231 if (!decoder.decode(isCancellation))232 return false;233 234 bool isTimeout;235 if (!decoder.decode(isTimeout))236 return false;237 238 227 resourceError = ResourceError(domain, errorCode, URL(URL(), failingURL), localizedDescription); 239 resourceError.setIsCancellation(isCancellation); 240 resourceError.setIsTimeout(isTimeout); 228 resourceError.setType(errorType); 241 229 242 230 CertificateInfo certificateInfo;
Note:
See TracChangeset
for help on using the changeset viewer.