| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 #include "config.h" | 31 #include "config.h" |
| 32 #include "modules/websockets/MainThreadWebSocketChannel.h" | 32 #include "modules/websockets/MainThreadWebSocketChannel.h" |
| 33 | 33 |
| 34 #include "bindings/v8/ExceptionStatePlaceholder.h" | 34 #include "bindings/v8/ExceptionStatePlaceholder.h" |
| 35 #include "core/dom/Document.h" | 35 #include "core/dom/Document.h" |
| 36 #include "core/dom/ExecutionContext.h" | 36 #include "core/dom/ExecutionContext.h" |
| 37 #include "core/fileapi/Blob.h" | 37 #include "core/fileapi/Blob.h" |
| 38 #include "core/fileapi/FileReaderLoader.h" | 38 #include "core/fileapi/FileReaderLoader.h" |
| 39 #include "core/frame/LocalFrame.h" | 39 #include "core/frame/LocalFrame.h" |
| 40 #include "core/inspector/InspectorInstrumentation.h" | 40 #include "core/inspector/InspectorInstrumentation.h" |
| 41 #include "core/loader/CookieJar.h" | |
| 42 #include "core/loader/FrameLoader.h" | 41 #include "core/loader/FrameLoader.h" |
| 43 #include "core/loader/FrameLoaderClient.h" | 42 #include "core/loader/FrameLoaderClient.h" |
| 44 #include "core/loader/UniqueIdentifier.h" | 43 #include "core/loader/UniqueIdentifier.h" |
| 45 #include "core/page/Page.h" | 44 #include "core/page/Page.h" |
| 46 #include "modules/websockets/WebSocketChannelClient.h" | 45 #include "modules/websockets/WebSocketChannelClient.h" |
| 47 #include "platform/Logging.h" | 46 #include "platform/Logging.h" |
| 48 #include "platform/network/SocketStreamError.h" | 47 #include "platform/network/SocketStreamError.h" |
| 49 #include "platform/network/SocketStreamHandle.h" | 48 #include "platform/network/SocketStreamHandle.h" |
| 50 #include "wtf/ArrayBuffer.h" | 49 #include "wtf/ArrayBuffer.h" |
| 51 #include "wtf/FastMalloc.h" | 50 #include "wtf/FastMalloc.h" |
| (...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 447 return false; | 446 return false; |
| 448 if (m_handshake->mode() == WebSocketHandshake::Connected) { | 447 if (m_handshake->mode() == WebSocketHandshake::Connected) { |
| 449 if (m_identifier) | 448 if (m_identifier) |
| 450 InspectorInstrumentation::didReceiveWebSocketHandshakeResponse(m
_document, m_identifier, 0, &m_handshake->serverHandshakeResponse()); | 449 InspectorInstrumentation::didReceiveWebSocketHandshakeResponse(m
_document, m_identifier, 0, &m_handshake->serverHandshakeResponse()); |
| 451 | 450 |
| 452 if (m_deflateFramer.enabled() && m_document) { | 451 if (m_deflateFramer.enabled() && m_document) { |
| 453 const String message = "WebSocket extension \"x-webkit-deflate-f
rame\" is deprecated"; | 452 const String message = "WebSocket extension \"x-webkit-deflate-f
rame\" is deprecated"; |
| 454 m_document->addConsoleMessage(JSMessageSource, WarningMessageLev
el, message, m_sourceURLAtConstruction, m_lineNumberAtConstruction); | 453 m_document->addConsoleMessage(JSMessageSource, WarningMessageLev
el, message, m_sourceURLAtConstruction, m_lineNumberAtConstruction); |
| 455 } | 454 } |
| 456 | 455 |
| 457 if (!m_handshake->serverSetCookie().isEmpty()) { | |
| 458 if (cookiesEnabled(m_document)) { | |
| 459 // Exception (for sandboxed documents) ignored. | |
| 460 m_document->setCookie(m_handshake->serverSetCookie(), IGNORE
_EXCEPTION); | |
| 461 } | |
| 462 } | |
| 463 // FIXME: handle set-cookie2. | |
| 464 WTF_LOG(Network, "MainThreadWebSocketChannel %p Connected", this); | 456 WTF_LOG(Network, "MainThreadWebSocketChannel %p Connected", this); |
| 465 skipBuffer(headerLength); | 457 skipBuffer(headerLength); |
| 466 m_client->didConnect(); | 458 m_client->didConnect(); |
| 467 WTF_LOG(Network, "MainThreadWebSocketChannel %p %lu bytes remaining
in m_buffer", this, static_cast<unsigned long>(m_buffer.size())); | 459 WTF_LOG(Network, "MainThreadWebSocketChannel %p %lu bytes remaining
in m_buffer", this, static_cast<unsigned long>(m_buffer.size())); |
| 468 return !m_buffer.isEmpty(); | 460 return !m_buffer.isEmpty(); |
| 469 } | 461 } |
| 470 ASSERT(m_handshake->mode() == WebSocketHandshake::Failed); | 462 ASSERT(m_handshake->mode() == WebSocketHandshake::Failed); |
| 471 WTF_LOG(Network, "MainThreadWebSocketChannel %p Connection failed", this
); | 463 WTF_LOG(Network, "MainThreadWebSocketChannel %p Connection failed", this
); |
| 472 skipBuffer(headerLength); | 464 skipBuffer(headerLength); |
| 473 m_shouldDiscardReceivedData = true; | 465 m_shouldDiscardReceivedData = true; |
| (...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 829 } | 821 } |
| 830 | 822 |
| 831 Vector<char> frameData; | 823 Vector<char> frameData; |
| 832 frame.makeFrameData(frameData); | 824 frame.makeFrameData(frameData); |
| 833 | 825 |
| 834 m_perMessageDeflate.resetDeflateBuffer(); | 826 m_perMessageDeflate.resetDeflateBuffer(); |
| 835 return m_handle->send(frameData.data(), frameData.size()); | 827 return m_handle->send(frameData.data(), frameData.size()); |
| 836 } | 828 } |
| 837 | 829 |
| 838 } // namespace WebCore | 830 } // namespace WebCore |
| OLD | NEW |