| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 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 18 matching lines...) Expand all Loading... |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #include "config.h" | 31 #include "config.h" |
| 32 #include "modules/websockets/NewWebSocketChannelImpl.h" | 32 #include "modules/websockets/NewWebSocketChannelImpl.h" |
| 33 | 33 |
| 34 #include "core/dom/Document.h" | 34 #include "core/dom/Document.h" |
| 35 #include "core/dom/ExecutionContext.h" | 35 #include "core/dom/ExecutionContext.h" |
| 36 #include "core/fileapi/FileReaderLoader.h" | 36 #include "core/fileapi/FileReaderLoader.h" |
| 37 #include "core/fileapi/FileReaderLoaderClient.h" | 37 #include "core/fileapi/FileReaderLoaderClient.h" |
| 38 #include "core/frame/LocalFrame.h" | 38 #include "core/frame/LocalFrame.h" |
| 39 #include "core/inspector/ConsoleMessage.h" |
| 39 #include "core/inspector/InspectorInstrumentation.h" | 40 #include "core/inspector/InspectorInstrumentation.h" |
| 40 #include "core/inspector/InspectorTraceEvents.h" | 41 #include "core/inspector/InspectorTraceEvents.h" |
| 41 #include "core/loader/FrameLoader.h" | 42 #include "core/loader/FrameLoader.h" |
| 42 #include "core/loader/FrameLoaderClient.h" | 43 #include "core/loader/FrameLoaderClient.h" |
| 43 #include "core/loader/MixedContentChecker.h" | 44 #include "core/loader/MixedContentChecker.h" |
| 44 #include "core/loader/UniqueIdentifier.h" | 45 #include "core/loader/UniqueIdentifier.h" |
| 45 #include "modules/websockets/WebSocketChannelClient.h" | 46 #include "modules/websockets/WebSocketChannelClient.h" |
| 46 #include "modules/websockets/WebSocketFrame.h" | 47 #include "modules/websockets/WebSocketFrame.h" |
| 47 #include "platform/Logging.h" | 48 #include "platform/Logging.h" |
| 48 #include "platform/network/WebSocketHandshakeRequest.h" | 49 #include "platform/network/WebSocketHandshakeRequest.h" |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 WTF_LOG(Network, "NewWebSocketChannelImpl %p connect()", this); | 134 WTF_LOG(Network, "NewWebSocketChannelImpl %p connect()", this); |
| 134 if (!m_handle) | 135 if (!m_handle) |
| 135 return false; | 136 return false; |
| 136 | 137 |
| 137 if (executionContext()->isDocument() && document()->frame()) { | 138 if (executionContext()->isDocument() && document()->frame()) { |
| 138 if (!document()->frame()->loader().mixedContentChecker()->canConnectInse
cureWebSocket(document()->securityOrigin(), url)) | 139 if (!document()->frame()->loader().mixedContentChecker()->canConnectInse
cureWebSocket(document()->securityOrigin(), url)) |
| 139 return false; | 140 return false; |
| 140 } | 141 } |
| 141 if (MixedContentChecker::isMixedContent(document()->securityOrigin(), url))
{ | 142 if (MixedContentChecker::isMixedContent(document()->securityOrigin(), url))
{ |
| 142 String message = "Connecting to a non-secure WebSocket server from a sec
ure origin is deprecated."; | 143 String message = "Connecting to a non-secure WebSocket server from a sec
ure origin is deprecated."; |
| 143 document()->addConsoleMessage(JSMessageSource, WarningMessageLevel, mess
age); | 144 document()->addConsoleMessage(ConsoleMessage::create(JSMessageSource, Wa
rningMessageLevel, message)); |
| 144 } | 145 } |
| 145 | 146 |
| 146 m_url = url; | 147 m_url = url; |
| 147 Vector<String> protocols; | 148 Vector<String> protocols; |
| 148 // Avoid placing an empty token in the Vector when the protocol string is | 149 // Avoid placing an empty token in the Vector when the protocol string is |
| 149 // empty. | 150 // empty. |
| 150 if (!protocol.isEmpty()) { | 151 if (!protocol.isEmpty()) { |
| 151 // Since protocol is already verified and escaped, we can simply split | 152 // Since protocol is already verified and escaped, we can simply split |
| 152 // it. | 153 // it. |
| 153 protocol.split(", ", true, protocols); | 154 protocol.split(", ", true, protocols); |
| (...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 559 } | 560 } |
| 560 | 561 |
| 561 void NewWebSocketChannelImpl::trace(Visitor* visitor) | 562 void NewWebSocketChannelImpl::trace(Visitor* visitor) |
| 562 { | 563 { |
| 563 visitor->trace(m_blobLoader); | 564 visitor->trace(m_blobLoader); |
| 564 visitor->trace(m_client); | 565 visitor->trace(m_client); |
| 565 WebSocketChannel::trace(visitor); | 566 WebSocketChannel::trace(visitor); |
| 566 } | 567 } |
| 567 | 568 |
| 568 } // namespace WebCore | 569 } // namespace WebCore |
| OLD | NEW |