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

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

Issue 2828563002: RTCCertificate.getFingerprints added (exposed to the web) (Closed)
Patch Set: 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..a56c162094b50e026f255d2e87cd7b001e6a10c6 100644
--- a/third_party/WebKit/Source/modules/peerconnection/RTCCertificate.cpp
+++ b/third_party/WebKit/Source/modules/peerconnection/RTCCertificate.cpp
@@ -30,6 +30,8 @@
#include "modules/peerconnection/RTCCertificate.h"
+#include "bindings/core/v8/ScriptState.h"
+#include "bindings/core/v8/ToV8.h"
#include "platform/wtf/PtrUtil.h"
namespace blink {
@@ -46,4 +48,26 @@ 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_.size()) {
Guido Urdaneta 2017/04/19 12:20:42 use IsEmpty() instead of !size
hbos_chromium 2017/04/20 09:07:09 Done.
+ v8::Local<v8::Object> creation_context =
+ script_state->GetContext()->Global();
+ for (const WebRTCDtlsFingerprint& web_fingerprint :
+ certificate_->Fingerprints()) {
+ RTCDtlsFingerprint fingerprint;
+ fingerprint.setAlgorithm(web_fingerprint.Algorithm());
+ fingerprint.setValue(web_fingerprint.Value());
+ fingerprints_.push_back(v8::Global<v8::Value>(
Guido Urdaneta 2017/04/19 12:20:42 I've seen that other cases that return a FrozenArr
hbos_chromium 2017/04/20 09:07:09 Yes, good catch. Without it the array is frozen bu
+ 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] = v8::Local<v8::Value>::New(isolate, fingerprints_[i]);
+ }
+ return fingerprints;
+}
+
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698