2011-04-19 Yuta Kitamura <yutak@chromium.org>
authoryutak@chromium.org <yutak@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 20 Apr 2011 04:51:11 +0000 (04:51 +0000)
committeryutak@chromium.org <yutak@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 20 Apr 2011 04:51:11 +0000 (04:51 +0000)
        Reviewed by Alexey Proskuryakov.

        WebSocket: Add assertion for SocketStreamError::failingURL.
        https://bugs.webkit.org/show_bug.cgi?id=58765

        No new tests, because an existing test http/tests/inspector/console-websocket-error.html should cover this.

        * websockets/WebSocketChannel.cpp:
        (WebCore::WebSocketChannel::didFail): If error.failingURL() is provided, it must be the same as
        m_handshake.url(). failingURL may be null if SocketStreamHandle has created a SocketStreamError
        using zero- or one-argument constructor (which is old version but some ports are still using it).
        In that case, m_handshake.url() is passed to addMessage().

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

Source/WebCore/ChangeLog
Source/WebCore/websockets/WebSocketChannel.cpp

index f958d859ca44054039350fc43b4845024f07b679..cdf931961cf73469a2966c631db099d1584a3cf5 100644 (file)
@@ -1,3 +1,18 @@
+2011-04-19  Yuta Kitamura  <yutak@chromium.org>
+
+        Reviewed by Alexey Proskuryakov.
+
+        WebSocket: Add assertion for SocketStreamError::failingURL.
+        https://bugs.webkit.org/show_bug.cgi?id=58765
+
+        No new tests, because an existing test http/tests/inspector/console-websocket-error.html should cover this.
+
+        * websockets/WebSocketChannel.cpp:
+        (WebCore::WebSocketChannel::didFail): If error.failingURL() is provided, it must be the same as
+        m_handshake.url(). failingURL may be null if SocketStreamHandle has created a SocketStreamError
+        using zero- or one-argument constructor (which is old version but some ports are still using it).
+        In that case, m_handshake.url() is passed to addMessage().
+
 2011-04-19  Eric Carlson  <eric.carlson@apple.com>
 
         Reviewed by Dimitri Glazkov.
index c4cb2e2043934426e269fd267cd3c16bfc14a633..590a9a687d597e1e175f18f1d4375bbe0e47e4ee 100644 (file)
@@ -219,7 +219,11 @@ void WebSocketChannel::didFail(SocketStreamHandle* handle, const SocketStreamErr
             message = makeString("WebSocket network error: error code ", String::number(error.errorCode()));
         else
             message = makeString("WebSocket network error: ", error.localizedDescription());
-        m_context->addMessage(OtherMessageSource, NetworkErrorMessageType, ErrorMessageLevel, message, 0, error.failingURL(), 0);
+        String failingURL = error.failingURL();
+        ASSERT(failingURL.isNull() || m_handshake.url().string() == failingURL);
+        if (failingURL.isNull())
+            failingURL = m_handshake.url().string();
+        m_context->addMessage(OtherMessageSource, NetworkErrorMessageType, ErrorMessageLevel, message, 0, failingURL, 0);
     }
     m_shouldDiscardReceivedData = true;
     handle->close();