Changeset 74390 in webkit
- Timestamp:
- Dec 20, 2010 9:44:07 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 3 added
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r74389 r74390 1 2010-12-20 Yuta Kitamura <yutak@chromium.org> 2 3 Reviewed by Alexey Proskuryakov. 4 5 WebSocket errors should be logged to console 6 https://bugs.webkit.org/show_bug.cgi?id=40945 7 8 * http/tests/inspector/console-websocket-error.html: Added. 9 * platform/mac/http/tests/inspector/console-websocket-error-expected.txt: Added. 10 * platform/win/Skipped: Added console-websocket-error.html 11 because HTTPS server is not supported on Windows yet. 12 1 13 2010-12-20 Sheriff Bot <webkit.review.bot@gmail.com> 2 14 -
trunk/LayoutTests/platform/win/Skipped
r74270 r74390 43 43 http/tests/security/cross-frame-access-protocol-explicit-domain.html 44 44 http/tests/security/cross-frame-access-protocol.html 45 http/tests/inspector/console-websocket-error.html 45 46 46 47 # Fails <rdar://problem/5674289> -
trunk/WebCore/ChangeLog
r74386 r74390 1 2010-12-20 Yuta Kitamura <yutak@chromium.org> 2 3 Reviewed by Alexey Proskuryakov. 4 5 WebSocket errors should be logged to console 6 https://bugs.webkit.org/show_bug.cgi?id=40945 7 8 Test: http/tests/inspector/console-websocket-error.html 9 10 * platform/network/SocketStreamErrorBase.cpp: 11 (WebCore::SocketStreamErrorBase::compare): 12 * platform/network/SocketStreamErrorBase.h: 13 (WebCore::SocketStreamErrorBase::failingURL): 14 (WebCore::SocketStreamErrorBase::localizedDescription): 15 (WebCore::SocketStreamErrorBase::SocketStreamErrorBase): 16 * platform/network/cf/SocketStreamError.h: 17 (WebCore::SocketStreamError::SocketStreamError): 18 * platform/network/cf/SocketStreamHandle.h: 19 * platform/network/cf/SocketStreamHandleCFNet.cpp: 20 (WebCore::SocketStreamHandle::readStreamCallback): 21 (WebCore::SocketStreamHandle::writeStreamCallback): 22 (WebCore::SocketStreamHandle::reportErrorToClient): 23 * websockets/WebSocketChannel.cpp: 24 (WebCore::WebSocketChannel::didFail): 25 1 26 2010-12-17 MORITA Hajime <morrita@google.com> 2 27 -
trunk/WebCore/platform/network/SocketStreamErrorBase.cpp
r47788 r74390 43 43 bool SocketStreamErrorBase::compare(const SocketStreamError& a, const SocketStreamError& b) 44 44 { 45 return a.errorCode() == b.errorCode(); 45 if (a.isNull() && b.isNull()) 46 return true; 47 48 if (a.isNull() || b.isNull()) 49 return false; 50 51 if (a.errorCode() != b.errorCode()) 52 return false; 53 54 if (a.failingURL() != b.failingURL()) 55 return false; 56 57 if (a.localizedDescription() != b.localizedDescription()) 58 return false; 59 60 return true; 46 61 } 47 62 -
trunk/WebCore/platform/network/SocketStreamErrorBase.h
r47788 r74390 33 33 #define SocketStreamErrorBase_h 34 34 35 #include "PlatformString.h" 36 35 37 namespace WebCore { 36 38 … … 45 47 46 48 int errorCode() const { return m_errorCode; } 49 const String& failingURL() const { return m_failingURL; } 50 const String& localizedDescription() const { return m_localizedDescription; } 47 51 48 52 static bool compare(const SocketStreamError&, const SocketStreamError&); … … 61 65 } 62 66 67 SocketStreamErrorBase(int errorCode, const String& failingURL, const String& localizedDescription) 68 : m_errorCode(errorCode) 69 , m_failingURL(failingURL) 70 , m_localizedDescription(localizedDescription) 71 , m_isNull(false) 72 { 73 } 74 63 75 int m_errorCode; 76 String m_failingURL; 77 String m_localizedDescription; 64 78 bool m_isNull; 65 79 }; -
trunk/WebCore/platform/network/cf/SocketStreamError.h
r70339 r74390 43 43 { 44 44 } 45 45 SocketStreamError(int errorCode, const String& failingURL, const String& localizedDescription) 46 : SocketStreamErrorBase(errorCode, failingURL, localizedDescription) 47 { 48 } 46 49 }; 47 50 -
trunk/WebCore/platform/network/cf/SocketStreamHandle.h
r70339 r74390 85 85 void writeStreamCallback(CFStreamEventType); 86 86 87 #ifndef BUILDING_ON_TIGER 88 void reportErrorToClient(CFErrorRef); 89 #endif 90 87 91 // No authentication for streams per se, but proxy may ask for credentials. 88 92 virtual void receivedCredential(const AuthenticationChallenge&, const Credential&); -
trunk/WebCore/platform/network/cf/SocketStreamHandleCFNet.cpp
r72498 r74390 40 40 #include "SocketStreamHandleClient.h" 41 41 #include <wtf/MainThread.h> 42 #include <wtf/text/StringConcatenate.h> 42 43 43 44 #if defined(BUILDING_ON_TIGER) || defined(BUILDING_ON_LEOPARD) … … 531 532 break; 532 533 case kCFStreamEventErrorOccurred: { 534 #ifndef BUILDING_ON_TIGER 535 RetainPtr<CFErrorRef> error(AdoptCF, CFReadStreamCopyError(m_readStream.get())); 536 reportErrorToClient(error.get()); 537 #else 533 538 CFStreamError error = CFReadStreamGetError(m_readStream.get()); 534 539 m_client->didFail(this, SocketStreamError(error.error)); // FIXME: Provide a sensible error. 540 #endif 535 541 break; 536 542 } … … 575 581 } 576 582 case kCFStreamEventErrorOccurred: { 583 #ifndef BUILDING_ON_TIGER 584 RetainPtr<CFErrorRef> error(AdoptCF, CFWriteStreamCopyError(m_writeStream.get())); 585 reportErrorToClient(error.get()); 586 #else 577 587 CFStreamError error = CFWriteStreamGetError(m_writeStream.get()); 578 588 m_client->didFail(this, SocketStreamError(error.error)); // FIXME: Provide a sensible error. 589 #endif 579 590 break; 580 591 } … … 584 595 } 585 596 } 597 598 #ifndef BUILDING_ON_TIGER 599 void SocketStreamHandle::reportErrorToClient(CFErrorRef error) 600 { 601 CFIndex errorCode = CFErrorGetCode(error); 602 String description; 603 604 #if PLATFORM(MAC) 605 if (CFEqual(CFErrorGetDomain(error), kCFErrorDomainOSStatus)) { 606 const char* descriptionOSStatus = GetMacOSStatusCommentString(static_cast<OSStatus>(errorCode)); 607 if (descriptionOSStatus && descriptionOSStatus[0] != '\0') 608 description = makeString("OSStatus Error ", String::number(errorCode), ": ", descriptionOSStatus); 609 } 610 #endif 611 612 if (description.isNull()) { 613 RetainPtr<CFStringRef> descriptionCF(AdoptCF, CFErrorCopyDescription(error)); 614 description = String(descriptionCF.get()); 615 } 616 617 m_client->didFail(this, SocketStreamError(static_cast<int>(errorCode), m_url.string(), description)); 618 } 619 #endif // BUILDING_ON_TIGER 586 620 587 621 SocketStreamHandle::~SocketStreamHandle() -
trunk/WebCore/websockets/WebSocketChannel.cpp
r73939 r74390 207 207 } 208 208 209 void WebSocketChannel::didFail(SocketStreamHandle* handle, const SocketStreamError& )209 void WebSocketChannel::didFail(SocketStreamHandle* handle, const SocketStreamError& error) 210 210 { 211 211 LOG(Network, "WebSocketChannel %p didFail", this); 212 212 ASSERT(handle == m_handle || !m_handle); 213 if (m_context) { 214 String message; 215 if (error.isNull()) 216 message = "WebSocket network error"; 217 else if (error.localizedDescription().isNull()) 218 message = makeString("WebSocket network error: error code ", String::number(error.errorCode())); 219 else 220 message = makeString("WebSocket network error: ", error.localizedDescription()); 221 m_context->addMessage(OtherMessageSource, NetworkErrorMessageType, ErrorMessageLevel, message, 0, error.failingURL()); 222 } 213 223 m_shouldDiscardReceivedData = true; 214 224 handle->close();
Note: See TracChangeset
for help on using the changeset viewer.