[WPE][GTK] Cleanups to the certificate decoder
authorcsaavedra@igalia.com <csaavedra@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 24 Oct 2018 13:45:26 +0000 (13:45 +0000)
committercsaavedra@igalia.com <csaavedra@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 24 Oct 2018 13:45:26 +0000 (13:45 +0000)
https://bugs.webkit.org/show_bug.cgi?id=190867

Reviewed by Žan Doberšek.

* Shared/soup/WebCoreArgumentCodersSoup.cpp:
(IPC::ArgumentCoder<CertificateInfo>::decode):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@237380 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit/ChangeLog
Source/WebKit/Shared/soup/WebCoreArgumentCodersSoup.cpp

index 1f234f0..3668bf7 100644 (file)
@@ -1,5 +1,15 @@
 2018-10-24  Claudio Saavedra  <csaavedra@igalia.com>
 
+        [WPE][GTK] Cleanups to the certificate decoder
+        https://bugs.webkit.org/show_bug.cgi?id=190867
+
+        Reviewed by Žan Doberšek.
+
+        * Shared/soup/WebCoreArgumentCodersSoup.cpp:
+        (IPC::ArgumentCoder<CertificateInfo>::decode):
+
+2018-10-24  Claudio Saavedra  <csaavedra@igalia.com>
+
         [WPE][GTK] Cleanups to the certificate encoder
         https://bugs.webkit.org/show_bug.cgi?id=190865
 
index 3331ab0..189b806 100644 (file)
@@ -93,22 +93,18 @@ bool ArgumentCoder<CertificateInfo>::decode(Decoder& decoder, CertificateInfo& c
     if (!chainLength)
         return true;
 
-    GTlsCertificate* issuer = nullptr;
-    GTlsBackend* backend = g_tls_backend_get_default();
+    GType certificateType = g_tls_backend_get_certificate_type(g_tls_backend_get_default());
     GRefPtr<GTlsCertificate> certificate;
     for (uint32_t i = 0; i < chainLength; i++) {
         IPC::DataReference certificateDataReference;
         if (!decoder.decodeVariableLengthByteArray(certificateDataReference))
             return false;
 
-        GByteArray* certificateData = g_byte_array_sized_new(certificateDataReference.size());
-        certificateData = g_byte_array_append(certificateData, certificateDataReference.data(), certificateDataReference.size());
-        GRefPtr<GByteArray> certificateBytes = adoptGRef(certificateData);
+        GRefPtr<GByteArray> certificateData = g_byte_array_sized_new(certificateDataReference.size());
+        certificateData = g_byte_array_append(certificateData.get(), certificateDataReference.data(), certificateDataReference.size());
 
         certificate = adoptGRef(G_TLS_CERTIFICATE(g_initable_new(
-            g_tls_backend_get_certificate_type(backend), 0, 0, "certificate", certificateBytes.get(), "issuer", issuer, nullptr)));
-
-        issuer = certificate.get();
+            certificateType, nullptr, nullptr, "certificate", certificateData.get(), "issuer", certificate.get(), nullptr)));
     }
 
     uint32_t tlsErrors;