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 24 matching lines...) Expand all Loading... |
35 #include "bindings/core/v8/ExceptionState.h" | 35 #include "bindings/core/v8/ExceptionState.h" |
36 #include "bindings/core/v8/Microtask.h" | 36 #include "bindings/core/v8/Microtask.h" |
37 #include "bindings/core/v8/Nullable.h" | 37 #include "bindings/core/v8/Nullable.h" |
38 #include "bindings/core/v8/ScriptPromiseResolver.h" | 38 #include "bindings/core/v8/ScriptPromiseResolver.h" |
39 #include "bindings/core/v8/ScriptState.h" | 39 #include "bindings/core/v8/ScriptState.h" |
40 #include "bindings/core/v8/ScriptValue.h" | 40 #include "bindings/core/v8/ScriptValue.h" |
41 #include "bindings/core/v8/V8ThrowException.h" | 41 #include "bindings/core/v8/V8ThrowException.h" |
42 #include "bindings/modules/v8/UnionTypesModules.h" | 42 #include "bindings/modules/v8/UnionTypesModules.h" |
43 #include "bindings/modules/v8/V8RTCCertificate.h" | 43 #include "bindings/modules/v8/V8RTCCertificate.h" |
44 #include "core/dom/DOMException.h" | 44 #include "core/dom/DOMException.h" |
| 45 #include "core/dom/DOMTimeStamp.h" |
45 #include "core/dom/Document.h" | 46 #include "core/dom/Document.h" |
46 #include "core/dom/ExceptionCode.h" | 47 #include "core/dom/ExceptionCode.h" |
47 #include "core/dom/ExecutionContext.h" | 48 #include "core/dom/ExecutionContext.h" |
48 #include "core/frame/Deprecation.h" | 49 #include "core/frame/Deprecation.h" |
49 #include "core/frame/LocalFrame.h" | 50 #include "core/frame/LocalFrame.h" |
50 #include "core/html/VoidCallback.h" | 51 #include "core/html/VoidCallback.h" |
51 #include "core/loader/FrameLoader.h" | 52 #include "core/loader/FrameLoader.h" |
52 #include "core/loader/FrameLoaderClient.h" | 53 #include "core/loader/FrameLoaderClient.h" |
53 #include "modules/crypto/CryptoResultImpl.h" | 54 #include "modules/crypto/CryptoResultImpl.h" |
54 #include "modules/mediastream/MediaConstraintsImpl.h" | 55 #include "modules/mediastream/MediaConstraintsImpl.h" |
(...skipping 26 matching lines...) Expand all Loading... |
81 #include "public/platform/WebRTCConfiguration.h" | 82 #include "public/platform/WebRTCConfiguration.h" |
82 #include "public/platform/WebRTCDataChannelHandler.h" | 83 #include "public/platform/WebRTCDataChannelHandler.h" |
83 #include "public/platform/WebRTCDataChannelInit.h" | 84 #include "public/platform/WebRTCDataChannelInit.h" |
84 #include "public/platform/WebRTCICECandidate.h" | 85 #include "public/platform/WebRTCICECandidate.h" |
85 #include "public/platform/WebRTCKeyParams.h" | 86 #include "public/platform/WebRTCKeyParams.h" |
86 #include "public/platform/WebRTCOfferOptions.h" | 87 #include "public/platform/WebRTCOfferOptions.h" |
87 #include "public/platform/WebRTCSessionDescription.h" | 88 #include "public/platform/WebRTCSessionDescription.h" |
88 #include "public/platform/WebRTCSessionDescriptionRequest.h" | 89 #include "public/platform/WebRTCSessionDescriptionRequest.h" |
89 #include "public/platform/WebRTCStatsRequest.h" | 90 #include "public/platform/WebRTCStatsRequest.h" |
90 #include "public/platform/WebRTCVoidRequest.h" | 91 #include "public/platform/WebRTCVoidRequest.h" |
| 92 #include "wtf/CurrentTime.h" |
91 | 93 |
92 #include <memory> | 94 #include <memory> |
93 | 95 |
94 namespace blink { | 96 namespace blink { |
95 | 97 |
96 namespace { | 98 namespace { |
97 | 99 |
98 const char kSignalingStateClosedMessage[] = "The RTCPeerConnection's signalingSt
ate is 'closed'."; | 100 const char kSignalingStateClosedMessage[] = "The RTCPeerConnection's signalingSt
ate is 'closed'."; |
99 | 101 |
100 bool throwExceptionIfSignalingStateClosed(RTCPeerConnection::SignalingState stat
e, ExceptionState& exceptionState) | 102 bool throwExceptionIfSignalingStateClosed(RTCPeerConnection::SignalingState stat
e, ExceptionState& exceptionState) |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 certificate = V8RTCCertificate::toImplWithTypeCheck(configuratio
n.isolate(), valCert); | 316 certificate = V8RTCCertificate::toImplWithTypeCheck(configuratio
n.isolate(), valCert); |
315 } | 317 } |
316 if (!certificate) { | 318 if (!certificate) { |
317 exceptionState.throwTypeError("Malformed sequence<RTCCertificate
>"); | 319 exceptionState.throwTypeError("Malformed sequence<RTCCertificate
>"); |
318 return 0; | 320 return 0; |
319 } | 321 } |
320 | 322 |
321 rtcConfiguration->appendCertificate(certificate->certificateShallowC
opy()); | 323 rtcConfiguration->appendCertificate(certificate->certificateShallowC
opy()); |
322 } | 324 } |
323 } | 325 } |
324 | |
325 return rtcConfiguration; | 326 return rtcConfiguration; |
326 } | 327 } |
327 | 328 |
328 RTCOfferOptionsPlatform* parseOfferOptions(const Dictionary& options) | 329 RTCOfferOptionsPlatform* parseOfferOptions(const Dictionary& options) |
329 { | 330 { |
330 if (options.isUndefinedOrNull()) | 331 if (options.isUndefinedOrNull()) |
331 return 0; | 332 return 0; |
332 | 333 |
333 Vector<String> propertyNames; | 334 Vector<String> propertyNames; |
334 options.getPropertyNames(propertyNames); | 335 options.getPropertyNames(propertyNames); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
381 { | 382 { |
382 if (mediaConstraints.isObject()) | 383 if (mediaConstraints.isObject()) |
383 UseCounter::count(context, UseCounter::RTCPeerConnectionConstructorConst
raints); | 384 UseCounter::count(context, UseCounter::RTCPeerConnectionConstructorConst
raints); |
384 else | 385 else |
385 UseCounter::count(context, UseCounter::RTCPeerConnectionConstructorCompl
iant); | 386 UseCounter::count(context, UseCounter::RTCPeerConnectionConstructorCompl
iant); |
386 | 387 |
387 RTCConfiguration* configuration = parseConfiguration(rtcConfiguration, excep
tionState); | 388 RTCConfiguration* configuration = parseConfiguration(rtcConfiguration, excep
tionState); |
388 if (exceptionState.hadException()) | 389 if (exceptionState.hadException()) |
389 return 0; | 390 return 0; |
390 | 391 |
| 392 // Make sure no certificates have expired. |
| 393 if (configuration && configuration->numberOfCertificates() > 0) { |
| 394 DOMTimeStamp now = convertSecondsToDOMTimeStamp(currentTime()); |
| 395 for (size_t i = 0; i < configuration->numberOfCertificates(); ++i) { |
| 396 DOMTimeStamp expires = configuration->certificate(i)->expires(); |
| 397 if (expires <= now) { |
| 398 exceptionState.throwDOMException(InvalidStateError, "Expired cer
tificate(s)."); |
| 399 return 0; |
| 400 } |
| 401 } |
| 402 } |
| 403 |
391 MediaErrorState mediaErrorState; | 404 MediaErrorState mediaErrorState; |
392 WebMediaConstraints constraints = MediaConstraintsImpl::create(context, medi
aConstraints, mediaErrorState); | 405 WebMediaConstraints constraints = MediaConstraintsImpl::create(context, medi
aConstraints, mediaErrorState); |
393 if (mediaErrorState.hadException()) { | 406 if (mediaErrorState.hadException()) { |
394 mediaErrorState.raiseException(exceptionState); | 407 mediaErrorState.raiseException(exceptionState); |
395 return 0; | 408 return 0; |
396 } | 409 } |
397 | 410 |
398 RTCPeerConnection* peerConnection = new RTCPeerConnection(context, configura
tion, constraints, exceptionState); | 411 RTCPeerConnection* peerConnection = new RTCPeerConnection(context, configura
tion, constraints, exceptionState); |
399 peerConnection->suspendIfNeeded(); | 412 peerConnection->suspendIfNeeded(); |
400 if (exceptionState.hadException()) | 413 if (exceptionState.hadException()) |
(...skipping 799 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1200 { | 1213 { |
1201 visitor->trace(m_localStreams); | 1214 visitor->trace(m_localStreams); |
1202 visitor->trace(m_remoteStreams); | 1215 visitor->trace(m_remoteStreams); |
1203 visitor->trace(m_dispatchScheduledEventRunner); | 1216 visitor->trace(m_dispatchScheduledEventRunner); |
1204 visitor->trace(m_scheduledEvents); | 1217 visitor->trace(m_scheduledEvents); |
1205 EventTargetWithInlineData::trace(visitor); | 1218 EventTargetWithInlineData::trace(visitor); |
1206 ActiveDOMObject::trace(visitor); | 1219 ActiveDOMObject::trace(visitor); |
1207 } | 1220 } |
1208 | 1221 |
1209 } // namespace blink | 1222 } // namespace blink |
OLD | NEW |