| 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 #include "core/frame/csp/ContentSecurityPolicy.h" | 48 #include "core/frame/csp/ContentSecurityPolicy.h" |
| 49 #include "core/inspector/ConsoleMessage.h" | 49 #include "core/inspector/ConsoleMessage.h" |
| 50 #include "modules/websockets/CloseEvent.h" | 50 #include "modules/websockets/CloseEvent.h" |
| 51 #include "platform/Histogram.h" | 51 #include "platform/Histogram.h" |
| 52 #include "platform/Logging.h" | 52 #include "platform/Logging.h" |
| 53 #include "platform/blob/BlobData.h" | 53 #include "platform/blob/BlobData.h" |
| 54 #include "platform/heap/Handle.h" | 54 #include "platform/heap/Handle.h" |
| 55 #include "platform/weborigin/KnownPorts.h" | 55 #include "platform/weborigin/KnownPorts.h" |
| 56 #include "platform/weborigin/SecurityOrigin.h" | 56 #include "platform/weborigin/SecurityOrigin.h" |
| 57 #include "public/platform/Platform.h" | 57 #include "public/platform/Platform.h" |
| 58 #include "public/platform/WebInsecureRequestPolicy.h" |
| 58 #include "wtf/Assertions.h" | 59 #include "wtf/Assertions.h" |
| 59 #include "wtf/HashSet.h" | 60 #include "wtf/HashSet.h" |
| 60 #include "wtf/PassOwnPtr.h" | 61 #include "wtf/PassOwnPtr.h" |
| 61 #include "wtf/StdLibExtras.h" | 62 #include "wtf/StdLibExtras.h" |
| 62 #include "wtf/text/CString.h" | 63 #include "wtf/text/CString.h" |
| 63 #include "wtf/text/StringBuilder.h" | 64 #include "wtf/text/StringBuilder.h" |
| 64 #include "wtf/text/WTFString.h" | 65 #include "wtf/text/WTFString.h" |
| 65 | 66 |
| 66 namespace blink { | 67 namespace blink { |
| 67 | 68 |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 return webSocket; | 278 return webSocket; |
| 278 } | 279 } |
| 279 | 280 |
| 280 void DOMWebSocket::connect(const String& url, const Vector<String>& protocols, E
xceptionState& exceptionState) | 281 void DOMWebSocket::connect(const String& url, const Vector<String>& protocols, E
xceptionState& exceptionState) |
| 281 { | 282 { |
| 282 UseCounter::count(getExecutionContext(), UseCounter::WebSocket); | 283 UseCounter::count(getExecutionContext(), UseCounter::WebSocket); |
| 283 | 284 |
| 284 WTF_LOG(Network, "WebSocket %p connect() url='%s'", this, url.utf8().data())
; | 285 WTF_LOG(Network, "WebSocket %p connect() url='%s'", this, url.utf8().data())
; |
| 285 m_url = KURL(KURL(), url); | 286 m_url = KURL(KURL(), url); |
| 286 | 287 |
| 287 if (getExecutionContext()->securityContext().getInsecureRequestsPolicy() ==
SecurityContext::InsecureRequestsUpgrade && m_url.protocol() == "ws") { | 288 if (getExecutionContext()->securityContext().getInsecureRequestPolicy() & kU
pgradeInsecureRequests && m_url.protocol() == "ws") { |
| 288 UseCounter::count(getExecutionContext(), UseCounter::UpgradeInsecureRequ
estsUpgradedRequest); | 289 UseCounter::count(getExecutionContext(), UseCounter::UpgradeInsecureRequ
estsUpgradedRequest); |
| 289 m_url.setProtocol("wss"); | 290 m_url.setProtocol("wss"); |
| 290 if (m_url.port() == 80) | 291 if (m_url.port() == 80) |
| 291 m_url.setPort(443); | 292 m_url.setPort(443); |
| 292 } | 293 } |
| 293 | 294 |
| 294 if (!m_url.isValid()) { | 295 if (!m_url.isValid()) { |
| 295 m_state = CLOSED; | 296 m_state = CLOSED; |
| 296 exceptionState.throwDOMException(SyntaxError, "The URL '" + url + "' is
invalid."); | 297 exceptionState.throwDOMException(SyntaxError, "The URL '" + url + "' is
invalid."); |
| 297 return; | 298 return; |
| (...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 715 DEFINE_TRACE(DOMWebSocket) | 716 DEFINE_TRACE(DOMWebSocket) |
| 716 { | 717 { |
| 717 visitor->trace(m_channel); | 718 visitor->trace(m_channel); |
| 718 visitor->trace(m_eventQueue); | 719 visitor->trace(m_eventQueue); |
| 719 WebSocketChannelClient::trace(visitor); | 720 WebSocketChannelClient::trace(visitor); |
| 720 EventTargetWithInlineData::trace(visitor); | 721 EventTargetWithInlineData::trace(visitor); |
| 721 ActiveDOMObject::trace(visitor); | 722 ActiveDOMObject::trace(visitor); |
| 722 } | 723 } |
| 723 | 724 |
| 724 } // namespace blink | 725 } // namespace blink |
| OLD | NEW |