Title: [260191] trunk/Source/WebKit
Revision
260191
Author
[email protected]
Date
2020-04-16 09:25:57 -0700 (Thu, 16 Apr 2020)

Log Message

[IPC Hardening] Use ObjectIdentifier<> for LegacyCustomProtocol
<https://webkit.org/b/210580>
<rdar://problem/61791686>

Reviewed by Chris Dumez.

Replace uses of uint64_t with LegacyCustomProtocolID.

* NetworkProcess/CustomProtocols/Cocoa/LegacyCustomProtocolManagerCocoa.mm:
(WebKit::LegacyCustomProtocolManager::didFailWithError):
(WebKit::LegacyCustomProtocolManager::didLoadData):
(WebKit::LegacyCustomProtocolManager::didReceiveResponse):
(WebKit::LegacyCustomProtocolManager::didFinishLoading):
(WebKit::LegacyCustomProtocolManager::wasRedirectedToRequest):
(WebKit::LegacyCustomProtocolManager::protocolForID):
* NetworkProcess/CustomProtocols/LegacyCustomProtocolID.h: Add.
* NetworkProcess/CustomProtocols/LegacyCustomProtocolManager.cpp:
(WebKit::LegacyCustomProtocolManager::addCustomProtocol):
(WebKit::LegacyCustomProtocolManager::removeCustomProtocol):
(WebKit::LegacyCustomProtocolManager::startLoading):
(WebKit::LegacyCustomProtocolManager::stopLoading):
(WebKit::generateCustomProtocolID): Delete.
- Replace with LegacyCustomProtocolID::generate().
* NetworkProcess/CustomProtocols/LegacyCustomProtocolManager.h:
* NetworkProcess/CustomProtocols/LegacyCustomProtocolManager.messages.in:
* Scripts/webkit/messages.py:
* UIProcess/API/APICustomProtocolManagerClient.h:
(API::CustomProtocolManagerClient::startLoading):
(API::CustomProtocolManagerClient::stopLoading):
* UIProcess/Cocoa/LegacyCustomProtocolManagerClient.h:
* UIProcess/Cocoa/LegacyCustomProtocolManagerClient.mm:
(-[WKCustomProtocolLoader initWithLegacyCustomProtocolManagerProxy:customProtocolID:request:]):
(WebKit::LegacyCustomProtocolManagerClient::startLoading):
(WebKit::LegacyCustomProtocolManagerClient::stopLoading):
* UIProcess/Network/CustomProtocols/LegacyCustomProtocolManagerProxy.cpp:
(WebKit::LegacyCustomProtocolManagerProxy::startLoading):
(WebKit::LegacyCustomProtocolManagerProxy::stopLoading):
(WebKit::LegacyCustomProtocolManagerProxy::wasRedirectedToRequest):
(WebKit::LegacyCustomProtocolManagerProxy::didReceiveResponse):
(WebKit::LegacyCustomProtocolManagerProxy::didLoadData):
(WebKit::LegacyCustomProtocolManagerProxy::didFailWithError):
(WebKit::LegacyCustomProtocolManagerProxy::didFinishLoading):
* UIProcess/Network/CustomProtocols/LegacyCustomProtocolManagerProxy.h:
- Remove unused typedef and instance variable.
* UIProcess/Network/CustomProtocols/LegacyCustomProtocolManagerProxy.messages.in:
* WebKit.xcodeproj/project.pbxproj:
- Add LegacyCustomProtocolID.h to project.

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (260190 => 260191)


--- trunk/Source/WebKit/ChangeLog	2020-04-16 15:55:22 UTC (rev 260190)
+++ trunk/Source/WebKit/ChangeLog	2020-04-16 16:25:57 UTC (rev 260191)
@@ -1,3 +1,53 @@
+2020-04-16  David Kilzer  <[email protected]>
+
+        [IPC Hardening] Use ObjectIdentifier<> for LegacyCustomProtocol
+        <https://webkit.org/b/210580>
+        <rdar://problem/61791686>
+
+        Reviewed by Chris Dumez.
+
+        Replace uses of uint64_t with LegacyCustomProtocolID.
+
+        * NetworkProcess/CustomProtocols/Cocoa/LegacyCustomProtocolManagerCocoa.mm:
+        (WebKit::LegacyCustomProtocolManager::didFailWithError):
+        (WebKit::LegacyCustomProtocolManager::didLoadData):
+        (WebKit::LegacyCustomProtocolManager::didReceiveResponse):
+        (WebKit::LegacyCustomProtocolManager::didFinishLoading):
+        (WebKit::LegacyCustomProtocolManager::wasRedirectedToRequest):
+        (WebKit::LegacyCustomProtocolManager::protocolForID):
+        * NetworkProcess/CustomProtocols/LegacyCustomProtocolID.h: Add.
+        * NetworkProcess/CustomProtocols/LegacyCustomProtocolManager.cpp:
+        (WebKit::LegacyCustomProtocolManager::addCustomProtocol):
+        (WebKit::LegacyCustomProtocolManager::removeCustomProtocol):
+        (WebKit::LegacyCustomProtocolManager::startLoading):
+        (WebKit::LegacyCustomProtocolManager::stopLoading):
+        (WebKit::generateCustomProtocolID): Delete.
+        - Replace with LegacyCustomProtocolID::generate().
+        * NetworkProcess/CustomProtocols/LegacyCustomProtocolManager.h:
+        * NetworkProcess/CustomProtocols/LegacyCustomProtocolManager.messages.in:
+        * Scripts/webkit/messages.py:
+        * UIProcess/API/APICustomProtocolManagerClient.h:
+        (API::CustomProtocolManagerClient::startLoading):
+        (API::CustomProtocolManagerClient::stopLoading):
+        * UIProcess/Cocoa/LegacyCustomProtocolManagerClient.h:
+        * UIProcess/Cocoa/LegacyCustomProtocolManagerClient.mm:
+        (-[WKCustomProtocolLoader initWithLegacyCustomProtocolManagerProxy:customProtocolID:request:]):
+        (WebKit::LegacyCustomProtocolManagerClient::startLoading):
+        (WebKit::LegacyCustomProtocolManagerClient::stopLoading):
+        * UIProcess/Network/CustomProtocols/LegacyCustomProtocolManagerProxy.cpp:
+        (WebKit::LegacyCustomProtocolManagerProxy::startLoading):
+        (WebKit::LegacyCustomProtocolManagerProxy::stopLoading):
+        (WebKit::LegacyCustomProtocolManagerProxy::wasRedirectedToRequest):
+        (WebKit::LegacyCustomProtocolManagerProxy::didReceiveResponse):
+        (WebKit::LegacyCustomProtocolManagerProxy::didLoadData):
+        (WebKit::LegacyCustomProtocolManagerProxy::didFailWithError):
+        (WebKit::LegacyCustomProtocolManagerProxy::didFinishLoading):
+        * UIProcess/Network/CustomProtocols/LegacyCustomProtocolManagerProxy.h:
+        - Remove unused typedef and instance variable.
+        * UIProcess/Network/CustomProtocols/LegacyCustomProtocolManagerProxy.messages.in:
+        * WebKit.xcodeproj/project.pbxproj:
+        - Add LegacyCustomProtocolID.h to project.
+
 2020-04-16  Tim Horton  <[email protected]>
 
         REGRESSION (r259898): WebKit-based Books views are all blank

Modified: trunk/Source/WebKit/NetworkProcess/CustomProtocols/Cocoa/LegacyCustomProtocolManagerCocoa.mm (260190 => 260191)


--- trunk/Source/WebKit/NetworkProcess/CustomProtocols/Cocoa/LegacyCustomProtocolManagerCocoa.mm	2020-04-16 15:55:22 UTC (rev 260190)
+++ trunk/Source/WebKit/NetworkProcess/CustomProtocols/Cocoa/LegacyCustomProtocolManagerCocoa.mm	2020-04-16 16:25:57 UTC (rev 260191)
@@ -60,10 +60,10 @@
 
 @interface WKCustomProtocol : NSURLProtocol {
 @private
-    uint64_t _customProtocolID;
+    LegacyCustomProtocolID _customProtocolID;
     RetainPtr<CFRunLoopRef> _initializationRunLoop;
 }
-@property (nonatomic, readonly) uint64_t customProtocolID;
+@property (nonatomic, readonly) LegacyCustomProtocolID customProtocolID;
 @property (nonatomic, readonly) CFRunLoopRef initializationRunLoop;
 @end
 
@@ -163,7 +163,7 @@
     CFRunLoopWakeUp(runloop);
 }
 
-void LegacyCustomProtocolManager::didFailWithError(uint64_t customProtocolID, const WebCore::ResourceError& error)
+void LegacyCustomProtocolManager::didFailWithError(LegacyCustomProtocolID customProtocolID, const WebCore::ResourceError& error)
 {
     RetainPtr<WKCustomProtocol> protocol = protocolForID(customProtocolID);
     if (!protocol)
@@ -178,7 +178,7 @@
     removeCustomProtocol(customProtocolID);
 }
 
-void LegacyCustomProtocolManager::didLoadData(uint64_t customProtocolID, const IPC::DataReference& data)
+void LegacyCustomProtocolManager::didLoadData(LegacyCustomProtocolID customProtocolID, const IPC::DataReference& data)
 {
     RetainPtr<WKCustomProtocol> protocol = protocolForID(customProtocolID);
     if (!protocol)
@@ -191,7 +191,7 @@
     });
 }
 
-void LegacyCustomProtocolManager::didReceiveResponse(uint64_t customProtocolID, const WebCore::ResourceResponse& response, uint32_t cacheStoragePolicy)
+void LegacyCustomProtocolManager::didReceiveResponse(LegacyCustomProtocolID customProtocolID, const WebCore::ResourceResponse& response, uint32_t cacheStoragePolicy)
 {
     RetainPtr<WKCustomProtocol> protocol = protocolForID(customProtocolID);
     if (!protocol)
@@ -204,7 +204,7 @@
     });
 }
 
-void LegacyCustomProtocolManager::didFinishLoading(uint64_t customProtocolID)
+void LegacyCustomProtocolManager::didFinishLoading(LegacyCustomProtocolID customProtocolID)
 {
     RetainPtr<WKCustomProtocol> protocol = protocolForID(customProtocolID);
     if (!protocol)
@@ -217,7 +217,7 @@
     removeCustomProtocol(customProtocolID);
 }
 
-void LegacyCustomProtocolManager::wasRedirectedToRequest(uint64_t customProtocolID, const WebCore::ResourceRequest& request, const WebCore::ResourceResponse& redirectResponse)
+void LegacyCustomProtocolManager::wasRedirectedToRequest(LegacyCustomProtocolID customProtocolID, const WebCore::ResourceRequest& request, const WebCore::ResourceResponse& redirectResponse)
 {
     RetainPtr<WKCustomProtocol> protocol = protocolForID(customProtocolID);
     if (!protocol)
@@ -231,7 +231,7 @@
     });
 }
 
-RetainPtr<WKCustomProtocol> LegacyCustomProtocolManager::protocolForID(uint64_t customProtocolID)
+RetainPtr<WKCustomProtocol> LegacyCustomProtocolManager::protocolForID(LegacyCustomProtocolID customProtocolID)
 {
     LockHolder locker(m_customProtocolMapMutex);
 

Copied: trunk/Source/WebKit/NetworkProcess/CustomProtocols/LegacyCustomProtocolID.h (from rev 260190, trunk/Source/WebKit/UIProcess/API/APICustomProtocolManagerClient.h) (0 => 260191)


--- trunk/Source/WebKit/NetworkProcess/CustomProtocols/LegacyCustomProtocolID.h	                        (rev 0)
+++ trunk/Source/WebKit/NetworkProcess/CustomProtocols/LegacyCustomProtocolID.h	2020-04-16 16:25:57 UTC (rev 260191)
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2020 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.
+ */
+
+#pragma once
+
+#include <wtf/ObjectIdentifier.h>
+
+namespace WebKit {
+
+enum LegacyCustomProtocolIDType { };
+using LegacyCustomProtocolID = ObjectIdentifier<LegacyCustomProtocolIDType>;
+
+}

Modified: trunk/Source/WebKit/NetworkProcess/CustomProtocols/LegacyCustomProtocolManager.cpp (260190 => 260191)


--- trunk/Source/WebKit/NetworkProcess/CustomProtocols/LegacyCustomProtocolManager.cpp	2020-04-16 15:55:22 UTC (rev 260190)
+++ trunk/Source/WebKit/NetworkProcess/CustomProtocols/LegacyCustomProtocolManager.cpp	2020-04-16 16:25:57 UTC (rev 260191)
@@ -36,12 +36,6 @@
 
 namespace WebKit {
 
-static uint64_t generateCustomProtocolID()
-{
-    static uint64_t uniqueCustomProtocolID = 0;
-    return ++uniqueCustomProtocolID;
-}
-
 const char* LegacyCustomProtocolManager::supplementName()
 {
     return "LegacyCustomProtocolManager";
@@ -61,26 +55,26 @@
         registerScheme(scheme);
 }
 
-uint64_t LegacyCustomProtocolManager::addCustomProtocol(CustomProtocol&& customProtocol)
+LegacyCustomProtocolID LegacyCustomProtocolManager::addCustomProtocol(CustomProtocol&& customProtocol)
 {
     LockHolder locker(m_customProtocolMapMutex);
-    auto customProtocolID = generateCustomProtocolID();
+    auto customProtocolID = LegacyCustomProtocolID::generate();
     m_customProtocolMap.add(customProtocolID, WTFMove(customProtocol));
     return customProtocolID;
 }
 
-void LegacyCustomProtocolManager::removeCustomProtocol(uint64_t customProtocolID)
+void LegacyCustomProtocolManager::removeCustomProtocol(LegacyCustomProtocolID customProtocolID)
 {
     LockHolder locker(m_customProtocolMapMutex);
     m_customProtocolMap.remove(customProtocolID);
 }
 
-void LegacyCustomProtocolManager::startLoading(uint64_t customProtocolID, const WebCore::ResourceRequest& request)
+void LegacyCustomProtocolManager::startLoading(LegacyCustomProtocolID customProtocolID, const WebCore::ResourceRequest& request)
 {
     m_networkProcess.send(Messages::LegacyCustomProtocolManagerProxy::StartLoading(customProtocolID, request));
 }
 
-void LegacyCustomProtocolManager::stopLoading(uint64_t customProtocolID)
+void LegacyCustomProtocolManager::stopLoading(LegacyCustomProtocolID customProtocolID)
 {
     m_networkProcess.send(Messages::LegacyCustomProtocolManagerProxy::StopLoading(customProtocolID), 0);
 }

Modified: trunk/Source/WebKit/NetworkProcess/CustomProtocols/LegacyCustomProtocolManager.h (260190 => 260191)


--- trunk/Source/WebKit/NetworkProcess/CustomProtocols/LegacyCustomProtocolManager.h	2020-04-16 15:55:22 UTC (rev 260190)
+++ trunk/Source/WebKit/NetworkProcess/CustomProtocols/LegacyCustomProtocolManager.h	2020-04-16 16:25:57 UTC (rev 260191)
@@ -25,6 +25,7 @@
 
 #pragma once
 
+#include "LegacyCustomProtocolID.h"
 #include "MessageReceiver.h"
 #include "NetworkProcessSupplement.h"
 #include <wtf/HashMap.h>
@@ -69,10 +70,10 @@
     typedef RetainPtr<WKCustomProtocol> CustomProtocol;
 #endif
 
-    uint64_t addCustomProtocol(CustomProtocol&&);
-    void removeCustomProtocol(uint64_t customProtocolID);
-    void startLoading(uint64_t customProtocolID, const WebCore::ResourceRequest&);
-    void stopLoading(uint64_t customProtocolID);
+    LegacyCustomProtocolID addCustomProtocol(CustomProtocol&&);
+    void removeCustomProtocol(LegacyCustomProtocolID);
+    void startLoading(LegacyCustomProtocolID, const WebCore::ResourceRequest&);
+    void stopLoading(LegacyCustomProtocolID);
 
 #if PLATFORM(COCOA)
     void registerProtocolClass(NSURLSessionConfiguration*);
@@ -86,17 +87,17 @@
     // IPC::MessageReceiver
     void didReceiveMessage(IPC::Connection&, IPC::Decoder&) override;
 
-    void didFailWithError(uint64_t customProtocolID, const WebCore::ResourceError&);
-    void didLoadData(uint64_t customProtocolID, const IPC::DataReference&);
-    void didReceiveResponse(uint64_t customProtocolID, const WebCore::ResourceResponse&, uint32_t cacheStoragePolicy);
-    void didFinishLoading(uint64_t customProtocolID);
-    void wasRedirectedToRequest(uint64_t customProtocolID, const WebCore::ResourceRequest&, const WebCore::ResourceResponse& redirectResponse);
+    void didFailWithError(LegacyCustomProtocolID, const WebCore::ResourceError&);
+    void didLoadData(LegacyCustomProtocolID, const IPC::DataReference&);
+    void didReceiveResponse(LegacyCustomProtocolID, const WebCore::ResourceResponse&, uint32_t cacheStoragePolicy);
+    void didFinishLoading(LegacyCustomProtocolID);
+    void wasRedirectedToRequest(LegacyCustomProtocolID, const WebCore::ResourceRequest&, const WebCore::ResourceResponse& redirectResponse);
 
     void registerProtocolClass();
 
     NetworkProcess& m_networkProcess;
 
-    typedef HashMap<uint64_t, CustomProtocol> CustomProtocolMap;
+    typedef HashMap<LegacyCustomProtocolID, CustomProtocol> CustomProtocolMap;
     CustomProtocolMap m_customProtocolMap;
     Lock m_customProtocolMapMutex;
 
@@ -106,7 +107,7 @@
 
     // WKCustomProtocol objects can be removed from the m_customProtocolMap from multiple threads.
     // We return a RetainPtr here because it is unsafe to return a raw pointer since the object might immediately be destroyed from a different thread.
-    RetainPtr<WKCustomProtocol> protocolForID(uint64_t customProtocolID);
+    RetainPtr<WKCustomProtocol> protocolForID(LegacyCustomProtocolID);
 #endif
 };
 

Modified: trunk/Source/WebKit/NetworkProcess/CustomProtocols/LegacyCustomProtocolManager.messages.in (260190 => 260191)


--- trunk/Source/WebKit/NetworkProcess/CustomProtocols/LegacyCustomProtocolManager.messages.in	2020-04-16 15:55:22 UTC (rev 260190)
+++ trunk/Source/WebKit/NetworkProcess/CustomProtocols/LegacyCustomProtocolManager.messages.in	2020-04-16 16:25:57 UTC (rev 260191)
@@ -21,11 +21,11 @@
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 messages -> LegacyCustomProtocolManager NotRefCounted {
-    DidFailWithError(uint64_t customProtocolID, WebCore::ResourceError error)
-    DidLoadData(uint64_t customProtocolID, IPC::DataReference data)
-    DidReceiveResponse(uint64_t customProtocolID, WebCore::ResourceResponse response, uint32_t cacheStoragePolicy)
-    DidFinishLoading(uint64_t customProtocolID)
-    WasRedirectedToRequest(uint64_t customProtocolID, WebCore::ResourceRequest request, WebCore::ResourceResponse redirectResponse);
+    DidFailWithError(WebKit::LegacyCustomProtocolID customProtocolID, WebCore::ResourceError error)
+    DidLoadData(WebKit::LegacyCustomProtocolID customProtocolID, IPC::DataReference data)
+    DidReceiveResponse(WebKit::LegacyCustomProtocolID customProtocolID, WebCore::ResourceResponse response, uint32_t cacheStoragePolicy)
+    DidFinishLoading(WebKit::LegacyCustomProtocolID customProtocolID)
+    WasRedirectedToRequest(WebKit::LegacyCustomProtocolID customProtocolID, WebCore::ResourceRequest request, WebCore::ResourceResponse redirectResponse);
 
     RegisterScheme(String name)
     UnregisterScheme(String name)

Modified: trunk/Source/WebKit/Scripts/webkit/messages.py (260190 => 260191)


--- trunk/Source/WebKit/Scripts/webkit/messages.py	2020-04-16 15:55:22 UTC (rev 260190)
+++ trunk/Source/WebKit/Scripts/webkit/messages.py	2020-04-16 16:25:57 UTC (rev 260191)
@@ -233,6 +233,7 @@
         'WebKit::ImageBufferFlushIdentifier',
         'WebKit::ImageBufferIdentifier',
         'WebKit::LayerHostingContextID',
+        'WebKit::LegacyCustomProtocolID',
         'WebKit::LibWebRTCResolverIdentifier',
         'WebKit::MDNSRegisterIdentifier',
         'WebKit::MediaPlayerPrivateRemoteIdentifier',

Modified: trunk/Source/WebKit/UIProcess/API/APICustomProtocolManagerClient.h (260190 => 260191)


--- trunk/Source/WebKit/UIProcess/API/APICustomProtocolManagerClient.h	2020-04-16 15:55:22 UTC (rev 260190)
+++ trunk/Source/WebKit/UIProcess/API/APICustomProtocolManagerClient.h	2020-04-16 16:25:57 UTC (rev 260191)
@@ -25,6 +25,7 @@
 
 #pragma once
 
+#include "LegacyCustomProtocolID.h"
 #include <wtf/Forward.h>
 
 namespace WebKit {
@@ -42,8 +43,8 @@
 public:
     virtual ~CustomProtocolManagerClient() { }
 
-    virtual void startLoading(WebKit::LegacyCustomProtocolManagerProxy&, uint64_t /* customProtocolID */, const WebCore::ResourceRequest&) { }
-    virtual void stopLoading(WebKit::LegacyCustomProtocolManagerProxy&, uint64_t /* customProtocolID */) { }
+    virtual void startLoading(WebKit::LegacyCustomProtocolManagerProxy&, WebKit::LegacyCustomProtocolID, const WebCore::ResourceRequest&) { }
+    virtual void stopLoading(WebKit::LegacyCustomProtocolManagerProxy&, WebKit::LegacyCustomProtocolID) { }
 
     virtual void invalidate(WebKit::LegacyCustomProtocolManagerProxy&) { }
 };

Modified: trunk/Source/WebKit/UIProcess/Cocoa/LegacyCustomProtocolManagerClient.h (260190 => 260191)


--- trunk/Source/WebKit/UIProcess/Cocoa/LegacyCustomProtocolManagerClient.h	2020-04-16 15:55:22 UTC (rev 260190)
+++ trunk/Source/WebKit/UIProcess/Cocoa/LegacyCustomProtocolManagerClient.h	2020-04-16 16:25:57 UTC (rev 260191)
@@ -26,6 +26,7 @@
 #pragma once
 
 #import "APICustomProtocolManagerClient.h"
+#import "LegacyCustomProtocolID.h"
 #import <wtf/HashMap.h>
 #import <wtf/RetainPtr.h>
 
@@ -41,11 +42,11 @@
 
 class LegacyCustomProtocolManagerClient final : public API::CustomProtocolManagerClient {
 private:
-    void startLoading(LegacyCustomProtocolManagerProxy&, uint64_t /*customProtocolID*/, const WebCore::ResourceRequest&) final;
-    void stopLoading(LegacyCustomProtocolManagerProxy&, uint64_t /*customProtocolID*/) final;
+    void startLoading(LegacyCustomProtocolManagerProxy&, LegacyCustomProtocolID, const WebCore::ResourceRequest&) final;
+    void stopLoading(LegacyCustomProtocolManagerProxy&, LegacyCustomProtocolID) final;
     void invalidate(LegacyCustomProtocolManagerProxy&) final;
 
-    HashMap<uint64_t, RetainPtr<WKCustomProtocolLoader>> m_loaderMap;
+    HashMap<LegacyCustomProtocolID, RetainPtr<WKCustomProtocolLoader>> m_loaderMap;
 };
 
 } // namespace WebKit

Modified: trunk/Source/WebKit/UIProcess/Cocoa/LegacyCustomProtocolManagerClient.mm (260190 => 260191)


--- trunk/Source/WebKit/UIProcess/Cocoa/LegacyCustomProtocolManagerClient.mm	2020-04-16 15:55:22 UTC (rev 260190)
+++ trunk/Source/WebKit/UIProcess/Cocoa/LegacyCustomProtocolManagerClient.mm	2020-04-16 16:25:57 UTC (rev 260191)
@@ -35,17 +35,17 @@
 @interface WKCustomProtocolLoader : NSObject <NSURLConnectionDelegate> {
 @private
     WeakPtr<WebKit::LegacyCustomProtocolManagerProxy> _customProtocolManagerProxy;
-    uint64_t _customProtocolID;
+    WebKit::LegacyCustomProtocolID _customProtocolID;
     NSURLCacheStoragePolicy _storagePolicy;
     NSURLConnection *_urlConnection;
 }
-- (id)initWithLegacyCustomProtocolManagerProxy:(WebKit::LegacyCustomProtocolManagerProxy&)customProtocolManagerProxy customProtocolID:(uint64_t)customProtocolID request:(NSURLRequest *)request;
+- (id)initWithLegacyCustomProtocolManagerProxy:(WebKit::LegacyCustomProtocolManagerProxy&)customProtocolManagerProxy customProtocolID:(WebKit::LegacyCustomProtocolID)customProtocolID request:(NSURLRequest *)request;
 - (void)cancel;
 @end
 
 @implementation WKCustomProtocolLoader
 
-- (id)initWithLegacyCustomProtocolManagerProxy:(WebKit::LegacyCustomProtocolManagerProxy&)customProtocolManagerProxy customProtocolID:(uint64_t)customProtocolID request:(NSURLRequest *)request
+- (id)initWithLegacyCustomProtocolManagerProxy:(WebKit::LegacyCustomProtocolManagerProxy&)customProtocolManagerProxy customProtocolID:(WebKit::LegacyCustomProtocolID)customProtocolID request:(NSURLRequest *)request
 {
     self = [super init];
     if (!self)
@@ -139,7 +139,7 @@
 namespace WebKit {
 using namespace WebCore;
 
-void LegacyCustomProtocolManagerClient::startLoading(LegacyCustomProtocolManagerProxy& manager, uint64_t customProtocolID, const ResourceRequest& coreRequest)
+void LegacyCustomProtocolManagerClient::startLoading(LegacyCustomProtocolManagerProxy& manager, WebKit::LegacyCustomProtocolID customProtocolID, const ResourceRequest& coreRequest)
 {
     NSURLRequest *request = coreRequest.nsURLRequest(HTTPBodyUpdatePolicy::DoNotUpdateHTTPBody);
     if (!request)
@@ -152,7 +152,7 @@
     [loader release];
 }
 
-void LegacyCustomProtocolManagerClient::stopLoading(LegacyCustomProtocolManagerProxy&, uint64_t customProtocolID)
+void LegacyCustomProtocolManagerClient::stopLoading(LegacyCustomProtocolManagerProxy&, WebKit::LegacyCustomProtocolID customProtocolID)
 {
     m_loaderMap.remove(customProtocolID);
 }

Modified: trunk/Source/WebKit/UIProcess/Network/CustomProtocols/LegacyCustomProtocolManagerProxy.cpp (260190 => 260191)


--- trunk/Source/WebKit/UIProcess/Network/CustomProtocols/LegacyCustomProtocolManagerProxy.cpp	2020-04-16 15:55:22 UTC (rev 260190)
+++ trunk/Source/WebKit/UIProcess/Network/CustomProtocols/LegacyCustomProtocolManagerProxy.cpp	2020-04-16 16:25:57 UTC (rev 260191)
@@ -42,12 +42,12 @@
     invalidate();
 }
 
-void LegacyCustomProtocolManagerProxy::startLoading(uint64_t customProtocolID, const WebCore::ResourceRequest& request)
+void LegacyCustomProtocolManagerProxy::startLoading(LegacyCustomProtocolID customProtocolID, const WebCore::ResourceRequest& request)
 {
     m_networkProcessProxy.processPool().customProtocolManagerClient().startLoading(*this, customProtocolID, request);
 }
 
-void LegacyCustomProtocolManagerProxy::stopLoading(uint64_t customProtocolID)
+void LegacyCustomProtocolManagerProxy::stopLoading(LegacyCustomProtocolID customProtocolID)
 {
     m_networkProcessProxy.processPool().customProtocolManagerClient().stopLoading(*this, customProtocolID);
 }
@@ -57,27 +57,27 @@
     m_networkProcessProxy.processPool().customProtocolManagerClient().invalidate(*this);
 }
 
-void LegacyCustomProtocolManagerProxy::wasRedirectedToRequest(uint64_t customProtocolID, const WebCore::ResourceRequest& request, const WebCore::ResourceResponse& redirectResponse)
+void LegacyCustomProtocolManagerProxy::wasRedirectedToRequest(LegacyCustomProtocolID customProtocolID, const WebCore::ResourceRequest& request, const WebCore::ResourceResponse& redirectResponse)
 {
     m_networkProcessProxy.send(Messages::LegacyCustomProtocolManager::WasRedirectedToRequest(customProtocolID, request, redirectResponse), 0);
 }
 
-void LegacyCustomProtocolManagerProxy::didReceiveResponse(uint64_t customProtocolID, const WebCore::ResourceResponse& response, uint32_t cacheStoragePolicy)
+void LegacyCustomProtocolManagerProxy::didReceiveResponse(LegacyCustomProtocolID customProtocolID, const WebCore::ResourceResponse& response, uint32_t cacheStoragePolicy)
 {
     m_networkProcessProxy.send(Messages::LegacyCustomProtocolManager::DidReceiveResponse(customProtocolID, response, cacheStoragePolicy), 0);
 }
 
-void LegacyCustomProtocolManagerProxy::didLoadData(uint64_t customProtocolID, const IPC::DataReference& data)
+void LegacyCustomProtocolManagerProxy::didLoadData(LegacyCustomProtocolID customProtocolID, const IPC::DataReference& data)
 {
     m_networkProcessProxy.send(Messages::LegacyCustomProtocolManager::DidLoadData(customProtocolID, data), 0);
 }
 
-void LegacyCustomProtocolManagerProxy::didFailWithError(uint64_t customProtocolID, const WebCore::ResourceError& error)
+void LegacyCustomProtocolManagerProxy::didFailWithError(LegacyCustomProtocolID customProtocolID, const WebCore::ResourceError& error)
 {
     m_networkProcessProxy.send(Messages::LegacyCustomProtocolManager::DidFailWithError(customProtocolID, error), 0);
 }
 
-void LegacyCustomProtocolManagerProxy::didFinishLoading(uint64_t customProtocolID)
+void LegacyCustomProtocolManagerProxy::didFinishLoading(LegacyCustomProtocolID customProtocolID)
 {
     m_networkProcessProxy.send(Messages::LegacyCustomProtocolManager::DidFinishLoading(customProtocolID), 0);
 }

Modified: trunk/Source/WebKit/UIProcess/Network/CustomProtocols/LegacyCustomProtocolManagerProxy.h (260190 => 260191)


--- trunk/Source/WebKit/UIProcess/Network/CustomProtocols/LegacyCustomProtocolManagerProxy.h	2020-04-16 15:55:22 UTC (rev 260190)
+++ trunk/Source/WebKit/UIProcess/Network/CustomProtocols/LegacyCustomProtocolManagerProxy.h	2020-04-16 16:25:57 UTC (rev 260191)
@@ -25,8 +25,8 @@
 
 #pragma once
 
+#include "LegacyCustomProtocolID.h"
 #include "MessageReceiver.h"
-
 #include <wtf/WeakPtr.h>
 
 #if PLATFORM(COCOA)
@@ -54,16 +54,16 @@
     LegacyCustomProtocolManagerProxy(NetworkProcessProxy&);
     ~LegacyCustomProtocolManagerProxy();
 
-    void startLoading(uint64_t customProtocolID, const WebCore::ResourceRequest&);
-    void stopLoading(uint64_t customProtocolID);
+    void startLoading(LegacyCustomProtocolID, const WebCore::ResourceRequest&);
+    void stopLoading(LegacyCustomProtocolID);
 
     void invalidate();
 
-    void wasRedirectedToRequest(uint64_t customProtocolID, const WebCore::ResourceRequest&, const WebCore::ResourceResponse&);
-    void didReceiveResponse(uint64_t customProtocolID, const WebCore::ResourceResponse&, uint32_t cacheStoragePolicy);
-    void didLoadData(uint64_t customProtocolID, const IPC::DataReference&);
-    void didFailWithError(uint64_t customProtocolID, const WebCore::ResourceError&);
-    void didFinishLoading(uint64_t customProtocolID);
+    void wasRedirectedToRequest(LegacyCustomProtocolID, const WebCore::ResourceRequest&, const WebCore::ResourceResponse&);
+    void didReceiveResponse(LegacyCustomProtocolID, const WebCore::ResourceResponse&, uint32_t cacheStoragePolicy);
+    void didLoadData(LegacyCustomProtocolID, const IPC::DataReference&);
+    void didFailWithError(LegacyCustomProtocolID, const WebCore::ResourceError&);
+    void didFinishLoading(LegacyCustomProtocolID);
 
 private:
     // IPC::MessageReceiver
@@ -70,11 +70,6 @@
     void didReceiveMessage(IPC::Connection&, IPC::Decoder&) override;
 
     NetworkProcessProxy& m_networkProcessProxy;
-
-#if PLATFORM(COCOA)
-    typedef HashMap<uint64_t, RetainPtr<WKCustomProtocolLoader>> LoaderMap;
-    LoaderMap m_loaderMap;
-#endif
 };
 
 } // namespace WebKit

Modified: trunk/Source/WebKit/UIProcess/Network/CustomProtocols/LegacyCustomProtocolManagerProxy.messages.in (260190 => 260191)


--- trunk/Source/WebKit/UIProcess/Network/CustomProtocols/LegacyCustomProtocolManagerProxy.messages.in	2020-04-16 15:55:22 UTC (rev 260190)
+++ trunk/Source/WebKit/UIProcess/Network/CustomProtocols/LegacyCustomProtocolManagerProxy.messages.in	2020-04-16 16:25:57 UTC (rev 260191)
@@ -21,6 +21,6 @@
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 messages -> LegacyCustomProtocolManagerProxy NotRefCounted {
-    StartLoading(uint64_t customProtocolID, WebCore::ResourceRequest request)
-    StopLoading(uint64_t customProtocolID)
+    StartLoading(WebKit::LegacyCustomProtocolID customProtocolID, WebCore::ResourceRequest request)
+    StopLoading(WebKit::LegacyCustomProtocolID customProtocolID)
 }

Modified: trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj (260190 => 260191)


--- trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj	2020-04-16 15:55:22 UTC (rev 260190)
+++ trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj	2020-04-16 16:25:57 UTC (rev 260191)
@@ -930,6 +930,7 @@
 		41FAF5F81E3C1021001AE678 /* LibWebRTCResolver.h in Headers */ = {isa = PBXBuildFile; fileRef = 41FAF5F61E3C0B47001AE678 /* LibWebRTCResolver.h */; };
 		4459984222833E8700E61373 /* SyntheticEditingCommandType.h in Headers */ = {isa = PBXBuildFile; fileRef = 4459984122833E6000E61373 /* SyntheticEditingCommandType.h */; };
 		449D90DA21FDC30B00F677C0 /* LocalAuthenticationSoftLink.mm in Sources */ = {isa = PBXBuildFile; fileRef = 449D90D821FD63FE00F677C0 /* LocalAuthenticationSoftLink.mm */; };
+		44E936FD2447C2D8009FA3E3 /* LegacyCustomProtocolID.h in Headers */ = {isa = PBXBuildFile; fileRef = 44E936FC2447C256009FA3E3 /* LegacyCustomProtocolID.h */; };
 		460F488F1F996F7100CF4B87 /* WebSWContextManagerConnectionMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 460F488D1F996F6C00CF4B87 /* WebSWContextManagerConnectionMessageReceiver.cpp */; };
 		460F48901F996F7100CF4B87 /* WebSWContextManagerConnectionMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = 460F488E1F996F6C00CF4B87 /* WebSWContextManagerConnectionMessages.h */; };
 		461CCCA5231485A700B659B9 /* UIRemoteObjectRegistry.h in Headers */ = {isa = PBXBuildFile; fileRef = 463236852314833F00A48FA7 /* UIRemoteObjectRegistry.h */; };
@@ -3513,6 +3514,7 @@
 		4459984122833E6000E61373 /* SyntheticEditingCommandType.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SyntheticEditingCommandType.h; sourceTree = "<group>"; };
 		449D90D821FD63FE00F677C0 /* LocalAuthenticationSoftLink.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = LocalAuthenticationSoftLink.mm; sourceTree = "<group>"; };
 		44A481C621F2D27B00F2F919 /* ClientCertificateAuthenticationXPCConstants.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = ClientCertificateAuthenticationXPCConstants.cpp; sourceTree = "<group>"; };
+		44E936FC2447C256009FA3E3 /* LegacyCustomProtocolID.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LegacyCustomProtocolID.h; sourceTree = "<group>"; };
 		4603011A234BE31D009C8217 /* WebBackForwardCache.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebBackForwardCache.cpp; sourceTree = "<group>"; };
 		4603011B234BE31E009C8217 /* WebBackForwardCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebBackForwardCache.h; sourceTree = "<group>"; };
 		460F488D1F996F6C00CF4B87 /* WebSWContextManagerConnectionMessageReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WebSWContextManagerConnectionMessageReceiver.cpp; path = DerivedSources/WebKit2/WebSWContextManagerConnectionMessageReceiver.cpp; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -8217,6 +8219,7 @@
 			isa = PBXGroup;
 			children = (
 				5C14271A1C23F8BF00D41183 /* Cocoa */,
+				44E936FC2447C256009FA3E3 /* LegacyCustomProtocolID.h */,
 				5CFECB031E1ED1C800F88504 /* LegacyCustomProtocolManager.cpp */,
 				5C1427141C23F8B000D41183 /* LegacyCustomProtocolManager.h */,
 				5C1427151C23F8B000D41183 /* LegacyCustomProtocolManager.messages.in */,
@@ -10809,6 +10812,7 @@
 				1AE4987811FF7FAA0048B464 /* JSNPObject.h in Headers */,
 				BCE0937814FB128C001138D9 /* LayerHostingContext.h in Headers */,
 				1A92DC1112F8BA460017AF65 /* LayerTreeContext.h in Headers */,
+				44E936FD2447C2D8009FA3E3 /* LegacyCustomProtocolID.h in Headers */,
 				5C1427181C23F8B700D41183 /* LegacyCustomProtocolManager.h in Headers */,
 				7A821F4C1E2F673900604577 /* LegacyCustomProtocolManagerClient.h in Headers */,
 				2984F589164BA095004BC0C6 /* LegacyCustomProtocolManagerMessages.h in Headers */,
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to