WebKit Bugzilla
Attachment 348104 Details for
Bug 188955
: [Cocoa] Adapt more WebKit code to be ARC-compatible
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-188955-20180826151133.patch (text/plain), 79.13 KB, created by
Darin Adler
on 2018-08-26 15:11:34 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Darin Adler
Created:
2018-08-26 15:11:34 PDT
Size:
79.13 KB
patch
obsolete
>Subversion Revision: 235338 >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index 509808abae463146e3d25282b6bfcdc32e997e5d..86d3a97da95576d225942ae5be2eb630899df45b 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,196 @@ >+2018-08-26 Darin Adler <darin@apple.com> >+ >+ [Cocoa] Adapt more WebKit code to be ARC-compatible >+ https://bugs.webkit.org/show_bug.cgi?id=188955 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * 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/Cocoa/_WKAttachment.mm: >+ (isDeclaredOrDynamicTypeIdentifier): Use __bridge casts. >+ (-[_WKAttachmentInfo mimeType]): Ditto. Also use bridgingAutorelease. >+ (-[_WKAttachmentInfo utiType]): 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-23 Jeff Miller <jeffm@apple.com> > > Remove -[WKNavigationDelegate _webView:decidePolicyForPluginLoadWithCurrentPolicy:pluginInfo:unavailabilityDescription:] >diff --git a/Source/WebKit/NetworkProcess/cocoa/NetworkDataTaskCocoa.h b/Source/WebKit/NetworkProcess/cocoa/NetworkDataTaskCocoa.h >index 3e82ee45cf45715f20724d270be9af7df412a4a2..62b1c1495a1c17ac26e98ceba7f2a7081e682eac 100644 >--- a/Source/WebKit/NetworkProcess/cocoa/NetworkDataTaskCocoa.h >+++ b/Source/WebKit/NetworkProcess/cocoa/NetworkDataTaskCocoa.h >@@ -87,7 +87,7 @@ private: > 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(); >diff --git a/Source/WebKit/NetworkProcess/cocoa/NetworkDataTaskCocoa.mm b/Source/WebKit/NetworkProcess/cocoa/NetworkDataTaskCocoa.mm >index f2cc733593cadc05cf46307e6820f4b920469410..fc209c8f71397e1728c152379937b28b9f4c1d2f 100644 >--- a/Source/WebKit/NetworkProcess/cocoa/NetworkDataTaskCocoa.mm >+++ b/Source/WebKit/NetworkProcess/cocoa/NetworkDataTaskCocoa.mm >@@ -56,6 +56,15 @@ @end > #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 @@ static float toNSURLSessionTaskPriority(WebCore::ResourceLoadPriority priority) > 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 @@ void NetworkDataTaskCocoa::applySniffingPoliciesAndBindRequestToInferfaceIfNeede > } > > #if HAVE(CFNETWORK_STORAGE_PARTITIONING) >+ > NSHTTPCookieStorage *NetworkDataTaskCocoa::statelessCookieStorage() > { > static NeverDestroyed<RetainPtr<NSHTTPCookieStorage>> statelessCookieStorage; >@@ -144,10 +154,11 @@ void NetworkDataTaskCocoa::applyCookieBlockingPolicy(bool shouldBlock) > 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) >diff --git a/Source/WebKit/PluginProcess/mac/PluginProcessMac.mm b/Source/WebKit/PluginProcess/mac/PluginProcessMac.mm >index 7ec04bcfed58326c66353ee35e8b1b75ce119bfa..c3120bb59a0a54b6987092faf5692d424153e617 100644 >--- a/Source/WebKit/PluginProcess/mac/PluginProcessMac.mm >+++ b/Source/WebKit/PluginProcess/mac/PluginProcessMac.mm >@@ -453,8 +453,8 @@ static void initializeCocoaOverrides() > 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) >diff --git a/Source/WebKit/Shared/API/Cocoa/WKRemoteObjectCoder.mm b/Source/WebKit/Shared/API/Cocoa/WKRemoteObjectCoder.mm >index 6f0b9b2ecb4119fe12e40cfd255193792b563b21..8d1f1ac18fb6ad4ce76459ce8f7c8fa4b2bb5431 100644 >--- a/Source/WebKit/Shared/API/Cocoa/WKRemoteObjectCoder.mm >+++ b/Source/WebKit/Shared/API/Cocoa/WKRemoteObjectCoder.mm >@@ -385,7 +385,7 @@ @implementation WKRemoteObjectDecoder { > 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 @@ - (void)decodeValueOfObjCType:(const char *)type at:(void *)data > 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 @@ - (id)decodeObjectForKey:(NSString *)key > 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 @@ static void checkIfClassIsAllowed(WKRemoteObjectDecoder *decoder, Class objectCl > 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 @@ static void validateClass(WKRemoteObjectDecoder *decoder, Class objectClass) > [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,56 +491,56 @@ static void decodeInvocationArguments(WKRemoteObjectDecoder *decoder, NSInvocati > 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; > } > > // 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; > } > > // 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; > } > > // 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; > } > > // 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; > } > > // 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; > } > > // 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; > } > > // 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 @@ static void decodeInvocationArguments(WKRemoteObjectDecoder *decoder, NSInvocati > // 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 @@ static id decodeObject(WKRemoteObjectDecoder *decoder) > 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 @@ static id decodeObject(WKRemoteObjectDecoder *decoder, const API::Dictionary* di > 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 @@ - (BOOL)requiresSecureCoding > > - (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 @@ - (NSSet *)allowedClasses > 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(); > } >diff --git a/Source/WebKit/Shared/API/Cocoa/_WKRemoteObjectInterface.mm b/Source/WebKit/Shared/API/Cocoa/_WKRemoteObjectInterface.mm >index c13714088ac1279dd298dbb256df9b86dcc45054..63446b76803794294c5bbff434e1d6742be6a330 100644 >--- a/Source/WebKit/Shared/API/Cocoa/_WKRemoteObjectInterface.mm >+++ b/Source/WebKit/Shared/API/Cocoa/_WKRemoteObjectInterface.mm >@@ -46,12 +46,12 @@ - (NSString *)_typeString; > @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 @@ static bool isContainerClass(Class objectClass) > 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 HashSet<Class>& propertyListClasses() > > 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 @@ static void initializeMethod(MethodInfo& methodInfo, Protocol *protocol, SEL sel > continue; > } > >- allowedClasses.append({ objectClass }); >+ allowedClasses.append({ (__bridge CFTypeRef)objectClass }); > } > > if (forReplyBlock) >@@ -212,8 +215,8 @@ - (NSString *)debugDescription > 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 @@ - (NSString *)debugDescription > if (needsComma) > [result appendString:@", "]; > >- [result appendFormat:@"%s", class_getName(argumentClass)]; >+ [result appendFormat:@"%s", class_getName((__bridge Class)argumentClass)]; > needsComma = true; > } > >@@ -252,7 +255,7 @@ - (NSString *)debugDescription > 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,16 +283,16 @@ - (NSSet *)classesForSelector:(SEL)selector argumentIndex:(NSUInteger)argumentIn > 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(); > } > > - (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,14 +347,14 @@ - (NSMethodSignature *)_methodSignatureForReplyBlockOfSelector:(SEL)selector > 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)); > > return _methods.find(selector)->value.allowedArgumentClasses; > } > >-- (const Vector<HashSet<Class>>&)_allowedArgumentClassesForReplyBlockOfSelector:(SEL)selector >+- (const Vector<HashSet<CFTypeRef>>&)_allowedArgumentClassesForReplyBlockOfSelector:(SEL)selector > { > ASSERT(_methods.contains(selector)); > >diff --git a/Source/WebKit/Shared/API/Cocoa/_WKRemoteObjectInterfaceInternal.h b/Source/WebKit/Shared/API/Cocoa/_WKRemoteObjectInterfaceInternal.h >index 170642ced350f61d51a65bf3b1026265a2e29cc9..45ef0a7bd2f0df7ba9326987626e955de881103f 100644 >--- a/Source/WebKit/Shared/API/Cocoa/_WKRemoteObjectInterfaceInternal.h >+++ b/Source/WebKit/Shared/API/Cocoa/_WKRemoteObjectInterfaceInternal.h >@@ -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 > >diff --git a/Source/WebKit/Shared/API/c/cf/WKStringCF.mm b/Source/WebKit/Shared/API/c/cf/WKStringCF.mm >index 61d1d47b7fe30a809429f2aeb1d3a914f0a55d71..98d7fa9f86982cc125fec940eb85ddb3b0d6ae05 100644 >--- a/Source/WebKit/Shared/API/c/cf/WKStringCF.mm >+++ b/Source/WebKit/Shared/API/c/cf/WKStringCF.mm >@@ -50,8 +50,10 @@ WKStringRef WKStringCreateWithCFString(CFStringRef cfString) > { > #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])); >+ if (object_getClass((__bridge NSString *)cfString) == wkNSStringClass()) { >+ CFRetain(cfString); >+ return toAPI(static_cast<API::String*>(&[(WKNSString *)(__bridge NSString *)cfString _apiObject])); >+ } > #endif > String string(cfString); > return toCopiedAPI(string); >diff --git a/Source/WebKit/Shared/API/c/cf/WKURLCF.mm b/Source/WebKit/Shared/API/c/cf/WKURLCF.mm >index ee627b3ca15a17b8f624e4e8fb2a45953bc37aae..f43e1df2cc472dd6d8852d2dd04fb355131041a0 100644 >--- a/Source/WebKit/Shared/API/c/cf/WKURLCF.mm >+++ b/Source/WebKit/Shared/API/c/cf/WKURLCF.mm >@@ -54,8 +54,10 @@ WKURLRef WKURLCreateWithCFURL(CFURLRef cfURL) > > #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])); >+ if (object_getClass((__bridge NSURL *)cfURL) == wkNSURLClass()) { >+ CFRetain(cfURL); >+ return toAPI(static_cast<API::URL*>(&[(WKNSURL *)(__bridge NSURL *)cfURL _apiObject])); >+ } > #endif > > CString urlBytes; >diff --git a/Source/WebKit/Shared/Cocoa/APIObject.mm b/Source/WebKit/Shared/Cocoa/APIObject.mm >index 6f3d284fd80dfa592ce5cea83017b00b16719346..448ffd28aca7b8f0d911d7c3c2bd744f22f847f7 100644 >--- a/Source/WebKit/Shared/Cocoa/APIObject.mm >+++ b/Source/WebKit/Shared/Cocoa/APIObject.mm >@@ -95,17 +95,17 @@ namespace API { > > 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 @@ void* Object::wrap(API::Object* object) > 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 @@ API::Object* Object::unwrap(void* object) > if (!object) > return nullptr; > >- return &static_cast<id <WKObject>>(object)._apiObject; >+ return &((__bridge id <WKObject>)object)._apiObject; > } > > } // namespace API >diff --git a/Source/WebKit/Shared/RemoteLayerTree/RemoteLayerTreePropertyApplier.h b/Source/WebKit/Shared/RemoteLayerTree/RemoteLayerTreePropertyApplier.h >index 301ba9108fa5cf4c978e833f5fba5a3120c22e8e..07b37e9802191cdde9d5531340c30d4ad1aea093 100644 >--- a/Source/WebKit/Shared/RemoteLayerTree/RemoteLayerTreePropertyApplier.h >+++ b/Source/WebKit/Shared/RemoteLayerTree/RemoteLayerTreePropertyApplier.h >@@ -35,7 +35,7 @@ class RemoteLayerTreeHost; > > 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); >diff --git a/Source/WebKit/Shared/RemoteLayerTree/RemoteLayerTreePropertyApplier.mm b/Source/WebKit/Shared/RemoteLayerTree/RemoteLayerTreePropertyApplier.mm >index 726a5b713f3b08a10c60cb0444c689c304fb983d..1d55102890909ef1d23e02a5c9faa7097a66a2d3 100644 >--- a/Source/WebKit/Shared/RemoteLayerTree/RemoteLayerTreePropertyApplier.mm >+++ b/Source/WebKit/Shared/RemoteLayerTree/RemoteLayerTreePropertyApplier.mm >@@ -263,7 +263,7 @@ void RemoteLayerTreePropertyApplier::applyProperties(CALayer *layer, RemoteLayer > 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 @@ void RemoteLayerTreePropertyApplier::applyProperties(CALayer *layer, RemoteLayer > 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 @@ void RemoteLayerTreePropertyApplier::applyProperties(UIView *view, RemoteLayerTr > 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 @@ void RemoteLayerTreePropertyApplier::applyProperties(UIView *view, RemoteLayerTr > 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) >diff --git a/Source/WebKit/UIProcess/API/Cocoa/WKBrowsingContextController.mm b/Source/WebKit/UIProcess/API/Cocoa/WKBrowsingContextController.mm >index e6eefcdf0ff7ee0c70e23ab23c08969da93f8b13..d624aa41c5b1a55fe6da452a69d18defc25c2a91 100644 >--- a/Source/WebKit/UIProcess/API/Cocoa/WKBrowsingContextController.mm >+++ b/Source/WebKit/UIProcess/API/Cocoa/WKBrowsingContextController.mm >@@ -83,9 +83,9 @@ @implementation WKBrowsingContextController { > 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; > } > >diff --git a/Source/WebKit/UIProcess/API/Cocoa/WKConnection.mm b/Source/WebKit/UIProcess/API/Cocoa/WKConnection.mm >index ce23d0ec8a32d671fd30663319a3a2c1b6c5fb0f..abe43483ce9feb6d1dc3ec23d107500c246337c7 100644 >--- a/Source/WebKit/UIProcess/API/Cocoa/WKConnection.mm >+++ b/Source/WebKit/UIProcess/API/Cocoa/WKConnection.mm >@@ -57,7 +57,7 @@ static void didReceiveMessage(WKConnectionRef, WKStringRef messageName, WKTypeRe > 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()]; > } > } > >diff --git a/Source/WebKit/UIProcess/API/Cocoa/WKContentRuleListStore.mm b/Source/WebKit/UIProcess/API/Cocoa/WKContentRuleListStore.mm >index 4b41b43968c2e8b0059aa51d438ae3a33cbe7bba..ba742ae58fe275abf44c5cd0fab1a257da56fd27 100644 >--- a/Source/WebKit/UIProcess/API/Cocoa/WKContentRuleListStore.mm >+++ b/Source/WebKit/UIProcess/API/Cocoa/WKContentRuleListStore.mm >@@ -74,27 +74,7 @@ + (instancetype)storeWithURL:(NSURL *)url > > - (void)compileContentRuleListForIdentifier:(NSString *)identifier encodedContentRuleList:(NSString *)encodedContentRuleList completionHandler:(void (^)(WKContentRuleList *, NSError *))completionHandler > { >- [self _compileContentRuleListForIdentifier:identifier encodedContentRuleList:encodedContentRuleList completionHandler:completionHandler releasesArgument:NO]; >-} >- >-- (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); >- }); >+ [self _compileContentRuleListForIdentifier:identifier encodedContentRuleList:[encodedContentRuleList retain] completionHandler:completionHandler]; > } > > - (void)lookUpContentRuleListForIdentifier:(NSString *)identifier completionHandler:(void (^)(WKContentRuleList *, NSError *))completionHandler >@@ -170,10 +150,22 @@ - (void)_getContentRuleListSourceForIdentifier:(NSString *)identifier completion > } > > // NS_RELEASES_ARGUMENT to keep peak memory usage low. >- >-- (void)_compileContentRuleListForIdentifier:(NSString *)identifier encodedContentRuleList:(NSString *)encodedContentRuleList completionHandler:(void (^)(WKContentRuleList *, NSError *))completionHandler >+- (void)_compileContentRuleListForIdentifier:(NSString *)identifier encodedContentRuleList:(NSString *) NS_RELEASES_ARGUMENT encodedContentRuleList completionHandler:(void (^)(WKContentRuleList *, NSError *))completionHandler > { >- [self _compileContentRuleListForIdentifier:identifier encodedContentRuleList:encodedContentRuleList completionHandler:completionHandler releasesArgument:YES]; >+ String json(encodedContentRuleList); >+ [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); >+ }); > } > > + (instancetype)defaultStoreWithLegacyFilename >diff --git a/Source/WebKit/UIProcess/API/Cocoa/WKHTTPCookieStore.mm b/Source/WebKit/UIProcess/API/Cocoa/WKHTTPCookieStore.mm >index 55324a1b6b84c4716acce47c16fe47423d75c58c..a806bdec2e2d4823b2f1e92ed133e71365def664 100644 >--- a/Source/WebKit/UIProcess/API/Cocoa/WKHTTPCookieStore.mm >+++ b/Source/WebKit/UIProcess/API/Cocoa/WKHTTPCookieStore.mm >@@ -63,7 +63,7 @@ private: > }; > > @implementation WKHTTPCookieStore { >- HashMap<id<WKHTTPCookieStoreObserver>, std::unique_ptr<WKHTTPCookieStoreObserver>> _observers; >+ HashMap<CFTypeRef, std::unique_ptr<WKHTTPCookieStoreObserver>> _observers; > } > > - (void)dealloc >@@ -105,7 +105,7 @@ - (void)deleteCookie:(NSHTTPCookie *)cookie completionHandler:(void (^)(void))co > > - (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)addObserver:(id<WKHTTPCookieStoreObserver>)observer > > - (void)removeObserver:(id<WKHTTPCookieStoreObserver>)observer > { >- auto result = _observers.take(observer); >+ auto result = _observers.take((__bridge CFTypeRef)observer); > if (!result) > return; > >diff --git a/Source/WebKit/UIProcess/API/Cocoa/WKProcessGroup.mm b/Source/WebKit/UIProcess/API/Cocoa/WKProcessGroup.mm >index 47b7c4ca5a149f5189862b378874ac905e5810cf..4d417b543c0ed862299422226ba0fa57331f59dd 100644 >--- a/Source/WebKit/UIProcess/API/Cocoa/WKProcessGroup.mm >+++ b/Source/WebKit/UIProcess/API/Cocoa/WKProcessGroup.mm >@@ -79,7 +79,7 @@ static void setUpConnectionClient(WKProcessGroup *processGroup, WKContextRef con > 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 @@ static void setUpHistoryClient(WKProcessGroup *processGroup, WKContextRef contex > 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; >diff --git a/Source/WebKit/UIProcess/API/Cocoa/WKViewPrivate.h b/Source/WebKit/UIProcess/API/Cocoa/WKViewPrivate.h >index 3e17c0fa416f95f9b993df70f4c4c5ec9bf9707c..fe896bc6b54e786a27b454ec7f87977ad4e38fd4 100644 >--- a/Source/WebKit/UIProcess/API/Cocoa/WKViewPrivate.h >+++ b/Source/WebKit/UIProcess/API/Cocoa/WKViewPrivate.h >@@ -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 >diff --git a/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm b/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm >index 003a193573eb8bd2cf49b3377c3fc862bee1f183..339a2bb1dbbad1c3944a7f1f3b89180db7e664b2 100644 >--- a/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm >+++ b/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm >@@ -209,9 +209,9 @@ @end > > #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 @@ - (BOOL)_haveSetObscuredInsets > #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 @@ - (void)_updateAccessibilityEventsEnabled > if (!isNullFunctionPointer(_AXSWebAccessibilityEventsEnabled)) > _page->updateAccessibilityEventsEnabled(_AXSWebAccessibilityEventsEnabled()); > } >+ > #endif > > #pragma mark OS X-specific methods >@@ -4236,7 +4238,7 @@ - (WKNavigation *)_loadRequest:(NSURLRequest *)request shouldOpenExternalURLs:(B > - (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; > } >@@ -6612,7 +6614,7 @@ - (NSArray *)certificateChain > if (!certificateInfo) > return @[ ]; > >- return (NSArray *)certificateInfo->certificateInfo().certificateChain() ?: @[ ]; >+ return (__bridge NSArray *)certificateInfo->certificateInfo().certificateChain() ?: @[ ]; > } > > @end >diff --git a/Source/WebKit/UIProcess/API/Cocoa/_WKAttachment.mm b/Source/WebKit/UIProcess/API/Cocoa/_WKAttachment.mm >index f495c714cc4a74bc6fe248a0616d80c4d5e0dd2d..4ed55f1c34ee3f92284e871fb98c08ac1a5b6853 100644 >--- a/Source/WebKit/UIProcess/API/Cocoa/_WKAttachment.mm >+++ b/Source/WebKit/UIProcess/API/Cocoa/_WKAttachment.mm >@@ -96,7 +96,7 @@ - (NSString *)filePath > > static BOOL isDeclaredOrDynamicTypeIdentifier(NSString *type) > { >- return UTTypeIsDeclared((CFStringRef)type) || UTTypeIsDynamic((CFStringRef)type); >+ return UTTypeIsDeclared((__bridge CFStringRef)type) || UTTypeIsDynamic((__bridge CFStringRef)type); > } > > - (NSString *)_typeIdentifierFromPathExtension >@@ -119,8 +119,7 @@ - (NSString *)mimeType > if (!isDeclaredOrDynamicTypeIdentifier(contentType)) > return contentType; > >- auto mimeType = adoptCF(UTTypeCopyPreferredTagWithClass((CFStringRef)contentType, kUTTagClassMIMEType)); >- return (NSString *)mimeType.autorelease(); >+ return adoptCF(UTTypeCopyPreferredTagWithClass((__bridge CFStringRef)contentType, kUTTagClassMIMEType)).bridgingAutorelease(); > } > > - (NSString *)utiType >@@ -129,8 +128,7 @@ - (NSString *)utiType > if (isDeclaredOrDynamicTypeIdentifier(contentType)) > return contentType; > >- auto utiType = adoptCF(UTTypeCreatePreferredIdentifierForTag(kUTTagClassMIMEType, (CFStringRef)contentType, nil)); >- return (NSString *)utiType.autorelease(); >+ return adoptCF(UTTypeCreatePreferredIdentifierForTag(kUTTagClassMIMEType, (__bridge CFStringRef)contentType, nullptr)).bridgingAutorelease(); > } > > - (NSFileWrapper *)fileWrapper >diff --git a/Source/WebKit/UIProcess/API/mac/WKView.mm b/Source/WebKit/UIProcess/API/mac/WKView.mm >index f776fdce4801b36da819a2e965410ceb6ed3128f..26d7ffb7aa3ae85c218c1e9090ca9d45691c2457 100644 >--- a/Source/WebKit/UIProcess/API/mac/WKView.mm >+++ b/Source/WebKit/UIProcess/API/mac/WKView.mm >@@ -884,7 +884,7 @@ - (void)maybeInstallIconLoadingClient > > static SEL delegateSelector() > { >- return sel_registerName("_shouldLoadIconWithParameters:completionHandler:"); >+ return @selector(_shouldLoadIconWithParameters:completionHandler:); > } > > private: >@@ -894,7 +894,7 @@ - (void)maybeInstallIconLoadingClient > { > 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) { >diff --git a/Source/WebKit/UIProcess/Cocoa/NavigationState.mm b/Source/WebKit/UIProcess/Cocoa/NavigationState.mm >index 34401de3bdf5016f32d4bb6ff16dfd59137a9819..5e27649cadcb4789054790852ecf7dc791d3f0ca 100644 >--- a/Source/WebKit/UIProcess/Cocoa/NavigationState.mm >+++ b/Source/WebKit/UIProcess/Cocoa/NavigationState.mm >@@ -978,11 +978,8 @@ RefPtr<API::Data> NavigationState::NavigationClient::webCryptoMasterKey(WebPageP > if (!navigationDelegate) > return nullptr; > >- RetainPtr<NSData> data = [static_cast<id <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 = [static_cast<id <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) >diff --git a/Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm b/Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm >index 0498d088edae70e6dcbacb40e192ed07d9d64bb3..d16f5852ddf84a4d592b9f33e78eb32da920b103 100644 >--- a/Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm >+++ b/Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm >@@ -226,12 +226,10 @@ void WebProcessPool::platformInitializeWebProcess(WebProcessCreationParameters& > } > > #if (!PLATFORM(MAC) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 101200) >- auto data = retainPtr(keyedArchiver.get().encodedData); >+ auto data = keyedArchiver.get().encodedData; > #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()); > >diff --git a/Source/WebKit/UIProcess/Cocoa/WebViewImpl.h b/Source/WebKit/UIProcess/Cocoa/WebViewImpl.h >index a778b9a7c77050270439760a64eb615dfbcd3cc7..327fa49d7b4c1c81d3c7e11ee490e702af604ba8 100644 >--- a/Source/WebKit/UIProcess/Cocoa/WebViewImpl.h >+++ b/Source/WebKit/UIProcess/Cocoa/WebViewImpl.h >@@ -364,7 +364,7 @@ public: > 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(); >diff --git a/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm b/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm >index 6ed86cf17d41f2c559642c58486d7d3737ffbce1..4a5730aa13cf4d17c5ea036a2e49182709c41abb 100644 >--- a/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm >+++ b/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm >@@ -2050,7 +2050,8 @@ bool WebViewImpl::acceptsFirstMouse(NSEvent *event) > // 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 @@ bool WebViewImpl::shouldDelayWindowOrderingForEvent(NSEvent *event) > // 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 @@ void WebViewImpl::setAllowsLinkPreview(bool allowsLinkPreview) > [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]; > } >@@ -4883,7 +4885,8 @@ bool WebViewImpl::performKeyEquivalent(NSEvent *event) > // 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:. >diff --git a/Source/WebKit/UIProcess/PageClient.h b/Source/WebKit/UIProcess/PageClient.h >index 2683fc8ddb6f1917e9a77e3e2525ec0a425451e5..2d709cf1e3767067711b340eadf545f0747128c5 100644 >--- a/Source/WebKit/UIProcess/PageClient.h >+++ b/Source/WebKit/UIProcess/PageClient.h >@@ -399,11 +399,10 @@ public: > > #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() { } >diff --git a/Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeHost.mm b/Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeHost.mm >index 8ff54b2f8be3b9caba5fad0b4774c25087288120..4efe080a6c0b1d2d6224464afe8d06216f8a4111 100644 >--- a/Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeHost.mm >+++ b/Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeHost.mm >@@ -104,11 +104,11 @@ bool RemoteLayerTreeHost::updateLayerTree(const RemoteLayerTreeTransaction& tran > 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 @@ void RemoteLayerTreeHost::detachRootLayer() > #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; >diff --git a/Source/WebKit/UIProcess/WebPageProxy.cpp b/Source/WebKit/UIProcess/WebPageProxy.cpp >index e072bc21bd6981db10e407f65aea8bbd42431b3c..4b59ef7ecd82c35cd0ab081a371b02be0d897282 100644 >--- a/Source/WebKit/UIProcess/WebPageProxy.cpp >+++ b/Source/WebKit/UIProcess/WebPageProxy.cpp >@@ -7326,7 +7326,7 @@ void WebPageProxy::didPerformImmediateActionHitTest(const WebHitTestResultData& > 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); > } >diff --git a/Source/WebKit/UIProcess/WebPageProxy.h b/Source/WebKit/UIProcess/WebPageProxy.h >index d6934d4a9cf62878905b4ddfd7ab8baa2592aebf..2abc79cef1a4083a4a3bdf04339e245c2cd6e23a 100644 >--- a/Source/WebKit/UIProcess/WebPageProxy.h >+++ b/Source/WebKit/UIProcess/WebPageProxy.h >@@ -1204,7 +1204,7 @@ public: > 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 ()>&&); > >diff --git a/Source/WebKit/UIProcess/mac/PageClientImplMac.h b/Source/WebKit/UIProcess/mac/PageClientImplMac.h >index c884fa2bba9f8faec9766b22321e1f3ce5e85d13..6720f7c08140fec94b4774dc8fc014239baebe0e 100644 >--- a/Source/WebKit/UIProcess/mac/PageClientImplMac.h >+++ b/Source/WebKit/UIProcess/mac/PageClientImplMac.h >@@ -217,7 +217,7 @@ private: > 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; > >diff --git a/Source/WebKit/UIProcess/mac/PageClientImplMac.mm b/Source/WebKit/UIProcess/mac/PageClientImplMac.mm >index a0bc9ebe79869a74fdae3956aad80f7a1352f7ef..b3f54219d311d9ce2435797bd1230d973cf6ae7d 100644 >--- a/Source/WebKit/UIProcess/mac/PageClientImplMac.mm >+++ b/Source/WebKit/UIProcess/mac/PageClientImplMac.mm >@@ -827,7 +827,7 @@ void PageClientImpl::didPerformImmediateActionHitTest(const WebHitTestResultData > 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 @@ WebCore::WebMediaSessionManager& PageClientImpl::mediaSessionManager() > > 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() >diff --git a/Source/WebKit/UIProcess/mac/ServicesController.mm b/Source/WebKit/UIProcess/mac/ServicesController.mm >index bb6fb7513e953bc3f5df503c9de79ca3e4c015a7..3c8bc642af81ceca42b170546a53f8c563a09150 100644 >--- a/Source/WebKit/UIProcess/mac/ServicesController.mm >+++ b/Source/WebKit/UIProcess/mac/ServicesController.mm >@@ -97,27 +97,27 @@ void ServicesController::refreshExistingServices(bool refreshImmediately) > 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; >diff --git a/Source/WebKit/UIProcess/mac/WKImmediateActionController.mm b/Source/WebKit/UIProcess/mac/WKImmediateActionController.mm >index 8ceadc1d9c23c2d8044edc310cef46ccd52c9633..f87207064c7be51eaebb27a031d4905112b388f4 100644 >--- a/Source/WebKit/UIProcess/mac/WKImmediateActionController.mm >+++ b/Source/WebKit/UIProcess/mac/WKImmediateActionController.mm >@@ -328,7 +328,7 @@ - (void)_updateImmediateActionItem > } > > 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; >diff --git a/Source/WebKit/UIProcess/mac/WKPrintingView.mm b/Source/WebKit/UIProcess/mac/WKPrintingView.mm >index 7b0b38b7454461c7a279a75373e6589ede16352a..1fda7dbe5df1ff7db1770cafb140dff560f5a38c 100644 >--- a/Source/WebKit/UIProcess/mac/WKPrintingView.mm >+++ b/Source/WebKit/UIProcess/mac/WKPrintingView.mm >@@ -63,8 +63,10 @@ - (id)initWithFrameProxy:(WebKit::WebFrameProxy&)frame view:(NSView *)wkView > > - (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 @@ - (unsigned)_pageForRect:(NSRect)rect > 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 @@ - (void)_drawPDFDocument:(PDFDocument *)pdfDocument page:(unsigned)page atPoint: > > 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 @@ - (void)_drawPDFDocument:(PDFDocument *)pdfDocument page:(unsigned)page atPoint: > PDFDestination *destination = [linkAnnotation destination]; > if (!destination) > continue; >- CGPDFContextSetDestinationForRect(context, linkDestinationName(pdfDocument, destination), transformedRect); >- >+ CGPDFContextSetDestinationForRect(context, (__bridge CFStringRef)linkDestinationName(pdfDocument, destination), transformedRect); > continue; > } > >diff --git a/Source/WebKit/WebProcess/InjectedBundle/API/mac/WKDOMInternals.h b/Source/WebKit/WebProcess/InjectedBundle/API/mac/WKDOMInternals.h >index 2891318651ad92d56d076c5b55eeeda462fa0df1..c9eb05a7cd9b45a686050858a9eca7d31f5c1ccc 100644 >--- a/Source/WebKit/WebProcess/InjectedBundle/API/mac/WKDOMInternals.h >+++ b/Source/WebKit/WebProcess/InjectedBundle/API/mac/WKDOMInternals.h >@@ -89,8 +89,8 @@ private: > > // -- 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. -- > >diff --git a/Source/WebKit/WebProcess/InjectedBundle/API/mac/WKDOMInternals.mm b/Source/WebKit/WebProcess/InjectedBundle/API/mac/WKDOMInternals.mm >index 650fd473ccfea103532aeb403af0d38fbfc318e1..af0fe632abc7c9bc5576f4420c7448173a7157de 100644 >--- a/Source/WebKit/WebProcess/InjectedBundle/API/mac/WKDOMInternals.mm >+++ b/Source/WebKit/WebProcess/InjectedBundle/API/mac/WKDOMInternals.mm >@@ -51,15 +51,15 @@ static WKDOMType toWKDOMType(WebCoreType impl, DOMCache<WebCoreType, WKDOMType>& > > // -- 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 @@ WebCore::Node* toWebCoreNode(WKDOMNode *wrapper) > > 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 @@ WebCore::Range* toWebCoreRange(WKDOMRange * wrapper) > > WKDOMRange *toWKDOMRange(WebCore::Range* impl) > { >- return toWKDOMType<WebCore::Range*, WKDOMRange *>(impl, WKDOMRangeCache()); >+ return toWKDOMType<WebCore::Range*, __unsafe_unretained WKDOMRange *>(impl, WKDOMRangeCache()); > } > > // -- Helpers -- >diff --git a/Source/WebKit/WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm b/Source/WebKit/WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm >index 8ec6b825915092ab8469364fd2b55a6a5304fb5e..edcf532c85aaf8c6b3a50ae3d64be06e9aa0e340 100644 >--- a/Source/WebKit/WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm >+++ b/Source/WebKit/WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm >@@ -204,9 +204,10 @@ void NetscapePlugin::platformPreInitialize() > // 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 @@ void NetscapePlugin::updatePluginLayer() > // 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) >diff --git a/Source/WebKit/WebProcess/Plugins/PDF/PDFPlugin.mm b/Source/WebKit/WebProcess/Plugins/PDF/PDFPlugin.mm >index 5c2e06692bfa77a258e244ec38ca6deca1ea80b6..5307e26a7637e8a69b045abb92879f3f8c6586f2 100644 >--- a/Source/WebKit/WebProcess/Plugins/PDF/PDFPlugin.mm >+++ b/Source/WebKit/WebProcess/Plugins/PDF/PDFPlugin.mm >@@ -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 >diff --git a/Source/WebKit/WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm b/Source/WebKit/WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm >index bfab60a6dae7d45f06021ef743542a77febed79e..1f90c4a5740f41509d8e85b19d4a07e80043a254 100644 >--- a/Source/WebKit/WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm >+++ b/Source/WebKit/WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm >@@ -63,7 +63,7 @@ void WebEditorClient::setInsertionPasteboard(const String&) > 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 @@ static void changeWordCase(WebPage* page, SEL selector) > 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) >diff --git a/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm b/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm >index e43e29d3a53d4f0c919474dc5b452446171f04b0..17cfb34de04e83eccaef34312599781640e98788 100644 >--- a/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm >+++ b/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm >@@ -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>
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
andersca
:
review+
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 188955
:
348101
| 348104