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