Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(535)

Unified Diff: third_party/WebKit/Source/modules/mediastream/RTCPeerConnection.cpp

Issue 1644553002: Constructing an RTCPeerConnection with expired certificates should throw an exception. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Check expiration at RTCPeerConnection::create, not at parseConfiguration Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/modules/mediastream/RTCPeerConnection.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/modules/mediastream/RTCPeerConnection.cpp
diff --git a/third_party/WebKit/Source/modules/mediastream/RTCPeerConnection.cpp b/third_party/WebKit/Source/modules/mediastream/RTCPeerConnection.cpp
index 063d4345a168cf49a4d1669964eb0608736d8964..2c3230397ffc628b3bf18e55debc5760ac1e6d1d 100644
--- a/third_party/WebKit/Source/modules/mediastream/RTCPeerConnection.cpp
+++ b/third_party/WebKit/Source/modules/mediastream/RTCPeerConnection.cpp
@@ -36,6 +36,7 @@
#include "bindings/core/v8/Nullable.h"
#include "bindings/core/v8/ScriptPromiseResolver.h"
#include "bindings/modules/v8/V8RTCCertificate.h"
+#include "core/dom/DOMTimeStamp.h"
#include "core/dom/Document.h"
#include "core/dom/ExceptionCode.h"
#include "core/dom/ExecutionContext.h"
@@ -76,6 +77,7 @@
#include "public/platform/WebRTCSessionDescriptionRequest.h"
#include "public/platform/WebRTCStatsRequest.h"
#include "public/platform/WebRTCVoidRequest.h"
+#include "wtf/CurrentTime.h"
namespace blink {
@@ -330,6 +332,18 @@ RTCPeerConnection* RTCPeerConnection::create(ExecutionContext* context, const Di
if (exceptionState.hadException())
return 0;
+ // Make sure no certificates have expired.
+ if (configuration->numberOfCertificates() > 0) {
+ 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
+ for (size_t i = 0; i < configuration->numberOfCertificates(); ++i) {
+ DOMTimeStamp expires = configuration->certificate(i)->expires();
+ if (expires <= now) {
+ exceptionState.throwDOMException(InvalidStateError, "Expired certificate(s).");
+ return 0;
+ }
+ }
+ }
+
MediaErrorState mediaErrorState;
WebMediaConstraints constraints = MediaConstraintsImpl::create(mediaConstraints, mediaErrorState);
if (mediaErrorState.hadException()) {
« no previous file with comments | « third_party/WebKit/Source/modules/mediastream/RTCPeerConnection.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698