| 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 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 if (!portAllowed(m_url)) { | 217 if (!portAllowed(m_url)) { |
| 218 m_state = CLOSED; | 218 m_state = CLOSED; |
| 219 es.throwSecurityError(ExceptionMessages::failedToExecute("connect", "Web
Socket", "The port " + String::number(m_url.port()) + " is not allowed.")); | 219 es.throwSecurityError(ExceptionMessages::failedToExecute("connect", "Web
Socket", "The port " + String::number(m_url.port()) + " is not allowed.")); |
| 220 return; | 220 return; |
| 221 } | 221 } |
| 222 | 222 |
| 223 // FIXME: Convert this to check the isolated world's Content Security Policy
once webkit.org/b/104520 is solved. | 223 // FIXME: Convert this to check the isolated world's Content Security Policy
once webkit.org/b/104520 is solved. |
| 224 bool shouldBypassMainWorldContentSecurityPolicy = false; | 224 bool shouldBypassMainWorldContentSecurityPolicy = false; |
| 225 if (executionContext()->isDocument()) { | 225 if (executionContext()->isDocument()) { |
| 226 Document* document = toDocument(executionContext()); | 226 Document* document = toDocument(executionContext()); |
| 227 shouldBypassMainWorldContentSecurityPolicy = document->frame()->script()
->shouldBypassMainWorldContentSecurityPolicy(); | 227 shouldBypassMainWorldContentSecurityPolicy = document->frame()->script()
.shouldBypassMainWorldContentSecurityPolicy(); |
| 228 } | 228 } |
| 229 if (!shouldBypassMainWorldContentSecurityPolicy && !executionContext()->cont
entSecurityPolicy()->allowConnectToSource(m_url)) { | 229 if (!shouldBypassMainWorldContentSecurityPolicy && !executionContext()->cont
entSecurityPolicy()->allowConnectToSource(m_url)) { |
| 230 m_state = CLOSED; | 230 m_state = CLOSED; |
| 231 // The URL is safe to expose to JavaScript, as this check happens synchr
onously before redirection. | 231 // The URL is safe to expose to JavaScript, as this check happens synchr
onously before redirection. |
| 232 es.throwSecurityError(ExceptionMessages::failedToExecute("connect", "Web
Socket", "Refused to connect to '" + m_url.elidedString() + "' because it violat
es the document's Content Security Policy.")); | 232 es.throwSecurityError(ExceptionMessages::failedToExecute("connect", "Web
Socket", "Refused to connect to '" + m_url.elidedString() + "' because it violat
es the document's Content Security Policy.")); |
| 233 return; | 233 return; |
| 234 } | 234 } |
| 235 | 235 |
| 236 m_channel = WebSocketChannel::create(executionContext(), this); | 236 m_channel = WebSocketChannel::create(executionContext(), this); |
| 237 | 237 |
| (...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 618 static const size_t minimumPayloadSizeWithEightByteExtendedPayloadLength = 0
x10000; | 618 static const size_t minimumPayloadSizeWithEightByteExtendedPayloadLength = 0
x10000; |
| 619 size_t overhead = hybiBaseFramingOverhead + hybiMaskingKeyLength; | 619 size_t overhead = hybiBaseFramingOverhead + hybiMaskingKeyLength; |
| 620 if (payloadSize >= minimumPayloadSizeWithEightByteExtendedPayloadLength) | 620 if (payloadSize >= minimumPayloadSizeWithEightByteExtendedPayloadLength) |
| 621 overhead += 8; | 621 overhead += 8; |
| 622 else if (payloadSize >= minimumPayloadSizeWithTwoByteExtendedPayloadLength) | 622 else if (payloadSize >= minimumPayloadSizeWithTwoByteExtendedPayloadLength) |
| 623 overhead += 2; | 623 overhead += 2; |
| 624 return overhead; | 624 return overhead; |
| 625 } | 625 } |
| 626 | 626 |
| 627 } // namespace WebCore | 627 } // namespace WebCore |
| OLD | NEW |