| 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 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 PassRefPtr<WebSocket> WebSocket::create(ExecutionContext* context, const String&
url, const Vector<String>& protocols, ExceptionState& exceptionState) | 251 PassRefPtr<WebSocket> WebSocket::create(ExecutionContext* context, const String&
url, const Vector<String>& protocols, ExceptionState& exceptionState) |
| 252 { | 252 { |
| 253 if (url.isNull()) { | 253 if (url.isNull()) { |
| 254 exceptionState.throwDOMException(SyntaxError, "Failed to create a WebSoc
ket: the provided URL is invalid."); | 254 exceptionState.throwDOMException(SyntaxError, "Failed to create a WebSoc
ket: the provided URL is invalid."); |
| 255 return nullptr; | 255 return nullptr; |
| 256 } | 256 } |
| 257 | 257 |
| 258 RefPtr<WebSocket> webSocket(adoptRef(new WebSocket(context))); | 258 RefPtr<WebSocket> webSocket(adoptRef(new WebSocket(context))); |
| 259 webSocket->suspendIfNeeded(); | 259 webSocket->suspendIfNeeded(); |
| 260 | 260 |
| 261 webSocket->connect(context->completeURL(url), protocols, exceptionState); | 261 webSocket->connect(url, protocols, exceptionState); |
| 262 if (exceptionState.hadException()) | 262 if (exceptionState.hadException()) |
| 263 return nullptr; | 263 return nullptr; |
| 264 | 264 |
| 265 return webSocket.release(); | 265 return webSocket.release(); |
| 266 } | 266 } |
| 267 | 267 |
| 268 PassRefPtr<WebSocket> WebSocket::create(ExecutionContext* context, const String&
url, const String& protocol, ExceptionState& exceptionState) | 268 PassRefPtr<WebSocket> WebSocket::create(ExecutionContext* context, const String&
url, const String& protocol, ExceptionState& exceptionState) |
| 269 { | 269 { |
| 270 Vector<String> protocols; | 270 Vector<String> protocols; |
| 271 protocols.append(protocol); | 271 protocols.append(protocol); |
| (...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 681 static const size_t minimumPayloadSizeWithEightByteExtendedPayloadLength = 0
x10000; | 681 static const size_t minimumPayloadSizeWithEightByteExtendedPayloadLength = 0
x10000; |
| 682 size_t overhead = hybiBaseFramingOverhead + hybiMaskingKeyLength; | 682 size_t overhead = hybiBaseFramingOverhead + hybiMaskingKeyLength; |
| 683 if (payloadSize >= minimumPayloadSizeWithEightByteExtendedPayloadLength) | 683 if (payloadSize >= minimumPayloadSizeWithEightByteExtendedPayloadLength) |
| 684 overhead += 8; | 684 overhead += 8; |
| 685 else if (payloadSize >= minimumPayloadSizeWithTwoByteExtendedPayloadLength) | 685 else if (payloadSize >= minimumPayloadSizeWithTwoByteExtendedPayloadLength) |
| 686 overhead += 2; | 686 overhead += 2; |
| 687 return overhead; | 687 return overhead; |
| 688 } | 688 } |
| 689 | 689 |
| 690 } // namespace WebCore | 690 } // namespace WebCore |
| OLD | NEW |