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

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: Rebase /w master. Updated test to generate expired certificate and verify exception is thrown Created 4 years, 8 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 fbc8b05127dc73f51124406b2df023f6e23443b6..1ff1f53521597c4da0008e110356956572d57f18 100644
--- a/third_party/WebKit/Source/modules/mediastream/RTCPeerConnection.cpp
+++ b/third_party/WebKit/Source/modules/mediastream/RTCPeerConnection.cpp
@@ -42,6 +42,7 @@
#include "bindings/modules/v8/UnionTypesModules.h"
#include "bindings/modules/v8/V8RTCCertificate.h"
#include "core/dom/DOMException.h"
+#include "core/dom/DOMTimeStamp.h"
#include "core/dom/Document.h"
#include "core/dom/ExceptionCode.h"
#include "core/dom/ExecutionContext.h"
@@ -88,6 +89,7 @@
#include "public/platform/WebRTCSessionDescriptionRequest.h"
#include "public/platform/WebRTCStatsRequest.h"
#include "public/platform/WebRTCVoidRequest.h"
+#include "wtf/CurrentTime.h"
#include <memory>
@@ -321,7 +323,6 @@ RTCConfiguration* parseConfiguration(const Dictionary& configuration, ExceptionS
rtcConfiguration->appendCertificate(certificate->certificateShallowCopy());
}
}
-
return rtcConfiguration;
}
@@ -388,6 +389,18 @@ RTCPeerConnection* RTCPeerConnection::create(ExecutionContext* context, const Di
if (exceptionState.hadException())
return 0;
+ // Make sure no certificates have expired.
+ if (configuration && configuration->numberOfCertificates() > 0) {
+ DOMTimeStamp now = convertSecondsToDOMTimeStamp(currentTime());
+ 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(context, 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