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

Side by Side Diff: third_party/WebKit/Source/bindings/modules/v8/ScriptValueSerializerForModules.cpp

Issue 2432493002: Handle RTCCertificate::fromPEM returning nullptr, with a unit test. (Closed)
Patch Set: Created 4 years, 2 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "bindings/modules/v8/ScriptValueSerializerForModules.h" 5 #include "bindings/modules/v8/ScriptValueSerializerForModules.h"
6 6
7 #include "bindings/core/v8/SerializationTag.h" 7 #include "bindings/core/v8/SerializationTag.h"
8 #include "bindings/core/v8/V8Binding.h" 8 #include "bindings/core/v8/V8Binding.h"
9 #include "bindings/modules/v8/V8CryptoKey.h" 9 #include "bindings/modules/v8/V8CryptoKey.h"
10 #include "bindings/modules/v8/V8DOMFileSystem.h" 10 #include "bindings/modules/v8/V8DOMFileSystem.h"
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 return false; 405 return false;
406 String pemCertificate; 406 String pemCertificate;
407 if (!readWebCoreString(&pemCertificate)) 407 if (!readWebCoreString(&pemCertificate))
408 return false; 408 return false;
409 409
410 std::unique_ptr<WebRTCCertificateGenerator> certificateGenerator = 410 std::unique_ptr<WebRTCCertificateGenerator> certificateGenerator =
411 wrapUnique(Platform::current()->createRTCCertificateGenerator()); 411 wrapUnique(Platform::current()->createRTCCertificateGenerator());
412 412
413 std::unique_ptr<WebRTCCertificate> certificate( 413 std::unique_ptr<WebRTCCertificate> certificate(
414 certificateGenerator->fromPEM(pemPrivateKey, pemCertificate)); 414 certificateGenerator->fromPEM(pemPrivateKey, pemCertificate));
415 if (!certificate)
416 return false;
415 RTCCertificate* jsCertificate = new RTCCertificate(std::move(certificate)); 417 RTCCertificate* jsCertificate = new RTCCertificate(std::move(certificate));
416 418
417 *value = 419 *value =
418 toV8(jsCertificate, getScriptState()->context()->Global(), isolate()); 420 toV8(jsCertificate, getScriptState()->context()->Global(), isolate());
419 return !value->IsEmpty(); 421 return !value->IsEmpty();
420 } 422 }
421 423
422 bool SerializedScriptValueReaderForModules::doReadHmacKey( 424 bool SerializedScriptValueReaderForModules::doReadHmacKey(
423 WebCryptoKeyAlgorithm& algorithm, 425 WebCryptoKeyAlgorithm& algorithm,
424 WebCryptoKeyType& type) { 426 WebCryptoKeyType& type) {
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
656 : ScriptValueDeserializer(reader, 658 : ScriptValueDeserializer(reader,
657 messagePorts, 659 messagePorts,
658 arrayBufferContents, 660 arrayBufferContents,
659 imageBitmapContents) {} 661 imageBitmapContents) {}
660 662
661 bool ScriptValueDeserializerForModules::read(v8::Local<v8::Value>* value) { 663 bool ScriptValueDeserializerForModules::read(v8::Local<v8::Value>* value) {
662 return toSerializedScriptValueReaderForModules(reader()).read(value, *this); 664 return toSerializedScriptValueReaderForModules(reader()).read(value, *this);
663 } 665 }
664 666
665 } // namespace blink 667 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698