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 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 return webSocket; | 275 return webSocket; |
276 } | 276 } |
277 | 277 |
278 void DOMWebSocket::connect(const String& url, const Vector<String>& protocols, E
xceptionState& exceptionState) | 278 void DOMWebSocket::connect(const String& url, const Vector<String>& protocols, E
xceptionState& exceptionState) |
279 { | 279 { |
280 UseCounter::count(executionContext(), UseCounter::WebSocket); | 280 UseCounter::count(executionContext(), UseCounter::WebSocket); |
281 | 281 |
282 WTF_LOG(Network, "WebSocket %p connect() url='%s'", this, url.utf8().data())
; | 282 WTF_LOG(Network, "WebSocket %p connect() url='%s'", this, url.utf8().data())
; |
283 m_url = KURL(KURL(), url); | 283 m_url = KURL(KURL(), url); |
284 | 284 |
285 if (executionContext()->securityContext().insecureRequestsPolicy() == Securi
tyContext::InsecureRequestsUpgrade && m_url.protocol() == "ws") { | 285 if (executionContext()->securityContext().getInsecureRequestsPolicy() == Sec
urityContext::InsecureRequestsUpgrade && m_url.protocol() == "ws") { |
286 UseCounter::count(executionContext(), UseCounter::UpgradeInsecureRequest
sUpgradedRequest); | 286 UseCounter::count(executionContext(), UseCounter::UpgradeInsecureRequest
sUpgradedRequest); |
287 m_url.setProtocol("wss"); | 287 m_url.setProtocol("wss"); |
288 if (m_url.port() == 80) | 288 if (m_url.port() == 80) |
289 m_url.setPort(443); | 289 m_url.setPort(443); |
290 } | 290 } |
291 | 291 |
292 if (!m_url.isValid()) { | 292 if (!m_url.isValid()) { |
293 m_state = CLOSED; | 293 m_state = CLOSED; |
294 exceptionState.throwDOMException(SyntaxError, "The URL '" + url + "' is
invalid."); | 294 exceptionState.throwDOMException(SyntaxError, "The URL '" + url + "' is
invalid."); |
295 return; | 295 return; |
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
713 DEFINE_TRACE(DOMWebSocket) | 713 DEFINE_TRACE(DOMWebSocket) |
714 { | 714 { |
715 visitor->trace(m_channel); | 715 visitor->trace(m_channel); |
716 visitor->trace(m_eventQueue); | 716 visitor->trace(m_eventQueue); |
717 WebSocketChannelClient::trace(visitor); | 717 WebSocketChannelClient::trace(visitor); |
718 RefCountedGarbageCollectedEventTargetWithInlineData<DOMWebSocket>::trace(vis
itor); | 718 RefCountedGarbageCollectedEventTargetWithInlineData<DOMWebSocket>::trace(vis
itor); |
719 ActiveDOMObject::trace(visitor); | 719 ActiveDOMObject::trace(visitor); |
720 } | 720 } |
721 | 721 |
722 } // namespace blink | 722 } // namespace blink |
OLD | NEW |