OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 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 | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 18 matching lines...) Expand all Loading... | |
29 */ | 29 */ |
30 | 30 |
31 #include "modules/mediastream/RTCPeerConnection.h" | 31 #include "modules/mediastream/RTCPeerConnection.h" |
32 | 32 |
33 #include "bindings/core/v8/ArrayValue.h" | 33 #include "bindings/core/v8/ArrayValue.h" |
34 #include "bindings/core/v8/ExceptionMessages.h" | 34 #include "bindings/core/v8/ExceptionMessages.h" |
35 #include "bindings/core/v8/ExceptionState.h" | 35 #include "bindings/core/v8/ExceptionState.h" |
36 #include "bindings/core/v8/Nullable.h" | 36 #include "bindings/core/v8/Nullable.h" |
37 #include "bindings/core/v8/ScriptPromiseResolver.h" | 37 #include "bindings/core/v8/ScriptPromiseResolver.h" |
38 #include "bindings/modules/v8/V8RTCCertificate.h" | 38 #include "bindings/modules/v8/V8RTCCertificate.h" |
39 #include "core/dom/DOMTimeStamp.h" | |
39 #include "core/dom/Document.h" | 40 #include "core/dom/Document.h" |
40 #include "core/dom/ExceptionCode.h" | 41 #include "core/dom/ExceptionCode.h" |
41 #include "core/dom/ExecutionContext.h" | 42 #include "core/dom/ExecutionContext.h" |
42 #include "core/frame/LocalFrame.h" | 43 #include "core/frame/LocalFrame.h" |
43 #include "core/frame/UseCounter.h" | 44 #include "core/frame/UseCounter.h" |
44 #include "core/html/VoidCallback.h" | 45 #include "core/html/VoidCallback.h" |
45 #include "core/loader/FrameLoader.h" | 46 #include "core/loader/FrameLoader.h" |
46 #include "core/loader/FrameLoaderClient.h" | 47 #include "core/loader/FrameLoaderClient.h" |
47 #include "modules/crypto/CryptoResultImpl.h" | 48 #include "modules/crypto/CryptoResultImpl.h" |
48 #include "modules/mediastream/MediaConstraintsImpl.h" | 49 #include "modules/mediastream/MediaConstraintsImpl.h" |
(...skipping 20 matching lines...) Expand all Loading... | |
69 #include "public/platform/WebRTCConfiguration.h" | 70 #include "public/platform/WebRTCConfiguration.h" |
70 #include "public/platform/WebRTCDataChannelHandler.h" | 71 #include "public/platform/WebRTCDataChannelHandler.h" |
71 #include "public/platform/WebRTCDataChannelInit.h" | 72 #include "public/platform/WebRTCDataChannelInit.h" |
72 #include "public/platform/WebRTCICECandidate.h" | 73 #include "public/platform/WebRTCICECandidate.h" |
73 #include "public/platform/WebRTCKeyParams.h" | 74 #include "public/platform/WebRTCKeyParams.h" |
74 #include "public/platform/WebRTCOfferOptions.h" | 75 #include "public/platform/WebRTCOfferOptions.h" |
75 #include "public/platform/WebRTCSessionDescription.h" | 76 #include "public/platform/WebRTCSessionDescription.h" |
76 #include "public/platform/WebRTCSessionDescriptionRequest.h" | 77 #include "public/platform/WebRTCSessionDescriptionRequest.h" |
77 #include "public/platform/WebRTCStatsRequest.h" | 78 #include "public/platform/WebRTCStatsRequest.h" |
78 #include "public/platform/WebRTCVoidRequest.h" | 79 #include "public/platform/WebRTCVoidRequest.h" |
80 #include "wtf/CurrentTime.h" | |
79 | 81 |
80 namespace blink { | 82 namespace blink { |
81 | 83 |
82 namespace { | 84 namespace { |
83 | 85 |
84 static bool throwExceptionIfSignalingStateClosed(RTCPeerConnection::SignalingSta te state, ExceptionState& exceptionState) | 86 static bool throwExceptionIfSignalingStateClosed(RTCPeerConnection::SignalingSta te state, ExceptionState& exceptionState) |
85 { | 87 { |
86 if (state == RTCPeerConnection::SignalingStateClosed) { | 88 if (state == RTCPeerConnection::SignalingStateClosed) { |
87 exceptionState.throwDOMException(InvalidStateError, "The RTCPeerConnecti on's signalingState is 'closed'."); | 89 exceptionState.throwDOMException(InvalidStateError, "The RTCPeerConnecti on's signalingState is 'closed'."); |
88 return true; | 90 return true; |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
323 { | 325 { |
324 if (mediaConstraints.isObject()) | 326 if (mediaConstraints.isObject()) |
325 UseCounter::count(context, UseCounter::RTCPeerConnectionConstructorConst raints); | 327 UseCounter::count(context, UseCounter::RTCPeerConnectionConstructorConst raints); |
326 else | 328 else |
327 UseCounter::count(context, UseCounter::RTCPeerConnectionConstructorCompl iant); | 329 UseCounter::count(context, UseCounter::RTCPeerConnectionConstructorCompl iant); |
328 | 330 |
329 RTCConfiguration* configuration = parseConfiguration(rtcConfiguration, excep tionState); | 331 RTCConfiguration* configuration = parseConfiguration(rtcConfiguration, excep tionState); |
330 if (exceptionState.hadException()) | 332 if (exceptionState.hadException()) |
331 return 0; | 333 return 0; |
332 | 334 |
335 // Make sure no certificates have expired. | |
336 if (configuration->numberOfCertificates() > 0) { | |
337 DOMTimeStamp now = convertSecondsToDOMTimeStamp(currentTime()); | |
hta - Chromium
2016/01/29 07:15:14
My usual caveat on depending on currentTime for st
hbos_chromium
2016/04/20 11:08:58
The ability to generate expired certificates lande
| |
338 for (size_t i = 0; i < configuration->numberOfCertificates(); ++i) { | |
339 DOMTimeStamp expires = configuration->certificate(i)->expires(); | |
340 if (expires <= now) { | |
341 exceptionState.throwDOMException(InvalidStateError, "Expired cer tificate(s)."); | |
342 return 0; | |
343 } | |
344 } | |
345 } | |
346 | |
333 MediaErrorState mediaErrorState; | 347 MediaErrorState mediaErrorState; |
334 WebMediaConstraints constraints = MediaConstraintsImpl::create(mediaConstrai nts, mediaErrorState); | 348 WebMediaConstraints constraints = MediaConstraintsImpl::create(mediaConstrai nts, mediaErrorState); |
335 if (mediaErrorState.hadException()) { | 349 if (mediaErrorState.hadException()) { |
336 mediaErrorState.raiseException(exceptionState); | 350 mediaErrorState.raiseException(exceptionState); |
337 return 0; | 351 return 0; |
338 } | 352 } |
339 | 353 |
340 RTCPeerConnection* peerConnection = new RTCPeerConnection(context, configura tion, constraints, exceptionState); | 354 RTCPeerConnection* peerConnection = new RTCPeerConnection(context, configura tion, constraints, exceptionState); |
341 peerConnection->suspendIfNeeded(); | 355 peerConnection->suspendIfNeeded(); |
342 if (exceptionState.hadException()) | 356 if (exceptionState.hadException()) |
(...skipping 715 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1058 visitor->trace(m_localStreams); | 1072 visitor->trace(m_localStreams); |
1059 visitor->trace(m_remoteStreams); | 1073 visitor->trace(m_remoteStreams); |
1060 visitor->trace(m_dataChannels); | 1074 visitor->trace(m_dataChannels); |
1061 visitor->trace(m_dispatchScheduledEventRunner); | 1075 visitor->trace(m_dispatchScheduledEventRunner); |
1062 visitor->trace(m_scheduledEvents); | 1076 visitor->trace(m_scheduledEvents); |
1063 RefCountedGarbageCollectedEventTargetWithInlineData<RTCPeerConnection>::trac e(visitor); | 1077 RefCountedGarbageCollectedEventTargetWithInlineData<RTCPeerConnection>::trac e(visitor); |
1064 ActiveDOMObject::trace(visitor); | 1078 ActiveDOMObject::trace(visitor); |
1065 } | 1079 } |
1066 | 1080 |
1067 } // namespace blink | 1081 } // namespace blink |
OLD | NEW |