WebKit Bugzilla
Attachment 347473 Details for
Bug 188735
: [Cocoa] Update uses of wrapper template functions in WebKit for clarity, simplicity, better ARC readiness
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-188735-20180819173010.patch (text/plain), 59.21 KB, created by
Darin Adler
on 2018-08-19 17:30:11 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Darin Adler
Created:
2018-08-19 17:30:11 PDT
Size:
59.21 KB
patch
obsolete
>Subversion Revision: 235021 >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index 028de973fb79443bfce8ca23fa9917b12c80cca3..4fab7544b9187e34fd89be5223bce433ef4f194f 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,193 @@ >+2018-08-19 Darin Adler <darin@apple.com> >+ >+ [Cocoa] Update uses of wrapper template functions in WebKit for clarity, simplicity, better ARC readiness >+ https://bugs.webkit.org/show_bug.cgi?id=188735 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Because of argument-dependent lookup, there should never be a reason to call >+ the wrapper function as WebKit::wrapper or API::wrapper unless there is a need >+ to resolve a name conflict, so removed the explicit namespacing. >+ >+ * UIProcess/API/C/mac/WKPagePrivateMac.mm: >+ (WKPageLoadURLRequestReturningNavigation): Removed explicit null check and >+ leakRef/autorelease pair, both done by the wrapper template function now. >+ >+ * UIProcess/API/Cocoa/WKBackForwardList.mm: >+ (toWKBackForwardListItem): Deleted. >+ (-[WKBackForwardList currentItem]): Use wrapper instead of toWKBackForwardListItem. >+ (-[WKBackForwardList backItem]): Ditto. >+ (-[WKBackForwardList forwardItem]): Ditto. >+ (-[WKBackForwardList itemAtIndex:]): Ditto. >+ (-[WKBackForwardList backList]): Removed leakRef/autorelease pair. >+ (-[WKBackForwardList forwardList]): Ditto. >+ >+ * UIProcess/API/Cocoa/WKContentRuleListStore.mm: >+ (+[WKContentRuleListStore defaultStore]): Removed explicit WebKit namespace. >+ (+[WKContentRuleListStore storeWithURL:]): Fixed storage leak by removing leakRef, >+ which was not balanced. This is not a copy or create function, so it should not >+ return an object that requires a release to balance it. >+ (-[WKContentRuleListStore _compileContentRuleListForIdentifier:encodedContentRuleList:completionHandler:releasesArgument:]): >+ Removed explicit WebKit namespace and unneeded get(). >+ (-[WKContentRuleListStore lookUpContentRuleListForIdentifier:completionHandler:]): >+ Removed explicit WebKit namespace. >+ (+[WKContentRuleListStore defaultStoreWithLegacyFilename]): Ditto. >+ (+[WKContentRuleListStore storeWithURLAndLegacyFilename:]): Fixed storage leak, >+ as above in storeWithURL. >+ >+ * UIProcess/API/Cocoa/WKFrameInfo.mm: >+ (-[WKFrameInfo _handle]): Removed explicit WebKit namespace. >+ * UIProcess/API/Cocoa/WKHTTPCookieStore.mm: >+ (WKHTTPCookieStoreObserver::cookiesDidChange): Ditto. >+ >+ * UIProcess/API/Cocoa/WKNavigationAction.mm: >+ (-[WKNavigationAction sourceFrame]): Removed explicit null check, now done by >+ the wrapper template function. >+ (-[WKNavigationAction targetFrame]): Ditto. >+ (-[WKNavigationAction _userInitiatedAction]): Ditto. >+ (-[WKNavigationAction _mainFrameNavigation]): Ditto. >+ >+ * UIProcess/API/Cocoa/WKOpenPanelParameters.mm: >+ (-[WKOpenPanelParameters _acceptedMIMETypes]): Removed leakRef/autorelease pair, >+ now done by the wrapper template function. >+ (-[WKOpenPanelParameters _acceptedFileExtensions]): Ditto. >+ >+ * UIProcess/API/Cocoa/WKPreferences.mm: >+ (-[WKPreferences copyWithZone:]): Use retain instead of leakRef; slightly clearer >+ for when we convert to ARC. >+ (+[WKPreferences _experimentalFeatures]): Removed leakRef/autorelease pair, >+ now done by the wrapper template function. >+ >+ * UIProcess/API/Cocoa/WKProcessPool.mm: >+ (-[WKProcessPool _configuration]): Fixed a storage leak by removing leakRef, >+ which was not balanaced. This is not a copy or create function, so it should not >+ return an object that requires a release to balance it. >+ >+ * UIProcess/API/Cocoa/WKURLSchemeTaskInternal.h: >+ Replaced inline wrapper function with WrapperTraits structure template specialization. >+ >+ * UIProcess/API/Cocoa/WKUserScript.mm: >+ (-[WKUserScript _userContentWorld]): Removed explicit API namespace. >+ >+ * UIProcess/API/Cocoa/WKWebView.mm: >+ (-[WKWebView loadRequest:]): Removed explicit null check and >+ leakRef/autorelease pair, both done by the wrapper template function now. >+ (-[WKWebView loadFileURL:allowingReadAccessToURL:]): Ditto. >+ (-[WKWebView loadData:MIMEType:characterEncodingName:baseURL:]): Ditto. >+ (-[WKWebView goToBackForwardListItem:]): Ditto. >+ (-[WKWebView goBack]): Ditto. >+ (-[WKWebView goForward]): Ditto. >+ (-[WKWebView reload]): Ditto. >+ (-[WKWebView reloadFromOrigin]): Ditto. >+ (-[WKWebView _didInsertAttachment:withSource:]): Removed leakRef/autorelease pairs, >+ now done by the wrapper template function. >+ (-[WKWebView _didRemoveAttachment:]): Ditto. >+ (-[WKWebView _loadData:MIMEType:characterEncodingName:baseURL:userData:]): Removed >+ explicit null check and leakRef/autorelease pair, both done by the wrapper template >+ function now. >+ (-[WKWebView _loadRequest:shouldOpenExternalURLs:]): Ditto. >+ (-[WKWebView _reloadWithoutContentBlockers]): Ditto. >+ (-[WKWebView _reloadExpiredOnly]): Ditto. >+ (-[WKWebView _sessionStateData]): Removed explicit leakRef/autorelease pair, done >+ by the wrapper template function now. Also, the old version explicitly dereferenced >+ and would not work when the result of encodeLegacySessionState was null. Decided >+ not to add a call to releaseNonNull to preserve that possibly-incorrect optimization, >+ instead allowing the wrapper function to generate code to handle the null case. >+ (-[WKWebView _sessionState]): Use the Objective-C autorelease instead of adoptNS >+ and RetainPtr's autorelease. >+ (-[WKWebView _sessionStateWithFilter:]): Ditto. >+ (-[WKWebView _restoreSessionState:andNavigate:]): Removed explicit null check and >+ leakRef/autorelease pair, both done by the wrapper template function now. >+ (-[WKWebView _insertAttachmentWithFilename:contentType:data:options:completion:]): >+ Removed explicit leakRef/autorelease pair, done by the wrapper template function now. >+ (-[WKWebView _diagnosticLoggingDelegate]): Replaced a leakRef/autorelease pair with >+ use of RetainPtr's autorelease. >+ (-[WKWebView _findDelegate]): Ditto. >+ >+ * UIProcess/API/Cocoa/WKWebViewConfiguration.mm: >+ (-[WKWebViewConfiguration _applicationManifest]): Removed explicit null check, >+ done by the wrapper template function now. >+ >+ * UIProcess/API/Cocoa/WKWebsiteDataStore.mm: >+ (+[WKWebsiteDataStore defaultDataStore]): Removed explicit WebKit namespace >+ and unneeded call to get(). >+ (+[WKWebsiteDataStore nonPersistentDataStore]): Removed explicit WebKit namespace >+ and leakRef/autorelease pair, done by the wrapper template function now. >+ (-[WKWebsiteDataStore httpCookieStore]): Removed explicit WebKit namespace. >+ >+ * UIProcess/API/Cocoa/_WKApplicationManifest.mm: >+ (+[_WKApplicationManifest applicationManifestFromJSON:manifestURL:documentURL:]): >+ Removed explicit leakRef/autorelease pair, done by the wrapper template function now. >+ * UIProcess/API/Cocoa/_WKGeolocationPosition.mm: >+ (WebKit::wrapper): Ditto. >+ >+ * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm: >+ (-[_WKProcessPoolConfiguration copyWithZone:]): Use retain instead of leakRef; >+ slightly clearer for when we convert to ARC. >+ >+ * UIProcess/API/Cocoa/_WKUserContentWorld.mm: >+ (+[_WKUserContentWorld worldWithName:]): Removed explicit leakRef/autorelease pair, >+ done by the wrapper template function now. >+ >+ * UIProcess/API/Cocoa/_WKWebsitePolicies.mm: >+ (-[_WKWebsitePolicies websiteDataStore]): Removed explicit null check, done by >+ the wrapper template function now. >+ >+ * UIProcess/Cocoa/NavigationState.mm: >+ (WebKit::NavigationState::NavigationClient::didChangeBackForwardList): Removed >+ explicit null check, done by the wrapper template function now. >+ (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction): Ditto. >+ (WebKit::NavigationState::NavigationClient::didStartProvisionalNavigation): Ditto. >+ (WebKit::NavigationState::NavigationClient::didReceiveServerRedirectForProvisionalNavigation): Ditto. >+ (WebKit::NavigationState::NavigationClient::didFailProvisionalNavigationWithError): Ditto. >+ (WebKit::NavigationState::NavigationClient::didFailProvisionalLoadInSubframeWithError): Ditto. >+ (WebKit::NavigationState::NavigationClient::didCommitNavigation): Ditto. >+ (WebKit::NavigationState::NavigationClient::didFinishDocumentLoad): Ditto. >+ (WebKit::NavigationState::NavigationClient::didFinishNavigation): Ditto. >+ (WebKit::NavigationState::NavigationClient::didFailNavigationWithError): Ditto. >+ (WebKit::NavigationState::NavigationClient::didSameDocumentNavigation): Ditto. >+ >+ * UIProcess/Cocoa/SessionStateCoding.mm: >+ (WebKit::encodeSessionState): Removed explicit leakRef/autorelease pair, done >+ by the wrapper template function now. Also, the old version explicitly dereferenced >+ and would not work when the result of encodeLegacySessionState was null. Decided >+ not to add a call to releaseNonNull to preserve that possibly-incorrect optimization, >+ instead allowing the wrapper function to generate code to handle the null case. >+ >+ * UIProcess/mac/WKInspectorViewController.mm: >+ (-[WKInspectorViewController configuration]): Removed explicit WebKit namespace. >+ >+ * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInFrame.mm: >+ (+[WKWebProcessPlugInFrame lookUpFrameFromHandle:]): Removed explicit null check, >+ done by the wrapper template function now. >+ (-[WKWebProcessPlugInFrame hitTest:]): Removed explicit leakRef/autorelease pair, done >+ by the wrapper template function now. Also, the old version explicitly dereferenced >+ and would not work when the result of hitTest was null. Decided not to add a call to >+ releaseNonNull to preserve that possibly-incorrect optimization, instead allowing the >+ wrapper function to generate code to handle the null case. >+ (-[WKWebProcessPlugInFrame childFrames]): Removed explicit leakRef/autorelease pair, >+ done by the wrapper template function now. >+ (-[WKWebProcessPlugInFrame handle]): Ditto. >+ (-[WKWebProcessPlugInFrame _parentFrame]): Removed explicit null check, done by the >+ wrapper template function now. >+ >+ * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInHitTestResult.mm: >+ (-[WKWebProcessPlugInHitTestResult nodeHandle]): Removed explicit null check and >+ leakRef/autorelease pair, both done by the wrapper template function now. >+ * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandle.mm: >+ (+[WKWebProcessPlugInNodeHandle nodeHandleWithJSValue:inContext:]): Ditto. >+ (-[WKWebProcessPlugInNodeHandle htmlIFrameElementContentFrame]): Ditto. >+ (-[WKWebProcessPlugInNodeHandle HTMLTableCellElementCellAbove]): Ditto. >+ (-[WKWebProcessPlugInNodeHandle frame]): Ditto. >+ * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInRangeHandle.mm: >+ (+[WKWebProcessPlugInRangeHandle rangeHandleWithJSValue:inContext:]): Ditto. >+ (-[WKWebProcessPlugInRangeHandle frame]): Ditto. >+ * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInScriptWorld.mm: >+ (+[WKWebProcessPlugInScriptWorld world]): Ditto. >+ * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm: >+ (-[WKWebProcessPlugInBrowserContextController mainFrame]): Ditto. >+ (+[WKWebProcessPlugInBrowserContextController lookUpBrowsingContextFromHandle:]): Ditto. >+ > 2018-08-19 Darin Adler <darin@apple.com> > > [Cocoa] Consolidate inline "wrapper" functions in WebKit API into function templates and WrapperTraits >diff --git a/Source/WebKit/UIProcess/API/C/mac/WKPagePrivateMac.mm b/Source/WebKit/UIProcess/API/C/mac/WKPagePrivateMac.mm >index 2eb36b562abfe26565db41f922792901360e716b..1994f3dc9d4fcfe0130573a8cabcca57ca54c6b2 100644 >--- a/Source/WebKit/UIProcess/API/C/mac/WKPagePrivateMac.mm >+++ b/Source/WebKit/UIProcess/API/C/mac/WKPagePrivateMac.mm >@@ -143,12 +143,7 @@ bool WKPageIsURLKnownHSTSHost(WKPageRef page, WKURLRef url) > WKNavigation *WKPageLoadURLRequestReturningNavigation(WKPageRef pageRef, WKURLRequestRef urlRequestRef) > { > auto resourceRequest = toImpl(urlRequestRef)->resourceRequest(); >- auto navigation = toImpl(pageRef)->loadRequest(WTFMove(resourceRequest)); >- >- if (!navigation) >- return nil; >- >- return [API::wrapper(*navigation.leakRef()) autorelease]; >+ return wrapper(toImpl(pageRef)->loadRequest(WTFMove(resourceRequest))); > } > #endif > >diff --git a/Source/WebKit/UIProcess/API/Cocoa/WKBackForwardList.mm b/Source/WebKit/UIProcess/API/Cocoa/WKBackForwardList.mm >index 2c96965478029dcd27ec531036d2a6a5c8ae23a9..79e5d239b9b80cf67417e93f888c99962004d7f9 100644 >--- a/Source/WebKit/UIProcess/API/Cocoa/WKBackForwardList.mm >+++ b/Source/WebKit/UIProcess/API/Cocoa/WKBackForwardList.mm >@@ -44,42 +44,34 @@ - (void)dealloc > [super dealloc]; > } > >-static WKBackForwardListItem *toWKBackForwardListItem(WebBackForwardListItem* item) >-{ >- if (!item) >- return nil; >- >- return wrapper(*item); >-} >- > - (WKBackForwardListItem *)currentItem > { >- return toWKBackForwardListItem(_list->currentItem()); >+ return wrapper(_list->currentItem()); > } > > - (WKBackForwardListItem *)backItem > { >- return toWKBackForwardListItem(_list->backItem()); >+ return wrapper(_list->backItem()); > } > > - (WKBackForwardListItem *)forwardItem > { >- return toWKBackForwardListItem(_list->forwardItem()); >+ return wrapper(_list->forwardItem()); > } > > - (WKBackForwardListItem *)itemAtIndex:(NSInteger)index > { >- return toWKBackForwardListItem(_list->itemAtIndex(index)); >+ return wrapper(_list->itemAtIndex(index)); > } > > - (NSArray *)backList > { >- return [wrapper(_list->backList().leakRef()) autorelease]; >+ return wrapper(_list->backList()); > } > > - (NSArray *)forwardList > { >- return [wrapper(_list->forwardList().leakRef()) autorelease]; >+ return wrapper(_list->forwardList()); > } > > #pragma mark WKObject protocol implementation >diff --git a/Source/WebKit/UIProcess/API/Cocoa/WKContentRuleListStore.mm b/Source/WebKit/UIProcess/API/Cocoa/WKContentRuleListStore.mm >index 56355af9383481687c4a580ff431e4d8303a9e75..4b41b43968c2e8b0059aa51d438ae3a33cbe7bba 100644 >--- a/Source/WebKit/UIProcess/API/Cocoa/WKContentRuleListStore.mm >+++ b/Source/WebKit/UIProcess/API/Cocoa/WKContentRuleListStore.mm >@@ -63,14 +63,13 @@ - (void)dealloc > + (instancetype)defaultStore > { > const bool legacyFilename = false; >- return WebKit::wrapper(API::ContentRuleListStore::defaultStore(legacyFilename)); >+ return wrapper(API::ContentRuleListStore::defaultStore(legacyFilename)); > } > > + (instancetype)storeWithURL:(NSURL *)url > { > const bool legacyFilename = false; >- Ref<API::ContentRuleListStore> store = API::ContentRuleListStore::storeWithPath(url.absoluteURL.fileSystemRepresentation, legacyFilename); >- return WebKit::wrapper(store.leakRef()); >+ return wrapper(API::ContentRuleListStore::storeWithPath(url.absoluteURL.fileSystemRepresentation, legacyFilename)); > } > > - (void)compileContentRuleListForIdentifier:(NSString *)identifier encodedContentRuleList:(NSString *)encodedContentRuleList completionHandler:(void (^)(WKContentRuleList *, NSError *))completionHandler >@@ -94,7 +93,7 @@ - (void)_compileContentRuleListForIdentifier:(NSString *)identifier encodedConte > // 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(WebKit::wrapper(*contentRuleList.get()), nil); >+ completionHandler(wrapper(*contentRuleList), nil); > }); > } > >@@ -108,7 +107,7 @@ - (void)lookUpContentRuleListForIdentifier:(NSString *)identifier completionHand > return completionHandler(nil, [NSError errorWithDomain:WKErrorDomain code:wkError userInfo:userInfo]); > } > >- completionHandler(WebKit::wrapper(*contentRuleList.get()), nil); >+ completionHandler(wrapper(*contentRuleList), nil); > }); > } > >@@ -180,14 +179,13 @@ - (void)_compileContentRuleListForIdentifier:(NSString *)identifier encodedConte > + (instancetype)defaultStoreWithLegacyFilename > { > const bool legacyFilename = true; >- return WebKit::wrapper(API::ContentRuleListStore::defaultStore(legacyFilename)); >+ return wrapper(API::ContentRuleListStore::defaultStore(legacyFilename)); > } > > + (instancetype)storeWithURLAndLegacyFilename:(NSURL *)url > { > const bool legacyFilename = true; >- Ref<API::ContentRuleListStore> store = API::ContentRuleListStore::storeWithPath(url.absoluteURL.fileSystemRepresentation, legacyFilename); >- return WebKit::wrapper(store.leakRef()); >+ return wrapper(API::ContentRuleListStore::storeWithPath(url.absoluteURL.fileSystemRepresentation, legacyFilename)); > } > > @end >diff --git a/Source/WebKit/UIProcess/API/Cocoa/WKFrameInfo.mm b/Source/WebKit/UIProcess/API/Cocoa/WKFrameInfo.mm >index be6eb3f78432e991764b959946f06383d000aa13..3d1a6de873e28d3fc81ed0dc506280e8157cbfce 100644 >--- a/Source/WebKit/UIProcess/API/Cocoa/WKFrameInfo.mm >+++ b/Source/WebKit/UIProcess/API/Cocoa/WKFrameInfo.mm >@@ -86,7 +86,7 @@ @implementation WKFrameInfo (WKPrivate) > > - (_WKFrameHandle *)_handle > { >- return WebKit::wrapper(_frameInfo->handle()); >+ return wrapper(_frameInfo->handle()); > } > > @end >diff --git a/Source/WebKit/UIProcess/API/Cocoa/WKHTTPCookieStore.mm b/Source/WebKit/UIProcess/API/Cocoa/WKHTTPCookieStore.mm >index 0a0863a80f61c6622a21dbed72f967bfd886a31f..55324a1b6b84c4716acce47c16fe47423d75c58c 100644 >--- a/Source/WebKit/UIProcess/API/Cocoa/WKHTTPCookieStore.mm >+++ b/Source/WebKit/UIProcess/API/Cocoa/WKHTTPCookieStore.mm >@@ -56,7 +56,7 @@ public: > private: > void cookiesDidChange(API::HTTPCookieStore& cookieStore) final > { >- [m_observer.get() cookiesDidChangeInCookieStore:WebKit::wrapper(cookieStore)]; >+ [m_observer cookiesDidChangeInCookieStore:wrapper(cookieStore)]; > } > > WeakObjCPtr<id<WKHTTPCookieStoreObserver>> m_observer; >diff --git a/Source/WebKit/UIProcess/API/Cocoa/WKNavigationAction.mm b/Source/WebKit/UIProcess/API/Cocoa/WKNavigationAction.mm >index 3f8ff695b22425ce27eee9aab5f8e3ccf93b7fd1..c7d5905632982dca99cec398d998caafa82a1955 100644 >--- a/Source/WebKit/UIProcess/API/Cocoa/WKNavigationAction.mm >+++ b/Source/WebKit/UIProcess/API/Cocoa/WKNavigationAction.mm >@@ -137,16 +137,12 @@ - (NSString *)description > > - (WKFrameInfo *)sourceFrame > { >- if (API::FrameInfo* frameInfo = _navigationAction->sourceFrame()) >- return wrapper(*frameInfo); >- return nil; >+ return wrapper(_navigationAction->sourceFrame()); > } > > - (WKFrameInfo *)targetFrame > { >- if (API::FrameInfo* frameInfo = _navigationAction->targetFrame()) >- return wrapper(*frameInfo); >- return nil; >+ return wrapper(_navigationAction->targetFrame()); > } > > - (WKNavigationType)navigationType >@@ -226,10 +222,7 @@ - (BOOL)_shouldOpenExternalURLs > > - (_WKUserInitiatedAction *)_userInitiatedAction > { >- auto userInitiatedAction = _navigationAction->userInitiatedAction(); >- if (userInitiatedAction) >- return wrapper(*userInitiatedAction); >- return nil; >+ return wrapper(_navigationAction->userInitiatedAction()); > } > > - (BOOL)_isRedirect >@@ -239,10 +232,7 @@ - (BOOL)_isRedirect > > - (WKNavigation *)_mainFrameNavigation > { >- if (auto* navigation = _navigationAction->mainFrameNavigation()) >- return wrapper(*navigation); >- >- return nil; >+ return wrapper(_navigationAction->mainFrameNavigation()); > } > > @end >diff --git a/Source/WebKit/UIProcess/API/Cocoa/WKOpenPanelParameters.mm b/Source/WebKit/UIProcess/API/Cocoa/WKOpenPanelParameters.mm >index 8d2509b335ff65f62c46ac5fa7d816f8845ed156..3dbd54522a65db741b06bf47b5ca0375f14e923b 100644 >--- a/Source/WebKit/UIProcess/API/Cocoa/WKOpenPanelParameters.mm >+++ b/Source/WebKit/UIProcess/API/Cocoa/WKOpenPanelParameters.mm >@@ -55,12 +55,12 @@ @implementation WKOpenPanelParameters (WKPrivate) > > - (NSArray<NSString *> *)_acceptedMIMETypes > { >- return [wrapper(_openPanelParameters->acceptMIMETypes().leakRef()) autorelease]; >+ return wrapper(_openPanelParameters->acceptMIMETypes()); > } > > - (NSArray<NSString *> *)_acceptedFileExtensions > { >- return [wrapper(_openPanelParameters->acceptFileExtensions().leakRef()) autorelease]; >+ return wrapper(_openPanelParameters->acceptFileExtensions()); > } > > @end >diff --git a/Source/WebKit/UIProcess/API/Cocoa/WKPreferences.mm b/Source/WebKit/UIProcess/API/Cocoa/WKPreferences.mm >index be43285a5f2af0675e5b24203a9451772375eb06..c49b4768a2d801e1a299f4c69f0b37c8bd20ae3a 100644 >--- a/Source/WebKit/UIProcess/API/Cocoa/WKPreferences.mm >+++ b/Source/WebKit/UIProcess/API/Cocoa/WKPreferences.mm >@@ -97,7 +97,7 @@ - (instancetype)initWithCoder:(NSCoder *)coder > > - (id)copyWithZone:(NSZone *)zone > { >- return wrapper(_preferences->copy().leakRef()); >+ return [wrapper(_preferences->copy()) retain]; > } > > - (CGFloat)minimumFontSize >@@ -530,7 +530,7 @@ - (void)_setFixedPitchFontFamily:(NSString *)fixedPitchFontFamily > + (NSArray<_WKExperimentalFeature *> *)_experimentalFeatures > { > auto features = WebKit::WebPreferences::experimentalFeatures(); >- return [wrapper(API::Array::create(WTFMove(features)).leakRef()) autorelease]; >+ return wrapper(API::Array::create(WTFMove(features))); > } > > - (BOOL)_isEnabledForFeature:(_WKExperimentalFeature *)feature >diff --git a/Source/WebKit/UIProcess/API/Cocoa/WKProcessPool.mm b/Source/WebKit/UIProcess/API/Cocoa/WKProcessPool.mm >index ab319e79edd17915fe9b15b69a8dbcaab5de1263..e390b9d355644556a1572f67a7061b54b2b6daf3 100644 >--- a/Source/WebKit/UIProcess/API/Cocoa/WKProcessPool.mm >+++ b/Source/WebKit/UIProcess/API/Cocoa/WKProcessPool.mm >@@ -126,7 +126,7 @@ - (NSString *)description > > - (_WKProcessPoolConfiguration *)_configuration > { >- return wrapper(_processPool->configuration().copy().leakRef()); >+ return wrapper(_processPool->configuration().copy()); > } > > - (API::Object&)_apiObject >diff --git a/Source/WebKit/UIProcess/API/Cocoa/WKURLSchemeTaskInternal.h b/Source/WebKit/UIProcess/API/Cocoa/WKURLSchemeTaskInternal.h >index 5797580d224560ec8e7a64f3ea557a0e0eef2f46..52b87484920b8e0042ac90377d340c2dd2f88f98 100644 >--- a/Source/WebKit/UIProcess/API/Cocoa/WKURLSchemeTaskInternal.h >+++ b/Source/WebKit/UIProcess/API/Cocoa/WKURLSchemeTaskInternal.h >@@ -1,5 +1,5 @@ > /* >- * Copyright (C) 2017 Apple Inc. All rights reserved. >+ * Copyright (C) 2017-2018 Apple Inc. All rights reserved. > * > * Redistribution and use in source and binary forms, with or without > * modification, are permitted provided that the following conditions >@@ -35,11 +35,9 @@ > > namespace WebKit { > >-inline id<WKURLSchemeTask> wrapper(API::URLSchemeTask& urlSchemeTask) >-{ >- ASSERT([urlSchemeTask.wrapper() isKindOfClass:[WKURLSchemeTaskImpl class]]); >- return (id<WKURLSchemeTask>)urlSchemeTask.wrapper(); >-} >+template<> struct WrapperTraits<API::URLSchemeTask> { >+ using WrapperClass = WKURLSchemeTaskImpl; >+}; > > } > >diff --git a/Source/WebKit/UIProcess/API/Cocoa/WKUserScript.mm b/Source/WebKit/UIProcess/API/Cocoa/WKUserScript.mm >index 1740a22d3068898e782dfbb016b02c3775537a42..9cf6681aab391c35b637907b111086f827976d5a 100644 >--- a/Source/WebKit/UIProcess/API/Cocoa/WKUserScript.mm >+++ b/Source/WebKit/UIProcess/API/Cocoa/WKUserScript.mm >@@ -102,7 +102,7 @@ - (instancetype)_initWithSource:(NSString *)source injectionTime:(WKUserScriptIn > > - (_WKUserContentWorld *)_userContentWorld > { >- return API::wrapper(_userScript->userContentWorld()); >+ return wrapper(_userScript->userContentWorld()); > } > > @end >diff --git a/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm b/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm >index 6cb60093cb0969170eb89af254c68ace456f85d7..f02301813e02af3362bfc5b3c47e39dafd1c4f5e 100644 >--- a/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm >+++ b/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm >@@ -857,11 +857,7 @@ - (void)_setIconLoadingDelegate:(id<_WKIconLoadingDelegate>)iconLoadingDelegate > > - (WKNavigation *)loadRequest:(NSURLRequest *)request > { >- auto navigation = _page->loadRequest(request); >- if (!navigation) >- return nil; >- >- return [wrapper(*navigation.leakRef()) autorelease]; >+ return wrapper(_page->loadRequest(request)); > } > > - (WKNavigation *)loadFileURL:(NSURL *)URL allowingReadAccessToURL:(NSURL *)readAccessURL >@@ -872,11 +868,7 @@ - (WKNavigation *)loadFileURL:(NSURL *)URL allowingReadAccessToURL:(NSURL *)read > if (![readAccessURL isFileURL]) > [NSException raise:NSInvalidArgumentException format:@"%@ is not a file URL", readAccessURL]; > >- auto navigation = _page->loadFile([URL _web_originalDataAsWTFString], [readAccessURL _web_originalDataAsWTFString]); >- if (!navigation) >- return nil; >- >- return [wrapper(*navigation.leakRef()) autorelease]; >+ return wrapper(_page->loadFile([URL _web_originalDataAsWTFString], [readAccessURL _web_originalDataAsWTFString])); > } > > - (WKNavigation *)loadHTMLString:(NSString *)string baseURL:(NSURL *)baseURL >@@ -888,20 +880,12 @@ - (WKNavigation *)loadHTMLString:(NSString *)string baseURL:(NSURL *)baseURL > > - (WKNavigation *)loadData:(NSData *)data MIMEType:(NSString *)MIMEType characterEncodingName:(NSString *)characterEncodingName baseURL:(NSURL *)baseURL > { >- auto navigation = _page->loadData({ static_cast<const uint8_t*>(data.bytes), data.length }, MIMEType, characterEncodingName, baseURL.absoluteString); >- if (!navigation) >- return nil; >- >- return [wrapper(*navigation.leakRef()) autorelease]; >+ return wrapper(_page->loadData({ static_cast<const uint8_t*>(data.bytes), data.length }, MIMEType, characterEncodingName, baseURL.absoluteString)); > } > > - (WKNavigation *)goToBackForwardListItem:(WKBackForwardListItem *)item > { >- auto navigation = _page->goToBackForwardItem(item._item); >- if (!navigation) >- return nil; >- >- return [wrapper(*navigation.leakRef()) autorelease]; >+ return wrapper(_page->goToBackForwardItem(item._item)); > } > > - (NSString *)title >@@ -954,20 +938,12 @@ - (BOOL)canGoForward > > - (WKNavigation *)goBack > { >- auto navigation = _page->goBack(); >- if (!navigation) >- return nil; >- >- return [wrapper(*navigation.leakRef()) autorelease]; >+ return wrapper(_page->goBack()); > } > > - (WKNavigation *)goForward > { >- auto navigation = _page->goForward(); >- if (!navigation) >- return nil; >- >- return [wrapper(*navigation.leakRef()) autorelease]; >+ return wrapper(_page->goForward()); > } > > - (WKNavigation *)reload >@@ -976,20 +952,12 @@ - (WKNavigation *)reload > if (linkedOnOrAfter(WebKit::SDKVersion::FirstWithExpiredOnlyReloadBehavior)) > reloadOptions |= WebCore::ReloadOption::ExpiredOnly; > >- auto navigation = _page->reload(reloadOptions); >- if (!navigation) >- return nil; >- >- return [wrapper(*navigation.leakRef()) autorelease]; >+ return wrapper(_page->reload(reloadOptions)); > } > > - (WKNavigation *)reloadFromOrigin > { >- auto navigation = _page->reload(WebCore::ReloadOption::FromOrigin); >- if (!navigation) >- return nil; >- >- return [wrapper(*navigation.leakRef()) autorelease]; >+ return wrapper(_page->reload(WebCore::ReloadOption::FromOrigin)); > } > > - (void)stopLoading >@@ -1245,16 +1213,16 @@ - (void)_didInsertAttachment:(NSString *)identifier withSource:(NSString *)sourc > { > id <WKUIDelegatePrivate> uiDelegate = (id <WKUIDelegatePrivate>)self.UIDelegate; > if ([uiDelegate respondsToSelector:@selector(_webView:didInsertAttachment:withSource:)]) >- [uiDelegate _webView:self didInsertAttachment:[wrapper(API::Attachment::create(identifier, *_page).leakRef()) autorelease] withSource:source]; >+ [uiDelegate _webView:self didInsertAttachment:wrapper(API::Attachment::create(identifier, *_page)) withSource:source]; > else if ([uiDelegate respondsToSelector:@selector(_webView:didInsertAttachment:)]) >- [uiDelegate _webView:self didInsertAttachment:[wrapper(API::Attachment::create(identifier, *_page).leakRef()) autorelease]]; >+ [uiDelegate _webView:self didInsertAttachment:wrapper(API::Attachment::create(identifier, *_page))]; > } > > - (void)_didRemoveAttachment:(NSString *)identifier > { > id <WKUIDelegatePrivate> uiDelegate = (id <WKUIDelegatePrivate>)self.UIDelegate; > if ([uiDelegate respondsToSelector:@selector(_webView:didRemoveAttachment:)]) >- [uiDelegate _webView:self didRemoveAttachment:[wrapper(API::Attachment::create(identifier, *_page).leakRef()) autorelease]]; >+ [uiDelegate _webView:self didRemoveAttachment:wrapper(API::Attachment::create(identifier, *_page))]; > } > > #endif // ENABLE(ATTACHMENT_ELEMENT) >@@ -4223,20 +4191,12 @@ - (void)_loadAlternateHTMLString:(NSString *)string baseURL:(NSURL *)baseURL for > > - (WKNavigation *)_loadData:(NSData *)data MIMEType:(NSString *)MIMEType characterEncodingName:(NSString *)characterEncodingName baseURL:(NSURL *)baseURL userData:(id)userData > { >- auto navigation = _page->loadData({ static_cast<const uint8_t*>(data.bytes), data.length }, MIMEType, characterEncodingName, baseURL.absoluteString, WebKit::ObjCObjectGraph::create(userData).ptr()); >- if (!navigation) >- return nil; >- >- return [wrapper(*navigation.leakRef()) autorelease]; >+ return wrapper(_page->loadData({ static_cast<const uint8_t*>(data.bytes), data.length }, MIMEType, characterEncodingName, baseURL.absoluteString, WebKit::ObjCObjectGraph::create(userData).ptr())); > } > > - (WKNavigation *)_loadRequest:(NSURLRequest *)request shouldOpenExternalURLs:(BOOL)shouldOpenExternalURLs > { >- auto navigation = _page->loadRequest(request, shouldOpenExternalURLs ? WebCore::ShouldOpenExternalURLsPolicy::ShouldAllow : WebCore::ShouldOpenExternalURLsPolicy::ShouldNotAllow); >- if (!navigation) >- return nil; >- >- return [wrapper(*navigation.leakRef()) autorelease]; >+ return wrapper(_page->loadRequest(request, shouldOpenExternalURLs ? WebCore::ShouldOpenExternalURLsPolicy::ShouldAllow : WebCore::ShouldOpenExternalURLsPolicy::ShouldNotAllow)); > } > > - (NSArray *)_certificateChain >@@ -4314,20 +4274,12 @@ - (void)_killWebContentProcess > > - (WKNavigation *)_reloadWithoutContentBlockers > { >- auto navigation = _page->reload(WebCore::ReloadOption::DisableContentBlockers); >- if (!navigation) >- return nil; >- >- return [wrapper(*navigation.leakRef()) autorelease]; >+ return wrapper(_page->reload(WebCore::ReloadOption::DisableContentBlockers)); > } > > - (WKNavigation *)_reloadExpiredOnly > { >- auto navigation = _page->reload(WebCore::ReloadOption::ExpiredOnly); >- if (!navigation) >- return nil; >- >- return [wrapper(*navigation.leakRef()) autorelease]; >+ return wrapper(_page->reload(WebCore::ReloadOption::ExpiredOnly)); > } > > - (void)_killWebContentProcessAndResetState >@@ -4404,15 +4356,13 @@ - (void)_accessibilityDidGetSpeakSelectionContent:(NSString *)content > > - (NSData *)_sessionStateData > { >- WebKit::SessionState sessionState = _page->sessionState(); >- > // FIXME: This should not use the legacy session state encoder. >- return [wrapper(*WebKit::encodeLegacySessionState(sessionState).leakRef()) autorelease]; >+ return wrapper(WebKit::encodeLegacySessionState(_page->sessionState())); > } > > - (_WKSessionState *)_sessionState > { >- return adoptNS([[_WKSessionState alloc] _initWithSessionState:_page->sessionState()]).autorelease(); >+ return [[[_WKSessionState alloc] _initWithSessionState:_page->sessionState()] autorelease]; > } > > - (_WKSessionState *)_sessionStateWithFilter:(BOOL (^)(WKBackForwardListItem *item))filter >@@ -4424,7 +4374,7 @@ - (_WKSessionState *)_sessionStateWithFilter:(BOOL (^)(WKBackForwardListItem *it > return (bool)filter(wrapper(item)); > }); > >- return adoptNS([[_WKSessionState alloc] _initWithSessionState:sessionState]).autorelease(); >+ return [[[_WKSessionState alloc] _initWithSessionState:sessionState] autorelease]; > } > > - (void)_restoreFromSessionStateData:(NSData *)sessionStateData >@@ -4439,11 +4389,7 @@ - (void)_restoreFromSessionStateData:(NSData *)sessionStateData > > - (WKNavigation *)_restoreSessionState:(_WKSessionState *)sessionState andNavigate:(BOOL)navigate > { >- auto navigation = _page->restoreFromSessionState(sessionState->_sessionState, navigate); >- if (!navigation) >- return nil; >- >- return [wrapper(*navigation.leakRef()) autorelease]; >+ return wrapper(_page->restoreFromSessionState(sessionState->_sessionState, navigate)); > } > > - (void)_close >@@ -4463,7 +4409,7 @@ - (_WKAttachment *)_insertAttachmentWithFilename:(NSString *)filename contentTyp > capturedHandler(error == WebKit::CallbackBase::Error::None); > }); > >- return [wrapper(API::Attachment::create(identifier, *_page).leakRef()) autorelease]; >+ return wrapper(API::Attachment::create(identifier, *_page)); > #else > return nil; > #endif >@@ -4747,7 +4693,7 @@ - (id <_WKDiagnosticLoggingDelegate>)_diagnosticLoggingDelegate > if (!diagnosticLoggingClient) > return nil; > >- return [static_cast<WebKit::DiagnosticLoggingClient&>(*diagnosticLoggingClient).delegate().leakRef() autorelease]; >+ return static_cast<WebKit::DiagnosticLoggingClient&>(*diagnosticLoggingClient).delegate().autorelease(); > } > > - (void)_setDiagnosticLoggingDelegate:(id<_WKDiagnosticLoggingDelegate>)diagnosticLoggingDelegate >@@ -4761,7 +4707,7 @@ - (void)_setDiagnosticLoggingDelegate:(id<_WKDiagnosticLoggingDelegate>)diagnost > > - (id <_WKFindDelegate>)_findDelegate > { >- return [static_cast<WebKit::FindClient&>(_page->findClient()).delegate().leakRef() autorelease]; >+ return static_cast<WebKit::FindClient&>(_page->findClient()).delegate().autorelease(); > } > > - (void)_setFindDelegate:(id<_WKFindDelegate>)findDelegate >diff --git a/Source/WebKit/UIProcess/API/Cocoa/WKWebViewConfiguration.mm b/Source/WebKit/UIProcess/API/Cocoa/WKWebViewConfiguration.mm >index 8a8052d3f0e7332ca636be7edbbeea2e5e336444..bf187ffcb69fd62463266914ca5248edcf8c0e87 100644 >--- a/Source/WebKit/UIProcess/API/Cocoa/WKWebViewConfiguration.mm >+++ b/Source/WebKit/UIProcess/API/Cocoa/WKWebViewConfiguration.mm >@@ -849,9 +849,7 @@ - (void)_setControlledByAutomation:(BOOL)controlledByAutomation > > - (_WKApplicationManifest *)_applicationManifest > { >- if (auto* manifest = _pageConfiguration->applicationManifest()) >- return wrapper(*manifest); >- return nil; >+ return wrapper(_pageConfiguration->applicationManifest()); > } > > - (void)_setApplicationManifest:(_WKApplicationManifest *)applicationManifest >diff --git a/Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStore.mm b/Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStore.mm >index 8252322682ea9a806245cce58685cad942248f18..245e707e26c11b5b8516a55583687ba800dc39a8 100644 >--- a/Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStore.mm >+++ b/Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStore.mm >@@ -48,12 +48,12 @@ @implementation WKWebsiteDataStore > > + (WKWebsiteDataStore *)defaultDataStore > { >- return WebKit::wrapper(API::WebsiteDataStore::defaultDataStore().get()); >+ return wrapper(API::WebsiteDataStore::defaultDataStore()); > } > > + (WKWebsiteDataStore *)nonPersistentDataStore > { >- return [WebKit::wrapper(API::WebsiteDataStore::createNonPersistentDataStore().leakRef()) autorelease]; >+ return wrapper(API::WebsiteDataStore::createNonPersistentDataStore()); > } > > - (void)dealloc >@@ -112,7 +112,7 @@ + (NSSet *)allWebsiteDataTypes > > - (WKHTTPCookieStore *)httpCookieStore > { >- return WebKit::wrapper(_websiteDataStore->httpCookieStore()); >+ return wrapper(_websiteDataStore->httpCookieStore()); > } > > static WallTime toSystemClockTime(NSDate *date) >diff --git a/Source/WebKit/UIProcess/API/Cocoa/_WKApplicationManifest.mm b/Source/WebKit/UIProcess/API/Cocoa/_WKApplicationManifest.mm >index c753503183310d8b7b847aec1d40b4a0d4470fcd..3edd8531a098b04f2437d7de5b8540f3f60ecf72 100644 >--- a/Source/WebKit/UIProcess/API/Cocoa/_WKApplicationManifest.mm >+++ b/Source/WebKit/UIProcess/API/Cocoa/_WKApplicationManifest.mm >@@ -84,7 +84,7 @@ - (void)encodeWithCoder:(NSCoder *)aCoder > + (_WKApplicationManifest *)applicationManifestFromJSON:(NSString *)json manifestURL:(NSURL *)manifestURL documentURL:(NSURL *)documentURL > { > auto manifest = WebCore::ApplicationManifestParser::parse(WTF::String(json), WebCore::URL(manifestURL), WebCore::URL(documentURL)); >- return [API::wrapper(API::ApplicationManifest::create(manifest).leakRef()) autorelease]; >+ return wrapper(API::ApplicationManifest::create(manifest)); > } > > - (API::Object&)_apiObject >diff --git a/Source/WebKit/UIProcess/API/Cocoa/_WKGeolocationPosition.mm b/Source/WebKit/UIProcess/API/Cocoa/_WKGeolocationPosition.mm >index 6f819df147576efe595b897c0db2ddc3347f18d1..e8426024c8b15389968e1f93758a91fa5e34e1c7 100644 >--- a/Source/WebKit/UIProcess/API/Cocoa/_WKGeolocationPosition.mm >+++ b/Source/WebKit/UIProcess/API/Cocoa/_WKGeolocationPosition.mm >@@ -39,7 +39,7 @@ + (instancetype)positionWithLocation:(CLLocation *)location > if (!location) > return nil; > >- return [wrapper(WebGeolocationPosition::create(WebCore::GeolocationPosition { location }).leakRef()) autorelease]; >+ return wrapper(WebGeolocationPosition::create(WebCore::GeolocationPosition { location })); > } > > - (void)dealloc >diff --git a/Source/WebKit/UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm b/Source/WebKit/UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm >index 6f7767b1435b5742840daaaba32f8a2fcc962f42..f2fd5def8cb645e846b58eea560e1d6853d471c1 100644 >--- a/Source/WebKit/UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm >+++ b/Source/WebKit/UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm >@@ -347,7 +347,7 @@ - (NSString *)description > > - (id)copyWithZone:(NSZone *)zone > { >- return wrapper(_processPoolConfiguration->copy().leakRef()); >+ return [wrapper(_processPoolConfiguration->copy()) retain]; > } > > - (NSString *)customWebContentServiceBundleIdentifier >diff --git a/Source/WebKit/UIProcess/API/Cocoa/_WKUserContentWorld.mm b/Source/WebKit/UIProcess/API/Cocoa/_WKUserContentWorld.mm >index 4fd17f3532483aa504c8ff5eaaeb3bbba62a43aa..c0ed7f78178297aa38ba11726f5fe7c3afea1e0a 100644 >--- a/Source/WebKit/UIProcess/API/Cocoa/_WKUserContentWorld.mm >+++ b/Source/WebKit/UIProcess/API/Cocoa/_WKUserContentWorld.mm >@@ -32,7 +32,7 @@ @implementation _WKUserContentWorld > > + (_WKUserContentWorld *)worldWithName:(NSString *)name > { >- return [wrapper(API::UserContentWorld::worldWithName(name).leakRef()) autorelease]; >+ return wrapper(API::UserContentWorld::worldWithName(name)); > } > > + (_WKUserContentWorld *)normalWorld >diff --git a/Source/WebKit/UIProcess/API/Cocoa/_WKWebsitePolicies.mm b/Source/WebKit/UIProcess/API/Cocoa/_WKWebsitePolicies.mm >index 29b73809d398c39881037c66ef2b69c312e11b37..613554b1150a43d110f50fc86f659e64c7ba3217 100644 >--- a/Source/WebKit/UIProcess/API/Cocoa/_WKWebsitePolicies.mm >+++ b/Source/WebKit/UIProcess/API/Cocoa/_WKWebsitePolicies.mm >@@ -175,8 +175,7 @@ - (void)setCustomHeaderFields:(NSDictionary<NSString *, NSString *> *)fields > > - (WKWebsiteDataStore *)websiteDataStore > { >- auto* store = _websitePolicies->websiteDataStore(); >- return store ? WebKit::wrapper(*store) : nil; >+ return wrapper(_websitePolicies->websiteDataStore()); > } > > - (void)setWebsiteDataStore:(WKWebsiteDataStore *)websiteDataStore >diff --git a/Source/WebKit/UIProcess/Cocoa/NavigationState.mm b/Source/WebKit/UIProcess/Cocoa/NavigationState.mm >index 9b5385baa2889d6248ca7fa92d21031a67722267..8f60c3697b1a3dda4aff4fa3480107bb73b92323 100644 >--- a/Source/WebKit/UIProcess/Cocoa/NavigationState.mm >+++ b/Source/WebKit/UIProcess/Cocoa/NavigationState.mm >@@ -435,7 +435,7 @@ bool NavigationState::NavigationClient::didChangeBackForwardList(WebPageProxy&, > for (auto& removedItem : removed) > [removedItems addObject:wrapper(removedItem.get())]; > } >- [(id <WKNavigationDelegatePrivate>)navigationDelegate _webView:m_navigationState.m_webView backForwardListItemAdded:added ? wrapper(*added) : nil removed:removedItems]; >+ [(id <WKNavigationDelegatePrivate>)navigationDelegate _webView:m_navigationState.m_webView backForwardListItemAdded:wrapper(added) removed:removedItems]; > return true; > } > >@@ -493,8 +493,8 @@ void NavigationState::NavigationClient::decidePolicyForNavigationAction(WebPageP > return; > } > >- RetainPtr<NSURLRequest> nsURLRequest = adoptNS(wrapper(API::URLRequest::create(navigationAction->request()).leakRef())); >- if ([NSURLConnection canHandleRequest:nsURLRequest.get()] || webPage->urlSchemeHandlerForScheme([nsURLRequest URL].scheme)) { >+ NSURLRequest *nsURLRequest = wrapper(API::URLRequest::create(navigationAction->request())); >+ if ([NSURLConnection canHandleRequest:nsURLRequest] || webPage->urlSchemeHandlerForScheme([nsURLRequest URL].scheme)) { > if (navigationAction->shouldPerformDownload()) > listener->download(); > else >@@ -664,14 +664,11 @@ void NavigationState::NavigationClient::didStartProvisionalNavigation(WebPagePro > return; > > // FIXME: We should assert that navigation is not null here, but it's currently null for some navigations through the page cache. >- WKNavigation *wkNavigation = nil; >- if (navigation) >- wkNavigation = wrapper(*navigation); > > if (m_navigationState.m_navigationDelegateMethods.webViewDidStartProvisionalNavigationUserInfo) >- [(id <WKNavigationDelegatePrivate>)navigationDelegate _webView:m_navigationState.m_webView didStartProvisionalNavigation:wkNavigation userInfo:userInfo ? static_cast<id <NSSecureCoding>>(userInfo->wrapper()) : nil]; >+ [(id <WKNavigationDelegatePrivate>)navigationDelegate _webView:m_navigationState.m_webView didStartProvisionalNavigation:wrapper(navigation) userInfo:userInfo ? static_cast<id <NSSecureCoding>>(userInfo->wrapper()) : nil]; > else >- [navigationDelegate webView:m_navigationState.m_webView didStartProvisionalNavigation:wkNavigation]; >+ [navigationDelegate webView:m_navigationState.m_webView didStartProvisionalNavigation:wrapper(navigation)]; > } > > void NavigationState::NavigationClient::didReceiveServerRedirectForProvisionalNavigation(WebPageProxy& page, API::Navigation* navigation, API::Object*) >@@ -684,11 +681,8 @@ void NavigationState::NavigationClient::didReceiveServerRedirectForProvisionalNa > return; > > // FIXME: We should assert that navigation is not null here, but it's currently null for some navigations through the page cache. >- WKNavigation *wkNavigation = nil; >- if (navigation) >- wkNavigation = wrapper(*navigation); > >- [navigationDelegate webView:m_navigationState.m_webView didReceiveServerRedirectForProvisionalNavigation:wkNavigation]; >+ [navigationDelegate webView:m_navigationState.m_webView didReceiveServerRedirectForProvisionalNavigation:wrapper(navigation)]; > } > > void NavigationState::NavigationClient::willPerformClientRedirect(WebPageProxy& page, const WTF::String& urlString, double delay) >@@ -735,10 +729,7 @@ static RetainPtr<NSError> createErrorWithRecoveryAttempter(WKWebView *webView, W > void NavigationState::NavigationClient::didFailProvisionalNavigationWithError(WebPageProxy& page, WebFrameProxy& webFrameProxy, API::Navigation* navigation, const WebCore::ResourceError& error, API::Object*) > { > // FIXME: We should assert that navigation is not null here, but it's currently null for some navigations through the page cache. >- RetainPtr<WKNavigation> wkNavigation; >- if (navigation) >- wkNavigation = wrapper(*navigation); >- >+ > // FIXME: Set the error on the navigation object. > > if (!m_navigationState.m_navigationDelegateMethods.webViewDidFailProvisionalNavigationWithError) >@@ -749,16 +740,13 @@ void NavigationState::NavigationClient::didFailProvisionalNavigationWithError(We > return; > > auto errorWithRecoveryAttempter = createErrorWithRecoveryAttempter(m_navigationState.m_webView, webFrameProxy, error); >- [navigationDelegate webView:m_navigationState.m_webView didFailProvisionalNavigation:wkNavigation.get() withError:errorWithRecoveryAttempter.get()]; >+ [navigationDelegate webView:m_navigationState.m_webView didFailProvisionalNavigation:wrapper(navigation) withError:errorWithRecoveryAttempter.get()]; > } > > // FIXME: Shouldn't need to pass the WebFrameProxy in here. At most, a FrameHandle. >-void NavigationState::NavigationClient::didFailProvisionalLoadInSubframeWithError(WebPageProxy& page, WebFrameProxy& webFrameProxy, const SecurityOriginData& securityOrigin, API::Navigation* navigation, const WebCore::ResourceError& error, API::Object*) >+void NavigationState::NavigationClient::didFailProvisionalLoadInSubframeWithError(WebPageProxy& page, WebFrameProxy& webFrameProxy, const SecurityOriginData& securityOrigin, API::Navigation*, const WebCore::ResourceError& error, API::Object*) > { > // FIXME: We should assert that navigation is not null here, but it's currently null because WebPageProxy::didFailProvisionalLoadForFrame passes null. >- RetainPtr<WKNavigation> wkNavigation; >- if (navigation) >- wkNavigation = wrapper(*navigation); > > if (!m_navigationState.m_navigationDelegateMethods.webViewNavigationDidFailProvisionalLoadInSubframeWithError) > return; >@@ -779,11 +767,8 @@ void NavigationState::NavigationClient::didCommitNavigation(WebPageProxy& page, > return; > > // FIXME: We should assert that navigation is not null here, but it's currently null for some navigations through the page cache. >- WKNavigation *wkNavigation = nil; >- if (navigation) >- wkNavigation = wrapper(*navigation); > >- [navigationDelegate webView:m_navigationState.m_webView didCommitNavigation:wkNavigation]; >+ [navigationDelegate webView:m_navigationState.m_webView didCommitNavigation:wrapper(navigation)]; > } > > void NavigationState::NavigationClient::didFinishDocumentLoad(WebPageProxy& page, API::Navigation* navigation, API::Object*) >@@ -796,11 +781,8 @@ void NavigationState::NavigationClient::didFinishDocumentLoad(WebPageProxy& page > return; > > // FIXME: We should assert that navigation is not null here, but it's currently null for some navigations through the page cache. >- WKNavigation *wkNavigation = nil; >- if (navigation) >- wkNavigation = wrapper(*navigation); > >- [static_cast<id <WKNavigationDelegatePrivate>>(navigationDelegate.get()) _webView:m_navigationState.m_webView navigationDidFinishDocumentLoad:wkNavigation]; >+ [static_cast<id <WKNavigationDelegatePrivate>>(navigationDelegate.get()) _webView:m_navigationState.m_webView navigationDidFinishDocumentLoad:wrapper(navigation)]; > } > > void NavigationState::NavigationClient::didFinishNavigation(WebPageProxy& page, API::Navigation* navigation, API::Object*) >@@ -813,11 +795,8 @@ void NavigationState::NavigationClient::didFinishNavigation(WebPageProxy& page, > return; > > // FIXME: We should assert that navigation is not null here, but it's currently null for some navigations through the page cache. >- WKNavigation *wkNavigation = nil; >- if (navigation) >- wkNavigation = wrapper(*navigation); > >- [navigationDelegate webView:m_navigationState.m_webView didFinishNavigation:wkNavigation]; >+ [navigationDelegate webView:m_navigationState.m_webView didFinishNavigation:wrapper(navigation)]; > } > > // FIXME: Shouldn't need to pass the WebFrameProxy in here. At most, a FrameHandle. >@@ -832,15 +811,12 @@ void NavigationState::NavigationClient::didFailNavigationWithError(WebPageProxy& > return; > > // FIXME: We should assert that navigation is not null here, but it's currently null for some navigations through the page cache. >- WKNavigation *wkNavigation = nil; >- if (navigation) >- wkNavigation = wrapper(*navigation); > > auto errorWithRecoveryAttempter = createErrorWithRecoveryAttempter(m_navigationState.m_webView, webFrameProxy, error); > if (m_navigationState.m_navigationDelegateMethods.webViewDidFailNavigationWithErrorUserInfo) >- [(id <WKNavigationDelegatePrivate>)navigationDelegate _webView:m_navigationState.m_webView didFailNavigation:wkNavigation withError:errorWithRecoveryAttempter.get() userInfo:userInfo ? static_cast<id <NSSecureCoding>>(userInfo->wrapper()) : nil]; >+ [(id <WKNavigationDelegatePrivate>)navigationDelegate _webView:m_navigationState.m_webView didFailNavigation:wrapper(navigation) withError:errorWithRecoveryAttempter.get() userInfo:userInfo ? static_cast<id <NSSecureCoding>>(userInfo->wrapper()) : nil]; > else >- [navigationDelegate webView:m_navigationState.m_webView didFailNavigation:wkNavigation withError:errorWithRecoveryAttempter.get()]; >+ [navigationDelegate webView:m_navigationState.m_webView didFailNavigation:wrapper(navigation) withError:errorWithRecoveryAttempter.get()]; > } > > void NavigationState::NavigationClient::didSameDocumentNavigation(WebPageProxy&, API::Navigation* navigation, SameDocumentNavigationType navigationType, API::Object*) >@@ -853,11 +829,8 @@ void NavigationState::NavigationClient::didSameDocumentNavigation(WebPageProxy&, > return; > > // FIXME: We should assert that navigationID is not zero here, but it's currently zero for some navigations through the page cache. >- WKNavigation *wkNavigation = nil; >- if (navigation) >- wkNavigation = wrapper(*navigation); > >- [static_cast<id <WKNavigationDelegatePrivate>>(navigationDelegate.get()) _webView:m_navigationState.m_webView navigation:wkNavigation didSameDocumentNavigation:toWKSameDocumentNavigationType(navigationType)]; >+ [static_cast<id <WKNavigationDelegatePrivate>>(navigationDelegate.get()) _webView:m_navigationState.m_webView navigation:wrapper(navigation) didSameDocumentNavigation:toWKSameDocumentNavigationType(navigationType)]; > } > > void NavigationState::NavigationClient::renderingProgressDidChange(WebPageProxy&, WebCore::LayoutMilestones layoutMilestones) >diff --git a/Source/WebKit/UIProcess/Cocoa/SessionStateCoding.mm b/Source/WebKit/UIProcess/Cocoa/SessionStateCoding.mm >index 623ba460a208ab7d736127ceaa84414fca04503d..0459183da00f070312c585f256181b8ce495dc92 100644 >--- a/Source/WebKit/UIProcess/Cocoa/SessionStateCoding.mm >+++ b/Source/WebKit/UIProcess/Cocoa/SessionStateCoding.mm >@@ -34,7 +34,7 @@ namespace WebKit { > RetainPtr<NSData> encodeSessionState(const SessionState& sessionState) > { > #if WK_API_ENABLED >- return [wrapper(*WebKit::encodeLegacySessionState(sessionState).leakRef()) autorelease]; >+ return wrapper(WebKit::encodeLegacySessionState(sessionState)); > #else > return nullptr; > #endif >diff --git a/Source/WebKit/UIProcess/mac/WKInspectorViewController.mm b/Source/WebKit/UIProcess/mac/WKInspectorViewController.mm >index 945214d873620183d54a9c77e171eb59f24559e3..b7014129b2457025d2042a319cda597e7902f6c4 100644 >--- a/Source/WebKit/UIProcess/mac/WKInspectorViewController.mm >+++ b/Source/WebKit/UIProcess/mac/WKInspectorViewController.mm >@@ -129,7 +129,7 @@ - (WKWebViewConfiguration *)configuration > } > } > >- [configuration setProcessPool: ::WebKit::wrapper(inspectorProcessPool(inspectorLevelForPage(_inspectedPage)))]; >+ [configuration setProcessPool:wrapper(inspectorProcessPool(inspectorLevelForPage(_inspectedPage)))]; > [configuration _setGroupIdentifier:inspectorPageGroupIdentifierForPage(_inspectedPage)]; > > return configuration.autorelease(); >diff --git a/Source/WebKit/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInFrame.mm b/Source/WebKit/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInFrame.mm >index 9f483dbcbd5e5413e4e3f96ee23e0784cf5584fc..96adaa94098fa16eec49cf7dbaf48e8a671d1d46 100644 >--- a/Source/WebKit/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInFrame.mm >+++ b/Source/WebKit/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInFrame.mm >@@ -52,11 +52,7 @@ @implementation WKWebProcessPlugInFrame { > > + (instancetype)lookUpFrameFromHandle:(_WKFrameHandle *)handle > { >- WebFrame* webFrame = WebProcess::singleton().webFrame(handle._frameID); >- if (!webFrame) >- return nil; >- >- return wrapper(*webFrame); >+ return wrapper(WebProcess::singleton().webFrame(handle._frameID)); > } > > - (void)dealloc >@@ -72,8 +68,7 @@ - (JSContext *)jsContextForWorld:(WKWebProcessPlugInScriptWorld *)world > > - (WKWebProcessPlugInHitTestResult *)hitTest:(CGPoint)point > { >- auto hitTestResult = _frame->hitTest(WebCore::IntPoint(point)); >- return [wrapper(*hitTestResult.leakRef()) autorelease]; >+ return wrapper(_frame->hitTest(WebCore::IntPoint(point))); > } > > - (JSValue *)jsNodeForNodeHandle:(WKWebProcessPlugInNodeHandle *)nodeHandle inWorld:(WKWebProcessPlugInScriptWorld *)world >@@ -100,7 +95,7 @@ - (NSURL *)URL > > - (NSArray *)childFrames > { >- return [wrapper(_frame->childFrames().leakRef()) autorelease]; >+ return wrapper(_frame->childFrames()); > } > > - (BOOL)containsAnyFormElements >@@ -110,7 +105,7 @@ - (BOOL)containsAnyFormElements > > - (_WKFrameHandle *)handle > { >- return [wrapper(API::FrameHandle::create(_frame->frameID()).leakRef()) autorelease]; >+ return wrapper(API::FrameHandle::create(_frame->frameID())); > } > > static RetainPtr<NSArray> collectIcons(WebCore::Frame* frame, OptionSet<WebCore::LinkIconType> iconTypes) >@@ -139,8 +134,7 @@ - (NSArray *)faviconURLs > > - (WKWebProcessPlugInFrame *)_parentFrame > { >- WebFrame *parentFrame = _frame->parentFrame(); >- return parentFrame ? wrapper(*parentFrame) : nil; >+ return wrapper(_frame->parentFrame()); > } > > - (BOOL)_hasCustomContentProvider >diff --git a/Source/WebKit/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInHitTestResult.mm b/Source/WebKit/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInHitTestResult.mm >index 7ea86c911e4d642e5fc63256243d22a5c1da32f5..020947cfbd0b80d37c9af7c6346a80c2c7254cf8 100644 >--- a/Source/WebKit/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInHitTestResult.mm >+++ b/Source/WebKit/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInHitTestResult.mm >@@ -44,8 +44,7 @@ - (void)dealloc > > - (WKWebProcessPlugInNodeHandle *)nodeHandle > { >- auto nodeHandle = _hitTestResult->nodeHandle(); >- return nodeHandle ? [wrapper(*nodeHandle.leakRef()) autorelease] : nil; >+ return wrapper(_hitTestResult->nodeHandle()); > } > > #pragma mark WKObject protocol implementation >diff --git a/Source/WebKit/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandle.mm b/Source/WebKit/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandle.mm >index 19744c8e0b493bc14d2fd6583adf1e45de6bd0d1..91cd0c40e4cebc5cbb67e1a7f53abd00b54aa724 100644 >--- a/Source/WebKit/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandle.mm >+++ b/Source/WebKit/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandle.mm >@@ -49,21 +49,13 @@ - (void)dealloc > + (WKWebProcessPlugInNodeHandle *)nodeHandleWithJSValue:(JSValue *)value inContext:(JSContext *)context > { > JSContextRef contextRef = [context JSGlobalContextRef]; >- JSObjectRef objectRef = JSValueToObject(contextRef, [value JSValueRef], 0); >- auto nodeHandle = InjectedBundleNodeHandle::getOrCreate(contextRef, objectRef); >- if (!nodeHandle) >- return nil; >- >- return [wrapper(*nodeHandle.leakRef()) autorelease]; >+ JSObjectRef objectRef = JSValueToObject(contextRef, [value JSValueRef], nullptr); >+ return wrapper(InjectedBundleNodeHandle::getOrCreate(contextRef, objectRef)); > } > > - (WKWebProcessPlugInFrame *)htmlIFrameElementContentFrame > { >- auto frame = _nodeHandle->htmlIFrameElementContentFrame(); >- if (!frame) >- return nil; >- >- return [wrapper(*frame.leakRef()) autorelease]; >+ return wrapper(_nodeHandle->htmlIFrameElementContentFrame()); > } > > #if PLATFORM(IOS) >@@ -191,16 +183,12 @@ - (BOOL)isTextField > > - (WKWebProcessPlugInNodeHandle *)HTMLTableCellElementCellAbove > { >- auto nodeHandle = _nodeHandle->htmlTableCellElementCellAbove(); >- if (!nodeHandle) >- return nil; >- >- return [wrapper(*nodeHandle.leakRef()) autorelease]; >+ return wrapper(_nodeHandle->htmlTableCellElementCellAbove()); > } > > - (WKWebProcessPlugInFrame *)frame > { >- return [wrapper(*_nodeHandle->document()->documentFrame().leakRef()) autorelease]; >+ return wrapper(_nodeHandle->document()->documentFrame()); > } > > - (InjectedBundleNodeHandle&)_nodeHandle >diff --git a/Source/WebKit/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInRangeHandle.mm b/Source/WebKit/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInRangeHandle.mm >index 4fcb1a4468d31cc267a16b2015e2f210cdf01801..4a8dd34359523d739da1f79e49c46b65e2596c5d 100644 >--- a/Source/WebKit/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInRangeHandle.mm >+++ b/Source/WebKit/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInRangeHandle.mm >@@ -52,17 +52,13 @@ - (void)dealloc > + (WKWebProcessPlugInRangeHandle *)rangeHandleWithJSValue:(JSValue *)value inContext:(JSContext *)context > { > JSContextRef contextRef = [context JSGlobalContextRef]; >- JSObjectRef objectRef = JSValueToObject(contextRef, [value JSValueRef], 0); >- auto rangeHandle = InjectedBundleRangeHandle::getOrCreate(contextRef, objectRef); >- if (!rangeHandle) >- return nil; >- >- return [wrapper(*rangeHandle.leakRef()) autorelease]; >+ JSObjectRef objectRef = JSValueToObject(contextRef, [value JSValueRef], nullptr); >+ return wrapper(InjectedBundleRangeHandle::getOrCreate(contextRef, objectRef)); > } > > - (WKWebProcessPlugInFrame *)frame > { >- return [wrapper(*_rangeHandle->document()->documentFrame().leakRef()) autorelease]; >+ return wrapper(_rangeHandle->document()->documentFrame()); > } > > - (NSString *)text >diff --git a/Source/WebKit/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInScriptWorld.mm b/Source/WebKit/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInScriptWorld.mm >index 6eba0129d777494b7b0aa5888044921080e6737b..ae8d9061f4430b2afc98a0a75a3151c70629dd7d 100644 >--- a/Source/WebKit/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInScriptWorld.mm >+++ b/Source/WebKit/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInScriptWorld.mm >@@ -36,8 +36,7 @@ @implementation WKWebProcessPlugInScriptWorld { > > + (WKWebProcessPlugInScriptWorld *)world > { >- auto scriptWorld = InjectedBundleScriptWorld::create(); >- return [wrapper(scriptWorld.leakRef()) autorelease]; >+ return wrapper(InjectedBundleScriptWorld::create()); > } > > + (WKWebProcessPlugInScriptWorld *)normalWorld >diff --git a/Source/WebKit/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm b/Source/WebKit/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm >index 1935322f3640e4ed24b91b6e1d2a8261baeed2be..28dc0669df5dd20e0bc1e0667ece9f7e5394c492 100644 >--- a/Source/WebKit/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm >+++ b/Source/WebKit/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm >@@ -385,11 +385,7 @@ - (WKDOMRange *)selectedRange > > - (WKWebProcessPlugInFrame *)mainFrame > { >- WebFrame *webKitMainFrame = _page->mainWebFrame(); >- if (!webKitMainFrame) >- return nil; >- >- return wrapper(*webKitMainFrame); >+ return wrapper(_page->mainWebFrame()); > } > > - (WKWebProcessPlugInPageGroup *)pageGroup >@@ -420,11 +416,7 @@ - (WKBrowsingContextHandle *)handle > > + (instancetype)lookUpBrowsingContextFromHandle:(WKBrowsingContextHandle *)handle > { >- WebPage* webPage = WebProcess::singleton().webPage(handle.pageID); >- if (!webPage) >- return nil; >- >- return wrapper(*webPage); >+ return wrapper(WebProcess::singleton().webPage(handle.pageID)); > } > > - (_WKRemoteObjectRegistry *)_remoteObjectRegistry
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:
mitz:
review+
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 188735
:
347470
| 347473