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

Unified Diff: third_party/WebKit/Source/modules/peerconnection/RTCCertificate.cpp

Issue 2828563002: RTCCertificate.getFingerprints added (exposed to the web) (Closed)
Patch Set: Addressed comments and rebased with upstream Created 3 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
Index: third_party/WebKit/Source/modules/peerconnection/RTCCertificate.cpp
diff --git a/third_party/WebKit/Source/modules/peerconnection/RTCCertificate.cpp b/third_party/WebKit/Source/modules/peerconnection/RTCCertificate.cpp
index 25da97fef72217f7da1500badf620efa35702f33..119fd7141cf43febbfcbd3eff110f5853caf248c 100644
--- a/third_party/WebKit/Source/modules/peerconnection/RTCCertificate.cpp
+++ b/third_party/WebKit/Source/modules/peerconnection/RTCCertificate.cpp
@@ -30,6 +30,9 @@
#include "modules/peerconnection/RTCCertificate.h"
+#include "bindings/core/v8/ScriptState.h"
+#include "bindings/core/v8/ToV8.h"
+#include "bindings/core/v8/V8Binding.h"
#include "platform/wtf/PtrUtil.h"
namespace blink {
@@ -46,4 +49,27 @@ DOMTimeStamp RTCCertificate::expires() const {
return static_cast<DOMTimeStamp>(certificate_->Expires());
}
+Vector<v8::Local<v8::Value>> RTCCertificate::fingerprints(
+ ScriptState* script_state) {
+ v8::Isolate* isolate = script_state->GetIsolate();
+ if (fingerprints_.IsEmpty()) {
+ v8::Local<v8::Object> creation_context =
+ script_state->GetContext()->Global();
+ for (const WebRTCDtlsFingerprint& web_fingerprint :
+ certificate_->Fingerprints()) {
+ RTCDtlsFingerprint fingerprint;
+ fingerprint.setAlgorithm(web_fingerprint.Algorithm());
foolip 2017/04/21 16:51:53 Can anything be asserted about the value? Looks pe
hbos_chromium 2017/04/24 15:37:54 Done.
+ fingerprint.setValue(web_fingerprint.Value());
+ fingerprints_.push_back(v8::Global<v8::Value>(
+ isolate, ToV8(fingerprint, creation_context, isolate)));
+ }
+ }
+ Vector<v8::Local<v8::Value>> fingerprints(fingerprints_.size());
+ for (size_t i = 0; i < fingerprints_.size(); ++i) {
+ fingerprints[i] = FreezeV8Object(
foolip 2017/04/21 16:51:53 The members of a FrozenArray shouldn't be frozen,
hbos_chromium 2017/04/24 15:37:54 I added tests for this, also regex-testing the fin
+ v8::Local<v8::Value>::New(isolate, fingerprints_[i]), isolate);
+ }
+ return fingerprints;
+}
+
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698