Diff
Modified: trunk/Source/WebKit/ChangeLog (235021 => 235022)
--- trunk/Source/WebKit/ChangeLog 2018-08-20 00:24:47 UTC (rev 235021)
+++ trunk/Source/WebKit/ChangeLog 2018-08-20 00:53:34 UTC (rev 235022)
@@ -1,5 +1,195 @@
2018-08-19 Darin Adler <[email protected]>
+ [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 Dan Bernstein.
+
+ 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 a 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 balanced. 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 <[email protected]>
+
[Cocoa] Consolidate inline "wrapper" functions in WebKit API into function templates and WrapperTraits
https://bugs.webkit.org/show_bug.cgi?id=188733
Modified: trunk/Source/WebKit/UIProcess/API/C/mac/WKPagePrivateMac.mm (235021 => 235022)
--- trunk/Source/WebKit/UIProcess/API/C/mac/WKPagePrivateMac.mm 2018-08-20 00:24:47 UTC (rev 235021)
+++ trunk/Source/WebKit/UIProcess/API/C/mac/WKPagePrivateMac.mm 2018-08-20 00:53:34 UTC (rev 235022)
@@ -143,12 +143,7 @@
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
Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKBackForwardList.mm (235021 => 235022)
--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKBackForwardList.mm 2018-08-20 00:24:47 UTC (rev 235021)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKBackForwardList.mm 2018-08-20 00:53:34 UTC (rev 235022)
@@ -44,42 +44,34 @@
[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
Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKContentRuleListStore.mm (235021 => 235022)
--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKContentRuleListStore.mm 2018-08-20 00:24:47 UTC (rev 235021)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKContentRuleListStore.mm 2018-08-20 00:53:34 UTC (rev 235022)
@@ -63,14 +63,13 @@
+ (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 @@
// 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 @@
return completionHandler(nil, [NSError errorWithDomain:WKErrorDomain code:wkError userInfo:userInfo]);
}
- completionHandler(WebKit::wrapper(*contentRuleList.get()), nil);
+ completionHandler(wrapper(*contentRuleList), nil);
});
}
@@ -180,14 +179,13 @@
+ (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
Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKFrameInfo.mm (235021 => 235022)
--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKFrameInfo.mm 2018-08-20 00:24:47 UTC (rev 235021)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKFrameInfo.mm 2018-08-20 00:53:34 UTC (rev 235022)
@@ -86,7 +86,7 @@
- (_WKFrameHandle *)_handle
{
- return WebKit::wrapper(_frameInfo->handle());
+ return wrapper(_frameInfo->handle());
}
@end
Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKHTTPCookieStore.mm (235021 => 235022)
--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKHTTPCookieStore.mm 2018-08-20 00:24:47 UTC (rev 235021)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKHTTPCookieStore.mm 2018-08-20 00:53:34 UTC (rev 235022)
@@ -56,7 +56,7 @@
private:
void cookiesDidChange(API::HTTPCookieStore& cookieStore) final
{
- [m_observer.get() cookiesDidChangeInCookieStore:WebKit::wrapper(cookieStore)];
+ [m_observer cookiesDidChangeInCookieStore:wrapper(cookieStore)];
}
WeakObjCPtr<id<WKHTTPCookieStoreObserver>> m_observer;
Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKNavigationAction.mm (235021 => 235022)
--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKNavigationAction.mm 2018-08-20 00:24:47 UTC (rev 235021)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKNavigationAction.mm 2018-08-20 00:53:34 UTC (rev 235022)
@@ -137,16 +137,12 @@
- (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 @@
- (_WKUserInitiatedAction *)_userInitiatedAction
{
- auto userInitiatedAction = _navigationAction->userInitiatedAction();
- if (userInitiatedAction)
- return wrapper(*userInitiatedAction);
- return nil;
+ return wrapper(_navigationAction->userInitiatedAction());
}
- (BOOL)_isRedirect
@@ -239,10 +232,7 @@
- (WKNavigation *)_mainFrameNavigation
{
- if (auto* navigation = _navigationAction->mainFrameNavigation())
- return wrapper(*navigation);
-
- return nil;
+ return wrapper(_navigationAction->mainFrameNavigation());
}
@end
Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKOpenPanelParameters.mm (235021 => 235022)
--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKOpenPanelParameters.mm 2018-08-20 00:24:47 UTC (rev 235021)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKOpenPanelParameters.mm 2018-08-20 00:53:34 UTC (rev 235022)
@@ -55,12 +55,12 @@
- (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
Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKPreferences.mm (235021 => 235022)
--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKPreferences.mm 2018-08-20 00:24:47 UTC (rev 235021)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKPreferences.mm 2018-08-20 00:53:34 UTC (rev 235022)
@@ -97,7 +97,7 @@
- (id)copyWithZone:(NSZone *)zone
{
- return wrapper(_preferences->copy().leakRef());
+ return [wrapper(_preferences->copy()) retain];
}
- (CGFloat)minimumFontSize
@@ -530,7 +530,7 @@
+ (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
Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKProcessPool.mm (235021 => 235022)
--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKProcessPool.mm 2018-08-20 00:24:47 UTC (rev 235021)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKProcessPool.mm 2018-08-20 00:53:34 UTC (rev 235022)
@@ -126,7 +126,7 @@
- (_WKProcessPoolConfiguration *)_configuration
{
- return wrapper(_processPool->configuration().copy().leakRef());
+ return wrapper(_processPool->configuration().copy());
}
- (API::Object&)_apiObject
Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKURLSchemeTaskInternal.h (235021 => 235022)
--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKURLSchemeTaskInternal.h 2018-08-20 00:24:47 UTC (rev 235021)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKURLSchemeTaskInternal.h 2018-08-20 00:53:34 UTC (rev 235022)
@@ -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;
+};
}
Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKUserScript.mm (235021 => 235022)
--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKUserScript.mm 2018-08-20 00:24:47 UTC (rev 235021)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKUserScript.mm 2018-08-20 00:53:34 UTC (rev 235022)
@@ -102,7 +102,7 @@
- (_WKUserContentWorld *)_userContentWorld
{
- return API::wrapper(_userScript->userContentWorld());
+ return wrapper(_userScript->userContentWorld());
}
@end
Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm (235021 => 235022)
--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm 2018-08-20 00:24:47 UTC (rev 235021)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm 2018-08-20 00:53:34 UTC (rev 235022)
@@ -857,11 +857,7 @@
- (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 @@
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 *)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 @@
- (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 @@
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,9 +1213,9 @@
{
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
@@ -1254,7 +1222,7 @@
{
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 @@
- (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 @@
- (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 @@
- (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 @@
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 @@
- (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 @@
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 @@
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 @@
- (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
Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebViewConfiguration.mm (235021 => 235022)
--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebViewConfiguration.mm 2018-08-20 00:24:47 UTC (rev 235021)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebViewConfiguration.mm 2018-08-20 00:53:34 UTC (rev 235022)
@@ -849,9 +849,7 @@
- (_WKApplicationManifest *)_applicationManifest
{
- if (auto* manifest = _pageConfiguration->applicationManifest())
- return wrapper(*manifest);
- return nil;
+ return wrapper(_pageConfiguration->applicationManifest());
}
- (void)_setApplicationManifest:(_WKApplicationManifest *)applicationManifest
Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStore.mm (235021 => 235022)
--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStore.mm 2018-08-20 00:24:47 UTC (rev 235021)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStore.mm 2018-08-20 00:53:34 UTC (rev 235022)
@@ -48,12 +48,12 @@
+ (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 @@
- (WKHTTPCookieStore *)httpCookieStore
{
- return WebKit::wrapper(_websiteDataStore->httpCookieStore());
+ return wrapper(_websiteDataStore->httpCookieStore());
}
static WallTime toSystemClockTime(NSDate *date)
Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/_WKApplicationManifest.mm (235021 => 235022)
--- trunk/Source/WebKit/UIProcess/API/Cocoa/_WKApplicationManifest.mm 2018-08-20 00:24:47 UTC (rev 235021)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/_WKApplicationManifest.mm 2018-08-20 00:53:34 UTC (rev 235022)
@@ -84,7 +84,7 @@
+ (_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
Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/_WKGeolocationPosition.mm (235021 => 235022)
--- trunk/Source/WebKit/UIProcess/API/Cocoa/_WKGeolocationPosition.mm 2018-08-20 00:24:47 UTC (rev 235021)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/_WKGeolocationPosition.mm 2018-08-20 00:53:34 UTC (rev 235022)
@@ -39,7 +39,7 @@
if (!location)
return nil;
- return [wrapper(WebGeolocationPosition::create(WebCore::GeolocationPosition { location }).leakRef()) autorelease];
+ return wrapper(WebGeolocationPosition::create(WebCore::GeolocationPosition { location }));
}
- (void)dealloc
Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm (235021 => 235022)
--- trunk/Source/WebKit/UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm 2018-08-20 00:24:47 UTC (rev 235021)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm 2018-08-20 00:53:34 UTC (rev 235022)
@@ -347,7 +347,7 @@
- (id)copyWithZone:(NSZone *)zone
{
- return wrapper(_processPoolConfiguration->copy().leakRef());
+ return [wrapper(_processPoolConfiguration->copy()) retain];
}
- (NSString *)customWebContentServiceBundleIdentifier
Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/_WKUserContentWorld.mm (235021 => 235022)
--- trunk/Source/WebKit/UIProcess/API/Cocoa/_WKUserContentWorld.mm 2018-08-20 00:24:47 UTC (rev 235021)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/_WKUserContentWorld.mm 2018-08-20 00:53:34 UTC (rev 235022)
@@ -32,7 +32,7 @@
+ (_WKUserContentWorld *)worldWithName:(NSString *)name
{
- return [wrapper(API::UserContentWorld::worldWithName(name).leakRef()) autorelease];
+ return wrapper(API::UserContentWorld::worldWithName(name));
}
+ (_WKUserContentWorld *)normalWorld
Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/_WKWebsitePolicies.mm (235021 => 235022)
--- trunk/Source/WebKit/UIProcess/API/Cocoa/_WKWebsitePolicies.mm 2018-08-20 00:24:47 UTC (rev 235021)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/_WKWebsitePolicies.mm 2018-08-20 00:53:34 UTC (rev 235022)
@@ -175,8 +175,7 @@
- (WKWebsiteDataStore *)websiteDataStore
{
- auto* store = _websitePolicies->websiteDataStore();
- return store ? WebKit::wrapper(*store) : nil;
+ return wrapper(_websitePolicies->websiteDataStore());
}
- (void)setWebsiteDataStore:(WKWebsiteDataStore *)websiteDataStore
Modified: trunk/Source/WebKit/UIProcess/Cocoa/NavigationState.mm (235021 => 235022)
--- trunk/Source/WebKit/UIProcess/Cocoa/NavigationState.mm 2018-08-20 00:24:47 UTC (rev 235021)
+++ trunk/Source/WebKit/UIProcess/Cocoa/NavigationState.mm 2018-08-20 00:53:34 UTC (rev 235022)
@@ -435,7 +435,7 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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)
Modified: trunk/Source/WebKit/UIProcess/Cocoa/SessionStateCoding.mm (235021 => 235022)
--- trunk/Source/WebKit/UIProcess/Cocoa/SessionStateCoding.mm 2018-08-20 00:24:47 UTC (rev 235021)
+++ trunk/Source/WebKit/UIProcess/Cocoa/SessionStateCoding.mm 2018-08-20 00:53:34 UTC (rev 235022)
@@ -34,7 +34,7 @@
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
Modified: trunk/Source/WebKit/UIProcess/mac/WKInspectorViewController.mm (235021 => 235022)
--- trunk/Source/WebKit/UIProcess/mac/WKInspectorViewController.mm 2018-08-20 00:24:47 UTC (rev 235021)
+++ trunk/Source/WebKit/UIProcess/mac/WKInspectorViewController.mm 2018-08-20 00:53:34 UTC (rev 235022)
@@ -129,7 +129,7 @@
}
}
- [configuration setProcessPool: ::WebKit::wrapper(inspectorProcessPool(inspectorLevelForPage(_inspectedPage)))];
+ [configuration setProcessPool:wrapper(inspectorProcessPool(inspectorLevelForPage(_inspectedPage)))];
[configuration _setGroupIdentifier:inspectorPageGroupIdentifierForPage(_inspectedPage)];
return configuration.autorelease();
Modified: trunk/Source/WebKit/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInFrame.mm (235021 => 235022)
--- trunk/Source/WebKit/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInFrame.mm 2018-08-20 00:24:47 UTC (rev 235021)
+++ trunk/Source/WebKit/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInFrame.mm 2018-08-20 00:53:34 UTC (rev 235022)
@@ -52,11 +52,7 @@
+ (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 @@
- (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 @@
- (NSArray *)childFrames
{
- return [wrapper(_frame->childFrames().leakRef()) autorelease];
+ return wrapper(_frame->childFrames());
}
- (BOOL)containsAnyFormElements
@@ -110,7 +105,7 @@
- (_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 @@
- (WKWebProcessPlugInFrame *)_parentFrame
{
- WebFrame *parentFrame = _frame->parentFrame();
- return parentFrame ? wrapper(*parentFrame) : nil;
+ return wrapper(_frame->parentFrame());
}
- (BOOL)_hasCustomContentProvider
Modified: trunk/Source/WebKit/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInHitTestResult.mm (235021 => 235022)
--- trunk/Source/WebKit/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInHitTestResult.mm 2018-08-20 00:24:47 UTC (rev 235021)
+++ trunk/Source/WebKit/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInHitTestResult.mm 2018-08-20 00:53:34 UTC (rev 235022)
@@ -44,8 +44,7 @@
- (WKWebProcessPlugInNodeHandle *)nodeHandle
{
- auto nodeHandle = _hitTestResult->nodeHandle();
- return nodeHandle ? [wrapper(*nodeHandle.leakRef()) autorelease] : nil;
+ return wrapper(_hitTestResult->nodeHandle());
}
#pragma mark WKObject protocol implementation
Modified: trunk/Source/WebKit/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandle.mm (235021 => 235022)
--- trunk/Source/WebKit/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandle.mm 2018-08-20 00:24:47 UTC (rev 235021)
+++ trunk/Source/WebKit/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandle.mm 2018-08-20 00:53:34 UTC (rev 235022)
@@ -49,21 +49,13 @@
+ (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 @@
- (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
Modified: trunk/Source/WebKit/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInRangeHandle.mm (235021 => 235022)
--- trunk/Source/WebKit/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInRangeHandle.mm 2018-08-20 00:24:47 UTC (rev 235021)
+++ trunk/Source/WebKit/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInRangeHandle.mm 2018-08-20 00:53:34 UTC (rev 235022)
@@ -52,17 +52,13 @@
+ (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
Modified: trunk/Source/WebKit/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInScriptWorld.mm (235021 => 235022)
--- trunk/Source/WebKit/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInScriptWorld.mm 2018-08-20 00:24:47 UTC (rev 235021)
+++ trunk/Source/WebKit/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInScriptWorld.mm 2018-08-20 00:53:34 UTC (rev 235022)
@@ -36,8 +36,7 @@
+ (WKWebProcessPlugInScriptWorld *)world
{
- auto scriptWorld = InjectedBundleScriptWorld::create();
- return [wrapper(scriptWorld.leakRef()) autorelease];
+ return wrapper(InjectedBundleScriptWorld::create());
}
+ (WKWebProcessPlugInScriptWorld *)normalWorld
Modified: trunk/Source/WebKit/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm (235021 => 235022)
--- trunk/Source/WebKit/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm 2018-08-20 00:24:47 UTC (rev 235021)
+++ trunk/Source/WebKit/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm 2018-08-20 00:53:34 UTC (rev 235022)
@@ -385,11 +385,7 @@
- (WKWebProcessPlugInFrame *)mainFrame
{
- WebFrame *webKitMainFrame = _page->mainWebFrame();
- if (!webKitMainFrame)
- return nil;
-
- return wrapper(*webKitMainFrame);
+ return wrapper(_page->mainWebFrame());
}
- (WKWebProcessPlugInPageGroup *)pageGroup
@@ -420,11 +416,7 @@
+ (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