| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 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 14 matching lines...) Expand all Loading... |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #include "modules/websockets/DOMWebSocket.h" | 31 #include "modules/websockets/DOMWebSocket.h" |
| 32 | 32 |
| 33 #include "bindings/core/v8/ExceptionState.h" | 33 #include "bindings/core/v8/ExceptionState.h" |
| 34 #include "bindings/core/v8/ScriptController.h" | 34 #include "bindings/core/v8/ScriptController.h" |
| 35 #include "bindings/core/v8/SourceLocation.h" |
| 35 #include "bindings/modules/v8/StringOrStringSequence.h" | 36 #include "bindings/modules/v8/StringOrStringSequence.h" |
| 36 #include "core/dom/DOMArrayBuffer.h" | 37 #include "core/dom/DOMArrayBuffer.h" |
| 37 #include "core/dom/DOMArrayBufferView.h" | 38 #include "core/dom/DOMArrayBufferView.h" |
| 38 #include "core/dom/Document.h" | 39 #include "core/dom/Document.h" |
| 39 #include "core/dom/ExceptionCode.h" | 40 #include "core/dom/ExceptionCode.h" |
| 40 #include "core/dom/ExecutionContext.h" | 41 #include "core/dom/ExecutionContext.h" |
| 41 #include "core/dom/SecurityContext.h" | 42 #include "core/dom/SecurityContext.h" |
| 42 #include "core/events/MessageEvent.h" | 43 #include "core/events/MessageEvent.h" |
| 43 #include "core/fileapi/Blob.h" | 44 #include "core/fileapi/Blob.h" |
| 44 #include "core/frame/LocalDOMWindow.h" | 45 #include "core/frame/LocalDOMWindow.h" |
| (...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 503 // reason might contain unpaired surrogates. Reconstruct it from | 504 // reason might contain unpaired surrogates. Reconstruct it from |
| 504 // utf8. | 505 // utf8. |
| 505 cleansedReason = String::fromUTF8(utf8.data(), utf8.length()); | 506 cleansedReason = String::fromUTF8(utf8.data(), utf8.length()); |
| 506 } | 507 } |
| 507 } | 508 } |
| 508 | 509 |
| 509 if (m_state == CLOSING || m_state == CLOSED) | 510 if (m_state == CLOSING || m_state == CLOSED) |
| 510 return; | 511 return; |
| 511 if (m_state == CONNECTING) { | 512 if (m_state == CONNECTING) { |
| 512 m_state = CLOSING; | 513 m_state = CLOSING; |
| 513 m_channel->fail("WebSocket is closed before the connection is establishe
d.", WarningMessageLevel, nullptr); | 514 m_channel->fail("WebSocket is closed before the connection is establishe
d.", WarningMessageLevel, SourceLocation::create(String(), 0, 0, nullptr)); |
| 514 return; | 515 return; |
| 515 } | 516 } |
| 516 m_state = CLOSING; | 517 m_state = CLOSING; |
| 517 if (m_channel) | 518 if (m_channel) |
| 518 m_channel->close(code, cleansedReason); | 519 m_channel->close(code, cleansedReason); |
| 519 } | 520 } |
| 520 | 521 |
| 521 const KURL& DOMWebSocket::url() const | 522 const KURL& DOMWebSocket::url() const |
| 522 { | 523 { |
| 523 return m_url; | 524 return m_url; |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 714 DEFINE_TRACE(DOMWebSocket) | 715 DEFINE_TRACE(DOMWebSocket) |
| 715 { | 716 { |
| 716 visitor->trace(m_channel); | 717 visitor->trace(m_channel); |
| 717 visitor->trace(m_eventQueue); | 718 visitor->trace(m_eventQueue); |
| 718 WebSocketChannelClient::trace(visitor); | 719 WebSocketChannelClient::trace(visitor); |
| 719 EventTargetWithInlineData::trace(visitor); | 720 EventTargetWithInlineData::trace(visitor); |
| 720 ActiveDOMObject::trace(visitor); | 721 ActiveDOMObject::trace(visitor); |
| 721 } | 722 } |
| 722 | 723 |
| 723 } // namespace blink | 724 } // namespace blink |
| OLD | NEW |