Don't launch network process in WebCookieManagerProxy::setHTTPCookieAcceptPolicy
[WebKit-https.git] / Source / WebKit / ChangeLog
1 2018-08-24  Sihui Liu  <sihui_liu@apple.com>
2
3         Don't launch network process in WebCookieManagerProxy::setHTTPCookieAcceptPolicy
4         https://bugs.webkit.org/show_bug.cgi?id=188906
5         <rdar://problem/43539661>
6
7         Reviewed by Geoffrey Garen.
8
9         In WebCookieManagerProxy::setHTTPCookieAcceptPolicy, we persist the cookieAcceptPolicy of 
10         sharedCookieStorage. When we launch the network process later, we pass the 
11         identifier of sharedCookieStorage to network process, so network process has the correct 
12         cookieAcceptPolicy. Therefore, we don't have to launch the network process and send the 
13         setting message if the network process is not launched.
14
15         * UIProcess/WebCookieManagerProxy.cpp:
16         (WebKit::WebCookieManagerProxy::setHTTPCookieAcceptPolicy):
17
18 2018-08-23  Carlos Garcia Campos  <cgarcia@igalia.com>
19
20         [GTK][WPE] Add API to inject/register user content in isolated worlds
21         https://bugs.webkit.org/show_bug.cgi?id=188883
22
23         Reviewed by Michael Catanzaro.
24
25         Add new API to create user scripts/stylesheets for a given script world and to register/unregister user script
26         messages in a given script world.
27
28         * UIProcess/API/glib/WebKitUserContent.cpp:
29         (webkitUserContentWorld):
30         (_WebKitUserStyleSheet::_WebKitUserStyleSheet):
31         (webkit_user_style_sheet_new):
32         (webkit_user_style_sheet_new_for_world):
33         (_WebKitUserScript::_WebKitUserScript):
34         (webkit_user_script_new):
35         (webkit_user_script_new_for_world):
36         * UIProcess/API/glib/WebKitUserContentManager.cpp:
37         (webkit_user_content_manager_register_script_message_handler_in_world):
38         (webkit_user_content_manager_unregister_script_message_handler_in_world):
39         * UIProcess/API/glib/WebKitUserContentPrivate.h:
40         * UIProcess/API/gtk/WebKitUserContent.h:
41         * UIProcess/API/gtk/WebKitUserContentManager.h:
42         * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt:
43         * UIProcess/API/wpe/WebKitUserContent.h:
44         * UIProcess/API/wpe/WebKitUserContentManager.h:
45         * WebProcess/UserContent/WebUserContentController.cpp:
46         (WebKit::WebUserContentController::addUserContentWorlds):
47
48 2018-08-23  Tim Horton  <timothy_horton@apple.com>
49
50         Use unified build for UIProcess
51         https://bugs.webkit.org/show_bug.cgi?id=185014
52
53         Reviewed by Alex Christensen.
54
55         * Sources.txt:
56         * SourcesCocoa.txt:
57         * UIProcess/API/APIWebsiteDataStore.h:
58         * UIProcess/API/Cocoa/WKWebView.mm:
59         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
60         (-[WKWebViewConfiguration urlSchemeHandlerForURLScheme:]):
61         * UIProcess/API/glib/IconDatabase.cpp:
62         * UIProcess/API/gtk/PageClientImpl.cpp:
63         * UIProcess/API/gtk/WebKitColorChooser.cpp:
64         * UIProcess/API/gtk/WebKitPopupMenu.cpp:
65         * UIProcess/API/gtk/WebKitRemoteInspectorProtocolHandler.cpp:
66         * UIProcess/ApplicationStateTracker.mm:
67         * UIProcess/Authentication/mac/WebCredentialMac.mm:
68         * UIProcess/Automation/cocoa/WebAutomationSessionCocoa.mm:
69         * UIProcess/Automation/ios/WebAutomationSessionIOS.mm:
70         * UIProcess/Automation/mac/WebAutomationSessionMac.mm:
71         * UIProcess/Cocoa/NavigationState.mm:
72         * UIProcess/Cocoa/PlaybackSessionManagerProxy.mm:
73         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp:
74         * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm:
75         * UIProcess/Cocoa/ViewGestureController.cpp:
76         * UIProcess/Cocoa/WKWebViewContentProviderRegistry.mm:
77         (-[WKWebViewContentProviderRegistry initWithConfiguration:]):
78         (-[WKWebViewContentProviderRegistry addPage:]):
79         (-[WKWebViewContentProviderRegistry removePage:]):
80         * UIProcess/Cocoa/WebPageProxyCocoa.mm:
81         * UIProcess/Cocoa/WebPasteboardProxyCocoa.mm:
82         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
83         * UIProcess/Cocoa/WebURLSchemeHandlerCocoa.mm:
84         * UIProcess/Cocoa/WebViewImpl.mm:
85         (-[WKTextTouchBarItemController itemForIdentifier:]):
86         (WebKit::WebViewImpl::performDragOperation):
87         * UIProcess/Downloads/DownloadProxy.cpp:
88         * UIProcess/DrawingAreaProxy.cpp:
89         * UIProcess/Gamepad/UIGamepad.cpp:
90         * UIProcess/Gamepad/UIGamepadProvider.cpp:
91         * UIProcess/Gamepad/cocoa/UIGamepadProviderCocoa.mm:
92         * UIProcess/HighPerformanceGraphicsUsageSampler.cpp:
93         * UIProcess/Network/NetworkProcessProxy.cpp:
94         * UIProcess/Notifications/WebNotificationManagerProxy.cpp:
95         * UIProcess/PerActivityStateCPUUsageSampler.cpp:
96         * UIProcess/Plugins/PluginInfoStore.cpp:
97         * UIProcess/Plugins/PluginProcessProxy.cpp:
98         * UIProcess/Plugins/mac/PluginInfoStoreMac.mm:
99         * UIProcess/Plugins/mac/PluginProcessProxyMac.mm:
100         * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm:
101         * UIProcess/RemoteLayerTree/RemoteLayerTreeHost.mm:
102         * UIProcess/RemoteLayerTree/RemoteLayerTreeScrollingPerformanceData.mm:
103         * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp:
104         * UIProcess/RemoteLayerTree/RemoteScrollingTree.cpp:
105         * UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm:
106         * UIProcess/RemoteLayerTree/ios/ScrollingTreeOverflowScrollingNodeIOS.mm:
107         * UIProcess/RemoteWebInspectorProxy.cpp:
108         * UIProcess/ResourceLoadStatisticsMemoryStore.cpp:
109         * UIProcess/ServiceWorkerProcessProxy.cpp:
110         * UIProcess/Storage/StorageProcessProxy.cpp:
111         * UIProcess/SuspendedPageProxy.cpp:
112         * UIProcess/TextCheckerCompletion.cpp:
113         * UIProcess/UIMessagePortChannelProvider.cpp:
114         * UIProcess/UserMediaPermissionCheckProxy.cpp:
115         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
116         * UIProcess/UserMediaPermissionRequestProxy.cpp:
117         * UIProcess/VisitedLinkStore.cpp:
118         * UIProcess/WKInspectorHighlightView.mm:
119         (findIntersectionOnLineBetweenPoints):
120         (quadIntersection):
121         (layerPathWithHole):
122         (layerPath):
123         (-[WKInspectorHighlightView _layoutForNodeHighlight:offset:]):
124         (-[WKInspectorHighlightView _layoutForNodeListHighlight:]):
125         (-[WKInspectorHighlightView _layoutForRectsHighlight:]):
126         (-[WKInspectorHighlightView update:]):
127         * UIProcess/WebBackForwardList.cpp:
128         * UIProcess/WebContextMenuListenerProxy.cpp:
129         * UIProcess/WebCookieManagerProxy.cpp:
130         * UIProcess/WebEditCommandProxy.cpp:
131         * UIProcess/WebFrameProxy.cpp:
132         * UIProcess/WebFullScreenManagerProxy.cpp:
133         * UIProcess/WebInspectorProxy.cpp:
134         * UIProcess/WebNavigationState.cpp:
135         * UIProcess/WebOpenPanelResultListenerProxy.cpp:
136         * UIProcess/WebPageInjectedBundleClient.cpp:
137         * UIProcess/WebPageProxy.cpp:
138         * UIProcess/WebProcessPool.cpp:
139         * UIProcess/WebProcessProxy.cpp:
140         * UIProcess/WebStorage/LocalStorageDatabaseTracker.cpp:
141         * UIProcess/WebURLSchemeHandler.cpp:
142         * UIProcess/WebURLSchemeTask.cpp:
143         * UIProcess/gtk/AcceleratedBackingStoreWayland.cpp:
144         * UIProcess/gtk/AcceleratedBackingStoreX11.cpp:
145         * UIProcess/ios/DragDropInteractionState.mm:
146         * UIProcess/ios/InputViewUpdateDeferrer.mm:
147         * UIProcess/ios/PageClientImplIOS.mm:
148         (-[WKEditCommandObjC initWithWebEditCommandProxy:]):
149         (-[WKEditCommandObjC command]):
150         * UIProcess/ios/SmartMagnificationController.mm:
151         * UIProcess/ios/TextCheckerIOS.mm:
152         * UIProcess/ios/ViewGestureControllerIOS.mm:
153         (WebKit::ViewGestureController::beginSwipeGesture):
154         (WebKit::ViewGestureController::removeSwipeSnapshot):
155         * UIProcess/ios/WKActionSheetAssistant.mm:
156         (presentationStyleForView):
157         * UIProcess/ios/WKApplicationStateTrackingView.mm:
158         (-[WKApplicationStateTrackingView initWithFrame:webView:]):
159         (-[WKApplicationStateTrackingView _applicationDidEnterBackground]):
160         (-[WKApplicationStateTrackingView _applicationDidFinishSnapshottingAfterEnteringBackground]):
161         (-[WKApplicationStateTrackingView _applicationWillEnterForeground]):
162         * UIProcess/ios/WKGeolocationProviderIOS.mm:
163         (-[WKGeolocationProviderIOS _startUpdating]):
164         (-[WKGeolocationProviderIOS _stopUpdating]):
165         (-[WKGeolocationProviderIOS _setEnableHighAccuracy:]):
166         (-[WKGeolocationProviderIOS init]):
167         (-[WKGeolocationProviderIOS initWithProcessPool:]):
168         (-[WKGeolocationProviderIOS decidePolicyForGeolocationRequestFromOrigin:frame:completionHandler:view:]):
169         (-[WKGeolocationProviderIOS geolocationAuthorizationGranted]):
170         (-[WKLegacyCoreLocationProvider positionChanged:]):
171         * UIProcess/ios/WKKeyboardScrollingAnimator.mm:
172         (-[WKKeyboardScrollingAnimator _scrollOffsetForEvent:]):
173         (-[WKKeyboardScrollingAnimator beginWithEvent:]):
174         (-[WKKeyboardScrollingAnimator handleKeyEvent:]):
175         (-[WKKeyboardScrollingAnimator startAnimatedScroll]):
176         (-[WKKeyboardScrollingAnimator stopAnimatedScroll]):
177         * UIProcess/ios/WKLegacyPDFView.mm:
178         * UIProcess/ios/WKPDFView.mm:
179         (-[WKPDFView web_setContentProviderData:suggestedFilename:]):
180         * UIProcess/ios/WKScrollView.mm:
181         (-[WKScrollView _systemContentInset]):
182         * UIProcess/ios/WKSystemPreviewView.mm:
183         * UIProcess/ios/WebPageProxyIOS.mm:
184         * UIProcess/mac/CorrectionPanel.mm:
185         (correctionIndicatorType):
186         * UIProcess/mac/PageClientImplMac.mm:
187         * UIProcess/mac/RemoteWebInspectorProxyMac.mm:
188         (-[WKRemoteWebInspectorProxyObjCAdapter initWithRemoteWebInspectorProxy:]):
189         * UIProcess/mac/TextCheckerMac.mm:
190         * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm:
191         * UIProcess/mac/ViewGestureControllerMac.mm:
192         * UIProcess/mac/ViewSnapshotStore.mm:
193         * UIProcess/mac/WKFullKeyboardAccessWatcher.mm:
194         (-[WKFullKeyboardAccessWatcher notifyAllProcessPools]):
195         * UIProcess/mac/WKFullScreenWindowController.mm:
196         (WebKit::WKFullScreenWindowControllerVideoFullscreenModelClient::setInterface):
197         (WebKit::WKFullScreenWindowControllerVideoFullscreenModelClient::interface const):
198         (-[WKFullScreenWindowController initWithWindow:webView:page:]):
199         (-[WKFullScreenWindowController enterFullScreen:]):
200         (-[WKFullScreenWindowController finishedEnterFullScreenAnimation:]):
201         (-[WKFullScreenWindowController finishedExitFullScreenAnimation:]):
202         (-[WKFullScreenWindowController windowDidEnterFullScreen:]):
203         (-[WKFullScreenWindowController windowDidExitFullScreen:]):
204         (-[WKFullScreenWindowController _manager]):
205         (-[WKFullScreenWindowController _replaceView:with:]):
206         (zoomAnimation):
207         (createMask):
208         (maskAnimation):
209         * UIProcess/mac/WKImmediateActionController.mm:
210         (-[WKImmediateActionController initWithPage:view:viewImpl:recognizer:]):
211         (-[WKImmediateActionController willDestroyView:]):
212         (-[WKImmediateActionController _clearImmediateActionState]):
213         (-[WKImmediateActionController didPerformImmediateActionHitTest:contentPreventsDefault:userData:]):
214         (-[WKImmediateActionController immediateActionRecognizerWillPrepare:]):
215         (-[WKImmediateActionController immediateActionRecognizerWillBeginAnimation:]):
216         (-[WKImmediateActionController _webHitTestResult]):
217         (-[WKImmediateActionController _defaultAnimationController]):
218         (-[WKImmediateActionController menuItem:maxSizeForPoint:]):
219         (-[WKImmediateActionController _animationControllerForDataDetectedText]):
220         (-[WKImmediateActionController _animationControllerForDataDetectedLink]):
221         (-[WKImmediateActionController _animationControllerForText]):
222         * UIProcess/mac/WKInspectorViewController.mm:
223         (-[WKInspectorViewController initWithInspectedPage:]):
224         (-[WKInspectorViewController webView]):
225         (-[WKInspectorViewController configuration]):
226         (-[WKInspectorViewController webView:runOpenPanelWithParameters:initiatedByFrame:completionHandler:]):
227         (-[WKInspectorViewController webView:decidePolicyForNavigationAction:decisionHandler:]):
228         (-[WKInspectorViewController inspectorWKWebViewReload:]):
229         * UIProcess/mac/WKPrintingView.mm:
230         (-[WKPrintingView _expectedPreviewCallbackForRect:]):
231         (pageDidDrawToImage):
232         (-[WKPrintingView _preparePDFDataForPrintingOnSecondaryThread]):
233         (pageDidComputePageRects):
234         (-[WKPrintingView _askPageToComputePageRects]):
235         (-[WKPrintingView _pageForRect:]):
236         (-[WKPrintingView _drawPDFDocument:page:atPoint:]):
237         (-[WKPrintingView _drawPreview:]):
238         (-[WKPrintingView drawRect:]):
239         (-[WKPrintingView rectForPage:]):
240         * UIProcess/mac/WKTextFinderClient.mm:
241         (-[WKTextFinderClient initWithPage:view:]):
242         (-[WKTextFinderClient findMatchesForString:relativeToMatch:findOptions:maxResults:resultCollector:]):
243         (-[WKTextFinderClient getSelectedText:]):
244         (arrayFromRects):
245         (-[WKTextFinderClient didFindStringMatchesWithRects:didWrapAround:]):
246         (-[WKTextFinderClient didGetImageForMatchResult:]):
247         * UIProcess/mac/WKTextInputWindowController.mm:
248         * UIProcess/mac/WKViewLayoutStrategy.mm:
249         (+[WKViewLayoutStrategy layoutStrategyWithPage:view:viewImpl:mode:]):
250         (-[WKViewLayoutStrategy initWithPage:view:viewImpl:mode:]):
251         (-[WKViewViewSizeLayoutStrategy initWithPage:view:viewImpl:mode:]):
252         (-[WKViewFixedSizeLayoutStrategy initWithPage:view:viewImpl:mode:]):
253         (-[WKViewDynamicSizeComputedFromViewScaleLayoutStrategy initWithPage:view:viewImpl:mode:]):
254         (-[WKViewDynamicSizeComputedFromMinimumDocumentSizeLayoutStrategy initWithPage:view:viewImpl:mode:]):
255         * UIProcess/mac/WebColorPickerMac.mm:
256         * UIProcess/mac/WebContextMenuProxyMac.mm:
257         (-[WKMenuTarget forwardContextMenuAction:]):
258         (WebKit::menuItemIdentifier):
259         (WebKit::WebContextMenuProxyMac::createContextMenuItem):
260         * UIProcess/mac/WebInspectorProxyMac.mm:
261         (-[WKWebInspectorProxyObjCAdapter initWithWebInspectorProxy:]):
262         * UIProcess/mac/WebPageProxyMac.mm:
263         * UIProcess/mac/WebPopupMenuProxyMac.mm:
264         * UIProcess/win/PageClientImpl.cpp:
265         * UIProcess/win/TextCheckerWin.cpp:
266         * UIProcess/win/WebContextMenuProxyWin.cpp:
267         * UIProcess/win/WebPopupMenuProxyWin.cpp:
268         * UIProcess/win/WebView.cpp:
269         * UIProcess/wpe/TextCheckerWPE.cpp:
270         * UIProcess/wpe/WebPasteboardProxyWPE.cpp:
271         * WebKit.xcodeproj/project.pbxproj:
272
273 2018-08-23  Sihui Liu  <sihui_liu@apple.com>
274
275         Move legacy directory configuration from WebProcessPool to API::WebsiteDataStore
276         https://bugs.webkit.org/show_bug.cgi?id=188765
277         <rdar://problem/43633183>
278
279         Reviewed by Geoffrey Garen.
280
281         Diretories are parameters of websiteDataStore instead of webProcessPool, so we should move
282         legacy default paths to API::WebsiteDataStore, which already stores default paths for 
283         non-legacy cases.
284
285         * UIProcess/API/APIProcessPoolConfiguration.cpp:
286         (API::ProcessPoolConfiguration::createWithLegacyOptions):
287         (API::ProcessPoolConfiguration::createWithWebsiteDataStoreConfiguration):
288         * UIProcess/API/APIWebsiteDataStore.cpp:
289         (API::WebsiteDataStore::legacyDefaultDataStoreConfiguration):
290         * UIProcess/API/APIWebsiteDataStore.h:
291         * UIProcess/API/Cocoa/APIWebsiteDataStoreCocoa.mm:
292         (API::WebsiteDataStore::legacyDefaultApplicationCacheDirectory):
293         (API::WebsiteDataStore::legacyDefaultNetworkCacheDirectory):
294         (API::WebsiteDataStore::legacyDefaultWebSQLDatabaseDirectory):
295         (API::WebsiteDataStore::legacyDefaultIndexedDBDatabaseDirectory):
296         (API::WebsiteDataStore::legacyDefaultLocalStorageDirectory):
297         (API::WebsiteDataStore::legacyDefaultMediaCacheDirectory):
298         (API::WebsiteDataStore::legacyDefaultMediaKeysStorageDirectory):
299         (API::WebsiteDataStore::legacyDefaultJavaScriptConfigurationDirectory):
300         * UIProcess/API/glib/APIWebsiteDataStoreGLib.cpp:
301         (API::WebsiteDataStore::legacyDefaultApplicationCacheDirectory):
302         (API::WebsiteDataStore::legacyDefaultNetworkCacheDirectory):
303         (API::WebsiteDataStore::legacyDefaultWebSQLDatabaseDirectory):
304         (API::WebsiteDataStore::legacyDefaultIndexedDBDatabaseDirectory):
305         (API::WebsiteDataStore::legacyDefaultLocalStorageDirectory):
306         (API::WebsiteDataStore::legacyDefaultMediaCacheDirectory):
307         (API::WebsiteDataStore::legacyDefaultMediaKeysStorageDirectory):
308         (API::WebsiteDataStore::legacyDefaultJavaScriptConfigurationDirectory):
309         * UIProcess/API/win/APIWebsiteDataStoreWin.cpp:
310         (API::WebsiteDataStore::legacyDefaultApplicationCacheDirectory):
311         (API::WebsiteDataStore::legacyDefaultNetworkCacheDirectory):
312         (API::WebsiteDataStore::legacyDefaultWebSQLDatabaseDirectory):
313         (API::WebsiteDataStore::legacyDefaultIndexedDBDatabaseDirectory):
314         (API::WebsiteDataStore::legacyDefaultLocalStorageDirectory):
315         (API::WebsiteDataStore::legacyDefaultMediaCacheDirectory):
316         (API::WebsiteDataStore::legacyDefaultMediaKeysStorageDirectory):
317         (API::WebsiteDataStore::legacyDefaultJavaScriptConfigurationDirectory):
318         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
319         (WebKit::WebProcessPool::legacyPlatformDefaultWebSQLDatabaseDirectory): Deleted.
320         (WebKit::WebProcessPool::legacyPlatformDefaultIndexedDBDatabaseDirectory): Deleted.
321         (WebKit::WebProcessPool::legacyPlatformDefaultLocalStorageDirectory): Deleted.
322         (WebKit::WebProcessPool::legacyPlatformDefaultMediaCacheDirectory): Deleted.
323         (WebKit::WebProcessPool::legacyPlatformDefaultMediaKeysStorageDirectory): Deleted.
324         (WebKit::WebProcessPool::legacyPlatformDefaultApplicationCacheDirectory): Deleted.
325         (WebKit::WebProcessPool::legacyPlatformDefaultNetworkCacheDirectory): Deleted.
326         (WebKit::WebProcessPool::legacyPlatformDefaultJavaScriptConfigurationDirectory): Deleted.
327         * UIProcess/WebProcessPool.h:
328         * UIProcess/gtk/WebProcessPoolGtk.cpp:
329         (WebKit::WebProcessPool::legacyPlatformDefaultApplicationCacheDirectory): Deleted.
330         (WebKit::WebProcessPool::legacyPlatformDefaultMediaCacheDirectory): Deleted.
331         (WebKit::WebProcessPool::legacyPlatformDefaultWebSQLDatabaseDirectory): Deleted.
332         (WebKit::WebProcessPool::legacyPlatformDefaultIndexedDBDatabaseDirectory): Deleted.
333         (WebKit::WebProcessPool::legacyPlatformDefaultLocalStorageDirectory): Deleted.
334         (WebKit::WebProcessPool::legacyPlatformDefaultMediaKeysStorageDirectory): Deleted.
335         (WebKit::WebProcessPool::legacyPlatformDefaultNetworkCacheDirectory): Deleted.
336         (WebKit::WebProcessPool::legacyPlatformDefaultJavaScriptConfigurationDirectory): Deleted.
337         * UIProcess/win/WebProcessPoolWin.cpp:
338         (WebKit::WebProcessPool::legacyPlatformDefaultApplicationCacheDirectory): Deleted.
339         (WebKit::WebProcessPool::legacyPlatformDefaultMediaCacheDirectory): Deleted.
340         (WebKit::WebProcessPool::legacyPlatformDefaultWebSQLDatabaseDirectory): Deleted.
341         (WebKit::WebProcessPool::legacyPlatformDefaultIndexedDBDatabaseDirectory): Deleted.
342         (WebKit::WebProcessPool::legacyPlatformDefaultLocalStorageDirectory): Deleted.
343         (WebKit::WebProcessPool::legacyPlatformDefaultMediaKeysStorageDirectory): Deleted.
344         (WebKit::WebProcessPool::legacyPlatformDefaultNetworkCacheDirectory): Deleted.
345         (WebKit::WebProcessPool::legacyPlatformDefaultJavaScriptConfigurationDirectory): Deleted.
346         * UIProcess/wpe/WebProcessPoolWPE.cpp:
347         (WebKit::WebProcessPool::legacyPlatformDefaultApplicationCacheDirectory): Deleted.
348         (WebKit::WebProcessPool::legacyPlatformDefaultMediaCacheDirectory): Deleted.
349         (WebKit::WebProcessPool::legacyPlatformDefaultWebSQLDatabaseDirectory): Deleted.
350         (WebKit::WebProcessPool::legacyPlatformDefaultIndexedDBDatabaseDirectory): Deleted.
351         (WebKit::WebProcessPool::legacyPlatformDefaultLocalStorageDirectory): Deleted.
352         (WebKit::WebProcessPool::legacyPlatformDefaultMediaKeysStorageDirectory): Deleted.
353         (WebKit::WebProcessPool::legacyPlatformDefaultNetworkCacheDirectory): Deleted.
354         (WebKit::WebProcessPool::legacyPlatformDefaultJavaScriptConfigurationDirectory): Deleted.
355
356 2018-08-23  Alex Christensen  <achristensen@webkit.org>
357
358         Add new _webViewRequestPointerLock SPI with a completionHandler
359         https://bugs.webkit.org/show_bug.cgi?id=188907
360         <rdar://problem/35871109>
361
362         Reviewed by Andy Estes.
363
364         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
365         * UIProcess/Cocoa/UIDelegate.h:
366         * UIProcess/Cocoa/UIDelegate.mm:
367         (WebKit::UIDelegate::setDelegate):
368         (WebKit::UIDelegate::UIClient::requestPointerLock):
369
370 2018-08-23  Andy Estes  <aestes@apple.com>
371
372         [Apple Pay] Introduce Apple Pay JS v4 on iOS 12 and macOS Mojave
373         https://bugs.webkit.org/show_bug.cgi?id=188829
374
375         Reviewed by Tim Horton.
376
377         * Configurations/FeatureDefines.xcconfig:
378         * WebProcess/ApplePay/WebPaymentCoordinator.cpp:
379         (WebKit::WebPaymentCoordinator::supportsVersion):
380
381 2018-08-23  Ryan Haddad  <ryanhaddad@apple.com>
382
383         Unreviewed, rolling out r234942.
384
385         Caused page loading issues in iTunes
386
387         Reverted changeset:
388
389         "Transition more WKWebViewConfiguration ivars to
390         API::PageConfiguration values"
391         https://bugs.webkit.org/show_bug.cgi?id=188663
392         https://trac.webkit.org/changeset/234942
393
394 2018-08-23  Aditya Keerthi  <akeerthi@apple.com>
395
396         [iOS] Support the inputmode attribute on contenteditable elements
397         https://bugs.webkit.org/show_bug.cgi?id=188878
398
399         Reviewed by Ryosuke Niwa.
400
401         Ensured that the assistedNodeInformation for a contenteditable element reflects
402         the value of the element's inputmode attribute.
403
404         Moved logic to obtain the InputMode from the attribute value into WebCore.
405
406         * Shared/AssistedNodeInformation.h:
407         * UIProcess/ios/WKContentViewInteraction.mm:
408         * WebProcess/WebPage/ios/WebPageIOS.mm:
409         (WebKit::WebPage::getAssistedNodeInformation):
410
411 2018-08-22  Ryosuke Niwa  <rniwa@webkit.org>
412
413         Assert in NetworkBlobRegistry::unregisterBlobURL after network process had terminated
414         https://bugs.webkit.org/show_bug.cgi?id=188880
415
416         Reviewed by Saam Barati.
417
418         Removed the debug assertion. WebContent process might be asking this network process
419         to unregister a blob registered from another network processs which had since crashed.
420
421         We could keep track of which blob had been registered with which network process
422         in WebContent process and avoid sending IPC to the network process but that's a lot of
423         house-keeping for virtually no benefit other than not hitting this assertion.
424
425         * NetworkProcess/FileAPI/NetworkBlobRegistry.cpp:
426         (WebKit::NetworkBlobRegistry::unregisterBlobURL):
427
428 2018-08-23  Sihui Liu  <sihui_liu@apple.com>
429
430         Remove keys of defaults that are no longer used in webProcessPool
431         https://bugs.webkit.org/show_bug.cgi?id=188855
432
433         Reviewed by Alex Christensen.
434
435         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
436         (WebKit::registerUserDefaultsIfNeeded):
437
438 2018-08-23  Dan Bernstein  <mitz@apple.com>
439
440         [Cocoa] First scroll gesture in pinned, non-rubber-banding WKWebView may fail to initiate back/forward swipe
441         https://bugs.webkit.org/show_bug.cgi?id=188894
442         <rdar://problem/43651434>
443
444         Reviewed by Tim Horton.
445
446         * WebProcess/WebPage/EventDispatcher.cpp:
447         (WebKit::EventDispatcher::wheelEvent): Set the rubber-band state on the ScrollingTree
448           synchronously rather than dispatching doing that to the scrolling thread. This is safe to
449           do because ScrollingTree synchrnoizes access to the rubber-band state with an internal
450           mutex.
451
452 2018-08-23  Youenn Fablet  <youenn@apple.com>
453
454         self.isSecureContext undefined in Service Worker
455         https://bugs.webkit.org/show_bug.cgi?id=188842
456
457         Reviewed by Alex Christensen.
458
459         Enable isSecureContext runtime flag.
460
461         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
462         (WebKit::WebSWContextManagerConnection::updatePreferencesStore):
463
464 2018-08-23  Commit Queue  <commit-queue@webkit.org>
465
466         Unreviewed, rolling out r235216.
467         https://bugs.webkit.org/show_bug.cgi?id=188887
468
469         Caused 50+ Layout Tests to Crash and 173 api Failures on Debug
470         builds (Requested by Truitt on #webkit).
471
472         Reverted changeset:
473
474         "Move legacy directory configuration from WebProcessPool to
475         API::WebsiteDataStore"
476         https://bugs.webkit.org/show_bug.cgi?id=188765
477         https://trac.webkit.org/changeset/235216
478
479 2018-08-23  Zan Dobersek  <zdobersek@igalia.com>
480
481         [CoordGraphics] Remove the remaining CoordinatedGraphicsLayerState cruft
482         https://bugs.webkit.org/show_bug.cgi?id=188881
483
484         Reviewed by Carlos Garcia Campos.
485
486         Rid CompositingCoordinator class of code that manages now-deleted state
487         tracking of layer creation, update and removal on the
488         CoordinatedGraphicsState class. The syncLayerState() method is changed
489         accordingly, now only enforcing a frame synchronization when called.
490
491         Use of Nicosia::PlatformLayer::LayerID is adopted since the
492         CoordinatedLayerID type has been removed.
493
494         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
495         (WebKit::CoordinatedGraphicsScene::purgeGLResources):
496         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.h:
497         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp:
498         (WebKit::CompositingCoordinator::flushPendingLayerChanges):
499         (WebKit::CompositingCoordinator::initializeRootCompositingLayerIfNeeded):
500         (WebKit::CompositingCoordinator::syncLayerState):
501         (WebKit::CompositingCoordinator::createGraphicsLayer):
502         (WebKit::CompositingCoordinator::detachLayer):
503         (WebKit::CompositingCoordinator::attachLayer):
504         (WebKit::CompositingCoordinator::clearPendingStateChanges): Deleted.
505         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.h:
506
507 2018-08-22  Antti Koivisto  <antti@apple.com>
508
509         NetworkCache::Storage::lastStableVersion should be a developer-only feature
510         https://bugs.webkit.org/show_bug.cgi?id=188843
511         <rdar://problem/43574100>
512
513         Reviewed by Geoffrey Garen.
514
515         * NetworkProcess/cache/NetworkCacheStorage.cpp:
516         (WebKit::NetworkCache::Storage::deleteOldVersions):
517
518         Delete old cache versions unconditionally if we are system WebKit.
519
520         * Shared/ChildProcess.h:
521         * Shared/mac/ChildProcessMac.mm:
522         (WebKit::ChildProcess::isSystemWebKit):
523
524         Find out if WebKit is installed under '/System/'.
525
526 2018-08-22  Zan Dobersek  <zdobersek@igalia.com>
527
528         [CoordGraphics] Remove CoordinatedImageBacking and related functionality
529         https://bugs.webkit.org/show_bug.cgi?id=188847
530
531         Reviewed by Michael Catanzaro.
532
533         Remove the CoordinatedImageBacking class and its intertwining use in the
534         CoordinatedGraphics system.
535
536         Drop the CoordinatedImageBacking object management from the
537         CompositingCoordinator class, along with the
538         CoordinatedImageBacking::Client inheritance. The corresponding image
539         backing state management on the CoordinatedGraphicsState class can be
540         removed accordingly.
541
542         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp:
543         (WebKit::CompositingCoordinator::flushPendingLayerChanges):
544         (WebKit::CompositingCoordinator::clearPendingStateChanges):
545         (WebKit::CompositingCoordinator::purgeBackingStores):
546         (WebKit::CompositingCoordinator::createImageBackingIfNeeded): Deleted.
547         (WebKit::CompositingCoordinator::createImageBacking): Deleted.
548         (WebKit::CompositingCoordinator::updateImageBacking): Deleted.
549         (WebKit::CompositingCoordinator::clearImageBackingContents): Deleted.
550         (WebKit::CompositingCoordinator::removeImageBacking): Deleted.
551         (WebKit::CompositingCoordinator::flushPendingImageBackingChanges): Deleted.
552         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.h:
553
554 2018-08-22  Sihui Liu  <sihui_liu@apple.com>
555
556         Move legacy directory configuration from WebProcessPool to API::WebsiteDataStore
557         https://bugs.webkit.org/show_bug.cgi?id=188765
558
559         Reviewed by Geoffrey Garen.
560
561         Diretories are parameters of websiteDataStore instead of webProcessPool, so we should move
562         legacy default paths to API::WebsiteDataStore, which already stores default paths for 
563         non-legacy cases.
564
565         * UIProcess/API/APIProcessPoolConfiguration.cpp:
566         (API::ProcessPoolConfiguration::createWithLegacyOptions):
567         (API::ProcessPoolConfiguration::createWithWebsiteDataStoreConfiguration):
568         * UIProcess/API/APIWebsiteDataStore.cpp:
569         (API::WebsiteDataStore::legacyDefaultDataStoreConfiguration):
570         * UIProcess/API/APIWebsiteDataStore.h:
571         * UIProcess/API/Cocoa/APIWebsiteDataStoreCocoa.mm:
572         (API::WebsiteDataStore::legacyDefaultApplicationCacheDirectory):
573         (API::WebsiteDataStore::legacyDefaultNetworkCacheDirectory):
574         (API::WebsiteDataStore::legacyDefaultWebSQLDatabaseDirectory):
575         (API::WebsiteDataStore::legacyDefaultIndexedDBDatabaseDirectory):
576         (API::WebsiteDataStore::legacyDefaultLocalStorageDirectory):
577         (API::WebsiteDataStore::legacyDefaultMediaCacheDirectory):
578         (API::WebsiteDataStore::legacyDefaultMediaKeysStorageDirectory):
579         (API::WebsiteDataStore::legacyDefaultJavaScriptConfigurationDirectory):
580         * UIProcess/API/glib/APIWebsiteDataStoreGLib.cpp:
581         (API::WebsiteDataStore::legacyDefaultApplicationCacheDirectory):
582         (API::WebsiteDataStore::legacyDefaultNetworkCacheDirectory):
583         (API::WebsiteDataStore::legacyDefaultWebSQLDatabaseDirectory):
584         (API::WebsiteDataStore::legacyDefaultIndexedDBDatabaseDirectory):
585         (API::WebsiteDataStore::legacyDefaultLocalStorageDirectory):
586         (API::WebsiteDataStore::legacyDefaultMediaCacheDirectory):
587         (API::WebsiteDataStore::legacyDefaultMediaKeysStorageDirectory):
588         (API::WebsiteDataStore::legacyDefaultJavaScriptConfigurationDirectory):
589         * UIProcess/API/win/APIWebsiteDataStoreWin.cpp:
590         (API::WebsiteDataStore::legacyDefaultApplicationCacheDirectory):
591         (API::WebsiteDataStore::legacyDefaultNetworkCacheDirectory):
592         (API::WebsiteDataStore::legacyDefaultWebSQLDatabaseDirectory):
593         (API::WebsiteDataStore::legacyDefaultIndexedDBDatabaseDirectory):
594         (API::WebsiteDataStore::legacyDefaultLocalStorageDirectory):
595         (API::WebsiteDataStore::legacyDefaultMediaCacheDirectory):
596         (API::WebsiteDataStore::legacyDefaultMediaKeysStorageDirectory):
597         (API::WebsiteDataStore::legacyDefaultJavaScriptConfigurationDirectory):
598         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
599         (WebKit::WebProcessPool::legacyPlatformDefaultWebSQLDatabaseDirectory): Deleted.
600         (WebKit::WebProcessPool::legacyPlatformDefaultIndexedDBDatabaseDirectory): Deleted.
601         (WebKit::WebProcessPool::legacyPlatformDefaultLocalStorageDirectory): Deleted.
602         (WebKit::WebProcessPool::legacyPlatformDefaultMediaCacheDirectory): Deleted.
603         (WebKit::WebProcessPool::legacyPlatformDefaultMediaKeysStorageDirectory): Deleted.
604         (WebKit::WebProcessPool::legacyPlatformDefaultApplicationCacheDirectory): Deleted.
605         (WebKit::WebProcessPool::legacyPlatformDefaultNetworkCacheDirectory): Deleted.
606         (WebKit::WebProcessPool::legacyPlatformDefaultJavaScriptConfigurationDirectory): Deleted.
607         * UIProcess/WebProcessPool.h:
608         * UIProcess/gtk/WebProcessPoolGtk.cpp:
609         (WebKit::WebProcessPool::legacyPlatformDefaultApplicationCacheDirectory): Deleted.
610         (WebKit::WebProcessPool::legacyPlatformDefaultMediaCacheDirectory): Deleted.
611         (WebKit::WebProcessPool::legacyPlatformDefaultWebSQLDatabaseDirectory): Deleted.
612         (WebKit::WebProcessPool::legacyPlatformDefaultIndexedDBDatabaseDirectory): Deleted.
613         (WebKit::WebProcessPool::legacyPlatformDefaultLocalStorageDirectory): Deleted.
614         (WebKit::WebProcessPool::legacyPlatformDefaultMediaKeysStorageDirectory): Deleted.
615         (WebKit::WebProcessPool::legacyPlatformDefaultNetworkCacheDirectory): Deleted.
616         (WebKit::WebProcessPool::legacyPlatformDefaultJavaScriptConfigurationDirectory): Deleted.
617         * UIProcess/win/WebProcessPoolWin.cpp:
618         (WebKit::WebProcessPool::legacyPlatformDefaultApplicationCacheDirectory): Deleted.
619         (WebKit::WebProcessPool::legacyPlatformDefaultMediaCacheDirectory): Deleted.
620         (WebKit::WebProcessPool::legacyPlatformDefaultWebSQLDatabaseDirectory): Deleted.
621         (WebKit::WebProcessPool::legacyPlatformDefaultIndexedDBDatabaseDirectory): Deleted.
622         (WebKit::WebProcessPool::legacyPlatformDefaultLocalStorageDirectory): Deleted.
623         (WebKit::WebProcessPool::legacyPlatformDefaultMediaKeysStorageDirectory): Deleted.
624         (WebKit::WebProcessPool::legacyPlatformDefaultNetworkCacheDirectory): Deleted.
625         (WebKit::WebProcessPool::legacyPlatformDefaultJavaScriptConfigurationDirectory): Deleted.
626         * UIProcess/wpe/WebProcessPoolWPE.cpp:
627         (WebKit::WebProcessPool::legacyPlatformDefaultApplicationCacheDirectory): Deleted.
628         (WebKit::WebProcessPool::legacyPlatformDefaultMediaCacheDirectory): Deleted.
629         (WebKit::WebProcessPool::legacyPlatformDefaultWebSQLDatabaseDirectory): Deleted.
630         (WebKit::WebProcessPool::legacyPlatformDefaultIndexedDBDatabaseDirectory): Deleted.
631         (WebKit::WebProcessPool::legacyPlatformDefaultLocalStorageDirectory): Deleted.
632         (WebKit::WebProcessPool::legacyPlatformDefaultMediaKeysStorageDirectory): Deleted.
633         (WebKit::WebProcessPool::legacyPlatformDefaultNetworkCacheDirectory): Deleted.
634         (WebKit::WebProcessPool::legacyPlatformDefaultJavaScriptConfigurationDirectory): Deleted.
635
636 2018-08-22  John Wilander  <wilander@apple.com>
637
638         The Storage Access API prompt should show the eTLD+1s, not the full host names
639         https://bugs.webkit.org/show_bug.cgi?id=188830
640         <rdar://problem/43380645>
641
642         Reviewed by Brent Fulgham.
643
644         * UIProcess/WebPageProxy.cpp:
645         (WebKit::WebPageProxy::requestStorageAccess):
646
647 2018-08-22  Tim Horton  <timothy_horton@apple.com>
648
649         De-unify WebPage
650         https://bugs.webkit.org/show_bug.cgi?id=188865
651
652         Reviewed by Wenson Hsieh.
653
654         * Sources.txt:
655         * WebKit.xcodeproj/project.pbxproj:
656         WebPage being unified is causing mysterious build issues inside Carbon headers
657         on High Sierra only. Also, WebPage by itself takes longer to build than
658         most full unified source files, so it might not make sense to unify it
659         with others (to maximize parallelism).
660
661 2018-08-22  David Fenton  <david_fenton@apple.com>
662
663         Unreviewed, rolling out r235204.
664
665         reverting previous rollout
666
667         Reverted changeset:
668
669         "Unreviewed, rolling out r235176."
670         https://bugs.webkit.org/show_bug.cgi?id=185015
671         https://trac.webkit.org/changeset/235204
672
673 2018-08-22  David Fenton  <david_fenton@apple.com>
674
675         Unreviewed, rolling out r235176.
676
677         broke internal builds
678
679         Reverted changeset:
680
681         "Use unified build for WebProcess"
682         https://bugs.webkit.org/show_bug.cgi?id=185015
683         https://trac.webkit.org/changeset/235176
684
685 2018-08-22  Wenson Hsieh  <wenson_hsieh@apple.com>
686
687         [Attachment Support] Support dragging attachment elements out as files on macOS
688         https://bugs.webkit.org/show_bug.cgi?id=181294
689         <rdar://problem/36298801>
690
691         Reviewed by Tim Horton.
692
693         Add support for dragging attachment elements on macOS by writing promised files to drag pasteboard. See changes
694         below for more details.
695
696         * UIProcess/API/Cocoa/WKWebView.mm:
697         (-[WKWebView filePromiseProvider:fileNameForType:]):
698         (-[WKWebView filePromiseProvider:writePromiseToURL:completionHandler:]):
699         (-[WKWebView draggingSession:sourceOperationMaskForDraggingContext:]):
700         (-[WKWebView draggingSession:endedAtPoint:operation:]):
701         * UIProcess/API/mac/WKView.mm:
702         (-[WKView filePromiseProvider:fileNameForType:]):
703         (-[WKView filePromiseProvider:writePromiseToURL:completionHandler:]):
704         (-[WKView draggingSession:sourceOperationMaskForDraggingContext:]):
705         (-[WKView draggingSession:endedAtPoint:operation:]):
706
707         Plumb NSFilePromiseProviderDelegate and NSDraggingSource method implementations to WebViewImpl.
708
709         * UIProcess/Cocoa/WebViewImpl.h:
710         * UIProcess/Cocoa/WebViewImpl.mm:
711         (-[WKPromisedAttachmentContext initWithAttachmentInfo:]):
712         (-[WKPromisedAttachmentContext blobURL]):
713         (-[WKPromisedAttachmentContext filename]):
714         (-[WKPromisedAttachmentContext attachmentIdentifier]):
715
716         Add an object that contains the information needed to deliver a dragged attachment element's data via
717         NSFilePromiseProvider. This is stored as the userInfo of the NSFilePromiseProvider created upon drag start.
718
719         (WebKit::WebViewImpl::draggedImage):
720         (WebKit::WebViewImpl::sendDragEndToPage):
721
722         Add a helper method to handle cleanup after the dragging has finished, and call it from -draggedImage:… and
723         -draggingSessionEnded:…. The latter is only triggered in the where -beginDraggingSessionWithItems:… is used,
724         which currently only happens when dragging attachment elements.
725
726         (WebKit::WebViewImpl::fileNameForFilePromiseProvider):
727         (WebKit::webKitUnknownError):
728         (WebKit::WebViewImpl::writeToURLForFilePromiseProvider):
729
730         Deliver either NSFileWrapper data to the destination URL (in the case where an attachment identifier is known
731         and the corresponding API::Attachment is backed by a file wrapper), or save the contents of the blob URL to the
732         destination.
733
734         (WebKit::WebViewImpl::dragSourceOperationMask):
735         (WebKit::WebViewImpl::draggingSessionEnded):
736         (WebKit::WebViewImpl::startDrag):
737
738 2018-08-22  Aditya Keerthi  <akeerthi@apple.com>
739
740         [iOS] Add support for the inputmode attribute
741         https://bugs.webkit.org/show_bug.cgi?id=183621
742
743         Reviewed by Tim Horton.
744
745         The inputmode attribute specifies which input mechanism would be most helpful for
746         users entering content in textfield inputs and textareas. This patch adds support
747         for seven values: text, tel, url, email, numeric, decimal and search.
748
749         On iOS, we can specify UIKeyboardTypes that best match the supplied inputmode.
750         - text: UIKeyboardTypeDefault
751         - tel: UIKeyboardTypePhonePad
752         - url: UIKeyboardTypeURL
753         - email: UIKeyboardTypeEmailAddress
754         - numeric: UIKeyboardTypeNumbersAndPunctuation
755         - decimal: UIKeyboardTypeDecimalPad
756         - search: UIKeyboardTypeWebSearch
757
758         In the case that the inputmode attribute is not specified, we fall back to using
759         our existing heuristic to determine what kind of keyboard to show for textfields.
760
761         * Shared/AssistedNodeInformation.cpp:
762         (WebKit::AssistedNodeInformation::encode const):
763         (WebKit::AssistedNodeInformation::decode):
764         * Shared/AssistedNodeInformation.h: Added inputMode field.
765         * UIProcess/ios/WKContentViewInteraction.mm:
766         (-[WKContentView textInputTraits]):
767         * WebProcess/WebPage/ios/WebPageIOS.mm:
768         (WebKit::inputModeForElement):
769         (WebKit::WebPage::getAssistedNodeInformation):
770
771 2018-08-22  Jeff Miller  <jeffm@apple.com>
772
773         WKNavigationDelegate needs to allow clients to specify a custom blocked plug-in message
774         https://bugs.webkit.org/show_bug.cgi?id=188764
775
776         Reviewed by Alex Christensen.
777
778         Add a new private WKNavigationDelegate method that takes a completion handler so clients can return
779         a custom unavailability description in addition to the policy. Change WebPageProxy::findPlugin() to
780         send a delayed reply and API::LoaderClient::pluginLoadPolicy()/API::NavigationClient::decidePolicyForPluginLoad()
781         to take a completion handler to support this.
782     
783         * UIProcess/API/APILoaderClient.h:
784         (API::LoaderClient::pluginLoadPolicy):
785         Changed to take a completion handler. The default implementation doesn't return a custom
786         unavailability description.
787
788         * UIProcess/API/APINavigationClient.h:
789         (API::NavigationClient::decidePolicyForPluginLoad):
790         Ditto.
791
792         * UIProcess/API/C/WKPage.cpp:
793         (WKPageSetPageLoaderClient):
794         Changed pluginLoadPolicy() to take a completion handler.
795
796         (WKPageSetPageNavigationClient):
797         Changed decidePolicyForPluginLoad() to take a completion handler.
798
799         * UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h:
800         Add alternate version of -decidePolicyForPluginLoadWithCurrentPolicy: that allows clients to return
801         the unavailibility description.
802     
803         * UIProcess/Cocoa/NavigationState.h:
804         Add flag for new delegate method.
805         Changed decidePolicyForPluginLoad() to take a completion handler.
806     
807         * UIProcess/Cocoa/NavigationState.mm:
808         (WebKit::NavigationState::setNavigationDelegate):
809         Calculate flag for new delegate method.
810     
811         (WebKit::NavigationState::NavigationClient::decidePolicyForPluginLoad):
812         Changed to take a completion handler.
813         Prefer new delegate method, if available.
814     
815         * UIProcess/WebPageProxy.cpp:
816         (WebKit::WebPageProxy::findPlugin):
817         Changed to send a delayed reply.
818         Refactored some code into a lambda so it can be shared when using m_navigationClient->decidePolicyForPluginLoad().
819         Removed unneeded UNUSED_PARAM() macros.
820     
821         * UIProcess/WebPageProxy.h:
822         Changed findPlugin() to send a delayed reply.
823     
824         * UIProcess/WebPageProxy.messages.in:
825         Ditto.
826
827 2018-08-22  Sihui Liu  <sihui_liu@apple.com>
828
829         Try removing defaultSessionParameters from NetworkProcessCreationParameters
830         https://bugs.webkit.org/show_bug.cgi?id=188831
831
832         Reviewed by Alex Christensen.
833
834         * NetworkProcess/NetworkProcess.cpp:
835         (WebKit::NetworkProcess::initializeNetworkProcess):
836         * NetworkProcess/NetworkProcessCreationParameters.cpp:
837         (WebKit::NetworkProcessCreationParameters::encode const):
838         (WebKit::NetworkProcessCreationParameters::decode):
839         * NetworkProcess/NetworkProcessCreationParameters.h:
840         * UIProcess/WebProcessPool.cpp:
841         (WebKit::WebProcessPool::ensureNetworkProcess):
842
843 2018-08-22  Tim Horton  <timothy_horton@apple.com>
844
845         Use unified build for WebProcess
846         https://bugs.webkit.org/show_bug.cgi?id=185015
847
848         Reviewed by Alex Christensen.
849
850         * Sources.txt:
851         * SourcesCocoa.txt:
852         * UIProcess/WebPageProxy.h:
853         * WebKit.xcodeproj/project.pbxproj:
854         * WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.cpp:
855         * WebProcess/Databases/WebDatabaseProvider.cpp:
856         * WebProcess/EntryPoint/mac/XPCService/WebContentServiceEntryPoint.mm:
857         * WebProcess/FileAPI/BlobRegistryProxy.cpp:
858         * WebProcess/FullScreen/WebFullScreenManager.cpp:
859         * WebProcess/Gamepad/WebGamepadProvider.cpp:
860         * WebProcess/Geolocation/GeolocationPermissionRequestManager.cpp:
861         * WebProcess/Geolocation/WebGeolocationManager.cpp:
862         * WebProcess/InjectedBundle/API/c/mac/WKBundlePageBannerMac.mm:
863         * WebProcess/InjectedBundle/API/gtk/DOM/GObjectEventListener.cpp:
864         * WebProcess/InjectedBundle/DOM/InjectedBundleCSSStyleDeclarationHandle.cpp:
865         * WebProcess/InjectedBundle/DOM/InjectedBundleFileHandle.cpp:
866         * WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp:
867         * WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.cpp:
868         * WebProcess/InjectedBundle/InjectedBundle.cpp:
869         * WebProcess/InjectedBundle/InjectedBundleBackForwardList.cpp:
870         * WebProcess/InjectedBundle/InjectedBundleBackForwardListItem.cpp:
871         * WebProcess/InjectedBundle/InjectedBundleDOMWindowExtension.cpp:
872         * WebProcess/InjectedBundle/InjectedBundleHitTestResult.cpp:
873         * WebProcess/InjectedBundle/InjectedBundleNavigationAction.cpp:
874         * WebProcess/InjectedBundle/InjectedBundlePageContextMenuClient.cpp:
875         * WebProcess/InjectedBundle/InjectedBundlePageEditorClient.cpp:
876         * WebProcess/InjectedBundle/InjectedBundlePageFormClient.cpp:
877         * WebProcess/InjectedBundle/InjectedBundlePageFullScreenClient.cpp:
878         * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp:
879         * WebProcess/InjectedBundle/InjectedBundlePagePolicyClient.cpp:
880         * WebProcess/InjectedBundle/InjectedBundlePageResourceLoadClient.cpp:
881         * WebProcess/InjectedBundle/InjectedBundlePageUIClient.cpp:
882         * WebProcess/InjectedBundle/InjectedBundleScriptWorld.cpp:
883         * WebProcess/InjectedBundle/mac/InjectedBundleMac.mm:
884         * WebProcess/MediaStream/UserMediaPermissionRequestManager.cpp:
885         * WebProcess/Network/NetworkProcessConnection.cpp:
886         * WebProcess/Network/WebLoaderStrategy.cpp:
887         * WebProcess/Network/WebResourceLoader.cpp:
888         * WebProcess/Network/WebSocketProvider.cpp:
889         * WebProcess/Network/WebSocketStream.cpp:
890         * WebProcess/Network/webrtc/LibWebRTCProvider.cpp:
891         * WebProcess/Network/webrtc/LibWebRTCResolver.cpp:
892         * WebProcess/Network/webrtc/LibWebRTCResolver.h:
893         * WebProcess/Network/webrtc/LibWebRTCSocket.cpp:
894         * WebProcess/Network/webrtc/LibWebRTCSocket.h:
895         * WebProcess/Network/webrtc/WebMDNSRegister.cpp:
896         * WebProcess/Network/webrtc/WebRTCMonitor.cpp:
897         * WebProcess/Network/webrtc/WebRTCMonitor.h:
898         * WebProcess/Notifications/NotificationPermissionRequestManager.cpp:
899         * WebProcess/Notifications/WebNotificationManager.cpp:
900         * WebProcess/Plugins/Netscape/JSNPMethod.cpp:
901         * WebProcess/Plugins/Netscape/JSNPObject.cpp:
902         * WebProcess/Plugins/Netscape/NPJSObject.cpp:
903         * WebProcess/Plugins/Netscape/NPRuntimeObjectMap.cpp:
904         * WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp:
905         * WebProcess/Plugins/Netscape/NetscapePlugin.cpp:
906         * WebProcess/Plugins/Netscape/NetscapePluginNone.cpp:
907         * WebProcess/Plugins/Netscape/NetscapePluginStream.cpp:
908         * WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm:
909         * WebProcess/Plugins/PDF/PDFPlugin.mm:
910         * WebProcess/Plugins/PDF/PDFPluginAnnotation.mm:
911         * WebProcess/Plugins/PDF/PDFPluginChoiceAnnotation.mm:
912         * WebProcess/Plugins/PDF/PDFPluginPasswordField.mm:
913         * WebProcess/Plugins/PDF/PDFPluginTextAnnotation.mm:
914         * WebProcess/Plugins/Plugin.cpp:
915         * WebProcess/Plugins/PluginProcessConnection.cpp:
916         * WebProcess/Plugins/PluginProxy.cpp:
917         * WebProcess/Plugins/PluginView.cpp:
918         * WebProcess/Plugins/WebPluginInfoProvider.cpp:
919         * WebProcess/Storage/ServiceWorkerClientFetch.cpp:
920         * WebProcess/Storage/WebSWClientConnection.cpp:
921         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
922         * WebProcess/Storage/WebSWOriginTable.cpp:
923         * WebProcess/Storage/WebServiceWorkerFetchTaskClient.cpp:
924         * WebProcess/Storage/WebServiceWorkerProvider.cpp:
925         * WebProcess/Storage/WebToStorageProcessConnection.cpp:
926         * WebProcess/UserContent/WebUserContentController.cpp:
927         * WebProcess/WebConnectionToUIProcess.cpp:
928         * WebProcess/WebCoreSupport/SessionStateConversion.cpp:
929         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
930         * WebProcess/WebCoreSupport/WebColorChooser.cpp:
931         * WebProcess/WebCoreSupport/WebContextMenuClient.cpp:
932         * WebProcess/WebCoreSupport/WebDataListSuggestionPicker.cpp:
933         * WebProcess/WebCoreSupport/WebDiagnosticLoggingClient.cpp:
934         * WebProcess/WebCoreSupport/WebDragClient.cpp:
935         * WebProcess/WebCoreSupport/WebEditorClient.cpp:
936         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
937         * WebProcess/WebCoreSupport/WebGeolocationClient.cpp:
938         * WebProcess/WebCoreSupport/WebInspectorClient.cpp:
939         * WebProcess/WebCoreSupport/WebMessagePortChannelProvider.cpp:
940         * WebProcess/WebCoreSupport/WebNotificationClient.cpp:
941         * WebProcess/WebCoreSupport/WebPerformanceLoggingClient.cpp:
942         * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
943         * WebProcess/WebCoreSupport/WebPopupMenu.cpp:
944         * WebProcess/WebCoreSupport/WebProgressTrackerClient.cpp:
945         * WebProcess/WebCoreSupport/WebSearchPopupMenu.cpp:
946         * WebProcess/WebCoreSupport/WebUserMediaClient.cpp:
947         * WebProcess/WebCoreSupport/WebValidationMessageClient.cpp:
948         * WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm:
949         * WebProcess/WebCoreSupport/ios/WebEditorClientIOS.mm:
950         * WebProcess/WebCoreSupport/ios/WebFrameLoaderClientIOS.mm:
951         * WebProcess/WebCoreSupport/mac/WebAlternativeTextClient.cpp:
952         * WebProcess/WebCoreSupport/mac/WebContextMenuClientMac.mm:
953         * WebProcess/WebCoreSupport/mac/WebDragClientMac.mm:
954         * WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm:
955         * WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.mm:
956         * WebProcess/WebCoreSupport/mac/WebPopupMenuMac.mm:
957         * WebProcess/WebCoreSupport/soup/WebFrameNetworkingContext.cpp:
958         * WebProcess/WebCoreSupport/win/WebContextMenuClientWin.cpp:
959         * WebProcess/WebCoreSupport/win/WebPopupMenuWin.cpp:
960         * WebProcess/WebCoreSupport/wpe/WebEditorClientWPE.cpp:
961         * WebProcess/WebPage/Cocoa/WebPageCocoa.mm:
962         * WebProcess/WebPage/DrawingArea.cpp:
963         * WebProcess/WebPage/EventDispatcher.cpp:
964         * WebProcess/WebPage/FindController.cpp:
965         * WebProcess/WebPage/LayerTreeHost.cpp:
966         * WebProcess/WebPage/RemoteLayerTree/GraphicsLayerCARemote.cpp:
967         * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.cpp:
968         * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemoteCustom.mm:
969         * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemoteTiledBacking.cpp:
970         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeContext.mm:
971         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDisplayRefreshMonitor.mm:
972         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
973         * WebProcess/WebPage/RemoteLayerTree/RemoteScrollingCoordinator.mm:
974         * WebProcess/WebPage/RemoteWebInspectorUI.cpp:
975         * WebProcess/WebPage/ViewGestureGeometryCollector.cpp:
976         * WebProcess/WebPage/VisitedLinkTableController.cpp:
977         * WebProcess/WebPage/WebBackForwardListProxy.cpp:
978         * WebProcess/WebPage/WebContextMenu.cpp:
979         * WebProcess/WebPage/WebDocumentLoader.cpp:
980         * WebProcess/WebPage/WebFrame.cpp:
981         * WebProcess/WebPage/WebInspector.cpp:
982         * WebProcess/WebPage/WebInspectorUI.cpp:
983         * WebProcess/WebPage/WebPage.cpp:
984         * WebProcess/WebPage/WebPageOverlay.cpp:
985         * WebProcess/WebPage/WebURLSchemeHandlerProxy.cpp:
986         * WebProcess/WebPage/WebURLSchemeTaskProxy.cpp:
987         * WebProcess/WebPage/ios/FindControllerIOS.mm:
988         * WebProcess/WebPage/ios/WebPageIOS.mm:
989         * WebProcess/WebPage/mac/DrawingAreaMac.cpp:
990         * WebProcess/WebPage/mac/PageBannerMac.mm:
991         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
992         * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectBase.mm:
993         * WebProcess/WebPage/mac/WebPageMac.mm:
994         * WebProcess/WebPage/win/WebPageWin.cpp:
995         * WebProcess/WebPage/wpe/AcceleratedSurfaceWPE.cpp:
996         * WebProcess/WebPage/wpe/WebPageWPE.cpp:
997         * WebProcess/WebProcess.cpp:
998         * WebProcess/WebStorage/StorageAreaImpl.cpp:
999         * WebProcess/WebStorage/StorageAreaMap.cpp:
1000         * WebProcess/WebStorage/StorageNamespaceImpl.cpp:
1001         * WebProcess/WebStorage/WebStorageNamespaceProvider.cpp:
1002         * WebProcess/cocoa/PlaybackSessionManager.mm:
1003         * WebProcess/cocoa/UserMediaCaptureManager.cpp:
1004         * WebProcess/cocoa/VideoFullscreenManager.mm:
1005         * WebProcess/cocoa/WebProcessCocoa.mm:
1006         * WebProcess/win/WebProcessMainWin.cpp:
1007         * WebProcess/win/WebProcessWin.cpp:
1008         * WebProcess/wpe/WebProcessMainWPE.cpp:
1009
1010 2018-08-22  Daniel Bates  <dabates@apple.com>
1011
1012         Cleanup: Add type alias for spell document tag
1013         https://bugs.webkit.org/show_bug.cgi?id=188817
1014
1015         Reviewed by Simon Fraser.
1016
1017         * UIProcess/TextChecker.h:
1018         * UIProcess/TextCheckerCompletion.h:
1019         * UIProcess/WebPageProxy.cpp:
1020         (WebKit::WebPageProxy::~WebPageProxy):
1021         (WebKit::WebPageProxy::spellDocumentTag):
1022         * UIProcess/WebPageProxy.h: Also addressed FIXME comment and modernized the code to use a std::optional
1023         while I am here.
1024         * UIProcess/gtk/TextCheckerGtk.cpp:
1025         (WebKit::TextChecker::uniqueSpellDocumentTag):
1026         (WebKit::TextChecker::closeSpellDocumentWithTag):
1027         (WebKit::TextChecker::checkSpellingOfString):
1028         (WebKit::TextChecker::checkGrammarOfString):
1029         (WebKit::TextChecker::updateSpellingUIWithMisspelledWord):
1030         (WebKit::TextChecker::updateSpellingUIWithGrammarString):
1031         (WebKit::TextChecker::getGuessesForWord):
1032         (WebKit::TextChecker::learnWord):
1033         (WebKit::TextChecker::ignoreWord):
1034         (WebKit::TextChecker::checkTextOfParagraph):
1035         * UIProcess/ios/TextCheckerIOS.mm:
1036         (WebKit::spellDocumentTagMap):
1037         (WebKit::TextChecker::uniqueSpellDocumentTag):
1038         (WebKit::TextChecker::closeSpellDocumentWithTag):
1039         (WebKit::textCheckerFor):
1040         (WebKit::TextChecker::checkTextOfParagraph):
1041         (WebKit::TextChecker::checkSpellingOfString):
1042         (WebKit::TextChecker::checkGrammarOfString):
1043         (WebKit::TextChecker::updateSpellingUIWithMisspelledWord):
1044         (WebKit::TextChecker::updateSpellingUIWithGrammarString):
1045         (WebKit::TextChecker::getGuessesForWord):
1046         (WebKit::TextChecker::learnWord):
1047         (WebKit::TextChecker::ignoreWord):
1048         * UIProcess/mac/TextCheckerMac.mm:
1049         (WebKit::TextChecker::uniqueSpellDocumentTag):
1050         (WebKit::TextChecker::closeSpellDocumentWithTag):
1051         (WebKit::TextChecker::checkTextOfParagraph):
1052         (WebKit::TextChecker::checkSpellingOfString):
1053         (WebKit::TextChecker::checkGrammarOfString):
1054         (WebKit::TextChecker::updateSpellingUIWithMisspelledWord):
1055         (WebKit::TextChecker::updateSpellingUIWithGrammarString):
1056         (WebKit::TextChecker::getGuessesForWord):
1057         (WebKit::TextChecker::learnWord):
1058         (WebKit::TextChecker::ignoreWord):
1059         * UIProcess/win/TextCheckerWin.cpp:
1060         (WebKit::TextChecker::uniqueSpellDocumentTag):
1061         (WebKit::TextChecker::closeSpellDocumentWithTag):
1062         (WebKit::TextChecker::checkSpellingOfString):
1063         (WebKit::TextChecker::checkGrammarOfString):
1064         (WebKit::TextChecker::updateSpellingUIWithMisspelledWord):
1065         (WebKit::TextChecker::updateSpellingUIWithGrammarString):
1066         (WebKit::TextChecker::getGuessesForWord):
1067         (WebKit::TextChecker::learnWord):
1068         (WebKit::TextChecker::ignoreWord):
1069         (WebKit::TextChecker::checkTextOfParagraph):
1070         * UIProcess/wpe/TextCheckerWPE.cpp:
1071         (WebKit::TextChecker::uniqueSpellDocumentTag):
1072         (WebKit::TextChecker::closeSpellDocumentWithTag):
1073         (WebKit::TextChecker::checkSpellingOfString):
1074         (WebKit::TextChecker::checkGrammarOfString):
1075         (WebKit::TextChecker::updateSpellingUIWithMisspelledWord):
1076         (WebKit::TextChecker::updateSpellingUIWithGrammarString):
1077         (WebKit::TextChecker::getGuessesForWord):
1078         (WebKit::TextChecker::learnWord):
1079         (WebKit::TextChecker::ignoreWord):
1080
1081 2018-08-22  Antti Koivisto  <antti@apple.com>
1082
1083         Use OptionSet for NetworkCache::Storage::TraverseFlags
1084         https://bugs.webkit.org/show_bug.cgi?id=188837
1085
1086         Reviewed by Anders Carlsson.
1087
1088         Type safe flags.
1089
1090         * NetworkProcess/cache/CacheStorageEngineCaches.cpp:
1091         (WebKit::CacheStorage::Caches::initializeSize):
1092         (WebKit::CacheStorage::Caches::readRecordsList):
1093         * NetworkProcess/cache/NetworkCache.cpp:
1094         (WebKit::NetworkCache::Cache::traverse):
1095         (WebKit::NetworkCache::Cache::dumpContentsToFile):
1096         * NetworkProcess/cache/NetworkCacheStorage.cpp:
1097         (WebKit::NetworkCache::Storage::TraverseOperation::TraverseOperation):
1098         (WebKit::NetworkCache::Storage::traverse):
1099         * NetworkProcess/cache/NetworkCacheStorage.h:
1100         * WebProcess/MediaStream/UserMediaPermissionRequestManager.cpp:
1101         (WebKit::UserMediaPermissionRequestManager::captureDevicesChanged):
1102         (WebKit::UserMediaPermissionRequestManager::activityStateDidChange):
1103
1104         Also use OptionSet<>::containsAll() in a few places.
1105
1106 2018-08-22  Carlos Garcia Campos  <cgarcia@igalia.com>
1107
1108         [WPE] pkg-config files should require libwpe
1109         https://bugs.webkit.org/show_bug.cgi?id=188835
1110
1111         Reviewed by Žan Doberšek.
1112
1113         * wpe/wpe-web-extension.pc.in:
1114         * wpe/wpe-webkit.pc.in:
1115
1116 2018-08-22  Zan Dobersek  <zdobersek@igalia.com>
1117
1118         [CoordGraphics] Switch to Nicosia::CompositionLayer state tracking
1119         https://bugs.webkit.org/show_bug.cgi?id=188693
1120
1121         Reviewed by Carlos Garcia Campos.
1122
1123         Switch CoordinatedGraphicsScene to utilizing Nicosia::CompositionLayer
1124         objects for state updates of the TextureMapper layer tree.
1125
1126         CoordinatedGraphicsScene::paintToCurrentGLContext() now calls
1127         updateSceneState() at the beginning. This is a new method that manages
1128         all updates for a given Nicosia::Scene instance. Any removed layers
1129         have their composition-side state cleaned up, and the current set of
1130         layers is then iterated to ensure and update the corresponding
1131         TextureMapperLayer objects.
1132
1133         Layers with any backing (painted backing store, platform-layer or image
1134         content) are temporarly stored for updating outside of mutex-controlled
1135         scene update. Performing all other state updates outside of this mutex
1136         area will be investigated at a later point.
1137
1138         We then iterate over vectors for each layer backing, gathering any
1139         affected CoordinatedBackingStore or TextureMapperPlatformLayerProxy
1140         objects that we have to update.
1141
1142         This drops a bunch of member variables and helper methods off the
1143         CoordinatedGraphicsScene class. The applyStateChanges() method will be
1144         further simplified in the future. coordinateUpdateCompletionWithClient
1145         logic in ThreadedCompositor should be checked to see whether it still
1146         addresses any real-life problem, because at the moment it imposes a few
1147         additional operations in terms of scene updates that we could really do
1148         without. This will be checked later and removed if possible.
1149
1150         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
1151         (WebKit::CoordinatedGraphicsScene::applyStateChanges):
1152         (WebKit::CoordinatedGraphicsScene::paintToCurrentGLContext):
1153         (WebKit::compositionLayerImpl):
1154         (WebKit::contentLayerImpl):
1155         (WebKit::backingStoreImpl):
1156         (WebKit::imageBackingImpl):
1157         (WebKit::texmapLayer):
1158         (WebKit::updateBackingStore):
1159         (WebKit::updateImageBacking):
1160         (WebKit::removeLayer):
1161         (WebKit::CoordinatedGraphicsScene::commitSceneState):
1162         (WebKit::CoordinatedGraphicsScene::updateSceneState):
1163         (WebKit::CoordinatedGraphicsScene::purgeGLResources):
1164         (WebKit::CoordinatedGraphicsScene::syncPlatformLayerIfNeeded): Deleted.
1165         (WebKit::CoordinatedGraphicsScene::setLayerChildrenIfNeeded): Deleted.
1166         (WebKit::CoordinatedGraphicsScene::setLayerFiltersIfNeeded): Deleted.
1167         (WebKit::CoordinatedGraphicsScene::setLayerState): Deleted.
1168         (WebKit::CoordinatedGraphicsScene::getLayerByIDIfExists): Deleted.
1169         (WebKit::CoordinatedGraphicsScene::createLayers): Deleted.
1170         (WebKit::CoordinatedGraphicsScene::createLayer): Deleted.
1171         (WebKit::CoordinatedGraphicsScene::deleteLayers): Deleted.
1172         (WebKit::CoordinatedGraphicsScene::deleteLayer): Deleted.
1173         (WebKit::CoordinatedGraphicsScene::setRootLayerID): Deleted.
1174         (WebKit::CoordinatedGraphicsScene::prepareContentBackingStore): Deleted.
1175         (WebKit::CoordinatedGraphicsScene::createBackingStoreIfNeeded): Deleted.
1176         (WebKit::CoordinatedGraphicsScene::removeBackingStoreIfNeeded): Deleted.
1177         (WebKit::CoordinatedGraphicsScene::resetBackingStoreSizeToLayerSize): Deleted.
1178         (WebKit::CoordinatedGraphicsScene::createTilesIfNeeded): Deleted.
1179         (WebKit::CoordinatedGraphicsScene::removeTilesIfNeeded): Deleted.
1180         (WebKit::CoordinatedGraphicsScene::updateTilesIfNeeded): Deleted.
1181         (WebKit::CoordinatedGraphicsScene::syncImageBackings): Deleted.
1182         (WebKit::CoordinatedGraphicsScene::createImageBacking): Deleted.
1183         (WebKit::CoordinatedGraphicsScene::updateImageBacking): Deleted.
1184         (WebKit::CoordinatedGraphicsScene::clearImageBackingContents): Deleted.
1185         (WebKit::CoordinatedGraphicsScene::removeImageBacking): Deleted.
1186         (WebKit::CoordinatedGraphicsScene::assignImageBackingToLayer): Deleted.
1187         (WebKit::CoordinatedGraphicsScene::setLayerAnimationsIfNeeded): Deleted.
1188         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.h:
1189         (WebKit::CoordinatedGraphicsScene::layerByID): Deleted.
1190         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
1191         (WebKit::ThreadedCompositor::renderLayerTree):
1192         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp:
1193         (WebKit::CompositingCoordinator::flushPendingLayerChanges):
1194
1195 2018-08-21  Ryosuke Niwa  <rniwa@webkit.org>
1196
1197         Replace booleans for modifier keys in UIEventWithKeyState with OptionSet<Modifier>
1198         https://bugs.webkit.org/show_bug.cgi?id=188777
1199
1200         Reviewed by Simon Fraser.
1201
1202         Added two FIXMEs.
1203
1204         * WebProcess/WebPage/WebPage.cpp:
1205         (WebKit::WebPage::navigateToPDFLinkWithSimulatedClick):
1206
1207 2018-08-21  Alex Christensen  <achristensen@webkit.org>
1208
1209         Roll out r235139 and r235146
1210         https://bugs.webkit.org/show_bug.cgi?id=188805
1211
1212         It turns out shouldKeepCurrentBackForwardListItemInList has one use left.
1213
1214         * UIProcess/API/APILoaderClient.h:
1215         (API::LoaderClient::shouldKeepCurrentBackForwardListItemInList):
1216         * UIProcess/API/C/WKPage.cpp:
1217         (WKPageSetPageLoaderClient):
1218         * UIProcess/WebBackForwardList.cpp:
1219         (WebKit::WebBackForwardList::addItem):
1220         (WebKit::WebBackForwardList::goToItem):
1221         * UIProcess/WebPageProxy.cpp:
1222         (WebKit::WebPageProxy::shouldKeepCurrentBackForwardListItemInList):
1223         * UIProcess/WebPageProxy.h:
1224
1225 2018-08-21  Wenson Hsieh  <wenson_hsieh@apple.com>
1226
1227         [Attachment Support] Remove _WKAttachments and notify the UI client upon mainframe navigation
1228         https://bugs.webkit.org/show_bug.cgi?id=188715
1229         <rdar://problem/43541790>
1230
1231         Reviewed by Tim Horton.
1232
1233         Adds logic for invalidating Attachment objects upon mainframe navigation, or upon web content process
1234         termination. An invalid Attachment's wrapper may still be retained by a UI client; however, calls to -info and
1235         other SPI methods will either return nil or immediately invoke their completion handlers with a nil result and
1236         an NSError. See changes below for more detail.
1237
1238         This patch also takes some extra measures to avoid sending redundant or unexpected removal updates to the UI
1239         client upon invalidating all Attachments.
1240
1241         See Tools changes for new API tests.
1242
1243         * UIProcess/API/APIAttachment.cpp:
1244         (API::Attachment::invalidate):
1245         * UIProcess/API/APIAttachment.h:
1246         * UIProcess/API/Cocoa/WKWebView.mm:
1247         (-[WKWebView _didInsertAttachment:withSource:]):
1248         (-[WKWebView _didRemoveAttachment:]):
1249
1250         Refactor these methods to take references to the API::Attachment that is being inserted or removed, rather than
1251         take attachment identifiers. This allows us to keep logic for setting the InsertionState of Attachment objects
1252         in WebPageProxy, rather than in platform code.
1253
1254         * UIProcess/API/Cocoa/WKWebViewInternal.h:
1255         * UIProcess/API/Cocoa/_WKAttachment.h:
1256         * UIProcess/API/Cocoa/_WKAttachment.mm:
1257         (-[_WKAttachment info]):
1258
1259         If the attachment object is invalid, return nil.
1260
1261         (-[_WKAttachment setDisplayOptions:completion:]):
1262         (-[_WKAttachment setFileWrapper:contentType:completion:]):
1263
1264         If the attachment object is invalid, immediately invoke the completion block with an error.
1265
1266         (-[_WKAttachment isConnected]):
1267
1268         Add a new readonly property for a client to easily determine whether a _WKAttachment is connected to the
1269         document, without having to maintain the current set of connected attachment objects by observing insertion and
1270         removal callbacks.
1271
1272         * UIProcess/Cocoa/PageClientImplCocoa.h:
1273         * UIProcess/Cocoa/PageClientImplCocoa.mm:
1274         (WebKit::PageClientImplCocoa::didInsertAttachment):
1275         (WebKit::PageClientImplCocoa::didRemoveAttachment):
1276
1277         Make these take API::Attachment&s rather than identifier strings.
1278
1279         * UIProcess/PageClient.h:
1280         (WebKit::PageClient::didInsertAttachment):
1281         (WebKit::PageClient::didRemoveAttachment):
1282
1283         Also make these take API::Attachment&s rather than identifier strings.
1284
1285         * UIProcess/WebPageProxy.cpp:
1286         (WebKit::WebPageProxy::didCommitLoadForFrame):
1287         (WebKit::WebPageProxy::resetStateAfterProcessExited):
1288         (WebKit::WebPageProxy::invalidateAllAttachments):
1289
1290         Introduce a helper function that invalidates all Attachments and notifies the UI client if needed. This is
1291         invoked upon mainframe navigation, and when the web content process terminates.
1292
1293         (WebKit::WebPageProxy::platformRegisterAttachment):
1294         (WebKit::WebPageProxy::didInsertAttachmentWithIdentifier):
1295         (WebKit::WebPageProxy::didRemoveAttachmentWithIdentifier):
1296         (WebKit::WebPageProxy::didInsertAttachment):
1297         (WebKit::WebPageProxy::didRemoveAttachment):
1298
1299         Keep track of whether we've notified the UI client that an Attachment has been inserted into the document. This
1300         allows us to send removal updates to the UI client only for Attachments that are currently in the document, from
1301         the perspective of the UI client, and allows us to avoid sending extra removal updates in
1302         invalidateAllAttachments for Attachments that either have already been removed, or Attachments which we haven't
1303         inserted yet.
1304
1305         * UIProcess/WebPageProxy.h:
1306         * UIProcess/WebPageProxy.messages.in:
1307         * WebProcess/WebCoreSupport/WebEditorClient.cpp:
1308         (WebKit::WebEditorClient::didInsertAttachmentWithIdentifier):
1309         (WebKit::WebEditorClient::didRemoveAttachmentWithIdentifier):
1310         (WebKit::WebEditorClient::didInsertAttachment): Deleted.
1311         (WebKit::WebEditorClient::didRemoveAttachment): Deleted.
1312         * WebProcess/WebCoreSupport/WebEditorClient.h:
1313
1314         Rename did{Insert|Remove}Attachment to did{Insert|Remove}AttachmentWithIdentifier.
1315
1316 2018-08-21  Megan Gardner  <megan_gardner@apple.com>
1317
1318         Change Selection modification to not snap the grabber when selecting above or below the selection anchor
1319         https://bugs.webkit.org/show_bug.cgi?id=188826
1320
1321         Reviewed by Tim Horton.
1322
1323         Selecting single lines is sometimes difficult because we currently snap selections to single
1324         characters if we move past the position of the other anchor in our selection. This patch changes
1325         this behaviour to reflect the behaviour in the rest of this system, which snaps the selection
1326         to the position on the line of the other anchor, rather than snapping it all the way a single
1327         character.
1328
1329         * WebProcess/WebPage/ios/WebPageIOS.mm:
1330         (WebKit::rangeForPointInRootViewCoordinates):
1331
1332 2018-08-21  Daniel Bates  <dabates@apple.com>
1333
1334         Cleanup: Remove unused file-local static variable from TextCheckerIOS.mm
1335         https://bugs.webkit.org/show_bug.cgi?id=188818
1336
1337         Reviewed by Wenson Hsieh.
1338
1339         * UIProcess/ios/TextCheckerIOS.mm:
1340         (WebKit::TextChecker::isSmartInsertDeleteEnabled):
1341
1342 2018-08-21  Daniel Bates  <dabates@apple.com>
1343
1344         [iOS][WK2] Misspelled words are not underlined
1345         https://bugs.webkit.org/show_bug.cgi?id=188800
1346         <rdar://problem/34811332>
1347
1348         Reviewed by Wenson Hsieh.
1349
1350         Implement enough of TextChecker for iOS to compute the list of misspelled words in a
1351         paragraph and advertise support for continuous spell checking. The WebCore editing
1352         machinery queries TextChecker for the list of the misspelled words, creating document
1353         markers that demarcate the misspelled words. When we paint a line of text we paint
1354         the spelling correction dots under each misspelled word.
1355
1356         On iOS we make use of UITextChecker to perform spell checking of a string. We maintain
1357         a side table that maps a "spell document tag" to a UITextChecker* to conform to the
1358         shape of the TextChecker interface.
1359
1360         * Platform/spi/ios/UIKitSPI.h: Forward declare some SPI.
1361         * UIProcess/ios/TextCheckerIOS.mm:
1362         (WebKit::mutableState): Added.
1363         (WebKit::TextChecker::state): Turns around and returns mutableState().
1364         (WebKit::TextChecker::isContinuousSpellCheckingAllowed): Returns true if we are building
1365         with USE(UNIFIED_TEXT_CHECKING). Otherwise, do what we do now.
1366         (WebKit::TextChecker::setContinuousSpellCheckingEnabled): Update state.
1367         (WebKit::TextChecker::continuousSpellCheckingEnabledStateChanged): Ditto.
1368         (WebKit::spellDocumentTagMap): Returns HashMap that maps a "spell document tag" (int64_t) to
1369         a RetainPtr<UITextChecker>>.
1370         (WebKit::TextChecker::uniqueSpellDocumentTag): Generates a unique identifier for the page
1371         this text checker is associated with.
1372         (WebKit::TextChecker::closeSpellDocumentWithTag): Removes the entry for the specified identifier
1373         from the HashMap.
1374         (WebKit::textCheckerFor): Query the HashMap for the UITextChecker for the specified spell
1375         document tag, if it exists. Otherwise, create a new UITextChecker and add a new map entry
1376         that associates it with the specified spell document tag. 
1377         (WebKit::TextChecker::checkTextOfParagraph): Spell check the specified string and return a list
1378         that represents the misspelled words.
1379         (WebKit::TextChecker::checkSpellingOfString): Added a comment to explain that iOS does not implement
1380         this function and instead implements checkTextOfParagraph().
1381         (WebKit::TextChecker::checkGrammarOfString): Ditto.
1382
1383 2018-08-21  Alex Christensen  <achristensen@webkit.org>
1384
1385         Transition ResizeReversePaginatedWebView API test from WKPageLoaderClient to WKPageNavigationClient
1386         https://bugs.webkit.org/show_bug.cgi?id=188821
1387
1388         Reviewed by Simon Fraser.
1389
1390         Add some more values to WKPageRenderingProgressEvents which were already supported by _WKRenderingProgressEvents and WKLayoutMilestones.
1391
1392         * UIProcess/API/C/WKPageRenderingProgressEvents.h:
1393         * UIProcess/API/C/WKPageRenderingProgressEventsInternal.h:
1394         (pageRenderingProgressEvents):
1395
1396 2018-08-21  Alex Christensen  <achristensen@webkit.org>
1397
1398         Fix API tests after r235139
1399         https://bugs.webkit.org/show_bug.cgi?id=188805
1400
1401         Apparently the call to didChangeBackForwardList with no changes was observable.  We should rename, but I'm restoring existing behavior for now.
1402
1403         * UIProcess/WebBackForwardList.cpp:
1404         (WebKit::WebBackForwardList::goToItem):
1405
1406 2018-08-21  John Wilander  <wilander@apple.com>
1407
1408         Storage Access API: The call to ResourceLoadStatisticsMemoryStore::grantStorageAccessInternal() should send eTLD+1s, not full host names
1409         https://bugs.webkit.org/show_bug.cgi?id=188783
1410         <rdar://problem/43559215>
1411
1412         Reviewed by Alex Christensen.
1413
1414         * UIProcess/ResourceLoadStatisticsMemoryStore.cpp:
1415         (WebKit::ResourceLoadStatisticsMemoryStore::grantStorageAccess):
1416             Now sends the eTLD+1 for the top frame and sub frame.
1417
1418 2018-08-21  Megan Gardner  <megan_gardner@apple.com>
1419
1420         Use VisiblePosition to calculate selection ranges
1421         https://bugs.webkit.org/show_bug.cgi?id=188767
1422         <rdar://problem/43577166>
1423
1424         Reviewed by Ryosuke Niwa.
1425
1426         Switches to using VisiblePosition, instead of Position. This code used to use VisiblePosiiton,
1427         but it has been changed a lot lately, and using Position causes issues with next and previous
1428         when trying to snap a selection. VisiblePosition gives us the correct information, and does not 
1429         result in collapsed ranges.
1430
1431         * WebProcess/WebPage/ios/WebPageIOS.mm:
1432         (WebKit::rangeForPointInRootViewCoordinates):
1433
1434 2018-08-21  Alex Christensen  <achristensen@webkit.org>
1435
1436         Remove unused shouldKeepCurrentBackForwardListItemInList check
1437         https://bugs.webkit.org/show_bug.cgi?id=188805
1438
1439         Reviewed by Andy Estes.
1440
1441         The check was only done in WKPageLoaderClient, and nobody implements the check.
1442         It was not needed to put in WKPageNavigationClient or WKNavigationDelegate, so let's remove it!
1443         This removes the unused ability to go back and remove the current back/forward list item.
1444
1445         * UIProcess/API/APILoaderClient.h:
1446         (API::LoaderClient::didChangeBackForwardList):
1447         (API::LoaderClient::shouldKeepCurrentBackForwardListItemInList): Deleted.
1448         * UIProcess/API/C/WKPage.cpp:
1449         (WKPageSetPageLoaderClient):
1450         * UIProcess/WebBackForwardList.cpp:
1451         (WebKit::WebBackForwardList::addItem):
1452         (WebKit::WebBackForwardList::goToItem):
1453         * UIProcess/WebPageProxy.cpp:
1454         (WebKit::WebPageProxy::shouldKeepCurrentBackForwardListItemInList): Deleted.
1455         * UIProcess/WebPageProxy.h:
1456
1457 2018-08-21  Wenson Hsieh  <wenson_hsieh@apple.com>
1458
1459         [Attachment Support] Augment _WKAttachment SPI to handle NSFileWrappers in addition to NSData
1460         https://bugs.webkit.org/show_bug.cgi?id=188496
1461         <rdar://problem/43216836>
1462
1463         Reviewed by Tim Horton.
1464
1465         Adjusts WebKit's attachment editing SPI with the following modifications:
1466         •   Deprecate `-_insertAttachmentWithFilename:contentType:data:options:completion:` in favor of
1467             `-_insertAttachmentWithFileWrapper:contentType:options:completion:`.
1468         •   Deprecate `-requestInfo:` and in favor of just `-info`.
1469         •   Add a `-fileWrapper` property to `_WKAttachmentInfo` that returns an `NSFileWrapper`.
1470         •   Remove some SPI methods that would otherwise be deprecated, but are not even necessary, since they're no
1471             longer even used by Mail.
1472
1473         To make this possible, we refactor where and how attachment data is tracked. Currently, the data is stored in
1474         the network process, and made accessible to the web process via blob URLs stored in the File object in the
1475         attachment element. As such, requests from the UI process for attachment data would first be routed through the
1476         web process to network process and back.
1477
1478         Instead, we now keep the relevant attachment data (in the form of NSFileWrapper on Cocoa platforms) in the UI
1479         process, on API::Attachment. We additionally keep a map of attachment identifiers to API::Attachments, which
1480         allows us to propagate the same _WKAttachment wrapper object to the SPI client for each uniquely identified
1481         attachment element. This also has the benefit of allowing us to remove the asynchronous version of `-requestInfo:`
1482         and replace it with just an `info` property.
1483
1484         Changes are covered by new and existing API tests.
1485
1486         * PlatformMac.cmake:
1487
1488         Remove APIAttachment.cpp, now that APIAttachment.cpp is listed in Sources.txt.
1489
1490         * Scripts/webkit/messages.py:
1491         * Shared/Cocoa/APIObject.mm:
1492         (API::Object::newObject):
1493
1494         Guard _WKAttachment creation with ENABLE_ATTACHMENT_ELEMENT.
1495
1496         * Shared/WebCoreArgumentCoders.cpp:
1497         (IPC::ArgumentCoder<PromisedAttachmentInfo>::encode):
1498         (IPC::ArgumentCoder<PromisedAttachmentInfo>::decode):
1499         (IPC::ArgumentCoder<PromisedBlobInfo>::encode): Deleted.
1500         (IPC::ArgumentCoder<PromisedBlobInfo>::decode): Deleted.
1501         (IPC::ArgumentCoder<AttachmentInfo>::encode): Deleted.
1502         (IPC::ArgumentCoder<AttachmentInfo>::decode): Deleted.
1503         * Shared/WebCoreArgumentCoders.h:
1504
1505         Continue removing encoding support for WebCore::AttachmentInfo. Additionally, rename PromisedBlobInfo to
1506         PromisedAttachmentInfo.
1507
1508         * Sources.txt:
1509         * SourcesCocoa.txt:
1510
1511         Move APIAttachment.cpp from the SourcesCocoa.txt to the platform-agnostic Sources.txt.
1512
1513         * UIProcess/API/APIAttachment.cpp:
1514         (API::Attachment::updateAttributes):
1515
1516         Rename setDataAndContentType to just updateAttributes; instead of sending data, only send the information needed
1517         to update the presentational attributes of the attachment element.
1518
1519         (API::Attachment::requestInfo): Deleted.
1520
1521         Just call the completion handler with the result of `self.info`.
1522
1523         (API::Attachment::setDataAndContentType): Deleted.
1524         * UIProcess/API/APIAttachment.h:
1525
1526         Add additional attributes: a content type, a file path, and (on Cocoa platforms) an NSFileWrapper.
1527
1528         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
1529
1530         Remove -_webView:didInsertAttachment:, since this is unused by any client currently, and is superceded by
1531         -_webView:didInsertAttachment:withSource:.
1532
1533         * UIProcess/API/Cocoa/WKWebView.mm:
1534         (-[WKWebView _didInsertAttachment:withSource:]):
1535         (-[WKWebView _didRemoveAttachment:]):
1536
1537         Look up the API::Attachment corresponding to the identifier, and send its wrapper object to the client.
1538
1539         (-[WKWebView _insertAttachmentWithFilename:contentType:data:options:completion:]):
1540         (-[WKWebView _insertAttachmentWithFileWrapper:contentType:options:completion:]):
1541
1542         Add a way to insert an attachment using NSFileWrapper, and reimplement _insertAttachmentWithFilename: using it.
1543
1544         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1545         * UIProcess/API/Cocoa/_WKAttachment.h:
1546         * UIProcess/API/Cocoa/_WKAttachment.mm:
1547         (-[_WKAttachmentInfo initWithFileWrapper:filePath:contentType:]):
1548         (-[_WKAttachmentInfo data]):
1549         (-[_WKAttachmentInfo name]):
1550         (isDeclaredOrDynamicTypeIdentifier):
1551         (-[_WKAttachmentInfo _typeIdentifierFromPathExtension]):
1552         (-[_WKAttachmentInfo contentType]):
1553         (-[_WKAttachmentInfo mimeType]):
1554         (-[_WKAttachmentInfo utiType]):
1555         (-[_WKAttachmentInfo fileWrapper]):
1556         (-[_WKAttachment info]):
1557         (-[_WKAttachment requestInfo:]):
1558
1559         Add a property on _WKAttachment to retrieve a _WKAttachmentInfo (a snapshot of the current state of the
1560         attachment, along with the NSFileWrapper). Reimplement requestInfo using this property.
1561
1562         (-[_WKAttachment setFileWrapper:contentType:completion:]):
1563         (-[_WKAttachment setData:newContentType:newFilename:completion:]):
1564
1565         Reimplemented by calling -setFileWrapper:contentType:completion: with an NSFileWrapper created using the given
1566         data. Additionally, create and associate the unique identifier with an API::Attachment right away.
1567
1568         (-[_WKAttachment uniqueIdentifier]):
1569         (-[_WKAttachment description]):
1570         (-[_WKAttachmentInfo initWithInfo:]): Deleted.
1571         (-[_WKAttachmentInfo fileLoadingError]): Deleted.
1572         (-[_WKAttachment isEqual:]): Deleted.
1573         (-[_WKAttachment hash]): Deleted.
1574
1575         There's no longer any point to implementing these methods, since the SPI client is now guaranteed a unique
1576         mapping of _WKAttachments to attachment elements in the document.
1577
1578         * UIProcess/Cocoa/PageClientImplCocoa.mm:
1579         (WebKit::PageClientImplCocoa::didInsertAttachment):
1580         * UIProcess/Cocoa/WebPageProxyCocoa.mm:
1581         (WebKit::WebPageProxy::platformRegisterAttachment):
1582         (WebKit::WebPageProxy::platformCloneAttachment):
1583
1584         Extend the behavior of registering new attachment data on Cocoa platforms by additionally creating and setting
1585         NSFileWrappers on the API::Attachment.
1586
1587         * UIProcess/WebPageProxy.cpp:
1588         (WebKit::WebPageProxy::resetStateAfterProcessExited):
1589
1590         Clear out the map of attachment identifiers to API::Attachments when the web content process is terminated.
1591
1592         (WebKit::WebPageProxy::attachmentForIdentifier const):
1593
1594         Helper function to look up an API::Attachment for the given attachment identifier. Returns null if the
1595         attachment is not found, or the attachment identifier is invalid.
1596
1597         (WebKit::WebPageProxy::insertAttachment):
1598         (WebKit::WebPageProxy::updateAttachmentAttributes):
1599         (WebKit::WebPageProxy::registerAttachmentIdentifierFromData):
1600         (WebKit::WebPageProxy::registerAttachmentIdentifierFromFilePath):
1601         (WebKit::WebPageProxy::cloneAttachmentData):
1602         (WebKit::WebPageProxy::platformRegisterAttachment):
1603         (WebKit::WebPageProxy::platformCloneAttachment):
1604         (WebKit::WebPageProxy::didInsertAttachment):
1605
1606         Create an entry in the attachment identifier to API::Attachment map when an attachment is inserted, if one does
1607         not already exist. An attachment mapping would not exist only in the case where an attachment element was
1608         created via bindings; in this case, the client wouldn't have access to an NSFileWrapper containing the contents
1609         of the file; in the future, this can be improved by adding a mechanism to register an attachment element with
1610         this data, but for now, this is unnecessary for Mail's purposes.
1611
1612         (WebKit::WebPageProxy::didRemoveAttachment):
1613         (WebKit::WebPageProxy::ensureAttachment):
1614
1615         Ensures an attachment identifier to API::Attachment mapping.
1616
1617         (WebKit::WebPageProxy::attachmentInfoCallback): Deleted.
1618         (WebKit::WebPageProxy::requestAttachmentInfo): Deleted.
1619         (WebKit::WebPageProxy::setAttachmentDataAndContentType): Deleted.
1620         * UIProcess/WebPageProxy.h:
1621         * UIProcess/WebPageProxy.messages.in:
1622         * UIProcess/ios/PageClientImplIOS.h:
1623         * UIProcess/ios/PageClientImplIOS.mm:
1624         * UIProcess/ios/WKContentViewInteraction.h:
1625         * UIProcess/ios/WKContentViewInteraction.mm:
1626         (-[WKContentView _startDrag:item:]):
1627         (-[WKContentView _prepareToDragPromisedAttachment:]):
1628         (-[WKContentView _prepareToDragPromisedBlob:]): Deleted.
1629
1630         Reimplement the way promised attachment data is delivered to the destination when an attachment element is
1631         dragged. Instead of relying on the blob URL of the File on the attachment element, first try to find an API
1632         Attachment object corresponding to the unique identifier of the dragged attachment, and use its NSFileWrapper to
1633         deliver promised data to the destination file URL. The blob URL codepath still exists in the case where script
1634         specifies the dragged attachment's File.
1635
1636         * UIProcess/mac/PageClientImplMac.h:
1637         * UIProcess/mac/PageClientImplMac.mm:
1638         * WebProcess/WebCoreSupport/WebEditorClient.cpp:
1639         (WebKit::WebEditorClient::registerAttachmentIdentifier):
1640         (WebKit::WebEditorClient::cloneAttachmentData):
1641         * WebProcess/WebCoreSupport/WebEditorClient.h:
1642         * WebProcess/WebPage/WebPage.cpp:
1643         (WebKit::WebPage::insertAttachment):
1644         (WebKit::WebPage::updateAttachmentAttributes):
1645         (WebKit::WebPage::requestAttachmentInfo): Deleted.
1646         (WebKit::WebPage::setAttachmentDataAndContentType): Deleted.
1647         * WebProcess/WebPage/WebPage.h:
1648         * WebProcess/WebPage/WebPage.messages.in:
1649
1650         More renaming and IPC message plumbing.
1651
1652 2018-08-21  Alex Christensen  <achristensen@webkit.org>
1653
1654         Increment NetworkCache::Storage::lastStableVersion after r233742
1655         https://bugs.webkit.org/show_bug.cgi?id=188798
1656         <rdar://43561761>
1657
1658         Reviewed by Geoffrey Garen.
1659
1660         * NetworkProcess/cache/NetworkCacheStorage.h:
1661
1662 2018-08-21  Brent Fulgham  <bfulgham@apple.com>
1663
1664         Remove experimental affiliated domain code now that StorageAccess API is available
1665         https://bugs.webkit.org/show_bug.cgi?id=188756
1666         <rdar://problem/43527848>
1667
1668         Reviewed by Alex Christensen.
1669
1670         In Bug 174661 we added a compatibility quirk to support wsj.com authentication. This quirk is no longer needed,
1671         since the StorageAccess API provides the necessary tools to do this type of interaction without needing global
1672         cross-site access.
1673
1674         * UIProcess/ResourceLoadStatisticsMemoryStore.cpp:
1675         (WebKit::ResourceLoadStatisticsMemoryStore::logFrameNavigation):
1676         * UIProcess/ResourceLoadStatisticsMemoryStore.h:
1677         * UIProcess/WebResourceLoadStatisticsStore.cpp:
1678         (WebKit::WebResourceLoadStatisticsStore::logFrameNavigation):
1679         (WebKit::areDomainsAssociated): Deleted.
1680
1681 2018-08-21  Alex Christensen  <achristensen@webkit.org>
1682
1683         Add _WKWebsiteDataStoreConfiguration. sourceApplicationBundleIdentifier and sourceApplicationSecondaryIdentifier
1684         https://bugs.webkit.org/show_bug.cgi?id=188748
1685
1686         Reviewed by Ryosuke Niwa.
1687
1688         * NetworkProcess/NetworkSessionCreationParameters.h:
1689         (WebKit::NetworkSessionCreationParameters::encode const):
1690         (WebKit::NetworkSessionCreationParameters::decode):
1691         * NetworkProcess/cocoa/NetworkSessionCocoa.h:
1692         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
1693         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
1694         * Shared/WebsiteDataStoreParameters.cpp:
1695         (WebKit::WebsiteDataStoreParameters::privateSessionParameters):
1696         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
1697         (-[WKWebsiteDataStore _initWithConfiguration:]):
1698         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
1699         * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.h:
1700         * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.mm:
1701         (-[_WKWebsiteDataStoreConfiguration setSourceApplicationBundleIdentifier:]):
1702         (-[_WKWebsiteDataStoreConfiguration sourceApplicationBundleIdentifier]):
1703         (-[_WKWebsiteDataStoreConfiguration sourceApplicationSecondaryIdentifier]):
1704         (-[_WKWebsiteDataStoreConfiguration setSourceApplicationSecondaryIdentifier:]):
1705         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
1706         (WebKit::WebsiteDataStore::parameters):
1707         * UIProcess/WebsiteData/WebsiteDataStore.h:
1708
1709 2018-08-21  Per Arne Vollan  <pvollan@apple.com>
1710
1711         [WebGL] Contexts are not updated when display configuration changed.
1712         https://bugs.webkit.org/show_bug.cgi?id=188750
1713
1714         Reviewed by Brent Fulgham.
1715
1716         Calling CGDisplayRegisterReconfigurationCallback in GraphicsContext3DManager::addContext
1717         returns kCGErrorSuccess when WindowServer access is blocked in the WebContent process,
1718         but the callback function is never called. We should register the callback function in
1719         the UI process, and send a message to the WebContent process when the display
1720         configuration changed.
1721
1722         * Sources.txt:
1723         * UIProcess/API/C/WKMockDisplay.cpp: Added.
1724         (WKSendDisplayConfigurationChangedMessageForTesting):
1725         * UIProcess/API/C/WKMockDisplay.h: Added.
1726         * UIProcess/WebProcessPool.cpp:
1727         (WebKit::displayReconfigurationCallBack):
1728         (WebKit::WebProcessPool::sendDisplayConfigurationChangedMessageForTesting):
1729         * UIProcess/WebProcessPool.h:
1730         * WebKit.xcodeproj/project.pbxproj:
1731         * WebProcess/WebProcess.h:
1732         * WebProcess/WebProcess.messages.in:
1733         * WebProcess/cocoa/WebProcessCocoa.mm:
1734         (WebKit::WebProcess::displayConfigurationChanged):
1735
1736 2018-08-21  John Wilander  <wilander@apple.com>
1737
1738         Make ResourceLoadObserver::logWebSocketLoading() handle websockets in detached frames
1739         https://bugs.webkit.org/show_bug.cgi?id=188757
1740         <rdar://problem/38713390>
1741
1742         Reviewed by Alex Christensen.
1743
1744         These changes are test infrastructure to support the new WebKitTestRunner
1745         function isStatisticsRegisteredAsSubresourceUnder().
1746
1747         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
1748         (WKWebsiteDataStoreIsStatisticsRegisteredAsSubresourceUnder):
1749         * UIProcess/API/C/WKWebsiteDataStoreRef.h:
1750         * UIProcess/ResourceLoadStatisticsMemoryStore.cpp:
1751         (WebKit::ResourceLoadStatisticsMemoryStore::isRegisteredAsSubresourceUnder const):
1752         * UIProcess/ResourceLoadStatisticsMemoryStore.h:
1753         * UIProcess/WebResourceLoadStatisticsStore.cpp:
1754         (WebKit::WebResourceLoadStatisticsStore::isRegisteredAsSubresourceUnder):
1755         * UIProcess/WebResourceLoadStatisticsStore.h:
1756
1757 2018-08-21  Daniel Bates  <dabates@apple.com>
1758
1759         Replace TextCheckingTypeMask with OptionSet
1760         https://bugs.webkit.org/show_bug.cgi?id=188678
1761
1762         Reviewed by Antti Koivisto.
1763
1764         * Scripts/webkit/messages.py: Add WebCore::TextCheckingType to the special case map so that
1765         the generator knows what header has the definition for this type.
1766         * Shared/WebCoreArgumentCoders.cpp:
1767         (IPC::ArgumentCoder<TextCheckingRequestData>::encode):
1768         (IPC::ArgumentCoder<TextCheckingRequestData>::decode):
1769         * UIProcess/Cocoa/WebViewImpl.mm:
1770         (WebKit::coreTextCheckingType):
1771         (WebKit::textCheckingResultFromNSTextCheckingResult):
1772         * UIProcess/TextChecker.h:
1773         * UIProcess/WebPageProxy.cpp:
1774         (WebKit::WebPageProxy::checkTextOfParagraph):
1775         * UIProcess/WebPageProxy.h:
1776         * UIProcess/WebPageProxy.messages.in:
1777         * UIProcess/gtk/TextCheckerGtk.cpp:
1778         (WebKit::TextChecker::requestCheckingOfString):
1779         (WebKit::TextChecker::checkTextOfParagraph): Also simplified return expressions.
1780         * UIProcess/ios/TextCheckerIOS.mm:
1781         (WebKit::TextChecker::checkTextOfParagraph):
1782         * UIProcess/mac/TextCheckerMac.mm:
1783         (WebKit::TextChecker::checkTextOfParagraph):
1784         * UIProcess/win/TextCheckerWin.cpp:
1785         (WebKit::TextChecker::checkTextOfParagraph):
1786         * WebProcess/WebCoreSupport/WebEditorClient.cpp:
1787         (WebKit::WebEditorClient::shouldEraseMarkersAfterChangeSelection const):
1788         (WebKit::WebEditorClient::checkTextOfParagraph):
1789         * WebProcess/WebCoreSupport/WebEditorClient.h:
1790
1791 2018-08-21  Adrian Perez de Castro  <aperez@igalia.com>
1792
1793         Unreviewed. Update OptionsWPE.cmake and NEWS for 2.21.91 release.
1794
1795         * wpe/NEWS: Add release notes for the 2.21.91 release.
1796
1797 2018-08-21  Commit Queue  <commit-queue@webkit.org>
1798
1799         Unreviewed, rolling out r234981.
1800         https://bugs.webkit.org/show_bug.cgi?id=188793
1801
1802         It was not the main cause of the high CPU usage in the end
1803         (Requested by KaL on #webkit).
1804
1805         Reverted changeset:
1806
1807         "Unreviewed, rolling out r234259."
1808         https://bugs.webkit.org/show_bug.cgi?id=188005
1809         https://trac.webkit.org/changeset/234981
1810
1811 2018-08-20  Michael Catanzaro  <mcatanzaro@igalia.com>
1812
1813         Use unified build for NetworkProcess
1814         https://bugs.webkit.org/show_bug.cgi?id=185011
1815
1816         Reviewed by Alex Christensen.
1817
1818         * NetworkProcess/Cookies/WebCookieManager.cpp:
1819         * NetworkProcess/Downloads/Download.cpp:
1820         * NetworkProcess/Downloads/DownloadManager.cpp:
1821         * NetworkProcess/Downloads/PendingDownload.cpp:
1822         * NetworkProcess/FileAPI/NetworkBlobRegistry.cpp:
1823         * NetworkProcess/NetworkCORSPreflightChecker.cpp:
1824         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
1825         * NetworkProcess/NetworkContentRuleListManager.cpp:
1826         * NetworkProcess/NetworkDataTask.cpp:
1827         * NetworkProcess/NetworkDataTaskBlob.cpp:
1828         * NetworkProcess/NetworkLoadChecker.cpp:
1829         * NetworkProcess/NetworkProcess.cpp:
1830         * NetworkProcess/NetworkProcessPlatformStrategies.cpp:
1831         * NetworkProcess/NetworkResourceLoadParameters.cpp:
1832         * NetworkProcess/NetworkResourceLoader.cpp:
1833         * NetworkProcess/NetworkSession.cpp:
1834         * NetworkProcess/NetworkSocketStream.cpp:
1835         * NetworkProcess/PingLoad.cpp:
1836         * NetworkProcess/cache/CacheStorageEngine.cpp:
1837         * NetworkProcess/cache/CacheStorageEngineCache.cpp:
1838         * NetworkProcess/cache/CacheStorageEngineCaches.cpp:
1839         * NetworkProcess/cache/CacheStorageEngineConnection.cpp:
1840         * NetworkProcess/cache/NetworkCache.cpp:
1841         * NetworkProcess/capture/NetworkCaptureEvent.cpp:
1842         * NetworkProcess/capture/NetworkCaptureManager.cpp:
1843         * NetworkProcess/capture/NetworkCaptureRecorder.cpp:
1844         * NetworkProcess/capture/NetworkCaptureReplayer.cpp:
1845         * NetworkProcess/capture/NetworkDataTaskReplay.cpp:
1846         * NetworkProcess/webrtc/NetworkMDNSRegister.cpp:
1847         * NetworkProcess/Downloads/cocoa/DownloadCocoa.mm:
1848         (WebKit::Download::platformCancelNetworkLoad):
1849         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
1850         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
1851         (-[WKNetworkSessionDelegate URLSession:didBecomeInvalidWithError:]):
1852         (-[WKNetworkSessionDelegate URLSession:dataTask:willCacheResponse:completionHandler:]):
1853         Fix the build with unified sources.
1854
1855         * Sources.txt: Un-@no-unify NetworkProcess/*.
1856         * SourcesCocoa.txt: Un-@no-unify NetworkProcess/*.
1857
1858 2018-08-20  Michael Catanzaro  <mcatanzaro@igalia.com>
1859
1860         [CMake] Sync unified build with Cocoa ports
1861         https://bugs.webkit.org/show_bug.cgi?id=188732
1862
1863         Reviewed by Tim Horton.
1864
1865         Sync unified build with Cocoa ports. This enables unified build for WebKit/Platform and
1866         WebKit/Shared.
1867
1868         Lots of files need to be moved around since the existing Sources.txt was not copied from
1869         CMakeLists.txt. This replaces the Sources.txt with the sources list from CMakeList.txt.
1870         Files that are not built for Cocoa are moved to SourcesGTK.txt, SourcesWPE.txt, and
1871         PlatformWin.cmake. Files that are built only on Cocoa are moved to SourcesCocoa.txt. There's
1872         plenty of room to determine if many of these files really need to be platform-specific in
1873         the future, but let's not change that now.
1874
1875         Unfortunately, several files under Shared and PluginProcess need to be un-unified to be
1876         usable for GTK's WebKitPluginProcess2. I've never managed to understand why, but it won't
1877         link otherwise. Fortunately, this only affects a few files (listed in
1878         PluginProcessGTK2_SOURCES), only a couple dozen of which are cross-platform.
1879
1880         * CMakeLists.txt:
1881         * PlatformWin.cmake:
1882         * Sources.txt:
1883         * SourcesCocoa.txt:
1884         * SourcesGTK.txt:
1885         * SourcesWPE.txt:
1886
1887 2018-08-20  Tim Horton  <timothy_horton@apple.com>
1888
1889         Fix the iOSMac build with unified sources
1890
1891         * Shared/mac/ArgumentCodersMac.mm:
1892         * Shared/mac/ChildProcessMac.mm:
1893         * Shared/mac/NativeWebKeyboardEventMac.mm:
1894
1895 2018-08-20  Eric Carlson  <eric.carlson@apple.com>
1896
1897         [MediaStream] Move capture device monitoring to WebKit
1898         https://bugs.webkit.org/show_bug.cgi?id=188521
1899         <rdar://problem/43251787>
1900
1901         Reviewed by Youenn Fablet.
1902
1903         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
1904         (WebKit::UserMediaPermissionRequestManagerProxy::captureDevicesChanged): Notify as appropriate.
1905         (WebKit::UserMediaPermissionRequestManagerProxy::viewIsBecomingVisible): Change name from
1906         viewIsBecomingVisible. Call captureDevicesChanged if a change happened when not visible.
1907         (WebKit::UserMediaPermissionRequestManagerProxy::watchdogTimerFired): Clear m_pendingDeviceChangeEvent.
1908         (WebKit::UserMediaPermissionRequestManagerProxy::processPregrantedRequests): Deleted.
1909         * UIProcess/UserMediaPermissionRequestManagerProxy.h:
1910
1911         * UIProcess/UserMediaProcessManager.cpp:
1912         (WebKit::UserMediaProcessManager::UserMediaProcessManager): Initialize timer.
1913         (WebKit::UserMediaProcessManager::captureDevicesChanged): New, notify each manager.
1914         (WebKit::UserMediaProcessManager::beginMonitoringCaptureDevices): Cache the device list and 
1915         register device change listener the first time it is called.
1916         * UIProcess/UserMediaProcessManager.h:
1917
1918         * UIProcess/WebPageProxy.cpp:
1919         (WebKit::WebPageProxy::viewIsBecomingVisible):
1920         (WebKit::WebPageProxy::beginMonitoringCaptureDevices):
1921         * UIProcess/WebPageProxy.h:
1922         * UIProcess/WebPageProxy.messages.in:
1923
1924         * WebProcess/MediaStream/UserMediaPermissionRequestManager.cpp:
1925         (WebKit::UserMediaPermissionRequestManager::addDeviceChangeObserver): Add listener, tell page
1926         to start monitoring device changes.
1927         (WebKit::UserMediaPermissionRequestManager::removeDeviceChangeObserver): Remove listener.
1928         (WebKit::UserMediaPermissionRequestManager::captureDevicesChanged): Call listeners.
1929         * WebProcess/MediaStream/UserMediaPermissionRequestManager.h:
1930
1931         * WebProcess/WebCoreSupport/WebUserMediaClient.cpp:
1932         (WebKit::WebUserMediaClient::addDeviceChangeObserver):
1933         (WebKit::WebUserMediaClient::removeDeviceChangeObserver):
1934         * WebProcess/WebCoreSupport/WebUserMediaClient.h:
1935
1936         * WebProcess/WebPage/WebPage.cpp:
1937         (WebKit::WebPage::captureDevicesChanged):
1938         * WebProcess/WebPage/WebPage.h:
1939         * WebProcess/WebPage/WebPage.messages.in:
1940
1941         * WebProcess/WebProcess.cpp:
1942         (WebKit::WebProcess::addMockMediaDevice):
1943         (WebKit::WebProcess::clearMockMediaDevices):
1944         (WebKit::WebProcess::removeMockMediaDevice):
1945         (WebKit::WebProcess::resetMockMediaDevices):
1946         (WebKit::WebProcess::captureDevicesChanged):
1947         * WebProcess/WebProcess.h:
1948
1949 2018-08-20  Carlos Garcia Campos  <cgarcia@igalia.com>
1950
1951         Unreviewed. Fix GTK/WPE cookie API tests after r234396.
1952
1953         * UIProcess/WebsiteData/WebsiteDataRecord.cpp:
1954         (WebKit::WebsiteDataRecord::displayNameForCookieHostName): Bring back the check to handle localhost as an
1955         special case for non cocoa ports.
1956
1957 2018-08-19  Darin Adler  <darin@apple.com>
1958
1959         [Cocoa] Update uses of wrapper template functions in WebKit for clarity, simplicity, better ARC readiness
1960         https://bugs.webkit.org/show_bug.cgi?id=188735
1961
1962         Reviewed by Dan Bernstein.
1963
1964         Because of argument-dependent lookup, there should never be a reason to call
1965         the wrapper function as WebKit::wrapper or API::wrapper unless there is a need
1966         to resolve a name conflict, so removed the explicit namespacing.
1967
1968         * UIProcess/API/C/mac/WKPagePrivateMac.mm:
1969         (WKPageLoadURLRequestReturningNavigation): Removed explicit null check and
1970         leakRef/autorelease pair, both done by the wrapper template function now.
1971
1972         * UIProcess/API/Cocoa/WKBackForwardList.mm:
1973         (toWKBackForwardListItem): Deleted.
1974         (-[WKBackForwardList currentItem]): Use wrapper instead of toWKBackForwardListItem.
1975         (-[WKBackForwardList backItem]): Ditto.
1976         (-[WKBackForwardList forwardItem]): Ditto.
1977         (-[WKBackForwardList itemAtIndex:]): Ditto.
1978         (-[WKBackForwardList backList]): Removed leakRef/autorelease pair.
1979         (-[WKBackForwardList forwardList]): Ditto.
1980
1981         * UIProcess/API/Cocoa/WKContentRuleListStore.mm:
1982         (+[WKContentRuleListStore defaultStore]): Removed explicit WebKit namespace.
1983         (+[WKContentRuleListStore storeWithURL:]): Fixed a storage leak by removing leakRef,
1984         which was not balanced. This is not a copy or create function, so it should not
1985         return an object that requires a release to balance it.
1986         (-[WKContentRuleListStore _compileContentRuleListForIdentifier:encodedContentRuleList:completionHandler:releasesArgument:]):
1987         Removed explicit WebKit namespace and unneeded get().
1988         (-[WKContentRuleListStore lookUpContentRuleListForIdentifier:completionHandler:]):
1989         Removed explicit WebKit namespace.
1990         (+[WKContentRuleListStore defaultStoreWithLegacyFilename]): Ditto.
1991         (+[WKContentRuleListStore storeWithURLAndLegacyFilename:]): Fixed storage leak,
1992         as above in storeWithURL.
1993
1994         * UIProcess/API/Cocoa/WKFrameInfo.mm:
1995         (-[WKFrameInfo _handle]): Removed explicit WebKit namespace.
1996         * UIProcess/API/Cocoa/WKHTTPCookieStore.mm:
1997         (WKHTTPCookieStoreObserver::cookiesDidChange): Ditto.
1998
1999         * UIProcess/API/Cocoa/WKNavigationAction.mm:
2000         (-[WKNavigationAction sourceFrame]): Removed explicit null check, now done by
2001         the wrapper template function.
2002         (-[WKNavigationAction targetFrame]): Ditto.
2003         (-[WKNavigationAction _userInitiatedAction]): Ditto.
2004         (-[WKNavigationAction _mainFrameNavigation]): Ditto.
2005
2006         * UIProcess/API/Cocoa/WKOpenPanelParameters.mm:
2007         (-[WKOpenPanelParameters _acceptedMIMETypes]): Removed leakRef/autorelease pair,
2008         now done by the wrapper template function.
2009         (-[WKOpenPanelParameters _acceptedFileExtensions]): Ditto.
2010
2011         * UIProcess/API/Cocoa/WKPreferences.mm:
2012         (-[WKPreferences copyWithZone:]): Use retain instead of leakRef; slightly clearer
2013         for when we convert to ARC.
2014         (+[WKPreferences _experimentalFeatures]): Removed leakRef/autorelease pair,
2015         now done by the wrapper template function.
2016
2017         * UIProcess/API/Cocoa/WKProcessPool.mm:
2018         (-[WKProcessPool _configuration]): Fixed a storage leak by removing leakRef,
2019         which was not balanced. This is not a copy or create function, so it should not
2020         return an object that requires a release to balance it.
2021
2022         * UIProcess/API/Cocoa/WKURLSchemeTaskInternal.h:
2023         Replaced inline wrapper function with WrapperTraits structure template specialization.
2024
2025         * UIProcess/API/Cocoa/WKUserScript.mm:
2026         (-[WKUserScript _userContentWorld]): Removed explicit API namespace.
2027
2028         * UIProcess/API/Cocoa/WKWebView.mm:
2029         (-[WKWebView loadRequest:]): Removed explicit null check and
2030         leakRef/autorelease pair, both done by the wrapper template function now.
2031         (-[WKWebView loadFileURL:allowingReadAccessToURL:]): Ditto.
2032         (-[WKWebView loadData:MIMEType:characterEncodingName:baseURL:]): Ditto.
2033         (-[WKWebView goToBackForwardListItem:]): Ditto.
2034         (-[WKWebView goBack]): Ditto.
2035         (-[WKWebView goForward]): Ditto.
2036         (-[WKWebView reload]): Ditto.
2037         (-[WKWebView reloadFromOrigin]): Ditto.
2038         (-[WKWebView _didInsertAttachment:withSource:]): Removed leakRef/autorelease pairs,
2039         now done by the wrapper template function.
2040         (-[WKWebView _didRemoveAttachment:]): Ditto.
2041         (-[WKWebView _loadData:MIMEType:characterEncodingName:baseURL:userData:]): Removed
2042         explicit null check and leakRef/autorelease pair, both done by the wrapper template
2043         function now.
2044         (-[WKWebView _loadRequest:shouldOpenExternalURLs:]): Ditto.
2045         (-[WKWebView _reloadWithoutContentBlockers]): Ditto.
2046         (-[WKWebView _reloadExpiredOnly]): Ditto.
2047         (-[WKWebView _sessionStateData]): Removed explicit leakRef/autorelease pair, done
2048         by the wrapper template function now. Also, the old version explicitly dereferenced
2049         and would not work when the result of encodeLegacySessionState was null. Decided
2050         not to add a call to releaseNonNull to preserve that possibly-incorrect optimization,
2051         instead allowing the wrapper function to generate code to handle the null case.
2052         (-[WKWebView _sessionState]): Use the Objective-C autorelease instead of adoptNS
2053         and RetainPtr's autorelease.
2054         (-[WKWebView _sessionStateWithFilter:]): Ditto.
2055         (-[WKWebView _restoreSessionState:andNavigate:]): Removed explicit null check and
2056         leakRef/autorelease pair, both done by the wrapper template function now.
2057         (-[WKWebView _insertAttachmentWithFilename:contentType:data:options:completion:]):
2058         Removed explicit leakRef/autorelease pair, done by the wrapper template function now.
2059         (-[WKWebView _diagnosticLoggingDelegate]): Replaced a leakRef/autorelease pair with
2060         use of RetainPtr's autorelease.
2061         (-[WKWebView _findDelegate]): Ditto.
2062
2063         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
2064         (-[WKWebViewConfiguration _applicationManifest]): Removed explicit null check,
2065         done by the wrapper template function now.
2066
2067         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
2068         (+[WKWebsiteDataStore defaultDataStore]): Removed explicit WebKit namespace
2069         and unneeded call to get().
2070         (+[WKWebsiteDataStore nonPersistentDataStore]): Removed explicit WebKit namespace
2071         and leakRef/autorelease pair, done by the wrapper template function now.
2072         (-[WKWebsiteDataStore httpCookieStore]): Removed explicit WebKit namespace.
2073
2074         * UIProcess/API/Cocoa/_WKApplicationManifest.mm:
2075         (+[_WKApplicationManifest applicationManifestFromJSON:manifestURL:documentURL:]):
2076         Removed explicit leakRef/autorelease pair, done by the wrapper template function now.
2077         * UIProcess/API/Cocoa/_WKGeolocationPosition.mm:
2078         (WebKit::wrapper): Ditto.
2079
2080         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
2081         (-[_WKProcessPoolConfiguration copyWithZone:]): Use retain instead of leakRef;
2082         slightly clearer for when we convert to ARC.
2083
2084         * UIProcess/API/Cocoa/_WKUserContentWorld.mm:
2085         (+[_WKUserContentWorld worldWithName:]): Removed explicit leakRef/autorelease pair,
2086         done by the wrapper template function now.
2087
2088         * UIProcess/API/Cocoa/_WKWebsitePolicies.mm:
2089         (-[_WKWebsitePolicies websiteDataStore]): Removed explicit null check, done by
2090         the wrapper template function now.
2091
2092         * UIProcess/Cocoa/NavigationState.mm:
2093         (WebKit::NavigationState::NavigationClient::didChangeBackForwardList): Removed
2094         explicit null check, done by the wrapper template function now.
2095         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction): Ditto.
2096         (WebKit::NavigationState::NavigationClient::didStartProvisionalNavigation): Ditto.
2097         (WebKit::NavigationState::NavigationClient::didReceiveServerRedirectForProvisionalNavigation): Ditto.
2098         (WebKit::NavigationState::NavigationClient::didFailProvisionalNavigationWithError): Ditto.
2099         (WebKit::NavigationState::NavigationClient::didFailProvisionalLoadInSubframeWithError): Ditto.
2100         (WebKit::NavigationState::NavigationClient::didCommitNavigation): Ditto.
2101         (WebKit::NavigationState::NavigationClient::didFinishDocumentLoad): Ditto.
2102         (WebKit::NavigationState::NavigationClient::didFinishNavigation): Ditto.
2103         (WebKit::NavigationState::NavigationClient::didFailNavigationWithError): Ditto.
2104         (WebKit::NavigationState::NavigationClient::didSameDocumentNavigation): Ditto.
2105
2106         * UIProcess/Cocoa/SessionStateCoding.mm:
2107         (WebKit::encodeSessionState): Removed explicit leakRef/autorelease pair, done
2108         by the wrapper template function now. Also, the old version explicitly dereferenced
2109         and would not work when the result of encodeLegacySessionState was null. Decided
2110         not to add a call to releaseNonNull to preserve that possibly-incorrect optimization,
2111         instead allowing the wrapper function to generate code to handle the null case.
2112
2113         * UIProcess/mac/WKInspectorViewController.mm:
2114         (-[WKInspectorViewController configuration]): Removed explicit WebKit namespace.
2115
2116         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInFrame.mm:
2117         (+[WKWebProcessPlugInFrame lookUpFrameFromHandle:]): Removed explicit null check,
2118         done by the wrapper template function now.
2119         (-[WKWebProcessPlugInFrame hitTest:]): Removed explicit leakRef/autorelease pair, done
2120         by the wrapper template function now. Also, the old version explicitly dereferenced
2121         and would not work when the result of hitTest was null. Decided not to add a call to
2122         releaseNonNull to preserve that possibly-incorrect optimization, instead allowing the
2123         wrapper function to generate code to handle the null case.
2124         (-[WKWebProcessPlugInFrame childFrames]): Removed explicit leakRef/autorelease pair,
2125         done by the wrapper template function now.
2126         (-[WKWebProcessPlugInFrame handle]): Ditto.
2127         (-[WKWebProcessPlugInFrame _parentFrame]): Removed explicit null check, done by the
2128         wrapper template function now.
2129
2130         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInHitTestResult.mm:
2131         (-[WKWebProcessPlugInHitTestResult nodeHandle]): Removed explicit null check and
2132         leakRef/autorelease pair, both done by the wrapper template function now.
2133         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandle.mm:
2134         (+[WKWebProcessPlugInNodeHandle nodeHandleWithJSValue:inContext:]): Ditto.
2135         (-[WKWebProcessPlugInNodeHandle htmlIFrameElementContentFrame]): Ditto.
2136         (-[WKWebProcessPlugInNodeHandle HTMLTableCellElementCellAbove]): Ditto.
2137         (-[WKWebProcessPlugInNodeHandle frame]): Ditto.
2138         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInRangeHandle.mm:
2139         (+[WKWebProcessPlugInRangeHandle rangeHandleWithJSValue:inContext:]): Ditto.
2140         (-[WKWebProcessPlugInRangeHandle frame]): Ditto.
2141         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInScriptWorld.mm:
2142         (+[WKWebProcessPlugInScriptWorld world]): Ditto.
2143         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:
2144         (-[WKWebProcessPlugInBrowserContextController mainFrame]): Ditto.
2145         (+[WKWebProcessPlugInBrowserContextController lookUpBrowsingContextFromHandle:]): Ditto.
2146
2147 2018-08-19  Darin Adler  <darin@apple.com>
2148
2149         [Cocoa] Consolidate inline "wrapper" functions in WebKit API into function templates and WrapperTraits
2150         https://bugs.webkit.org/show_bug.cgi?id=188733
2151
2152         Reviewed by Sam Weinig.
2153
2154         Replaced all the different functions named "wrapper" that were all boilerplate doing Objective-C
2155         casts with WrapperTraits specializations. The only thing about this that was at all tricky was
2156         the loose mixing of the WebKit namespace, the API namespace, and the global namespace. My choice
2157         for this first step was to put WrapperTraits into the WebKit namespace and to put the wrapper
2158         function into both the WebKit and API namespaces with "using". This turned out pretty clean: did
2159         not have to touch any of the code calling wrapper just to make things work, although we can now
2160         clean up by changing call sites to get rid of unnecessary explicit use of leakRef and autorelease.
2161         Doing this will make ARC conversion practical and easy, which is the motivation behind pursuing
2162         this set of changes.
2163
2164         * Shared/Cocoa/WKObject.h: Tweaked style of the ObjectStorage structure template,
2165         using a class name instead of "T". Added WrapperTraits structure template, checkedObjCCast
2166         function template, and multiple wrapper functions templates that take a variety of pointer,
2167         reference, smart pointer, and smart reference types, and return the wrapper for each one,
2168         handling object lifetime appropriately.
2169
2170         * Shared/API/Cocoa/_WKFrameHandleInternal.h:
2171         * Shared/API/Cocoa/_WKHitTestResultInternal.h:
2172         * Shared/Cocoa/WKNSArray.h:
2173         * Shared/Cocoa/WKNSData.h:
2174         * Shared/Cocoa/WKNSDictionary.h:
2175         * Shared/Cocoa/WKNSError.h:
2176         * Shared/Cocoa/WKNSNumber.h:
2177         * Shared/Cocoa/WKNSString.h:
2178         * Shared/Cocoa/WKNSURL.h:
2179         * Shared/Cocoa/WKNSURLRequest.h:
2180         * UIProcess/API/Cocoa/WKBackForwardListInternal.h:
2181         * UIProcess/API/Cocoa/WKBackForwardListItemInternal.h:
2182         * UIProcess/API/Cocoa/WKBrowsingContextGroupInternal.h:
2183         * UIProcess/API/Cocoa/WKConnectionInternal.h:
2184         * UIProcess/API/Cocoa/WKContentRuleListInternal.h:
2185         * UIProcess/API/Cocoa/WKContentRuleListStoreInternal.h:
2186         * UIProcess/API/Cocoa/WKFrameInfoInternal.h:
2187         * UIProcess/API/Cocoa/WKHTTPCookieStoreInternal.h:
2188         * UIProcess/API/Cocoa/WKNSURLAuthenticationChallenge.h:
2189         * UIProcess/API/Cocoa/WKNavigationActionInternal.h:
2190         * UIProcess/API/Cocoa/WKNavigationDataInternal.h:
2191         * UIProcess/API/Cocoa/WKNavigationInternal.h:
2192         * UIProcess/API/Cocoa/WKNavigationResponseInternal.h:
2193         * UIProcess/API/Cocoa/WKOpenPanelParametersInternal.h:
2194         * UIProcess/API/Cocoa/WKPreferencesInternal.h:
2195         * UIProcess/API/Cocoa/WKProcessPoolInternal.h:
2196         * UIProcess/API/Cocoa/WKSecurityOriginInternal.h:
2197         * UIProcess/API/Cocoa/WKUserContentControllerInternal.h:
2198         * UIProcess/API/Cocoa/WKUserScriptInternal.h:
2199         * UIProcess/API/Cocoa/WKWebsiteDataRecordInternal.h:
2200         * UIProcess/API/Cocoa/WKWebsiteDataStoreInternal.h:
2201         * UIProcess/API/Cocoa/WKWindowFeaturesInternal.h:
2202         * UIProcess/API/Cocoa/_WKApplicationManifestInternal.h:
2203         * UIProcess/API/Cocoa/_WKAttachmentInternal.h:
2204         * UIProcess/API/Cocoa/_WKAutomationSessionInternal.h:
2205         * UIProcess/API/Cocoa/_WKExperimentalFeatureInternal.h:
2206         * UIProcess/API/Cocoa/_WKGeolocationPositionInternal.h:
2207         * UIProcess/API/Cocoa/_WKProcessPoolConfigurationInternal.h:
2208         * UIProcess/API/Cocoa/_WKUserContentWorldInternal.h:
2209         * UIProcess/API/Cocoa/_WKUserInitiatedActionInternal.h:
2210         * UIProcess/API/Cocoa/_WKUserStyleSheetInternal.h:
2211         * UIProcess/API/Cocoa/_WKVisitedLinkStoreInternal.h:
2212         * UIProcess/API/Cocoa/_WKWebsitePoliciesInternal.h:
2213         * UIProcess/Cocoa/DownloadClient.mm:
2214         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInFrameInternal.h:
2215         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInHitTestResultInternal.h:
2216         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandleInternal.h:
2217         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInPageGroupInternal.h:
2218         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInRangeHandleInternal.h:
2219         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInScriptWorldInternal.h:
2220         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextControllerInternal.h:
2221         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInInternal.h:
2222         Replaced inline wrapper functions with WrapperTraits structure template
2223         specializations. This is always in the WebKit namespace, unlike the functions,
2224         which were in a mix of namespaces. Also deleted some unneeded "#pragma once".
2225
2226 2018-08-19  David Kilzer  <ddkilzer@apple.com>
2227
2228         REGRESSION (r234396): Leak of CFURLRef in WebKit::NetworkProcess::deleteHSTSCacheForHostNames()
2229         <https://webkit.org/b/188725>
2230
2231         Reviewed by Dan Bernstein.
2232
2233         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
2234         (WebKit::NetworkProcess::deleteHSTSCacheForHostNames): Use
2235         adoptCF() to prevent a leak.
2236
2237 2018-08-18  Andy Estes  <aestes@apple.com>
2238
2239         [watchOS] NetworkProximityManager should use WTF_MAKE_FAST_ALLOCATED
2240         https://bugs.webkit.org/show_bug.cgi?id=188723
2241
2242         Reviewed by Sam Weinig.
2243
2244         * NetworkProcess/watchos/NetworkProximityManager.h:
2245
2246 2018-08-18  Andy Estes  <aestes@apple.com>
2247
2248         [watchOS] Add more assertions to NetworkProximityAssertion
2249         https://bugs.webkit.org/show_bug.cgi?id=188721
2250
2251         Reviewed by Wenson Hsieh.
2252
2253         * NetworkProcess/watchos/NetworkProximityAssertion.mm:
2254         (WebKit::NetworkProximityAssertion::hold):
2255         (WebKit::NetworkProximityAssertion::release):
2256         (WebKit::NetworkProximityAssertion::releaseTimerFired):
2257
2258 2018-08-18  Wenson Hsieh  <wenson_hsieh@apple.com>
2259
2260         [iOS] Paste is missing from callout bar when pasteboard only contains custom data
2261         https://bugs.webkit.org/show_bug.cgi?id=184271
2262         <rdar://problem/39256708>
2263
2264         Reviewed by Ryosuke Niwa.
2265
2266         Currently, the "paste:" selector action cannot be performed during editing if the pasteboard only contains
2267         custom pasteboard data. This is because logic in -[WKContentView canPerformActionForWebView:withSender:] only
2268         checks against a list of pasteboard types which does not include the type identifier for custom pasteboard data.
2269         To fix this, we allow pasting only in the case where none of the other type identifiers exist in the pasteboard,
2270         as long as the custom pasteboard data type identifier is present, and the custom pasteboard data's origin
2271         matches the origin of the focused frame's document.
2272
2273         Test: PasteMixedContent.CopyAndPasteWithCustomPasteboardDataOnly
2274
2275         * Shared/EditorState.cpp:
2276         (WebKit::EditorState::encode const):
2277         (WebKit::EditorState::decode):
2278         * Shared/EditorState.h:
2279
2280         Add a originIdentifierForPasteboard field, and add support for encoding it when propagating EditorState via IPC.
2281
2282         * UIProcess/ios/WKContentViewInteraction.mm:
2283         (-[WKContentView canPerformActionForWebView:withSender:]):
2284
2285         If none of the conventional pasteboard type identifiers for rich or plain text editing are present, check to see
2286         if we have custom pasteboard data; if so, only allow pasting if the custom pasteboard data's origin matches that
2287         of the focused frame's document origin.
2288
2289         Additionally refactor a bit of logic by pulling out `_page->editorState()` into a separate local variable, used
2290         throughout the rest of the method.
2291
2292         * WebProcess/WebPage/WebPage.cpp:
2293         (WebKit::WebPage::editorState const):
2294
2295         Send the focused frame's document origin to the UI process via EditorState.
2296
2297 2018-08-17  Tim Horton  <timothy_horton@apple.com>
2298
2299         Start bringing up Unified Sources in WebKit2
2300         https://bugs.webkit.org/show_bug.cgi?id=188703
2301
2302         Reviewed by Simon Fraser.
2303
2304         * Configurations/BaseTarget.xcconfig:
2305         Add SRCROOT to the include path, so unified sources can find the source files.
2306
2307         * Shared/APIWebArchive.mm:
2308         (API::releaseWebArchiveData):
2309         (API::WebArchive::data):
2310         (API::releaseCFData): Deleted.
2311         * Shared/APIWebArchiveResource.mm:
2312         (API::releaseWebArchiveResourceData):
2313         (API::WebArchiveResource::data):
2314         (API::releaseCFData): Deleted.
2315         Disambiguate two static methods by renaming them.
2316
2317         * Shared/cf/ArgumentCodersCF.cpp:
2318         Leave a comment about the bizarreness of this file.
2319
2320         * Shared/NavigationActionData.cpp:
2321         (WebKit::NavigationActionData::decode):
2322         * Shared/WebPlatformTouchPoint.cpp:
2323         * Shared/WebPopupItem.cpp:
2324         (WebKit::WebPopupItem::WebPopupItem):
2325         (WebKit::WebPopupItem::decode):
2326         * Shared/WebPreferencesStore.cpp:
2327         * Shared/WebRenderLayer.cpp:
2328         (WebKit::WebRenderLayer::create):
2329         (WebKit::WebRenderLayer::createArrayFromLayerList):
2330         (WebKit::WebRenderLayer::WebRenderLayer):
2331         * Shared/gtk/WebEventFactory.cpp:
2332         * Shared/mac/WebCoreArgumentCodersMac.mm:
2333         * Shared/mac/WebEventFactory.mm:
2334         (WebKit::WebEventFactory::createWebMouseEvent):
2335         (WebKit::WebEventFactory::createWebWheelEvent):
2336         (WebKit::WebEventFactory::createWebKeyboardEvent):
2337         * Shared/mac/WebMemorySampler.mac.mm:
2338         (WebKit::WebMemorySampler::sampleWebKit const):
2339         * UIProcess/API/APIAutomationSessionClient.h:
2340         (API::AutomationSessionClient::sessionIdentifier const):
2341         (API::AutomationSessionClient::messageOfCurrentJavaScriptDialogOnPage):
2342         * Shared/RemoteLayerTree/RemoteLayerBackingStore.mm:
2343         (WebKit::RemoteLayerBackingStore::ensureBackingStore):
2344         (WebKit::RemoteLayerBackingStore::setNeedsDisplay):
2345         (WebKit::RemoteLayerBackingStore::backingStoreSize const):
2346         (WebKit::RemoteLayerBackingStore::swapToValidFrontBuffer):
2347         (WebKit::RemoteLayerBackingStore::display):
2348         (WebKit::RemoteLayerBackingStore::drawInContext):
2349         (WebKit::RemoteLayerBackingStore::applyBackingStoreToLayer):
2350         * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm:
2351         (WebKit::RemoteLayerTreeTransaction::LayerCreationProperties::LayerCreationProperties):
2352         (WebKit::RemoteLayerTreeTransaction::LayerProperties::LayerProperties):
2353         (WebKit::RemoteLayerTreeTransaction::LayerProperties::decode):
2354         (WebKit::RemoteLayerTreeTransaction::decode):
2355         (WebKit::RemoteLayerTreeTransaction::setRootLayerID):
2356         (WebKit::RemoteLayerTreeTransaction::setDestroyedLayerIDs):
2357         (WebKit::RemoteLayerTreeTransaction::setLayerIDsWithNewlyUnreachableBackingStore):
2358         (WebKit::dumpChangedLayers):
2359         (WebKit::RemoteLayerTreeTransaction::description const):
2360         * Shared/WebPlatformTouchPoint.cpp:
2361         (WebKit::WebPlatformTouchPoint::WebPlatformTouchPoint):
2362         Get rid of lots of `using namespace`.
2363
2364         * Sources.txt: Added.
2365         * SourcesCocoa.txt: Added.
2366         * WebKit.xcodeproj/project.pbxproj:
2367         Set up unified sources.
2368         Right now, we only unify Platform/ and Shared/[^API].
2369
2370 2018-08-17  Aditya Keerthi  <akeerthi@apple.com>
2371
2372         [Datalist][iOS] Display suggestions for input[type=color]
2373         https://bugs.webkit.org/show_bug.cgi?id=188669
2374
2375         Reviewed by Tim Horton.
2376
2377         An input[type=color] element that has an associated datalist element should
2378         display the color values provided on iOS. Similar to macOS, we now support 1-12
2379         suggested colors, that will be displayed at the top of the color picker.
2380
2381         Also ensured that we get rounded corners on both sides of a color swatch if it is
2382         the only one in its row.
2383
2384         * Shared/AssistedNodeInformation.cpp: Added suggestedColors field.
2385         (WebKit::AssistedNodeInformation::encode const):
2386         (WebKit::AssistedNodeInformation::decode):
2387         * Shared/AssistedNodeInformation.h:
2388         * UIProcess/ios/forms/WKFormColorPicker.mm:
2389         (+[WKColorPicker defaultTopColorMatrix]):
2390         (-[WKColorPicker initWithView:]): Use the list of suggestedColors if it exists.
2391         (-[WKColorPicker drawSelectionIndicatorForColorButton:]):
2392         * WebProcess/WebCoreSupport/WebColorChooser.cpp:
2393         (WebKit::WebColorChooser::WebColorChooser):
2394         (WebKit::WebColorChooser::reattachColorChooser):
2395         * WebProcess/WebPage/ios/WebPageIOS.mm:
2396         (WebKit::WebPage::getAssistedNodeInformation):
2397
2398 2018-08-17  Ryan Haddad  <ryanhaddad@apple.com>
2399
2400         Unreviewed, rolling out r234991.
2401
2402         Caused an assertion failure on the bots.
2403
2404         Reverted changeset:
2405
2406         "Pass webPageID and webFrameID to NetworkLoad for speculative
2407         loads"
2408         https://bugs.webkit.org/show_bug.cgi?id=188682
2409         https://trac.webkit.org/changeset/234991
2410
2411 2018-08-17  Alex Christensen  <achristensen@webkit.org>
2412
2413         Add some plumbing for safe browsing
2414         https://bugs.webkit.org/show_bug.cgi?id=188709
2415
2416         Reviewed by Tim Horton.
2417
2418         Also adding a URL to SafeBrowsingResult because we'll need it.
2419         Also adding a bool to LoadParameters because we will need to do special things
2420         when loading the safe browsing warning, like adding a way to skip the safe browsing check.
2421
2422         * Shared/LoadParameters.cpp:
2423         (WebKit::LoadParameters::encode const):
2424         (WebKit::LoadParameters::decode):
2425         * Shared/LoadParameters.h:
2426         * UIProcess/Cocoa/SafeBrowsingResultCocoa.mm:
2427         (WebKit::SafeBrowsingResult::SafeBrowsingResult):
2428         * UIProcess/Cocoa/WebPageProxyCocoa.mm:
2429         (WebKit::WebPageProxy::beginSafeBrowsingCheck):
2430         * UIProcess/SafeBrowsingResult.h:
2431         (WebKit::SafeBrowsingResult::url const):
2432         * UIProcess/WebPageProxy.cpp:
2433         (WebKit::WebPageProxy::loadAlternateHTML):
2434         (WebKit::WebPageProxy::decidePolicyForNavigationActionAsync):
2435         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
2436         (WebKit::WebPageProxy::decidePolicyForNavigationActionSync):
2437         * UIProcess/WebPageProxy.h:
2438         * UIProcess/WebPageProxy.messages.in:
2439         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
2440         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
2441         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
2442
2443 2018-08-16  Ryosuke Niwa  <rniwa@webkit.org>
2444
2445         Replace canBubble and cancelable booleans in Event by enum classes
2446         https://bugs.webkit.org/show_bug.cgi?id=188692
2447
2448         Reviewed by Alex Christensen.
2449
2450         * WebProcess/WebPage/WebPage.cpp:
2451         (WebKit::WebPage::navigateToPDFLinkWithSimulatedClick):
2452
2453 2018-08-17  Andy Estes  <aestes@apple.com>
2454
2455         [Xcode] Fix up file reference paths in Source/WebKit/NetworkProcess
2456         https://bugs.webkit.org/show_bug.cgi?id=188700
2457
2458         Rubber-stamped by Dan Bernstein.
2459
2460         * WebKit.xcodeproj/project.pbxproj:
2461
2462 2018-08-17  Alex Christensen  <achristensen@webkit.org>
2463
2464         Pass webPageID and webFrameID to NetworkLoad for speculative loads
2465         https://bugs.webkit.org/show_bug.cgi?id=188682
2466
2467         Reviewed by Youenn Fablet.
2468
2469         This also removes an authentication shortcut I introduced in r234941
2470
2471         * NetworkProcess/cache/NetworkCacheSpeculativeLoad.cpp:
2472         (WebKit::NetworkCache::SpeculativeLoad::SpeculativeLoad):
2473         (WebKit::NetworkCache::SpeculativeLoad::didReceiveResponse):
2474         * Shared/Authentication/AuthenticationManager.cpp:
2475         (WebKit::AuthenticationManager::didReceiveAuthenticationChallenge):
2476
2477 2018-08-17  Alex Christensen  <achristensen@webkit.org>
2478
2479         Simplify server trust authentication flow
2480         https://bugs.webkit.org/show_bug.cgi?id=188684
2481
2482         Reviewed by Youenn Fablet.
2483
2484         We unnecessarily had the allowsSpecificHTTPSCertificateForHost check at two different abstraction levels.
2485
2486         * NetworkProcess/NetworkLoad.cpp:
2487         (WebKit::NetworkLoad::didReceiveChallenge):
2488         * NetworkProcess/NetworkSession.cpp:
2489         (WebKit::NetworkSession::allowsSpecificHTTPSCertificateForHost): Deleted.
2490         * NetworkProcess/NetworkSession.h:
2491         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
2492         (-[WKNetworkSessionDelegate URLSession:task:didReceiveChallenge:completionHandler:]):
2493
2494 2018-08-17  Alex Christensen  <achristensen@webkit.org>
2495
2496         Fix API tests after r234985
2497         https://bugs.webkit.org/show_bug.cgi?id=188679
2498
2499         * UIProcess/API/C/WKPage.cpp:
2500         (encodingOf):
2501         (dataFrom):
2502         The encoding of null strings had changed, which is no big deal because there's no data in that encoding,
2503         but switching it back fixes the tests.
2504
2505 2018-08-17  Alex Christensen  <achristensen@webkit.org>
2506
2507         Replace WebPageProxy::loadAlternateHTMLString with loadAlternateHTML
2508         https://bugs.webkit.org/show_bug.cgi?id=188679
2509
2510         Reviewed by Carlos Garcia Campos.
2511
2512         * Shared/LoadParameters.cpp:
2513         (WebKit::LoadParameters::encode const):
2514         (WebKit::LoadParameters::decode):
2515         * Shared/LoadParameters.h:
2516         * UIProcess/API/C/WKPage.cpp:
2517         (encodingOf):
2518         (dataFrom):
2519         (loadString):
2520         (WKPageLoadAlternateHTMLString):
2521         (WKPageLoadAlternateHTMLStringWithUserData):
2522         * UIProcess/API/Cocoa/WKBrowsingContextController.mm:
2523         (-[WKBrowsingContextController loadAlternateHTMLString:baseURL:forUnreachableURL:]):
2524         * UIProcess/API/Cocoa/WKWebView.mm:
2525         (-[WKWebView _loadAlternateHTMLString:baseURL:forUnreachableURL:]):
2526         * UIProcess/WebPageProxy.cpp:
2527         (WebKit::WebPageProxy::loadAlternateHTML):
2528         (WebKit::WebPageProxy::loadAlternateHTMLString): Deleted.
2529         * UIProcess/WebPageProxy.h:
2530         * WebProcess/WebPage/WebPage.cpp:
2531         (WebKit::WebPage::loadAlternateHTMLString):
2532
2533 2018-08-17  Michael Catanzaro  <mcatanzaro@igalia.com>
2534
2535         Unreviewed, rolling out r234259.
2536
2537         Caused excessive CPU usage
2538
2539         Reverted changeset:
2540
2541         "[GTK][WPE] Improve the way request displayRefresh
2542         notifications"
2543         https://bugs.webkit.org/show_bug.cgi?id=188005
2544         https://trac.webkit.org/changeset/234259
2545
2546 2018-08-16  Commit Queue  <commit-queue@webkit.org>
2547
2548         Unreviewed, rolling out r234958.
2549         https://bugs.webkit.org/show_bug.cgi?id=188683
2550
2551         Breaking builds due to copy failure (Requested by brichards on
2552         #webkit).
2553
2554         Reverted changeset:
2555
2556         "Add script to generate WebContent service resource files"
2557         https://bugs.webkit.org/show_bug.cgi?id=188601
2558         https://trac.webkit.org/changeset/234958
2559
2560 2018-08-16  Sihui Liu  <sihui_liu@apple.com>
2561
2562         Remove unused parentProcessName from NetworkProcessCreationParameters
2563         https://bugs.webkit.org/show_bug.cgi?id=188618
2564
2565         Reviewed by Alex Christensen.
2566
2567         * NetworkProcess/NetworkProcessCreationParameters.cpp:
2568         (WebKit::NetworkProcessCreationParameters::encode const):
2569         (WebKit::NetworkProcessCreationParameters::decode):
2570         * NetworkProcess/NetworkProcessCreationParameters.h:
2571         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
2572         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
2573
2574 2018-08-16  Andy Estes  <aestes@apple.com>
2575
2576         [watchOS] Upstream Proximity Networking (nee Wi-Fi Assertions)
2577         https://bugs.webkit.org/show_bug.cgi?id=188664
2578
2579         Reviewed by Tim Horton.
2580
2581         Proximity Networking provides two features for speeding up page loads on watchOS:
2582
2583         1. Binding requests to the Apple Watch's Wi-Fi interface even when the iPhone is in proximity.
2584         2. When Wi-Fi isn't available, preemptively upgrading the Bluetooth link to its fastest data
2585         rate prior to starting page loads.
2586
2587         * Configurations/WebKit.xcconfig:
2588
2589         Added LDFLAGS for Proximity Networking.
2590
2591         * NetworkProcess/NetworkProcess.cpp:
2592         (WebKit::NetworkProcess::NetworkProcess):
2593         (WebKit::NetworkProcess::proximityManager):
2594         * NetworkProcess/NetworkProcess.h:
2595
2596         Added NetworkProximityManager as a supplement.
2597
2598         * NetworkProcess/NetworkProcessCreationParameters.cpp:
2599         (WebKit::NetworkProcessCreationParameters::encode const):
2600         (WebKit::NetworkProcessCreationParameters::decode):
2601         * NetworkProcess/NetworkProcessCreationParameters.h:
2602
2603         Renamed ENABLE(WIFI_ASSERTIONS) to ENABLE(PROXIMITY_NETWORKING).
2604
2605         * NetworkProcess/cocoa/NetworkDataTaskCocoa.h:
2606
2607         Renamed m_wiFiAssertionHolder to m_proximityAssertionToken and changed its type from an
2608         optional WiFiAssertionHolder to an optional NetworkProximityAssertion::Token.
2609
2610         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
2611         (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa):
2612         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
2613         (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa):
2614         (WebKit::NetworkProcess::platformPrepareToSuspend):
2615         (WebKit::NetworkProcess::platformProcessDidResume):
2616         (WebKit::NetworkProcess::platformProcessDidTransitionToBackground):
2617         (WebKit::NetworkProcess::platformProcessDidTransitionToForeground):
2618
2619         Changed to use NetworkProximityManager.
2620
2621         * NetworkProcess/cocoa/WiFiAssertionHolder.h: Removed.
2622         * NetworkProcess/cocoa/WiFiAssertionHolder.mm: Removed.
2623         * NetworkProcess/watchos/NetworkProximityAssertion.h: Added.
2624         (WebKit::NetworkProximityAssertion::Token::Token):
2625         (WebKit::NetworkProximityAssertion::Token::~Token):
2626
2627         Added. NetworkDataTasks hold these tokens to keep Bluetooth or Wi-Fi assertions active
2628         during loading. When the last token is destroyed, its associated assertion will be
2629         deactivated.
2630
2631         * NetworkProcess/watchos/NetworkProximityAssertion.mm: Added.
2632         (WebKit::NetworkProximityAssertion::NetworkProximityAssertion):
2633         (WebKit::NetworkProximityAssertion::hold):
2634         (WebKit::NetworkProximityAssertion::release):
2635         (WebKit::NetworkProximityAssertion::resume):
2636         (WebKit::NetworkProximityAssertion::suspend):
2637         (WebKit::NetworkProximityAssertion::suspendNow):
2638         (WebKit::NetworkProximityAssertion::releaseTimerFired):
2639         (WebKit::NetworkProximityAssertion::suspendAfterBackgroundingTimerFired):
2640
2641         Added. NetworkProximityAssertion is the base class for Bluetooth and Wi-Fi assertions. It
2642         manages the logic for holding and releasing assertions as well as responding to network
2643         process backgrounding and suspension.
2644
2645         (WebKit::BluetoothProximityAssertion::BluetoothProximityAssertion):
2646         (WebKit::BluetoothProximityAssertion::suspend):
2647         (WebKit::BluetoothProximityAssertion::holdNow):
2648         (WebKit::BluetoothProximityAssertion::releaseNow):
2649
2650         Added. Holds a Bluetooth assertion by calling -[IDSService setLinkPreferences:].
2651
2652         (WebKit::WiFiProximityAssertion::WiFiProximityAssertion):
2653         (WebKit::WiFiProximityAssertion::holdNow):
2654         (WebKit::WiFiProximityAssertion::releaseNow):
2655
2656         Added. Holds a Wi-Fi assertion by using WiFiManagerClient.
2657
2658         * NetworkProcess/watchos/NetworkProximityManager.h: Added.
2659         * NetworkProcess/watchos/NetworkProximityManager.mm: Added.
2660         (-[WKProximityServiceDelegate setClient:]):
2661         (-[WKProximityServiceDelegate service:devicesChanged:]):
2662         (-[WKProximityServiceDelegate service:nearbyDevicesChanged:]):
2663         (WebKit::NetworkProximityManager::NetworkProximityManager):
2664         (WebKit::NetworkProximityManager::~NetworkProximityManager):
2665         (WebKit::NetworkProximityManager::supplementName):
2666         (WebKit::bindRequestToWiFi):
2667         (WebKit::NetworkProximityManager::applyProperties):
2668         (WebKit::NetworkProximityManager::resume):
2669         (WebKit::NetworkProximityManager::suspend):
2670         (WebKit::NetworkProximityManager::recommendation const):
2671         (WebKit::NetworkProximityManager::processRecommendations):
2672         (WebKit::toProcessID):
2673         (WebKit::NetworkProximityManager::resumeRecommendations):
2674         (WebKit::NetworkProximityManager::suspendRecommendations):
2675         (WebKit::NetworkProximityManager::updateCompanionProximity):
2676         (WebKit::NetworkProximityManager::updateRecommendation):
2677         (WebKit::NetworkProximityManager::initialize):
2678         (WebKit::NetworkProximityManager::devicesChanged):
2679
2680         Added. NetworkProximityManager is a network process supplement that can bind
2681         NetworkDataTasks to Wi-Fi, associate assertions with NetworkDataTasks, check for companion
2682         proximity, ask for proximity network recommendations, and respond to network process
2683         backgrounding and suspending.
2684
2685         * Platform/Logging.h:
2686
2687         Renamed the WiFiAssertions log channel to ProximityNetworking.
2688
2689         * Platform/spi/ios/MobileWiFiSPI.h:
2690         * UIProcess/API/APIProcessPoolConfiguration.cpp:
2691         (API::ProcessPoolConfiguration::copy):
2692         * UIProcess/API/APIProcessPoolConfiguration.h:
2693         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
2694         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
2695         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
2696
2697         Renamed ENABLE(WIFI_ASSERTIONS) to ENABLE(PROXIMITY_NETWORKING).
2698
2699         * WebKit.xcodeproj/project.pbxproj:
2700         * config.h:
2701
2702         Removed unused definition of HAVE_MOBILE_WIFI.
2703
2704 2018-08-16  Alex Christensen  <achristensen@webkit.org>
2705
2706         Remove unused and deprecated _WKProcessPoolConfiguration.allowsCellularAccess
2707         https://bugs.webkit.org/show_bug.cgi?id=188681
2708
2709         Reviewed by Tim Horton.
2710
2711         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
2712         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
2713         (-[_WKProcessPoolConfiguration allowsCellularAccess]): Deleted.
2714         (-[_WKProcessPoolConfiguration setAllowsCellularAccess:]): Deleted.
2715
2716 2018-08-16  Alex Christensen  <achristensen@webkit.org>
2717
2718         Deprecate SPI that is or ought to be unused
2719         https://bugs.webkit.org/show_bug.cgi?id=188616
2720
2721         Reviewed by Tim Horton.
2722
2723         * UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h:
2724         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
2725         * UIProcess/Cocoa/NavigationState.mm:
2726         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
2727         * UIProcess/Cocoa/UIDelegate.mm:
2728         (WebKit::UIDelegate::ContextMenuClient::menuFromProposedMenu):
2729
2730 2018-08-16  Alex Christensen  <achristensen@webkit.org>
2731
2732         Add temporary SPI WKContextHandlesSafeBrowsing
2733         https://bugs.webkit.org/show_bug.cgi?id=188676
2734
2735         Reviewed by Joseph Pecoraro.
2736
2737         WebKit showing the safe browsing warning doesn't play well with Safari showing the safe browsing warning.
2738         I plan to adopt this SPI in Safari to disable Safari's safe browsing check if it's true.
2739         Then when I implement safe browsing in WebKit, I can switch this value to true in the same change and
2740         not have a broken Safari.
2741
2742         * UIProcess/API/C/mac/WKContextPrivateMac.h:
2743         * UIProcess/API/C/mac/WKContextPrivateMac.mm:
2744         (WKContextHandlesSafeBrowsing):
2745
2746 2018-08-16  Ben Richards  <benton_richards@apple.com>
2747
2748         Add script to generate WebContent service resource files
2749         https://bugs.webkit.org/show_bug.cgi?id=188601
2750
2751         Reviewed by Dan Bernstein.
2752
2753         Added new build phase to WebContent service to copy resource files to WebKit.framework/PrivateHeaders/CustomWebContentResource.
2754         These resources are intended to be used by a client to create a custom WebContent service.
2755
2756         * Scripts/copy-webcontent-resources-to-private-headers.sh: Added.
2757         * WebKit.xcodeproj/project.pbxproj:
2758
2759 2018-08-16  Alex Christensen  <achristensen@webkit.org>
2760
2761         Consolidate data/string API loading paths
2762         https://bugs.webkit.org/show_bug.cgi?id=188417
2763
2764         Reviewed by Michael Catanzaro.
2765
2766         loadHTMLString and loadData are basically duplicate code.
2767         loadPlainTextString was also basically the same except it didn't set up a navigation, which
2768         was almost certainly a bug, but nobody uses it in all of Apple and Debian.  We should probably deprecate
2769         and remove it, but for now I make it use the same data loading path.
2770
2771         * UIProcess/API/C/WKPage.cpp:
2772         (WKPageLoadData):
2773         (WKPageLoadDataWithUserData):
2774         (loadString):
2775         (WKPageLoadHTMLString):
2776         (WKPageLoadHTMLStringWithUserData):
2777         (WKPageLoadPlainTextString):
2778         (WKPageLoadPlainTextStringWithUserData):
2779         * UIProcess/API/Cocoa/WKBrowsingContextController.mm:
2780         (-[WKBrowsingContextController loadHTMLString:baseURL:userData:]):
2781         (-[WKBrowsingContextController loadData:MIMEType:textEncodingName:baseURL:userData:]):
2782         * UIProcess/API/Cocoa/WKWebView.mm:
2783         (-[WKWebView loadData:MIMEType:characterEncodingName:baseURL:]):
2784         (-[WKWebView _loadData:MIMEType:characterEncodingName:baseURL:userData:]):
2785         * UIProcess/API/glib/WebKitWebView.cpp:
2786         (webkit_web_view_load_html):
2787         (webkit_web_view_load_plain_text):
2788         * UIProcess/WebPageProxy.cpp:
2789         (WebKit::WebPageProxy::loadData):
2790         (WebKit::WebPageProxy::loadHTMLString): Deleted.
2791         (WebKit::WebPageProxy::loadPlainTextString): Deleted.
2792         * UIProcess/WebPageProxy.h:
2793         * WebProcess/WebPage/WebPage.cpp:
2794         (WebKit::WebPage::loadData):
2795         (WebKit::WebPage::loadString): Deleted.
2796         * WebProcess/WebPage/WebPage.h:
2797         * WebProcess/WebPage/WebPage.messages.in:
2798
2799 2018-08-16  Alex Christensen  <achristensen@webkit.org>
2800
2801         Transition more WKWebViewConfiguration ivars to API::PageConfiguration values
2802         https://bugs.webkit.org/show_bug.cgi?id=188665
2803
2804         Reviewed by Joseph Pecoraro.
2805
2806         APPLICATION_MANIFEST is enabled on all Cocoa platforms, so I removed some guards, too!
2807
2808         * UIProcess/API/APIPageConfiguration.cpp:
2809         (API::PageConfiguration::applicationManifest const):
2810         * UIProcess/API/APIPageConfiguration.h:
2811         * UIProcess/API/Cocoa/WKWebView.mm:
2812         (-[WKWebView _initializeWithConfiguration:]):
2813         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
2814         (-[WKWebViewConfiguration init]):
2815         (-[WKWebViewConfiguration copyWithZone:]):
2816         (-[WKWebViewConfiguration _applicationManifest]):
2817         (-[WKWebViewConfiguration _setApplicationManifest:]):
2818         (-[WKWebViewConfiguration _setCPULimit:]):
2819         (-[WKWebViewConfiguration _cpuLimit]):
2820
2821 2018-08-16  Alex Christensen  <achristensen@webkit.org>
2822
2823         Transition more WKWebViewConfiguration ivars to API::PageConfiguration values
2824         https://bugs.webkit.org/show_bug.cgi?id=188663
2825
2826         Reviewed by Tim Horton.
2827
2828         * UIProcess/API/Cocoa/WKWebView.mm:
2829         (-[WKWebView _initializeWithConfiguration:]):
2830         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
2831         (-[WKWebViewConfiguration init]):
2832         (-[WKWebViewConfiguration copyWithZone:]):
2833         (-[WKWebViewConfiguration _drawsBackground]):
2834         (-[WKWebViewConfiguration _setDrawsBackground:]):
2835         (-[WKWebViewConfiguration _waitsForPaintAfterViewDidMoveToWindow]):
2836         (-[WKWebViewConfiguration _setWaitsForPaintAfterViewDidMoveToWindow:]):
2837         (-[WKWebViewConfiguration _isControlledByAutomation]):
2838         (-[WKWebViewConfiguration _setControlledByAutomation:]):
2839
2840 2018-08-16  Alex Christensen  <achristensen@webkit.org>
2841
2842         Stop using canAuthenticateAgainstProtectionSpace in modern WebKit
2843         https://bugs.webkit.org/show_bug.cgi?id=188639
2844
2845         Reviewed by Youenn Fablet.
2846
2847         canAuthenticateAgainstProtectionSpace is an unnecessary step in the authentication process.
2848         It is leftover from when it was necessary when we used NSURLConnection, which is only used in WebKitLegacy now.
2849         Now it's just an extra IPC roundtrip asking if we should use NSURLSessionAuthChallengeRejectProtectionSpace
2850         or if we are going to ask the API client.  We can move this step into the C API for compatibility
2851         with the 1 client that still uses it (not for long, see rdar://problem/43358403) and simplify and optimize
2852         authentication.
2853
2854         * NetworkProcess/Downloads/PendingDownload.cpp:
2855         (WebKit::PendingDownload::canAuthenticateAgainstProtectionSpaceAsync): Deleted.
2856         * NetworkProcess/Downloads/PendingDownload.h:
2857         * NetworkProcess/NetworkCORSPreflightChecker.cpp:
2858         (WebKit::NetworkCORSPreflightChecker::didReceiveChallenge):
2859         * NetworkProcess/NetworkLoad.cpp:
2860         (WebKit::NetworkLoad::~NetworkLoad):
2861         (WebKit::NetworkLoad::didReceiveChallenge):
2862         (WebKit::NetworkLoad::completeAuthenticationChallenge): Deleted.
2863         (WebKit::NetworkLoad::continueCanAuthenticateAgainstProtectionSpace): Deleted.
2864         * NetworkProcess/NetworkLoad.h:
2865         * NetworkProcess/NetworkLoadClient.h:
2866         * NetworkProcess/NetworkProcess.cpp:
2867         (WebKit::NetworkProcess::cancelDownload):
2868         (WebKit::NetworkProcess::canAuthenticateAgainstProtectionSpace): Deleted.
2869         (WebKit::NetworkProcess::continueCanAuthenticateAgainstProtectionSpace): Deleted.
2870         * NetworkProcess/NetworkProcess.h:
2871         * NetworkProcess/NetworkProcess.messages.in:
2872         * NetworkProcess/NetworkResourceLoader.cpp:
2873         (WebKit::NetworkResourceLoader::canAuthenticateAgainstProtectionSpaceAsync): Deleted.
2874         * NetworkProcess/NetworkResourceLoader.h:
2875         * NetworkProcess/PreconnectTask.cpp:
2876         (WebKit::PreconnectTask::canAuthenticateAgainstProtectionSpaceAsync): Deleted.
2877         * NetworkProcess/PreconnectTask.h:
2878         * NetworkProcess/cache/NetworkCacheSpeculativeLoad.cpp:
2879         (WebKit::NetworkCache::SpeculativeLoad::canAuthenticateAgainstProtectionSpaceAsync): Deleted.
2880         * NetworkProcess/cache/NetworkCacheSpeculativeLoad.h:
2881         * Shared/Authentication/AuthenticationManager.cpp:
2882         (WebKit::AuthenticationManager::didReceiveAuthenticationChallenge):
2883         * Shared/Authentication/AuthenticationManager.h:
2884         * UIProcess/API/C/WKPage.cpp:
2885         (WKPageSetPageNavigationClient):
2886         * UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h:
2887         * UIProcess/Cocoa/NavigationState.h:
2888         * UIProcess/Cocoa/NavigationState.mm:
2889         (WebKit::NavigationState::setNavigationDelegate):
2890         (WebKit::NavigationState::NavigationClient::didReceiveAuthenticationChallenge):
2891         (WebKit::NavigationState::NavigationClient::canAuthenticateAgainstProtectionSpace): Deleted.
2892         * UIProcess/Network/NetworkProcessProxy.cpp:
2893         (WebKit::NetworkProcessProxy::canAuthenticateAgainstProtectionSpace): Deleted.
2894         * UIProcess/Network/NetworkProcessProxy.h:
2895         * UIProcess/Network/NetworkProcessProxy.messages.in:
2896         * UIProcess/WebPageProxy.cpp:
2897         (WebKit::WebPageProxy::canAuthenticateAgainstProtectionSpace): Deleted.
2898         * UIProcess/WebPageProxy.h:
2899
2900 2018-08-15  Jer Noble  <jer.noble@apple.com>
2901
2902         Add Experimental Feature support for SourceBuffer.changeType()
2903         https://bugs.webkit.org/show_bug.cgi?id=188626
2904
2905         Reviewed by Eric Carlson.
2906
2907         * Shared/WebPreferences.yaml:
2908         * UIProcess/API/C/WKPreferences.cpp:
2909         (WKPreferencesSetSourceBufferChangeTypeEnabled):
2910         (WKPreferencesGetSourceBufferChangeTypeEnabled):
2911         * UIProcess/API/C/WKPreferencesRefPrivate.h:
2912
2913 2018-08-16  Alex Christensen  <achristensen@webkit.org>
2914
2915         Transition more WKWebViewConfiguration ivars to API::PageConfiguration values
2916         https://bugs.webkit.org/show_bug.cgi?id=188661
2917
2918         Reviewed by Anders Carlsson.
2919
2920         * UIProcess/API/Cocoa/WKWebView.mm:
2921         (-[WKWebView _initializeWithConfiguration:]):
2922         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
2923         (-[WKWebViewConfiguration init]):
2924         (-[WKWebViewConfiguration copyWithZone:]):
2925         (-[WKWebViewConfiguration _alwaysRunsAtForegroundPriority]):
2926         (-[WKWebViewConfiguration _setAlwaysRunsAtForegroundPriority:]):
2927         (-[WKWebViewConfiguration _initialCapitalizationEnabled]):
2928         (-[WKWebViewConfiguration _setInitialCapitalizationEnabled:]):
2929         (-[WKWebViewConfiguration _overrideContentSecurityPolicy]):
2930         (-[WKWebViewConfiguration _setOverrideContentSecurityPolicy:]):
2931
2932 2018-08-16  Aditya Keerthi  <akeerthi@apple.com>
2933
2934         Support drag-and-drop for input[type=color]
2935         https://bugs.webkit.org/show_bug.cgi?id=188464
2936
2937         Reviewed by Wenson Hsieh.
2938
2939         On iOS, the drag preview for the color input is a rounded rectangle. In order to
2940         ensure that the corners appear transparent, the visiblePath property of the
2941         UIDragPreviewParameters was set to match the preview's shape. This also required
2942         the creation of an additional ArgumentCoder for Path.
2943
2944         When beginning the drag session, the preview should appear centered about the
2945         color input. This is managed in createTargetedDragPreview. However, once the
2946         preview is dragged, the preview should be at the center of the touch location.
2947         Consequently, DragSourceActionColor was added to the list of sources that could
2948         update the drag preview after lifting.
2949
2950         * Shared/WebCoreArgumentCoders.cpp:
2951         (IPC::ArgumentCoder<Path>::decode):
2952         * Shared/WebCoreArgumentCoders.h:
2953         * UIProcess/Cocoa/WebPasteboardProxyCocoa.mm:
2954         (WebKit::WebPasteboardProxy::setPasteboardColor):
2955         * UIProcess/WebPasteboardProxy.h:
2956         * UIProcess/WebPasteboardProxy.messages.in:
2957         * UIProcess/ios/DragDropInteractionState.h:
2958         * UIProcess/ios/DragDropInteractionState.mm:
2959         (WebKit::createTargetedDragPreview):
2960         (WebKit::shouldUseDragImageToCreatePreviewForDragSource):
2961         (WebKit::shouldUseVisiblePathToCreatePreviewForDragSource):
2962         (WebKit::canUpdatePreviewForActiveDragSource):
2963         (WebKit::DragDropInteractionState::previewForDragItem const):
2964         (WebKit::DragDropInteractionState::stageDragItem):
2965         (WebKit::DragDropInteractionState::updatePreviewsForActiveDragSources):
2966         * UIProcess/ios/forms/WKFormColorPicker.mm:
2967         (-[WKColorPicker initWithView:]):
2968         * UIProcess/mac/WebColorPickerMac.h:
2969         * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
2970         (WebKit::WebPlatformStrategies::setColor):
2971         * WebProcess/WebCoreSupport/WebPlatformStrategies.h:
2972
2973 2018-08-16  Per Arne Vollan  <pvollan@apple.com>
2974
2975         Assert that calling CGSSetDenyWindowServerConnections(true) succeeds
2976         https://bugs.webkit.org/show_bug.cgi?id=188615
2977
2978         Reviewed by Brent Fulgham.
2979
2980         If the call to CGSSetDenyWindowServerConnections(true) fails, it means there are open WindowServer connections
2981         at this point, and future WindowServer connections will not be denied. We should assert that this call succeeds.
2982
2983         * WebProcess/cocoa/WebProcessCocoa.mm:
2984         (WebKit::WebProcess::platformInitializeProcess):
2985
2986 2018-08-16  Philippe Normand  <pnormand@igalia.com>
2987
2988         Unreviewed, WPE build fix after r234920.
2989
2990         * UIProcess/API/wpe/PageClientImpl.cpp:
2991         (WebKit::PageClientImpl::isViewWindowActive):
2992         (WebKit::PageClientImpl::isViewFocused):
2993         (WebKit::PageClientImpl::isViewVisible):
2994         (WebKit::PageClientImpl::isViewInWindow):
2995         * UIProcess/API/wpe/WPEView.cpp:
2996         (WKWPE::View::setViewState):
2997         * UIProcess/API/wpe/WPEView.h:
2998
2999 2018-08-16  Antti Koivisto  <antti@apple.com>
3000
3001         Use OptionSet for ActivityState::Flags
3002         https://bugs.webkit.org/show_bug.cgi?id=188554
3003
3004         Reviewed by Brent Fulgham.
3005
3006         * Shared/WebPageCreationParameters.h:
3007         * UIProcess/Cocoa/WebViewImpl.mm:
3008         (WebKit::WebViewImpl::windowDidOrderOffScreen):
3009         (WebKit::WebViewImpl::windowDidOrderOnScreen):
3010         (WebKit::WebViewImpl::viewDidMoveToWindow):
3011         * UIProcess/WebPageProxy.cpp:
3012         (WebKit::WebPageProxy::updateActivityState):
3013         (WebKit::WebPageProxy::activityStateDidChange):
3014         (WebKit::WebPageProxy::dispatchActivityStateChange):
3015         (WebKit::WebPageProxy::setMuted):
3016         (WebKit::WebPageProxy::isPlayingMediaDidChange):
3017         * UIProcess/WebPageProxy.h:
3018         (WebKit::WebPageProxy::isInWindow const):
3019         (WebKit::WebPageProxy::isViewVisible const):
3020         (WebKit::WebPageProxy::isViewFocused const):
3021         (WebKit::WebPageProxy::isViewWindowActive const):
3022         * WebProcess/Plugins/PluginView.cpp:
3023         (WebKit::PluginView::activityStateDidChange):
3024         * WebProcess/Plugins/PluginView.h:
3025         * WebProcess/WebPage/DrawingArea.h:
3026         (WebKit::DrawingArea::activityStateDidChange):
3027         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.h:
3028         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
3029         (WebKit::RemoteLayerTreeDrawingArea::activityStateDidChange):
3030         * WebProcess/WebPage/WebPage.cpp:
3031         (WebKit::WebPage::updateThrottleState):
3032         (WebKit::WebPage::updateIsInWindow):
3033         (WebKit::WebPage::visibilityDidChange):
3034         (WebKit::WebPage::setActivityState):
3035         * WebProcess/WebPage/WebPage.h:
3036         (WebKit::WebPage::isVisible const):
3037         (WebKit::WebPage::isVisibleOrOccluded const):
3038         * WebProcess/WebPage/WebPage.messages.in:
3039         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
3040         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
3041         (WebKit::TiledCoreAnimationDrawingArea::activityStateDidChange):
3042         * WebProcess/WebProcess.cpp:
3043         (WebKit::WebProcess::pageActivityStateDidChange):
3044         * WebProcess/WebProcess.h:
3045
3046 2018-08-15  Ansh Shukla  <ansh_shukla@apple.com>
3047
3048         NSURLAuthenticationMethodOAuth challenges are surfaced to clients in -didReceiveAuthenticationChallenge as NSURLAuthenticationMethodDefault
3049         https://bugs.webkit.org/show_bug.cgi?id=186870
3050         <rdar://problem/41314410>
3051
3052         Reviewed by Alex Christensen.
3053
3054         Correctly expose the OAuth protection space type in API.
3055
3056         * UIProcess/API/C/WKAPICast.h:
3057         (WebKit::toAPI):
3058         * UIProcess/API/C/WKProtectionSpaceTypes.h:
3059
3060 2018-08-15  Ben Richards  <benton_richards@apple.com>
3061
3062         We should cache the compiled sandbox profile in a data vault
3063         https://bugs.webkit.org/show_bug.cgi?id=184991
3064
3065         Reviewed by Ryosuke Niwa.
3066
3067         This patch changes a few things (note: data vaults and sandbox entitlements are only used in internal builds):
3068         (1) Instead of compiling a sandbox every time a process is launched, processes now look for a cached sandbox
3069             in a process specific data vault on macOS platforms. (ChildProcessMac.mm)
3070         (2) If a valid cached sandbox is not found, a process will create the data vault (or ensure that it exists),
3071             compile a sandbox, and cache it.
3072         (3) In order to create process specific data vaults, each process now has their own <process name>-OSX-sandbox.entitlements
3073             file which contains an entitlement with a process specific "storage class" which ensures that each process
3074             can only ever access its own data vault. (See the article on confluence "Data Vaults and Restricted Files" for more info)
3075         (4) The sandbox entitlements file for the Network and WebContent services are loaded dynamically
3076             through Scripts/<process name>-process-entitlements.sh which is triggered in a new build phase for each service.
3077             The Storage process sandbox entitlements are loaded directly in Configurations/StorageService.xcconfig.
3078             The reason that the sandbox entitlements are applied dynamically is so that these sandbox entitlements
3079             are only applied when WK_USE_RESTRICTED_ENTITLEMENTS is YES. This means that open source builds will still work.
3080
3081         * Configurations/Network-OSX-sandbox.entitlements: Added.
3082         * Configurations/Storage-OSX-sandbox.entitlements: Added.
3083         * Configurations/StorageService.xcconfig:
3084         * Configurations/WebContent-OSX-sandbox.entitlements: Added.
3085         * Configurations/WebKit.xcconfig:
3086         * NetworkProcess/NetworkProcess.h:
3087         * PluginProcess/PluginProcess.h:
3088         * Scripts/process-network-sandbox-entitlements.sh: Added.
3089         * Scripts/process-webcontent-sandbox-entitlements.sh: Added.
3090         * Shared/ChildProcess.h:
3091         * Shared/EntryPointUtilities/mac/XPCService/XPCServiceEntryPoint.h:
3092         (WebKit::XPCServiceInitializer):
3093         * Shared/SandboxInitializationParameters.h:
3094         (WebKit::SandboxInitializationParameters::setOverrideSandboxProfilePath):
3095         (WebKit::SandboxInitializationParameters::overrideSandboxProfilePath const):
3096         (WebKit::SandboxInitializationParameters::setSandboxProfile):
3097         (WebKit::SandboxInitializationParameters::sandboxProfile const):
3098         (): Deleted.
3099         * Shared/mac/ChildProcessMac.mm:
3100         (WebKit::SandboxProfileDeleter::operator()):
3101         (WebKit::SandboxParametersDeleter::operator()):
3102         (WebKit::SandboxInfo::SandboxInfo):
3103         (WebKit::fileContents):
3104         (WebKit::processStorageClass):
3105         (WebKit::setAndSerializeSandboxParameters):
3106         (WebKit::sandboxDataVaultParentDirectory):
3107         (WebKit::sandboxDirectory):
3108         (WebKit::sandboxFilePath):
3109         (WebKit::ensureSandboxCacheDirectory):
3110         (WebKit::writeSandboxDataToCacheFile):
3111         (WebKit::compileAndCacheSandboxProfile):
3112         (WebKit::tryApplyCachedSandbox):
3113         (WebKit::webKit2Bundle):
3114         (WebKit::getSandboxProfileOrProfilePath):
3115         (WebKit::compileAndApplySandboxSlowCase):
3116         (WebKit::applySandbox):
3117         (WebKit::initializeSandboxParameters):
3118         (WebKit::ChildProcess::initializeSandbox):
3119         * Shared/mac/SandboxInitialiationParametersMac.mm:
3120         (WebKit::SandboxInitializationParameters::SandboxInitializationParameters):
3121         * StorageProcess/StorageProcess.h:
3122         * WebKit.xcodeproj/project.pbxproj:
3123         * WebProcess/WebProcess.h:
3124
3125 2018-08-15  Ross Kirsling  <ross.kirsling@sony.com>
3126
3127         [WinCairo] Unreviewed build fix after r234896.
3128
3129         * NetworkProcess/curl/NetworkDataTaskCurl.cpp:
3130         (WebKit::NetworkDataTaskCurl::tryHttpAuthentication):
3131
3132 2018-08-15  Ryosuke Niwa  <rniwa@webkit.org>
3133
3134         Can't share an app on AppStore to WeChat due to a release assert
3135         https://bugs.webkit.org/show_bug.cgi?id=188621
3136         <rdar://problem/43343976>
3137
3138         Reviewed by Geoffrey Garen.
3139
3140         Disable the thread safety check when the app is not linked on or after iOS 12 since this release assert
3141         is getting hit by third party applications on iOS in UI process.
3142
3143         * UIProcess/Cocoa/VersionChecks.h:
3144         (WebKit::SDKVersion::FirstWithMainThreadReleaseAssertionInWebPageProxy): Added. It's iOS 12 or macOS 10.14 Mojave.
3145         * UIProcess/WebProcessProxy.cpp:
3146         (WebKit::isMainThreadOrCheckDisabled): Added. Returns true whether when we're in the main thread or if the app
3147         is not linked on or after iOS 12 or macOS 10.14 Mojave.
3148         (WebKit::globalPageMap):
3149         (WebKit::m_isInPrewarmedPool):
3150         (WebKit::WebProcessProxy::~WebProcessProxy):
3151         (WebKit::WebProcessProxy::shutDown):
3152         (WebKit::WebProcessProxy::deleteWebsiteDataForTopPrivatelyControlledDomainsInAllPersistentDataStores):
3153         (WebKit::WebProcessProxy::topPrivatelyControlledDomainsWithWebsiteData):
3154         (WebKit::WebProcessProxy::didFinishLaunching):
3155
3156 2018-08-15  Alex Christensen  <achristensen@webkit.org>
3157
3158         Remove WKNavigationDelegatePrivate's canAuthenticateAgainstProtectionSpace
3159         https://bugs.webkit.org/show_bug.cgi?id=188622
3160
3161         Reviewed by Timothy Hatcher.
3162
3163         It's been deprecated for a release now, nobody uses it, and it's a concept from NSURLConnection, which we don't use any more in WebKit2.
3164
3165         * UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h:
3166         * UIProcess/Cocoa/NavigationState.h:
3167         * UIProcess/Cocoa/NavigationState.mm:
3168         (WebKit::NavigationState::setNavigationDelegate):
3169         (WebKit::NavigationState::NavigationClient::canAuthenticateAgainstProtectionSpace):
3170
3171 2018-08-15  Tim Horton  <timothy_horton@apple.com>
3172
3173         Crashes in Quip under _dictionaryPopupInfoForRange, in setObject:forKey:
3174         https://bugs.webkit.org/show_bug.cgi?id=188569
3175         <rdar://problem/34201095>
3176
3177         Reviewed by Megan Gardner.
3178
3179         * WebProcess/WebPage/mac/WebPageMac.mm:
3180         (WebKit::WebPage::dictionaryPopupInfoForRange):
3181         Speculative fix; the crashes indicate font is null, but we just checked it,
3182         so it must be getting made null by convertFont:toSize:. Check again!
3183
3184 2018-08-15  Ryan Haddad  <ryanhaddad@apple.com>
3185
3186         Unreviewed, rolling out r234870.
3187
3188         The test introduced with this change is a flaky failure.
3189
3190         Reverted changeset:
3191
3192         "NSURLAuthenticationMethodOAuth challenges are surfaced to
3193         clients in -didReceiveAuthenticationChallenge as
3194         NSURLAuthenticationMethodDefault"
3195         https://bugs.webkit.org/show_bug.cgi?id=186870
3196         https://trac.webkit.org/changeset/234870
3197
3198 2018-08-15  Alex Christensen  <achristensen@webkit.org>
3199
3200         NetworkCORSPreflightChecker should proceed in case of ProtectionSpaceAuthenticationSchemeServerTrustEvaluationRequested even though the WebKit app is not implementing the didReceiveAuthenticationChallenge/didReceiveAuthenticationChallengeInFrame callback
3201         https://bugs.webkit.org/show_bug.cgi?id=188592
3202         <rdar://problem/43210331>
3203
3204         Reviewed by Youenn Fablet.
3205
3206         Do a canAuthenticateAgainstProtectionSpace check in NetworkCORSPreflightChecker like we do in NetworkLoad.
3207         Use CompletionHandlers to make the now 3 different canAuthenticateAgainstProtectionSpace checks look the same from the NetworkProcess.
3208
3209         * NetworkProcess/NetworkCORSPreflightChecker.cpp:
3210         (WebKit::NetworkCORSPreflightChecker::didReceiveChallenge):
3211         * NetworkProcess/NetworkCORSPreflightChecker.h:
3212         * NetworkProcess/NetworkDataTask.h:
3213         * NetworkProcess/NetworkLoad.cpp:
3214         (WebKit::NetworkLoad::didReceiveChallenge):
3215         * NetworkProcess/NetworkLoad.h:
3216         * NetworkProcess/NetworkProcess.cpp:
3217         (WebKit::NetworkProcess::canAuthenticateAgainstProtectionSpace):
3218         (WebKit::NetworkProcess::continueCanAuthenticateAgainstProtectionSpace):
3219         * NetworkProcess/NetworkProcess.h:
3220         * NetworkProcess/NetworkResourceLoader.cpp:
3221         (WebKit::NetworkResourceLoader::canAuthenticateAgainstProtectionSpaceAsync):
3222         (WebKit::NetworkResourceLoader::continueCanAuthenticateAgainstProtectionSpace): Deleted.
3223         * NetworkProcess/NetworkResourceLoader.h:
3224         * NetworkProcess/PingLoad.cpp:
3225         (WebKit::PingLoad::didReceiveChallenge):
3226         * NetworkProcess/PingLoad.h:
3227         * NetworkProcess/PreconnectTask.cpp:
3228         (WebKit::PreconnectTask::canAuthenticateAgainstProtectionSpaceAsync):
3229         (WebKit::PreconnectTask::continueCanAuthenticateAgainstProtectionSpace): Deleted.
3230         * NetworkProcess/PreconnectTask.h:
3231         * NetworkProcess/cocoa/NetworkDataTaskCocoa.h:
3232         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
3233         (WebKit::NetworkDataTaskCocoa::didReceiveChallenge):
3234
3235 2018-08-15  Michael Catanzaro  <mcatanzaro@igalia.com>
3236
3237         [WPE][GTK] WaylandCompositor fails to properly remove surface from its page map
3238         https://bugs.webkit.org/show_bug.cgi?id=188520
3239
3240         Reviewed by Alex Christensen.
3241
3242         willDestroySurface overwrites the surface pointer in the map's iterator in an attempt to
3243         change the value of the surface pointer in the map, but it doesn't work because changing
3244         the iterator does not change the map itself. There's no need to fix this function: it's
3245         better to use WeakPtr instead.
3246
3247         * UIProcess/gtk/WaylandCompositor.cpp:
3248         (WebKit::WaylandCompositor::getTexture):
3249         (WebKit::WaylandCompositor::bindSurfaceToWebPage):
3250         (WebKit::WaylandCompositor::unregisterWebPage):
3251         (WebKit::WaylandCompositor::willDestroySurface): Deleted.
3252         * UIProcess/gtk/WaylandCompositor.h:
3253
3254 2018-08-15  Wenson Hsieh  <wenson_hsieh@apple.com>
3255
3256         [Attachment SPI] Remove attachment display mode options
3257         https://bugs.webkit.org/show_bug.cgi?id=188596
3258
3259         Reviewed by Dan Bernstein.
3260
3261         Remove attachment display mode from WebKit. Note that _WKAttachmentDisplayOptions needs to remain in the private
3262         header for source compatibility with Mail.
3263
3264         * UIProcess/API/Cocoa/_WKAttachment.mm:
3265         (-[_WKAttachmentDisplayOptions coreDisplayOptions]): Deleted.
3266         * WebProcess/WebPage/WebPage.cpp:
3267         (WebKit::WebPage::setAttachmentDisplayOptions):
3268
3269 2018-08-14 Sihui Liu <sihui_liu@apple.com>
3270
3271         Crash in WebKit::filterPreloadHSTSEntry via NetworkProcess::getHostNamesWithHSTSCache
3272         https://bugs.webkit.org/show_bug.cgi?id=188576
3273         <rdar://problem/43148977>
3274
3275         Reviewed by Alex Christensen.
3276
3277         * NetworkProcess/NetworkProcess.cpp:
3278         (WebKit::NetworkProcess::fetchWebsiteData):
3279
3280 2018-08-14  Alex Christensen  <achristensen@webkit.org>
3281
3282         isValidCSSSelector is unsafe to be called from a non-main thread
3283         https://bugs.webkit.org/show_bug.cgi?id=188581
3284         <rdar://problem/40517358>
3285
3286         Reviewed by Sam Weinig.
3287
3288         * UIProcess/API/APIContentRuleListStore.cpp:
3289         (API::compiledToFile):
3290         (API::ContentRuleListStore::lookupContentRuleList):
3291         (API::ContentRuleListStore::getAvailableContentRuleListIdentifiers):
3292         (API::ContentRuleListStore::compileContentRuleList):
3293         (API::ContentRuleListStore::removeContentRuleList):
3294         (API::ContentRuleListStore::getContentRuleListSource):
3295         * UIProcess/API/APIContentRuleListStore.h:
3296         * UIProcess/API/Cocoa/WKContentRuleListStore.mm:
3297
3298 2018-08-14  Ansh Shukla  <ansh_shukla@apple.com>
3299
3300         NSURLAuthenticationMethodOAuth challenges are surfaced to clients in -didReceiveAuthenticationChallenge as NSURLAuthenticationMethodDefault
3301         https://bugs.webkit.org/show_bug.cgi?id=186870
3302         <rdar://problem/41314410>
3303
3304         Reviewed by Alex Christensen.
3305
3306         Correctly expose the OAuth protection space type in API.
3307
3308         * UIProcess/API/C/WKAPICast.h:
3309         (WebKit::toAPI):
3310         * UIProcess/API/C/WKProtectionSpaceTypes.h:
3311
3312 2018-08-14  Ben Richards  <benton_richards@apple.com>
3313
3314         Remove api misuse check so that custom webcontent service identifier can be set at runtime
3315         https://bugs.webkit.org/show_bug.cgi?id=188579
3316
3317         Reviewed by Ryosuke Niwa.
3318
3319         Changed API misuse check so that a custom bundle identifier can be set at runtime with a debug flag
3320
3321         * UIProcess/WebProcessPool.cpp:
3322         (WebKit::WebProcessPool::setCustomWebContentServiceBundleIdentifier):
3323         * UIProcess/WebProcessProxy.cpp:
3324         (WebKit::WebProcessProxy::getLaunchOptions):
3325
3326 2018-08-14  Antti Koivisto  <antti@apple.com>
3327
3328         RemoteLayerTreeTransaction should use OptionSet for change flags
3329         https://bugs.webkit.org/show_bug.cgi?id=188547
3330
3331         Reviewed by Simon Fraser.
3332
3333         * Shared/RemoteLayerTree/RemoteLayerTreePropertyApplier.mm:
3334         (WebKit::RemoteLayerTreePropertyApplier::applyProperties):
3335         * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.h:
3336         (WebKit::RemoteLayerTreeTransaction::LayerProperties::notePropertiesChanged):
3337         (WebKit::RemoteLayerTreeTransaction::LayerProperties::resetChangedProperties):
3338
3339         Also remove unused everChangedProperties.
3340
3341         * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm:
3342         (WebKit::RemoteLayerTreeTransaction::LayerProperties::LayerProperties):
3343         (WebKit::RemoteLayerTreeTransaction::LayerProperties::encode const):
3344         (WebKit::RemoteLayerTreeTransaction::LayerProperties::decode):
3345         * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.cpp:
3346         (WebKit::PlatformCALayerRemote::recursiveBuildTransaction):
3347         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
3348         (WebKit::RemoteLayerTreeDrawingArea::flushLayers):
3349
3350 2018-08-13  Wenson Hsieh  <wenson_hsieh@apple.com>
3351
3352         [WK2] [macOS] Implement a mechanism to test drag and drop
3353         https://bugs.webkit.org/show_bug.cgi?id=181898
3354         <rdar://problem/39181698>
3355
3356         Reviewed by Simon Fraser.
3357
3358         Adds a new SPI method, `-_doAfterProcessingAllPendingMouseEvents:`, to WKWebView. This invokes the given
3359         callback after all queued mouse events have been handled by the web process. See Tools/ChangeLog for more
3360         detail.
3361
3362         * UIProcess/API/Cocoa/WKWebView.mm:
3363         (-[WKWebView _doAfterProcessingAllPendingMouseEvents:]):
3364         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
3365         * UIProcess/API/gtk/PageClientImpl.h:
3366         * UIProcess/API/wpe/PageClientImpl.h:
3367         * UIProcess/Cocoa/WebViewImpl.h:
3368         * UIProcess/Cocoa/WebViewImpl.mm:
3369         (WebKit::WebViewImpl::processDidExit):
3370
3371         Invoke any outstanding callbacks for processing pending mouse events when the web process is terminated.
3372
3373         (WebKit::WebViewImpl::doAfterProcessingAllPendingMouseEvents):
3374
3375         Either invoke the callback immediately if there are no mouse events to be processed, or insert the callback in
3376         a queue that will be flushed once all mouse events have been handled.
3377
3378         (WebKit::WebViewImpl::didFinishProcessingAllPendingMouseEvents):
3379         (WebKit::WebViewImpl::flushPendingMouseEventCallbacks):
3380         * UIProcess/PageClient.h:
3381         (WebKit::PageClient::pinnedStateWillChange):
3382         (WebKit::PageClient::pinnedStateDidChange):
3383         (WebKit::PageClient::videoControlsManagerDidChange):
3384
3385         Drive-by tweaks: remove unnecessary semicolons after empty implementation stubs.
3386
3387         * UIProcess/WebPageProxy.cpp:
3388         (WebKit::WebPageProxy::didReceiveEvent):
3389
3390         Notify the page client when there are no remaining mouse events left in the queue.
3391
3392         * UIProcess/ios/PageClientImplIOS.h:
3393         * UIProcess/mac/PageClientImplMac.h:
3394         * UIProcess/mac/PageClientImplMac.mm:
3395         (WebKit::PageClientImpl::didFinishProcessingAllPendingMouseEvents):
3396
3397         Add some plumbing through PageClient, so that WebPageProxy can tell WebViewImpl when it is finished processing
3398         all mouse events.
3399
3400         * UIProcess/win/PageClientImpl.h: