Web Inspector: Network: add button to show system certificate dialog
authordrousso@apple.com <drousso@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 17 Nov 2018 18:27:42 +0000 (18:27 +0000)
committerdrousso@apple.com <drousso@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 17 Nov 2018 18:27:42 +0000 (18:27 +0000)
https://bugs.webkit.org/show_bug.cgi?id=191458
<rdar://problem/45977019>

Reviewed by Joseph Pecoraro.

Source/JavaScriptCore:

* inspector/protocol/Network.json:
Add `getSerializedCertificate` command.

Source/WebCore:

Test: http/tests/inspector/network/getSerializedCertificate.html

* inspector/agents/InspectorNetworkAgent.h:
* inspector/agents/InspectorNetworkAgent.cpp:
(WebCore::InspectorNetworkAgent::getSerializedCertificate): Added.

* inspector/InspectorFrontendHost.idl:
* inspector/InspectorFrontendHost.h:
* inspector/InspectorFrontendHost.cpp:
(WebCore::InspectorFrontendHost::supportsShowCertificate): Added.
(WebCore::InspectorFrontendHost::showCertificate): Added.
* inspector/InspectorFrontendClient.h:
(InspectorFrontendClient::showCertificate): Added.
* testing/Internals.cpp:
(InspectorStubFrontend::showCertificate): Added.

* platform/network/cf/CertificateInfo.h:
(WTF::Persistence::encodeCFData): Added.
(WTF::Persistence::decodeCFData): Added.
(WTF::Persistence::encodeSecTrustRef): Added.
(WTF::Persistence::decodeSecTrustRef): Added.
(WTF::Persistence::encodeCertificateChain): Added.
(WTF::Persistence::decodeCertificateChain): Added.
(WTF::Persistence::Coder<WebCore::CertificateInfo>::encode): Added.
(WTF::Persistence::Coder<WebCore::CertificateInfo>::decode): Added.
* platform/network/cf/CertificateInfoCFNet.cpp:
* platform/network/cocoa/CertificateInfoCocoa.mm:

* platform/network/curl/CertificateInfo.h:
(WTF::Persistence::Coder<WebCore::CertificateInfo>::encode): Added.
(WTF::Persistence::Coder<WebCore::CertificateInfo>::decode): Added.

* platform/network/soup/CertificateInfo.h:
(WTF::Persistence::Coder<GRefPtr<GByteArray>>::encode): Added.
(WTF::Persistence::Coder<GRefPtr<GByteArray>>::decode): Added.
(WTF::Persistence::certificatesDataListFromCertificateInfo): Added.
(WTF::Persistence::certificateFromCertificatesDataList): Added.
(WTF::Persistence::Coder<WebCore::CertificateInfo>::encode): Added.
(WTF::Persistence::Coder<WebCore::CertificateInfo>::decode): Added.

Source/WebInspectorUI:

* UserInterface/Controllers/NetworkManager.js:
(WI.NetworkManager.supportsShowCertificate): Added.

* UserInterface/Models/Resource.js:
(WI.Resource.prototype.showCertificate): Added.

* UserInterface/Views/ResourceSecurityContentView.js:
(WI.ResourceSecurityContentView.prototype._refreshCetificateSection):
* UserInterface/Views/ResourceSecurityContentView.css:
(.resource-security .details > .show-certificate > .key): Added.
(.resource-security .details > .show-certificate > .key > .error): Added.

* Localizations/en.lproj/localizedStrings.js:

Source/WebKit:

* UIProcess/WebInspectorProxy.messages.in:
* UIProcess/WebInspectorProxy.h:
* UIProcess/WebInspectorProxy.cpp:
(WebKit::WebInspectorProxy::showCertificate): Added.
(WebKit::WebInspectorProxy::platformShowCertificate): Added.
* UIProcess/mac/WebInspectorProxyGtk.cpp:
(WebKit::WebInspectorProxy::platformShowCertificate): Added.
* UIProcess/mac/WebInspectorProxyMac.mm:
(WebKit::WebInspectorProxy::platformShowCertificate): Added.
* UIProcess/mac/WebInspectorProxyWPE.cpp:
(WebKit::WebInspectorProxy::platformShowCertificate): Added.
* UIProcess/mac/WebInspectorProxyWin.cpp:
(WebKit::WebInspectorProxy::platformShowCertificate): Added.
* WebProcess/WebPage/WebInspectorUI.h:
* WebProcess/WebPage/WebInspectorUI.cpp:
(WebKit::WebInspectorUI::showCertificate): Added.

* UIProcess/RemoteWebInspectorProxy.messages.in:
* UIProcess/RemoteWebInspectorProxy.h:
* UIProcess/RemoteWebInspectorProxy.cpp:
(WebKit::RemoteWebInspectorProxy::showCertificate): Added.
(WebKit::RemoteWebInspectorProxy::platformShowCertificate): Added.
* UIProcess/mac/RemoteWebInspectorProxyGtk.cpp:
(WebKit::RemoteWebInspectorProxy::platformShowCertificate): Added.
* UIProcess/mac/RemoteWebInspectorProxyMac.mm:
(WebKit::RemoteWebInspectorProxy::platformShowCertificate): Added.
* WebProcess/WebPage/RemoteWebInspectorUI.h:
* WebProcess/WebPage/RemoteWebInspectorUI.cpp:
(WebKit::RemoteWebInspectorUI::showCertificate): Added.

* NetworkProcess/cache/NetworkCacheCoders.h:
* NetworkProcess/cache/NetworkCacheCodersCocoa.cpp: Removed.
* NetworkProcess/cache/NetworkCacheCodersCurl.cpp: Removed.
* NetworkProcess/cache/NetworkCacheCodersSoup.cpp: Removed.
Moved `WebCore::CertificateInfo` code for `WTF::Encoder` and `WTF::Decoder` into their
respective platform's CertificateInfo.h file.

* UIProcess/Authentication/mac/WebCredentialMac.mm:

* Configurations/WebKit.xcconfig:
* PlatformMac.cmake:
* PlatformWin.cmake:
* SourcesCocoa.txt:
* SourcesGTK.txt:
* SourcesWPE.txt:
* WebKit.xcodeproj/project.pbxproj:

Source/WebKitLegacy:

* WebCoreSupport/WebInspectorClientIOS.mm:
(WebInspectorFrontendClient::showCertificate): Added.

Source/WebKitLegacy/mac:

* WebCoreSupport/WebInspectorClient.h:
* WebCoreSupport/WebInspectorClient.mm:
(WebInspectorFrontendClient::showCertificate): Added.

* Configurations/WebKitLegacy.xcconfig:

Source/WebKitLegacy/win:

* WebCoreSupport/WebInspectorClient.h:
* WebCoreSupport/WebInspectorClient.cpp:
(WebInspectorFrontendClient::showCertificate): Added.

LayoutTests:

* http/tests/inspector/network/getSerializedCertificate-expected.txt: Added.
* http/tests/inspector/network/getSerializedCertificate.html: Added.

* platform/gtk/TestExpectations:
* platform/wincairo/TestExpectations:
* platform/wpe/TestExpectations:

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

65 files changed:
LayoutTests/ChangeLog
LayoutTests/http/tests/inspector/network/getSerializedCertificate-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/inspector/network/getSerializedCertificate.html [new file with mode: 0644]
LayoutTests/platform/gtk/TestExpectations
LayoutTests/platform/wincairo/TestExpectations
LayoutTests/platform/wpe/TestExpectations
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/inspector/protocol/Network.json
Source/WebCore/ChangeLog
Source/WebCore/inspector/InspectorFrontendClient.h
Source/WebCore/inspector/InspectorFrontendHost.cpp
Source/WebCore/inspector/InspectorFrontendHost.h
Source/WebCore/inspector/InspectorFrontendHost.idl
Source/WebCore/inspector/agents/InspectorNetworkAgent.cpp
Source/WebCore/inspector/agents/InspectorNetworkAgent.h
Source/WebCore/platform/network/cf/CertificateInfo.h
Source/WebCore/platform/network/cf/CertificateInfoCFNet.cpp
Source/WebCore/platform/network/cocoa/CertificateInfoCocoa.mm
Source/WebCore/platform/network/curl/CertificateInfo.h
Source/WebCore/platform/network/soup/CertificateInfo.h
Source/WebCore/testing/Internals.cpp
Source/WebInspectorUI/ChangeLog
Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js
Source/WebInspectorUI/UserInterface/Controllers/NetworkManager.js
Source/WebInspectorUI/UserInterface/Models/Resource.js
Source/WebInspectorUI/UserInterface/Views/ResourceSecurityContentView.css
Source/WebInspectorUI/UserInterface/Views/ResourceSecurityContentView.js
Source/WebKit/ChangeLog
Source/WebKit/Configurations/WebKit.xcconfig
Source/WebKit/NetworkProcess/cache/NetworkCacheCoders.h
Source/WebKit/NetworkProcess/cache/NetworkCacheCodersCocoa.cpp [deleted file]
Source/WebKit/NetworkProcess/cache/NetworkCacheCodersCurl.cpp [deleted file]
Source/WebKit/NetworkProcess/cache/NetworkCacheCodersSoup.cpp [deleted file]
Source/WebKit/PlatformMac.cmake
Source/WebKit/PlatformWin.cmake
Source/WebKit/SourcesCocoa.txt
Source/WebKit/SourcesGTK.txt
Source/WebKit/SourcesWPE.txt
Source/WebKit/UIProcess/Authentication/mac/WebCredentialMac.mm
Source/WebKit/UIProcess/RemoteWebInspectorProxy.cpp
Source/WebKit/UIProcess/RemoteWebInspectorProxy.h
Source/WebKit/UIProcess/RemoteWebInspectorProxy.messages.in
Source/WebKit/UIProcess/WebInspectorProxy.cpp
Source/WebKit/UIProcess/WebInspectorProxy.h
Source/WebKit/UIProcess/WebInspectorProxy.messages.in
Source/WebKit/UIProcess/gtk/RemoteWebInspectorProxyGtk.cpp
Source/WebKit/UIProcess/gtk/WebInspectorProxyGtk.cpp
Source/WebKit/UIProcess/mac/RemoteWebInspectorProxyMac.mm
Source/WebKit/UIProcess/mac/WebInspectorProxyMac.mm
Source/WebKit/UIProcess/win/WebInspectorProxyWin.cpp
Source/WebKit/UIProcess/wpe/WebInspectorProxyWPE.cpp
Source/WebKit/WebKit.xcodeproj/project.pbxproj
Source/WebKit/WebProcess/WebPage/RemoteWebInspectorUI.cpp
Source/WebKit/WebProcess/WebPage/RemoteWebInspectorUI.h
Source/WebKit/WebProcess/WebPage/WebInspectorUI.cpp
Source/WebKit/WebProcess/WebPage/WebInspectorUI.h
Source/WebKitLegacy/ChangeLog
Source/WebKitLegacy/ios/WebCoreSupport/WebInspectorClientIOS.mm
Source/WebKitLegacy/mac/ChangeLog
Source/WebKitLegacy/mac/Configurations/WebKitLegacy.xcconfig
Source/WebKitLegacy/mac/WebCoreSupport/WebInspectorClient.h
Source/WebKitLegacy/mac/WebCoreSupport/WebInspectorClient.mm
Source/WebKitLegacy/win/ChangeLog
Source/WebKitLegacy/win/WebCoreSupport/WebInspectorClient.cpp
Source/WebKitLegacy/win/WebCoreSupport/WebInspectorClient.h

index a0df8ae..4e0c95f 100644 (file)
@@ -1,3 +1,18 @@
+2018-11-17  Devin Rousso  <drousso@apple.com>
+
+        Web Inspector: Network: add button to show system certificate dialog
+        https://bugs.webkit.org/show_bug.cgi?id=191458
+        <rdar://problem/45977019>
+
+        Reviewed by Joseph Pecoraro.
+
+        * http/tests/inspector/network/getSerializedCertificate-expected.txt: Added.
+        * http/tests/inspector/network/getSerializedCertificate.html: Added.
+
+        * platform/gtk/TestExpectations:
+        * platform/wincairo/TestExpectations:
+        * platform/wpe/TestExpectations:
+
 2018-11-17  Zalan Bujtas  <zalan@apple.com>
 
         [LFC][IFC] InlineFormattingState::addDetachingRule should accumulate rules.
diff --git a/LayoutTests/http/tests/inspector/network/getSerializedCertificate-expected.txt b/LayoutTests/http/tests/inspector/network/getSerializedCertificate-expected.txt
new file mode 100644 (file)
index 0000000..c9c66de
--- /dev/null
@@ -0,0 +1,15 @@
+Tests that the NetworkAgent is able to get a serialized certificate for a given request.
+
+
+== Running test suite: Network.getSerializedCertificate
+-- Running test case: Network.getSerializedCertificate.HTTP
+PASS: Should produce an exception.
+Error: No certificate for resource
+
+-- Running test case: Network.getSerializedCertificate.HTTPS
+PASS: Request should have serializable certificate.
+
+-- Running test case: Network.getSerializedCertificate.Invalid
+PASS: Should produce an exception.
+Error: No resource with given identifier found
+
diff --git a/LayoutTests/http/tests/inspector/network/getSerializedCertificate.html b/LayoutTests/http/tests/inspector/network/getSerializedCertificate.html
new file mode 100644 (file)
index 0000000..6c110c9
--- /dev/null
@@ -0,0 +1,67 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<script src="../resources/inspector-test.js"></script>
+<script>
+function createSecureRequest() {
+    let img = document.createElement("img");
+    img.src = "https://localhost:8443/resources/square100.png";
+    document.body.appendChild(img);
+}
+
+function createInsecureRequest() {
+    let img = document.createElement("img");
+    img.src = "http://localhost:8000/resources/square100.png";
+    document.body.appendChild(img);
+}
+
+function test()
+{
+    let suite = InspectorTest.createAsyncSuite("Network.getSerializedCertificate");
+
+    suite.addTestCase({
+        name: "Network.getSerializedCertificate.HTTP",
+        description: "Check if an insecure resource is able to serialize its certificate.",
+        test(resolve, reject) {
+            WI.Resource.awaitEvent(WI.Resource.Event.ResponseReceived)
+            .then((event) => InspectorTest.expectException(() => NetworkAgent.getSerializedCertificate(event.target.requestIdentifier)))
+            .then(resolve, reject);
+
+            InspectorTest.evaluateInPage(`createInsecureRequest()`)
+            .catch(reject);
+        }
+    });
+
+    suite.addTestCase({
+        name: "Network.getSerializedCertificate.HTTPS",
+        description: "Check of a secure resource is able to serialize its certificate.",
+        test(resolve, reject) {
+            WI.Resource.awaitEvent(WI.Resource.Event.ResponseReceived)
+            .then((event) => NetworkAgent.getSerializedCertificate(event.target.requestIdentifier))
+            .then(({serializedCertificate}) => {
+                InspectorTest.expectGreaterThan(serializedCertificate.length, 0, "Request should have serializable certificate.");
+            })
+            .then(resolve, reject);
+
+            InspectorTest.evaluateInPage(`createSecureRequest()`)
+            .catch(reject);
+        }
+    });
+
+    suite.addTestCase({
+        name: "Network.getSerializedCertificate.Invalid",
+        async test() {
+            const invalidRequestIdentifier = "INVALID";
+            await InspectorTest.expectException(() => NetworkAgent.getSerializedCertificate(invalidRequestIdentifier));
+        }
+    });
+
+    suite.runTestCasesAndFinish();
+}
+</script>
+</head>
+<body onload="runTest()">
+    <p>Tests that the NetworkAgent is able to get a serialized certificate for a given request.</p>
+</body>
+</html>
index f6a83b4..4242df8 100644 (file)
@@ -1974,6 +1974,7 @@ webkit.org/b/186750 imported/w3c/web-platform-tests/WebCryptoAPI/derive_bits_key
 
 webkit.org/b/186847 http/tests/inspector/network/resource-sizes-memory-cache.html [ Pass Failure ]
 webkit.org/b/191497 http/tests/inspector/network/resource-response-security.html [ Skip ]
+webkit.org/b/191497 http/tests/inspector/network/getSerializedCertificate.html [ Skip ]
 
 webkit.org/b/186851 imported/w3c/web-platform-tests/xhr/formdata.htm [ Pass Failure ]
 webkit.org/b/186851 imported/w3c/web-platform-tests/xhr/formdata-blob.htm [ Pass Failure ]
index 04a8483..3a414c3 100644 (file)
@@ -1000,6 +1000,7 @@ http/tests/xmlhttprequest/upload-progress-events.html [ Failure ]
 http/tests/xmlviewer [ Skip ]
 
 webkit.org/b/191498 http/tests/inspector/network/resource-response-security.html [ Skip ]
+webkit.org/b/191498 http/tests/inspector/network/getSerializedCertificate.html [ Skip ]
 
 #///////////////////////////////////////////////////////////////////////////////
 # Issue categories below are shared with other platforms (primarily AppleWin)
index 38fd8b4..7d87f4f 100644 (file)
@@ -531,6 +531,7 @@ Bug(WPE) fast/history/page-cache-notification-suspendable.html [ Skip ]
 Bug(WPE) fast/dom/HTMLAnchorElement [ Skip ]
 
 webkit.org/b/191497 http/tests/inspector/network/resource-response-security.html [ Skip ]
+webkit.org/b/191497 http/tests/inspector/network/getSerializedCertificate.html [ Skip ]
 
 #////////////////////////////////////////////////////////////////////////////////////////
 # 4. TESTS PASSING
index f87b751..081afea 100644 (file)
@@ -1,3 +1,14 @@
+2018-11-17  Devin Rousso  <drousso@apple.com>
+
+        Web Inspector: Network: add button to show system certificate dialog
+        https://bugs.webkit.org/show_bug.cgi?id=191458
+        <rdar://problem/45977019>
+
+        Reviewed by Joseph Pecoraro.
+
+        * inspector/protocol/Network.json:
+        Add `getSerializedCertificate` command.
+
 2018-11-17  Dominik Infuehr  <dinfuehr@igalia.com>
 
         Fix build with disabled DFG/FTL
index 03aebce..338d745 100644 (file)
             ]
         },
         {
+            "name": "getSerializedCertificate",
+            "description": "Fetches a serialized secure certificate for the given requestId to be displayed via InspectorFrontendHost.showCertificate.",
+            "parameters": [
+                { "name": "requestId", "$ref": "RequestId" }
+            ],
+            "returns": [
+                { "name": "serializedCertificate", "type": "string", "description": "Represents a base64 encoded WebCore::CertificateInfo object." }
+            ]
+        },
+        {
             "name": "resolveWebSocket",
             "description": "Resolves JavaScript WebSocket object for given request id.",
             "parameters": [
index e8e2107..3bafc43 100644 (file)
@@ -1,3 +1,51 @@
+2018-11-17  Devin Rousso  <drousso@apple.com>
+
+        Web Inspector: Network: add button to show system certificate dialog
+        https://bugs.webkit.org/show_bug.cgi?id=191458
+        <rdar://problem/45977019>
+
+        Reviewed by Joseph Pecoraro.
+
+        Test: http/tests/inspector/network/getSerializedCertificate.html
+
+        * inspector/agents/InspectorNetworkAgent.h:
+        * inspector/agents/InspectorNetworkAgent.cpp:
+        (WebCore::InspectorNetworkAgent::getSerializedCertificate): Added.
+
+        * inspector/InspectorFrontendHost.idl:
+        * inspector/InspectorFrontendHost.h:
+        * inspector/InspectorFrontendHost.cpp:
+        (WebCore::InspectorFrontendHost::supportsShowCertificate): Added.
+        (WebCore::InspectorFrontendHost::showCertificate): Added.
+        * inspector/InspectorFrontendClient.h:
+        (InspectorFrontendClient::showCertificate): Added.
+        * testing/Internals.cpp:
+        (InspectorStubFrontend::showCertificate): Added.
+
+        * platform/network/cf/CertificateInfo.h:
+        (WTF::Persistence::encodeCFData): Added.
+        (WTF::Persistence::decodeCFData): Added.
+        (WTF::Persistence::encodeSecTrustRef): Added.
+        (WTF::Persistence::decodeSecTrustRef): Added.
+        (WTF::Persistence::encodeCertificateChain): Added.
+        (WTF::Persistence::decodeCertificateChain): Added.
+        (WTF::Persistence::Coder<WebCore::CertificateInfo>::encode): Added.
+        (WTF::Persistence::Coder<WebCore::CertificateInfo>::decode): Added.
+        * platform/network/cf/CertificateInfoCFNet.cpp:
+        * platform/network/cocoa/CertificateInfoCocoa.mm:
+
+        * platform/network/curl/CertificateInfo.h:
+        (WTF::Persistence::Coder<WebCore::CertificateInfo>::encode): Added.
+        (WTF::Persistence::Coder<WebCore::CertificateInfo>::decode): Added.
+
+        * platform/network/soup/CertificateInfo.h:
+        (WTF::Persistence::Coder<GRefPtr<GByteArray>>::encode): Added.
+        (WTF::Persistence::Coder<GRefPtr<GByteArray>>::decode): Added.
+        (WTF::Persistence::certificatesDataListFromCertificateInfo): Added.
+        (WTF::Persistence::certificateFromCertificatesDataList): Added.
+        (WTF::Persistence::Coder<WebCore::CertificateInfo>::encode): Added.
+        (WTF::Persistence::Coder<WebCore::CertificateInfo>::decode): Added.
+
 2018-11-17  Zalan Bujtas  <zalan@apple.com>
 
         [LFC][IFC] InlineFormattingState::addDetachingRule should accumulate rules.
index 3623100..7403efb 100644 (file)
@@ -30,6 +30,7 @@
 
 #pragma once
 
+#include "CertificateInfo.h"
 #include "UserInterfaceLayoutDirection.h"
 #include <wtf/Forward.h>
 #include <wtf/text/WTFString.h>
@@ -74,6 +75,7 @@ public:
     virtual void append(const WTF::String& url, const WTF::String& content) = 0;
 
     virtual void inspectedURLChanged(const String&) = 0;
+    virtual void showCertificate(const CertificateInfo&) = 0;
 
     virtual void pagePaused() { }
     virtual void pageUnpaused() { }
index 18cf9c8..b1773aa 100644 (file)
@@ -30,6 +30,7 @@
 #include "config.h"
 #include "InspectorFrontendHost.h"
 
+#include "CertificateInfo.h"
 #include "ContextMenu.h"
 #include "ContextMenuController.h"
 #include "ContextMenuItem.h"
@@ -56,7 +57,7 @@
 #include <JavaScriptCore/ScriptFunctionCall.h>
 #include <pal/system/Sound.h>
 #include <wtf/StdLibExtras.h>
-
+#include <wtf/text/Base64.h>
 
 namespace WebCore {
 
@@ -438,4 +439,34 @@ void InspectorFrontendHost::inspectInspector()
         m_frontendPage->inspectorController().show();
 }
 
+bool InspectorFrontendHost::supportsShowCertificate() const
+{
+#if PLATFORM(COCOA)
+    return true;
+#else
+    return false;
+#endif
+}
+
+bool InspectorFrontendHost::showCertificate(const String& serializedCertificate)
+{
+    if (!m_client)
+        return false;
+
+    Vector<uint8_t> data;
+    if (!base64Decode(serializedCertificate, data))
+        return false;
+
+    CertificateInfo certificateInfo;
+    WTF::Persistence::Decoder decoder(data.data(), data.size());
+    if (!decoder.decode(certificateInfo))
+        return false;
+
+    if (certificateInfo.isEmpty())
+        return false;
+
+    m_client->showCertificate(certificateInfo);
+    return true;
+}
+
 } // namespace WebCore
index 654f060..6a0a275 100644 (file)
@@ -60,6 +60,9 @@ public:
     void bringToFront();
     void inspectedURLChanged(const String&);
 
+    bool supportsShowCertificate() const;
+    bool showCertificate(const String& serializedCertificate);
+
     void setZoomFactor(float);
     float zoomFactor();
 
index d53418b..2b9a0d7 100644 (file)
@@ -39,6 +39,9 @@
     void bringToFront();
     void inspectedURLChanged(DOMString newURL);
 
+    readonly attribute boolean supportsShowCertificate;
+    boolean showCertificate(DOMString serializedCertificate);
+
     void setZoomFactor(unrestricted float zoom);
     float zoomFactor();
 
index ad9c8ad..12a4e62 100644 (file)
@@ -83,6 +83,7 @@
 #include <wtf/Lock.h>
 #include <wtf/RefPtr.h>
 #include <wtf/Stopwatch.h>
+#include <wtf/persistence/PersistentEncoder.h>
 #include <wtf/text/Base64.h>
 #include <wtf/text/StringBuilder.h>
 
@@ -906,6 +907,25 @@ void InspectorNetworkAgent::loadResource(const String& frameId, const String& ur
     inspectorThreadableLoaderClient->setLoader(WTFMove(loader));
 }
 
+void InspectorNetworkAgent::getSerializedCertificate(ErrorString& errorString, const String& requestId, String* serializedCertificate)
+{
+    auto* resourceData = m_resourcesData->data(requestId);
+    if (!resourceData) {
+        errorString = "No resource with given identifier found"_s;
+        return;
+    }
+
+    auto& certificate = resourceData->certificateInfo();
+    if (!certificate || certificate.value().isEmpty()) {
+        errorString = "No certificate for resource"_s;
+        return;
+    }
+
+    WTF::Persistence::Encoder encoder;
+    encoder << certificate.value();
+    *serializedCertificate = base64Encode(encoder.buffer(), encoder.bufferSize());
+}
+
 WebSocket* InspectorNetworkAgent::webSocketForRequestId(const String& requestId)
 {
     LockHolder lock(WebSocket::allActiveWebSocketsMutex());
index 781c004..5239422 100644 (file)
@@ -116,6 +116,7 @@ public:
     void getResponseBody(ErrorString&, const String& requestId, String* content, bool* base64Encoded) final;
     void setResourceCachingDisabled(ErrorString&, bool disabled) final;
     void loadResource(const String& frameId, const String& url, Ref<LoadResourceCallback>&&) final;
+    void getSerializedCertificate(ErrorString&, const String& requestId, String* serializedCertificate) final;
     void resolveWebSocket(ErrorString&, const String& requestId, const String* objectGroup, RefPtr<Inspector::Protocol::Runtime::RemoteObject>&) final;
 
     virtual String loaderIdentifier(DocumentLoader*) = 0;
index 3907960..3a71183 100644 (file)
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef CertificateInfo_h
-#define CertificateInfo_h
+#pragma once
 
 #include "CertificateInfoBase.h"
 #include <wtf/RetainPtr.h>
+#include <wtf/Vector.h>
+#include <wtf/cf/TypeCastsCF.h>
+#include <wtf/persistence/PersistentCoders.h>
+#include <wtf/persistence/PersistentDecoder.h>
+#include <wtf/persistence/PersistentEncoder.h>
 
 #if PLATFORM(COCOA)
+#include <Security/SecCertificate.h>
 #include <Security/SecTrust.h>
+#include <wtf/spi/cocoa/SecuritySPI.h>
+
+WTF_DECLARE_CF_TYPE_TRAIT(SecCertificate);
 #endif
 
 namespace WebCore {
@@ -87,5 +95,166 @@ private:
     mutable RetainPtr<CFArrayRef> m_certificateChain;
 };
 
+} // namespace WebCore
+
+namespace WTF {
+namespace Persistence {
+
+static void encodeCFData(Encoder& encoder, CFDataRef data)
+{
+    uint64_t length = CFDataGetLength(data);
+    const uint8_t* bytePtr = CFDataGetBytePtr(data);
+
+    encoder << length;
+    encoder.encodeFixedLengthData(bytePtr, static_cast<size_t>(length));
+}
+
+static bool decodeCFData(Decoder& decoder, RetainPtr<CFDataRef>& data)
+{
+    uint64_t size = 0;
+    if (!decoder.decode(size))
+        return false;
+
+    Vector<uint8_t> vector(static_cast<size_t>(size));
+    if (!decoder.decodeFixedLengthData(vector.data(), vector.size()))
+        return false;
+
+    data = adoptCF(CFDataCreate(nullptr, vector.data(), vector.size()));
+    return true;
+}
+
+#if HAVE(SEC_TRUST_SERIALIZATION)
+static void encodeSecTrustRef(Encoder& encoder, SecTrustRef trust)
+{
+    auto data = adoptCF(SecTrustSerialize(trust, nullptr));
+    if (!data) {
+        encoder << false;
+        return;
+    }
+
+    encoder << true;
+    encodeCFData(encoder, data.get());
+}
+
+static bool decodeSecTrustRef(Decoder& decoder, RetainPtr<SecTrustRef>& result)
+{
+    bool hasTrust;
+    if (!decoder.decode(hasTrust))
+        return false;
+
+    if (!hasTrust)
+        return true;
+
+    RetainPtr<CFDataRef> trustData;
+    if (!decodeCFData(decoder, trustData))
+        return false;
+
+    auto trust = adoptCF(SecTrustDeserialize(trustData.get(), nullptr));
+    if (!trust)
+        return false;
+
+    result = WTFMove(trust);
+    return true;
 }
 #endif
+
+#if PLATFORM(COCOA)
+static void encodeCertificateChain(Encoder& encoder, CFArrayRef certificateChain)
+{
+    CFIndex size = CFArrayGetCount(certificateChain);
+    Vector<CFTypeRef, 32> values(size);
+
+    CFArrayGetValues(certificateChain, CFRangeMake(0, size), values.data());
+
+    encoder << static_cast<uint64_t>(size);
+
+    for (CFIndex i = 0; i < size; ++i) {
+        ASSERT(values[i]);
+        auto data = adoptCF(SecCertificateCopyData(checked_cf_cast<SecCertificateRef>(values[i])));
+        encodeCFData(encoder, data.get());
+    }
+}
+
+static bool decodeCertificateChain(Decoder& decoder, RetainPtr<CFArrayRef>& certificateChain)
+{
+    uint64_t size;
+    if (!decoder.decode(size))
+        return false;
+
+    auto array = adoptCF(CFArrayCreateMutable(0, 0, &kCFTypeArrayCallBacks));
+
+    for (size_t i = 0; i < size; ++i) {
+        RetainPtr<CFDataRef> data;
+        if (!decodeCFData(decoder, data))
+            return false;
+
+        auto certificate = adoptCF(SecCertificateCreateWithData(0, data.get()));
+        CFArrayAppendValue(array.get(), certificate.get());
+    }
+
+    certificateChain = WTFMove(array);
+    return true;
+}
+#endif
+
+template<> struct Coder<WebCore::CertificateInfo> {
+    static void encode(Encoder& encoder, const WebCore::CertificateInfo& certificateInfo)
+    {
+        encoder.encodeEnum(certificateInfo.type());
+
+        switch (certificateInfo.type()) {
+#if HAVE(SEC_TRUST_SERIALIZATION)
+        case WebCore::CertificateInfo::Type::Trust:
+            encodeSecTrustRef(encoder, certificateInfo.trust());
+            break;
+#endif
+#if PLATFORM(COCOA)
+        case WebCore::CertificateInfo::Type::CertificateChain: {
+            encodeCertificateChain(encoder, certificateInfo.certificateChain());
+            break;
+        }
+#endif
+        case WebCore::CertificateInfo::Type::None:
+            // Do nothing.
+            break;
+        }
+    }
+
+    static bool decode(Decoder& decoder, WebCore::CertificateInfo& certificateInfo)
+    {
+        WebCore::CertificateInfo::Type certificateInfoType;
+        if (!decoder.decodeEnum(certificateInfoType))
+            return false;
+
+        switch (certificateInfoType) {
+#if HAVE(SEC_TRUST_SERIALIZATION)
+        case WebCore::CertificateInfo::Type::Trust: {
+            RetainPtr<SecTrustRef> trust;
+            if (!decodeSecTrustRef(decoder, trust))
+                return false;
+
+            certificateInfo = WebCore::CertificateInfo(WTFMove(trust));
+            return true;
+        }
+#endif
+#if PLATFORM(COCOA)
+        case WebCore::CertificateInfo::Type::CertificateChain: {
+            RetainPtr<CFArrayRef> certificateChain;
+            if (!decodeCertificateChain(decoder, certificateChain))
+                return false;
+
+            certificateInfo = WebCore::CertificateInfo(WTFMove(certificateChain));
+            return true;
+        }
+#endif
+        case WebCore::CertificateInfo::Type::None:
+            // Do nothing.
+            break;
+        }
+
+        return true;
+    }
+};
+
+} // namespace WTF::Persistence
+} // namespace WTF
index b103445..448def8 100644 (file)
 #include "config.h"
 #include "CertificateInfo.h"
 
-#include "NotImplemented.h"
-#include <wtf/cf/TypeCastsCF.h>
-
-#if PLATFORM(COCOA)
-#include <Security/SecCertificate.h>
-#include <wtf/spi/cocoa/SecuritySPI.h>
-
-WTF_DECLARE_CF_TYPE_TRAIT(SecCertificate);
-#endif
-
 namespace WebCore {
 
 #if PLATFORM(COCOA)
index 29c05b0..e57fdd4 100644 (file)
 #include "config.h"
 #include "CertificateInfo.h"
 
-#include <Security/SecCertificate.h>
-#include <wtf/cf/TypeCastsCF.h>
-#include <wtf/spi/cocoa/SecuritySPI.h>
-
-WTF_DECLARE_CF_TYPE_TRAIT(SecCertificate);
-
 namespace WebCore {
 
 #ifndef NDEBUG
index 274c8f5..5cb982a 100644 (file)
@@ -28,6 +28,9 @@
 #include "CertificateInfoBase.h"
 #include "NotImplemented.h"
 #include <wtf/Vector.h>
+#include <wtf/persistence/PersistentCoders.h>
+#include <wtf/persistence/PersistentDecoder.h>
+#include <wtf/persistence/PersistentEncoder.h>
 
 namespace WebCore {
 
@@ -62,3 +65,20 @@ inline bool operator==(const CertificateInfo& a, const CertificateInfo& b)
 }
 
 } // namespace WebCore
+
+namespace WTF {
+namespace Persistence {
+
+void Coder<WebCore::CertificateInfo>::encode(Encoder& encoder, const WebCore::CertificateInfo& certificateInfo)
+{
+    notImplemented();
+}
+
+bool Coder<WebCore::CertificateInfo>::decode(Decoder& decoder, WebCore::CertificateInfo& certificateInfo)
+{
+    notImplemented();
+    return false;
+}
+
+} // namespace WTF::Persistence
+} // namespace WTF
index d0f6e22..ba31fc1 100644 (file)
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef CertificateInfo_h
-#define CertificateInfo_h
+#pragma once
 
 #include "CertificateInfoBase.h"
 #include "NotImplemented.h"
 #include <libsoup/soup.h>
+#include <wtf/Vector.h>
 #include <wtf/glib/GRefPtr.h>
+#include <wtf/persistence/PersistentCoders.h>
+#include <wtf/persistence/PersistentDecoder.h>
+#include <wtf/persistence/PersistentEncoder.h>
 
 namespace WebCore {
 
@@ -63,4 +66,94 @@ private:
 
 } // namespace WebCore
 
-#endif // CertificateInfo_h
+namespace WTF {
+namespace Persistence {
+
+template<> struct Coder<GRefPtr<GByteArray>> {
+    static void encode(Encoder &encoder, const GRefPtr<GByteArray>& byteArray)
+    {
+        encoder << static_cast<uint32_t>(byteArray->len);
+        encoder.encodeFixedLengthData(byteArray->data, byteArray->len);
+    }
+
+    static bool decode(Decoder &decoder, GRefPtr<GByteArray>& byteArray)
+    {
+        uint32_t size;
+        if (!decoder.decode(size))
+            return false;
+
+        byteArray = adoptGRef(g_byte_array_sized_new(size));
+        return decoder.decodeFixedLengthData(byteArray->data, byteArray->len);
+    }
+};
+
+static Vector<GRefPtr<GByteArray>> certificatesDataListFromCertificateInfo(const WebCore::CertificateInfo &certificateInfo)
+{
+    auto* certificate = certificateInfo.certificate();
+    if (!certificate)
+        return { };
+
+    Vector<GRefPtr<GByteArray>> certificatesDataList;
+    for (; certificate; certificate = g_tls_certificate_get_issuer(certificate)) {
+        GByteArray* certificateData = nullptr;
+        g_object_get(G_OBJECT(certificate), "certificate", &certificateData, nullptr);
+
+        if (!certificateData) {
+            certificatesDataList.clear();
+            break;
+        }
+        certificatesDataList.append(adoptGRef(certificateData));
+    }
+
+    // Reverse so that the list starts from the rootmost certificate.
+    certificatesDataList.reverse();
+
+    return certificatesDataList;
+}
+
+static GRefPtr<GTlsCertificate> certificateFromCertificatesDataList(const Vector<GRefPtr<GByteArray>> &certificatesDataList)
+{
+    GType certificateType = g_tls_backend_get_certificate_type(g_tls_backend_get_default());
+    GRefPtr<GTlsCertificate> certificate;
+    for (auto& certificateData : certificatesDataList) {
+        certificate = adoptGRef(G_TLS_CERTIFICATE(g_initable_new(
+            certificateType, nullptr, nullptr, "certificate", certificateData.get(), "issuer", certificate.get(), nullptr)));
+    }
+
+    return certificate;
+}
+
+template<> struct Coder<WebCore::CertificateInfo> {
+    static void encode(Encoder& encoder, const WebCore::CertificateInfo& certificateInfo)
+    {
+        auto certificatesDataList = certificatesDataListFromCertificateInfo(certificateInfo);
+
+        encoder << certificatesDataList;
+
+        if (certificatesDataList.isEmpty())
+            return;
+
+        encoder << static_cast<uint32_t>(certificateInfo.tlsErrors());
+    }
+
+    static bool decode(Decoder& decoder, WebCore::CertificateInfo& certificateInfo)
+    {
+        Vector<GRefPtr<GByteArray>> certificatesDataList;
+        if (!decoder.decode(certificatesDataList))
+            return false;
+
+        if (certificatesDataList.isEmpty())
+            return true;
+        certificateInfo.setCertificate(certificateFromCertificatesDataList(certificatesDataList).get());
+
+        uint32_t tlsErrors;
+        if (!decoder.decode(tlsErrors))
+            return false;
+        certificateInfo.setTLSErrors(static_cast<GTlsCertificateFlags>(tlsErrors));
+
+        return true;
+    }
+};
+
+} // namespace WTF::Persistence
+} // namespace WTF
index 19318fc..6051c2f 100644 (file)
@@ -45,6 +45,7 @@
 #include "CacheStorageProvider.h"
 #include "CachedImage.h"
 #include "CachedResourceLoader.h"
+#include "CertificateInfo.h"
 #include "Chrome.h"
 #include "ClientOrigin.h"
 #include "ComposedTreeIterator.h"
@@ -309,6 +310,7 @@ private:
     void bringToFront() final { }
     String localizedStringsURL() final { return String(); }
     void inspectedURLChanged(const String&) final { }
+    void showCertificate(const CertificateInfo&) final { }
     void setAttachedWindowHeight(unsigned) final { }
     void setAttachedWindowWidth(unsigned) final { }
 
index 804b279..abd8ed3 100644 (file)
@@ -1,3 +1,25 @@
+2018-11-17  Devin Rousso  <drousso@apple.com>
+
+        Web Inspector: Network: add button to show system certificate dialog
+        https://bugs.webkit.org/show_bug.cgi?id=191458
+        <rdar://problem/45977019>
+
+        Reviewed by Joseph Pecoraro.
+
+        * UserInterface/Controllers/NetworkManager.js:
+        (WI.NetworkManager.supportsShowCertificate): Added.
+
+        * UserInterface/Models/Resource.js:
+        (WI.Resource.prototype.showCertificate): Added.
+
+        * UserInterface/Views/ResourceSecurityContentView.js:
+        (WI.ResourceSecurityContentView.prototype._refreshCetificateSection):
+        * UserInterface/Views/ResourceSecurityContentView.css:
+        (.resource-security .details > .show-certificate > .key): Added.
+        (.resource-security .details > .show-certificate > .key > .error): Added.
+
+        * Localizations/en.lproj/localizedStrings.js:
+
 2018-11-16  Devin Rousso  <drousso@apple.com>
 
         Web Inspector: Audit: add default tests
index 2f9fbb5..c9c561f 100644 (file)
@@ -830,6 +830,7 @@ localizedStrings["Show all actions"] = "Show all actions";
 localizedStrings["Show all resources"] = "Show all resources";
 localizedStrings["Show compositing borders"] = "Show compositing borders";
 localizedStrings["Show errors logged to the Console"] = "Show errors logged to the Console";
+localizedStrings["Show full certificate"] = "Show full certificate";
 localizedStrings["Show hidden tabs"] = "Show hidden tabs";
 localizedStrings["Show messages logged to the Console"] = "Show messages logged to the Console";
 localizedStrings["Show network information"] = "Show network information";
@@ -966,6 +967,7 @@ localizedStrings["Type information for variable: %s"] = "Type information for va
 localizedStrings["URL"] = "URL";
 localizedStrings["Unable to determine path to property from root"] = "Unable to determine path to property from root";
 localizedStrings["Unable to parse as JSON: %s"] = "Unable to parse as JSON: %s";
+localizedStrings["Unable to show certificate for \u201C%s\u201C"] = "Unable to show certificate for \u201C%s\u201C";
 localizedStrings["Uncaught Exceptions"] = "Uncaught Exceptions";
 localizedStrings["Undefined custom element"] = "Undefined custom element";
 localizedStrings["Unique"] = "Unique";
index 96e2ead..0344e55 100644 (file)
@@ -47,6 +47,13 @@ WI.NetworkManager = class NetworkManager extends WI.Object
         WI.Frame.addEventListener(WI.Frame.Event.MainResourceDidChange, this._handleFrameMainResourceDidChange, this);
     }
 
+    // Static
+
+    static supportsShowCertificate()
+    {
+        return InspectorFrontendHost.supportsShowCertificate && window.NetworkAgent && NetworkAgent.getSerializedCertificate;
+    }
+
     // Target
 
     initializeTarget(target)
index 6a647d2..a0a9beb 100644 (file)
@@ -1060,6 +1060,26 @@ WI.Resource = class Resource extends WI.SourceCode
         InspectorFrontendHost.copyText(curlCommand);
         return curlCommand;
     }
+
+    async showCertificate()
+    {
+        let errorString = WI.UIString("Unable to show certificate for \u201C%s\u201C").format(this.url);
+
+        try {
+            let {serializedCertificate} = await NetworkAgent.getSerializedCertificate(this._requestIdentifier);
+            if (InspectorFrontendHost.showCertificate(serializedCertificate))
+                return;
+        } catch (e) {
+            console.error(e);
+            throw errorString;
+        }
+
+        let consoleMessage = new WI.ConsoleMessage(this._target, WI.ConsoleMessage.MessageSource.Other, WI.ConsoleMessage.MessageLevel.Error, errorString);
+        consoleMessage.shouldRevealConsole = true;
+        WI.consoleLogViewController.appendConsoleMessage(consoleMessage);
+
+        throw errorString;
+    }
 };
 
 WI.Resource.TypeIdentifier = "resource";
index a676016..2f0015b 100644 (file)
@@ -31,6 +31,17 @@ body[dir] .resource-security > section.certificate > .details {
     color: var(--network-dns-color);
 }
 
+.resource-security .details > .show-certificate > .key {
+    display: inline-flex;
+    align-items: center;
+}
+
+.resource-security .details > .show-certificate > .key > .error {
+    width: 14px;
+    height: 14px;
+    -webkit-margin-start: 2px;
+}
+
 .resource-security .dns-name + .dns-name > .key,
 .resource-security .ip-address + .ip-address > .key {
     color: transparent;
index 24fc166..da431a0 100644 (file)
@@ -183,6 +183,30 @@ WI.ResourceSecurityContentView = class ResourceSecurityContentView extends WI.Co
             return;
         }
 
+        if (WI.NetworkManager.supportsShowCertificate()) {
+            let button = document.createElement("button");
+            button.textContent = WI.UIString("Show full certificate");
+
+            let errorElement = null;
+            button.addEventListener("click", (event) => {
+                this._resource.showCertificate()
+                .then(() => {
+                    if (errorElement) {
+                        errorElement.remove();
+                        errorElement = null;
+                    }
+                })
+                .catch((error) => {
+                    if (!errorElement)
+                        errorElement = WI.ImageUtilities.useSVGSymbol("Images/Error.svg", "error", error);
+                    button.insertAdjacentElement("afterend", errorElement);
+                });
+            });
+
+            let pairElement = this._certificateSection.appendKeyValuePair(button);
+            pairElement.classList.add("show-certificate");
+        }
+
         this._certificateSection.appendKeyValuePair(WI.UIString("Subject"), certificate.subject);
 
         let appendFormattedDate = (key, timestamp) => {
index 2a0fb71..a671bf4 100644 (file)
@@ -1,3 +1,58 @@
+2018-11-17  Devin Rousso  <drousso@apple.com>
+
+        Web Inspector: Network: add button to show system certificate dialog
+        https://bugs.webkit.org/show_bug.cgi?id=191458
+        <rdar://problem/45977019>
+
+        Reviewed by Joseph Pecoraro.
+
+        * UIProcess/WebInspectorProxy.messages.in:
+        * UIProcess/WebInspectorProxy.h:
+        * UIProcess/WebInspectorProxy.cpp:
+        (WebKit::WebInspectorProxy::showCertificate): Added.
+        (WebKit::WebInspectorProxy::platformShowCertificate): Added.
+        * UIProcess/mac/WebInspectorProxyGtk.cpp:
+        (WebKit::WebInspectorProxy::platformShowCertificate): Added.
+        * UIProcess/mac/WebInspectorProxyMac.mm:
+        (WebKit::WebInspectorProxy::platformShowCertificate): Added.
+        * UIProcess/mac/WebInspectorProxyWPE.cpp:
+        (WebKit::WebInspectorProxy::platformShowCertificate): Added.
+        * UIProcess/mac/WebInspectorProxyWin.cpp:
+        (WebKit::WebInspectorProxy::platformShowCertificate): Added.
+        * WebProcess/WebPage/WebInspectorUI.h:
+        * WebProcess/WebPage/WebInspectorUI.cpp:
+        (WebKit::WebInspectorUI::showCertificate): Added.
+
+        * UIProcess/RemoteWebInspectorProxy.messages.in:
+        * UIProcess/RemoteWebInspectorProxy.h:
+        * UIProcess/RemoteWebInspectorProxy.cpp:
+        (WebKit::RemoteWebInspectorProxy::showCertificate): Added.
+        (WebKit::RemoteWebInspectorProxy::platformShowCertificate): Added.
+        * UIProcess/mac/RemoteWebInspectorProxyGtk.cpp:
+        (WebKit::RemoteWebInspectorProxy::platformShowCertificate): Added.
+        * UIProcess/mac/RemoteWebInspectorProxyMac.mm:
+        (WebKit::RemoteWebInspectorProxy::platformShowCertificate): Added.
+        * WebProcess/WebPage/RemoteWebInspectorUI.h:
+        * WebProcess/WebPage/RemoteWebInspectorUI.cpp:
+        (WebKit::RemoteWebInspectorUI::showCertificate): Added.
+
+        * NetworkProcess/cache/NetworkCacheCoders.h:
+        * NetworkProcess/cache/NetworkCacheCodersCocoa.cpp: Removed.
+        * NetworkProcess/cache/NetworkCacheCodersCurl.cpp: Removed.
+        * NetworkProcess/cache/NetworkCacheCodersSoup.cpp: Removed.
+        Moved `WebCore::CertificateInfo` code for `WTF::Encoder` and `WTF::Decoder` into their
+        respective platform's CertificateInfo.h file.
+
+        * UIProcess/Authentication/mac/WebCredentialMac.mm:
+
+        * Configurations/WebKit.xcconfig:
+        * PlatformMac.cmake:
+        * PlatformWin.cmake:
+        * SourcesCocoa.txt:
+        * SourcesGTK.txt:
+        * SourcesWPE.txt:
+        * WebKit.xcodeproj/project.pbxproj:
+
 2018-11-16  Chris Dumez  <cdumez@apple.com>
 
         Regression(ProcessPrewarming) Assertion hit in NetworkProcessProxy destructor
index 730a4f1..6bb8c4f 100644 (file)
@@ -115,13 +115,16 @@ WK_SAFE_BROWSING_LDFLAGS_iphonesimulator[sdk=iphone*10.*] = ;
 WK_SAFE_BROWSING_LDFLAGS_macosx = $(WK_SAFE_BROWSING_LDFLAGS$(WK_MACOS_1013));
 WK_SAFE_BROWSING_LDFLAGS_MACOS_SINCE_1013 = -weak_framework SafariSafeBrowsing;
 
+WK_SECURITY_INTERFACE_LDFLAGS = $(WK_SECURITY_INTERFACE_LDFLAGS_$(WK_PLATFORM_NAME));
+WK_SECURITY_INTERFACE_LDFLAGS_macosx = -framework SecurityInterface;
+
 WK_UIKIT_LDFLAGS = $(WK_UIKIT_LDFLAGS_$(WK_COCOA_TOUCH));
 WK_UIKIT_LDFLAGS_cocoatouch = -framework UIKit;
 
 WK_URL_FORMATTING_LDFLAGS = $(WK_URL_FORMATTING_LDFLAGS_$(WK_HAVE_URL_FORMATTING));
 WK_URL_FORMATTING_LDFLAGS_YES = -framework URLFormatting;
 
-FRAMEWORK_AND_LIBRARY_LDFLAGS = -lobjc -framework CFNetwork -framework CoreAudio -framework CoreFoundation -framework CoreGraphics -framework CoreText -framework Foundation -framework ImageIO -framework IOKit -framework WebKitLegacy -lnetwork $(WK_ACCESSIBILITY_LDFLAGS) $(WK_APPKIT_LDFLAGS) $(WK_ASSERTION_SERVICES_LDFLAGS) $(WK_CARBON_LDFLAGS) $(WK_CORE_PDF_LDFLAGS) $(WK_CORE_PREDICTION_LDFLAGS) $(WK_CORE_SERVICES_LDFLAGS) $(WK_DEVICE_IDENTITY_LDFLAGS) $(WK_GRAPHICS_SERVICES_LDFLAGS) $(WK_IOSURFACE_LDFLAGS) $(WK_LIBSANDBOX_LDFLAGS) $(WK_LIBWEBRTC_LDFLAGS) $(WK_MOBILE_CORE_SERVICES_LDFLAGS) $(WK_MOBILE_GESTALT_LDFLAGS) $(WK_OPENGL_LDFLAGS) $(WK_PDFKIT_LDFLAGS) $(WK_PROXIMITY_NETWORKING_LDFLAGS) $(WK_SAFE_BROWSING_LDFLAGS) $(WK_UIKIT_LDFLAGS) $(WK_URL_FORMATTING_LDFLAGS);
+FRAMEWORK_AND_LIBRARY_LDFLAGS = -lobjc -framework CFNetwork -framework CoreAudio -framework CoreFoundation -framework CoreGraphics -framework CoreText -framework Foundation -framework ImageIO -framework IOKit -framework WebKitLegacy -lnetwork $(WK_ACCESSIBILITY_LDFLAGS) $(WK_APPKIT_LDFLAGS) $(WK_ASSERTION_SERVICES_LDFLAGS) $(WK_CARBON_LDFLAGS) $(WK_CORE_PDF_LDFLAGS) $(WK_CORE_PREDICTION_LDFLAGS) $(WK_CORE_SERVICES_LDFLAGS) $(WK_DEVICE_IDENTITY_LDFLAGS) $(WK_GRAPHICS_SERVICES_LDFLAGS) $(WK_IOSURFACE_LDFLAGS) $(WK_LIBSANDBOX_LDFLAGS) $(WK_LIBWEBRTC_LDFLAGS) $(WK_MOBILE_CORE_SERVICES_LDFLAGS) $(WK_MOBILE_GESTALT_LDFLAGS) $(WK_OPENGL_LDFLAGS) $(WK_PDFKIT_LDFLAGS) $(WK_PROXIMITY_NETWORKING_LDFLAGS) $(WK_SAFE_BROWSING_LDFLAGS) $(WK_SECURITY_INTERFACE_LDFLAGS) $(WK_UIKIT_LDFLAGS) $(WK_URL_FORMATTING_LDFLAGS);
 
 // Prevent C++ standard library basic_stringstream, operator new, delete and their related exception types from being exported as weak symbols.
 UNEXPORTED_SYMBOL_LDFLAGS = -Wl,-unexported_symbol -Wl,__ZTISt9bad_alloc -Wl,-unexported_symbol -Wl,__ZTISt9exception -Wl,-unexported_symbol -Wl,__ZTSSt9bad_alloc -Wl,-unexported_symbol -Wl,__ZTSSt9exception -Wl,-unexported_symbol -Wl,__ZdlPvS_ -Wl,-unexported_symbol -Wl,__ZnwmPv -Wl,-unexported_symbol -Wl,__Znwm -Wl,-unexported_symbol -Wl,__ZNSt3__18functionIFvN7WebCore12PolicyActionEEEC2EOS4_ -Wl,-unexported_symbol -Wl,__ZNSt3__18functionIFvN7WebCore12PolicyActionEEEC1EOS4_ -Wl,-unexported_symbol -Wl,__ZNSt3__18functionIFvN7WebCore12PolicyActionEEEaSEDn -Wl,-unexported_symbol -Wl,__ZNKSt3__18functionIFvN7WebCore12PolicyActionEEEclES2_ -Wl,-unexported_symbol -Wl,__ZNSt3__18functionIFvN7WebCore12PolicyActionEEE4swapERS4_ -Wl,-unexported_symbol -Wl,__ZNSt3__18functionIFvN7WebCore12PolicyActionEEEC1ERKS4_ -Wl,-unexported_symbol -Wl,__ZNSt3__18functionIFvN7WebCore12PolicyActionEEEC2ERKS4_ -Wl,-unexported_symbol -Wl,__ZNSt3__18functionIFvN7WebCore12PolicyActionEEED1Ev -Wl,-unexported_symbol -Wl,__ZNSt3__18functionIFvN7WebCore12PolicyActionEEED2Ev -Wl,-unexported_symbol -Wl,__ZNSt3__18functionIFvN7WebCore12PolicyActionEEEaSERKS4_ -Wl,-unexported_symbol -Wl,__ZTVNSt3__117bad_function_callE -Wl,-unexported_symbol -Wl,__ZTCNSt3__118basic_stringstreamIcNS_11char_traitsIcEENS_9allocatorIcEEEE0_NS_13basic_istreamIcS2_EE -Wl,-unexported_symbol -Wl,__ZTCNSt3__118basic_stringstreamIcNS_11char_traitsIcEENS_9allocatorIcEEEE0_NS_14basic_iostreamIcS2_EE -Wl,-unexported_symbol -Wl,__ZTCNSt3__118basic_stringstreamIcNS_11char_traitsIcEENS_9allocatorIcEEEE16_NS_13basic_ostreamIcS2_EE -Wl,-unexported_symbol -Wl,__ZTTNSt3__118basic_stringstreamIcNS_11char_traitsIcEENS_9allocatorIcEEEE -Wl,-unexported_symbol -Wl,__ZTVNSt3__115basic_stringbufIcNS_11char_traitsIcEENS_9allocatorIcEEEE -Wl,-unexported_symbol -Wl,__ZTVNSt3__118basic_stringstreamIcNS_11char_traitsIcEENS_9allocatorIcEEEE -Wl,-unexported_symbol -Wl,__ZTCNSt3__118basic_stringstreamIcNS_11char_traitsIcEENS_9allocatorIcEEEE8_NS_13basic_ostreamIcS2_EE;
index 4b60943..1298ab6 100644 (file)
 
 #pragma once
 
-#include <WebCore/CertificateInfo.h>
 #include <WebCore/HTTPHeaderMap.h>
-#include <utility>
-#include <wtf/Forward.h>
-#include <wtf/HashMap.h>
-#include <wtf/HashSet.h>
-#include <wtf/SHA1.h>
-#include <wtf/Vector.h>
 #include <wtf/persistence/PersistentCoders.h>
 #include <wtf/persistence/PersistentDecoder.h>
 #include <wtf/persistence/PersistentEncoder.h>
 namespace WTF {
 namespace Persistence {
 
-template<> struct Coder<WebCore::CertificateInfo> {
-    static void encode(Encoder&, const WebCore::CertificateInfo&);
-    static bool decode(Decoder&, WebCore::CertificateInfo&);
-};
-
 template<> struct Coder<WebCore::HTTPHeaderMap> {
     static void encode(Encoder&, const WebCore::HTTPHeaderMap&);
     static bool decode(Decoder&, WebCore::HTTPHeaderMap&);
 };
 
-#if USE(GLIB)
-template<> struct Coder<GRefPtr<GByteArray>> {
-    static void encode(Encoder&, const GRefPtr<GByteArray>&);
-    static bool decode(Decoder&, GRefPtr<GByteArray>&);
-};
-#endif
-
 }
 }
diff --git a/Source/WebKit/NetworkProcess/cache/NetworkCacheCodersCocoa.cpp b/Source/WebKit/NetworkProcess/cache/NetworkCacheCodersCocoa.cpp
deleted file mode 100644 (file)
index 3a0f38a..0000000
+++ /dev/null
@@ -1,191 +0,0 @@
-/*
- * Copyright (C) 2011, 2014-2015 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "NetworkCacheCoders.h"
-
-#if PLATFORM(COCOA)
-#include <Security/SecCertificate.h>
-#include <Security/SecTrust.h>
-#include <wtf/cf/TypeCastsCF.h>
-#include <wtf/spi/cocoa/SecuritySPI.h>
-#endif
-
-WTF_DECLARE_CF_TYPE_TRAIT(SecCertificate);
-
-namespace WTF {
-namespace Persistence {
-
-static void encodeCFData(Encoder& encoder, CFDataRef data)
-{
-    uint64_t length = CFDataGetLength(data);
-    const uint8_t* bytePtr = CFDataGetBytePtr(data);
-
-    encoder << length;
-    encoder.encodeFixedLengthData(bytePtr, length);
-}
-
-static bool decodeCFData(Decoder& decoder, RetainPtr<CFDataRef>& data)
-{
-    uint64_t size = 0;
-    if (!decoder.decode(size))
-        return false;
-
-    Vector<uint8_t> vector(size);
-    if (!decoder.decodeFixedLengthData(vector.data(), vector.size()))
-        return false;
-
-    data = adoptCF(CFDataCreate(nullptr, vector.data(), vector.size()));
-    return true;
-}
-
-
-#if HAVE(SEC_TRUST_SERIALIZATION)
-static void encodeSecTrustRef(Encoder& encoder, SecTrustRef trust)
-{
-    auto data = adoptCF(SecTrustSerialize(trust, nullptr));
-    if (!data) {
-        encoder << false;
-        return;
-    }
-
-    encoder << true;
-    encodeCFData(encoder, data.get());
-}
-
-static bool decodeSecTrustRef(Decoder& decoder, RetainPtr<SecTrustRef>& result)
-{
-    bool hasTrust;
-    if (!decoder.decode(hasTrust))
-        return false;
-
-    if (!hasTrust)
-        return true;
-
-    RetainPtr<CFDataRef> trustData;
-    if (!decodeCFData(decoder, trustData))
-        return false;
-
-    auto trust = adoptCF(SecTrustDeserialize(trustData.get(), nullptr));
-    if (!trust)
-        return false;
-
-    result = WTFMove(trust);
-    return true;
-}
-#endif
-
-static void encodeCertificateChain(Encoder& encoder, CFArrayRef certificateChain)
-{
-    CFIndex size = CFArrayGetCount(certificateChain);
-    Vector<CFTypeRef, 32> values(size);
-
-    CFArrayGetValues(certificateChain, CFRangeMake(0, size), values.data());
-
-    encoder << static_cast<uint64_t>(size);
-
-    for (CFIndex i = 0; i < size; ++i) {
-        ASSERT(values[i]);
-        auto data = adoptCF(SecCertificateCopyData(checked_cf_cast<SecCertificateRef>(values[i])));
-        encodeCFData(encoder, data.get());
-    }
-}
-
-static bool decodeCertificateChain(Decoder& decoder, RetainPtr<CFArrayRef>& certificateChain)
-{
-    uint64_t size;
-    if (!decoder.decode(size))
-        return false;
-
-    auto array = adoptCF(CFArrayCreateMutable(0, 0, &kCFTypeArrayCallBacks));
-
-    for (size_t i = 0; i < size; ++i) {
-        RetainPtr<CFDataRef> data;
-        if (!decodeCFData(decoder, data))
-            return false;
-
-        auto certificate = adoptCF(SecCertificateCreateWithData(0, data.get()));
-        CFArrayAppendValue(array.get(), certificate.get());
-    }
-
-    certificateChain = WTFMove(array);
-    return true;
-}
-
-void Coder<WebCore::CertificateInfo>::encode(Encoder& encoder, const WebCore::CertificateInfo& certificateInfo)
-{
-    encoder.encodeEnum(certificateInfo.type());
-
-    switch (certificateInfo.type()) {
-#if HAVE(SEC_TRUST_SERIALIZATION)
-    case WebCore::CertificateInfo::Type::Trust:
-        encodeSecTrustRef(encoder, certificateInfo.trust());
-        break;
-#endif
-    case WebCore::CertificateInfo::Type::CertificateChain: {
-        encodeCertificateChain(encoder, certificateInfo.certificateChain());
-        break;
-    }
-    case WebCore::CertificateInfo::Type::None:
-        // Do nothing.
-        break;
-    }
-}
-
-bool Coder<WebCore::CertificateInfo>::decode(Decoder& decoder, WebCore::CertificateInfo& certificateInfo)
-{
-    WebCore::CertificateInfo::Type certificateInfoType;
-    if (!decoder.decodeEnum(certificateInfoType))
-        return false;
-
-    switch (certificateInfoType) {
-#if HAVE(SEC_TRUST_SERIALIZATION)
-    case WebCore::CertificateInfo::Type::Trust: {
-        RetainPtr<SecTrustRef> trust;
-        if (!decodeSecTrustRef(decoder, trust))
-            return false;
-
-        certificateInfo = WebCore::CertificateInfo(WTFMove(trust));
-        return true;
-    }
-#endif
-    case WebCore::CertificateInfo::Type::CertificateChain: {
-        RetainPtr<CFArrayRef> certificateChain;
-        if (!decodeCertificateChain(decoder, certificateChain))
-            return false;
-
-        certificateInfo = WebCore::CertificateInfo(WTFMove(certificateChain));
-        return true;
-    }    
-    case WebCore::CertificateInfo::Type::None:
-        // Do nothing.
-        break;
-    }
-
-    return true;
-}
-
-}
-}
diff --git a/Source/WebKit/NetworkProcess/cache/NetworkCacheCodersCurl.cpp b/Source/WebKit/NetworkProcess/cache/NetworkCacheCodersCurl.cpp
deleted file mode 100644 (file)
index 1cf9149..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (C) 2018 Sony Interactive Entertainment Inc.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "NetworkCacheCoders.h"
-
-#include <WebCore/NotImplemented.h>
-
-namespace WTF {
-namespace Persistence {
-
-void Coder<WebCore::CertificateInfo>::encode(Encoder& encoder, const WebCore::CertificateInfo& certificateInfo)
-{
-    notImplemented();
-}
-
-bool Coder<WebCore::CertificateInfo>::decode(Decoder& decoder, WebCore::CertificateInfo& certificateInfo)
-{
-    notImplemented();
-    return false;
-}
-
-}
-}
diff --git a/Source/WebKit/NetworkProcess/cache/NetworkCacheCodersSoup.cpp b/Source/WebKit/NetworkProcess/cache/NetworkCacheCodersSoup.cpp
deleted file mode 100644 (file)
index 2338c9a..0000000
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * Copyright (C) 2011, 2014-2015 Apple Inc. All rights reserved.
- * Copyright (C) 2018 Igalia S.L.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "NetworkCacheCoders.h"
-
-namespace WTF {
-namespace Persistence {
-
-
-static Vector<GRefPtr<GByteArray>> certificatesDataListFromCertificateInfo(const WebCore::CertificateInfo &certificateInfo)
-{
-    auto* certificate = certificateInfo.certificate();
-    if (!certificate)
-        return { };
-
-    Vector<GRefPtr<GByteArray>> certificatesDataList;
-    for (; certificate; certificate = g_tls_certificate_get_issuer(certificate)) {
-        GByteArray* certificateData = nullptr;
-        g_object_get(G_OBJECT(certificate), "certificate", &certificateData, nullptr);
-
-        if (!certificateData) {
-            certificatesDataList.clear();
-            break;
-        }
-        certificatesDataList.append(adoptGRef(certificateData));
-    }
-
-    // Reverse so that the list starts from the rootmost certificate.
-    certificatesDataList.reverse();
-
-    return certificatesDataList;
-}
-
-static GRefPtr<GTlsCertificate> certificateFromCertificatesDataList(const Vector<GRefPtr<GByteArray>> &certificatesDataList)
-{
-    GType certificateType = g_tls_backend_get_certificate_type(g_tls_backend_get_default());
-    GRefPtr<GTlsCertificate> certificate;
-    for (auto& certificateData : certificatesDataList) {
-        certificate = adoptGRef(G_TLS_CERTIFICATE(g_initable_new(
-            certificateType, nullptr, nullptr, "certificate", certificateData.get(), "issuer", certificate.get(), nullptr)));
-    }
-
-    return certificate;
-}
-
-void Coder<WebCore::CertificateInfo>::encode(Encoder& encoder, const WebCore::CertificateInfo& certificateInfo)
-{
-    auto certificatesDataList = certificatesDataListFromCertificateInfo(certificateInfo);
-
-    encoder << certificatesDataList;
-
-    if (certificatesDataList.isEmpty())
-        return;
-
-    encoder << static_cast<uint32_t>(certificateInfo.tlsErrors());
-}
-
-bool Coder<WebCore::CertificateInfo>::decode(Decoder& decoder, WebCore::CertificateInfo& certificateInfo)
-{
-    Vector<GRefPtr<GByteArray>> certificatesDataList;
-    if (!decoder.decode(certificatesDataList))
-        return false;
-
-    if (certificatesDataList.isEmpty())
-        return true;
-    certificateInfo.setCertificate(certificateFromCertificatesDataList(certificatesDataList).get());
-
-    uint32_t tlsErrors;
-    if (!decoder.decode(tlsErrors))
-        return false;
-    certificateInfo.setTLSErrors(static_cast<GTlsCertificateFlags>(tlsErrors));
-
-    return true;
-}
-
-void Coder<GRefPtr<GByteArray>>::encode(Encoder &encoder, const GRefPtr<GByteArray>& byteArray)
-{
-    encoder << static_cast<uint32_t>(byteArray->len);
-    encoder.encodeFixedLengthData(byteArray->data, byteArray->len);
-}
-
-bool Coder<GRefPtr<GByteArray>>::decode(Decoder &decoder, GRefPtr<GByteArray>& byteArray)
-{
-    uint32_t size;
-    if (!decoder.decode(size))
-        return false;
-
-    byteArray = adoptGRef(g_byte_array_sized_new(size));
-    return decoder.decodeFixedLengthData(byteArray->data, byteArray->len);
-}
-
-}
-}
index 1c7fb26..8a52d2a 100644 (file)
@@ -29,7 +29,6 @@ list(APPEND WebKit_SOURCES
 
     NetworkProcess/Downloads/cocoa/DownloadCocoa.mm
 
-    NetworkProcess/cache/NetworkCacheCodersCocoa.cpp
     NetworkProcess/cache/NetworkCacheDataCocoa.mm
     NetworkProcess/cache/NetworkCacheIOChannelCocoa.mm
 
index 0054986..fcad8c9 100644 (file)
@@ -150,7 +150,6 @@ if (${WTF_PLATFORM_WIN_CAIRO})
     list(APPEND WebKit_SOURCES
         NetworkProcess/Cookies/curl/WebCookieManagerCurl.cpp
 
-        NetworkProcess/cache/NetworkCacheCodersCurl.cpp
         NetworkProcess/cache/NetworkCacheDataCurl.cpp
         NetworkProcess/cache/NetworkCacheIOChannelCurl.cpp
 
index ecc82d1..08dbd7b 100644 (file)
@@ -21,7 +21,6 @@
 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
 // THE POSSIBILITY OF SUCH DAMAGE.
 
-NetworkProcess/cache/NetworkCacheCodersCocoa.cpp
 NetworkProcess/cache/NetworkCacheDataCocoa.mm
 NetworkProcess/cache/NetworkCacheIOChannelCocoa.mm
 
index 2a33480..265384b 100644 (file)
@@ -31,7 +31,6 @@ NetworkProcess/CustomProtocols/LegacyCustomProtocolManager.cpp
 
 NetworkProcess/CustomProtocols/soup/LegacyCustomProtocolManagerSoup.cpp
 
-NetworkProcess/cache/NetworkCacheCodersSoup.cpp
 NetworkProcess/cache/NetworkCacheDataSoup.cpp
 NetworkProcess/cache/NetworkCacheIOChannelSoup.cpp
 
index 84ef23f..5bc9b3b 100644 (file)
@@ -27,7 +27,6 @@ NetworkProcess/CustomProtocols/LegacyCustomProtocolManager.cpp
 
 NetworkProcess/CustomProtocols/soup/LegacyCustomProtocolManagerSoup.cpp
 
-NetworkProcess/cache/NetworkCacheCodersSoup.cpp
 NetworkProcess/cache/NetworkCacheDataSoup.cpp
 NetworkProcess/cache/NetworkCacheIOChannelSoup.cpp
 
index 6aec754..b873d37 100644 (file)
@@ -33,8 +33,6 @@
 #include <WebCore/CertificateInfo.h>
 #include <wtf/cf/TypeCastsCF.h>
 
-WTF_DECLARE_CF_TYPE_TRAIT(SecCertificate);
-
 namespace WebKit {
 using namespace WebCore;
 
index 6f1e407..4bdcf49 100644 (file)
@@ -32,6 +32,7 @@
 #include "WebInspectorProxy.h"
 #include "WebPageGroup.h"
 #include "WebPageProxy.h"
+#include <WebCore/CertificateInfo.h>
 #include <WebCore/NotImplemented.h>
 
 namespace WebKit {
@@ -115,6 +116,11 @@ void RemoteWebInspectorProxy::openInNewTab(const String& url)
     platformOpenInNewTab(url);
 }
 
+void RemoteWebInspectorProxy::showCertificate(const CertificateInfo& certificateInfo)
+{
+    platformShowCertificate(certificateInfo);
+}
+
 void RemoteWebInspectorProxy::sendMessageToBackend(const String& message)
 {
     if (m_client)
@@ -160,6 +166,7 @@ void RemoteWebInspectorProxy::platformSave(const String&, const String&, bool, b
 void RemoteWebInspectorProxy::platformAppend(const String&, const String&) { }
 void RemoteWebInspectorProxy::platformStartWindowDrag() { }
 void RemoteWebInspectorProxy::platformOpenInNewTab(const String&) { }
+void RemoteWebInspectorProxy::platformShowCertificate(const CertificateInfo&) { }
 void RemoteWebInspectorProxy::platformCloseFrontendPageAndWindow() { }
 #endif
 
index 75d9eaf..a5db10c 100644 (file)
@@ -40,6 +40,10 @@ OBJC_CLASS WKRemoteWebInspectorProxyObjCAdapter;
 OBJC_CLASS WKWebView;
 #endif
 
+namespace WebCore {
+class CertificateInfo;
+}
+
 namespace WebKit {
 
 class WebPageProxy;
@@ -96,6 +100,7 @@ private:
     void append(const String& filename, const String& content);
     void startWindowDrag();
     void openInNewTab(const String& url);
+    void showCertificate(const WebCore::CertificateInfo&);
     void sendMessageToBackend(const String& message);
 
     void createFrontendPageAndWindow();
@@ -109,6 +114,7 @@ private:
     void platformAppend(const String& filename, const String& content);
     void platformStartWindowDrag();
     void platformOpenInNewTab(const String& url);
+    void platformShowCertificate(const WebCore::CertificateInfo&);
 
     RemoteWebInspectorProxyClient* m_client { nullptr };
     WebPageProxy* m_inspectorPage { nullptr };
index 84b5259..83b496e 100644 (file)
@@ -30,6 +30,7 @@ messages -> RemoteWebInspectorProxy {
     StartWindowDrag()
 
     OpenInNewTab(String url)
+    ShowCertificate(WebCore::CertificateInfo certificateInfo)
 
     SendMessageToBackend(String message)
 }
index 9df893e..589bbce 100644 (file)
@@ -41,6 +41,7 @@
 #include "WebPreferences.h"
 #include "WebProcessPool.h"
 #include "WebProcessProxy.h"
+#include <WebCore/CertificateInfo.h>
 #include <WebCore/NotImplemented.h>
 #include <WebCore/TextEncoding.h>
 #include <wtf/SetForScope.h>
@@ -537,6 +538,11 @@ void WebInspectorProxy::inspectedURLChanged(const String& urlString)
     platformInspectedURLChanged(urlString);
 }
 
+void WebInspectorProxy::showCertificate(const CertificateInfo& certificateInfo)
+{
+    platformShowCertificate(certificateInfo);
+}
+
 void WebInspectorProxy::elementSelectionChanged(bool active)
 {
     m_elementSelectionActive = active;
@@ -625,6 +631,11 @@ void WebInspectorProxy::platformInspectedURLChanged(const String&)
     notImplemented();
 }
 
+void WebInspectorProxy::platformShowCertificate(const CertificateInfo&)
+{
+    notImplemented();
+}
+
 void WebInspectorProxy::platformSave(const String& suggestedURL, const String& content, bool base64Encoded, bool forceSaveDialog)
 {
     notImplemented();
index fbcbb9f..f8e2f00 100644 (file)
@@ -52,6 +52,7 @@ OBJC_CLASS WKInspectorViewController;
 #endif
 
 namespace WebCore {
+class CertificateInfo;
 class URL;
 }
 
@@ -188,6 +189,7 @@ private:
     bool platformIsFront();
     void platformAttachAvailabilityChanged(bool);
     void platformInspectedURLChanged(const String&);
+    void platformShowCertificate(const WebCore::CertificateInfo&);
     unsigned platformInspectedWindowHeight();
     unsigned platformInspectedWindowWidth();
     void platformAttach();
@@ -214,6 +216,7 @@ private:
     void bringToFront();
     void attachAvailabilityChanged(bool);
     void inspectedURLChanged(const String&);
+    void showCertificate(const WebCore::CertificateInfo&);
     void elementSelectionChanged(bool);
 
     void save(const String& filename, const String& content, bool base64Encoded, bool forceSaveAs);
index 1e027d3..631ff90 100644 (file)
@@ -31,6 +31,7 @@ messages -> WebInspectorProxy {
     BringToFront()
 
     InspectedURLChanged(String urlString)
+    ShowCertificate(WebCore::CertificateInfo certificateInfo)
     ElementSelectionChanged(bool active)
 
     Save(String filename, String content, bool base64Encoded, bool forceSaveAs)
index f9ecedf..8516437 100644 (file)
 #include "WebKitInspectorWindow.h"
 #include "WebKitWebViewBasePrivate.h"
 #include "WebPageGroup.h"
+#include <WebCore/CertificateInfo.h>
 
 namespace WebKit {
+using namespace WebCore;
 
 void RemoteWebInspectorProxy::updateWindowTitle(const CString& targetName)
 {
@@ -109,6 +111,10 @@ void RemoteWebInspectorProxy::platformOpenInNewTab(const String&)
 {
 }
 
+void RemoteWebInspectorProxy::platformShowCertificate(const CertificateInfo&)
+{
+}
+
 } // namespace WebKit
 
 #endif // ENABLE(REMOTE_INSPECTOR)
index df1f6d5..b64e335 100644 (file)
@@ -41,6 +41,7 @@
 #include "WebPageGroup.h"
 #include "WebProcessPool.h"
 #include "WebProcessProxy.h"
+#include <WebCore/CertificateInfo.h>
 #include <WebCore/FileSystem.h>
 #include <WebCore/GtkUtilities.h>
 #include <WebCore/NotImplemented.h>
@@ -337,6 +338,11 @@ void WebInspectorProxy::platformInspectedURLChanged(const String& url)
         updateInspectorWindowTitle();
 }
 
+void WebInspectorProxy::platformShowCertificate(const CertificateInfo&)
+{
+    notImplemented();
+}
+
 String WebInspectorProxy::inspectorPageURL()
 {
     return String("resource:///org/webkit/inspector/UserInterface/Main.html");
index 9422e01..ae9f25b 100644 (file)
@@ -38,6 +38,9 @@
 #import "WebInspectorProxy.h"
 #import "WebPageGroup.h"
 #import "WebPageProxy.h"
+#import <SecurityInterface/SFCertificatePanel.h>
+#import <SecurityInterface/SFCertificateView.h>
+#import <WebCore/CertificateInfo.h>
 #import <wtf/text/Base64.h>
 
 @interface WKRemoteWebInspectorProxyObjCAdapter : NSObject <WKInspectorViewControllerDelegate> {
@@ -71,6 +74,7 @@
 @end
 
 namespace WebKit {
+using namespace WebCore;
 
 WKWebView *RemoteWebInspectorProxy::webView() const
 {
@@ -212,6 +216,27 @@ void RemoteWebInspectorProxy::platformOpenInNewTab(const String& url)
     [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:url]];
 }
 
+void RemoteWebInspectorProxy::platformShowCertificate(const CertificateInfo& certificateInfo)
+{
+    ASSERT(!certificateInfo.isEmpty());
+
+    RetainPtr<SFCertificatePanel> certificatePanel = adoptNS([[SFCertificatePanel alloc] init]);
+
+    ASSERT(m_window);
+#if HAVE(SEC_TRUST_SERIALIZATION)
+    [certificatePanel beginSheetForWindow:m_window.get() modalDelegate:nil didEndSelector:NULL contextInfo:nullptr trust:certificateInfo.trust() showGroup:YES];
+#else
+    [certificatePanel beginSheetForWindow:m_window.get() modalDelegate:nil didEndSelector:NULL contextInfo:nullptr certificates:(NSArray *)certificateInfo.certificateChain() showGroup:YES];
+#endif
+
+    // This must be called after the trust panel has been displayed, because the certificateView doesn't exist beforehand.
+    SFCertificateView *certificateView = [certificatePanel certificateView];
+    [certificateView setDisplayTrust:YES];
+    [certificateView setEditableTrust:NO];
+    [certificateView setDisplayDetails:YES];
+    [certificateView setDetailsDisclosed:YES];
+}
+
 } // namespace WebKit
 
 #endif
index 9832632..1210067 100644 (file)
@@ -37,6 +37,9 @@
 #import "WebPageGroup.h"
 #import "WebPageProxy.h"
 #import "_WKInspectorInternal.h"
+#import <SecurityInterface/SFCertificatePanel.h>
+#import <SecurityInterface/SFCertificateView.h>
+#import <WebCore/CertificateInfo.h>
 #import <WebCore/InspectorFrontendClientLocal.h>
 #import <WebCore/LocalizedStrings.h>
 #import <wtf/SoftLinking.h>
@@ -405,6 +408,35 @@ void WebInspectorProxy::platformInspectedURLChanged(const String& urlString)
     updateInspectorWindowTitle();
 }
 
+void WebInspectorProxy::platformShowCertificate(const CertificateInfo& certificateInfo)
+{
+    ASSERT(!certificateInfo.isEmpty());
+
+    RetainPtr<SFCertificatePanel> certificatePanel = adoptNS([[SFCertificatePanel alloc] init]);
+
+    NSWindow *window;
+    if (m_inspectorWindow)
+        window = m_inspectorWindow.get();
+    else
+        window = [[m_inspectorViewController webView] window];
+
+    if (!window)
+        window = [NSApp keyWindow];
+
+#if HAVE(SEC_TRUST_SERIALIZATION)
+    [certificatePanel beginSheetForWindow:window modalDelegate:nil didEndSelector:NULL contextInfo:nullptr trust:certificateInfo.trust() showGroup:YES];
+#else
+    [certificatePanel beginSheetForWindow:window modalDelegate:nil didEndSelector:NULL contextInfo:nullptr certificates:(NSArray *)certificateInfo.certificateChain() showGroup:YES];
+#endif
+
+    // This must be called after the trust panel has been displayed, because the certificateView doesn't exist beforehand.
+    SFCertificateView *certificateView = [certificatePanel certificateView];
+    [certificateView setDisplayTrust:YES];
+    [certificateView setEditableTrust:NO];
+    [certificateView setDisplayDetails:YES];
+    [certificateView setDetailsDisclosed:YES];
+}
+
 void WebInspectorProxy::platformSave(const String& suggestedURL, const String& content, bool base64Encoded, bool forceSaveDialog)
 {
     ASSERT(!suggestedURL.isEmpty());
index 0b0fa00..3198220 100644 (file)
@@ -38,6 +38,7 @@
 #include "WebPreferences.h"
 #include "WebProcessPool.h"
 #include "WebView.h"
+#include <WebCore/CertificateInfo.h>
 #include <WebCore/InspectorFrontendClientLocal.h>
 #include <WebCore/NotImplemented.h>
 #include <WebCore/WebCoreBundleWin.h>
@@ -387,6 +388,11 @@ void WebInspectorProxy::platformInspectedURLChanged(const String& /* url */)
     notImplemented();
 }
 
+void WebInspectorProxy::platformShowCertificate(const WebCore::CertificateInfo&)
+{
+    notImplemented();
+}
+
 void WebInspectorProxy::platformSave(const String&, const String&, bool, bool)
 {
     notImplemented();
index fb8d7a1..8dd5c19 100644 (file)
@@ -26,6 +26,7 @@
 #include "config.h"
 #include "WebInspectorProxy.h"
 
+#include <WebCore/CertificateInfo.h>
 #include <WebCore/NotImplemented.h>
 #include <wtf/text/WTFString.h>
 
@@ -81,6 +82,11 @@ void WebInspectorProxy::platformInspectedURLChanged(const String&)
     notImplemented();
 }
 
+void WebInspectorProxy::platformShowCertificate(const CertificateInfo&)
+{
+    notImplemented();
+}
+
 String WebInspectorProxy::inspectorPageURL()
 {
     return String("resource:///org/webkit/inspector/UserInterface/Main.html");
index 4aa777a..a9e5d07 100644 (file)
                7C9D1536184584DA009D3918 /* WKBrowsingContextGroupInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKBrowsingContextGroupInternal.h; sourceTree = "<group>"; };
                7CA254EA182993CE00FC8A41 /* WKBrowsingContextPolicyDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKBrowsingContextPolicyDelegate.h; sourceTree = "<group>"; };
                7CA3793D1AC378B30079DC37 /* _WKUserContentExtensionStorePrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = _WKUserContentExtensionStorePrivate.h; sourceTree = "<group>"; };
-               7CAB93791D459E4B0070F540 /* NetworkCacheCodersCocoa.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NetworkCacheCodersCocoa.cpp; sourceTree = "<group>"; };
                7CB100EE1FA2D74A001729EE /* WebPreferencesKeys.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = WebPreferencesKeys.cpp; path = DerivedSources/WebKit2/WebPreferencesKeys.cpp; sourceTree = BUILT_PRODUCTS_DIR; };
                7CB100EF1FA2D74B001729EE /* WebPreferencesKeys.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = WebPreferencesKeys.h; path = DerivedSources/WebKit2/WebPreferencesKeys.h; sourceTree = BUILT_PRODUCTS_DIR; };
                7CB100F01FA2D784001729EE /* WebPreferencesStoreDefaultsMap.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = WebPreferencesStoreDefaultsMap.cpp; path = DerivedSources/WebKit2/WebPreferencesStoreDefaultsMap.cpp; sourceTree = BUILT_PRODUCTS_DIR; };
                                E49D40D61AD3FB170066B7B9 /* NetworkCacheBlobStorage.h */,
                                E489D2841A0A2DB80078C06A /* NetworkCacheCoders.cpp */,
                                E489D2851A0A2DB80078C06A /* NetworkCacheCoders.h */,
-                               7CAB93791D459E4B0070F540 /* NetworkCacheCodersCocoa.cpp */,
                                E47D1E961B062B66002676A8 /* NetworkCacheData.cpp */,
                                E42E06111AA75ABD00B11699 /* NetworkCacheData.h */,
                                E42E06131AA75B7000B11699 /* NetworkCacheDataCocoa.mm */,
index ab42695..5a9b0fc 100644 (file)
 
 #include "RemoteWebInspectorProxyMessages.h"
 #include "RemoteWebInspectorUIMessages.h"
+#include "WebCoreArgumentCoders.h"
 #include "WebPage.h"
 #include "WebProcess.h"
+#include <WebCore/CertificateInfo.h>
 #include <WebCore/Chrome.h>
 #include <WebCore/DOMWrapperWorld.h>
 #include <WebCore/InspectorController.h>
@@ -146,4 +148,9 @@ void RemoteWebInspectorUI::inspectedURLChanged(const String& urlString)
     // Do nothing. The remote side can know if the main resource changed.
 }
 
+void RemoteWebInspectorUI::showCertificate(const CertificateInfo& certificateInfo)
+{
+    WebProcess::singleton().parentProcessConnection()->send(Messages::RemoteWebInspectorProxy::ShowCertificate(certificateInfo), m_page.pageID());
+}
+
 } // namespace WebKit
index 33f43be..6e0f9b8 100644 (file)
 #include <WebCore/InspectorFrontendHost.h>
 #include <wtf/Deque.h>
 
+namespace WebCore {
+class CertificateInfo;
+}
+
 namespace WebKit {
 
 class WebPage;
@@ -67,6 +71,7 @@ public:
     void save(const String& url, const String& content, bool base64Encoded, bool forceSaveAs) override;
     void append(const String& url, const String& content) override;
     void inspectedURLChanged(const String&) override;
+    void showCertificate(const WebCore::CertificateInfo&) override;
     void sendMessageToBackend(const String&) override;
 
     bool canSave() override { return true; }
index e82b569..32853ad 100644 (file)
 #include "config.h"
 #include "WebInspectorUI.h"
 
+#include "WebCoreArgumentCoders.h"
 #include "WebInspectorMessages.h"
 #include "WebInspectorProxyMessages.h"
 #include "WebPage.h"
 #include "WebProcess.h"
+#include <WebCore/CertificateInfo.h>
 #include <WebCore/Chrome.h>
 #include <WebCore/DOMWrapperWorld.h>
 #include <WebCore/InspectorController.h>
@@ -261,6 +263,11 @@ void WebInspectorUI::inspectedURLChanged(const String& urlString)
     WebProcess::singleton().parentProcessConnection()->send(Messages::WebInspectorProxy::InspectedURLChanged(urlString), m_inspectedPageIdentifier);
 }
 
+void WebInspectorUI::showCertificate(const CertificateInfo& certificateInfo)
+{
+    WebProcess::singleton().parentProcessConnection()->send(Messages::WebInspectorProxy::ShowCertificate(certificateInfo), m_inspectedPageIdentifier);
+}
+
 void WebInspectorUI::showConsole()
 {
     m_frontendAPIDispatcher.dispatchCommand("showConsole"_s);
index 5b030ec..81e08b1 100644 (file)
@@ -32,6 +32,7 @@
 
 namespace WebCore {
 class InspectorController;
+class CertificateInfo;
 }
 
 namespace WebKit {
@@ -105,6 +106,7 @@ public:
     void append(const WTF::String& url, const WTF::String& content) override;
 
     void inspectedURLChanged(const String&) override;
+    void showCertificate(const WebCore::CertificateInfo&) override;
 
     void sendMessageToBackend(const String&) override;
 
index b415f3a..209d625 100644 (file)
@@ -1,3 +1,14 @@
+2018-11-17  Devin Rousso  <drousso@apple.com>
+
+        Web Inspector: Network: add button to show system certificate dialog
+        https://bugs.webkit.org/show_bug.cgi?id=191458
+        <rdar://problem/45977019>
+
+        Reviewed by Joseph Pecoraro.
+
+        * WebCoreSupport/WebInspectorClientIOS.mm:
+        (WebInspectorFrontendClient::showCertificate): Added.
+
 2018-11-09  Sihui Liu  <sihui_liu@apple.com>
 
         Remove legacy storage tracker database file after r237330
index 39ad80d..d67aa5d 100644 (file)
@@ -34,6 +34,7 @@
 #import "WebInspector.h"
 #import "WebNodeHighlighter.h"
 #import "WebViewInternal.h"
+#import <WebCore/CertificateInfo.h>
 #import <WebCore/InspectorController.h>
 #import <WebCore/NotImplemented.h>
 #import <WebCore/Page.h>
@@ -130,6 +131,7 @@ void WebInspectorFrontendClient::setAttachedWindowHeight(unsigned) { }
 void WebInspectorFrontendClient::setAttachedWindowWidth(unsigned) { }
 void WebInspectorFrontendClient::startWindowDrag() { }
 void WebInspectorFrontendClient::inspectedURLChanged(const String&) { }
+void WebInspectorFrontendClient::showCertificate(const CertificateInfo&) { }
 void WebInspectorFrontendClient::updateWindowTitle() const { }
 void WebInspectorFrontendClient::save(const String&, const String&, bool, bool) { }
 void WebInspectorFrontendClient::append(const String&, const String&) { }
index 115f65d..5a18503 100644 (file)
@@ -1,3 +1,17 @@
+2018-11-17  Devin Rousso  <drousso@apple.com>
+
+        Web Inspector: Network: add button to show system certificate dialog
+        https://bugs.webkit.org/show_bug.cgi?id=191458
+        <rdar://problem/45977019>
+
+        Reviewed by Joseph Pecoraro.
+
+        * WebCoreSupport/WebInspectorClient.h:
+        * WebCoreSupport/WebInspectorClient.mm:
+        (WebInspectorFrontendClient::showCertificate): Added.
+
+        * Configurations/WebKitLegacy.xcconfig:
+
 2018-11-15  Truitt Savell  <tsavell@apple.com>
 
         Unreviewed, rolling out r238244.
index 91bd017..8fe026e 100644 (file)
@@ -89,7 +89,10 @@ WK_MOBILE_CORE_SERVICES_LDFLAGS_cocoatouch = -framework MobileCoreServices;
 WK_MOBILE_GESTALT_LDFLAGS = $(WK_MOBILE_GESTALT_LDFLAGS_$(WK_COCOA_TOUCH));
 WK_MOBILE_GESTALT_LDFLAGS_cocoatouch = -lMobileGestalt;
 
-OTHER_LDFLAGS = -lobjc -lsqlite3 -framework CFNetwork -framework CoreFoundation -framework CoreGraphics -framework CoreText -framework Foundation -framework ImageIO -framework IOKit $(WK_APPKIT_LDFLAGS) $(WK_CARBON_LDFLAGS) $(WK_GRAPHICS_SERVICES_LDFLAGS) $(WK_MOBILE_CORE_SERVICES_LDFLAGS) $(WK_MOBILE_GESTALT_LDFLAGS);
+WK_SECURITY_INTERFACE_LDFLAGS = $(WK_SECURITY_INTERFACE_LDFLAGS_$(WK_PLATFORM_NAME));
+WK_SECURITY_INTERFACE_LDFLAGS_macosx = -framework SecurityInterface;
+
+OTHER_LDFLAGS = -lobjc -lsqlite3 -framework CFNetwork -framework CoreFoundation -framework CoreGraphics -framework CoreText -framework Foundation -framework ImageIO -framework IOKit $(WK_APPKIT_LDFLAGS) $(WK_CARBON_LDFLAGS) $(WK_GRAPHICS_SERVICES_LDFLAGS) $(WK_MOBILE_CORE_SERVICES_LDFLAGS) $(WK_MOBILE_GESTALT_LDFLAGS) $(WK_SECURITY_INTERFACE_LDFLAGS);
 
 SECTORDER_FLAGS = $(SECTORDER_FLAGS_$(CONFIGURATION));
 SECTORDER_FLAGS_Production[sdk=iphoneos*] = -Wl,-order_file,$(SDKROOT)/AppleInternal/OrderFiles/WebKitLegacy.order;
index e662db5..03839e7 100644 (file)
@@ -42,6 +42,7 @@ OBJC_CLASS WebNodeHighlighter;
 OBJC_CLASS WebView;
 
 namespace WebCore {
+class CertificateInfo;
 class Frame;
 class Page;
 }
@@ -124,6 +125,7 @@ public:
     void setAttachedWindowWidth(unsigned height) override;
 
     void inspectedURLChanged(const String& newURL) override;
+    void showCertificate(const WebCore::CertificateInfo&) override;
 
 private:
     void updateWindowTitle() const;
index 4a5c3f8..1010c7b 100644 (file)
@@ -43,6 +43,9 @@
 #import "WebUIDelegatePrivate.h"
 #import "WebViewInternal.h"
 #import <JavaScriptCore/InspectorAgentBase.h>
+#import <SecurityInterface/SFCertificatePanel.h>
+#import <SecurityInterface/SFCertificateView.h>
+#import <WebCore/CertificateInfo.h>
 #import <WebCore/Frame.h>
 #import <WebCore/InspectorController.h>
 #import <WebCore/InspectorFrontendClient.h>
@@ -276,6 +279,30 @@ void WebInspectorFrontendClient::inspectedURLChanged(const String& newURL)
     updateWindowTitle();
 }
 
+void WebInspectorFrontendClient::showCertificate(const CertificateInfo& certificateInfo)
+{
+    ASSERT(!certificateInfo.isEmpty());
+
+    RetainPtr<SFCertificatePanel> certificatePanel = adoptNS([[SFCertificatePanel alloc] init]);
+
+    NSWindow *window = [[m_frontendWindowController frontendWebView] window];
+    if (!window)
+        window = [NSApp keyWindow];
+
+#if HAVE(SEC_TRUST_SERIALIZATION)
+    [certificatePanel beginSheetForWindow:window modalDelegate:nil didEndSelector:NULL contextInfo:nullptr trust:certificateInfo.trust() showGroup:YES];
+#else
+    [certificatePanel beginSheetForWindow:window modalDelegate:nil didEndSelector:NULL contextInfo:nullptr certificates:(NSArray *)certificateInfo.certificateChain() showGroup:YES];
+#endif
+
+    // This must be called after the trust panel has been displayed, because the certificateView doesn't exist beforehand.
+    SFCertificateView *certificateView = [certificatePanel certificateView];
+    [certificateView setDisplayTrust:YES];
+    [certificateView setEditableTrust:NO];
+    [certificateView setDisplayDetails:YES];
+    [certificateView setDetailsDisclosed:YES];
+}
+
 void WebInspectorFrontendClient::updateWindowTitle() const
 {
     NSString *title = [NSString stringWithFormat:UI_STRING_INTERNAL("Web Inspector — %@", "Web Inspector window title"), (NSString *)m_inspectedURL];
index e4696d9..b059834 100644 (file)
@@ -1,3 +1,15 @@
+2018-11-17  Devin Rousso  <drousso@apple.com>
+
+        Web Inspector: Network: add button to show system certificate dialog
+        https://bugs.webkit.org/show_bug.cgi?id=191458
+        <rdar://problem/45977019>
+
+        Reviewed by Joseph Pecoraro.
+
+        * WebCoreSupport/WebInspectorClient.h:
+        * WebCoreSupport/WebInspectorClient.cpp:
+        (WebInspectorFrontendClient::showCertificate): Added.
+
 2018-11-16  Brent Fulgham  <bfulgham@apple.com>
 
         [Win] Reduce the use of WKSI library calls: CFNetwork
index f8f0a46..f6b2178 100644 (file)
@@ -35,6 +35,7 @@
 #include "WebView.h"
 #include <JavaScriptCore/InspectorAgentBase.h>
 #include <WebCore/BString.h>
+#include <WebCore/CertificateInfo.h>
 #include <WebCore/Element.h>
 #include <WebCore/FloatRect.h>
 #include <WebCore/FrameView.h>
@@ -337,6 +338,11 @@ void WebInspectorFrontendClient::inspectedURLChanged(const String& newURL)
     updateWindowTitle();
 }
 
+void WebInspectorFrontendClient::showCertificate(const CertificateInfo&)
+{
+    notImplemented();
+}
+
 void WebInspectorFrontendClient::closeWindowWithoutNotifications()
 {
     if (!m_frontendHwnd)
index 8342fe0..81d5812 100644 (file)
@@ -41,6 +41,7 @@
 #include <wtf/text/WTFString.h>
 
 namespace WebCore {
+class CertificateInfo;
 class Page;
 }
 
@@ -107,6 +108,7 @@ public:
     void setAttachedWindowWidth(unsigned) override;
 
     void inspectedURLChanged(const WTF::String& newURL) override;
+    void showCertificate(const WebCore::CertificateInfo&) override;
 
     // InspectorFrontendClientLocal API.
     void attachWindow(DockSide) override;