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 25 matching lines...) Expand all Loading... |
36 #include "core/dom/Document.h" | 36 #include "core/dom/Document.h" |
37 #include "core/dom/Event.h" | 37 #include "core/dom/Event.h" |
38 #include "core/dom/EventException.h" | 38 #include "core/dom/EventException.h" |
39 #include "core/dom/EventListener.h" | 39 #include "core/dom/EventListener.h" |
40 #include "core/dom/EventNames.h" | 40 #include "core/dom/EventNames.h" |
41 #include "core/dom/ExceptionCode.h" | 41 #include "core/dom/ExceptionCode.h" |
42 #include "core/dom/MessageEvent.h" | 42 #include "core/dom/MessageEvent.h" |
43 #include "core/dom/ScriptExecutionContext.h" | 43 #include "core/dom/ScriptExecutionContext.h" |
44 #include "core/fileapi/Blob.h" | 44 #include "core/fileapi/Blob.h" |
45 #include "core/inspector/ScriptCallStack.h" | 45 #include "core/inspector/ScriptCallStack.h" |
| 46 #include "core/page/ConsoleTypes.h" |
46 #include "core/page/ContentSecurityPolicy.h" | 47 #include "core/page/ContentSecurityPolicy.h" |
47 #include "core/page/DOMWindow.h" | 48 #include "core/page/DOMWindow.h" |
48 #include "core/page/Frame.h" | 49 #include "core/page/Frame.h" |
49 #include "core/page/SecurityOrigin.h" | 50 #include "core/page/SecurityOrigin.h" |
50 #include "core/platform/Logging.h" | 51 #include "core/platform/Logging.h" |
51 #include "core/platform/network/BlobData.h" | 52 #include "core/platform/network/BlobData.h" |
52 #include "modules/websockets/CloseEvent.h" | 53 #include "modules/websockets/CloseEvent.h" |
53 #include "modules/websockets/WebSocketChannel.h" | 54 #include "modules/websockets/WebSocketChannel.h" |
54 #include "wtf/ArrayBuffer.h" | 55 #include "wtf/ArrayBuffer.h" |
55 #include "wtf/ArrayBufferView.h" | 56 #include "wtf/ArrayBufferView.h" |
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
385 scriptExecutionContext()->addConsoleMessage(JSMessageSource, ErrorMe
ssageLevel, "WebSocket close message is too long."); | 386 scriptExecutionContext()->addConsoleMessage(JSMessageSource, ErrorMe
ssageLevel, "WebSocket close message is too long."); |
386 ec = SYNTAX_ERR; | 387 ec = SYNTAX_ERR; |
387 return; | 388 return; |
388 } | 389 } |
389 } | 390 } |
390 | 391 |
391 if (m_state == CLOSING || m_state == CLOSED) | 392 if (m_state == CLOSING || m_state == CLOSED) |
392 return; | 393 return; |
393 if (m_state == CONNECTING) { | 394 if (m_state == CONNECTING) { |
394 m_state = CLOSING; | 395 m_state = CLOSING; |
395 m_channel->fail("WebSocket is closed before the connection is establishe
d."); | 396 m_channel->fail("WebSocket is closed before the connection is establishe
d.", WarningMessageLevel); |
396 return; | 397 return; |
397 } | 398 } |
398 m_state = CLOSING; | 399 m_state = CLOSING; |
399 if (m_channel) | 400 if (m_channel) |
400 m_channel->close(code, reason); | 401 m_channel->close(code, reason); |
401 } | 402 } |
402 | 403 |
403 const KURL& WebSocket::url() const | 404 const KURL& WebSocket::url() const |
404 { | 405 { |
405 return m_url; | 406 return m_url; |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
597 static const size_t minimumPayloadSizeWithEightByteExtendedPayloadLength = 0
x10000; | 598 static const size_t minimumPayloadSizeWithEightByteExtendedPayloadLength = 0
x10000; |
598 size_t overhead = hybiBaseFramingOverhead + hybiMaskingKeyLength; | 599 size_t overhead = hybiBaseFramingOverhead + hybiMaskingKeyLength; |
599 if (payloadSize >= minimumPayloadSizeWithEightByteExtendedPayloadLength) | 600 if (payloadSize >= minimumPayloadSizeWithEightByteExtendedPayloadLength) |
600 overhead += 8; | 601 overhead += 8; |
601 else if (payloadSize >= minimumPayloadSizeWithTwoByteExtendedPayloadLength) | 602 else if (payloadSize >= minimumPayloadSizeWithTwoByteExtendedPayloadLength) |
602 overhead += 2; | 603 overhead += 2; |
603 return overhead; | 604 return overhead; |
604 } | 605 } |
605 | 606 |
606 } // namespace WebCore | 607 } // namespace WebCore |
OLD | NEW |