Title: [235365] trunk/Source/WebKit
Revision
235365
Author
[email protected]
Date
2018-08-27 08:51:24 -0700 (Mon, 27 Aug 2018)

Log Message

[Cocoa] Adapt more WebKit code to be ARC-compatible
https://bugs.webkit.org/show_bug.cgi?id=188955

Reviewed by Anders Carlsson.

* NetworkProcess/cocoa/NetworkDataTaskCocoa.h: Use __strong for an in/out argument.
* NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
(WebKit::NetworkDataTaskCocoa::applySniffingPoliciesAndBindRequestToInferfaceIfNeeded):
Use __strong for a in/out argument.
(WebKit::NetworkDataTaskCocoa::applyCookieBlockingPolicy): Call a NSURLSessionTask
method using an explicit category declaration rather than by using performSelector:
since ARC is unable to correctly compile a call when it doesn't know argument and
result types.

* PluginProcess/mac/PluginProcessMac.mm:
(WebKit::initializeCocoaOverrides): Add some __bridge casts.

* Shared/API/Cocoa/WKRemoteObjectCoder.mm: Use HashSet<CFTypeRef> instead of
HashSet<Class> since Class ia an ARC-managed type and WTF hash tables can't
currently handle those as key types.
(-[WKRemoteObjectDecoder decodeValueOfObjCType:at:]): Changed types and added casts
to adapt to the above.
(decodeObjectFromObjectStream): Ditto.
(checkIfClassIsAllowed): Ditto.
(decodeInvocationArguments): Ditto.
(decodeObject): Ditto.
(-[WKRemoteObjectDecoder decodeObjectOfClasses:forKey:]): Ditto.
(-[WKRemoteObjectDecoder allowedClasses]): Ditto.
* Shared/API/Cocoa/_WKRemoteObjectInterface.mm:
(propertyListClasses): Ditto.
(initializeMethod): Ditto.
(-[_WKRemoteObjectInterface debugDescription]): Ditto.
(classesForSelectorArgument): Ditto.
(-[_WKRemoteObjectInterface classesForSelector:argumentIndex:ofReply:]): Ditto.
(-[_WKRemoteObjectInterface setClasses:forSelector:argumentIndex:ofReply:]): Ditto.
(-[_WKRemoteObjectInterface _allowedArgumentClassesForSelector:]): Ditto.
(-[_WKRemoteObjectInterface _allowedArgumentClassesForReplyBlockOfSelector:]): Ditto.
* Shared/API/Cocoa/_WKRemoteObjectInterfaceInternal.h: Ditto.

* Shared/API/c/cf/WKStringCF.mm:
(WKStringCreateWithCFString): Use CFRetain instead of -[NSObject retain]. Also use
a __bridge cast.
* Shared/API/c/cf/WKURLCF.mm:
(WKURLCreateWithCFURL): Ditto.

* Shared/Cocoa/APIObject.mm:
(API::Object::ref): Added a __bridge cast.
(API::Object::deref): Ditto.
(API::allocateWKObject): Use class_createInstance instead of NSAllocateObject.
(API::Object::wrap): Use a __bridge cast.
(API::Object::unwrap): Ditto.

* Shared/RemoteLayerTree/RemoteLayerTreePropertyApplier.h: Use CFTypeRef for layers
or views in the RelatedLayerMap since we don't want the items retained, and can't
use __unsafe_uretained because the header is used in non-Objective-C contexts.
* Shared/RemoteLayerTree/RemoteLayerTreePropertyApplier.mm:
(WebKit::RemoteLayerTreePropertyApplier::applyProperties): Added __bridge casts,
needed because of the above change.

* UIProcess/API/Cocoa/WKBrowsingContextController.mm:
(WebKit::browsingContextControllerMap): Use __unsafe_unretained.

* UIProcess/API/Cocoa/WKConnection.mm:
(didReceiveMessage): Use a __bridge cast.

* UIProcess/API/Cocoa/WKContentRuleListStore.mm:
(-[WKContentRuleListStore compileContentRuleListForIdentifier:encodedContentRuleList:completionHandler:]):
Use a retain here so we don't have to have a "releasesArgument:" boolean. The cost of a single
retain/release pair should be infinitesmal compared to the entire process of compiling.
(-[WKContentRuleListStore _compileContentRuleListForIdentifier:encodedContentRuleList:completionHandler:]):
Moved the code for the "releases argument" version here since the private method is now the
actual method that does the work. The public method now simply calls this private one after
doing a retain. The optimization of releasing the argument at the correct moment should be intact.

* UIProcess/API/Cocoa/WKHTTPCookieStore.mm: Use CFTypeRef for the key to the _observers
HashMap since the WTF collections can't yet handle ARC types for keys.
(-[WKHTTPCookieStore addObserver:]): Added __bridge cast for compatibility with the above.
(-[WKHTTPCookieStore removeObserver:]): Ditto.

* UIProcess/API/Cocoa/WKProcessGroup.mm:
(setUpConnectionClient): Added a __bridge cast.
(setUpHistoryClient): Ditto.

* UIProcess/API/Cocoa/WKViewPrivate.h: Added a declaration of the
-[WKView _shouldLoadIconWithParameters:completionHandler:] method. This peculiar idiom
should be removed, but I didn't bother doing that since the entire WKView class is already
deprecated and so will eventually be removed.

* UIProcess/API/Cocoa/WKWebView.mm: Use __unsafe_unretained for the keys in the page to
view map.
(accessibilityEventsEnabledChangedCallback): Use a __bridge cast.
(-[WKWebView _certificateChain]): Ditto.
(-[WKWebView certificateChain]): Ditto.

* UIProcess/API/mac/WKView.mm:
(-[WKView maybeInstallIconLoadingClient]): Call the method
_shouldLoadIconWithParameters:completionHandler: in a normal way rather than using
performSelector:withObject:withObject: since ARC is unable to correctly compile a call
when it doesn't know argument and result types.

* UIProcess/Cocoa/NavigationState.mm:
(WebKit::NavigationState::NavigationClient::webCryptoMasterKey): Use the overload
of API::Data::createWithoutCopying that knows how to work with an NSData rather than
re-implementing it here.
* UIProcess/Cocoa/WebProcessPoolCocoa.mm:
(WebKit::WebProcessPool::platformInitializeWebProcess): Ditto. Also removed unneeded
use of RetainPtr.

* UIProcess/Cocoa/WebViewImpl.h: Use NSObject * as the result type of
immediateActionAnimationControllerForHitTestResult. Our techniques for defining such
functions in headers while remaining compatible with non-Objective-C will still work
fine given how we use this, and converting to and from void* rather than NSObject *
would be difficult to do correctly under ARC.

* UIProcess/Cocoa/WebViewImpl.mm:
(WebKit::WebViewImpl::acceptsFirstMouse): Use CFRetain/CFAutorelease instead of
retain/autorelease.
(WebKit::WebViewImpl::shouldDelayWindowOrderingForEvent): Ditto.
(WebKit::WebViewImpl::immediateActionAnimationControllerForHitTestResult):
Updated return type to NSObject *.
(WebKit::WebViewImpl::performKeyEquivalent): Use CFRetain/CFAutorelease.

* UIProcess/PageClient.h: Use NSObject * as the result type, as above.

* UIProcess/RemoteLayerTree/RemoteLayerTreeHost.mm:
(WebKit::RemoteLayerTreeHost::updateLayerTree): Use __bridge casts to be compatible
with the changes to the RelatedLayerMap types.
(WebKit::recursivelyMapIOSurfaceBackingStore): Use __bridge cast.

* Source/WebKit/UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::immediateActionAnimationControllerForHitTestResult):
Use NSObject * as the result type, as above.
* Source/WebKit/UIProcess/WebPageProxy.h: Ditto.

* UIProcess/mac/PageClientImplMac.h: Use NSObject * as the result type, as above.
* UIProcess/mac/PageClientImplMac.mm:
(WebKit::PageClientImpl::immediateActionAnimationControllerForHitTestResult):
Ditto.
(WebKit::PageClientImpl::refView): Use __bridge cast.
(WebKit::PageClientImpl::derefView): Ditto.

* UIProcess/mac/ServicesController.mm:
(WebKit::ServicesController::refreshExistingServices): Removed unnecessary use
of NeverDestroyed for Objective-C object pointers. Simpler and more efficient
both with and without ARC.

* UIProcess/mac/WKImmediateActionController.mm:
(-[WKImmediateActionController _updateImmediateActionItem]): Removed unneeded
cast now that immediateActionAnimationControllerForHitTestResult has a more
accurate return type.

* UIProcess/mac/WKPrintingView.mm:
(-[WKPrintingView dealloc]): Use a more direct approach to making sure we do the
non-thread-safe actions on the main thread with a call to callOnMainThread.
The old solution, WebCoreObjCScheduleDeallocateOnMainThread, may not be possible
in an ARC-compatible way, but this one should work fine.
(linkDestinationName): Changed to return an NSString * to make sure we get the
object lifetimes correct under ARC.
(-[WKPrintingView _drawPDFDocument:page:atPoint:]): Added __bridge casts.

* WebProcess/InjectedBundle/API/mac/WKDOMInternals.h: Use __unsafe_unretained
for the value types in DOM caches.
* WebProcess/InjectedBundle/API/mac/WKDOMInternals.mm:
(WebKit::toWKDOMNode): Updated for the above.
(WebKit::toWKDOMRange): Ditto.

* WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm:
(WebKit::NetscapePlugin::platformPreInitialize): Rewrote the class_replaceMethod
call to sidestep the rules about not using @selector(release) under ARC.
(WebKit::NetscapePlugin::updatePluginLayer): Use __bridge casts.

* WebProcess/Plugins/PDF/PDFPlugin.mm: Added an include of
WebAccessibilityObjectWrapperMac.h, without which this code doesn't compile
under ARC.

* WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm:
(WebKit::changeWordCase): Use a function rather than a selector, since ARC is unable
to correctly compile a method call when it doesn't know argument and result types.
(WebKit::WebEditorClient::uppercaseWord): Updated to use a function rather than a selector.
(WebKit::WebEditorClient::lowercaseWord): Ditto.
(WebKit::WebEditorClient::capitalizeWord): Ditto.

* WebProcess/cocoa/WebProcessCocoa.mm: Added an include of
WebAccessibilityObjectWrapperIOS/Mac.h, without which this code doesn't compile
under ARC.

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (235364 => 235365)


--- trunk/Source/WebKit/ChangeLog	2018-08-27 15:44:18 UTC (rev 235364)
+++ trunk/Source/WebKit/ChangeLog	2018-08-27 15:51:24 UTC (rev 235365)
@@ -1,3 +1,191 @@
+2018-08-26  Darin Adler  <[email protected]>
+
+        [Cocoa] Adapt more WebKit code to be ARC-compatible
+        https://bugs.webkit.org/show_bug.cgi?id=188955
+
+        Reviewed by Anders Carlsson.
+
+        * NetworkProcess/cocoa/NetworkDataTaskCocoa.h: Use __strong for an in/out argument.
+        * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
+        (WebKit::NetworkDataTaskCocoa::applySniffingPoliciesAndBindRequestToInferfaceIfNeeded):
+        Use __strong for a in/out argument.
+        (WebKit::NetworkDataTaskCocoa::applyCookieBlockingPolicy): Call a NSURLSessionTask
+        method using an explicit category declaration rather than by using performSelector:
+        since ARC is unable to correctly compile a call when it doesn't know argument and
+        result types.
+
+        * PluginProcess/mac/PluginProcessMac.mm:
+        (WebKit::initializeCocoaOverrides): Add some __bridge casts.
+
+        * Shared/API/Cocoa/WKRemoteObjectCoder.mm: Use HashSet<CFTypeRef> instead of
+        HashSet<Class> since Class ia an ARC-managed type and WTF hash tables can't
+        currently handle those as key types.
+        (-[WKRemoteObjectDecoder decodeValueOfObjCType:at:]): Changed types and added casts
+        to adapt to the above.
+        (decodeObjectFromObjectStream): Ditto.
+        (checkIfClassIsAllowed): Ditto.
+        (decodeInvocationArguments): Ditto.
+        (decodeObject): Ditto.
+        (-[WKRemoteObjectDecoder decodeObjectOfClasses:forKey:]): Ditto.
+        (-[WKRemoteObjectDecoder allowedClasses]): Ditto.
+        * Shared/API/Cocoa/_WKRemoteObjectInterface.mm:
+        (propertyListClasses): Ditto.
+        (initializeMethod): Ditto.
+        (-[_WKRemoteObjectInterface debugDescription]): Ditto.
+        (classesForSelectorArgument): Ditto.
+        (-[_WKRemoteObjectInterface classesForSelector:argumentIndex:ofReply:]): Ditto.
+        (-[_WKRemoteObjectInterface setClasses:forSelector:argumentIndex:ofReply:]): Ditto.
+        (-[_WKRemoteObjectInterface _allowedArgumentClassesForSelector:]): Ditto.
+        (-[_WKRemoteObjectInterface _allowedArgumentClassesForReplyBlockOfSelector:]): Ditto.
+        * Shared/API/Cocoa/_WKRemoteObjectInterfaceInternal.h: Ditto.
+
+        * Shared/API/c/cf/WKStringCF.mm:
+        (WKStringCreateWithCFString): Use CFRetain instead of -[NSObject retain]. Also use
+        a __bridge cast.
+        * Shared/API/c/cf/WKURLCF.mm:
+        (WKURLCreateWithCFURL): Ditto.
+
+        * Shared/Cocoa/APIObject.mm:
+        (API::Object::ref): Added a __bridge cast.
+        (API::Object::deref): Ditto.
+        (API::allocateWKObject): Use class_createInstance instead of NSAllocateObject.
+        (API::Object::wrap): Use a __bridge cast.
+        (API::Object::unwrap): Ditto.
+
+        * Shared/RemoteLayerTree/RemoteLayerTreePropertyApplier.h: Use CFTypeRef for layers
+        or views in the RelatedLayerMap since we don't want the items retained, and can't
+        use __unsafe_uretained because the header is used in non-Objective-C contexts.
+        * Shared/RemoteLayerTree/RemoteLayerTreePropertyApplier.mm:
+        (WebKit::RemoteLayerTreePropertyApplier::applyProperties): Added __bridge casts,
+        needed because of the above change.
+
+        * UIProcess/API/Cocoa/WKBrowsingContextController.mm:
+        (WebKit::browsingContextControllerMap): Use __unsafe_unretained.
+
+        * UIProcess/API/Cocoa/WKConnection.mm:
+        (didReceiveMessage): Use a __bridge cast.
+
+        * UIProcess/API/Cocoa/WKContentRuleListStore.mm:
+        (-[WKContentRuleListStore compileContentRuleListForIdentifier:encodedContentRuleList:completionHandler:]):
+        Use a retain here so we don't have to have a "releasesArgument:" boolean. The cost of a single
+        retain/release pair should be infinitesmal compared to the entire process of compiling.
+        (-[WKContentRuleListStore _compileContentRuleListForIdentifier:encodedContentRuleList:completionHandler:]):
+        Moved the code for the "releases argument" version here since the private method is now the
+        actual method that does the work. The public method now simply calls this private one after
+        doing a retain. The optimization of releasing the argument at the correct moment should be intact.
+
+        * UIProcess/API/Cocoa/WKHTTPCookieStore.mm: Use CFTypeRef for the key to the _observers
+        HashMap since the WTF collections can't yet handle ARC types for keys.
+        (-[WKHTTPCookieStore addObserver:]): Added __bridge cast for compatibility with the above.
+        (-[WKHTTPCookieStore removeObserver:]): Ditto.
+
+        * UIProcess/API/Cocoa/WKProcessGroup.mm:
+        (setUpConnectionClient): Added a __bridge cast.
+        (setUpHistoryClient): Ditto.
+
+        * UIProcess/API/Cocoa/WKViewPrivate.h: Added a declaration of the
+        -[WKView _shouldLoadIconWithParameters:completionHandler:] method. This peculiar idiom
+        should be removed, but I didn't bother doing that since the entire WKView class is already
+        deprecated and so will eventually be removed.
+
+        * UIProcess/API/Cocoa/WKWebView.mm: Use __unsafe_unretained for the keys in the page to
+        view map.
+        (accessibilityEventsEnabledChangedCallback): Use a __bridge cast.
+        (-[WKWebView _certificateChain]): Ditto.
+        (-[WKWebView certificateChain]): Ditto.
+
+        * UIProcess/API/mac/WKView.mm:
+        (-[WKView maybeInstallIconLoadingClient]): Call the method
+        _shouldLoadIconWithParameters:completionHandler: in a normal way rather than using
+        performSelector:withObject:withObject: since ARC is unable to correctly compile a call
+        when it doesn't know argument and result types.
+
+        * UIProcess/Cocoa/NavigationState.mm:
+        (WebKit::NavigationState::NavigationClient::webCryptoMasterKey): Use the overload
+        of API::Data::createWithoutCopying that knows how to work with an NSData rather than
+        re-implementing it here.
+        * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
+        (WebKit::WebProcessPool::platformInitializeWebProcess): Ditto. Also removed unneeded
+        use of RetainPtr.
+
+        * UIProcess/Cocoa/WebViewImpl.h: Use NSObject * as the result type of
+        immediateActionAnimationControllerForHitTestResult. Our techniques for defining such
+        functions in headers while remaining compatible with non-Objective-C will still work
+        fine given how we use this, and converting to and from void* rather than NSObject *
+        would be difficult to do correctly under ARC.
+
+        * UIProcess/Cocoa/WebViewImpl.mm:
+        (WebKit::WebViewImpl::acceptsFirstMouse): Use CFRetain/CFAutorelease instead of
+        retain/autorelease.
+        (WebKit::WebViewImpl::shouldDelayWindowOrderingForEvent): Ditto.
+        (WebKit::WebViewImpl::immediateActionAnimationControllerForHitTestResult):
+        Updated return type to NSObject *.
+        (WebKit::WebViewImpl::performKeyEquivalent): Use CFRetain/CFAutorelease.
+
+        * UIProcess/PageClient.h: Use NSObject * as the result type, as above.
+
+        * UIProcess/RemoteLayerTree/RemoteLayerTreeHost.mm:
+        (WebKit::RemoteLayerTreeHost::updateLayerTree): Use __bridge casts to be compatible
+        with the changes to the RelatedLayerMap types.
+        (WebKit::recursivelyMapIOSurfaceBackingStore): Use __bridge cast.
+
+        * Source/WebKit/UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::immediateActionAnimationControllerForHitTestResult):
+        Use NSObject * as the result type, as above.
+        * Source/WebKit/UIProcess/WebPageProxy.h: Ditto.
+
+        * UIProcess/mac/PageClientImplMac.h: Use NSObject * as the result type, as above.
+        * UIProcess/mac/PageClientImplMac.mm:
+        (WebKit::PageClientImpl::immediateActionAnimationControllerForHitTestResult):
+        Ditto.
+        (WebKit::PageClientImpl::refView): Use __bridge cast.
+        (WebKit::PageClientImpl::derefView): Ditto.
+
+        * UIProcess/mac/ServicesController.mm:
+        (WebKit::ServicesController::refreshExistingServices): Removed unnecessary use
+        of NeverDestroyed for Objective-C object pointers. Simpler and more efficient
+        both with and without ARC.
+
+        * UIProcess/mac/WKImmediateActionController.mm:
+        (-[WKImmediateActionController _updateImmediateActionItem]): Removed unneeded
+        cast now that immediateActionAnimationControllerForHitTestResult has a more
+        accurate return type.
+
+        * UIProcess/mac/WKPrintingView.mm:
+        (-[WKPrintingView dealloc]): Use a more direct approach to making sure we do the
+        non-thread-safe actions on the main thread with a call to callOnMainThread.
+        The old solution, WebCoreObjCScheduleDeallocateOnMainThread, may not be possible
+        in an ARC-compatible way, but this one should work fine.
+        (linkDestinationName): Changed to return an NSString * to make sure we get the
+        object lifetimes correct under ARC.
+        (-[WKPrintingView _drawPDFDocument:page:atPoint:]): Added __bridge casts.
+
+        * WebProcess/InjectedBundle/API/mac/WKDOMInternals.h: Use __unsafe_unretained
+        for the value types in DOM caches.
+        * WebProcess/InjectedBundle/API/mac/WKDOMInternals.mm:
+        (WebKit::toWKDOMNode): Updated for the above.
+        (WebKit::toWKDOMRange): Ditto.
+
+        * WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm:
+        (WebKit::NetscapePlugin::platformPreInitialize): Rewrote the class_replaceMethod
+        call to sidestep the rules about not using @selector(release) under ARC.
+        (WebKit::NetscapePlugin::updatePluginLayer): Use __bridge casts.
+
+        * WebProcess/Plugins/PDF/PDFPlugin.mm: Added an include of
+        WebAccessibilityObjectWrapperMac.h, without which this code doesn't compile
+        under ARC.
+
+        * WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm:
+        (WebKit::changeWordCase): Use a function rather than a selector, since ARC is unable
+        to correctly compile a method call when it doesn't know argument and result types.
+        (WebKit::WebEditorClient::uppercaseWord): Updated to use a function rather than a selector.
+        (WebKit::WebEditorClient::lowercaseWord): Ditto.
+        (WebKit::WebEditorClient::capitalizeWord): Ditto.
+
+        * WebProcess/cocoa/WebProcessCocoa.mm: Added an include of
+        WebAccessibilityObjectWrapperIOS/Mac.h, without which this code doesn't compile
+        under ARC.
+
 2018-08-27  Alex Christensen  <[email protected]>
 
         Fix authentication for clients of WKPageLoaderClient after r234941

Modified: trunk/Source/WebKit/NetworkProcess/cocoa/NetworkDataTaskCocoa.h (235364 => 235365)


--- trunk/Source/WebKit/NetworkProcess/cocoa/NetworkDataTaskCocoa.h	2018-08-27 15:44:18 UTC (rev 235364)
+++ trunk/Source/WebKit/NetworkProcess/cocoa/NetworkDataTaskCocoa.h	2018-08-27 15:51:24 UTC (rev 235365)
@@ -87,7 +87,7 @@
     NetworkDataTaskCocoa(NetworkSession&, NetworkDataTaskClient&, const WebCore::ResourceRequest&, uint64_t frameID, uint64_t pageID, WebCore::StoredCredentialsPolicy, WebCore::ContentSniffingPolicy, WebCore::ContentEncodingSniffingPolicy, bool shouldClearReferrerOnHTTPSToHTTPRedirect, PreconnectOnly, bool dataTaskIsForMainFrameNavigation, std::optional<NetworkActivityTracker>);
 
     bool tryPasswordBasedAuthentication(const WebCore::AuthenticationChallenge&, ChallengeCompletionHandler&);
-    void applySniffingPoliciesAndBindRequestToInferfaceIfNeeded(NSURLRequest*&, bool shouldContentSniff, bool shouldContentEncodingSniff);
+    void applySniffingPoliciesAndBindRequestToInferfaceIfNeeded(__strong NSURLRequest*&, bool shouldContentSniff, bool shouldContentEncodingSniff);
 
 #if HAVE(CFNETWORK_STORAGE_PARTITIONING)
     static NSHTTPCookieStorage *statelessCookieStorage();

Modified: trunk/Source/WebKit/NetworkProcess/cocoa/NetworkDataTaskCocoa.mm (235364 => 235365)


--- trunk/Source/WebKit/NetworkProcess/cocoa/NetworkDataTaskCocoa.mm	2018-08-27 15:44:18 UTC (rev 235364)
+++ trunk/Source/WebKit/NetworkProcess/cocoa/NetworkDataTaskCocoa.mm	2018-08-27 15:51:24 UTC (rev 235365)
@@ -56,6 +56,15 @@
 #import <CFNetwork/CFNSURLConnection.h>
 #endif
 
+#if HAVE(CFNETWORK_STORAGE_PARTITIONING)
+
+// FIXME: Move to CFNetworkSPI.h?
+@interface NSURLSessionTask ()
+- (void)_setExplicitCookieStorage:(CFHTTPCookieStorageRef)storage;
+@end
+
+#endif
+
 namespace WebKit {
 
 #if USE(CREDENTIAL_STORAGE_WITH_NETWORK_SESSION)
@@ -85,7 +94,7 @@
     return NSURLSessionTaskPriorityDefault;
 }
 
-void NetworkDataTaskCocoa::applySniffingPoliciesAndBindRequestToInferfaceIfNeeded(NSURLRequest*& nsRequest, bool shouldContentSniff, bool shouldContentEncodingSniff)
+void NetworkDataTaskCocoa::applySniffingPoliciesAndBindRequestToInferfaceIfNeeded(__strong NSURLRequest *& nsRequest, bool shouldContentSniff, bool shouldContentEncodingSniff)
 {
 #if !PLATFORM(MAC)
     UNUSED_PARAM(shouldContentEncodingSniff);
@@ -119,6 +128,7 @@
 }
 
 #if HAVE(CFNETWORK_STORAGE_PARTITIONING)
+
 NSHTTPCookieStorage *NetworkDataTaskCocoa::statelessCookieStorage()
 {
     static NeverDestroyed<RetainPtr<NSHTTPCookieStorage>> statelessCookieStorage;
@@ -144,10 +154,11 @@
     if (shouldBlock == m_hasBeenSetToUseStatelessCookieStorage)
         return;
 
-    NSHTTPCookieStorage *storage = shouldBlock ? statelessCookieStorage(): m_session->networkStorageSession().nsCookieStorage();
-    [m_task performSelector:NSSelectorFromString(@"_setExplicitCookieStorage:") withObject:(NSObject*)storage._cookieStorage];
+    NSHTTPCookieStorage *storage = shouldBlock ? statelessCookieStorage() : m_session->networkStorageSession().nsCookieStorage();
+    [m_task _setExplicitCookieStorage:storage._cookieStorage];
     m_hasBeenSetToUseStatelessCookieStorage = shouldBlock;
 }
+
 #endif
 
 bool NetworkDataTaskCocoa::isThirdPartyRequest(const WebCore::ResourceRequest& request)

Modified: trunk/Source/WebKit/PluginProcess/mac/PluginProcessMac.mm (235364 => 235365)


--- trunk/Source/WebKit/PluginProcess/mac/PluginProcessMac.mm	2018-08-27 15:44:18 UTC (rev 235364)
+++ trunk/Source/WebKit/PluginProcess/mac/PluginProcessMac.mm	2018-08-27 15:51:24 UTC (rev 235365)
@@ -453,8 +453,8 @@
                                                        usingBlock:^(NSNotification *notification) { fullscreenWindowTracker().windowHidden([notification object]); }];
 
     // Leak the two observers so that they observe notifications for the lifetime of the process.
-    CFRetain(orderOnScreenObserver);
-    CFRetain(orderOffScreenObserver);
+    CFRetain((__bridge CFTypeRef)orderOnScreenObserver);
+    CFRetain((__bridge CFTypeRef)orderOffScreenObserver);
 }
 
 void PluginProcess::setModalWindowIsShowing(bool modalWindowIsShowing)

Modified: trunk/Source/WebKit/Shared/API/Cocoa/WKRemoteObjectCoder.mm (235364 => 235365)


--- trunk/Source/WebKit/Shared/API/Cocoa/WKRemoteObjectCoder.mm	2018-08-27 15:44:18 UTC (rev 235364)
+++ trunk/Source/WebKit/Shared/API/Cocoa/WKRemoteObjectCoder.mm	2018-08-27 15:51:24 UTC (rev 235365)
@@ -385,7 +385,7 @@
     const API::Array* _objectStream;
     size_t _objectStreamPosition;
 
-    const HashSet<Class>* _allowedClasses;
+    const HashSet<CFTypeRef>* _allowedClasses;
 }
 
 - (id)initWithInterface:(_WKRemoteObjectInterface *)interface rootObjectDictionary:(const API::Dictionary*)rootObjectDictionary replyToSelector:(SEL)replyToSelector
@@ -410,7 +410,7 @@
     switch (*type) {
     // int
     case 'i':
-        *static_cast<int*>(data) = [decodeObjectFromObjectStream(self, { [NSNumber class] }) intValue];
+        *static_cast<int*>(data) = [decodeObjectFromObjectStream(self, { (__bridge CFTypeRef)[NSNumber class] }) intValue];
         break;
 
     default:
@@ -433,9 +433,9 @@
     return [self decodeObjectOfClasses:nil forKey:key];
 }
 
-static id decodeObject(WKRemoteObjectDecoder *, const API::Dictionary*, const HashSet<Class>& allowedClasses);
+static id decodeObject(WKRemoteObjectDecoder *, const API::Dictionary*, const HashSet<CFTypeRef>& allowedClasses);
 
-static id decodeObjectFromObjectStream(WKRemoteObjectDecoder *decoder, const HashSet<Class>& allowedClasses)
+static id decodeObjectFromObjectStream(WKRemoteObjectDecoder *decoder, const HashSet<CFTypeRef>& allowedClasses)
 {
     if (!decoder->_objectStream)
         return nil;
@@ -454,11 +454,11 @@
     if (!allowedClasses)
         return;
 
-    if (allowedClasses->contains(objectClass))
+    if (allowedClasses->contains((__bridge CFTypeRef)objectClass))
         return;
 
     for (Class superclass = class_getSuperclass(objectClass); superclass; superclass = class_getSuperclass(superclass)) {
-        if (allowedClasses->contains(superclass))
+        if (allowedClasses->contains((__bridge CFTypeRef)superclass))
             return;
     }
 
@@ -478,7 +478,7 @@
     [decoder validateClassSupportsSecureCoding:objectClass];
 }
 
-static void decodeInvocationArguments(WKRemoteObjectDecoder *decoder, NSInvocation *invocation, const Vector<HashSet<Class>>& allowedArgumentClasses, NSUInteger firstArgument)
+static void decodeInvocationArguments(WKRemoteObjectDecoder *decoder, NSInvocation *invocation, const Vector<HashSet<CFTypeRef>>& allowedArgumentClasses, NSUInteger firstArgument)
 {
     NSMethodSignature *methodSignature = invocation.methodSignature;
     NSUInteger argumentCount = methodSignature.numberOfArguments;
@@ -491,7 +491,7 @@
         switch (*type) {
         // double
         case 'd': {
-            double value = [decodeObjectFromObjectStream(decoder, { [NSNumber class] }) doubleValue];
+            double value = [decodeObjectFromObjectStream(decoder, { (__bridge CFTypeRef)[NSNumber class] }) doubleValue];
             [invocation setArgument:&value atIndex:i];
             break;
         }
@@ -498,7 +498,7 @@
 
         // float
         case 'f': {
-            float value = [decodeObjectFromObjectStream(decoder, { [NSNumber class] }) floatValue];
+            float value = [decodeObjectFromObjectStream(decoder, { (__bridge CFTypeRef)[NSNumber class] }) floatValue];
             [invocation setArgument:&value atIndex:i];
             break;
         }
@@ -505,7 +505,7 @@
 
         // int
         case 'i': {
-            int value = [decodeObjectFromObjectStream(decoder, { [NSNumber class] }) intValue];
+            int value = [decodeObjectFromObjectStream(decoder, { (__bridge CFTypeRef)[NSNumber class] }) intValue];
             [invocation setArgument:&value atIndex:i];
             break;
         }
@@ -512,7 +512,7 @@
 
         // unsigned
         case 'I': {
-            unsigned value = [decodeObjectFromObjectStream(decoder, { [NSNumber class] }) unsignedIntValue];
+            unsigned value = [decodeObjectFromObjectStream(decoder, { (__bridge CFTypeRef)[NSNumber class] }) unsignedIntValue];
             [invocation setArgument:&value atIndex:i];
             break;
         }
@@ -519,7 +519,7 @@
 
         // char
         case 'c': {
-            char value = [decodeObjectFromObjectStream(decoder, { [NSNumber class] }) charValue];
+            char value = [decodeObjectFromObjectStream(decoder, { (__bridge CFTypeRef)[NSNumber class] }) charValue];
             [invocation setArgument:&value atIndex:i];
             break;
         }
@@ -526,7 +526,7 @@
 
         // bool
         case 'B': {
-            bool value = [decodeObjectFromObjectStream(decoder, { [NSNumber class] }) boolValue];
+            bool value = [decodeObjectFromObjectStream(decoder, { (__bridge CFTypeRef)[NSNumber class] }) boolValue];
             [invocation setArgument:&value atIndex:i];
             break;
         }
@@ -533,7 +533,7 @@
 
         // long
         case 'q': {
-            long value = [decodeObjectFromObjectStream(decoder, { [NSNumber class] }) longValue];
+            long value = [decodeObjectFromObjectStream(decoder, { (__bridge CFTypeRef)[NSNumber class] }) longValue];
             [invocation setArgument:&value atIndex:i];
             break;
         }
@@ -540,7 +540,7 @@
 
         // unsigned long
         case 'Q': {
-            unsigned long value = [decodeObjectFromObjectStream(decoder, { [NSNumber class] }) unsignedLongValue];
+            unsigned long value = [decodeObjectFromObjectStream(decoder, { (__bridge CFTypeRef)[NSNumber class] }) unsignedLongValue];
             [invocation setArgument:&value atIndex:i];
             break;
         }
@@ -559,13 +559,13 @@
         // struct
         case '{':
             if (!strcmp(type, @encode(NSRange))) {
-                NSRange value = [decodeObjectFromObjectStream(decoder, { [NSValue class] }) rangeValue];
+                NSRange value = [decodeObjectFromObjectStream(decoder, { (__bridge CFTypeRef)[NSValue class] }) rangeValue];
                 [invocation setArgument:&value atIndex:i];
                 break;
             } else if (!strcmp(type, @encode(CGSize))) {
                 CGSize value;
-                value.width = [decodeObjectFromObjectStream(decoder, { [NSNumber class] }) doubleValue];
-                value.height = [decodeObjectFromObjectStream(decoder, { [NSNumber class] }) doubleValue];
+                value.width = [decodeObjectFromObjectStream(decoder, { (__bridge CFTypeRef)[NSNumber class] }) doubleValue];
+                value.height = [decodeObjectFromObjectStream(decoder, { (__bridge CFTypeRef)[NSNumber class] }) doubleValue];
                 [invocation setArgument:&value atIndex:i];
                 break;
             }
@@ -675,7 +675,7 @@
     return [result autorelease];
 }
 
-static id decodeObject(WKRemoteObjectDecoder *decoder, const API::Dictionary* dictionary, const HashSet<Class>& allowedClasses)
+static id decodeObject(WKRemoteObjectDecoder *decoder, const API::Dictionary* dictionary, const HashSet<CFTypeRef>& allowedClasses)
 {
     if (!dictionary)
         return nil;
@@ -686,7 +686,7 @@
     if (allowedClasses.isEmpty())
         return decodeObject(decoder);
 
-    SetForScope<const HashSet<Class>*> allowedClassesChange(decoder->_allowedClasses, &allowedClasses);
+    SetForScope<const HashSet<CFTypeRef>*> allowedClassesChange(decoder->_allowedClasses, &allowedClasses);
     return decodeObject(decoder);
 }
 
@@ -762,9 +762,9 @@
 
 - (id)decodeObjectOfClasses:(NSSet *)classes forKey:(NSString *)key
 {
-    HashSet<Class> allowedClasses;
+    HashSet<CFTypeRef> allowedClasses;
     for (Class allowedClass in classes)
-        allowedClasses.add(allowedClass);
+        allowedClasses.add((__bridge CFTypeRef)allowedClass);
 
     return decodeObject(self, _currentDictionary->get<API::Dictionary>(escapeKey(key)), allowedClasses);
 }
@@ -775,8 +775,8 @@
         return [NSSet set];
 
     auto result = adoptNS([[NSMutableSet alloc] init]);
-    for (Class allowedClass : *_allowedClasses)
-        [result addObject:allowedClass];
+    for (auto allowedClass : *_allowedClasses)
+        [result addObject:(__bridge Class)allowedClass];
 
     return result.autorelease();
 }

Modified: trunk/Source/WebKit/Shared/API/Cocoa/_WKRemoteObjectInterface.mm (235364 => 235365)


--- trunk/Source/WebKit/Shared/API/Cocoa/_WKRemoteObjectInterface.mm	2018-08-27 15:44:18 UTC (rev 235364)
+++ trunk/Source/WebKit/Shared/API/Cocoa/_WKRemoteObjectInterface.mm	2018-08-27 15:51:24 UTC (rev 235365)
@@ -46,12 +46,12 @@
 @end
 
 struct MethodInfo {
-    Vector<HashSet<Class>> allowedArgumentClasses;
+    Vector<HashSet<CFTypeRef>> allowedArgumentClasses;
 
     struct ReplyInfo {
         NSUInteger replyPosition;
         CString replySignature;
-        Vector<HashSet<Class>> allowedReplyClasses;
+        Vector<HashSet<CFTypeRef>> allowedReplyClasses;
     };
     std::optional<ReplyInfo> replyInfo;
 };
@@ -70,12 +70,15 @@
     return objectClass == arrayClass || objectClass == dictionaryClass;
 }
 
-static HashSet<Class>& propertyListClasses()
+static HashSet<CFTypeRef>& propertyListClasses()
 {
-    static LazyNeverDestroyed<HashSet<Class>> propertyListClasses;
+    static LazyNeverDestroyed<HashSet<CFTypeRef>> propertyListClasses;
     static dispatch_once_t onceToken;
     dispatch_once(&onceToken, ^{
-        propertyListClasses.construct(std::initializer_list<Class> { [NSArray class], [NSDictionary class], [NSNumber class], [NSString class] });
+        propertyListClasses.construct(std::initializer_list<CFTypeRef> {
+            (__bridge CFTypeRef)[NSArray class], (__bridge CFTypeRef)[NSDictionary class],
+            (__bridge CFTypeRef)[NSNumber class], (__bridge CFTypeRef)[NSString class]
+        });
     });
 
     return propertyListClasses;
@@ -83,7 +86,7 @@
 
 static void initializeMethod(MethodInfo& methodInfo, Protocol *protocol, SEL selector, NSMethodSignature *methodSignature, bool forReplyBlock)
 {
-    Vector<HashSet<Class>> allowedClasses;
+    Vector<HashSet<CFTypeRef>> allowedClasses;
 
     NSUInteger firstArgument = forReplyBlock ? 1 : 2;
     NSUInteger argumentCount = methodSignature.numberOfArguments;
@@ -127,7 +130,7 @@
             continue;
         }
 
-        allowedClasses.append({ objectClass });
+        allowedClasses.append({ (__bridge CFTypeRef)objectClass });
     }
 
     if (forReplyBlock)
@@ -212,8 +215,8 @@
             auto result = adoptNS([[NSMutableString alloc] initWithString:@"{"]);
 
             auto orderedArgumentClasses = copyToVector(allowedArgumentClasses);
-            std::sort(orderedArgumentClasses.begin(), orderedArgumentClasses.end(), [](Class a, Class b) {
-                return CString(class_getName(a)) < CString(class_getName(b));
+            std::sort(orderedArgumentClasses.begin(), orderedArgumentClasses.end(), [](CFTypeRef a, CFTypeRef b) {
+                return CString(class_getName((__bridge Class)a)) < CString(class_getName((__bridge Class)b));
             });
 
             bool needsComma = false;
@@ -221,7 +224,7 @@
                 if (needsComma)
                     [result appendString:@", "];
 
-                [result appendFormat:@"%s", class_getName(argumentClass)];
+                [result appendFormat:@"%s", class_getName((__bridge Class)argumentClass)];
                 needsComma = true;
             }
 
@@ -252,7 +255,7 @@
     return result.autorelease();
 }
 
-static HashSet<Class>& classesForSelectorArgument(_WKRemoteObjectInterface *interface, SEL selector, NSUInteger argumentIndex, bool replyBlock)
+static HashSet<CFTypeRef>& classesForSelectorArgument(_WKRemoteObjectInterface *interface, SEL selector, NSUInteger argumentIndex, bool replyBlock)
 {
     auto it = interface->_methods.find(selector);
     if (it == interface->_methods.end())
@@ -280,7 +283,7 @@
     auto result = adoptNS([[NSMutableSet alloc] init]);
 
     for (auto allowedClass : classesForSelectorArgument(self, selector, argumentIndex, ofReply))
-        [result addObject:allowedClass];
+        [result addObject:(__bridge Class)allowedClass];
 
     return result.autorelease();
 }
@@ -287,9 +290,9 @@
 
 - (void)setClasses:(NSSet *)classes forSelector:(SEL)selector argumentIndex:(NSUInteger)argumentIndex ofReply:(BOOL)ofReply
 {
-    HashSet<Class> allowedClasses;
+    HashSet<CFTypeRef> allowedClasses;
     for (Class allowedClass in classes)
-        allowedClasses.add(allowedClass);
+        allowedClasses.add((__bridge CFTypeRef)allowedClass);
 
     classesForSelectorArgument(self, selector, argumentIndex, ofReply) = WTFMove(allowedClasses);
 }
@@ -344,7 +347,7 @@
     return [NSMethodSignature signatureWithObjCTypes:methodInfo.replyInfo->replySignature.data()];
 }
 
-- (const Vector<HashSet<Class>>&)_allowedArgumentClassesForSelector:(SEL)selector
+- (const Vector<HashSet<CFTypeRef>>&)_allowedArgumentClassesForSelector:(SEL)selector
 {
     ASSERT(_methods.contains(selector));
 
@@ -351,7 +354,7 @@
     return _methods.find(selector)->value.allowedArgumentClasses;
 }
 
-- (const Vector<HashSet<Class>>&)_allowedArgumentClassesForReplyBlockOfSelector:(SEL)selector
+- (const Vector<HashSet<CFTypeRef>>&)_allowedArgumentClassesForReplyBlockOfSelector:(SEL)selector
 {
     ASSERT(_methods.contains(selector));
 

Modified: trunk/Source/WebKit/Shared/API/Cocoa/_WKRemoteObjectInterfaceInternal.h (235364 => 235365)


--- trunk/Source/WebKit/Shared/API/Cocoa/_WKRemoteObjectInterfaceInternal.h	2018-08-27 15:44:18 UTC (rev 235364)
+++ trunk/Source/WebKit/Shared/API/Cocoa/_WKRemoteObjectInterfaceInternal.h	2018-08-27 15:51:24 UTC (rev 235365)
@@ -35,8 +35,8 @@
 
 - (NSMethodSignature *)_methodSignatureForSelector:(SEL)selector;
 - (NSMethodSignature *)_methodSignatureForReplyBlockOfSelector:(SEL)selector;
-- (const Vector<HashSet<Class>>&)_allowedArgumentClassesForSelector:(SEL)selector;
-- (const Vector<HashSet<Class>>&)_allowedArgumentClassesForReplyBlockOfSelector:(SEL)selector;
+- (const Vector<HashSet<CFTypeRef>>&)_allowedArgumentClassesForSelector:(SEL)selector;
+- (const Vector<HashSet<CFTypeRef>>&)_allowedArgumentClassesForReplyBlockOfSelector:(SEL)selector;
 
 @end
 

Modified: trunk/Source/WebKit/Shared/API/c/cf/WKStringCF.mm (235364 => 235365)


--- trunk/Source/WebKit/Shared/API/c/cf/WKStringCF.mm	2018-08-27 15:44:18 UTC (rev 235364)
+++ trunk/Source/WebKit/Shared/API/c/cf/WKStringCF.mm	2018-08-27 15:51:24 UTC (rev 235365)
@@ -51,7 +51,7 @@
 #if WK_API_ENABLED
     // Since WKNSString is an internal class with no subclasses, we can do a simple equality check.
     if (object_getClass((__bridge NSString *)cfString) == wkNSStringClass())
-        return toAPI(static_cast<API::String*>(&[(WKNSString *)[(NSString *)cfString retain] _apiObject]));
+        return toAPI(static_cast<API::String*>(&[(WKNSString *)(__bridge NSString *)CFRetain(cfString) _apiObject]));
 #endif
     String string(cfString);
     return toCopiedAPI(string);

Modified: trunk/Source/WebKit/Shared/API/c/cf/WKURLCF.mm (235364 => 235365)


--- trunk/Source/WebKit/Shared/API/c/cf/WKURLCF.mm	2018-08-27 15:44:18 UTC (rev 235364)
+++ trunk/Source/WebKit/Shared/API/c/cf/WKURLCF.mm	2018-08-27 15:51:24 UTC (rev 235365)
@@ -55,7 +55,7 @@
 #if WK_API_ENABLED
     // Since WKNSURL is an internal class with no subclasses, we can do a simple equality check.
     if (object_getClass((__bridge NSURL *)cfURL) == wkNSURLClass())
-        return toAPI(static_cast<API::URL*>(&[(WKNSURL *)[(NSURL *)cfURL retain] _apiObject]));
+        return toAPI(static_cast<API::URL*>(&[(WKNSURL *)(__bridge NSURL *)CFRetain(cfURL) _apiObject]));
 #endif
 
     CString urlBytes;

Modified: trunk/Source/WebKit/Shared/Cocoa/APIObject.mm (235364 => 235365)


--- trunk/Source/WebKit/Shared/Cocoa/APIObject.mm	2018-08-27 15:44:18 UTC (rev 235364)
+++ trunk/Source/WebKit/Shared/Cocoa/APIObject.mm	2018-08-27 15:51:24 UTC (rev 235365)
@@ -95,17 +95,17 @@
 
 void Object::ref()
 {
-    CFRetain(wrapper());
+    CFRetain((__bridge CFTypeRef)wrapper());
 }
 
 void Object::deref()
 {
-    CFRelease(wrapper());
+    CFRelease((__bridge CFTypeRef)wrapper());
 }
 
 static id <WKObject> allocateWKObject(Class cls, size_t size)
 {
-    return NSAllocateObject(cls, size + maximumExtraSpaceForAlignment, nullptr);
+    return class_createInstance(cls, size + maximumExtraSpaceForAlignment);
 }
 
 API::Object& Object::fromWKObjectExtraSpace(id <WKObject> obj)
@@ -372,7 +372,7 @@
     if (!object)
         return nullptr;
 
-    return static_cast<void*>(object->wrapper());
+    return (__bridge void*)object->wrapper();
 }
 
 API::Object* Object::unwrap(void* object)
@@ -380,7 +380,7 @@
     if (!object)
         return nullptr;
 
-    return &static_cast<id <WKObject>>(object)._apiObject;
+    return &((__bridge id <WKObject>)object)._apiObject;
 }
 
 } // namespace API

Modified: trunk/Source/WebKit/Shared/RemoteLayerTree/RemoteLayerTreePropertyApplier.h (235364 => 235365)


--- trunk/Source/WebKit/Shared/RemoteLayerTree/RemoteLayerTreePropertyApplier.h	2018-08-27 15:44:18 UTC (rev 235364)
+++ trunk/Source/WebKit/Shared/RemoteLayerTree/RemoteLayerTreePropertyApplier.h	2018-08-27 15:51:24 UTC (rev 235365)
@@ -35,7 +35,7 @@
 
 class RemoteLayerTreePropertyApplier {
 public:
-    typedef HashMap<WebCore::GraphicsLayer::PlatformLayerID, LayerOrView *> RelatedLayerMap;
+    using RelatedLayerMap = HashMap<WebCore::GraphicsLayer::PlatformLayerID, CFTypeRef>;
     static void applyProperties(CALayer *, RemoteLayerTreeHost*, const RemoteLayerTreeTransaction::LayerProperties&, const RelatedLayerMap&, RemoteLayerBackingStore::LayerContentsType);
 #if PLATFORM(IOS)
     static void applyProperties(UIView *, RemoteLayerTreeHost*, const RemoteLayerTreeTransaction::LayerProperties&, const RelatedLayerMap&, RemoteLayerBackingStore::LayerContentsType);

Modified: trunk/Source/WebKit/Shared/RemoteLayerTree/RemoteLayerTreePropertyApplier.mm (235364 => 235365)


--- trunk/Source/WebKit/Shared/RemoteLayerTree/RemoteLayerTreePropertyApplier.mm	2018-08-27 15:44:18 UTC (rev 235364)
+++ trunk/Source/WebKit/Shared/RemoteLayerTree/RemoteLayerTreePropertyApplier.mm	2018-08-27 15:51:24 UTC (rev 235365)
@@ -263,7 +263,7 @@
         RetainPtr<NSMutableArray> children = adoptNS([[NSMutableArray alloc] initWithCapacity:properties.children.size()]);
         for (auto& child : properties.children) {
             ASSERT(relatedLayers.get(child));
-            [children addObject:relatedLayers.get(child)];
+            [children addObject:(__bridge id)relatedLayers.get(child)];
         }
 
         layer.sublayers = children.get();
@@ -274,13 +274,13 @@
             layer.mask = nullptr;
         else {
 #if PLATFORM(IOS)
-            UIView *maskView = relatedLayers.get(properties.maskLayerID);
+            UIView *maskView = (__bridge UIView *)relatedLayers.get(properties.maskLayerID);
             // FIXME: need to check that the mask view is kept alive.
             ASSERT(!maskView.layer.superlayer);
             if (!maskView.layer.superlayer)
                 layer.mask = maskView.layer;
 #else
-            CALayer *maskLayer = relatedLayers.get(properties.maskLayerID);
+            CALayer *maskLayer = (__bridge CALayer *)relatedLayers.get(properties.maskLayerID);
             ASSERT(!maskLayer.superlayer);
             if (!maskLayer.superlayer)
                 layer.mask = maskLayer;
@@ -300,7 +300,7 @@
         RetainPtr<NSMutableArray> children = adoptNS([[NSMutableArray alloc] initWithCapacity:properties.children.size()]);
         for (auto& child : properties.children) {
             ASSERT(relatedLayers.get(child));
-            [children addObject:relatedLayers.get(child)];
+            [children addObject:(__bridge id)relatedLayers.get(child)];
         }
 
         if (properties.customAppearance == GraphicsLayer::CustomAppearance::LightBackdrop || properties.customAppearance == GraphicsLayer::CustomAppearance::DarkBackdrop) {
@@ -324,7 +324,7 @@
         if (!properties.maskLayerID)
             maskOwnerLayer.mask = nullptr;
         else {
-            UIView *maskView = relatedLayers.get(properties.maskLayerID);
+            UIView *maskView = (__bridge UIView *)relatedLayers.get(properties.maskLayerID);
             // FIXME: need to check that the mask view is kept alive.
             ASSERT(!maskView.layer.superlayer);
             if (!maskView.layer.superlayer)

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKBrowsingContextController.mm (235364 => 235365)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKBrowsingContextController.mm	2018-08-27 15:44:18 UTC (rev 235364)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKBrowsingContextController.mm	2018-08-27 15:51:24 UTC (rev 235365)
@@ -83,9 +83,9 @@
     WeakObjCPtr<id <WKBrowsingContextPolicyDelegate>> _policyDelegate;
 }
 
-static HashMap<WebPageProxy*, WKBrowsingContextController *>& browsingContextControllerMap()
+static HashMap<WebPageProxy*, __unsafe_unretained WKBrowsingContextController *>& browsingContextControllerMap()
 {
-    static NeverDestroyed<HashMap<WebPageProxy*, WKBrowsingContextController *>> browsingContextControllerMap;
+    static NeverDestroyed<HashMap<WebPageProxy*, __unsafe_unretained WKBrowsingContextController *>> browsingContextControllerMap;
     return browsingContextControllerMap;
 }
 

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKConnection.mm (235364 => 235365)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKConnection.mm	2018-08-27 15:44:18 UTC (rev 235364)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKConnection.mm	2018-08-27 15:51:24 UTC (rev 235365)
@@ -57,7 +57,7 @@
     if ([delegate respondsToSelector:@selector(connection:didReceiveMessageWithName:body:)]) {
         RetainPtr<CFStringRef> nsMessageName = adoptCF(WKStringCopyCFString(kCFAllocatorDefault, messageName));
         RetainPtr<id> nsMessageBody = static_cast<ObjCObjectGraph*>(toImpl(messageBody))->rootObject();
-        [delegate connection:connection didReceiveMessageWithName:(NSString *)nsMessageName.get() body:nsMessageBody.get()];
+        [delegate connection:connection didReceiveMessageWithName:(__bridge NSString *)nsMessageName.get() body:nsMessageBody.get()];
     }
 }
 

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKContentRuleListStore.mm (235364 => 235365)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKContentRuleListStore.mm	2018-08-27 15:44:18 UTC (rev 235364)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKContentRuleListStore.mm	2018-08-27 15:51:24 UTC (rev 235365)
@@ -74,29 +74,9 @@
 
 - (void)compileContentRuleListForIdentifier:(NSString *)identifier encodedContentRuleList:(NSString *)encodedContentRuleList completionHandler:(void (^)(WKContentRuleList *, NSError *))completionHandler
 {
-    [self _compileContentRuleListForIdentifier:identifier encodedContentRuleList:encodedContentRuleList completionHandler:completionHandler releasesArgument:NO];
+    [self _compileContentRuleListForIdentifier:identifier encodedContentRuleList:[encodedContentRuleList retain] completionHandler:completionHandler];
 }
 
-- (void)_compileContentRuleListForIdentifier:(NSString *)identifier encodedContentRuleList:(NSString *)encodedContentRuleList completionHandler:(void (^)(WKContentRuleList *, NSError *))completionHandler releasesArgument:(BOOL)releasesArgument
-{
-    String json(encodedContentRuleList);
-    if (releasesArgument) {
-        [encodedContentRuleList release];
-        encodedContentRuleList = nil;
-    }
-
-    _contentRuleListStore->compileContentRuleList(identifier, WTFMove(json), [completionHandler = makeBlockPtr(completionHandler)](RefPtr<API::ContentRuleList> contentRuleList, std::error_code error) {
-        if (error) {
-            auto userInfo = @{NSHelpAnchorErrorKey: [NSString stringWithFormat:@"Rule list compilation failed: %s", error.message().c_str()]};
-
-            // error.value() could have a specific compiler error that is not equal to WKErrorContentRuleListStoreCompileFailed.
-            // We want to use error.message, but here we want to only pass on CompileFailed with userInfo from the std::error_code.
-            return completionHandler(nil, [NSError errorWithDomain:WKErrorDomain code:WKErrorContentRuleListStoreCompileFailed userInfo:userInfo]);
-        }
-        completionHandler(wrapper(*contentRuleList), nil);
-    });
-}
-
 - (void)lookUpContentRuleListForIdentifier:(NSString *)identifier completionHandler:(void (^)(WKContentRuleList *, NSError *))completionHandler
 {
     _contentRuleListStore->lookupContentRuleList(identifier, [completionHandler = makeBlockPtr(completionHandler)](RefPtr<API::ContentRuleList> contentRuleList, std::error_code error) {
@@ -170,10 +150,22 @@
 }
 
 // NS_RELEASES_ARGUMENT to keep peak memory usage low.
+- (void)_compileContentRuleListForIdentifier:(NSString *)identifier encodedContentRuleList:(NSString *) NS_RELEASES_ARGUMENT encodedContentRuleList completionHandler:(void (^)(WKContentRuleList *, NSError *))completionHandler
+{
+    String json(encodedContentRuleList);
+    [encodedContentRuleList release];
+    encodedContentRuleList = nil;
 
-- (void)_compileContentRuleListForIdentifier:(NSString *)identifier encodedContentRuleList:(NSString *)encodedContentRuleList completionHandler:(void (^)(WKContentRuleList *, NSError *))completionHandler
-{
-    [self _compileContentRuleListForIdentifier:identifier encodedContentRuleList:encodedContentRuleList completionHandler:completionHandler releasesArgument:YES];
+    _contentRuleListStore->compileContentRuleList(identifier, WTFMove(json), [completionHandler = makeBlockPtr(completionHandler)](RefPtr<API::ContentRuleList> contentRuleList, std::error_code error) {
+        if (error) {
+            auto userInfo = @{NSHelpAnchorErrorKey: [NSString stringWithFormat:@"Rule list compilation failed: %s", error.message().c_str()]};
+
+            // error.value() could have a specific compiler error that is not equal to WKErrorContentRuleListStoreCompileFailed.
+            // We want to use error.message, but here we want to only pass on CompileFailed with userInfo from the std::error_code.
+            return completionHandler(nil, [NSError errorWithDomain:WKErrorDomain code:WKErrorContentRuleListStoreCompileFailed userInfo:userInfo]);
+        }
+        completionHandler(wrapper(*contentRuleList), nil);
+    });
 }
 
 + (instancetype)defaultStoreWithLegacyFilename

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKHTTPCookieStore.mm (235364 => 235365)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKHTTPCookieStore.mm	2018-08-27 15:44:18 UTC (rev 235364)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKHTTPCookieStore.mm	2018-08-27 15:51:24 UTC (rev 235365)
@@ -63,7 +63,7 @@
 };
 
 @implementation WKHTTPCookieStore {
-    HashMap<id<WKHTTPCookieStoreObserver>, std::unique_ptr<WKHTTPCookieStoreObserver>> _observers;
+    HashMap<CFTypeRef, std::unique_ptr<WKHTTPCookieStoreObserver>> _observers;
 }
 
 - (void)dealloc
@@ -105,7 +105,7 @@
 
 - (void)addObserver:(id<WKHTTPCookieStoreObserver>)observer
 {
-    auto result = _observers.add(observer, nullptr);
+    auto result = _observers.add((__bridge CFTypeRef)observer, nullptr);
     if (!result.isNewEntry)
         return;
 
@@ -115,7 +115,7 @@
 
 - (void)removeObserver:(id<WKHTTPCookieStoreObserver>)observer
 {
-    auto result = _observers.take(observer);
+    auto result = _observers.take((__bridge CFTypeRef)observer);
     if (!result)
         return;
 

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKProcessGroup.mm (235364 => 235365)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKProcessGroup.mm	2018-08-27 15:44:18 UTC (rev 235364)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKProcessGroup.mm	2018-08-27 15:51:24 UTC (rev 235365)
@@ -79,7 +79,7 @@
     memset(&connectionClient, 0, sizeof(connectionClient));
 
     connectionClient.base.version = 0;
-    connectionClient.base.clientInfo = processGroup;
+    connectionClient.base.clientInfo = (__bridge CFTypeRef)processGroup;
     connectionClient.didCreateConnection = didCreateConnection;
 
     WKContextSetConnectionClient(contextRef, &connectionClient.base);
@@ -165,7 +165,7 @@
     memset(&historyClient, 0, sizeof(historyClient));
 
     historyClient.base.version = 0;
-    historyClient.base.clientInfo = processGroup;
+    historyClient.base.clientInfo = (__bridge CFTypeRef)processGroup;
     historyClient.didNavigateWithNavigationData = didNavigateWithNavigationData;
     historyClient.didPerformClientRedirect = didPerformClientRedirect;
     historyClient.didPerformServerRedirect = didPerformServerRedirect;

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKViewPrivate.h (235364 => 235365)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKViewPrivate.h	2018-08-27 15:44:18 UTC (rev 235364)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKViewPrivate.h	2018-08-27 15:51:24 UTC (rev 235365)
@@ -30,6 +30,8 @@
 #import <WebKit/WKView.h>
 #import <WebKit/_WKOverlayScrollbarStyle.h>
 
+@class _WKLinkIconParameters;
+
 @interface WKView (Private)
 
 /* C SPI support. */
@@ -146,4 +148,11 @@
 
 @end
 
+@interface WKView (PrivateForSubclassToDefine)
+
+// This a method that subclasses can define and WKView itself does not define. WKView will call the method if it is present.
+- (void)_shouldLoadIconWithParameters:(_WKLinkIconParameters *)parameters completionHandler:(void (^)(void (^)(NSData *)))completionHandler;
+
+@end
+
 #endif // !TARGET_OS_IPHONE

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm (235364 => 235365)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm	2018-08-27 15:44:18 UTC (rev 235364)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm	2018-08-27 15:51:24 UTC (rev 235365)
@@ -209,9 +209,9 @@
 
 #endif
 
-static HashMap<WebKit::WebPageProxy*, WKWebView *>& pageToViewMap()
+static HashMap<WebKit::WebPageProxy*, __unsafe_unretained WKWebView *>& pageToViewMap()
 {
-    static NeverDestroyed<HashMap<WebKit::WebPageProxy*, WKWebView *>> map;
+    static NeverDestroyed<HashMap<WebKit::WebPageProxy*, __unsafe_unretained WKWebView *>> map;
     return map;
 }
 
@@ -3151,10 +3151,11 @@
 #endif // PLATFORM(IOS)
 
 #if ENABLE(ACCESSIBILITY_EVENTS)
+
 static void accessibilityEventsEnabledChangedCallback(CFNotificationCenterRef, void* observer, CFStringRef, const void*, CFDictionaryRef)
 {
     ASSERT(observer);
-    WKWebView* webview = static_cast<WKWebView*>(observer);
+    WKWebView *webview = (__bridge WKWebView *)observer;
     [webview _updateAccessibilityEventsEnabled];
 }
 
@@ -3163,6 +3164,7 @@
     if (!isNullFunctionPointer(_AXSWebAccessibilityEventsEnabled))
         _page->updateAccessibilityEventsEnabled(_AXSWebAccessibilityEventsEnabled());
 }
+
 #endif
 
 #pragma mark OS X-specific methods
@@ -4243,7 +4245,7 @@
 - (NSArray *)_certificateChain
 {
     if (WebKit::WebFrameProxy* mainFrame = _page->mainFrame())
-        return mainFrame->certificateInfo() ? (NSArray *)mainFrame->certificateInfo()->certificateInfo().certificateChain() : nil;
+        return mainFrame->certificateInfo() ? (__bridge NSArray *)mainFrame->certificateInfo()->certificateInfo().certificateChain() : nil;
 
     return nil;
 }
@@ -6619,7 +6621,7 @@
     if (!certificateInfo)
         return @[ ];
 
-    return (NSArray *)certificateInfo->certificateInfo().certificateChain() ?: @[ ];
+    return (__bridge NSArray *)certificateInfo->certificateInfo().certificateChain() ?: @[ ];
 }
 
 @end

Modified: trunk/Source/WebKit/UIProcess/API/mac/WKView.mm (235364 => 235365)


--- trunk/Source/WebKit/UIProcess/API/mac/WKView.mm	2018-08-27 15:44:18 UTC (rev 235364)
+++ trunk/Source/WebKit/UIProcess/API/mac/WKView.mm	2018-08-27 15:51:24 UTC (rev 235365)
@@ -884,7 +884,7 @@
 
         static SEL delegateSelector()
         {
-            return sel_registerName("_shouldLoadIconWithParameters:completionHandler:");
+            return @selector(_shouldLoadIconWithParameters:completionHandler:);
         }
 
     private:
@@ -894,7 +894,7 @@
         {
             RetainPtr<_WKLinkIconParameters> parameters = adoptNS([[_WKLinkIconParameters alloc] _initWithLinkIcon:linkIcon]);
 
-            [m_wkView performSelector:delegateSelector() withObject:parameters.get() withObject:BlockPtr<void(IconLoadCompletionHandler)>::fromCallable([completionHandler = WTFMove(completionHandler)](IconLoadCompletionHandler loadCompletionHandler) mutable {
+            [m_wkView _shouldLoadIconWithParameters:parameters.get() completionHandler:BlockPtr<void(IconLoadCompletionHandler)>::fromCallable([completionHandler = WTFMove(completionHandler)](IconLoadCompletionHandler loadCompletionHandler) mutable {
                 ASSERT(RunLoop::isMain());
                 if (loadCompletionHandler) {
                     completionHandler([loadCompletionHandler = BlockPtr<void (NSData *)>(loadCompletionHandler)](API::Data* data, WebKit::CallbackBase::Error error) {

Modified: trunk/Source/WebKit/UIProcess/Cocoa/NavigationState.mm (235364 => 235365)


--- trunk/Source/WebKit/UIProcess/Cocoa/NavigationState.mm	2018-08-27 15:44:18 UTC (rev 235364)
+++ trunk/Source/WebKit/UIProcess/Cocoa/NavigationState.mm	2018-08-27 15:51:24 UTC (rev 235365)
@@ -978,11 +978,8 @@
     if (!navigationDelegate)
         return nullptr;
 
-    RetainPtr<NSData> data = "" <WKNavigationDelegatePrivate>>(navigationDelegate.get()) _webCryptoMasterKeyForWebView:m_navigationState.m_webView];
-
-    return API::Data::createWithoutCopying((const unsigned char*)[data bytes], [data length], [] (unsigned char*, const void* data) {
-        [(NSData *)data release];
-    }, data.leakRef());
+    NSData *data = "" <WKNavigationDelegatePrivate>>(navigationDelegate.get()) _webCryptoMasterKeyForWebView:m_navigationState.m_webView];
+    return API::Data::createWithoutCopying(data);
 }
 
 RefPtr<API::String> NavigationState::NavigationClient::signedPublicKeyAndChallengeString(WebPageProxy& page, unsigned keySizeIndex, const RefPtr<API::String>& challengeString, const WebCore::URL& url)

Modified: trunk/Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm (235364 => 235365)


--- trunk/Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm	2018-08-27 15:44:18 UTC (rev 235364)
+++ trunk/Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm	2018-08-27 15:51:24 UTC (rev 235365)
@@ -226,12 +226,10 @@
         }
 
 #if (!PLATFORM(MAC) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 101200)
-        auto data = ""
+        auto data = ""
 #endif
 
-        parameters.bundleParameterData = API::Data::createWithoutCopying((const unsigned char*)[data bytes], [data length], [] (unsigned char*, const void* data) {
-            [(NSData *)data release];
-        }, data.leakRef());
+        parameters.bundleParameterData = API::Data::createWithoutCopying(WTFMove(data));
     }
     parameters.networkATSContext = adoptCF(_CFNetworkCopyATSContext());
 

Modified: trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.h (235364 => 235365)


--- trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.h	2018-08-27 15:44:18 UTC (rev 235364)
+++ trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.h	2018-08-27 15:51:24 UTC (rev 235365)
@@ -365,7 +365,7 @@
     void prepareForDictionaryLookup();
     void setAllowsLinkPreview(bool);
     bool allowsLinkPreview() const { return m_allowsLinkPreview; }
-    void* immediateActionAnimationControllerForHitTestResult(API::HitTestResult*, uint32_t type, API::Object* userData);
+    NSObject *immediateActionAnimationControllerForHitTestResult(API::HitTestResult*, uint32_t type, API::Object* userData);
     void didPerformImmediateActionHitTest(const WebHitTestResultData&, bool contentPreventsDefault, API::Object* userData);
     void prepareForImmediateActionAnimation();
     void cancelImmediateActionAnimation();

Modified: trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm (235364 => 235365)


--- trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm	2018-08-27 15:44:18 UTC (rev 235364)
+++ trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm	2018-08-27 15:51:24 UTC (rev 235365)
@@ -2050,7 +2050,8 @@
     // There's a chance that responding to this event will run a nested event loop, and
     // fetching a new event might release the old one. Retaining and then autoreleasing
     // the current event prevents that from causing a problem inside WebKit or AppKit code.
-    [[event retain] autorelease];
+    CFRetain((__bridge CFTypeRef)event);
+    CFAutorelease((__bridge CFTypeRef)event);
 
     if (![m_view hitTest:event.locationInWindow])
         return false;
@@ -2069,7 +2070,8 @@
     // There's a chance that responding to this event will run a nested event loop, and
     // fetching a new event might release the old one. Retaining and then autoreleasing
     // the current event prevents that from causing a problem inside WebKit or AppKit code.
-    [[event retain] autorelease];
+    CFRetain((__bridge CFTypeRef)event);
+    CFAutorelease((__bridge CFTypeRef)event);
 
     if (![m_view hitTest:event.locationInWindow])
         return false;
@@ -3319,7 +3321,7 @@
         [m_view addGestureRecognizer:immediateActionRecognizer];
 }
 
-void* WebViewImpl::immediateActionAnimationControllerForHitTestResult(API::HitTestResult* hitTestResult, uint32_t type, API::Object* userData)
+NSObject *WebViewImpl::immediateActionAnimationControllerForHitTestResult(API::HitTestResult* hitTestResult, uint32_t type, API::Object* userData)
 {
     return [m_view _web_immediateActionAnimationControllerForHitTestResultInternal:hitTestResult withType:type userData:userData];
 }
@@ -4900,7 +4902,8 @@
     // There's a chance that responding to this event will run a nested event loop, and
     // fetching a new event might release the old one. Retaining and then autoreleasing
     // the current event prevents that from causing a problem inside WebKit or AppKit code.
-    [[event retain] autorelease];
+    CFRetain((__bridge CFTypeRef)event);
+    CFAutorelease((__bridge CFTypeRef)event);
 
     // We get Esc key here after processing either Esc or Cmd+period. The former starts as a keyDown, and the latter starts as a key equivalent,
     // but both get transformed to a cancelOperation: command, executing which passes an Esc key event to -performKeyEquivalent:.

Modified: trunk/Source/WebKit/UIProcess/PageClient.h (235364 => 235365)


--- trunk/Source/WebKit/UIProcess/PageClient.h	2018-08-27 15:44:18 UTC (rev 235364)
+++ trunk/Source/WebKit/UIProcess/PageClient.h	2018-08-27 15:51:24 UTC (rev 235365)
@@ -400,11 +400,10 @@
 
 #if PLATFORM(MAC)
     virtual void didPerformImmediateActionHitTest(const WebHitTestResultData&, bool contentPreventsDefault, API::Object*) = 0;
-
-    virtual void* immediateActionAnimationControllerForHitTestResult(RefPtr<API::HitTestResult>, uint64_t, RefPtr<API::Object>) = 0;
-
+    virtual NSObject *immediateActionAnimationControllerForHitTestResult(RefPtr<API::HitTestResult>, uint64_t, RefPtr<API::Object>) = 0;
     virtual void didHandleAcceptedCandidate() = 0;
 #endif
+
     virtual void didFinishProcessingAllPendingMouseEvents() = 0;
 
     virtual void videoControlsManagerDidChange() { }

Modified: trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeHost.mm (235364 => 235365)


--- trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeHost.mm	2018-08-27 15:44:18 UTC (rev 235364)
+++ trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeHost.mm	2018-08-27 15:51:24 UTC (rev 235365)
@@ -104,11 +104,11 @@
         RemoteLayerTreePropertyApplier::RelatedLayerMap relatedLayers;
         if (properties.changedProperties & RemoteLayerTreeTransaction::ChildrenChanged) {
             for (auto& child : properties.children)
-                relatedLayers.set(child, getLayer(child));
+                relatedLayers.set(child, (__bridge CFTypeRef)getLayer(child));
         }
 
         if (properties.changedProperties & RemoteLayerTreeTransaction::MaskLayerChanged && properties.maskLayerID)
-            relatedLayers.set(properties.maskLayerID, getLayer(properties.maskLayerID));
+            relatedLayers.set(properties.maskLayerID, (__bridge CFTypeRef)getLayer(properties.maskLayerID));
 
         if (properties.changedProperties & RemoteLayerTreeTransaction::ClonedContentsChanged && properties.clonedLayerID)
             clonesToUpdate.append(LayerIDPair(layerID, properties.clonedLayerID));
@@ -292,7 +292,7 @@
 #if HAVE(IOSURFACE)
 static void recursivelyMapIOSurfaceBackingStore(CALayer *layer)
 {
-    if (layer.contents && CFGetTypeID(layer.contents) == CAMachPortGetTypeID()) {
+    if (layer.contents && CFGetTypeID((__bridge CFTypeRef)layer.contents) == CAMachPortGetTypeID()) {
         MachSendRight port = MachSendRight::create(CAMachPortGetPort((__bridge CAMachPortRef)layer.contents));
         auto surface = WebCore::IOSurface::createFromSendRight(WTFMove(port), sRGBColorSpaceRef());
         layer.contents = surface ? surface->asLayerContents() : nil;

Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.cpp (235364 => 235365)


--- trunk/Source/WebKit/UIProcess/WebPageProxy.cpp	2018-08-27 15:44:18 UTC (rev 235364)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.cpp	2018-08-27 15:51:24 UTC (rev 235365)
@@ -7331,7 +7331,7 @@
     m_pageClient.didPerformImmediateActionHitTest(result, contentPreventsDefault, m_process->transformHandlesToObjects(userData.object()).get());
 }
 
-void* WebPageProxy::immediateActionAnimationControllerForHitTestResult(RefPtr<API::HitTestResult> hitTestResult, uint64_t type, RefPtr<API::Object> userData)
+NSObject *WebPageProxy::immediateActionAnimationControllerForHitTestResult(RefPtr<API::HitTestResult> hitTestResult, uint64_t type, RefPtr<API::Object> userData)
 {
     return m_pageClient.immediateActionAnimationControllerForHitTestResult(hitTestResult, type, userData);
 }

Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.h (235364 => 235365)


--- trunk/Source/WebKit/UIProcess/WebPageProxy.h	2018-08-27 15:44:18 UTC (rev 235364)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.h	2018-08-27 15:51:24 UTC (rev 235365)
@@ -1204,7 +1204,7 @@
     void immediateActionDidCancel();
     void immediateActionDidComplete();
 
-    void* immediateActionAnimationControllerForHitTestResult(RefPtr<API::HitTestResult>, uint64_t, RefPtr<API::Object>);
+    NSObject *immediateActionAnimationControllerForHitTestResult(RefPtr<API::HitTestResult>, uint64_t, RefPtr<API::Object>);
 
     void installActivityStateChangeCompletionHandler(WTF::Function<void ()>&&);
 

Modified: trunk/Source/WebKit/UIProcess/mac/PageClientImplMac.h (235364 => 235365)


--- trunk/Source/WebKit/UIProcess/mac/PageClientImplMac.h	2018-08-27 15:44:18 UTC (rev 235364)
+++ trunk/Source/WebKit/UIProcess/mac/PageClientImplMac.h	2018-08-27 15:51:24 UTC (rev 235365)
@@ -217,7 +217,7 @@
     void handleControlledElementIDResponse(const String&) override;
 
     void didPerformImmediateActionHitTest(const WebHitTestResultData&, bool contentPreventsDefault, API::Object*) override;
-    void* immediateActionAnimationControllerForHitTestResult(RefPtr<API::HitTestResult>, uint64_t, RefPtr<API::Object>) override;
+    NSObject *immediateActionAnimationControllerForHitTestResult(RefPtr<API::HitTestResult>, uint64_t, RefPtr<API::Object>) override;
 
     void didHandleAcceptedCandidate() override;
 

Modified: trunk/Source/WebKit/UIProcess/mac/PageClientImplMac.mm (235364 => 235365)


--- trunk/Source/WebKit/UIProcess/mac/PageClientImplMac.mm	2018-08-27 15:44:18 UTC (rev 235364)
+++ trunk/Source/WebKit/UIProcess/mac/PageClientImplMac.mm	2018-08-27 15:51:24 UTC (rev 235365)
@@ -827,7 +827,7 @@
     m_impl->didPerformImmediateActionHitTest(result, contentPreventsDefault, userData);
 }
 
-void* PageClientImpl::immediateActionAnimationControllerForHitTestResult(RefPtr<API::HitTestResult> hitTestResult, uint64_t type, RefPtr<API::Object> userData)
+NSObject *PageClientImpl::immediateActionAnimationControllerForHitTestResult(RefPtr<API::HitTestResult> hitTestResult, uint64_t type, RefPtr<API::Object> userData)
 {
     return m_impl->immediateActionAnimationControllerForHitTestResult(hitTestResult.get(), type, userData.get());
 }
@@ -856,12 +856,12 @@
 
 void PageClientImpl::refView()
 {
-    CFRetain(m_view);
+    CFRetain((__bridge CFTypeRef)m_view);
 }
 
 void PageClientImpl::derefView()
 {
-    CFRelease(m_view);
+    CFRelease((__bridge CFTypeRef)m_view);
 }
 
 void PageClientImpl::startWindowDrag()

Modified: trunk/Source/WebKit/UIProcess/mac/ServicesController.mm (235364 => 235365)


--- trunk/Source/WebKit/UIProcess/mac/ServicesController.mm	2018-08-27 15:44:18 UTC (rev 235364)
+++ trunk/Source/WebKit/UIProcess/mac/ServicesController.mm	2018-08-27 15:51:24 UTC (rev 235365)
@@ -97,27 +97,27 @@
     dispatch_after(refreshTime, m_refreshQueue, ^{
         auto serviceLookupGroup = adoptOSObject(dispatch_group_create());
 
-        static NeverDestroyed<NSImage *> image([[NSImage alloc] init]);
+        static NSImage *image { [[NSImage alloc] init] };
         hasCompatibleServicesForItems(serviceLookupGroup.get(), @[ image ], [this] (bool hasServices) {
             m_hasImageServices = hasServices;
         });
 
-        static NeverDestroyed<NSAttributedString *> attributedString([[NSAttributedString alloc] initWithString:@"a"]);
+        static NSAttributedString *attributedString { [[NSAttributedString alloc] initWithString:@"a"] };
         hasCompatibleServicesForItems(serviceLookupGroup.get(), @[ attributedString ], [this] (bool hasServices) {
             m_hasSelectionServices = hasServices;
         });
 
-        static NSAttributedString *attributedStringWithRichContent;
-        if (!attributedStringWithRichContent) {
-            dispatch_sync(dispatch_get_main_queue(), ^ {
+        static NSAttributedString *attributedStringWithRichContent = [] {
+            NSMutableAttributedString *richString;
+            dispatch_sync(dispatch_get_main_queue(), [&richString] {
                 auto attachment = adoptNS([[NSTextAttachment alloc] init]);
-                auto cell = adoptNS([[NSTextAttachmentCell alloc] initImageCell:image.get()]);
+                auto cell = adoptNS([[NSTextAttachmentCell alloc] initImageCell:image]);
                 [attachment setAttachmentCell:cell.get()];
-                NSMutableAttributedString *richString = (NSMutableAttributedString *)[NSMutableAttributedString attributedStringWithAttachment:attachment.get()];
+                richString = [[NSAttributedString attributedStringWithAttachment:attachment.get()] mutableCopy];
                 [richString appendAttributedString:attributedString];
-                attributedStringWithRichContent = [richString retain];
             });
-        }
+            return richString;
+        }();
 
         hasCompatibleServicesForItems(serviceLookupGroup.get(), @[ attributedStringWithRichContent ], [this] (bool hasServices) {
             m_hasRichContentServices = hasServices;

Modified: trunk/Source/WebKit/UIProcess/mac/WKImmediateActionController.mm (235364 => 235365)


--- trunk/Source/WebKit/UIProcess/mac/WKImmediateActionController.mm	2018-08-27 15:44:18 UTC (rev 235364)
+++ trunk/Source/WebKit/UIProcess/mac/WKImmediateActionController.mm	2018-08-27 15:51:24 UTC (rev 235365)
@@ -328,7 +328,7 @@
     }
 
     RefPtr<API::HitTestResult> hitTestResult = [self _webHitTestResult];
-    id customClientAnimationController = (id)(_page->immediateActionAnimationControllerForHitTestResult(hitTestResult, _type, _userData));
+    id customClientAnimationController = _page->immediateActionAnimationControllerForHitTestResult(hitTestResult, _type, _userData);
     if (customClientAnimationController == [NSNull null]) {
         [self _cancelImmediateAction];
         return;

Modified: trunk/Source/WebKit/UIProcess/mac/WKPrintingView.mm (235364 => 235365)


--- trunk/Source/WebKit/UIProcess/mac/WKPrintingView.mm	2018-08-27 15:44:18 UTC (rev 235364)
+++ trunk/Source/WebKit/UIProcess/mac/WKPrintingView.mm	2018-08-27 15:51:24 UTC (rev 235365)
@@ -63,8 +63,10 @@
 
 - (void)dealloc
 {
-    if (WebCoreObjCScheduleDeallocateOnMainThread([WKPrintingView class], self))
-        return;
+    callOnMainThread([frame = WTFMove(_webFrame), previews = WTFMove(_pagePreviews)] {
+        // Deallocate these on the main thread, not the current thread, since the
+        // reference counting and the destructors aren't threadsafe.
+    });
 
     [super dealloc];
 }
@@ -431,9 +433,9 @@
     return 0; // Invalid page number.
 }
 
-static CFStringRef linkDestinationName(PDFDocument *document, PDFDestination *destination)
+static NSString *linkDestinationName(PDFDocument *document, PDFDestination *destination)
 {
-    return (CFStringRef)[NSString stringWithFormat:@"%lu-%f-%f", (unsigned long)[document indexForPage:destination.page], destination.point.x, destination.point.y];
+    return [NSString stringWithFormat:@"%lu-%f-%f", (unsigned long)[document indexForPage:destination.page], destination.point.x, destination.point.y];
 }
 
 - (void)_drawPDFDocument:(PDFDocument *)pdfDocument page:(unsigned)page atPoint:(NSPoint)point
@@ -470,7 +472,7 @@
 
     for (const auto& destination : _linkDestinationsPerPage[page]) {
         CGPoint destinationPoint = CGPointApplyAffineTransform(NSPointToCGPoint([destination point]), transform);
-        CGPDFContextAddDestinationAtPoint(context, linkDestinationName(pdfDocument, destination.get()), destinationPoint);
+        CGPDFContextAddDestinationAtPoint(context, (__bridge CFStringRef)linkDestinationName(pdfDocument, destination.get()), destinationPoint);
     }
 
     for (PDFAnnotation *annotation in [pdfPage annotations]) {
@@ -488,8 +490,7 @@
             PDFDestination *destination = [linkAnnotation destination];
             if (!destination)
                 continue;
-            CGPDFContextSetDestinationForRect(context, linkDestinationName(pdfDocument, destination), transformedRect);
-
+            CGPDFContextSetDestinationForRect(context, (__bridge CFStringRef)linkDestinationName(pdfDocument, destination), transformedRect);
             continue;
         }
 

Modified: trunk/Source/WebKit/WebProcess/InjectedBundle/API/mac/WKDOMInternals.h (235364 => 235365)


--- trunk/Source/WebKit/WebProcess/InjectedBundle/API/mac/WKDOMInternals.h	2018-08-27 15:44:18 UTC (rev 235364)
+++ trunk/Source/WebKit/WebProcess/InjectedBundle/API/mac/WKDOMInternals.h	2018-08-27 15:51:24 UTC (rev 235365)
@@ -89,8 +89,8 @@
 
 // -- Caches --
 
-DOMCache<WebCore::Node*, WKDOMNode *>& WKDOMNodeCache();
-DOMCache<WebCore::Range*, WKDOMRange *>& WKDOMRangeCache();
+DOMCache<WebCore::Node*, __unsafe_unretained WKDOMNode *>& WKDOMNodeCache();
+DOMCache<WebCore::Range*, __unsafe_unretained WKDOMRange *>& WKDOMRangeCache();
 
 // -- Node and classes derived from Node. --
 

Modified: trunk/Source/WebKit/WebProcess/InjectedBundle/API/mac/WKDOMInternals.mm (235364 => 235365)


--- trunk/Source/WebKit/WebProcess/InjectedBundle/API/mac/WKDOMInternals.mm	2018-08-27 15:44:18 UTC (rev 235364)
+++ trunk/Source/WebKit/WebProcess/InjectedBundle/API/mac/WKDOMInternals.mm	2018-08-27 15:51:24 UTC (rev 235365)
@@ -51,15 +51,15 @@
 
 // -- Caches -- 
 
-DOMCache<WebCore::Node*, WKDOMNode *>& WKDOMNodeCache()
+DOMCache<WebCore::Node*, __unsafe_unretained WKDOMNode *>& WKDOMNodeCache()
 {
-    static NeverDestroyed<DOMCache<WebCore::Node*, WKDOMNode *>> cache;
+    static NeverDestroyed<DOMCache<WebCore::Node*, __unsafe_unretained WKDOMNode *>> cache;
     return cache;
 }
 
-DOMCache<WebCore::Range*, WKDOMRange *>& WKDOMRangeCache()
+DOMCache<WebCore::Range*, __unsafe_unretained WKDOMRange *>& WKDOMRangeCache()
 {
-    static NeverDestroyed<DOMCache<WebCore::Range*, WKDOMRange *>> cache;
+    static NeverDestroyed<DOMCache<WebCore::Range*, __unsafe_unretained WKDOMRange *>> cache;
     return cache;
 }
 
@@ -98,7 +98,7 @@
 
 WKDOMNode *toWKDOMNode(WebCore::Node* impl)
 {
-    return toWKDOMType<WebCore::Node*, WKDOMNode *>(impl, WKDOMNodeCache());
+    return toWKDOMType<WebCore::Node*, __unsafe_unretained WKDOMNode *>(impl, WKDOMNodeCache());
 }
 
 WebCore::Element* toWebCoreElement(WKDOMElement *wrapper)
@@ -145,7 +145,7 @@
 
 WKDOMRange *toWKDOMRange(WebCore::Range* impl)
 {
-    return toWKDOMType<WebCore::Range*, WKDOMRange *>(impl, WKDOMRangeCache());
+    return toWKDOMType<WebCore::Range*, __unsafe_unretained WKDOMRange *>(impl, WKDOMRangeCache());
 }
 
 // -- Helpers --

Modified: trunk/Source/WebKit/WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm (235364 => 235365)


--- trunk/Source/WebKit/WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm	2018-08-27 15:44:18 UTC (rev 235364)
+++ trunk/Source/WebKit/WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm	2018-08-27 15:51:24 UTC (rev 235365)
@@ -204,9 +204,10 @@
         // Patch -[NSException release] to not release the object.
         static dispatch_once_t once;
         dispatch_once(&once, ^{
-            Class exceptionClass = [NSException class];
-            Method exceptionReleaseMethod = class_getInstanceMethod(exceptionClass, @selector(release));
-            class_replaceMethod(exceptionClass, @selector(release), reinterpret_cast<IMP>(NSException_release), method_getTypeEncoding(exceptionReleaseMethod));
+            auto exceptionClass = [NSException class];
+            auto releaseSelector = sel_registerName("release");
+            auto exceptionReleaseMethod = class_getInstanceMethod(exceptionClass, releaseSelector);
+            class_replaceMethod(exceptionClass, releaseSelector, reinterpret_cast<IMP>(NSException_release), method_getTypeEncoding(exceptionReleaseMethod));
         });
     }
 }
@@ -1159,9 +1160,9 @@
     // be returned by using NPN_GetValue and pass the WKNVExpectsNonretainedLayer parameter.
     // https://bugs.webkit.org/show_bug.cgi?id=58282 describes the bug where WebKit expects retained layers.
     if (m_pluginReturnsNonretainedLayer)
-        m_pluginLayer = reinterpret_cast<CALayer *>(value);
+        m_pluginLayer = (__bridge CALayer *)value;
     else
-        m_pluginLayer = adoptNS(reinterpret_cast<CALayer *>(value));
+        m_pluginLayer = adoptNS((__bridge CALayer *)value);
 
     if (m_pluginModule->pluginQuirks().contains(PluginQuirks::MakeOpaqueUnlessTransparentSilverlightBackgroundAttributeExists) &&
         !m_isTransparent)

Modified: trunk/Source/WebKit/WebProcess/Plugins/PDF/PDFPlugin.mm (235364 => 235365)


--- trunk/Source/WebKit/WebProcess/Plugins/PDF/PDFPlugin.mm	2018-08-27 15:44:18 UTC (rev 235364)
+++ trunk/Source/WebKit/WebProcess/Plugins/PDF/PDFPlugin.mm	2018-08-27 15:51:24 UTC (rev 235365)
@@ -69,6 +69,7 @@
 #import <WebCore/HTMLFormElement.h>
 #import <WebCore/HTMLPlugInElement.h>
 #import <WebCore/LegacyNSPasteboardTypes.h>
+#import <WebCore/LocalDefaultSystemAppearance.h>
 #import <WebCore/LocalizedStrings.h>
 #import <WebCore/MouseEvent.h>
 #import <WebCore/PDFDocumentImage.h>
@@ -81,15 +82,12 @@
 #import <WebCore/ScrollAnimator.h>
 #import <WebCore/ScrollbarTheme.h>
 #import <WebCore/Settings.h>
+#import <WebCore/WebAccessibilityObjectWrapperMac.h>
 #import <WebCore/WheelEventTestTrigger.h>
 #import <pal/spi/cg/CoreGraphicsSPI.h>
 #import <pal/spi/mac/NSMenuSPI.h>
 #import <wtf/UUID.h>
 
-#if PLATFORM(MAC)
-#include <WebCore/LocalDefaultSystemAppearance.h>
-#endif
-
 using namespace WebCore;
 
 // Set overflow: hidden on the annotation container so <input> elements scrolled out of view don't show

Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm (235364 => 235365)


--- trunk/Source/WebKit/WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm	2018-08-27 15:44:18 UTC (rev 235364)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm	2018-08-27 15:51:24 UTC (rev 235365)
@@ -63,7 +63,7 @@
     notImplemented();
 }
 
-static void changeWordCase(WebPage* page, SEL selector)
+static void changeWordCase(WebPage* page, NSString *(*changeCase)(NSString *))
 {
     Frame& frame = page->corePage()->focusController().focusedOrMainFrame();
     if (!frame.editor().canEdit())
@@ -72,22 +72,28 @@
     frame.editor().command("selectWord").execute();
 
     NSString *selectedString = frame.displayStringModifiedByEncoding(frame.editor().selectedText());
-    page->replaceSelectionWithText(&frame, [selectedString performSelector:selector]);
+    page->replaceSelectionWithText(&frame, changeCase(selectedString));
 }
 
 void WebEditorClient::uppercaseWord()
 {
-    changeWordCase(m_page, @selector(uppercaseString));
+    changeWordCase(m_page, [] (NSString *string) {
+        return [string uppercaseString];
+    });
 }
 
 void WebEditorClient::lowercaseWord()
 {
-    changeWordCase(m_page, @selector(lowercaseString));
+    changeWordCase(m_page, [] (NSString *string) {
+        return [string lowercaseString];
+    });
 }
 
 void WebEditorClient::capitalizeWord()
 {
-    changeWordCase(m_page, @selector(capitalizedString));
+    changeWordCase(m_page, [] (NSString *string) {
+        return [string capitalizedString];
+    });
 }
 
 #if USE(AUTOMATIC_TEXT_REPLACEMENT)

Modified: trunk/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm (235364 => 235365)


--- trunk/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm	2018-08-27 15:44:18 UTC (rev 235364)
+++ trunk/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm	2018-08-27 15:51:24 UTC (rev 235365)
@@ -73,19 +73,22 @@
 #import <stdio.h>
 
 #if PLATFORM(IOS)
+#import "WKAccessibilityWebPageObjectIOS.h"
 #import <UIKit/UIAccessibility.h>
 #import <pal/spi/ios/GraphicsServicesSPI.h>
+#endif
 
-#if USE(APPLE_INTERNAL_SDK)
+#if PLATFORM(IOS) && USE(APPLE_INTERNAL_SDK)
 #import <AXRuntime/AXDefines.h>
 #import <AXRuntime/AXNotificationConstants.h>
-#else
-#define kAXPidStatusChangedNotification 0
 #endif
 
+#if PLATFORM(IOS) && !USE(APPLE_INTERNAL_SDK)
+#define kAXPidStatusChangedNotification 0
 #endif
 
 #if PLATFORM(MAC)
+#import "WKAccessibilityWebPageObjectMac.h"
 #import <WebCore/GraphicsContext3DManager.h>
 #import <WebCore/ScrollbarThemeMac.h>
 #import <pal/spi/mac/NSScrollerImpSPI.h>
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to