[GTK] Add WebKitInspectorWindow to create inspector windows from local and remote...
[WebKit-https.git] / Source / WebKit2 / ChangeLog
1 2017-04-25  Carlos Garcia Campos  <cgarcia@igalia.com>
2
3         [GTK] Add WebKitInspectorWindow to create inspector windows from local and remote inspector
4         https://bugs.webkit.org/show_bug.cgi?id=171261
5
6         Reviewed by Michael Catanzaro.
7
8         The code is currently duplicated in WebInspectorProxyGtk.cpp and RemoteWebInspectorProxyGtk.cpp. We can simplify
9         it by using a common widget in both places.
10         This patch also fixes the build when using GTK+ < 3.16.
11
12         * PlatformGTK.cmake:
13         * UIProcess/gtk/RemoteWebInspectorProxyGtk.cpp:
14         (WebKit::RemoteWebInspectorProxy::updateWindowTitle):
15         (WebKit::RemoteWebInspectorProxy::platformCreateFrontendPageAndWindow):
16         * UIProcess/gtk/WebInspectorProxyGtk.cpp:
17         (WebKit::WebInspectorProxy::createInspectorWindow):
18         (WebKit::WebInspectorProxy::updateInspectorWindowTitle):
19         * UIProcess/gtk/WebKitInspectorWindow.cpp: Added.
20         (webkit_inspector_window_class_init):
21         (webkit_inspector_window_init):
22         (webkitInspectorWindowNew):
23         (webkitInspectorWindowSetSubtitle):
24         * UIProcess/gtk/WebKitInspectorWindow.h: Added.
25
26 2017-04-25  Antti Koivisto  <antti@apple.com>
27
28         Enable expired-only reload policy on Mac and iOS
29         https://bugs.webkit.org/show_bug.cgi?id=171264
30         <rdar://problem/31807637>
31
32         Reviewed by Andreas Kling.
33
34         Enable the reload policy where only expired subresources are revalidated on Mac and iOS.
35         The behavor is enabled in Safari and for other clients based on SDK version check.
36
37         * UIProcess/API/C/WKPage.cpp:
38         (WKPageReload):
39         * UIProcess/API/Cocoa/WKWebView.mm:
40         (-[WKWebView reload]):
41         * UIProcess/Cocoa/VersionChecks.h:
42
43 2017-04-25  Wenson Hsieh  <wenson_hsieh@apple.com>
44
45         Support reading NSURL titles from the pasteboard when performing data interaction
46         https://bugs.webkit.org/show_bug.cgi?id=171156
47         <rdar://problem/31356937>
48
49         Reviewed by Tim Horton.
50
51         Adjust for interface changes in WebCore to support plumbing the title of an NSURL from the platform pasteboard
52         back to WebCore. Additionally, implement WebEditorClient::hasRichlyEditableSelection (which previously returned
53         false) to check whether the current selection is richly editable, or the drop caret is in richly editable content.
54         See WebCore ChangeLog for more details.
55
56         * UIProcess/Cocoa/WebPasteboardProxyCocoa.mm:
57         (WebKit::WebPasteboardProxy::readURLFromPasteboard):
58         * UIProcess/WebPasteboardProxy.h:
59         * UIProcess/WebPasteboardProxy.messages.in:
60         * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
61         (WebKit::WebPlatformStrategies::readURLFromPasteboard):
62         * WebProcess/WebCoreSupport/WebPlatformStrategies.h:
63         * WebProcess/WebCoreSupport/ios/WebEditorClientIOS.mm:
64         (WebKit::WebEditorClient::hasRichlyEditableSelection):
65         * WebProcess/WebPage/WebPage.cpp:
66         (WebKit::WebPage::hasRichlyEditableSelection):
67         * WebProcess/WebPage/WebPage.h:
68
69 2017-04-24  Wenson Hsieh  <wenson_hsieh@apple.com>
70
71         Respect fidelity order when reading web content from item providers
72         https://bugs.webkit.org/show_bug.cgi?id=171155
73         <rdar://problem/31356937>
74
75         Reviewed by Tim Horton.
76
77         Adjusts for changes in WebCore by adding plumbing to support Pasteboard::getTypesByFidelityForItemAtIndex. See
78         WebCore/ChangeLog for more details.
79
80         * UIProcess/Cocoa/WebPasteboardProxyCocoa.mm:
81         (WebKit::WebPasteboardProxy::getPasteboardTypesByFidelityForItemAtIndex):
82         * UIProcess/WebPasteboardProxy.h:
83         * UIProcess/WebPasteboardProxy.messages.in:
84         * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
85         (WebKit::WebPlatformStrategies::getTypesByFidelityForItemAtIndex):
86         * WebProcess/WebCoreSupport/WebPlatformStrategies.h:
87
88 2017-04-24  Brady Eidson  <beidson@apple.com>
89
90         WebProcessPools should always have a WebsiteDataStore
91         https://bugs.webkit.org/show_bug.cgi?id=171252
92
93         Reviewed by Alex Christensen.
94
95         * UIProcess/API/APIWebsiteDataStore.cpp:
96         (API::WebsiteDataStore::registerSharedResourceLoadObserver): Deleted.
97         * UIProcess/API/APIWebsiteDataStore.h:
98         * UIProcess/API/C/WKContext.cpp:
99         (WKContextGetWebsiteDataStore):
100         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
101         (WebKit::WebProcessPool::platformInitialize):
102         * UIProcess/WebProcessPool.cpp:
103         (WebKit::WebProcessPool::WebProcessPool):
104         (WebKit::WebProcessPool::createWebPage):
105         * UIProcess/WebProcessPool.h:
106         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
107         (WebKit::WebsiteDataStore::isAssociatedProcessPool):
108
109 2017-04-24  Youenn Fablet  <youenn@apple.com>
110
111         Set defaults video getUserMedia constraints
112         https://bugs.webkit.org/show_bug.cgi?id=171127
113
114         Reviewed by Eric Carlson.
115
116         Updated to cope with MediaStreamConstraintsImpl refactoring.
117
118         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp:
119         (WebKit::UserMediaCaptureManagerProxy::createMediaSourceForCaptureDeviceWithConstraints):
120         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
121         (WebKit::UserMediaPermissionRequestManagerProxy::requestUserMediaPermissionForFrame):
122
123 2017-04-24  Chris Dumez  <cdumez@apple.com>
124
125         Allow tabs with capturing audio or video to exceed background CPU limit
126         https://bugs.webkit.org/show_bug.cgi?id=171249
127         <rdar://problem/31796314>
128
129         Reviewed by Geoffrey Garen.
130
131         Allow tabs with capturing audio or video to exceed background CPU limit as this
132         is a legit case of potentially high background CPU use.
133
134         * UIProcess/WebProcessProxy.cpp:
135         (WebKit::WebProcessProxy::didExceedBackgroundCPULimit):
136
137 2017-04-24  Andy Estes  <aestes@apple.com>
138
139         Try to fix the 32-bit macOS build.
140
141         * UIProcess/Cocoa/WebViewImpl.mm:
142
143 2017-04-24  Andy Estes  <aestes@apple.com>
144
145         [macOS] Enable media selection button on AVTouchBarScrubber
146         https://bugs.webkit.org/show_bug.cgi?id=171149
147         <rdar://problem/29875010>
148
149         Reviewed by Beth Dakin.
150
151         * UIProcess/Cocoa/WebViewImpl.mm:
152         (WebKit::WebViewImpl::updateMediaTouchBar):
153
154 2017-04-24  Alex Christensen  <achristensen@webkit.org>
155
156         Reduce copies and allocations in SharedBuffer::append
157         https://bugs.webkit.org/show_bug.cgi?id=170956
158
159         Reviewed by Andreas Kling.
160
161         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
162         (-[WKNetworkSessionDelegate URLSession:dataTask:didReceiveData:]):
163         * Platform/IPC/DataReference.cpp:
164         (IPC::SharedBufferDataReference::encode):
165         * Shared/ShareableResource.cpp:
166         (WebKit::ShareableResource::wrapInSharedBuffer):
167         * UIProcess/API/Cocoa/WKURLSchemeHandlerTask.mm:
168         (-[WKURLSchemeHandlerTaskImpl didReceiveData:]):
169         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:
170         (-[WKWebProcessPlugInBrowserContextController _setEditingDelegate:]):
171         * WebProcess/Plugins/PDF/PDFPlugin.mm:
172         (WebKit::PDFPlugin::addArchiveResource):
173         (WebKit::PDFPlugin::liveResourceData):
174         (WebKit::PDFPlugin::writeItemsToPasteboard):
175         * WebProcess/Plugins/PluginView.cpp:
176         (WebKit::PluginView::redeliverManualStream):
177         * WebProcess/WebCoreSupport/mac/WebDragClientMac.mm:
178         (WebKit::WebDragClient::declareAndWriteDragImage):
179         * WebProcess/WebPage/mac/WebPageMac.mm:
180         (WebKit::WebPage::cachedResponseDataForURL):
181
182 2017-04-24  Carlos Garcia Campos  <cgarcia@igalia.com>
183
184         [GTK] Switch to use ENABLE_REMOTE_INSPECTOR instead of ENABLE_INSPECTOR_SERVER for the remote inspector
185         https://bugs.webkit.org/show_bug.cgi?id=166680
186
187         Reviewed by Michael Catanzaro.
188
189         Remove INSPECTOR_SERVER code and add new classes to implement REMOTE_INSPECTOR. The WebKitWebContext registers a
190         custom protocol "inspector" that loads a page with the list of debuggable targets.
191
192         * PlatformGTK.cmake: Add new files to compilation and remove the old ones.
193         * UIProcess/API/gtk/WebKit2InspectorGResourceBundle.xml: Removed.
194         * UIProcess/API/gtk/WebKitRemoteInspectorProtocolHandler.cpp: Added.
195         (WebKit::RemoteInspectorProtocolHandler::RemoteInspectorProtocolHandler):
196         (WebKit::RemoteInspectorProtocolHandler::~RemoteInspectorProtocolHandler):
197         (WebKit::RemoteInspectorProtocolHandler::webViewDestroyed):
198         (WebKit::RemoteInspectorProtocolHandler::userContentManagerDestroyed):
199         (WebKit::RemoteInspectorProtocolHandler::handleRequest):
200         (WebKit::RemoteInspectorProtocolHandler::inspect):
201         (WebKit::RemoteInspectorProtocolHandler::targetListChanged):
202         (WebKit::RemoteInspectorProtocolHandler::connectionClosed):
203         * UIProcess/API/gtk/WebKitRemoteInspectorProtocolHandler.h: Added.
204         * UIProcess/API/gtk/WebKitWebContext.cpp:
205         (webkitWebContextConstructed):
206         * UIProcess/InspectorServer/HTTPRequest.cpp: Add missing ENABLE(INSPECTOR_SERVER) ifdefs.
207         * UIProcess/InspectorServer/HTTPRequest.h:
208         * UIProcess/InspectorServer/WebInspectorServer.h:
209         * UIProcess/InspectorServer/gtk/WebInspectorServerGtk.cpp: Removed.
210         * UIProcess/RemoteWebInspectorProxy.cpp:
211         * UIProcess/RemoteWebInspectorProxy.h:
212         * UIProcess/WebProcessPool.cpp:
213         * UIProcess/glib/RemoteInspectorClient.cpp: Added.
214         (WebKit::RemoteInspectorClient::RemoteInspectorClient):
215         (WebKit::RemoteInspectorClient::~RemoteInspectorClient):
216         (WebKit::dbusConnectionCallAsyncReadyCallback):
217         (WebKit::RemoteInspectorClient::connectionClosedCallback):
218         (WebKit::RemoteInspectorClient::setupConnection):
219         (WebKit::RemoteInspectorClient::connectionClosed):
220         (WebKit::RemoteInspectorClient::inspect):
221         (WebKit::RemoteInspectorClient::sendMessageToBackend):
222         (WebKit::RemoteInspectorClient::closeFromFrontend):
223         (WebKit::RemoteInspectorClient::setTargetList):
224         (WebKit::RemoteInspectorClient::sendMessageToFrontend):
225         * UIProcess/glib/RemoteInspectorClient.h: Added.
226         (WebKit::RemoteInspectorObserver::~RemoteInspectorObserver):
227         (WebKit::RemoteInspectorClient::targets):
228         (WebKit::RemoteInspectorClient::hostAndPort):
229         * UIProcess/gtk/RemoteWebInspectorProxyGtk.cpp: Added.
230         (WebKit::RemoteWebInspectorProxy::updateWindowTitle):
231         (WebKit::inspectorViewDestroyed):
232         (WebKit::RemoteWebInspectorProxy::platformCreateFrontendPageAndWindow):
233         (WebKit::RemoteWebInspectorProxy::platformCloseFrontendPageAndWindow):
234         (WebKit::RemoteWebInspectorProxy::platformBringToFront):
235         (WebKit::RemoteWebInspectorProxy::platformSave):
236         (WebKit::RemoteWebInspectorProxy::platformAppend):
237         (WebKit::RemoteWebInspectorProxy::platformStartWindowDrag):
238         (WebKit::RemoteWebInspectorProxy::platformOpenInNewTab):
239         * UIProcess/gtk/WebProcessPoolGtk.cpp:
240         (WebKit::initializeRemoteInspectorServer):
241         (WebKit::WebProcessPool::platformInitialize):
242         (WebKit::WebProcessPool::platformInitializeWebProcess):
243         * WebProcess/InjectedBundle/API/gtk/WebKitWebExtension.cpp:
244         (didReceiveMessageToPage): Updated after the GRefPtr hash traitds changes.
245         * config.h:
246
247 2017-04-23  Dan Bernstein  <mitz@apple.com>
248
249         [macOS] WKWebInspectorProxyObjCAdapter has a public ivar
250         https://bugs.webkit.org/show_bug.cgi?id=171200
251
252         Reviewed by Geoffrey Garen.
253
254         * UIProcess/API/C/mac/WKInspectorPrivateMac.h: Made ivar private.
255
256 2017-04-23  Commit Queue  <commit-queue@webkit.org>
257
258         Unreviewed, rolling out r215657 and r215676.
259         https://bugs.webkit.org/show_bug.cgi?id=171201
260
261         Broke the build (Requested by ap on #webkit).
262
263         Reverted changesets:
264
265         "[macOS] Enable media selection button on AVTouchBarScrubber"
266         https://bugs.webkit.org/show_bug.cgi?id=171149
267         http://trac.webkit.org/changeset/215657
268
269         "Build fix after r215657."
270         http://trac.webkit.org/changeset/215676
271
272 2017-04-23  Alexey Proskuryakov  <ap@apple.com>
273
274         Build fix after r215657.
275
276         * UIProcess/Cocoa/WebViewImpl.mm:
277
278 2017-04-23  Andy Estes  <aestes@apple.com>
279
280         [macOS] AVTouchBarMediaSelectionOptions should be created with the correct type
281         https://bugs.webkit.org/show_bug.cgi?id=171192
282         <rdar://problem/29875010>
283
284         Reviewed by Wenson Hsieh.
285
286         * Shared/WebCoreArgumentCoders.cpp:
287         (IPC::ArgumentCoder<MediaSelectionOption>::encode):
288         (IPC::ArgumentCoder<MediaSelectionOption>::decode):
289         * Shared/WebCoreArgumentCoders.h:
290         * UIProcess/Cocoa/WebPlaybackSessionManagerProxy.h:
291         * UIProcess/Cocoa/WebPlaybackSessionManagerProxy.messages.in:
292         * UIProcess/Cocoa/WebPlaybackSessionManagerProxy.mm:
293         (WebKit::WebPlaybackSessionModelContext::setAudioMediaSelectionOptions):
294         (WebKit::WebPlaybackSessionModelContext::setLegibleMediaSelectionOptions):
295         (WebKit::WebPlaybackSessionManagerProxy::setAudioMediaSelectionOptions):
296         (WebKit::WebPlaybackSessionManagerProxy::setLegibleMediaSelectionOptions):
297         * WebProcess/cocoa/WebPlaybackSessionManager.h:
298         * WebProcess/cocoa/WebPlaybackSessionManager.mm:
299         (WebKit::WebPlaybackSessionInterfaceContext::audioMediaSelectionOptionsChanged):
300         (WebKit::WebPlaybackSessionInterfaceContext::legibleMediaSelectionOptionsChanged):
301         (WebKit::WebPlaybackSessionManager::audioMediaSelectionOptionsChanged):
302         (WebKit::WebPlaybackSessionManager::legibleMediaSelectionOptionsChanged):
303
304 2017-04-21  Wenson Hsieh  <wenson_hsieh@apple.com>
305
306         Support writing link titles to the pasteboard when beginning data interaction on a link
307         https://bugs.webkit.org/show_bug.cgi?id=171154
308         <rdar://problem/31356937>
309
310         Reviewed by Andy Estes.
311
312         Adds support for setting the _title attribute of NSURLs written to the pasteboard. See WebCore ChangeLog for more details.
313
314         * Scripts/webkit/messages.py:
315         (headers_for_type):
316         * Shared/WebCoreArgumentCoders.cpp:
317         (IPC::ArgumentCoder<PasteboardURL>::encode):
318         (IPC::ArgumentCoder<PasteboardURL>::decode):
319         * Shared/WebCoreArgumentCoders.h:
320
321         Teach PasteboardURL to be serialized in IPC. For now, we just send across the absolute string of the link and
322         its title.
323
324         * UIProcess/Cocoa/WebPasteboardProxyCocoa.mm:
325         (WebKit::WebPasteboardProxy::writeURLToPasteboard):
326         * UIProcess/WebPasteboardProxy.h:
327         * UIProcess/WebPasteboardProxy.messages.in:
328
329         Add IPC plumbing for writing PasteboarURLs to the pasteboard.
330
331         * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
332         (WebKit::WebPlatformStrategies::writeToPasteboard):
333         * WebProcess/WebCoreSupport/WebPlatformStrategies.h:
334
335 2017-04-21  Michael Catanzaro  <mcatanzaro@igalia.com>
336
337         Unreviewed, rolling out r215608.
338
339         Hundreds of test failures on GTK bot
340
341         Reverted changeset:
342
343         "Reduce copies and allocations in SharedBuffer::append"
344         https://bugs.webkit.org/show_bug.cgi?id=170956
345         http://trac.webkit.org/changeset/215608
346
347 2017-04-21  Andy Estes  <aestes@apple.com>
348
349         [macOS] Enable media selection button on AVTouchBarScrubber
350         https://bugs.webkit.org/show_bug.cgi?id=171149
351         <rdar://problem/29875010>
352
353         Reviewed by Beth Dakin.
354
355         * UIProcess/Cocoa/WebViewImpl.mm:
356         (WebKit::WebViewImpl::updateMediaTouchBar):
357
358 2017-04-21  Wenson Hsieh  <wenson_hsieh@apple.com>
359
360         [WK2] Add delegate hooks for overriding unhanded data interaction operations
361         https://bugs.webkit.org/show_bug.cgi?id=171005
362         <rdar://problem/31669646>
363
364         Reviewed by Tim Horton.
365
366         Adds support for overriding data interaction operations through two new delegate methods:
367         _webView:willUpdateDataInteractionOperationToOperation:forSession:, and
368         _webView:dataInteractionOperationWasHandled:forSession:. The former may be overridden to return a different
369         operation type than what WebKit would originally have returned, and the latter may be overridden to run custom
370         logic after the web process has handled a data interaction operation.
371
372         Additionally, includes some minor cleanup around WKContentViewInteraction. With the new
373         _webView:dataInteractionOperationWasHandled:forSession: delegate method, the last method on _WKTestingDelegate
374         may be removed. This means _WKTestingDelegate is no longer needed, so this patch removes its header entirely.
375         Also, relocates some state variables formerly on WKContentView to WKContentView's WKDataInteractionState struct
376         instead, so that all state associated with data interaction may be cleaned up at the same time.
377
378         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
379         * UIProcess/API/Cocoa/WKWebView.mm:
380         (-[WKWebView _testingDelegate]): Deleted.
381         (-[WKWebView _setTestingDelegate:]): Deleted.
382         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
383         * UIProcess/API/Cocoa/_WKTestingDelegate.h: Removed.
384         * UIProcess/PageClient.h:
385         * UIProcess/WebPageProxy.h:
386         * UIProcess/WebPageProxy.messages.in:
387
388         Add a new "handled" IPC argument to DidPerformDataInteractionControllerOperation. This lets the UI process
389         know whether or not the data interaction operation was handled by the web process, and is eventually plumbed
390         through to the UI delegate via the new SPI.
391
392         * UIProcess/ios/PageClientImplIOS.h:
393         * UIProcess/ios/PageClientImplIOS.mm:
394         (WebKit::PageClientImpl::didPerformDataInteractionControllerOperation):
395         * UIProcess/ios/WKContentViewInteraction.h:
396         * UIProcess/ios/WKContentViewInteraction.mm:
397         (-[WKContentView cleanupInteraction]):
398         (-[WKContentView _displayFormNodeInputView]):
399         (-[WKContentView _startAssistingNode:userIsInteracting:blurPreviousNode:userObject:]):
400         * UIProcess/ios/WebPageProxyIOS.mm:
401         (WebKit::WebPageProxy::didPerformDataInteractionControllerOperation):
402         * WebKit2.xcodeproj/project.pbxproj:
403         * WebProcess/WebPage/WebPage.cpp:
404         (WebKit::WebPage::performDragControllerAction):
405
406 2017-04-21  Anders Carlsson  <andersca@apple.com>
407
408         Stop using deprecated APIs, part 5
409         https://bugs.webkit.org/show_bug.cgi?id=171134
410         rdar://problem/31589635
411
412         Reviewed by Tim Horton.
413
414         * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
415         (WebKit::toPKPaymentAuthorizationStatus):
416         Remove this and add a new version that doesn't use any deprecated values.
417
418         (WebKit::toPKPaymentAuthorizationStatus):
419         New function that takes a WebCore::PaymentAuthorizationResult and converts it to a status, for older OSes.
420
421         (WebKit::WebPaymentCoordinatorProxy::platformCompletePaymentSession):
422         Use the new toPKPaymentAuthorizationStatus versions.
423
424         (WebKit::WebPaymentCoordinatorProxy::platformCompleteShippingContactSelection):
425         Ditto.
426
427         (WebKit::status): Deleted.
428
429 2017-04-21  David Kilzer  <ddkilzer@apple.com>
430
431         Switch from -std=gnu++11 to -std=gnu++14 for consistency in DerivedSources.make
432         <https://webkit.org/b/171122>
433
434         Reviewed by Brent Fulgham.
435
436         * DerivedSources.make: Switch to -std=gnu++14 for preprocessing
437         headers to check for build settings.
438
439 2017-04-21  Jer Noble  <jer.noble@apple.com>
440
441         [WK2][MediaCapture] Pass muted and enabled state across process boundary when capturing in UIProcess
442         https://bugs.webkit.org/show_bug.cgi?id=170846
443
444         Reviewed by Jon Lee.
445
446         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp:
447         (WebKit::UserMediaCaptureManagerProxy::setMuted):
448         (WebKit::UserMediaCaptureManagerProxy::setEnabled):
449         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.h:
450         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.messages.in:
451         * WebProcess/cocoa/UserMediaCaptureManager.cpp:
452         (WebKit::UserMediaCaptureManager::Source::setMuted):
453         (WebKit::UserMediaCaptureManager::Source::setEnabled):
454         (WebKit::UserMediaCaptureManager::setMuted):
455         (WebKit::UserMediaCaptureManager::setEnabled):
456         * WebProcess/cocoa/UserMediaCaptureManager.h:
457
458 2017-04-21  Jer Noble  <jer.noble@apple.com>
459
460         [WK2][MediaCapture] Remove now-unused WKWebViewConfiguration property for shouldCaptureAudioInUIProcess
461         https://bugs.webkit.org/show_bug.cgi?id=170847
462
463         Reviewed by Jon Lee.
464
465         * Shared/WebPreferencesDefinitions.h:
466         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
467         (-[WKWebViewConfiguration copyWithZone:]):
468         (-[WKWebViewConfiguration _shouldCaptureAudioInUIProcess]): Deleted.
469         (-[WKWebViewConfiguration _setShouldCaptureAudioInUIProcess:]): Deleted.
470
471 2017-04-21  Anders Carlsson  <andersca@apple.com>
472
473         Stop using deprecated APIs, part 4
474         https://bugs.webkit.org/show_bug.cgi?id=171125
475         rdar://problem/31589635
476
477         Reviewed by Tim Horton.
478
479         It doesn't really matter what we pass to these completion functions, since the sheet has already been dismissed at this point
480         so just remove the status parameter.
481
482         * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
483         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didSelectPaymentMethod:handler:]):
484         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didSelectShippingMethod:handler:]):
485         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didSelectShippingContact:handler:]):
486
487 2017-04-21  Andrew Gold  <agold@apple.com>
488
489         -[WKUIDelegatePrivate _webView:requestUserMediaAuthorizationForMicrophone:camera:url:mainFrameURL:decisionHandler:] 
490         decision handler should only have one parameter.
491         https://bugs.webkit.org/show_bug.cgi?id=171081
492
493         Reviewed by Tim Horton.
494
495         Because user media authorization is all or nothing, we should not have separate booleans
496         to indicate authorization. Additionally, rather than passing two separate booleans to the
497         UIDelegate, we now pass an NS_OPTIONS parameter.
498
499         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
500         * UIProcess/API/Cocoa/WKWebViewPrivate.h: Added _WKCaptureDevice NS_OPTIONS.
501
502         * UIProcess/Cocoa/UIDelegate.mm:
503         * UIProcess/Cocoa/UIDelegate.mm:
504         (WebKit::UIDelegate::setDelegate): Uses new WKUIDelegatePrivate method.
505         (WebKit::UIDelegate::UIClient::decidePolicyForUserMediaPermissionRequest): Ditto.
506
507 2017-04-21  Konstantin Tokarev  <annulen@yandex.ru>
508
509         Unreviewed, added missing file to PlatformMac.cmake
510
511         * PlatformMac.cmake:
512
513 2017-04-21  Konstantin Tokarev  <annulen@yandex.ru>
514
515         Unreviewed follow-up for r215609
516
517         * UIProcess/API/Cocoa/WKWebView.mm: Move internal header include too.
518
519 2017-04-21  Konstantin Tokarev  <annulen@yandex.ru>
520
521         Include iOS-specific headers inside preprocessor guard
522         https://bugs.webkit.org/show_bug.cgi?id=171104
523
524         Reviewed by Michael Catanzaro.
525
526         This patch should fix Mac cmake build.
527
528         * UIProcess/API/Cocoa/WKWebView.mm:
529
530 2017-04-21  Alex Christensen  <achristensen@webkit.org>
531
532         Reduce copies and allocations in SharedBuffer::append
533         https://bugs.webkit.org/show_bug.cgi?id=170956
534
535         Reviewed by Andreas Kling.
536
537         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
538         (-[WKNetworkSessionDelegate URLSession:dataTask:didReceiveData:]):
539         * Platform/IPC/DataReference.cpp:
540         (IPC::SharedBufferDataReference::encode):
541         * Shared/ShareableResource.cpp:
542         (WebKit::ShareableResource::wrapInSharedBuffer):
543         * UIProcess/API/Cocoa/WKURLSchemeHandlerTask.mm:
544         (-[WKURLSchemeHandlerTaskImpl didReceiveData:]):
545         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:
546         (-[WKWebProcessPlugInBrowserContextController _setEditingDelegate:]):
547         * WebProcess/Plugins/PDF/PDFPlugin.mm:
548         (WebKit::PDFPlugin::addArchiveResource):
549         (WebKit::PDFPlugin::liveResourceData):
550         (WebKit::PDFPlugin::writeItemsToPasteboard):
551         * WebProcess/Plugins/PluginView.cpp:
552         (WebKit::PluginView::redeliverManualStream):
553         * WebProcess/WebCoreSupport/mac/WebDragClientMac.mm:
554         (WebKit::WebDragClient::declareAndWriteDragImage):
555         * WebProcess/WebPage/mac/WebPageMac.mm:
556         (WebKit::WebPage::cachedResponseDataForURL):
557
558 2017-04-20  Konstantin Tokarev  <annulen@yandex.ru>
559
560         [cmake] Define FORWARDING_HEADERS_DIR in WebKitFS and use it everywhere
561         https://bugs.webkit.org/show_bug.cgi?id=171071
562
563         Reviewed by Michael Catanzaro.
564
565         "${DERIVED_SOURCES_DIR}/ForwardingHeaders" path occurs very often in the
566         build system files. GTK-specifc FORWARDING_HEADERS_DIR variable should
567         be available for all ports.
568
569         * CMakeLists.txt:
570         * PlatformMac.cmake:
571
572 2017-04-20  Brady Eidson  <beidson@apple.com>
573
574         WebContent process becomes unresponsive after returning nil from async version of -webView:createWebViewWithConfiguration:...
575         <rdar://problem/31739023> and https://bugs.webkit.org/show_bug.cgi?id=171090
576
577         Reviewed by Andy Estes.
578
579         * UIProcess/Cocoa/UIDelegate.mm:
580         (WebKit::UIDelegate::UIClient::createNewPageCommon): Handle the perfectly valid "nil webView" case correctly.
581
582 2017-04-20  Dan Bernstein  <mitz@apple.com>
583
584         Disable header postprocessing when building for Sierra
585
586         Absolutely rubber-stamped by Anders Carlsson.
587
588         * Configurations/WebKit.xcconfig:
589
590 2017-04-20  Matt Rajca  <mrajca@apple.com>
591
592         Cocoa: add private API for suppressing first responder changes
593         https://bugs.webkit.org/show_bug.cgi?id=171069
594         <rdar://problem/31658967>
595
596         Reviewed by Tim Horton.
597
598         Some clients may not want the web view to be programmatically made the first responder
599         and invoking -makeFirstResponder: unconditionally posts 'first responder did change'
600         notifications.
601
602         Added API test.
603
604         * UIProcess/API/Cocoa/WKWebView.mm:
605         (-[WKWebView _setShouldSuppressFirstResponderChanges:]):
606         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
607         * UIProcess/Cocoa/WebViewImpl.h:
608         * UIProcess/Cocoa/WebViewImpl.mm:
609         (WebKit::WebViewImpl::setShouldSuppressFirstResponderChanges):
610         * UIProcess/PageClient.h:
611         * UIProcess/mac/PageClientImpl.h:
612         * UIProcess/mac/PageClientImpl.mm:
613         (WebKit::PageClientImpl::makeFirstResponder):
614
615 2017-04-20  Eric Carlson  <eric.carlson@apple.com>
616
617         [MediaStream iOS] Hold process assertion while media capture is active
618         https://bugs.webkit.org/show_bug.cgi?id=171017
619         <rdar://problem/31719177>
620
621         Reviewed by Dean Jackson.
622
623         * UIProcess/WebPageProxy.cpp:
624         (WebKit::WebPageProxy::updateActivityState): Update IsCapturingMedia when necessary.
625         (WebKit::WebPageProxy::updateThrottleState): Hold a token when capture is active.
626         (WebKit::WebPageProxy::setMuted): Capture state may change when the page is muted,
627         so pass IsCapturingMedia to activityStateDidChange.
628         (WebKit::WebPageProxy::isPlayingMediaDidChange): Ditto.
629
630         * WebProcess/WebPage/WebPage.cpp:
631         (WebKit::WebPage::updateThrottleState): Don't allow page suppression when capture
632         is active. 
633
634 2017-04-20  Anders Carlsson  <andersca@apple.com>
635
636         Fix build.
637
638         * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
639         (WebKit::WebPaymentCoordinatorProxy::platformCompletePaymentSession):
640
641 2017-04-20  Brady Eidson  <beidson@apple.com>
642
643         Add CompletionHandlerCallChecker to SPI added in r215545.
644         https://bugs.webkit.org/show_bug.cgi?id=171067
645
646         Reviewed by Dan Bernstein.
647
648         * UIProcess/Cocoa/UIDelegate.mm:
649         (WebKit::UIDelegate::UIClient::createNewPageCommon):
650
651 2017-04-20  Anders Carlsson  <andersca@apple.com>
652
653         Replace isFinalStateStatus with isFinalStateResult
654         https://bugs.webkit.org/show_bug.cgi?id=171072
655         rdar://problem/31589635
656
657         Reviewed by Tim Horton.
658
659         * UIProcess/ApplePay/WebPaymentCoordinatorProxy.cpp:
660         (WebKit::WebPaymentCoordinatorProxy::completePaymentSession):
661
662 2017-04-20  Wenson Hsieh  <wenson_hsieh@apple.com>
663
664         [WK2] -[WKContentView doAfterPositionInformationUpdate:atPosition:] should be robust against synchronous reentrancy
665         https://bugs.webkit.org/show_bug.cgi?id=170922
666         <rdar://problem/31634990>
667
668         Reviewed by Tim Horton.
669
670         Refactors part of the asynchronous position information mechanism introduced in
671         <https://trac.webkit.org/changeset/215171>, and introduces infrastructure for unit testing UI-side position
672         information requests.
673
674         _invokeAndRemovePendingHandlersValidForCurrentPositionInformation is a helper method on WKContentView
675         responsible for invoking queued position information handlers after receiving a position information response
676         from the web process. Previously, this method would iterate over the list of pending callbacks and invoke all
677         callbacks whose requests are satisfied by the incoming position information update, saving the indices of these
678         handled callbacks in the process. At the end, it would then remove callbacks at these indices from the array of
679         pending callbacks. This is problematic when a synchronous position update (via
680         ensurePositionInformationIsUpToDate:) is triggered from within one of these callbacks, since
681         _invokeAndRemovePendingHandlersValidForCurrentPositionInformation will be called from within itself, and then we
682         will attempt to remove a callback at the same index twice.
683
684         To fix this, we change the array of pending position information handlers to be an array of optionals instead.
685         When invoking and removing pending handlers after a position information response arrives, we now mark callbacks
686         as handled by setting them to std::nullopt. Then, when the top-level invocation to
687         _invokeAndRemovePendingHandlersValidForCurrentPositionInformation is finished, we remove all marked handlers
688         from the pending vector.
689
690         Covered by 6 new unit tests:
691         - PositionInformationTests.FindDraggableLinkAtPosition
692         - PositionInformationTests.RequestDraggableLinkAtPosition
693         - PositionInformationTests.FindDraggableLinkAtDifferentPositionWithinRequestBlock
694         - PositionInformationTests.FindDraggableLinkAtSamePositionWithinRequestBlock
695         - PositionInformationTests.RequestDraggableLinkAtSamePositionWithinRequestBlock
696         - PositionInformationTests.RequestDraggableLinkAtDifferentPositionWithinRequestBlock
697
698         * UIProcess/API/Cocoa/WKWebView.mm:
699         (-[WKWebView draggableElementAtPosition:]):
700         (-[WKWebView requestDraggableElementAtPosition:completionBlock:]):
701
702         Uses WKContentView's position information request helpers to search for draggable elements on the page. There
703         are both synchronous and asynchronous versions of this, both of which retrieve a _WKDraggableElementInfo.
704
705         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
706         * UIProcess/API/Cocoa/_WKDraggableElementInfo.h: Added.
707         * UIProcess/API/Cocoa/_WKDraggableElementInfo.mm: Added.
708
709         Exposes what elements are draggable at a given position as SPI (only for use in testing code, at the moment).
710
711         (-[_WKDraggableElementInfo initWithInteractionInformationAtPosition:]):
712         (-[_WKDraggableElementInfo copyWithZone:]):
713         * UIProcess/API/Cocoa/_WKDraggableElementInfoInternal.h: Added.
714         * UIProcess/ios/WKContentViewInteraction.h:
715         * UIProcess/ios/WKContentViewInteraction.mm:
716         (-[WKContentView currentPositionInformation]):
717         (-[WKContentView doAfterPositionInformationUpdate:forRequest:]):
718         (-[WKContentView _invokeAndRemovePendingHandlersValidForCurrentPositionInformation]):
719         * WebKit2.xcodeproj/project.pbxproj:
720
721 2017-04-20  Anders Carlsson  <andersca@apple.com>
722
723         Fix a PassKit function declaration typo
724         https://bugs.webkit.org/show_bug.cgi?id=171068
725         rdar://problem/31635008
726
727         Reviewed by Tim Horton.
728
729         * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
730         (WebKit::WebPaymentCoordinatorProxy::platformCanMakePaymentsWithActiveCard):
731
732 2017-04-20  Jer Noble  <jer.noble@apple.com>
733
734         [MediaCapture] gUM() with CoreAudio fails if capturing audio in the UIProcess.
735         https://bugs.webkit.org/show_bug.cgi?id=171021
736
737         Reviewed by Eric Carlson.
738
739         Pass a deviceID rather than a CaptureDevice across the process boundary.
740
741         * Shared/WebCoreArgumentCoders.h:
742         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp:
743         (WebKit::UserMediaCaptureManagerProxy::createMediaSourceForCaptureDeviceWithConstraints):
744         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.h:
745         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.messages.in:
746         * WebProcess/cocoa/UserMediaCaptureManager.cpp:
747         (WebKit::UserMediaCaptureManager::createMediaSourceForCaptureDeviceWithConstraints):
748         * WebProcess/cocoa/UserMediaCaptureManager.h:
749
750 2017-04-20  Alex Christensen  <achristensen@webkit.org>
751
752         Fix assertions in webProcessProxyFromConnection
753         https://bugs.webkit.org/show_bug.cgi?id=171025
754         <rdar://problem/31184073>
755
756         Reviewed by Brady Eidson.
757
758         * UIProcess/WebProcessPool.cpp:
759         (WebKit::webProcessProxyFromConnection):
760         If we have a Connection, then we have a valid process attached to that connection,
761         unless it's a Connection to a different type of child process.
762         Calling ChildProcessProxy::connection on other web processes that are in State::Launching,
763         then we get an assertion.  Luckily, ChildProcessProxy::hasConnection was introduced in r210861
764         for this reason.
765
766 2017-04-20  Brent Fulgham  <bfulgham@apple.com>
767
768         [WK2][macOS] Allow iokit-get-properties for IOAudioControlValue
769         https://bugs.webkit.org/show_bug.cgi?id=171020
770         <rdar://problem/30878974>
771
772         Reviewed by Alexey Proskuryakov.
773
774         * WebProcess/com.apple.WebProcess.sb.in: Add missing property name.
775
776 2017-04-19  Joseph Pecoraro  <pecoraro@apple.com>
777
778         Remove WebKitTestRunner code for enabling features that are already enabled by default
779         https://bugs.webkit.org/show_bug.cgi?id=171033
780
781         Reviewed by Ryosuke Niwa.
782
783         * WebProcess/InjectedBundle/InjectedBundle.cpp:
784         (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner):
785
786 2017-04-19  Youenn Fablet  <youenn@apple.com>
787
788         [Mac] Allow customizing H264 encoder
789         https://bugs.webkit.org/show_bug.cgi?id=170829
790
791         Reviewed by Alex Christensen.
792
793         * Configurations/FeatureDefines.xcconfig:
794         * WebKit2.xcodeproj/project.pbxproj:
795
796 2017-04-19  Brady Eidson  <beidson@apple.com>
797
798         Add asynchronous equivalent of -[<WKUIDelegate> webView:createWebViewWithConfiguration:...].
799         <rdar://problem/30699851> and https://bugs.webkit.org/show_bug.cgi?id=171018
800
801         Reviewed by Tim Horton.
802
803         * UIProcess/API/APIUIClient.h:
804         (API::UIClient::createNewPageAsync):
805
806         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
807
808         * UIProcess/Cocoa/UIDelegate.h:
809         * UIProcess/Cocoa/UIDelegate.mm:
810         (WebKit::UIDelegate::setDelegate):
811         (WebKit::UIDelegate::UIClient::createNewPageCommon):
812         (WebKit::UIDelegate::UIClient::createNewPage):
813         (WebKit::UIDelegate::UIClient::createNewPageAsync):
814
815         * UIProcess/WebPageProxy.cpp:
816         (WebKit::WebPageProxy::createNewPage):
817         * UIProcess/WebPageProxy.h:
818         * UIProcess/WebPageProxy.messages.in:
819
820 2017-04-19  Anders Carlsson  <andersca@apple.com>
821
822         Stop using deprecated APIs, part 3
823         https://bugs.webkit.org/show_bug.cgi?id=171003
824         rdar://problem/31589635
825
826         Reviewed by Tim Horton.
827
828         * Shared/Cocoa/WebCoreArgumentCodersCocoa.mm:
829         (IPC::ArgumentCoder<WebCore::ShippingMethodUpdate>::encode):
830         (IPC::ArgumentCoder<WebCore::ShippingMethodUpdate>::decode):
831         Don't encode/decode status.
832
833         * UIProcess/ApplePay/WebPaymentCoordinatorProxy.cpp:
834         (WebKit::WebPaymentCoordinatorProxy::cancelPaymentSession):
835         Hide the UI and report back.
836
837         * UIProcess/ApplePay/WebPaymentCoordinatorProxy.h:
838         Add new member.
839
840         * UIProcess/ApplePay/WebPaymentCoordinatorProxy.messages.in:
841         Add new message.
842
843         * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
844         (WebKit::WebPaymentCoordinatorProxy::platformCompleteShippingMethodSelection):
845         Always pass success in the old code path. Stop using the deprecated method.
846
847         * WebProcess/ApplePay/WebPaymentCoordinator.cpp:
848         (WebKit::WebPaymentCoordinator::cancelPaymentSession):
849         Send a message to the UI process.
850
851         * WebProcess/ApplePay/WebPaymentCoordinator.h:
852         Add new member.
853
854 2017-04-19  Eric Carlson  <eric.carlson@apple.com>
855
856         [MediaStream] Limit capture to one tab at a time
857         https://bugs.webkit.org/show_bug.cgi?id=171009
858
859         Reviewed by Jon Lee.
860
861         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
862         (WebKit::UserMediaPermissionRequestManagerProxy::stopCapture): Deleted, not used.
863         * UIProcess/UserMediaPermissionRequestManagerProxy.h:
864
865         * UIProcess/UserMediaProcessManager.cpp:
866         (WebKit::UserMediaProcessManager::willEnableMediaStreamInPage): Mute media streams
867         on other pages.
868         (WebKit::UserMediaProcessManager::willCreateMediaStream): Call willEnableMediaStreamInPage.
869         * UIProcess/UserMediaProcessManager.h:
870
871         * UIProcess/WebPageProxy.cpp:
872         (WebKit::WebPageProxy::setMuted): If media streams in the page will be unmuted, call
873         willEnableMediaStreamInPage so streams in other pages are muted first.
874
875 2017-04-19  Brady Eidson  <beidson@apple.com>
876
877         REGRESSION (r213168): An extra Web Content process is spun up on launch and is never closed.
878         <rdar://problem/30774839> and https://bugs.webkit.org/show_bug.cgi?id=171002
879
880         Reviewed by Alex Christensen.
881
882         The original change unnecessarily avoided using the initial warmed process if an explicit
883         data store was set on the new WKWebView.
884         
885         Fixing that fixes the regression.
886         
887         * UIProcess/API/Cocoa/WKProcessPool.mm:
888         (-[WKProcessPool _webProcessCount]):
889         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
890
891         * UIProcess/WebProcessPool.cpp:
892         (WebKit::WebProcessPool::createWebPage):
893
894 2017-04-19  Anders Carlsson  <andersca@apple.com>
895
896         Rename cancelPayment to cancelPaymentSession
897         https://bugs.webkit.org/show_bug.cgi?id=171007
898
899         Reviewed by Tim Horton.
900
901         * UIProcess/ApplePay/WebPaymentCoordinatorProxy.cpp:
902         (WebKit::WebPaymentCoordinatorProxy::showPaymentUI):
903         (WebKit::WebPaymentCoordinatorProxy::didCancelPaymentSession):
904         (WebKit::WebPaymentCoordinatorProxy::didCancelPayment): Deleted.
905         * UIProcess/ApplePay/WebPaymentCoordinatorProxy.h:
906         * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
907         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewControllerDidFinish:]):
908         * WebProcess/ApplePay/WebPaymentCoordinator.cpp:
909         (WebKit::WebPaymentCoordinator::didCancelPaymentSession):
910         (WebKit::WebPaymentCoordinator::didCancelPayment): Deleted.
911         * WebProcess/ApplePay/WebPaymentCoordinator.h:
912         * WebProcess/ApplePay/WebPaymentCoordinator.messages.in:
913
914 2017-04-19  David Kilzer  <ddkilzer@apple.com>
915
916         Stop using strcpy() in WebKit::EnvironmentUtilities::stripValuesEndingWithString()
917         <https://webkit.org/b/170994>
918         <rdar://problem/29889932>
919
920         Reviewed by Brent Fulgham.
921
922         * Platform/unix/EnvironmentUtilities.cpp:
923         (WebKit::EnvironmentUtilities::stripValuesEndingWithString):
924         Switch from using strcpy() to strlcpy().  Also switch from using
925         strstr() to strnstr().
926         * Platform/unix/EnvironmentUtilities.h: Switch to #pragma once.
927         (WebKit::EnvironmentUtilities::stripValuesEndingWithString):
928         Export function for testing.
929         * WebKit2.xcodeproj/project.pbxproj:
930         (EnvironmentUtilitiesTest.h): Make header private for testing.
931
932 2017-04-19  Eric Carlson  <eric.carlson@apple.com>
933
934         Provide a way for clients to unmute a media stream.
935         https://bugs.webkit.org/show_bug.cgi?id=170855
936         <rdar://problem/31656855>
937
938         Unreviewed, fix a typo missed in the review of r215420.
939
940         * UIProcess/API/Cocoa/WKWebView.mm:
941         (-[WKWebView _setPageMuted:]):
942
943 2017-04-19  Adrian Perez de Castro  <aperez@igalia.com>
944
945         [GTK] WebKitAutocleanups.h regression in v2.16.1 release
946         https://bugs.webkit.org/show_bug.cgi?id=170987
947
948         Reviewed by Carlos Garcia Campos.
949
950         * UIProcess/API/gtk/WebKitAutocleanups.h: Remove stray semicolon.
951
952 2017-04-18  Per Arne Vollan  <pvollan@apple.com>
953
954         Dragging a few items over MiniBrowser has 0 in the red indicator.
955         https://bugs.webkit.org/show_bug.cgi?id=170874
956
957         Reviewed by Tim Horton.
958
959         When WebKit does not accept the drag items, the drag count badge should not be updated.
960         Also, if WebKit changes the drag count badge, it should be restored to its original
961         value when the drag exits.
962
963         * UIProcess/Cocoa/WebViewImpl.h:
964         * UIProcess/Cocoa/WebViewImpl.mm:
965         (WebKit::WebViewImpl::draggingEntered):
966         (WebKit::WebViewImpl::draggingUpdated):
967         (WebKit::WebViewImpl::draggingExited):
968
969 2017-04-18  Wenson Hsieh  <wenson_hsieh@apple.com>
970
971         [WK2] Add infrastructure and unit tests for file uploads using data interaction
972         https://bugs.webkit.org/show_bug.cgi?id=170903
973         <rdar://problem/31314689>
974
975         Reviewed by Tim Horton.
976
977         See Tools/ChangeLog for more details. Makes a small adjustment to _simulateDataInteractionUpdated: to return a
978         BOOL indicating whether or not to allow the operation to proceed. This is necessary for testing scenarios where
979         multiple files are being "data interacted" onto an element. See <https://bugs.webkit.org/show_bug.cgi?id=170880>
980         for more details about the change this patch is testing.
981
982         * UIProcess/API/Cocoa/WKWebView.mm:
983         (-[WKWebView _simulateDataInteractionUpdated:]):
984         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
985         * UIProcess/ios/WKContentViewInteraction.h:
986
987 2017-04-18  Wenson Hsieh  <wenson_hsieh@apple.com>
988
989         [WK2] Support DataTransfer::files() when performing a DHTML data interaction
990         https://bugs.webkit.org/show_bug.cgi?id=170880
991         <rdar://problem/31314689>
992
993         Reviewed by Tim Horton.
994
995         See the WebCore ChangeLog for more details.
996
997         * UIProcess/Cocoa/WebPasteboardProxyCocoa.mm:
998         (WebKit::WebPasteboardProxy::getFilenamesForDataInteraction):
999         * UIProcess/WebPageProxy.cpp:
1000         (WebKit::WebPageProxy::didPerformDragControllerAction):
1001         (WebKit::WebPageProxy::resetCurrentDragInformation):
1002         * UIProcess/WebPageProxy.h:
1003         (WebKit::WebPageProxy::documentIsHandlingNonDefaultDrag):
1004         * UIProcess/WebPageProxy.messages.in:
1005
1006         Adds an IPC argument to DidPerformDragControllerAction specifying whether the page prevented the default behavior.
1007
1008         * UIProcess/WebPasteboardProxy.h:
1009         * UIProcess/WebPasteboardProxy.messages.in:
1010
1011         Adds IPC plumbing for the new filenamesForDataInteraction Pasteboard codepath.
1012
1013         * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
1014         (WebKit::WebPlatformStrategies::getFilenamesForDataInteraction):
1015         * WebProcess/WebCoreSupport/WebPlatformStrategies.h:
1016         * WebProcess/WebPage/WebPage.cpp:
1017         (WebKit::WebPage::performDragControllerAction):
1018
1019 2017-04-18  John Wilander  <wilander@apple.com>
1020
1021         Resource Load Statistics: Check both origins and cookieHostNames for domain matches in data removal
1022         https://bugs.webkit.org/show_bug.cgi?id=170763
1023         <rdar://problem/31573091>
1024
1025         Reviewed by Alex Christensen.
1026
1027         * UIProcess/WebProcessProxy.cpp:
1028         (WebKit::WebProcessProxy::deleteWebsiteDataForTopPrivatelyControlledDomainsInAllPersistentDataStores):
1029             Move semantics for topPrivatelyControlledDomains vector.
1030         (WebKit::WebProcessProxy::deleteWebsiteDataForTopPrivatelyOwnedDomainsInAllPersistentDataStores): Deleted.
1031             Renamed 'PrivatelyControlled' instead of 'PrivatelyOwned.'
1032         * UIProcess/WebProcessProxy.h:
1033         * UIProcess/WebResourceLoadStatisticsStore.cpp:
1034         (WebKit::WebResourceLoadStatisticsStore::removeDataRecords):
1035             Move semantics for prevalentResourceDomains vector.
1036         * UIProcess/WebsiteData/WebsiteDataRecord.cpp:
1037         (WebKit::hostIsInDomain):
1038             Static convenience function.
1039         (WebKit::WebsiteDataRecord::matchesTopPrivatelyControlledDomain):
1040             Checks for matching cookieHostNames if types contains WebsiteDataType::Cookies.
1041             Also checks origins.
1042         * UIProcess/WebsiteData/WebsiteDataRecord.h:
1043         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
1044         (WebKit::WebsiteDataStore::fetchDataForTopPrivatelyControlledDomains):
1045             Now makes use of the new function
1046             WebKit::WebsiteDataRecord::validForTopPrivatelyControlledDomain().
1047         (WebKit::WebsiteDataStore::removeDataForTopPrivatelyControlledDomains):
1048             Move semantics for topPrivatelyControlledDomains vector.
1049         (WebKit::WebsiteDataStore::fetchDataForTopPrivatelyOwnedDomains): Deleted.
1050             Renamed 'PrivatelyControlled' instead of 'PrivatelyOwned.'
1051         (WebKit::WebsiteDataStore::removeDataForTopPrivatelyOwnedDomains): Deleted.
1052             Renamed 'PrivatelyControlled' instead of 'PrivatelyOwned.'
1053         * UIProcess/WebsiteData/WebsiteDataStore.h:
1054
1055 2017-04-18  Brent Fulgham  <bfulgham@apple.com>
1056
1057         [iOS][WK2] Prevent ephemeral files from being backed up
1058         https://bugs.webkit.org/show_bug.cgi?id=170963
1059         <rdar://problem/30470332>
1060
1061         Reviewed by Brady Eidson.
1062
1063         Tell the OS to skip temporary data files when performing backups.
1064
1065         * UIProcess/Cocoa/WebResourceLoadStatisticsStoreCocoa.mm: Added.
1066         (WebKit::WebResourceLoadStatisticsStore::platformExcludeFromBackup): Added.
1067         * UIProcess/WebResourceLoadStatisticsStore.cpp:
1068         (WebKit::WebResourceLoadStatisticsStore::writeEncoderToDisk):
1069         (WebKit::WebResourceLoadStatisticsStore::platformExcludeFromBackup): Add stub for
1070         non-iOS platforms.
1071         * UIProcess/WebResourceLoadStatisticsStore.h:
1072         * WebKit2.xcodeproj/project.pbxproj: Add new file.
1073
1074 2017-04-18  Wenson Hsieh  <wenson_hsieh@apple.com>
1075
1076         [WK2] Cannot select text on nytimes.com when the selection granularity is WKSelectionGranularityCharacter
1077         https://bugs.webkit.org/show_bug.cgi?id=170968
1078         <rdar://problem/31692560>
1079
1080         Reviewed by Dan Bernstein.
1081
1082         Makes a small adjustment to textInteractionGesture:shouldBeginAtPoint:. When determining whether to allow the
1083         text interaction assistant to recognize at a given point, instead of depending on whether or not the hit node is
1084         the same as the assisted node, only enforce this restriction when editing an assisted node. Otherwise, default
1085         to allowing the selection gesture.
1086
1087         Note that character granularity selection was working on most pages before, due to the fact that
1088         nodeAtPositionIsAssistedNode was true in many cases when there is no assisted node at all. This is because, in
1089         WebPage.mm, we compute the hit-tested node responding to click events to be null, and then set
1090         nodeAtPositionIsAssistedNode to be equal to hitNode == m_assistedNode, which ends up being true because both of
1091         these values are null.
1092
1093         This allowed text selection to work in the simple case when selection granularity character is used, but not
1094         when the node containing the selected point actually does respond to click events, since the comparison returns
1095         false.
1096
1097         New layout test: LayoutTests/editing/selection/character-granularity-select-text-with-click-handler.html.
1098
1099         * UIProcess/ios/WKContentViewInteraction.mm:
1100         (-[WKContentView textInteractionGesture:shouldBeginAtPoint:]):
1101
1102 2017-04-18  Keith Rollin  <krollin@apple.com>
1103
1104         Add additional information when logging URL disposition in WebLoaderStrategy::scheduleLoad
1105         https://bugs.webkit.org/show_bug.cgi?id=170813
1106
1107         Reviewed by Alex Christensen.
1108
1109         There are a few logging statements in WebLoaderStrategy::scheduleLoad
1110         that report, for example, "URL will be loaded as data". These
1111         statements also log the address of the frame doing the loading and the
1112         identifier of the resource. For consistency with other logging and to
1113         make scripted analysis of the logs more robust, also include the
1114         pageID and frameID in the logging.
1115
1116         * WebProcess/Network/WebLoaderStrategy.cpp:
1117         (WebKit::WebLoaderStrategy::scheduleLoad):
1118
1119 2017-04-18  Anders Carlsson  <andersca@apple.com>
1120
1121         Stop using deprecated APIs, part 2
1122         https://bugs.webkit.org/show_bug.cgi?id=170965
1123
1124         Reviewed by Tim Horton.
1125
1126         * Shared/Cocoa/WebCoreArgumentCodersCocoa.mm:
1127         (IPC::ArgumentCoder<WebCore::ShippingContactUpdate>::encode):
1128         (IPC::ArgumentCoder<WebCore::ShippingContactUpdate>::decode):
1129         Remove the status member variable.
1130
1131         * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
1132         (WebKit::status):
1133         New function to be used by older OSes. This will recreate a PKPaymentAuthorizationStatus given a ShippingContactUpdate.
1134
1135         (WebKit::WebPaymentCoordinatorProxy::platformCompleteShippingContactSelection):
1136         Stop using the deprecated API.
1137
1138 2017-04-18  Timothy Horton  <timothy_horton@apple.com>
1139
1140         Force scroll view insets to be respected regardless of rubber-banding state
1141         https://bugs.webkit.org/show_bug.cgi?id=170937
1142         <rdar://problem/31412788>
1143
1144         Reviewed by Simon Fraser.
1145
1146         * Platform/spi/ios/UIKitSPI.h:
1147         * UIProcess/API/Cocoa/WKWebView.mm:
1148         (-[WKWebView _initializeWithConfiguration:]):
1149
1150 2017-04-18  Carlos Garcia Campos  <cgarcia@igalia.com>
1151
1152         [GLIB] Define priorities also for async network IO tasks
1153         https://bugs.webkit.org/show_bug.cgi?id=170905
1154
1155         Reviewed by Žan Doberšek.
1156
1157         * NetworkProcess/cache/NetworkCacheIOChannelSoup.cpp:
1158         (WebKit::NetworkCache::inputStreamReadReadyCallback):
1159         (WebKit::NetworkCache::IOChannel::read):
1160         (WebKit::NetworkCache::outputStreamWriteReadyCallback):
1161         (WebKit::NetworkCache::IOChannel::write):
1162         * NetworkProcess/soup/NetworkDataTaskSoup.cpp:
1163         (WebKit::NetworkDataTaskSoup::skipInputStreamForRedirection):
1164         (WebKit::NetworkDataTaskSoup::read):
1165         (WebKit::NetworkDataTaskSoup::requestNextPart):
1166         (WebKit::NetworkDataTaskSoup::writeDownload):
1167         (WebKit::NetworkDataTaskSoup::didFinishDownload):
1168         * UIProcess/API/gtk/WebKitURISchemeRequest.cpp:
1169         (webkitURISchemeRequestReadCallback):
1170         (webkit_uri_scheme_request_finish):
1171
1172 2017-04-17  Timothy Horton  <timothy_horton@apple.com>
1173
1174         Plumb all four obscured insets to WebCore, instead of just top/left
1175         https://bugs.webkit.org/show_bug.cgi?id=170913
1176
1177         Reviewed by Wenson Hsieh.
1178
1179         * Shared/VisibleContentRectUpdateInfo.cpp:
1180         (WebKit::VisibleContentRectUpdateInfo::encode):
1181         (WebKit::VisibleContentRectUpdateInfo::decode):
1182         (WebKit::operator<<):
1183         * Shared/VisibleContentRectUpdateInfo.h:
1184         (WebKit::VisibleContentRectUpdateInfo::VisibleContentRectUpdateInfo):
1185         (WebKit::VisibleContentRectUpdateInfo::obscuredInsets):
1186         (WebKit::operator==):
1187         (WebKit::VisibleContentRectUpdateInfo::obscuredInset): Deleted.
1188         * Shared/WebCoreArgumentCoders.cpp:
1189         (IPC::ArgumentCoder<FloatRectInsets>::encode):
1190         (IPC::ArgumentCoder<FloatRectInsets>::decode):
1191         * Shared/WebCoreArgumentCoders.h:
1192         * UIProcess/API/Cocoa/WKWebView.mm:
1193         (-[WKWebView _didCommitLayerTree:]):
1194         (-[WKWebView _restorePageScrollPosition:scrollOrigin:previousObscuredInset:scale:]):
1195         (-[WKWebView _updateVisibleContentRects]):
1196         * UIProcess/API/Cocoa/WKWebViewInternal.h:
1197         * UIProcess/PageClient.h:
1198         * UIProcess/WebPageProxy.cpp:
1199         * UIProcess/WebPageProxy.h:
1200         * UIProcess/WebPageProxy.messages.in:
1201         * UIProcess/ios/PageClientImplIOS.h:
1202         * UIProcess/ios/PageClientImplIOS.mm:
1203         (WebKit::PageClientImpl::restorePageState):
1204         * UIProcess/ios/WKContentView.h:
1205         * UIProcess/ios/WKContentView.mm:
1206         (-[WKContentView didUpdateVisibleRect:unobscuredRect:unobscuredRectInScrollViewCoordinates:obscuredInsets:inputViewBounds:scale:minimumScale:inStableState:isChangingObscuredInsetsInteractively:enclosedInScrollableAncestorView:]):
1207         (-[WKContentView didUpdateVisibleRect:unobscuredRect:unobscuredRectInScrollViewCoordinates:obscuredInset:inputViewBounds:scale:minimumScale:inStableState:isChangingObscuredInsetsInteractively:enclosedInScrollableAncestorView:]): Deleted.
1208         * UIProcess/ios/WebPageProxyIOS.mm:
1209         (WebKit::WebPageProxy::restorePageState):
1210         * WebProcess/WebPage/ios/WebPageIOS.mm:
1211         (WebKit::WebPage::restorePageState):
1212         (WebKit::WebPage::updateVisibleContentRects):
1213         Adopt FloatBoxExtent for obscuredInsets (and adjust pluralization).
1214
1215 2017-04-17  Joseph Pecoraro  <pecoraro@apple.com>
1216
1217         Web Inspector: Doesn't show size of compressed content correctly
1218         https://bugs.webkit.org/show_bug.cgi?id=155112
1219         <rdar://problem/25006728>
1220
1221         Reviewed by Alex Christensen and Timothy Hatcher.
1222
1223         * NetworkProcess/NetworkResourceLoader.cpp:
1224         (WebKit::NetworkResourceLoader::sendResultForCacheEntry):
1225         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
1226         (-[WKNetworkSessionDelegate URLSession:task:didFinishCollectingMetrics:]):
1227         Include size information in network load metrics.
1228
1229 2017-04-17  Youenn Fablet  <youenn@apple.com>
1230
1231         com.apple.WebKit.Networking.Development crashed in com.apple.WebKit: WebKit::NetworkRTCProvider::resolvedName
1232         https://bugs.webkit.org/show_bug.cgi?id=170889
1233
1234         Reviewed by Alex Christensen.
1235
1236         * NetworkProcess/webrtc/NetworkRTCProvider.cpp:
1237         (WebKit::NetworkRTCProvider::Resolver::~Resolver): Unschedule the host resolution in addition to cancelling it.
1238         Providing a test would need to stop the resolver between the time the resolver is created and gets
1239         data in the network process. Or we would need to change Resolver to be instantiated/tested on its own.
1240         * NetworkProcess/webrtc/NetworkRTCProvider.h:
1241
1242 2017-04-17  Brady Eidson  <beidson@apple.com>
1243
1244         Make WKHTTPCookieStore public.
1245         <rdar://problem/31024691> and https://bugs.webkit.org/show_bug.cgi?id=170920
1246
1247         Reviewed by Geoffrey Garen.
1248
1249         * UIProcess/API/Cocoa/WKHTTPCookieStore.h:
1250         * UIProcess/API/Cocoa/WKHTTPCookieStore.mm:
1251         (-[WKHTTPCookieStore getAllCookies:]):
1252         (-[WKHTTPCookieStore allCookies:]): Deleted.
1253
1254         * UIProcess/API/Cocoa/WKWebsiteDataStore.h:
1255         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
1256         (-[WKWebsiteDataStore httpCookieStore]):
1257         (-[WKWebsiteDataStore _httpCookieStore]): Deleted.
1258         * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
1259
1260         * WebKit2.xcodeproj/project.pbxproj:
1261
1262 2017-04-17  Eric Carlson  <eric.carlson@apple.com>
1263
1264         [MediaStream] Fix typo in UIDelegate::mediaCaptureStateDidChange
1265         https://bugs.webkit.org/show_bug.cgi?id=170911
1266
1267         Reviewed by Youenn Fablet.
1268
1269         * UIProcess/Cocoa/UIDelegate.mm:
1270         (WebKit::UIDelegate::UIClient::mediaCaptureStateDidChange): Fix typo.
1271
1272 2017-04-17  Keith Rollin  <krollin@apple.com>
1273
1274         Move and update WebLoaderStrategy logging statement
1275         https://bugs.webkit.org/show_bug.cgi?id=170140
1276
1277         Reviewed by Alex Christensen.
1278
1279         WebLoaderStrategy::scheduleLoad has a logging statement that says, in
1280         part: "Resource has been queued for scheduling with the
1281         NetworkProcess". This statement is emitted after the
1282         ScheduleResourceLoad message has been successfully sent to the
1283         NetworkProcess. The logging statement was added at this location to
1284         indicate that the resource-load had been successfully handed off; it
1285         pairs a similar logging statement that is emitted if the sending of
1286         the ScheduleResourceLoad message fails.
1287
1288         I think it would be better to move this logging statement before the
1289         ScheduleResourceLoad message is sent to the NetworkProcess (and change
1290         its wording to "Resource is being scheduled with the NetworkProcess").
1291         The reason for this change is to help make sure that the sequence of
1292         logging statements is more deterministic. In the current form, the
1293         message "Resource has been queued for scheduling with the
1294         NetworkProcess" normally appears before any NetworkProcess logging
1295         statements that indicate that the resource-loading is continuing
1296         there, but in rare occasions the logging statements can be reversed.
1297         This change in the ordering of the statements has caused a problem in
1298         a script I've written that examines the resource-loading process and
1299         looks for errors. By ensuring that the WebLoaderStrategy statement
1300         always appears before the NetworkResourceLoader statement, the flow
1301         makes better sense and the script can be more robust.
1302
1303         In making this change, we are probably not giving up any assurance
1304         that the ScheduleResourceLoad message has been sent to the
1305         NetworkResourceLoader. If the message is successfully sent, we'll see
1306         logging in the NetworkProcess. If the message has not been sent, we'll
1307         see WebLoaderStrategy logging an error.
1308
1309         * WebProcess/Network/WebLoaderStrategy.cpp:
1310         (WebKit::WebLoaderStrategy::scheduleLoad):
1311
1312 2017-04-17  Anders Carlsson  <andersca@apple.com>
1313
1314         Stop using deprecated APIs, part 1
1315         https://bugs.webkit.org/show_bug.cgi?id=170915
1316         rdar://problem/31589635
1317
1318         Reviewed by Tim Horton.
1319
1320         Stop using the PKPaymentRequestPaymentMethodUpdate initializer that takes a status, it's been deprecated
1321         and we always passed PKPaymentAuthorizationStatusSuccess anyway.
1322
1323         * Shared/Cocoa/WebCoreArgumentCodersCocoa.mm:
1324         (IPC::ArgumentCoder<WebCore::PaymentMethodUpdate>::encode):
1325         (IPC::ArgumentCoder<WebCore::PaymentMethodUpdate>::decode):
1326         * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
1327         (WebKit::WebPaymentCoordinatorProxy::platformCompletePaymentMethodSelection):
1328
1329 2017-04-17  Youenn Fablet  <youenn@apple.com>
1330
1331         Disable outdated WritableStream API
1332         https://bugs.webkit.org/show_bug.cgi?id=170749
1333         <rdar://problem/31446233>
1334
1335         Reviewed by Alex Christensen.
1336
1337         Replacing READABLE_STREAM_API, READABLE_BYTE_STREAM_API and WRITABLE_STREAM_API compilation flag by:
1338         - A STREAMS_API compilation flag.
1339         - A ReadableByteStreamAPI and WritableStreamAPI runtime flags, turned off except for RWT and DRT.
1340
1341         * Configurations/FeatureDefines.xcconfig:
1342         * WebProcess/InjectedBundle/InjectedBundle.cpp:
1343         (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner):
1344
1345 2017-04-17  Tim Horton  <timothy_horton@apple.com>
1346
1347         Provide a viewport parameter to disable clipping to the safe area
1348         https://bugs.webkit.org/show_bug.cgi?id=170766
1349         <rdar://problem/31564634>
1350
1351         Reviewed by Beth Dakin.
1352
1353         * UIProcess/WebPageProxy.cpp:
1354         (WebKit::WebPageProxy::resetState):
1355         (WebKit::WebPageProxy::setClipToSafeArea):
1356         * UIProcess/WebPageProxy.h:
1357         (WebKit::WebPageProxy::clipToSafeArea):
1358         * UIProcess/WebPageProxy.messages.in:
1359         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
1360         (WebKit::WebChromeClient::didChangeClipToSafeArea):
1361         * WebProcess/WebCoreSupport/WebChromeClient.h:
1362         * UIProcess/API/gtk/PageClientImpl.h:
1363         * UIProcess/PageClient.h:
1364         * UIProcess/ios/PageClientImplIOS.h:
1365         * UIProcess/ios/PageClientImplIOS.mm:
1366         (WebKit::PageClientImpl::didChangeClipToSafeArea):
1367         * UIProcess/mac/PageClientImpl.h:
1368         Forward clip-to-safe-area changes from ChromeClient to WKWebView.
1369         Update visible content rects when it changes, which will
1370         result in a call to updateFixedClippingView, as below.
1371         Keep track of the current state in the UI process.
1372
1373         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1374         * UIProcess/API/Cocoa/WKWebView.mm:
1375         (-[WKWebView _contentMayDrawInObscuredInsets]):
1376         Expose the current state of the clip-to-safe-area bit as SPI.
1377
1378         * UIProcess/ios/WKContentView.mm:
1379         (-[WKContentView updateFixedClippingView:]):
1380         Disable fixed clipping when clip-to-safe-area is disabled.
1381         
1382         * WebProcess/WebPage/ios/WebPageIOS.mm:
1383         (WebKit::WebPage::viewportConfigurationChanged):
1384         Push the viewport's clip-to-safe-area bit onto the main frame's FrameView.
1385
1386 2017-04-17  Dan Bernstein  <mitz@apple.com>
1387
1388         [Cocoa] Move isNullFunctionPointer down into WTF
1389         https://bugs.webkit.org/show_bug.cgi?id=170892
1390
1391         Reviewed by Sam Weinig.
1392
1393         * Platform/classifier/cocoa/ResourceLoadStatisticsClassifierCocoa.cpp:
1394         (WebKit::ResourceLoadStatisticsClassifierCocoa::canUseCorePrediction): Changed to use
1395           WTF::isNullFunctionPointer.
1396         (WebKit::isNullFunctionPointer): Deleted.
1397
1398 2017-04-17  Wenson Hsieh  <wenson_hsieh@apple.com>
1399
1400         [WK2] Respect a new internal setting for defaulting to character selection granularity
1401         https://bugs.webkit.org/show_bug.cgi?id=170904
1402         <rdar://problem/31364280>
1403
1404         Reviewed by Dan Bernstein.
1405
1406         Respect a new WebKitDebugDefaultSelectionGranularityCharacter user default by initializing
1407         WKWebViewConfiguration with WKSelectionGranularityCharacter, but only when linked on or after the first iOS to
1408         use WKSelectionGranularityCharacter by default.
1409
1410         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
1411         (-[WKWebViewConfiguration init]):
1412         * UIProcess/Cocoa/VersionChecks.h:
1413
1414 2017-04-17  Eric Carlson  <eric.carlson@apple.com>
1415
1416         Provide a way for clients to unmute a media stream.
1417         https://bugs.webkit.org/show_bug.cgi?id=170855
1418         <rdar://problem/31656855>
1419
1420         Reviewed by Jon Lee.
1421
1422         * UIProcess/API/Cocoa/WKWebView.mm:
1423         (-[WKWebView _setPageMuted:]): New.
1424         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1425
1426 2017-04-17  Jeremy Jones  <jeremyj@apple.com>
1427
1428         Refactor enumerateDevices to allow separate CaptureDeviceManagers for audio and video.
1429         https://bugs.webkit.org/show_bug.cgi?id=170778
1430
1431         Reviewed by Tim Horton.
1432
1433         setUseAVFoundationAudioCapture is moved from AVCaptureDeviceManager to RealtimeMediaSourceCenterMac.
1434
1435         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
1436         (WebKit::UserMediaPermissionRequestManagerProxy::syncWithWebCorePrefs):
1437
1438 2017-04-15  Keith Rollin  <krollin@apple.com>
1439
1440         Include resource size in some existing logging
1441         https://bugs.webkit.org/show_bug.cgi?id=170866
1442
1443         Reviewed by Alex Christensen.
1444
1445         In order to correlate resource load times with resource size, we log
1446         when the resource is starting to be loaded and when the resource is
1447         finished loading. In NetworkResourceLoader::didReceiveResponse, we
1448         also log the expected resource length. However, we can only log the
1449         length if it is provided in Content-Length, which is not always the
1450         case. If it's not provided, we end up logging "length = -1". To make
1451         up for this, change NetworkResourceLoader::didFinishLoading and
1452         WebResourceLoader:: didFinishLoading to log the length once we know
1453         it.
1454
1455         * NetworkProcess/NetworkResourceLoader.cpp:
1456         (WebKit::NetworkResourceLoader::didReceiveBuffer):
1457         (WebKit::NetworkResourceLoader::didFinishLoading):
1458         * NetworkProcess/NetworkResourceLoader.h:
1459         * WebProcess/Network/WebResourceLoader.cpp:
1460         (WebKit::WebResourceLoader::didReceiveData):
1461         (WebKit::WebResourceLoader::didFinishResourceLoad):
1462         * WebProcess/Network/WebResourceLoader.h:
1463
1464 2017-04-15  Wenson Hsieh  <wenson_hsieh@apple.com>
1465
1466         [WK2] Support data interaction of files into file inputs
1467         https://bugs.webkit.org/show_bug.cgi?id=170803
1468         <rdar://problem/31286130>
1469
1470         Reviewed by Tim Horton.
1471
1472         Implements remaining support for performing data interaction onto file inputs. There are two main changes at
1473         this layer: plumbing the number of files in the pasteboard to the web process, and pulling the implementation of
1474         createSandboxExtensionsIfNeeded out of Mac-specific WebViewImpl::createSandboxExtensionsIfNeeded and into
1475         WebPageProxy::createSandboxExtensionsIfNeeded.
1476
1477         * Shared/WebCoreArgumentCoders.cpp:
1478         (IPC::ArgumentCoder<DragData>::encode):
1479         (IPC::ArgumentCoder<DragData>::decode):
1480
1481         Relax special-casing of encoding and decoding filenames to be PLATFORM(COCOA) rather than PLATFORM(MAC).
1482
1483         * UIProcess/Cocoa/WebPageProxyCocoa.mm:
1484         (WebKit::WebPageProxy::createSandboxExtensionsIfNeeded):
1485         * UIProcess/Cocoa/WebPasteboardProxyCocoa.mm:
1486         (WebKit::WebPasteboardProxy::getNumberOfFiles):
1487
1488         More boilerplate plumbing to deliver the number of files in the pasteboard to the web process.
1489
1490         * UIProcess/Cocoa/WebViewImpl.h:
1491         * UIProcess/Cocoa/WebViewImpl.mm:
1492         (WebKit::WebViewImpl::performDragOperation):
1493         (WebKit::WebViewImpl::createSandboxExtensionsIfNeeded): Deleted.
1494
1495         Move the logic in WebViewImpl::createSandboxExtensionsIfNeeded over to WebPageProxy::createSandboxExtensionsIfNeeded.
1496
1497         * UIProcess/WebPageProxy.h:
1498         * UIProcess/WebPasteboardProxy.h:
1499         * UIProcess/WebPasteboardProxy.messages.in:
1500         * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
1501         (WebKit::WebPlatformStrategies::getNumberOfFiles):
1502         * WebProcess/WebCoreSupport/WebPlatformStrategies.h:
1503
1504 2017-04-14  Mark Lam  <mark.lam@apple.com>
1505
1506         Update architectures in xcconfig files.
1507         https://bugs.webkit.org/show_bug.cgi?id=170867
1508         <rdar://problem/31628104>
1509
1510         Reviewed by Joseph Pecoraro.
1511
1512         * Configurations/FeatureDefines.xcconfig:
1513
1514 2017-04-14  Wenson Hsieh  <wenson_hsieh@apple.com>
1515
1516         [WK2] Support Icon creation from file URLs on iOS
1517         https://bugs.webkit.org/show_bug.cgi?id=170809
1518         <rdar://problem/31286130>
1519
1520         Reviewed by Tim Horton.
1521
1522         Refactors file icon generation logic to support showing an Icon representing the content at a list of file paths
1523         on iOS. Pulls out logic in WKFileUploadPanel responsible for generating the thumbnail image for a file input into
1524         separate helpers in WebIconUtilities, and then uses these utilities in both WKFileUploadPanel and
1525         WebChromeClientIOS.
1526
1527         * Shared/ios/WebIconUtilities.h: Added.
1528         * Shared/ios/WebIconUtilities.mm: Added.
1529         (WebKit::squareCropRectForSize):
1530         (WebKit::squareImage):
1531         (WebKit::thumbnailSizedImageForImage):
1532         (WebKit::fallbackIconForFile):
1533         (WebKit::iconForImageFile):
1534         (WebKit::iconForVideoFile):
1535         (WebKit::iconForFile):
1536
1537         Add logic for generating thumbnail icons, moved from WKFileUploadPanel.mm.
1538
1539         * UIProcess/ios/forms/WKFileUploadPanel.mm:
1540         (squareCropRectForSize): Deleted.
1541         (squareImage): Deleted.
1542         (thumbnailSizedImageForImage): Deleted.
1543         (fallbackIconForFile): Deleted.
1544         (iconForImageFile): Deleted.
1545         (iconForVideoFile): Deleted.
1546         (iconForFile): Deleted.
1547
1548         Remove logic for generating thumbnail icons.
1549
1550         * WebKit2.xcodeproj/project.pbxproj:
1551         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
1552         (WebKit::WebChromeClient::loadIconForFiles):
1553         (WebKit::WebChromeClient::createIconForFiles):
1554
1555         Rather than call Icon::createIconForFiles directly, loadIconForFiles now consults ChromeClient::createIconForFiles
1556         instead. On other platforms, this just turns around and calls Icon::createIconForFiles, but on iOS, we use the
1557         utilities introduced in WebIconUtilities to generate a file icon.
1558
1559         * WebProcess/WebCoreSupport/WebChromeClient.h:
1560         * WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm:
1561         (WebKit::WebChromeClient::createIconForFiles):
1562
1563 2017-04-14  Brady Eidson  <beidson@apple.com>
1564
1565         Fix basic WKURLSchemeHandler bugs.
1566         <rdar://problem/30647559> and https://bugs.webkit.org/show_bug.cgi?id=170862
1567
1568         Reviewed by Andy Estes.
1569
1570         * UIProcess/Cocoa/NavigationState.mm:
1571         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
1572
1573         * UIProcess/WebURLSchemeHandlerTask.cpp:
1574         (WebKit::WebURLSchemeHandlerTask::didReceiveResponse):
1575
1576         * WebProcess/Network/WebLoaderStrategy.cpp:
1577         (WebKit::WebLoaderStrategy::addURLSchemeHandlerTaskProxy):
1578         (WebKit::WebLoaderStrategy::removeURLSchemeHandlerTaskProxy):
1579         (WebKit::WebLoaderStrategy::remove):
1580         * WebProcess/Network/WebLoaderStrategy.h:
1581
1582         * WebProcess/WebPage/WebURLSchemeHandlerProxy.cpp:
1583         (WebKit::WebURLSchemeHandlerProxy::startNewTask):
1584         (WebKit::WebURLSchemeHandlerProxy::taskDidComplete):
1585         (WebKit::WebURLSchemeHandlerProxy::taskDidStopLoading):
1586         * WebProcess/WebPage/WebURLSchemeHandlerProxy.h:
1587
1588         * WebProcess/WebPage/WebURLSchemeHandlerTaskProxy.cpp:
1589         (WebKit::WebURLSchemeHandlerTaskProxy::WebURLSchemeHandlerTaskProxy):
1590         (WebKit::WebURLSchemeHandlerTaskProxy::stopLoading):
1591         (WebKit::WebURLSchemeHandlerTaskProxy::didReceiveResponse):
1592         (WebKit::WebURLSchemeHandlerTaskProxy::didReceiveData):
1593         (WebKit::WebURLSchemeHandlerTaskProxy::didComplete):
1594         (WebKit::WebURLSchemeHandlerTaskProxy::hasLoader):
1595         * WebProcess/WebPage/WebURLSchemeHandlerTaskProxy.h:
1596         (WebKit::WebURLSchemeHandlerTaskProxy::identifier):
1597
1598 2017-04-14  Jer Noble  <jer.noble@apple.com>
1599
1600         [MediaSource] Push capabilities across process boundary during UIProcess capture.
1601         https://bugs.webkit.org/show_bug.cgi?id=170814
1602
1603         Reviewed by Eric Carlson.
1604
1605         Make a new synchronous getter for capabilities(), moderated by only requesting the capabilities() cross-process
1606         the first time called.
1607
1608         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp:
1609         (WebKit::UserMediaCaptureManagerProxy::capabilities):
1610         (WebKit::UserMediaCaptureManagerProxy::supportedConstraints):
1611         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.h:
1612         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.messages.in:
1613         * WebProcess/cocoa/UserMediaCaptureManager.cpp:
1614         (WebKit::UserMediaCaptureManager::Source::setCapabilities):
1615         (WebKit::UserMediaCaptureManager::capabilities):
1616         * WebProcess/cocoa/UserMediaCaptureManager.h:
1617
1618 2017-04-13  Dan Bernstein  <mitz@apple.com>
1619
1620         [Cocoa] Allow clients to specify in _WKProcessPoolConfiguration additional directory sandbox extensions
1621         https://bugs.webkit.org/show_bug.cgi?id=170387
1622
1623         Reviewed by Sam Weinig.
1624
1625         Test: TestWebKitAPI/Tests/WebKit2Cocoa/AdditionalReadAccessAllowedURLs.mm
1626
1627         Added an additionalReadAccessAllowedURLs property to _WKProcessPoolConfiguration.
1628
1629         * Shared/WebProcessCreationParameters.cpp:
1630         (WebKit::WebProcessCreationParameters::encode): Encode the new
1631           additionalSandboxExtensionHandles member.
1632         (WebKit::WebProcessCreationParameters::decode): Decode it.
1633         * Shared/WebProcessCreationParameters.h: Added additionalSandboxExtensionHandles member.
1634
1635         * UIProcess/API/APIProcessPoolConfiguration.cpp:
1636         (API::ProcessPoolConfiguration::copy): Copy new m_additionalReadAccessAllowedPaths member.
1637         * UIProcess/API/APIProcessPoolConfiguration.h: Added m_additionalReadAccessAllowedPaths
1638           member and accessor functions.
1639
1640         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h: Declared new
1641           additionalReadAccessAllowedURLs property whose value is an array of URLs to which the Web
1642           Content process will be given read access.
1643         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
1644         (-[_WKProcessPoolConfiguration additionalReadAccessAllowedURLs]): New getter that returns
1645           an array of file URLs from the ProcessPoolConfiguration’s additionalReadAccessAllowedPaths().
1646         (-[_WKProcessPoolConfiguration setAdditionalReadAccessAllowedURLs:]): New setter that checks
1647           that the given URLs are file URLs and populates the ProcessPoolConfiguration’s
1648           additionalReadAccessAllowedPaths with their paths.
1649
1650         * UIProcess/WebProcessPool.cpp:
1651         (WebKit::WebProcessPool::resolvePathsForSandboxExtensions): Populate the new
1652           m_resolvedPaths.additionalWebProcessSandboxExtensionPaths with resolved paths from the
1653           ProcessPoolConfiguration’s additionalReadAccessAllowedPaths.
1654         (WebKit::WebProcessPool::createNewWebProcess): Populate the WebProcessCreationParameters’s
1655           additionalSandboxExtensionHandles member with read-only sandbox extensions created from
1656           the resolved paths.
1657         * UIProcess/WebProcessPool.h: Added additionalWebProcessSandboxExtensionPaths member to
1658           the Paths struct.
1659
1660         * WebProcess/WebProcess.cpp:
1661         (WebKit::WebProcess::initializeWebProcess): Consume the additional sandbox extensions.
1662
1663 2017-04-13  Alex Christensen  <achristensen@webkit.org>
1664
1665         Fix CMake build
1666         https://bugs.webkit.org/show_bug.cgi?id=170815
1667
1668         Reviewed by Beth Dakin.
1669
1670         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
1671         (-[WKWebViewConfiguration _setShouldCaptureAudioInUIProcess:]):
1672
1673 2017-04-12  Dan Bernstein  <mitz@apple.com>
1674
1675         [Mac] Future-proof .xcconfig files
1676         https://bugs.webkit.org/show_bug.cgi?id=170802
1677
1678         Reviewed by Tim Horton.
1679
1680         * Configurations/Base.xcconfig:
1681         * Configurations/DebugRelease.xcconfig:
1682         * Configurations/FeatureDefines.xcconfig:
1683         * Configurations/Version.xcconfig:
1684
1685 2017-04-12  Brady Eidson  <beidson@apple.com>
1686
1687         QuotaExceededError when saving to localStorage in private mode.
1688         https://bugs.webkit.org/show_bug.cgi?id=157010
1689
1690         Reviewed by Alex Christensen.
1691
1692         * WebProcess/Storage/StorageAreaMap.cpp:
1693         (WebKit::StorageAreaMap::StorageAreaMap):
1694         (WebKit::StorageAreaMap::~StorageAreaMap):
1695
1696         * WebProcess/Storage/StorageNamespaceImpl.cpp:
1697         (WebKit::StorageNamespaceImpl::createEphemeralLocalStorageNamespace):
1698         (WebKit::StorageNamespaceImpl::storageArea):
1699         (WebKit::StorageNamespaceImpl::ephemeralLocalStorageArea):
1700         (WebKit::StorageNamespaceImpl::copy):
1701         * WebProcess/Storage/StorageNamespaceImpl.h:
1702
1703         * WebProcess/Storage/WebStorageNamespaceProvider.cpp:
1704         (WebKit::WebStorageNamespaceProvider::createEphemeralLocalStorageNamespace):
1705         * WebProcess/Storage/WebStorageNamespaceProvider.h:
1706
1707 2017-04-12  Yusuke Suzuki  <utatane.tea@gmail.com>
1708
1709         Unreviewed, fix build failure on Ubuntu LTS GTK bot
1710         https://bugs.webkit.org/show_bug.cgi?id=170781
1711
1712         * UIProcess/WebProcessPool.cpp:
1713         (WebKit::WebProcessPool::createNewWebProcess):
1714
1715 2017-04-12  Eric Carlson  <eric.carlson@apple.com>
1716
1717         [MediaStream] rename -[WKWebView _stopMediaCapture]
1718         https://bugs.webkit.org/show_bug.cgi?id=170791
1719         <rdar://problem/31589204>
1720
1721         Reviewed by Youenn Fablet.
1722
1723         * UIProcess/API/Cocoa/WKWebView.mm:
1724         (-[WKWebView _muteMediaCapture]):
1725         (-[WKWebView _stopMediaCapture]): Deleted.
1726         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1727
1728 2017-04-12  Ryan Haddad  <ryanhaddad@apple.com>
1729
1730         Unreviewed build fix.
1731
1732         * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
1733         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didSelectPaymentMethod:handler:]):
1734         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didSelectShippingMethod:handler:]):
1735         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didSelectShippingContact:handler:]):
1736         (WebKit::WebPaymentCoordinatorProxy::platformCompleteShippingMethodSelection):
1737         (WebKit::WebPaymentCoordinatorProxy::platformCompleteShippingContactSelection):
1738         (WebKit::WebPaymentCoordinatorProxy::platformCompletePaymentMethodSelection):
1739
1740 2017-04-12  Jer Noble  <jer.noble@apple.com>
1741
1742         [WK2] Add a C-API for creating a WKContextConfigurationRef with legacy options.
1743         https://bugs.webkit.org/show_bug.cgi?id=170790
1744
1745         Reviewed by Alex Christensen.
1746
1747         * UIProcess/API/C/WKContextConfigurationRef.cpp:
1748         (WKContextConfigurationCreate):
1749         (WKContextConfigurationCreateWithLegacyOptions):
1750         * UIProcess/API/C/WKContextConfigurationRef.h:
1751
1752 2017-04-12  Jer Noble  <jer.noble@apple.com>
1753
1754         [WK2] Do not pass microphone sandbox extension to WebProcess if capturing is happening in UIProcess.
1755         https://bugs.webkit.org/show_bug.cgi?id=170781
1756
1757         Reviewed by Alex Christensen.
1758
1759         Simultaneously, allow clients to configure whether capturing will occur in the UIProcess through
1760         _WKProcessPoolConfiguration.
1761
1762         * UIProcess/API/APIProcessPoolConfiguration.cpp:
1763         (API::ProcessPoolConfiguration::copy):
1764         * UIProcess/API/APIProcessPoolConfiguration.h:
1765         * UIProcess/API/C/WKContextConfigurationRef.cpp:
1766         (WKContextConfigurationShouldCaptureAudioInUIProcess):
1767         (WKContextConfigurationSetShouldCaptureAudioInUIProcess):
1768         * UIProcess/API/C/WKContextConfigurationRef.h:
1769         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
1770         (-[WKWebViewConfiguration copyWithZone:]):
1771         (-[WKWebViewConfiguration _shouldCaptureAudioInUIProcess]):
1772         (-[WKWebViewConfiguration _setShouldCaptureAudioInUIProcess:]):
1773         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
1774         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
1775         (-[_WKProcessPoolConfiguration shouldCaptureAudioInUIProcess]):
1776         (-[_WKProcessPoolConfiguration setShouldCaptureAudioInUIProcess:]):
1777         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
1778         (WebKit::WebProcessPool::platformInitializeWebProcess):
1779         * UIProcess/WebProcessPool.cpp:
1780         (WebKit::WebProcessPool::createNewWebProcess):
1781
1782 2017-04-12  Keith Rollin  <krollin@apple.com>
1783
1784         Add some missing NetworkResourceLoader logging
1785         https://bugs.webkit.org/show_bug.cgi?id=170139
1786
1787         Reviewed by Alex Christensen.
1788
1789         Once execution enters the lambda in
1790         NetworkResourceLoader::retrieveCacheEntry, there is little indication
1791         of which exit point was taken. If flow enters into startNetworkLoad,
1792         we'll get some logging from that function, but not from the others.
1793         Add some logging so that we know what the result was from looking up
1794         the resource in the cache.
1795
1796         * NetworkProcess/NetworkResourceLoader.cpp:
1797         (WebKit::NetworkResourceLoader::retrieveCacheEntry):
1798
1799 2017-04-12  Anders Carlsson  <andersca@apple.com>
1800
1801         Tweak WebCore::setMetadataURL function
1802         https://bugs.webkit.org/show_bug.cgi?id=170786
1803
1804         Reviewed by Beth Dakin.
1805
1806         Update for WebCore changes.
1807
1808         * UIProcess/Cocoa/WebViewImpl.mm:
1809         (WebKit::WebViewImpl::namesOfPromisedFilesDroppedAtDestination):
1810
1811 2017-04-12  Brent Fulgham  <bfulgham@apple.com>
1812
1813         [WK2][Mac] Stop allowing access to disk arbitration process
1814         https://bugs.webkit.org/show_bug.cgi?id=170517
1815         <rdar://problem/31071151>
1816
1817         Reviewed by Alex Christensen.
1818
1819         * WebProcess/com.apple.WebProcess.sb.in:
1820
1821 2017-04-12  Beth Dakin  <bdakin@apple.com>
1822
1823         32-bit build fix.
1824
1825         * UIProcess/API/mac/WKView.mm:
1826         (-[WKView _mediaPlaybackControlsView]):
1827
1828 2017-04-12  Beth Dakin  <bdakin@apple.com>
1829
1830         More 32-bit build fix.
1831
1832         * UIProcess/API/Cocoa/WKWebView.mm:
1833         (-[WKWebView _mediaPlaybackControlsView]):
1834         (-[WKWebView _addMediaPlaybackControlsView:]):
1835         * UIProcess/API/mac/WKView.mm:
1836         (-[WKView _mediaPlaybackControlsView]):
1837         (-[WKView _addMediaPlaybackControlsView:]):
1838
1839 2017-04-12  Beth Dakin  <bdakin@apple.com>
1840
1841         Another 32 bit build fix.
1842
1843         * UIProcess/Cocoa/WebViewImpl.h:
1844         * UIProcess/Cocoa/WebViewImpl.mm:
1845         (WebKit::WebViewImpl::mediaPlaybackControlsView):
1846
1847 2017-04-12  Alex Christensen  <achristensen@webkit.org>
1848
1849         Stop using didReceiveDataArray callback on El Capitan
1850         https://bugs.webkit.org/show_bug.cgi?id=170780
1851
1852         Reviewed by Brady Eidson.
1853
1854         * NetworkProcess/NetworkLoad.cpp:
1855         (WebKit::NetworkLoad::supportsDataArray): Deleted.
1856         (WebKit::NetworkLoad::didReceiveDataArray): Deleted.
1857         * NetworkProcess/NetworkLoad.h:
1858
1859 2017-04-12  Beth Dakin  <bdakin@apple.com>
1860
1861         Speculative build fix.
1862
1863         * UIProcess/API/Cocoa/WKViewPrivate.h:
1864
1865 2017-04-12  Beth Dakin  <bdakin@apple.com>
1866
1867         Attempted build fix.
1868
1869         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1870
1871 2017-04-12  Beth Dakin  <bdakin@apple.com>
1872
1873         Adopt AVKit name change from AVFunctionBar* to AVTouchBar*
1874         https://bugs.webkit.org/show_bug.cgi?id=170693
1875         -and corresponding-
1876         rdar://problem/31230018
1877
1878         Reviewed by Sam Weinig.
1879
1880         Since the new names only apply to some versions of macOS, this patch uses typedefs 
1881         for the older OS’s. SO:
1882
1883         AVFunctionBarScrubber is now AVTouchBarScrubber
1884
1885         AVFunctionBarPlaybackControlsProvider is now AVTouchBarPlaybackControlsProvider
1886
1887         AVFunctionBarMediaSelectionOption is now AVTouchBarMediaSelectionOption
1888
1889         And the protocol AVFunctionBarPlaybackControlsControlling is now 
1890         AVTouchBarPlaybackControlsControlling
1891
1892         Use the new name.
1893         * UIProcess/API/Cocoa/WKViewPrivate.h:
1894         * UIProcess/API/Cocoa/WKWebView.mm:
1895         (-[WKWebView _mediaPlaybackControlsView]):
1896         (-[WKWebView _addMediaPlaybackControlsView:]):
1897         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1898         * UIProcess/API/mac/WKView.mm:
1899         (-[WKView _mediaPlaybackControlsView]):
1900         (-[WKView _addMediaPlaybackControlsView:]):
1901         * UIProcess/Cocoa/WebViewImpl.h:
1902
1903         Soft links and allocations cannot use the typedefs.
1904         * UIProcess/Cocoa/WebViewImpl.mm:
1905         (WebKit::WebViewImpl::mediaPlaybackControlsView):
1906         (WebKit::WebViewImpl::updateMediaTouchBar):
1907
1908 2017-04-12  Eric Carlson  <eric.carlson@apple.com>
1909
1910         [MediaStream] Audio source in UI process not identified as capture source
1911         https://bugs.webkit.org/show_bug.cgi?id=170776
1912
1913         Reviewed by Youenn Fablet.
1914
1915         * WebProcess/cocoa/UserMediaCaptureManager.cpp: Override isCaptureSource.
1916
1917 2017-04-12  Andrew Gold  <agold@apple.com>
1918
1919         Allow iOS to toggle webRTCAPI legacy flag.
1920         https://bugs.webkit.org/show_bug.cgi?id=170735
1921
1922         Reviewed by Eric Carlson.
1923
1924         * UIProcess/API/Cocoa/WKPreferences.mm:
1925         (-[WKPreferences _webRTCLegacyAPIEnabled]):
1926         (-[WKPreferences _setWebRTCLegacyAPIEnabled:]):
1927         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
1928
1929 2017-04-12  Yusuke Suzuki  <utatane.tea@gmail.com>
1930
1931         Unreviewed, build fix for GTK port after r215262
1932         https://bugs.webkit.org/show_bug.cgi?id=170758
1933
1934         * NetworkProcess/soup/NetworkDataTaskSoup.cpp:
1935         (WebKit::NetworkDataTaskSoup::didRead):
1936
1937 2017-04-12  Yusuke Suzuki  <utatane.tea@gmail.com>
1938
1939         [WTF] Introduce Thread class and use RefPtr<Thread> and align Windows Threading implementation semantics to Pthread one
1940         https://bugs.webkit.org/show_bug.cgi?id=170502
1941
1942         Reviewed by Mark Lam.
1943
1944         Mechanical change. Use Thread:: APIs.
1945
1946         * NetworkProcess/NetworkProcess.cpp:
1947         (WebKit::NetworkProcess::initializeNetworkProcess):
1948         * NetworkProcess/cache/NetworkCacheIOChannelSoup.cpp:
1949         (WebKit::NetworkCache::IOChannel::readSyncInThread):
1950         * Platform/IPC/Connection.cpp:
1951         (IPC::Connection::processIncomingMessage):
1952         * Shared/EntryPointUtilities/mac/XPCService/XPCServiceEntryPoint.h:
1953         (WebKit::XPCServiceInitializer):
1954         * UIProcess/linux/MemoryPressureMonitor.cpp:
1955         (WebKit::MemoryPressureMonitor::MemoryPressureMonitor):
1956         * WebProcess/WebProcess.cpp:
1957         (WebKit::WebProcess::initializeWebProcess):
1958
1959 2017-04-10  Antti Koivisto  <antti@apple.com>
1960
1961         Cache small media resources in disk cache
1962         https://bugs.webkit.org/show_bug.cgi?id=170676
1963         <rdar://problem/31532649>
1964
1965         Reviewed by Andreas Kling.
1966
1967         * NetworkProcess/cache/NetworkCache.cpp:
1968         (WebKit::NetworkCache::makeRetrieveDecision):
1969
1970             Allow retrieving media resources.
1971
1972         (WebKit::NetworkCache::expectedTotalResourceSizeFromContentRange):
1973         (WebKit::NetworkCache::expectedTotalResourceSize):
1974         (WebKit::NetworkCache::makeStoreDecision):
1975
1976             Store media resource if we can figure out its total size and it is less than 5MB
1977             (and it is cacheable by the usual rules).
1978
1979 2017-04-12  Alex Christensen  <achristensen@webkit.org>
1980
1981         Modernize vector adoption
1982         https://bugs.webkit.org/show_bug.cgi?id=170758
1983
1984         Reviewed by Geoffrey Garen.
1985
1986         * NetworkProcess/capture/NetworkCaptureEvent.cpp:
1987         (WebKit::NetworkCapture::JSONCoder<WebCore::SharedBuffer>::decode):
1988         * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
1989         (WebKit::WebPlatformStrategies::bufferForType):
1990
1991 2017-04-12  Zan Dobersek  <zdobersek@igalia.com>
1992
1993         Unreviewed GTK+ debug build fix. Drop an unused debug-only member
1994         variable in the CompositingRunLoop class.
1995
1996         * Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.h:
1997
1998 2017-04-11  Zan Dobersek  <zdobersek@igalia.com>
1999
2000         [GTK] Use the DisplayRefreshMonitor facilities
2001         https://bugs.webkit.org/show_bug.cgi?id=170599
2002
2003         Reviewed by Carlos Garcia Campos.
2004
2005         ThreadedCompositor gains a DisplayRefreshMonitor member that it can use
2006         to better coordinate display refresh callbacks on the main thread. Still,
2007         because currently the GTK+ port doesn't have a reliable way of notifying
2008         the ThreadedCompositor of a vsync event, a timer targeting 60FPS is used
2009         in order to keep the updates at a reasonable rate. When the timer is fired,
2010         the ThreadedCompositor decides how to proceed based on state changes that
2011         might have occurred during composition or whether there's any display
2012         refresh callbacks that require handling on the main thread.
2013
2014         CompositingRunLoop now stores its state in an atomic variable that's then
2015         inspected whenever a new update is scheduled or completed. When scheduled,
2016         if there's no update in progress, a new update is requested through the
2017         timer. If there's already an update in progress, a new update is marked
2018         as pending after the current one completes. In that case, when the update
2019         is completed, a new update is requested through the timer.
2020
2021         ThreadedDisplayRefreshMonitor is used to coordinate updates between the
2022         main and the composition thread whenever the CoordinatedGraphics state
2023         demands it, or whenever there are clients registered to that monitor that
2024         require an update (e.g. a requestAnimationFrame() callback). After the
2025         update on the composition thread is finished, and the DisplayRefreshMonitor
2026         object requires an update, a callback at the same priority as the layer
2027         flush timer is scheduled on the main thread. In that callback we handle
2028         any clients registered for this DisplayRefreshMonitor before proceeding
2029         to handle any changes to the CoordinatedGraphics scene. In case the
2030         DisplayRefreshMonitor clients or the layer flushes already queued up
2031         any changes to the state, we immediately ask the ThreadedCompositor for
2032         an update.
2033
2034         * PlatformGTK.cmake:
2035         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
2036         (WebKit::CoordinatedGraphicsScene::updateViewport):
2037         (WebKit::CoordinatedGraphicsScene::commitSceneState):
2038         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.h:
2039         * Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.cpp:
2040         (WebKit::CompositingRunLoop::CompositingRunLoop):
2041         (WebKit::CompositingRunLoop::isActive):
2042         (WebKit::CompositingRunLoop::scheduleUpdate):
2043         (WebKit::CompositingRunLoop::stopUpdates):
2044         (WebKit::CompositingRunLoop::updateCompleted):
2045         (WebKit::CompositingRunLoop::updateTimerFired):
2046         (WebKit::CompositingRunLoop::isCurrent):
2047         (WebKit::CompositingRunLoop::startUpdateTimer): Deleted.
2048         (WebKit::CompositingRunLoop::stopUpdateTimer): Deleted.
2049         * Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.h:
2050         (): Deleted.
2051         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
2052         (WebKit::m_displayRefreshMonitor):
2053         (WebKit::ThreadedCompositor::invalidate):
2054         (WebKit::ThreadedCompositor::setNativeSurfaceHandleForCompositing):
2055         (WebKit::ThreadedCompositor::updateViewport):
2056         (WebKit::ThreadedCompositor::scheduleDisplayImmediately):
2057         (WebKit::ThreadedCompositor::renderLayerTree):
2058         (WebKit::ThreadedCompositor::sceneUpdateFinished):
2059         (WebKit::ThreadedCompositor::updateSceneState):
2060         (WebKit::ThreadedCompositor::displayRefreshMonitor):
2061         (WebKit::ThreadedCompositor::renderNextFrameIfNeeded):
2062         (WebKit::ThreadedCompositor::completeCoordinatedUpdateIfNeeded):
2063         (WebKit::ThreadedCompositor::coordinateUpdateCompletionWithClient):
2064         (WebKit::ThreadedCompositor::performFrameCompletion):
2065         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h:
2066         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedDisplayRefreshMonitor.cpp: Added.
2067         (WebKit::ThreadedDisplayRefreshMonitor::ThreadedDisplayRefreshMonitor):
2068         (WebKit::ThreadedDisplayRefreshMonitor::requestRefreshCallback):
2069         (WebKit::ThreadedDisplayRefreshMonitor::requiresDisplayRefreshCallback):
2070         (WebKit::ThreadedDisplayRefreshMonitor::dispatchDisplayRefreshCallback):
2071         (WebKit::ThreadedDisplayRefreshMonitor::invalidate):
2072         (WebKit::ThreadedDisplayRefreshMonitor::displayRefreshCallback):
2073         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedDisplayRefreshMonitor.h: Copied from Source/WebKit2/Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.h.
2074         * WebProcess/WebPage/AcceleratedDrawingArea.cpp:
2075         (WebKit::AcceleratedDrawingArea::createDisplayRefreshMonitor):
2076         * WebProcess/WebPage/AcceleratedDrawingArea.h:
2077         * WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.cpp:
2078         (WebKit::ThreadedCoordinatedLayerTreeHost::createDisplayRefreshMonitor):
2079         * WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.h:
2080         * WebProcess/WebPage/LayerTreeHost.h:
2081         (WebKit::LayerTreeHost::createDisplayRefreshMonitor):
2082
2083 2017-04-11  Alex Christensen  <achristensen@webkit.org>
2084
2085         Modernize and clean up code
2086         https://bugs.webkit.org/show_bug.cgi?id=170752
2087
2088         Reviewed by Sam Weinig.
2089
2090         * NetworkProcess/NetworkResourceLoader.h:
2091         * Shared/WebPreferencesStore.h:
2092         * UIProcess/API/APIHitTestResult.cpp:
2093         (API::HitTestResult::create):
2094         * UIProcess/API/APIHitTestResult.h:
2095         * UIProcess/API/C/WKPreferences.cpp:
2096         (WKPreferencesCreate):
2097         (WKPreferencesCreateWithIdentifier):
2098         (WKPreferencesCreateCopy):
2099         * UIProcess/Authentication/AuthenticationChallengeProxy.h:
2100         * UIProcess/WebPreferences.cpp:
2101         (WebKit::WebPreferences::createWithLegacyDefaults):
2102         (WebKit::WebPreferences::copy):
2103         * UIProcess/WebPreferences.h:
2104         * WebProcess/Network/WebLoaderStrategy.h:
2105         * WebProcess/WebCoreSupport/WebEditorClient.cpp:
2106         (WebKit::WebEditorClient::requestCheckingOfString):
2107         * WebProcess/WebPage/WebPage.cpp:
2108         (WebKit::WebPage::addTextCheckingRequest):
2109         * WebProcess/WebPage/WebPage.h:
2110         * WebProcess/WebPage/ios/WebPageIOS.mm:
2111         (WebKit::WebPage::rangeForWebSelectionAtPosition):
2112         (WebKit::WebPage::rangeForBlockAtPoint):
2113         (WebKit::WebPage::expandedRangeFromHandle):
2114         (WebKit::WebPage::contractedRangeFromHandle):
2115         (WebKit::WebPage::computeExpandAndShrinkThresholdsForHandle):
2116         (WebKit::WebPage::changeBlockSelection):
2117         (WebKit::WebPage::rangeForGranularityAtPoint):
2118         (WebKit::WebPage::computePagesForPrintingAndDrawToPDF):
2119
2120 2017-04-11  Dean Jackson  <dino@apple.com>
2121
2122         Disable outdated WritableStream API
2123         https://bugs.webkit.org/show_bug.cgi?id=170749
2124         <rdar://problem/31446233>
2125
2126         Reviewed by Tim Horton.
2127
2128         The API we implement is no longer accurate. Disable it until we
2129         are compatible with the new specification
2130
2131         * Configurations/FeatureDefines.xcconfig:
2132
2133 2017-04-11  Dan Bernstein  <mitz@apple.com>
2134
2135         [Cocoa] WebKit unnecessarily soft-links CorePrediction
2136         https://bugs.webkit.org/show_bug.cgi?id=170644
2137
2138         Reviewed by Sam Weinig.
2139
2140         * Configurations/BaseTarget.xcconfig: Defined HAVE_CORE_PREDICTION and added
2141           HAVE_CORE_PREDICTION to the preprocessor defintions when the former is YES.
2142
2143         * Configurations/WebKit.xcconfig: Have the linker link against CorePrediction where
2144           available. On macOS, use weak linking, because CorePrediction is not available in the
2145           Base System.
2146
2147         * Platform/classifier/cocoa/CorePredictionSoftLink.h: Removed.
2148
2149         * Platform/classifier/cocoa/ResourceLoadStatisticsClassifierCocoa.cpp: Guarded with
2150           #if HAVE(CORE_PREDICTION).
2151         (WebKit::isNullFunctionPointer): Added this helper.
2152         (WebKit::ResourceLoadStatisticsClassifierCocoa::canUseCorePrediction): Replaced
2153           dlopen()-based runtime check with a null check.
2154
2155         * Platform/classifier/cocoa/ResourceLoadStatisticsClassifierCocoa.h: Guarded with #if
2156           HAVE(CORE_PREDICTION).
2157
2158         * Platform/spi/Cocoa/CorePredictionSPI.h: Added.
2159
2160         * UIProcess/WebResourceLoadStatisticsStore.h: Updated guards to include HAVE(CORE_PREDICTION).
2161
2162         * WebKit2.xcodeproj/project.pbxproj: pdated file references for removal and addition.
2163
2164 2017-04-11  David Quesada  <david_quesada@apple.com>
2165
2166         Add SPI for handling geolocation authorization requests
2167         https://bugs.webkit.org/show_bug.cgi?id=170362
2168         rdar://problem/17508627
2169
2170         Reviewed by Alex Christensen.
2171
2172         Add a new WKUIDelegate method for the WKGeolocationProviderIOS to call when a web page
2173         requests geolocation access. To support testing this change, make it possible to override
2174         the CoreLocation abstraction WKGeolocationProviderIOS uses. There is now a configurable
2175         object on the process pool that implements a protocol for providing location updates for
2176         web views in the process pool. If the client doesn't provide this object,
2177         WKGeolocationProviderIOS falls back to an object that wraps the existing WebKit1
2178         WebGeolocationCoreLocationProvider and conforms to the new protocol.
2179
2180         * Shared/Cocoa/APIObject.mm:
2181         (API::Object::newObject):
2182         * Shared/WebGeolocationPosition.h:
2183         (WebKit::WebGeolocationPosition::create):
2184         * UIProcess/API/C/WKGeolocationPosition.cpp:
2185         (WKGeolocationPositionCreate_b):
2186         * UIProcess/API/Cocoa/WKProcessPool.mm:
2187         (-[WKProcessPool _coreLocationProvider]):
2188         (-[WKProcessPool _setCoreLocationProvider:]):
2189         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
2190         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
2191         * UIProcess/API/Cocoa/_WKGeolocationCoreLocationProvider.h: Copied from Source/WebKit2/UIProcess/API/C/WKGeolocationPosition.cpp.
2192         * UIProcess/API/Cocoa/_WKGeolocationPosition.h: Copied from Source/WebKit2/UIProcess/API/C/WKGeolocationPosition.cpp.
2193         * UIProcess/API/Cocoa/_WKGeolocationPosition.mm: Added.
2194         (WebKit::if):
2195         (-[_WKGeolocationPosition dealloc]):
2196         (-[_WKGeolocationPosition _apiObject]):
2197         * UIProcess/API/Cocoa/_WKGeolocationPositionInternal.h: Copied from Source/WebKit2/UIProcess/API/C/WKGeolocationPosition.cpp.
2198         (WebKit::wrapper):
2199         * UIProcess/ios/WKGeolocationProviderIOS.mm:
2200         (kit):
2201         (-[WKGeolocationProviderIOS initWithProcessPool:]):
2202         (-[WKGeolocationProviderIOS geolocationAuthorizationGranted]):
2203         (-[WKGeolocationProviderIOS positionChanged:]):
2204         (-[WKLegacyCoreLocationProvider setListener:]):
2205         (-[WKLegacyCoreLocationProvider requestGeolocationAuthorization]):
2206         (-[WKLegacyCoreLocationProvider start]):
2207         (-[WKLegacyCoreLocationProvider stop]):
2208         (-[WKLegacyCoreLocationProvider setEnableHighAccuracy:]):
2209         (-[WKLegacyCoreLocationProvider geolocationAuthorizationGranted]):
2210         (-[WKLegacyCoreLocationProvider geolocationAuthorizationDenied]):
2211         (-[WKLegacyCoreLocationProvider positionChanged:]):
2212         (-[WKLegacyCoreLocationProvider errorOccurred:]):
2213         (-[WKLegacyCoreLocationProvider resetGeolocation]):
2214         Implement a new class that bridges the currently used WebGeolocationCoreLocationProvider
2215         to conform to the _WKGeolocationCoreLocationProvider protocol that WKGeolocationProviderIOS
2216         expects.
2217         * WebKit2.xcodeproj/project.pbxproj:
2218
2219 2017-04-11  Eric Carlson  <eric.carlson@apple.com>
2220
2221         [MediaStream] Set correct audio session category when capturing audio
2222         https://bugs.webkit.org/show_bug.cgi?id=170736
2223         <rdar://problem/31559405>
2224
2225         Reviewed by Jer Noble.
2226
2227         * UIProcess/WebPageProxy.cpp:
2228         (WebKit::WebPageProxy::isPlayingMediaDidChange):
2229
2230 2017-04-11  Youenn Fablet  <youenn@apple.com>
2231
2232         Activate WebRTC data channel tests for WK1
2233         https://bugs.webkit.org/show_bug.cgi?id=170710
2234
2235         Reviewed by Eric Carlson.
2236
2237         * WebProcess/Network/webrtc/LibWebRTCProvider.h: Making sure networking is not done in the Web process.
2238
2239 2017-04-11  Chris Fleizach  <cfleizach@apple.com>
2240
2241         AX: PDF plugin needs to support PDF-DOM Mode
2242         https://bugs.webkit.org/show_bug.cgi?id=170589
2243
2244         Reviewed by Tim Horton.
2245
2246         Provide access to DOM objects with PDF document. This mean:
2247            1) Support a different set of attributes for WKPDFPluginAccessibilityObject.
2248                 WKPDFPluginAccessibilityObject is now a group instead of forwarding attribute calls to the pdf layer.
2249            2) Connect the focused UI element to the active annotation if possible.
2250            3) Mark the PDF associated nodes with an attribute so they can be identified later so their correct parent can be found.
2251
2252         * WebProcess/Plugins/PDF/PDFLayerControllerSPI.h:
2253         * WebProcess/Plugins/PDF/PDFPlugin.h:
2254         * WebProcess/Plugins/PDF/PDFPlugin.mm:
2255         (-[WKPDFPluginAccessibilityObject pdfLayerController]):
2256         (-[WKPDFPluginAccessibilityObject setPdfLayerController:]):
2257         (-[WKPDFPluginAccessibilityObject convertRectToScreenSpace:]):
2258         (-[WKPDFPluginAccessibilityObject accessibilityAttributeValue:]):
2259         (-[WKPDFPluginAccessibilityObject accessibilityAttributeNames]):
2260         (-[WKPDFPluginAccessibilityObject accessibilityActionNames]):
2261         (-[WKPDFPluginAccessibilityObject accessibilityParameterizedAttributeNames]):
2262         (-[WKPDFPluginAccessibilityObject accessibilityFocusedUIElement]):
2263         (-[WKPDFPluginAccessibilityObject accessibilityAssociatedControlForAnnotation:]):
2264         (-[WKPDFPluginAccessibilityObject accessibilityHitTest:]):
2265         (WebKit::PDFPlugin::convertFromRootViewToPDFView):
2266         (WebKit::PDFPlugin::convertFromPDFViewToScreen):
2267         (WebKit::PDFPlugin::pluginHandlesContentOffsetForAccessibilityHitTest):
2268         (WebKit::PDFPlugin::axObjectCache):
2269         (WebKit::PDFPlugin::accessibilityShadowPluginParentForElement):
2270         * WebProcess/Plugins/PDF/PDFPluginAnnotation.mm:
2271         (WebKit::PDFPluginAnnotation::attach):
2272         * WebProcess/Plugins/Plugin.h:
2273         (WebKit::Plugin::accessibilityShadowPluginParentForElement):
2274         (WebKit::Plugin::pluginHandlesContentOffsetForAccessibilityHitTest):
2275         * WebProcess/Plugins/PluginView.cpp:
2276         (WebKit::PluginView::accessibilityShadowPluginParentForElement):
2277         * WebProcess/Plugins/PluginView.h:
2278         * WebProcess/WebPage/WebPage.h:
2279         * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectMac.mm:
2280         (-[WKAccessibilityWebPageObject accessibilityHitTest:]):
2281
2282 2017-04-11  Adrian Perez de Castro  <aperez@igalia.com>
2283
2284         [GTK] Attach popup menu to web view widget
2285         https://bugs.webkit.org/show_bug.cgi?id=145866
2286
2287         Use gtk_menu_attach_to_widget() to let GTK+ know that popup menus belong to a certain web view.
2288         This improves the positioning choices that the toolkit can do, and solves a long-standing issue
2289         that caused long popup menus to hang outside of the available display area under Wayland.
2290
2291         Based on a patch by Jonas Ådahl <jadahl@gmail.com>.
2292
2293         Reviewed by Carlos Garcia Campos.
2294
2295         * UIProcess/gtk/WebPopupMenuProxyGtk.cpp:
2296         (WebKit::WebPopupMenuProxyGtk::showPopupMenu):
2297
2298 2017-04-10  Alex Christensen  <achristensen@webkit.org>
2299
2300         Revert r215217
2301         https://bugs.webkit.org/show_bug.cgi?id=170703
2302
2303         * Configurations/FeatureDefines.xcconfig:
2304
2305 2017-04-10  Alex Christensen  <achristensen@webkit.org>
2306
2307         Continue enabling WebRTC
2308         https://bugs.webkit.org/show_bug.cgi?id=170703
2309
2310         Reviewed by Youenn Fablet.
2311
2312         * Configurations/FeatureDefines.xcconfig:
2313
2314 2017-04-10  Alex Christensen  <achristensen@webkit.org>
2315
2316         REGRESSION(r195479) First main resource load in new WebProcess bypasses content extensions
2317         https://bugs.webkit.org/show_bug.cgi?id=170707
2318         <rdar://problem/27788755>
2319
2320         Reviewed by Tim Horton.
2321
2322         We fix this by sending the UserContentController with the WebPageCreationParameters
2323         instead of in a IPC message immediately following creation.  By the time the WebPage
2324         receives its second message, it has already started loading the first main resource.
2325         
2326         I also changed all instances of calling ChildProcessProxy::connection() to send a message
2327         in favor of calling ChildProcessProxy::send, which does the same thing except if a child
2328         process has not started, it will put the message in a queue and send it when the process
2329         is finished launching.  This was necessary because the UserContentController is now connected
2330         to the process sooner, so there were some API tests that would try to send messages between
2331         initiating a process launch and finishing a process launch, and this change preserves the
2332         existing behavior in those cases.
2333
2334         * Shared/WebPageCreationParameters.cpp:
2335         (WebKit::WebPageCreationParameters::encode):
2336         (WebKit::WebPageCreationParameters::decode):
2337         * Shared/WebPageCreationParameters.h:
2338         * UIProcess/Databases/DatabaseProcessProxy.cpp:
2339         (WebKit::DatabaseProcessProxy::getDatabaseProcessConnection):
2340         (WebKit::DatabaseProcessProxy::didFinishLaunching):
2341         * UIProcess/Downloads/DownloadProxy.cpp:
2342         (WebKit::DownloadProxy::cancel):
2343         (WebKit::DownloadProxy::canAuthenticateAgainstProtectionSpace):
2344         (WebKit::DownloadProxy::willSendRequest):
2345         (WebKit::DownloadProxy::decideDestinationWithSuggestedFilenameAsync):
2346         * UIProcess/UserContent/WebUserContentControllerProxy.cpp:
2347         (WebKit::WebUserContentControllerProxy::addProcess):
2348         (WebKit::WebUserContentControllerProxy::addUserContentWorldUse):
2349         (WebKit::WebUserContentControllerProxy::removeUserContentWorldUses):
2350         (WebKit::WebUserContentControllerProxy::addUserScript):
2351         (WebKit::WebUserContentControllerProxy::removeUserScript):
2352         (WebKit::WebUserContentControllerProxy::removeAllUserScripts):
2353         (WebKit::WebUserContentControllerProxy::addUserStyleSheet):
2354         (WebKit::WebUserContentControllerProxy::removeUserStyleSheet):
2355         (WebKit::WebUserContentControllerProxy::removeAllUserStyleSheets):
2356         (WebKit::WebUserContentControllerProxy::addUserScriptMessageHandler):
2357         (WebKit::WebUserContentControllerProxy::removeUserMessageHandlerForName):
2358         (WebKit::WebUserContentControllerProxy::removeAllUserMessageHandlers):
2359         (WebKit::WebUserContentControllerProxy::addContentExtension):
2360         (WebKit::WebUserContentControllerProxy::removeContentExtension):
2361         (WebKit::WebUserContentControllerProxy::removeAllContentExtensions):
2362         * UIProcess/UserContent/WebUserContentControllerProxy.h:
2363         * UIProcess/VisitedLinkStore.cpp:
2364         (WebKit::VisitedLinkStore::removeAll):
2365         (WebKit::VisitedLinkStore::pendingVisitedLinksTimerFired):
2366         (WebKit::VisitedLinkStore::sendTable):
2367         * UIProcess/WebPageProxy.cpp:
2368         (WebKit::WebPageProxy::finishInitializingWebPageAfterProcessLaunch):
2369         (WebKit::WebPageProxy::creationParameters):
2370         * UIProcess/WebProcessProxy.cpp:
2371         (WebKit::WebProcessProxy::addWebUserContentControllerProxy):
2372         * UIProcess/WebProcessProxy.h:
2373         * WebProcess/UserContent/WebUserContentController.h:
2374         * WebProcess/WebPage/WebPage.cpp:
2375         (WebKit::m_backgroundCPULimit):
2376
2377 2017-04-10  Alex Christensen  <achristensen@webkit.org>
2378
2379         Add API to get available content extension identifiers in a WKContentExtensionStore
2380         https://bugs.webkit.org/show_bug.cgi?id=170093
2381
2382         Reviewed by Geoffrey Garen.
2383
2384         * UIProcess/API/APIContentExtensionStore.cpp:
2385         (API::constructedPathPrefix):
2386         (API::constructedPathFilter):
2387         (API::constructedPath):
2388         (API::ContentExtensionStore::getAvailableContentExtensionIdentifiers):
2389         * UIProcess/API/APIContentExtensionStore.h:
2390         * UIProcess/API/Cocoa/WKContentExtensionStore.h:
2391         * UIProcess/API/Cocoa/WKContentExtensionStore.mm:
2392         (-[WKContentExtensionStore _compileContentExtensionForIdentifier:encodedContentExtension:completionHandler:releasesArgument:]):
2393         (-[WKContentExtensionStore lookUpContentExtensionForIdentifier:completionHandler:]):
2394         (-[WKContentExtensionStore getAvailableContentExtensionIdentifiers:]):
2395         (-[WKContentExtensionStore removeContentExtensionForIdentifier:completionHandler:]):
2396
2397 2017-04-10  Jeremy Jones  <jeremyj@apple.com>
2398
2399         Add CoreAudioCaptureSource.
2400         https://bugs.webkit.org/show_bug.cgi?id=170112
2401         rdar://problem/30293338
2402
2403         Reviewed by Tim Horton.
2404
2405         Add UseAVFoundationAudioCapture preference to switch back from the new default of CoreAudio.
2406
2407         * Shared/WebPreferencesDefinitions.h:
2408         * UIProcess/API/C/WKPreferences.cpp:
2409         (WKPreferencesSetUseAVFoundationAudioCapture):
2410         (WKPreferencesGetUseAVFoundationAudioCapture):
2411         * UIProcess/API/C/WKPreferencesRefPrivate.h:
2412         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp:
2413         (WebKit::UserMediaCaptureManagerProxy::createMediaSourceForCaptureDeviceWithConstraints):
2414         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
2415         (WebKit::UserMediaPermissionRequestManagerProxy::syncWithWebCorePrefs):
2416         * WebProcess/WebPage/WebPage.cpp:
2417         (WebKit::WebPage::updatePreferences):
2418
2419 2017-04-10  Brent Fulgham  <bfulgham@apple.com>
2420
2421         [WK2][macOS] Block access to Apple Events before launch.
2422         https://bugs.webkit.org/show_bug.cgi?id=170626
2423         <rdar://problem/16079334>
2424
2425         Reviewed by Alexey Proskuryakov.
2426
2427         Clear the environment of the AppleEvent server name before initializing
2428         AppKit so we never bother connecting.
2429
2430         * Shared/EntryPointUtilities/mac/XPCService/XPCServiceMain.mm:
2431         (main):
2432
2433 2017-04-10  Adrian Perez de Castro  <aperez@igalia.com>
2434
2435         [GTK] Misplaced right click menu on web page due to deprecated gtk_menu_popup()
2436         https://bugs.webkit.org/show_bug.cgi?id=170553
2437
2438         Reviewed by Michael Catanzaro.
2439
2440         Use gtk_menu_popup_at_pointer() and gtk_menu_popup_at_rect() when building with GTK+ 3.22 or
2441         newer. This allows the Wayland GTK+ backend to properly position popup menus, and also avoids
2442         using functions which were deprecated starting at that GTK+ release.
2443
2444         * UIProcess/gtk/WebContextMenuProxyGtk.cpp:
2445         (WebKit::WebContextMenuProxyGtk::show): Use gtk_menu_popup_at_pointer() as there is always a
2446         pointer event that can be passed to it.
2447         * UIProcess/gtk/WebPopupMenuProxyGtk.cpp:
2448         (WebKit::WebPopupMenuProxyGtk::showPopupMenu): Use gtk_menu_popup_at_rect(), using the coordinates
2449         of the control passed as reference rectangle. Some conditional code is needed because with newer
2450         GTK+ versions a relative offset instead of an absolute position is needed.
2451
2452 2017-04-10  Adrian Perez de Castro  <aperez@igalia.com>
2453
2454         [GTK] Opening a popup menu does not pre-select the active item
2455         https://bugs.webkit.org/show_bug.cgi?id=170680
2456
2457         Reviewed by Michael Catanzaro.
2458
2459         * UIProcess/gtk/WebPopupMenuProxyGtk.cpp:
2460         (WebKit::WebPopupMenuProxyGtk::showPopupMenu): Use gtk_menu_shell_select_item() to
2461         ensure that the active item appears selected right after popping up the menu.
2462
2463 2017-04-10  Carlos Garcia Campos  <cgarcia@igalia.com>
2464
2465         [GTK] Enable DOM timer throttling and CSS animations suspension
2466         https://bugs.webkit.org/show_bug.cgi?id=170669
2467
2468         Reviewed by Žan Doberšek.
2469
2470         * Shared/WebPreferencesDefinitions.h:
2471
2472 2017-04-10  Chris Dumez  <cdumez@apple.com>
2473
2474         Drop Timer::startOneShot() overload taking a double
2475         https://bugs.webkit.org/show_bug.cgi?id=170659
2476
2477         Reviewed by Yusuke Suzuki.
2478
2479         Drop Timer::startOneShot() overload taking a double as people should use Seconds type now.
2480
2481         * NetworkProcess/PingLoad.h:
2482         * NetworkProcess/soup/NetworkDataTaskSoup.cpp:
2483         (WebKit::NetworkDataTaskSoup::startTimeout):
2484         * Platform/IPC/Connection.h:
2485         * Platform/IPC/mac/ConnectionMac.mm:
2486         (IPC::ConnectionTerminationWatchdog::createConnectionTerminationWatchdog):
2487         (IPC::ConnectionTerminationWatchdog::ConnectionTerminationWatchdog):
2488         (IPC::Connection::terminateSoon):
2489         * PluginProcess/PluginProcess.cpp:
2490         (WebKit::PluginProcess::setMinimumLifetime):
2491         * PluginProcess/PluginProcess.h:
2492         * Shared/ChildProcess.cpp:
2493         (WebKit::ChildProcess::ChildProcess):
2494         * Shared/ChildProcess.h:
2495         (WebKit::ChildProcess::setTerminationTimeout):
2496         * Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.cpp:
2497         (WebKit::CompositingRunLoop::startUpdateTimer):
2498         * Shared/Plugins/PluginProcessCreationParameters.h:
2499         * Shared/WebMemorySampler.cpp:
2500         (WebKit::WebMemorySampler::initializeTimers):
2501         * Shared/WebProcessCreationParameters.h:
2502         * UIProcess/API/Cocoa/APISerializedScriptValueCocoa.mm:
2503         (API::SharedJSContext::ensureContext):
2504         * UIProcess/ChildProcessProxy.cpp:
2505         (WebKit::ChildProcessProxy::shutDownProcess):
2506         * UIProcess/Cocoa/NavigationState.mm:
2507         (WebKit::NavigationState::didChangeIsLoading):
2508         * UIProcess/Cocoa/ViewGestureController.cpp:
2509         (WebKit::ViewGestureController::SnapshotRemovalTracker::startWatchdog):
2510         * UIProcess/Cocoa/ViewGestureController.h:
2511         * UIProcess/DrawingAreaProxyImpl.cpp:
2512         (WebKit::DrawingAreaProxyImpl::discardBackingStoreSoon):
2513         (WebKit::DrawingAreaProxyImpl::DrawingMonitor::start):
2514         (WebKit::DrawingAreaProxyImpl::DrawingMonitor::didDraw):
2515         * UIProcess/Gamepad/UIGamepadProvider.cpp:
2516         * UIProcess/Plugins/PluginProcessProxy.cpp:
2517         * UIProcess/ProcessThrottler.cpp:
2518         * UIProcess/ResponsivenessTimer.cpp:
2519         * UIProcess/WebProcessPool.cpp:
2520         (WebKit::WebProcessPool::createNewWebProcess):
2521         * UIProcess/gtk/GestureController.cpp:
2522         (WebKit::GestureController::DragGesture::begin):
2523         * UIProcess/mac/WebInspectorProxyMac.mm:
2524         * WebProcess/WebPage/AcceleratedDrawingArea.cpp:
2525         (WebKit::AcceleratedDrawingArea::exitAcceleratedCompositingModeNow):
2526         * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp:
2527         (WebKit::CoordinatedLayerTreeHost::scheduleAnimation):
2528         * WebProcess/WebPage/WebPage.cpp:
2529         (WebKit::WebPage::determinePrimarySnapshottedPlugIn):
2530         * WebProcess/WebProcess.cpp:
2531
2532 2017-04-09  Wenson Hsieh  <wenson_hsieh@apple.com>
2533
2534         [WK2] Add infrastructure to perform actions after an asynchronous position information request finishes
2535         https://bugs.webkit.org/show_bug.cgi?id=170658
2536         <rdar://problem/31431450>
2537
2538         Reviewed by Tim Horton.
2539
2540         Introduces doAfterPositionInformationUpdate:forRequest:, which WKContentView can use internally to perform
2541         an action requiring InteractionInformationAtPosition asynchronously. See below for additional details.
2542
2543         New API unit test: DataInteractionTests.UnresponsivePageDoesNotHangUI.
2544
2545         * UIProcess/ios/WKContentViewInteraction.h:
2546         * UIProcess/ios/WKContentViewInteraction.mm:
2547         (-[WKContentView _actionForLongPressFromPositionInformation:]):
2548         (-[WKContentView _actionForLongPress]):
2549         (-[WKContentView doAfterPositionInformationUpdate:forRequest:]):
2550
2551         If current position information satisfies the request, then perform the given block immediately; otherwise, we
2552         save the block and request as a pair in a list of pending position information handlers, and then make a new
2553         request to the web process for position information if the currently outgoing request does not already satisfy
2554         the given request.
2555
2556         (-[WKContentView ensurePositionInformationIsUpToDate:]):
2557
2558         Fire all asynchronous position information handlers that are satisfied by the incoming position information.
2559
2560         (-[WKContentView requestAsynchronousPositionInformationUpdate:]):
2561         (-[WKContentView _currentPositionInformationIsValidForRequest:]):
2562         (-[WKContentView _hasValidOutstandingPositionInformationRequest:]):
2563
2564         Pulled out common logic for managing InteractionInformationRequests into separate helper methods.
2565
2566         (-[WKContentView _invokeAndRemovePendingHandlersValidForCurrentPositionInformation]):
2567         (-[WKContentView gestureRecognizerShouldBegin:]):
2568
2569         Refactored to use ensurePositionInformationIsUpToDate:. There is no behavior change here, but it makes sure that
2570         this particular request will also any valid pending position information handlers.
2571
2572         (-[WKContentView _positionInformationDidChange:]):
2573
2574         Fire all asynchronous position information handlers that are satisfied by the incoming position information.
2575
2576         (-[WKContentView pointIsInDataInteractionContent:]): Deleted.
2577
2578         We should no longer use this method, since it makes a synchronous request to the web process -- see
2579         positionInformationMayStartDataInteraction.
2580
2581 2017-04-09  Chris Dumez  <cdumez@apple.com>
2582
2583         Drop Timer::startRepeating() overload taking a double
2584         https://bugs.webkit.org/show_bug.cgi?id=170656
2585
2586         Reviewed by Yusuke Suzuki.
2587
2588         Drop Timer::startRepeating() overload taking a double as people should use Seconds type now.
2589
2590         * Shared/WebMemorySampler.cpp:
2591         (WebKit::WebMemorySampler::initializeTimers):
2592         * UIProcess/Cocoa/ViewGestureController.cpp:
2593         * UIProcess/HighPerformanceGraphicsUsageSampler.cpp:
2594         * UIProcess/PerActivityStateCPUUsageSampler.cpp:
2595         * WebProcess/Plugins/Netscape/NetscapePlugin.cpp:
2596         (WebKit::NetscapePlugin::Timer::start):
2597         * WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm:
2598         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp:
2599         (WebKit::CompositingCoordinator::scheduleReleaseInactiveAtlases):
2600
2601 2017-04-09  Jon Lee  <jonlee@apple.com>
2602
2603         [WK2][iOS] Add CoreMedia entitlement for WebProcess
2604         https://bugs.webkit.org/show_bug.cgi?id=170623
2605         rdar://problem/30020073
2606
2607         Reviewed by Youenn Fablet.
2608
2609         * Configurations/WebContent-iOS.entitlements: Update entitlement to an array of strings instead of bool.
2610
2611 2017-04-09  Chris Dumez  <cdumez@apple.com>
2612
2613         Start dropping Timer API dealing with double
2614         https://bugs.webkit.org/show_bug.cgi?id=170649
2615
2616         Reviewed by Yusuke Suzuki.
2617
2618         Start dropping Timer API dealing with double as people should use Seconds now.
2619
2620         * NetworkProcess/NetworkDataTask.cpp:
2621         (WebKit::NetworkDataTask::scheduleFailure):
2622         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
2623         (WebKit::NetworkDataTaskCocoa::resume):
2624         * PluginProcess/PluginControllerProxy.cpp:
2625         (WebKit::PluginControllerProxy::destroy):
2626         (WebKit::PluginControllerProxy::startPaintTimer):
2627         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
2628         (webkitWebViewBaseScheduleUpdateActivityState):
2629         * UIProcess/DrawingAreaProxy.cpp:
2630         (WebKit::DrawingAreaProxy::setViewExposedRect):
2631         * UIProcess/DrawingAreaProxyImpl.cpp:
2632         (WebKit::DrawingAreaProxyImpl::DrawingMonitor::start):
2633         * UIProcess/Plugins/gtk/PluginInfoCache.cpp:
2634         (WebKit::PluginInfoCache::updatePluginInfo):
2635         * UIProcess/VisitedLinkStore.cpp:
2636         (WebKit::VisitedLinkStore::addVisitedLinkHash):
2637         * UIProcess/WebProcessPool.cpp:
2638         (WebKit::m_hiddenPageThrottlingAutoIncreasesCounter):
2639         * UIProcess/gtk/GestureController.cpp:
2640         (WebKit::GestureController::ZoomGesture::scaleChanged):
2641         * UIProcess/gtk/WebPopupMenuProxyGtk.cpp:
2642         (WebKit::WebPopupMenuProxyGtk::menuUnmappedCallback):
2643         * WebProcess/Network/WebLoaderStrategy.cpp:
2644         (WebKit::WebLoaderStrategy::scheduleInternallyFailedLoad):
2645         * WebProcess/Plugins/Netscape/NPRuntimeObjectMap.cpp:
2646         (WebKit::NPRuntimeObjectMap::addToInvalidationQueue):
2647         * WebProcess/Plugins/Netscape/NetscapePluginStream.cpp:
2648         (WebKit::NetscapePluginStream::deliverDataToPlugin):
2649         * WebProcess/Plugins/PluginView.cpp:
2650         (WebKit::PluginView::pendingURLRequestsTimerFired):
2651         (WebKit::PluginView::loadURL):
2652         * WebProcess/WebPage/AcceleratedDrawingArea.cpp:
2653         (WebKit::AcceleratedDrawingArea::exitAcceleratedCompositingModeSoon):
2654         * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp:
2655         (WebKit::CoordinatedLayerTreeHost::scheduleLayerFlush):
2656         * WebProcess/WebPage/DrawingAreaImpl.cpp:
2657         (WebKit::DrawingAreaImpl::scheduleDisplay):
2658         * WebProcess/WebPage/WebPage.cpp:
2659         (WebKit::WebPage::updateIsInWindow):
2660         (WebKit::WebPage::addPluginView):
2661         (WebKit::WebPage::setMayStartMediaWhenInWindow):
2662         (WebKit::WebPage::didFinishLoad):
2663         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
2664         (WebKit::TiledCoreAnimationDrawingArea::activityStateDidChange):
2665
2666 2017-04-08  Chris Dumez  <cdumez@apple.com>
2667
2668         Drop std::chrono support from Timer class
2669         https://bugs.webkit.org/show_bug.cgi?id=170645
2670
2671         Reviewed by Sam Weinig.
2672
2673         Drop std::chrono support from Timer class now that we prefer using Seconds type.
2674
2675         * NetworkProcess/NetworkLoad.cpp:
2676         (WebKit::NetworkLoad::Throttle::Throttle):
2677         (WebKit::NetworkLoad::didReceiveResponseNetworkSession):
2678         * NetworkProcess/NetworkProcess.h:
2679         (WebKit::NetworkProcess::loadThrottleLatency):
2680         * NetworkProcess/NetworkProcessCreationParameters.cpp:
2681         * NetworkProcess/NetworkProcessCreationParameters.h:
2682         * NetworkProcess/NetworkResourceLoadParameters.h:
2683         * NetworkProcess/NetworkResourceLoader.cpp:
2684         (WebKit::NetworkResourceLoader::startNetworkLoad):
2685         * NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp:
2686         * NetworkProcess/cache/NetworkCacheStatistics.cpp:
2687         * NetworkProcess/cache/NetworkCacheStorage.cpp:
2688         (WebKit::NetworkCache::Storage::dispatchReadOperation):
2689         (WebKit::NetworkCache::Storage::store):
2690         * Shared/CacheModel.cpp:
2691         (WebKit::calculateMemoryCacheSizes):
2692         * Shared/CacheModel.h:
2693         * Shared/mac/RemoteLayerBackingStoreCollection.mm:
2694         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
2695         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
2696         * WebProcess/Network/WebLoaderStrategy.cpp:
2697         (WebKit::maximumBufferingTime):
2698         * WebProcess/Plugins/PluginView.cpp:
2699         * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm:
2700         (WebKit::RemoteLayerTreeDrawingArea::scheduleCompositingLayerFlushImmediately):
2701         (WebKit::RemoteLayerTreeDrawingArea::scheduleCompositingLayerFlush):
2702         * WebProcess/WebProcess.cpp:
2703         (WebKit::m_resourceLoadStatisticsStore):
2704         (WebKit::WebProcess::setCacheModel):
2705
2706 2017-04-08  Chris Dumez  <cdumez@apple.com>
2707
2708         Unreviewed attempt to fix GTK build after r215138.
2709
2710         * UIProcess/API/gtk/WebKitUIClient.cpp:
2711
2712 2017-04-08  Youenn Fablet  <youenn@apple.com>
2713
2714         WebRTC tests gardening
2715         https://bugs.webkit.org/show_bug.cgi?id=170508
2716
2717         Reviewed by Eric Carlson.
2718
2719         * Configurations/FeatureDefines.xcconfig:
2720
2721 2017-04-08  Chris Dumez  <cdumez@apple.com>
2722
2723         Timer's nextFireInterval() / repeatInterval() should return Seconds
2724         https://bugs.webkit.org/show_bug.cgi?id=170639
2725
2726         Reviewed by Simon Fraser.
2727
2728         Timer's nextFireInterval() / repeatInterval() should return Seconds, not double.
2729
2730         * WebProcess/WebPage/WebPage.cpp:
2731         (WebKit::WebPage::layerVolatilityTimerFired):
2732         (WebKit::WebPage::markLayersVolatile):
2733
2734 2017-04-07  Alex Christensen  <achristensen@webkit.org>
2735
2736         Modernize WebPage.h
2737         https://bugs.webkit.org/show_bug.cgi?id=170633
2738
2739         Reviewed by Joseph Pecoraro.
2740
2741         * UIProcess/API/APIUIClient.h:
2742         (API::UIClient::createNewPage):
2743         * UIProcess/API/C/WKPage.cpp:
2744         (WebKit::RunBeforeUnloadConfirmPanelResultListener::create):
2745         (WebKit::RunJavaScriptAlertResultListener::create):
2746         (WebKit::RunJavaScriptConfirmResultListener::create):
2747         (WebKit::RunJavaScriptConfirmResultListener::RunJavaScriptConfirmResultListener):
2748         (WebKit::RunJavaScriptPromptResultListener::create):
2749         (WebKit::RunJavaScriptPromptResultListener::RunJavaScriptPromptResultListener):
2750         (WKPageSetPageUIClient):
2751         * UIProcess/Cocoa/UIDelegate.h:
2752         * UIProcess/Cocoa/UIDelegate.mm:
2753         (WebKit::UIDelegate::UIClient::createNewPage):
2754         * WebProcess/WebPage/WebPage.cpp:
2755         (WebKit::WebPage::loadDataImpl):
2756         (WebKit::WebPage::loadStringImpl):
2757         (WebKit::WebPage::loadData):
2758         (WebKit::WebPage::scaledSnapshotWithOptions):
2759         (WebKit::WebPage::SandboxExtensionTracker::willPerformLoadDragDestinationAction):
2760         (WebKit::WebPage::SandboxExtensionTracker::setPendingProvisionalSandboxExtension):
2761         * WebProcess/WebPage/WebPage.h:
2762
2763 2017-04-07  Alex Christensen  <achristensen@webkit.org>
2764
2765         Use audit_token_t instead of pid_t for checking sandbox of other processes
2766         https://bugs.webkit.org/show_bug.cgi?id=170616
2767         <rdar://problem/31158189>
2768
2769         Reviewed by Daniel Bates.
2770
2771         pid's can be reused, so it's theoretically unsafe to use the pid of another process to check whether it's sandboxed.
2772         Use an audit_token_t instead to be more sure that we are not mistakenly checking a new process that has reused the
2773         old process's pid. For the current process, though, we have no xpc_connection_t to the process because we are the process.
2774
2775         * PluginProcess/mac/PluginProcessMac.mm:
2776         (WebKit::PluginProcess::initializeSandbox):
2777         * Shared/EntryPointUtilities/mac/XPCService/XPCServiceEntryPoint.mm:
2778         (WebKit::XPCServiceInitializerDelegate::isClientSandboxed):
2779         * Shared/mac/SandboxUtilities.h:
2780         * Shared/mac/SandboxUtilities.mm:
2781         (WebKit::currentProcessIsSandboxed):
2782         (WebKit::connectedProcessIsSandboxed):
2783         (WebKit::processIsSandboxed): Deleted.
2784         * UIProcess/Cocoa/WebProcessProxyCocoa.mm:
2785         (WebKit::WebProcessProxy::platformIsBeingDebugged):
2786         * UIProcess/Plugins/mac/PluginInfoStoreMac.mm:
2787         (WebKit::PluginInfoStore::shouldUsePlugin):
2788         * UIProcess/Plugins/mac/PluginProcessProxyMac.mm:
2789         (WebKit::PluginProcessProxy::platformGetLaunchOptions):
2790
2791 2017-04-07  Brent Fulgham  <bfulgham@apple.com>
2792
2793         [WK2][iOS] Add CoreMedia entitlement for WebProcess
2794         https://bugs.webkit.org/show_bug.cgi?id=170623
2795         <rdar://problem/30020073>
2796
2797         Reviewed by Youenn Fablet.
2798
2799         Add new "com.apple.tcc.delegated-services" entitlement to allow CoreMedia
2800         to work properly in WebRTC.
2801
2802         * Configurations/WebContent-iOS.entitlements:
2803
2804 2017-04-07  Alex Christensen  <achristensen@webkit.org>
2805
2806         Private browsing sessions should not look in keychain for client certificates
2807         https://bugs.webkit.org/show_bug.cgi?id=170618
2808         <rdar://problem/18457427>
2809
2810         Reviewed by Dan Bernstein.
2811
2812         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
2813         (WebKit::configurationForSessionID):
2814
2815 2017-04-07  Chris Dumez  <cdumez@apple.com>
2816
2817         We should log how much CPU a background process was using when killing it due to CPU limiting
2818         https://bugs.webkit.org/show_bug.cgi?id=170619
2819
2820         Reviewed by Andreas Kling.
2821
2822         * WebProcess/cocoa/WebProcessCocoa.mm:
2823         (WebKit::WebProcess::updateBackgroundCPUMonitorState):
2824
2825 2017-04-07  Wenson Hsieh  <wenson_hsieh@apple.com>
2826
2827         Missing conversion from window to content coordinates when adjusting unobscured content rects for input view
2828         https://bugs.webkit.org/show_bug.cgi?id=170603
2829
2830         Reviewed by Simon Fraser.
2831
2832         Refactors -[WKContentView _computeUnobscuredContentRectRespectingInputViewBounds:unobscuredContentRect:inputViewBounds:scale:]
2833         to convert the input view bounds into content coordinates instead of using the zoom scale to adjust the height of inputViewBounds.
2834         Covered by the existing LayoutTest, fixed-element-on-bottom-with-keyboard.html.
2835
2836         * UIProcess/ios/WKContentView.mm:
2837         (-[WKContentView _computeUnobscuredContentRectRespectingInputViewBounds:unobscuredContentRect:inputViewBounds:scale:]):
2838
2839 2017-04-07  Michael Catanzaro  <mcatanzaro@igalia.com>
2840
2841         [GTK] Various build errors when plugin support is disabled
2842         https://bugs.webkit.org/show_bug.cgi?id=170015
2843
2844         Reviewed by Carlos Garcia Campos.
2845
2846         * PluginProcess/unix/PluginControllerProxyUnix.cpp:
2847         * UIProcess/API/gtk/WebKitWebsiteData.cpp:
2848         (recordContainsSupportedDataTypes):
2849         (toWebKitWebsiteDataTypes):
2850         * UIProcess/API/gtk/WebKitWebsiteDataManager.cpp:
2851         (toWebsiteDataTypes):
2852
2853 2017-04-07  John Wilander  <wilander@apple.com>
2854
2855         WebSocket streams should have network usage attributed to correct process
2856         https://bugs.webkit.org/show_bug.cgi?id=170322
2857         <rdar://problem/26413551>
2858
2859         Reviewed by Alex Christensen.
2860
2861         Changes here are due to the added WebCore::SourceApplicationAuditToken parameter
2862         in WebCore::SocketStreamHandleImpl::create().
2863         WebKit::NetworkSocketStream takes it and passes it on.
2864
2865         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
2866         (WebKit::NetworkConnectionToWebProcess::createSocketStream):
2867         * NetworkProcess/NetworkSocketStream.cpp:
2868         (WebKit::NetworkSocketStream::create):
2869         (WebKit::NetworkSocketStream::NetworkSocketStream):
2870         * NetworkProcess/NetworkSocketStream.h:
2871
2872 2017-04-07  Michael Catanzaro  <mcatanzaro@igalia.com>
2873
2874         Unreviewed, fix missing return value warning
2875
2876         * UIProcess/WebProcessProxy.cpp:
2877         (WebKit::diagnosticLoggingKeyForSimulatedCrashReason):
2878
2879 2017-04-07  Carlos Garcia Campos  <cgarcia@igalia.com>
2880
2881         [GTK] Update the priorities used in glib main loop sources
2882         https://bugs.webkit.org/show_bug.cgi?id=170457
2883
2884         Reviewed by Žan Doberšek.
2885
2886         * Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.cpp:
2887         (WebKit::CompositingRunLoop::CompositingRunLoop):
2888         * UIProcess/DrawingAreaProxyImpl.cpp:
2889         (WebKit::DrawingAreaProxyImpl::DrawingAreaProxyImpl):
2890         (WebKit::DrawingAreaProxyImpl::DrawingMonitor::DrawingMonitor):
2891         * UIProcess/gtk/WaylandCompositor.cpp:
2892         (WebKit::createWaylandLoopSource):
2893         * WebProcess/WebPage/AcceleratedDrawingArea.cpp:
2894         (WebKit::AcceleratedDrawingArea::AcceleratedDrawingArea):
2895         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp:
2896         (WebKit::CompositingCoordinator::CompositingCoordinator):
2897         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.h:
2898         * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp:
2899         (WebKit::CoordinatedLayerTreeHost::CoordinatedLayerTreeHost):
2900         * WebProcess/WebPage/DrawingAreaImpl.cpp:
2901         (WebKit::DrawingAreaImpl::DrawingAreaImpl):
2902
2903 2017-04-06  Alex Christensen  <achristensen@webkit.org>
2904
2905         Add WKContentExtensionStore.h and WKContentExtension.h to public WebKit.h
2906         https://bugs.webkit.org/show_bug.cgi?id=170533
2907
2908         Reviewed by Daniel Bates.
2909
2910         * Shared/API/Cocoa/WebKit.h:
2911         In r213696 I added two public headers.  All public headers in WebKit are included with
2912         #import <WebKit/WebKit.h>
2913
2914 2017-04-06  Joseph Pecoraro  <pecoraro@apple.com>
2915
2916         Web Inspector: Hangs when loading under SpeculativeLoad::shouldCaptureExtraNetworkLoadMetrics
2917         https://bugs.webkit.org/show_bug.cgi?id=170575
2918
2919         Rubber-stamped by Brian Burg.
2920
2921         * NetworkProcess/cache/NetworkCacheSpeculativeLoad.cpp:
2922         (WebKit::NetworkCache::SpeculativeLoad::shouldCaptureExtraNetworkLoadMetrics): Deleted.
2923         * NetworkProcess/cache/NetworkCacheSpeculativeLoad.h:
2924         m_networkLoad is a wrapper around `this` as the client, so we would infinite loop here.
2925
2926 2017-04-06  Commit Queue  <commit-queue@webkit.org>
2927
2928         Unreviewed, rolling out r214973.
2929         https://bugs.webkit.org/show_bug.cgi?id=170578
2930
2931         Causes issues in Safari (Requested by bradee-oh on #webkit).
2932
2933         Reverted changeset:
2934
2935         "Refactor so WebsiteDataStores always have a StorageManager."
2936         https://bugs.webkit.org/show_bug.cgi?id=170521
2937         http://trac.webkit.org/changeset/214973
2938
2939 2017-04-06  Ryan Haddad  <ryanhaddad@apple.com>
2940
2941         Unreviewed, rolling out r215046.
2942
2943         This change broke internal builds.
2944
2945         Reverted changeset:
2946
2947         "WebRTC tests gardening"
2948         https://bugs.webkit.org/show_bug.cgi?id=170508
2949         http://trac.webkit.org/changeset/215046
2950
2951 2017-04-06  Joseph Pecoraro  <pecoraro@apple.com>
2952
2953         Web Inspector: Only Capture Extra Network Load Metrics when there is a Web Inspector Frontend
2954         https://bugs.webkit.org/show_bug.cgi?id=170525
2955
2956         Reviewed by Youenn Fablet.
2957
2958         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
2959         (-[WKNetworkSessionDelegate URLSession:task:didFinishCollectingMetrics:]):
2960         Only collect extra metrics if the WebProcess this load is for has enabled
2961         collecting extra metrics.
2962
2963         * WebProcess/Network/WebLoaderStrategy.cpp:
2964         (WebKit::WebLoaderStrategy::setCaptureExtraNetworkLoadMetricsEnabled):
2965         * WebProcess/Network/WebLoaderStrategy.h:
2966         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
2967         (WebKit::NetworkConnectionToWebProcess::setCaptureExtraNetworkLoadMetricsEnabled):
2968         * NetworkProcess/NetworkConnectionToWebProcess.h:
2969         (WebKit::NetworkConnectionToWebProcess::captureExtraNetworkLoadMetricsEnabled):
2970         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
2971         New bool state toggled through the loader policy.
2972
2973         * NetworkProcess/NetworkDataTask.cpp:
2974         (WebKit::NetworkDataTask::shouldCaptureExtraNetworkLoadMetrics):
2975         * NetworkProcess/NetworkDataTask.h:
2976         (WebKit::NetworkDataTaskClient::shouldCaptureExtraNetworkLoadMetrics):
2977         * NetworkProcess/NetworkLoad.cpp:
2978         (WebKit::NetworkLoad::shouldCaptureExtraNetworkLoadMetrics):
2979         * NetworkProcess/NetworkLoad.h:
2980         * NetworkProcess/NetworkLoadClient.h:
2981         (WebKit::NetworkLoadClient::shouldCaptureExtraNetworkLoadMetrics):
2982         * NetworkProcess/NetworkResourceLoader.cpp:
2983         (WebKit::NetworkResourceLoader::shouldCaptureExtraNetworkLoadMetrics):
2984         * NetworkProcess/NetworkResourceLoader.h:
2985         * NetworkProcess/cache/NetworkCacheSpeculativeLoad.cpp:
2986         (WebKit::NetworkCache::SpeculativeLoad::shouldCaptureExtraNetworkLoadMetrics):
2987         * NetworkProcess/cache/NetworkCacheSpeculativeLoad.h:
2988         Default handling for network loads is to not include extra data. Thread
2989         client messages back from the NetworkLoads / SpeculativeLoads to check
2990         the NetworkConnectionToWebProcess state on whether or not we should collect
2991         extra metrics.
2992
2993 2017-04-06  Joseph Pecoraro  <pecoraro@apple.com>
2994
2995         Web Inspector: Show all headers in the Request Headers section of the Resource details sidebar
2996         https://bugs.webkit.org/show_bug.cgi?id=16531
2997         <rdar://problem/5712895>
2998
2999         Reviewed by Timothy Hatcher.
3000
3001         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
3002         (-[WKNetworkSessionDelegate URLSession:task:didFinishCollectingMetrics:]):
3003         Include a complete list of the request headers sent for this load.
3004         There may be headers that WebCore did not know about and developer
3005         tools should be informed of.
3006
3007 2017-04-06  Anders Carlsson  <andersca@apple.com>
3008
3009         OptionSet options need to be powers of two
3010         https://bugs.webkit.org/show_bug.cgi?id=170565
3011
3012         Reviewed by Chris Dumez.
3013
3014         Change Cache::Option to be powers of two.
3015
3016         * NetworkProcess/cache/NetworkCache.h:
3017
3018 2017-04-06  Youenn Fablet  <youenn@apple.com>
3019
3020         WebRTC tests gardening
3021         https://bugs.webkit.org/show_bug.cgi?id=170508
3022
3023         Reviewed by Eric Carlson.
3024
3025         * Configurations/FeatureDefines.xcconfig:
3026
3027 2017-04-06  Antti Koivisto  <antti@apple.com>
3028
3029         Implement testing mode for disk cache
3030         https://bugs.webkit.org/show_bug.cgi?id=170547
3031
3032         Reviewed by Andreas Kling.
3033
3034         Disable read timeouts and cache shrinking in TestRunner to eliminate potential sources of randomness.
3035
3036         Cache directories are deleted by TestRunner so lack of shrinking does not consume the disk.
3037
3038         This is enabled by the existing WKContextUseTestingNetworkSession SPI.
3039
3040         * NetworkProcess/cache/NetworkCache.cpp:
3041         (WebKit::NetworkCache::Cache::initialize):
3042         * NetworkProcess/cache/NetworkCache.h:
3043         * NetworkProcess/cache/NetworkCacheStorage.cpp:
3044         (WebKit::NetworkCache::Storage::open):
3045         (WebKit::NetworkCache::Storage::Storage):
3046         (WebKit::NetworkCache::Storage::dispatchReadOperation):
3047         (WebKit::NetworkCache::Storage::shrinkIfNeeded):
3048         * NetworkProcess/cache/NetworkCacheStorage.h:
3049         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
3050         (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa):
3051
3052 2017-04-06  Chris Dumez  <cdumez@apple.com>
3053
3054         [WK2] Add C private API to toggle invisibleAutoplayNotPermitted setting
3055         https://bugs.webkit.org/show_bug.cgi?id=170524
3056         <rdar://problem/31461472>
3057
3058         Reviewed by Eric Carlson.
3059
3060         Add C private API to toggle invisibleAutoplayNotPermitted setting.
3061
3062         * UIProcess/API/C/WKPreferences.cpp:
3063         (WKPreferencesSetInvisibleMediaAutoplayPermitted):
3064         (WKPreferencesGetInvisibleMediaAutoplayPermitted):
3065         * UIProcess/API/C/WKPreferencesRefPrivate.h:
3066
3067 2017-04-06  Adrian Perez de Castro  <aperez@igalia.com>
3068
3069         [GTK] Fix build with MEDIA_CAPTURE enabled
3070         https://bugs.webkit.org/show_bug.cgi?id=170539
3071
3072         Reviewed by Carlos Garcia Campos.
3073
3074         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDeprecated.cpp:
3075         (webkit_dom_html_input_element_get_capture): Add missing namespace in usage of WebCore::MediaCaptureTypeNone.
3076
3077 2017-04-05  Brent Fulgham  <bfulgham@apple.com>
3078
3079         [WK2][iOS] Remove access to features not present on iOS 
3080         https://bugs.webkit.org/show_bug.cgi?id=170531
3081         <rdar://problem/31352258>
3082
3083         Reviewed by Alexey Proskuryakov.
3084
3085         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
3086
3087 2017-04-05  Eric Carlson  <eric.carlson@apple.com>
3088
3089         [MediaStream] Host application should be able to mute and unmute media streams
3090         https://bugs.webkit.org/show_bug.cgi?id=170519
3091         <rdar://problem/31174326>
3092
3093         Reviewed by Youenn Fablet.
3094
3095         * UIProcess/API/C/WKPage.cpp:
3096         (WKPageGetMediaState): Support new media stream state flags.
3097         * UIProcess/API/C/WKPagePrivate.h:
3098         * UIProcess/API/Cocoa/WKWebViewPrivate.h: Ditto.
3099         * UIProcess/Cocoa/UIDelegate.mm: Ditto.
3100
3101 2017-04-05  Brady Eidson  <beidson@apple.com>
3102
3103         Refactor so WebsiteDataStores always have a StorageManager.
3104         https://bugs.webkit.org/show_bug.cgi?id=170521
3105
3106         Reviewed by Geoff Garen.
3107
3108         This basically involves teaching StorageManager how to work without a LocalStorageDatabaseTracker,
3109         since there will never be ephemeral bits on disk to track.
3110         
3111         * UIProcess/Storage/StorageManager.cpp:
3112         (WebKit::StorageManager::StorageArea::openDatabaseAndImportItemsIfNeeded):
3113         (WebKit::StorageManager::createEphemeral):
3114         (WebKit::StorageManager::StorageManager):
3115         (WebKit::StorageManager::getLocalStorageOrigins):
3116         (WebKit::StorageManager::getLocalStorageOriginDetails):
3117         (WebKit::StorageManager::deleteLocalStorageEntriesForOrigin):
3118         (WebKit::StorageManager::deleteLocalStorageOriginsModifiedSince):
3119         (WebKit::StorageManager::deleteLocalStorageEntriesForOrigins):
3120         * UIProcess/Storage/StorageManager.h:
3121         
3122         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
3123         (WebKit::WebsiteDataStore::WebsiteDataStore):
3124
3125 2017-04-05  Brent Fulgham  <bfulgham@apple.com>
3126
3127         [WK2][iOS] Add entitlements to enable audio/video capture in WebProcess
3128         https://bugs.webkit.org/show_bug.cgi?id=170507
3129         <rdar://problem/31121248>
3130
3131         Reviewed by Youenn Fablet.
3132
3133         Add two entitlements that are required to access audio/video capture on iOS.
3134
3135         * Configurations/WebContent-iOS.entitlements:
3136
3137 2017-04-05  Carlos Garcia Campos  <cgarcia@igalia.com>
3138
3139         Show a log message when an invalid message is received in non cocoa ports
3140         https://bugs.webkit.org/show_bug.cgi?id=170506
3141
3142         Reviewed by Michael Catanzaro.
3143
3144         We just crash, but without knowing the details about the message it's impossible to debug.
3145
3146         * Shared/ChildProcess.cpp:
3147         (WebKit::ChildProcess::didReceiveInvalidMessage):
3148
3149 2017-04-04  Carlos Garcia Campos  <cgarcia@igalia.com>
3150
3151         Move WebErrors from WebProcess to Shared and get rid of ErrorsGtk in WebCore
3152         https://bugs.webkit.org/show_bug.cgi?id=156974
3153
3154         Reviewed by Sam Weinig.
3155
3156         WebErrors are not only used by the frame loader client in the web process, but also by the network process. So,
3157         move them to Shared make most of the implementation cross-platform.
3158
3159         * CMakeLists.txt: Add new files to compilation.
3160         * NetworkProcess/soup/NetworkDataTaskSoup.cpp:
3161         (WebKit::NetworkDataTaskSoup::download): Use WebErrors directly instead of platform methods that are no longer needed.
3162         (WebKit::NetworkDataTaskSoup::writeDownloadCallback): Ditto.
3163         (WebKit::NetworkDataTaskSoup::didFinishDownload): Ditto.
3164         (WebKit::NetworkDataTaskSoup::didFail): Ditto.
3165         * PlatformGTK.cmake: Add new files to compilation and remove DownloadSoupErrorsGtk.cpp
3166         * PlatformMac.cmake:
3167         * Shared/API/APIError.cpp: Add error domains used by glib based ports.
3168         (API::Error::webKitNetworkErrorDomain):
3169         (API::Error::webKitPolicyErrorDomain):
3170         (API::Error::webKitPluginErrorDomain):
3171         (API::Error::webKitDownloadErrorDomain):
3172         (API::Error::webKitPrintErrorDomain):
3173         * Shared/API/APIError.h:
3174         * Shared/Cocoa/WebErrorsCocoa.mm: Copied from Source/WebKit2/WebProcess/WebCoreSupport/WebErrors.h.
3175         (WebKit::createNSError):
3176         (WebKit::cancelledError):
3177         (WebKit::fileDoesNotExistError):
3178         * Shared/WebErrors.cpp: Copied from Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebErrorsGtk.cpp.
3179         (WebKit::blockedError):
3180         (WebKit::blockedByContentBlockerError):
3181         (WebKit::cannotShowURLError):
3182         (WebKit::interruptedForPolicyChangeError):
3183         (WebKit::blockedByContentFilterError):
3184         (WebKit::cannotShowMIMETypeError):
3185         (WebKit::pluginWillHandleLoadError):
3186         (WebKit::internalError):
3187         * Shared/WebErrors.h: Renamed from Source/WebKit2/WebProcess/WebCoreSupport/WebErrors.h.
3188         * Shared/glib/WebErrorsGlib.cpp: Renamed from Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebErrorsGtk.cpp.
3189         (WebKit::cancelledError):
3190         (WebKit::fileDoesNotExistError):
3191         * Shared/gtk/WebErrorsGtk.cpp: Copied from Source/WebKit2/NetworkProcess/Downloads/gtk/DownloadSoupErrorsGtk.cpp.
3192         (WebKit::printError):
3193         (WebKit::printerNotFoundError):
3194         (WebKit::invalidPageRangeToPrint):
3195         * Shared/soup/WebErrorsSoup.cpp: Renamed from Source/WebKit2/NetworkProcess/Downloads/gtk/DownloadSoupErrorsGtk.cpp.
3196         (WebKit::downloadNetworkError):
3197         (WebKit::downloadCancelledByUserError):
3198         (WebKit::downloadDestinationError):
3199         * UIProcess/API/gtk/WebKitDownload.cpp:
3200         * UIProcess/API/gtk/WebKitError.cpp:
3201         (webkit_network_error_quark):
3202         (webkit_policy_error_quark):
3203         (webkit_plugin_error_quark):
3204         (webkit_download_error_quark):
3205         (webkit_print_error_quark):
3206         * UIProcess/API/gtk/WebKitPrivate.cpp:
3207         (toWebKitError):
3208         (toWebCoreError):
3209         * WebKit2.xcodeproj/project.pbxproj:
3210         * WebProcess/WebCoreSupport/mac/WebErrorsMac.mm: Removed.
3211         * WebProcess/WebPage/gtk/WebPrintOperationGtk.cpp:
3212
3213 2017-04-04  Youenn Fablet  <youenn@apple.com>
3214
3215         [Mac] Add back web audio support for getUserMedia MediaStreamTrack
3216         https://bugs.webkit.org/show_bug.cgi?id=170482
3217
3218         Reviewed by Eric Carlson.
3219
3220         * WebProcess/cocoa/UserMediaCaptureManager.cpp:
3221         (WebKit::UserMediaCaptureManager::Source::setStorage):
3222
3223 2017-04-04  Tim Horton  <timothy_horton@apple.com>
3224
3225         [Mac] -[WKWebView findMatchesForString:relativeToMatch:findOptions:maxResults:resultCollector:] invokes the resultCollector with didWrap = NO even when it wraps
3226         https://bugs.webkit.org/show_bug.cgi?id=165801
3227         <rdar://problem/29649535>
3228
3229         Reviewed by Wenson Hsieh.
3230
3231         Previously, when doing an incremental find that wrapped, we would 
3232         say that it did not, leading NSTextFinder to not provide its usual
3233         wrapping UI, and other clients of the NSTextFinderClient protocol to
3234         get confused by the lack of wrapping.
3235
3236         * UIProcess/WebPageProxy.cpp:
3237         (WebKit::WebPageProxy::didFindString):
3238         * UIProcess/WebPageProxy.h:
3239         * UIProcess/WebPageProxy.messages.in:
3240         * UIProcess/API/APIFindClient.h:
3241         (API::FindClient::didFindString):
3242         * UIProcess/API/C/WKPage.cpp:
3243         (WKPageSetPageFindClient):
3244         * UIProcess/Cocoa/FindClient.h:
3245         * UIProcess/Cocoa/FindClient.mm:
3246         (WebKit::FindClient::didFindString):
3247         * WebProcess/WebPage/FindController.cpp:
3248         (WebKit::FindController::updateFindUIAfterPageScroll):
3249         (WebKit::FindController::findString):
3250         * WebProcess/WebPage/FindController.h:
3251         Plumb DidWrap from FindController's call to findString back through
3252         the DidFindString message.
3253
3254         * UIProcess/mac/WKTextFinderClient.mm:
3255         (-[WKTextFinderClient didFindStringMatchesWithRects:didWrapAround:]):
3256         (-[WKTextFinderClient didFindStringMatchesWithRects:]): Deleted.
3257         Make use of the new DidWrap information to stop lying to NSTextFinder
3258         about whether a wrap actually occurred.
3259
3260 2017-04-03  Wenson Hsieh  <wenson_hsieh@apple.com>
3261
3262         Data interaction should register type identifiers in order of priority
3263         https://bugs.webkit.org/show_bug.cgi?id=170428
3264         <rdar://problem/30633296>
3265
3266         Reviewed by Tim Horton.
3267
3268         Serialize PasteboardWebContent.dataInAttributedStringFormat when sending over IPC. Refer to WebCore ChangeLog
3269         for more details.
3270
3271         * Shared/WebCoreArgumentCoders.cpp:
3272         (IPC::ArgumentCoder<PasteboardWebContent>::encode):
3273         (IPC::ArgumentCoder<PasteboardWebContent>::decode):
3274         * UIProcess/API/Cocoa/WKWebView.mm:
3275
3276 2017-04-03  Joseph Pecoraro  <pecoraro@apple.com>
3277
3278         Remove no longer needed forward declarations
3279         https://bugs.webkit.org/show_bug.cgi?id=170415
3280
3281         Reviewed by Dan Bernstein.
3282
3283         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
3284
3285 2017-04-03  Anders Carlsson  <andersca@apple.com>
3286
3287         Tweak ApplePaySession API
3288         https://bugs.webkit.org/show_bug.cgi?id=170409
3289         rdar://problem/31405459
3290
3291         Reviewed by Tim Horton.
3292
3293         Update for WebCore changes.
3294
3295         * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
3296         (WebKit::toNSError):
3297
3298 2017-04-03  Carlos Garcia Campos  <cgarcia@igalia.com>
3299
3300         [SOUP] URI Fragment is lost after redirect
3301         https://bugs.webkit.org/show_bug.cgi?id=170058
3302
3303         Reviewed by Michael Catanzaro.
3304
3305         In case of redirection check if the current request has a fragment identifier and apply it to the redirection
3306         only when it doesn't have a fragment identifier yet.
3307
3308         * NetworkProcess/soup/NetworkDataTaskSoup.cpp:
3309         (WebKit::NetworkDataTaskSoup::NetworkDataTaskSoup):
3310         (WebKit::NetworkDataTaskSoup::createRequest):
3311         (WebKit::NetworkDataTaskSoup::continueHTTPRedirection):
3312         * NetworkProcess/soup/NetworkDataTaskSoup.h:
3313
3314 2017-04-03  Antti Koivisto  <antti@apple.com>
3315
3316         Mutex may be freed too late in NetworkCache::Storage::traverse
3317         https://bugs.webkit.org/show_bug.cgi?id=170400
3318         <rdar://problem/30515865>
3319
3320         Reviewed by Carlos Garcia Campos and Andreas Kling.
3321
3322         Fix a race.
3323
3324         * NetworkProcess/cache/NetworkCacheStorage.cpp:
3325         (WebKit::NetworkCache::Storage::traverse):
3326
3327             Ensure the mutex is not accessed after we dispatch to the main thread.
3328             The main thread call deletes the owning TraverseOperation.
3329
3330 2017-04-01  Dan Bernstein  <mitz@apple.com>
3331
3332         [iOS] <input type=file> label should be specified using plural rules
3333         https://bugs.webkit.org/show_bug.cgi?id=170388
3334
3335         Reviewed by Alexey Proskuryakov.
3336
3337         * UIProcess/ios/forms/WKFileUploadPanel.mm:
3338         (-[WKFileUploadPanel _processMediaInfoDictionaries:atIndex:processedResults:processedImageCount:processedVideoCount:successBlock:failureBlock:]):
3339           Instead of calling -_displayStringForPhotos:videos:, use
3340           +[NSString localizedStringWithFormat:] with the new format string "%lu photo(s) and
3341           %lu video(s)" for which there are plural rules.
3342         (-[WKFileUploadPanel _displayStringForPhotos:videos:]): Deleted.
3343
3344 2017-04-01  Dan Bernstein  <mitz@apple.com>
3345
3346         [Xcode] In engineering builds, linker warns about libwebrtc.dylib’s install name being invalid
3347         https://bugs.webkit.org/show_bug.cgi?id=170385
3348
3349         Reviewed by Tim Horton.
3350
3351         * Configurations/WebKit.xcconfig: When WebKit is relocatable, tell the linker that it’s
3352           not going to be in the shared cache, even if its install name implies that it might be.
3353
3354 2017-03-31  Simon Fraser  <simon.fraser@apple.com>
3355
3356         Remove a logging statement left in by mistake.
3357
3358         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
3359         (WebKit::WebFrameLoaderClient::restoreViewState):
3360
3361 2017-03-31  Wenson Hsieh  <wenson_hsieh@apple.com>
3362
3363         Address post-review feedback after r214692
3364         https://bugs.webkit.org/show_bug.cgi?id=170328
3365
3366         Reviewed by Dan Bernstein.
3367
3368         Clearing the selection when UIKit calls into WKContentView to set its selected text range to nil is a rule
3369         that should be applied when using a text interaction assistant, not just when using character granularity
3370         for selecting text.
3371
3372         * UIProcess/ios/WKContentViewInteraction.mm:
3373         (-[WKContentView setSelectedTextRange:]):
3374
3375 2017-03-31  Wenson Hsieh  <wenson_hsieh@apple.com>
3376
3377         [WK2] Tapping away to dismiss the selection does not update the selected DOM range using character granularity
3378         https://bugs.webkit.org/show_bug.cgi?id=170328
3379         <rdar://problem/30904558>
3380
3381         Reviewed by Tim Horton.
3382
3383         When UIKit clears the selection while in text interaction mode, it notifies its document view (i.e., the
3384         WKContentView) by setting its selected text range to nil. When character granularity selection is enabled, use
3385         this as a cue to notify the web process that the selection is being cleared out.
3386
3387         -setSelectedTextRange: is a noop in the general case because the web process acts as the source of truth for what
3388         the selection currently consists of, and notifies the UI process and UIKit via WKTextPosition and WKTextRange.
3389         However, in the case of character granularity selections, tapping away to clear the selection is handled by
3390         UIKit's text gesture recognizer cluster, which then informs the document (via -setSelectedTextRange:) that the
3391         selection should be cleared out.
3392
3393         Adds a new Layout test: editing/selection/character-granularity-selected-range-after-dismissing-selection.html.
3394
3395         * UIProcess/ios/WKContentViewInteraction.mm:
3396         (-[WKContentView setSelectedTextRange:]):
3397
3398 2017-03-31  Wenson Hsieh  <wenson_hsieh@apple.com>
3399
3400         [WK2] Tapping editable text inside of a range selection no longer changes the selection to a caret
3401         https://bugs.webkit.org/show_bug.cgi?id=170327
3402         <rdar://problem/31363816>
3403
3404         Reviewed by Tim Horton.
3405
3406         Currently, we're forcing all text interaction gestures to duck in lieu of data interaction gestures
3407         when we should only be doing so for gestures that begin a loupe. This prevents other gestures, such as
3408         single taps, from changing the selection when they should be allowed to.
3409
3410         Hooks into new UIKit SPI to make this tweak.
3411         Introduces a new LayoutTest: editing/selection/caret-after-tap-in-editable-selection.html.
3412
3413         * UIProcess/ios/WKContentViewInteraction.mm:
3414         (-[WKContentView pointIsInAssistedNode:]):
3415         (-[WKContentView textInteractionGesture:shouldBeginAtPoint:]):
3416
3417 2017-03-31  Tim Horton  <timothy_horton@apple.com>
3418
3419         Mail can get stuck underneath FindController::findStringMatches after searching in a long message
3420         https://bugs.webkit.org/show_bug.cgi?id=170326
3421         <rdar://problem/30330395>
3422
3423         Reviewed by Simon Fraser.
3424
3425         * UIProcess/mac/WKTextFinderClient.mm:
3426         (-[WKTextFinderClient findMatchesForString:relativeToMatch:findOptions:maxResults:resultCollector:]):
3427         Cap the number of find matches at 1000, the same maximum that Safari uses.
3428
3429 2017-03-31  Brady Eidson  <beidson@apple.com>
3430
3431         Clean up the "StorageType" enum.
3432         https://bugs.webkit.org/show_bug.cgi?id=170349
3433
3434         Reviewed by Tim Horton.
3435
3436         * WebProcess/Storage/StorageAreaMap.cpp:
3437         (WebKit::StorageAreaMap::StorageAreaMap):
3438         (WebKit::StorageAreaMap::dispatchStorageEvent):
3439         (WebKit::StorageAreaMap::dispatchSessionStorageEvent):
3440         (WebKit::StorageAreaMap::dispatchLocalStorageEvent):
3441         
3442         * WebProcess/Storage/StorageNamespaceImpl.cpp:
3443         (WebKit::StorageNamespaceImpl::createSessionStorageNamespace):
3444         (WebKit::StorageNamespaceImpl::createLocalStorageNamespace):
3445         (WebKit::StorageNamespaceImpl::createTransientLocalStorageNamespace):
3446
3447 2017-03-31  Tim Horton  <timothy_horton@apple.com>
3448
3449         Remove bundle checks for attachmentElementEnabled
3450         https://bugs.webkit.org/show_bug.cgi?id=170329
3451         <rdar://problem/25135244>
3452
3453         Reviewed by Simon Fraser.
3454
3455         * UIProcess/API/Cocoa/WKWebView.mm:
3456         (-[WKWebView _initializeWithConfiguration:]):
3457         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
3458         (-[WKWebViewConfiguration init]):
3459         Remove bundle checks.
3460
3461 2017-03-29  Anders Carlsson  <andersca@apple.com>
3462
3463         Adopt PKCanMakePaymentsWithMerchantIdentifierAndDomainAndSourceApplication
3464         https://bugs.webkit.org/show_bug.cgi?id=170257
3465         rdar://problem/31289764
3466
3467         Reviewed by Beth Dakin.
3468
3469         * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
3470         (WebKit::WebPaymentCoordinatorProxy::platformCanMakePaymentsWithActiveCard):
3471
3472 2017-03-31  Csaba Osztrogonác  <ossy@webkit.org>
3473
3474         Mac cmake buildfix after r214403
3475         https://bugs.webkit.org/show_bug.cgi?id=170346
3476
3477         Unreviewed speculative buildfix.
3478
3479         * UIProcess/API/Cocoa/WKWebView.mm:
3480
3481 2017-03-31  Brady Eidson  <beidson@apple.com>
3482
3483         Remove erroneously committed changes from r214078
3484
3485         Unreviewed.
3486
3487         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
3488         (WebKit::WebProcessPool::platformInitializeNetworkProcess): Whoops!
3489
3490 2017-03-31  Carlos Garcia Campos  <cgarcia@igalia.com>
3491
3492         Modern media controls should never be enabled in non cocoa ports
3493         https://bugs.webkit.org/show_bug.cgi?id=170338
3494
3495         Reviewed by Michael Catanzaro.
3496
3497         It's currently enabled, because it uses the default value for all other runtime features, but modern media
3498         controls are not a cross-platform feature. I think this is why media/video-click-dblckick-standalone.html
3499         started to fail in GTK+ port after r214426. I can't reprouduce the failure locally, so I can't confirm it,
3500         though.
3501
3502         * Shared/WebPreferencesDefinitions.h:
3503
3504 2017-03-30  Zan Dobersek  <zdobersek@igalia.com>
3505
3506         Unreviewed GTK+ build fix. List WebCore before JavaScriptCore as the
3507         two WebKit2 dependency libraries to avoid WTF directiories being
3508         listed for inclusion before WebCore directories at compile-time.
3509
3510         * CMakeLists.txt:
3511
3512 2017-03-30  Megan Gardner  <megan_gardner@apple.com>
3513
3514         Allow for extended color in snapshots
3515         https://bugs.webkit.org/show_bug.cgi?id=170314
3516         <rdar://problem/28676092> WKImageCreateCGImage should support WideGamut in WebKit2 on macOS
3517
3518         Reviewed by Simon Fraser.
3519
3520         Piping options through snapshots to allow for wide gamut support.
3521
3522         * Shared/API/c/WKImage.h:
3523         * Shared/API/c/WKSharedAPICast.h:
3524         (WebKit::snapshotOptionsFromImageOptions):
3525         * Shared/ImageOptions.h:
3526         (WebKit::snapshotOptionsToImageOptions):
3527         * Shared/WebImage.cpp:
3528         (WebKit::WebImage::create):
3529
3530 2017-03-30  Sam Weinig  <sam@webkit.org>
3531
3532         Expose the WKView SPI, _prepareForMoveToWindow:withCompletionHandler as WKWebView SPI
3533         <rdar://problem/31350588>
3534         https://bugs.webkit.org/show_bug.cgi?id=170315
3535
3536         Reviewed by Simon Fraser.
3537
3538         * UIProcess/API/Cocoa/WKWebView.mm:
3539         (-[WKWebView _prepareForMoveToWindow:completionHandler:]):
3540         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
3541         Copy SPI to WKWebView. Remove 'with' prefix to match conventions.
3542
3543 2017-03-30  Wenson Hsieh  <wenson_hsieh@apple.com>
3544
3545         [WK2] Touches should not cancel when showing a custom action sheet while data interaction is active
3546         https://bugs.webkit.org/show_bug.cgi?id=170291
3547         <rdar://problem/31301388>
3548
3549         Reviewed by Tim Horton.
3550
3551         Currently, when presenting a custom popover, we will cancel all touches in the application. This makes data
3552         interaction when a custom popover is shown impossible -- to address this, we should only cancel touches when
3553         the view is not an active data interaction source.
3554
3555         New API test: DataInteractionTests.CustomActionSheetPopover.
3556
3557         * UIProcess/ios/WKContentViewInteraction.mm:
3558         (-[WKContentView actionSheetAssistant:showCustomSheetForElement:]):
3559
3560 2017-03-30  Youenn Fablet  <youenn@apple.com>
3561
3562         NetworkConnectionToWebProcess should stop web sockets when being destroyed
3563         https://bugs.webkit.org/show_bug.cgi?id=170286
3564
3565         Reviewed by Brady Eidson.
3566
3567         * NetworkProcess/NetworkSocketStream.cpp:
3568         (WebKit::NetworkSocketStream::~NetworkSocketStream): Stopping the socket handle if not done already.
3569         * NetworkProcess/NetworkSocketStream.h:
3570
3571 2017-03-29  Tim Horton  <timothy_horton@apple.com>
3572
3573         Remove unused PageClient::removeNavigationGestureSnapshot
3574         https://bugs.webkit.org/show_bug.cgi?id=170249
3575
3576         Reviewed by Beth Dakin.
3577
3578         * UIProcess/PageClient.h:
3579         * UIProcess/WebPageProxy.cpp:
3580         (WebKit::WebPageProxy::removeNavigationGestureSnapshot): Deleted.
3581         * UIProcess/WebPageProxy.h:
3582         * UIProcess/mac/PageClientImpl.h:
3583         * UIProcess/mac/PageClientImpl.mm:
3584         (WebKit::PageClientImpl::removeNavigationGestureSnapshot): Deleted.
3585
3586 2017-03-29  Antti Koivisto  <antti@apple.com>
3587
3588         Increment the last stable network cache version on Mac
3589         https://bugs.webkit.org/show_bug.cgi?id=170248
3590         <rdar://problem/31326040>
3591
3592         Reviewed by Chris Dumez.
3593
3594         Bump to the latest release.
3595
3596         * NetworkProcess/cache/NetworkCacheStorage.h:
3597
3598 2017-03-28  Timothy Horton  <timothy_horton@apple.com>
3599
3600         Stop overriding scroll view inset defaults
3601         https://bugs.webkit.org/show_bug.cgi?id=170221
3602         <rdar://problem/31260325>
3603
3604         Reviewed by Simon Fraser.
3605
3606         * Platform/spi/ios/UIKitSPI.h:
3607         * UIProcess/API/Cocoa/WKWebView.mm:
3608         (-[WKWebView _initializeWithConfiguration:]):
3609         The default behavior is sufficient for us.
3610
3611 2017-03-28  Timothy Horton  <timothy_horton@apple.com>
3612
3613         Safari crashes when attempting to close tab that is displaying PDF
3614         https://bugs.webkit.org/show_bug.cgi?id=170201
3615         <rdar://problem/31242019>
3616
3617         Reviewed by Wenson Hsieh.
3618
3619         * UIProcess/API/Cocoa/WKWebView.mm:
3620         (-[WKWebView _doAfterNextStablePresentationUpdate:]):
3621         Adopt BlockPtr to fix a leak.
3622
3623         (-[WKWebView _firePresentationUpdateForPendingStableStatePresentationCallbacks]):
3624         dispatch_async in the doAfterNextPresentationUpdate callback; since this
3625         recursively calls itself, in cases where doAfterNextPresentationUpdate
3626         returns synchronously (e.g. if the Web Process is missing), we would
3627         recurse infinitely.
3628
3629 2017-03-27  Youenn Fablet  <youenn@apple.com>
3630
3631         Remove WebPage::m_shouldDoICECandidateFiltering
3632         https://bugs.webkit.org/show_bug.cgi?id=170150
3633
3634         Reviewed by Sam Weinig.
3635
3636         It is redundant with RTCController::m_shouldFilterICECandidates.
3637         Manually tested on webrtc test samples.
3638         This code path is currently untested by rwt as we hook it to getUserMedia which is mocked in rwt.
3639         Additional testing will be added as a follow-up patch.
3640
3641         * WebProcess/WebPage/WebPage.cpp:
3642         (WebKit::WebPage::disableICECandidateFiltering):
3643         (WebKit::WebPage::enableICECandidateFiltering):
3644         * WebProcess/WebPage/WebPage.h:
3645
3646 2017-03-27  Wenson Hsieh  <wenson_hsieh@apple.com>
3647
3648         [WK2] UIKit assertion when rotating device after dismissing popover
3649         https://bugs.webkit.org/show_bug.cgi?id=170159
3650         <rdar://problem/31283829>
3651
3652         Reviewed by Tim Horton.
3653
3654         Ensure that when we are finished presenting a WKActionSheet, we unregister with the shared notifications center.
3655
3656         * UIProcess/ios/WKActionSheet.mm:
3657         (-[WKActionSheet dealloc]):
3658         (-[WKActionSheet _cleanup]):
3659         (-[WKActionSheet doneWithSheet:]):
3660
3661 2017-03-27  Andy Estes  <aestes@apple.com>
3662
3663         [iOS] Suppress page count recalc when setting a snapshot paper rect
3664         https://bugs.webkit.org/show_bug.cgi?id=170156
3665         <rdar://problem/30787872>
3666
3667         Reviewed by Tim Horton.
3668
3669         When _WKWebViewPrintFormatter computes a page count for snapshotting, it updates the paper
3670         rect, which triggers UIKit to ask for the page count again while we're in the middle of
3671         printing, putting us in a bad state.
3672
3673         Suppress page count recalc while setting the new paper rect, since we know this will not
3674         cause it to change.
3675
3676         * UIProcess/_WKWebViewPrintFormatter.mm:
3677         (-[_WKWebViewPrintFormatter _setSnapshotPaperRect:]): Temporarily set
3678         _suppressPageCountRecalc to YES before updating the paper rect.
3679         (-[_WKWebViewPrintFormatter _setNeedsRecalc]): Only call [super _setNeedsRecalc] if
3680         _suppressPageCountRecalc is NO.
3681         * UIProcess/_WKWebViewPrintFormatterInternal.h: Declared -_setNeedsRecalc.
3682
3683 2017-03-26  Wenson Hsieh  <wenson_hsieh@apple.com>
3684
3685         [WK2] Callout Bar should be dismissed during data interaction
3686         https://bugs.webkit.org/show_bug.cgi?id=170109
3687         <rdar://problem/31171570>
3688
3689         Reviewed by Tim Horton.
3690
3691         Minor tweak to get the callout bar to duck during data interaction. Import a new UIKit SPI header in WebKit2.
3692
3693         * Platform/spi/ios/UIKitSPI.h:
3694
3695 2017-03-27  Keith Rollin  <krollin@apple.com>
3696
3697         Update NetworkResourceLoader logging statement
3698         https://bugs.webkit.org/show_bug.cgi?id=170126
3699
3700         Reviewed by Alex Christensen.
3701
3702         NetworkResourceLoader contains a logging statement that prints, in
3703         part: "start: Retrieving resource from cache". This is misleading,
3704         since it's not necessarily the case that the resource will be loaded
3705         from the cache. What is actually happening at the point where that is
3706         logged is that the cache is being checked for the resource. It still
3707         remains to be seen if the resource will be found in it. To address
3708         this, change the logging to say "start: Checking cache for resource".
3709
3710         * NetworkProcess/NetworkResourceLoader.cpp:
3711         (WebKit::NetworkResourceLoader::start):
3712
3713 2017-03-27  Joseph Pecoraro  <pecoraro@apple.com>
3714
3715         Web Inspector: Saving files should not suggest the top level directory
3716         https://bugs.webkit.org/show_bug.cgi?id=170085
3717         <rdar://problem/30197794>
3718
3719         Reviewed by Matt Baker.
3720
3721         * UIProcess/mac/RemoteWebInspectorProxyMac.mm:
3722         (WebKit::RemoteWebInspectorProxy::platformSave):
3723         * UIProcess/mac/WebInspectorProxyMac.mm:
3724         (WebKit::WebInspectorProxy::platformSave):
3725         Don't set panel.directoryURL unless we have a good suggestion.
3726
3727 2017-03-27  Yongjun Zhang  <yongjun_zhang@apple.com>
3728
3729         Add delegate method to let an WebKit client provide a custom image preview controller.
3730         https://bugs.webkit.org/show_bug.cgi?id=170076
3731         rdar://problem/31153051
3732
3733         Add a new delegate method (_webView:previewViewControllerForImage:alternateURL:defaultActions:elementInfo:) to
3734         WKUIDelegatePrivate, an client can use this method to provide a custom image preview view controller if the image
3735         has alternated URL or custom image info.
3736
3737         Reviewed by Beth Dakin.
3738
3739         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h: Add delegate method _webView:previewViewControllerForImage:alternateURL:defaultActions:elementInfo:.
3740         * UIProcess/ios/WKContentViewInteraction.mm:
3741         (-[WKContentView _presentedViewControllerForPreviewItemController:]): If the image has alternated URL or custom info, try to use the client-provided
3742             preview view controller. Otherwise, use the default WKImagePreviewViewController.
3743
3744 2017-03-27  Anders Carlsson  <andersca@apple.com>
3745
3746         Fix uses of deprecated API
3747         https://bugs.webkit.org/show_bug.cgi?id=170138
3748         rdar://problem/28882449
3749
3750         Reviewed by Tim Horton.
3751
3752         * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
3753         (WebKit::toPKContactFields):
3754         (WebKit::toPKAddressField):
3755         (WebKit::toPKPaymentRequest):
3756         Don't use deprecated APIs.
3757
3758         (WebKit::toNSError):
3759         Don't try to insert nil in a dictionary.
3760
3761 2017-03-27  Alex Christensen  <achristensen@webkit.org>
3762
3763         Make WebSockets work in network process
3764         https://bugs.webkit.org/show_bug.cgi?id=169930
3765
3766         Reviewed by Youenn Fablet.
3767
3768         This adds WebSocketStream, which is a SocketStreamHandle that sends asynchronous 
3769         messages to a NetworkSocketStream in the NetworkProcess.  WebKit1 uses a SocketStreamHandleImpl
3770         still, but WebKit2 now has a SocketStreamHandleImpl in the NetworkProcess owned by the 
3771         NetworkSocketStream, which is a SocketStreamHandleClient that sends asynchronous messages back
3772         to the WebProcess.  WebSocketStream's implementation of SocketStreamHandle::platformSend is special
3773         because it stores the completion handler in a map and asynchronously reports to the caller whether
3774         it succeeded or not.  If the network processes crashes before the completion handlers are called,
3775         then they are called indicating failure and an error is reported, but that never happens, right?
3776
3777         * CMakeLists.txt:
3778         * DerivedSources.make:
3779         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
3780         (WebKit::NetworkConnectionToWebProcess::didReceiveMessage):
3781         (WebKit::NetworkConnectionToWebProcess::createSocketStream):
3782         (WebKit::NetworkConnectionToWebProcess::destroySocketStream):
3783         * NetworkProcess/NetworkConnectionToWebProcess.h:
3784         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
3785         * NetworkProcess/NetworkProcess.cpp:
3786         (WebKit::NetworkProcess::setAllowsAnySSLCertificateForWebSocket):
3787         * NetworkProcess/NetworkProcess.h:
3788         * NetworkProcess/NetworkProcess.messages.in:
3789         * NetworkProcess/NetworkSocketStream.cpp: Added.
3790         (WebKit::NetworkSocketStream::create):
3791         (WebKit::NetworkSocketStream::NetworkSocketStream):
3792         (WebKit::NetworkSocketStream::sendData):
3793         (WebKit::NetworkSocketStream::close):
3794         (WebKit::NetworkSocketStream::didOpenSocketStream):
3795         (WebKit::NetworkSocketStream::didCloseSocketStream):
3796         (WebKit::NetworkSocketStream::didReceiveSocketStreamData):
3797         (WebKit::NetworkSocketStream::didFailToReceiveSocketStreamData):
3798         (WebKit::NetworkSocketStream::didUpdateBufferedAmount):
3799         (WebKit::NetworkSocketStream::didFailSocketStream):
3800         (WebKit::NetworkSocketStream::messageSenderConnection):
3801         (WebKit::NetworkSocketStream::messageSenderDestinationID):
3802         * NetworkProcess/NetworkSocketStream.h: Added.
3803         * NetworkProcess/NetworkSocketStream.messages.in: Added.
3804         * UIProcess/API/C/WKContext.cpp:
3805         (WKContextSetAllowsAnySSLCertificateForWebSocketTesting):
3806         (WKContextTerminateNetworkProcess):
3807         * UIProcess/API/C/WKContextPrivate.h:
3808         * UIProcess/WebProcessPool.cpp:
3809         (WebKit::WebProcessPool::sendSyncToNetworkingProcess):
3810         (WebKit::WebProcessPool::setAllowsAnySSLCertificateForWebSocket):
3811         (WebKit::WebProcessPool::terminateNetworkProcess):
3812         * UIProcess/WebProcessPool.h:
3813         * WebKit2.xcodeproj/project.pbxproj:
3814         * WebProcess/Network/NetworkProcessConnection.cpp:
3815         (WebKit::NetworkProcessConnection::didReceiveMessage):
3816         * WebProcess/Network/WebSocketProvider.cpp:
3817         (WebKit::WebSocketProvider::createSocketStreamHandle):
3818         * WebProcess/Network/WebSocketStream.cpp: Added.
3819         (WebKit::globalWebSocketStreamMap):
3820         (WebKit::WebSocketStream::streamWithIdentifier):
3821         (WebKit::WebSocketStream::networkProcessCrashed):
3822         (WebKit::WebSocketStream::create):
3823         (WebKit::WebSocketStream::WebSocketStream):
3824         (WebKit::WebSocketStream::~WebSocketStream):
3825         (WebKit::WebSocketStream::messageSenderConnection):
3826         (WebKit::WebSocketStream::messageSenderDestinationID):
3827         (WebKit::WebSocketStream::platformSend):
3828         (WebKit::WebSocketStream::didSendData):
3829         (WebKit::WebSocketStream::platformClose):
3830         (WebKit::WebSocketStream::bufferedAmount):
3831         (WebKit::WebSocketStream::didOpenSocketStream):
3832         (WebKit::WebSocketStream::didCloseSocketStream):
3833         (WebKit::WebSocketStream::didReceiveSocketStreamData):
3834         (WebKit::WebSocketStream::didFailToReceiveSocketStreamData):
3835         (WebKit::WebSocketStream::didUpdateBufferedAmount):
3836         (WebKit::WebSocketStream::didFailSocketStream):
3837         * WebProcess/Network/WebSocketStream.h: Added.
3838         * WebProcess/Network/WebSocketStream.messages.in: Added.
3839         * WebProcess/WebProcess.cpp:
3840         (WebKit::WebProcess::networkProcessConnectionClosed):
3841
3842 2017-03-27  Adrian Perez de Castro  <aperez@igalia.com>
3843
3844         [GTK] NetscapePluginX11::m_windowID is unused/unneeded
3845         https://bugs.webkit.org/show_bug.cgi?id=170115
3846
3847         Reviewed by Michael Catanzaro.
3848
3849         * WebProcess/Plugins/Netscape/x11/NetscapePluginX11.cpp:
3850         (WebKit::NetscapePluginX11::NetscapePluginX11):
3851         Remove the unneeded NetscapePluginX11::m_windowID member.
3852         * WebProcess/Plugins/Netscape/x11/NetscapePluginX11.h:
3853         Remove the unneeded NetscapePluginX11::m_windowID member.
3854
3855 2017-03-25  Andy Estes  <aestes@apple.com>
3856
3857         [iOS] Use snapshotting instead of printing to draw single-page PDFs
3858         https://bugs.webkit.org/show_bug.cgi?id=170103
3859         <rdar://problem/30542960>
3860
3861         Reviewed by Tim Horton.
3862
3863         * WebProcess/WebPage/WebPage.cpp:
3864         (WebKit::paintSnapshotAtSize): Moved the painting logic from WebPage::snapshotAtSize() to here.
3865         (WebKit::WebPage::snapshotAtSize): Changed to call paintSnapshotAtSize() with the
3866         WebImage's graphics context.
3867         (WebKit::WebPage::pdfSnapshotAtSize): Created a CGPDFGraphicsContext, passed it to
3868         paintSnapshotAtSize(), and returned the context's data.
3869         * WebProcess/WebPage/WebPage.h: Made snapshotAtSize() and snapshotNode() private, changed
3870         their return values from PassRefPtr to RefPtr, and declared pdfSnapshotAtSize().
3871         * WebProcess/WebPage/ios/WebPageIOS.mm:
3872         (WebKit::WebPage::computePagesForPrintingAndDrawToPDF): If snapshotting the first page,
3873         returned a page count of 1 and created a PDF using pdfSnapshotAtSize().
3874
3875 2017-03-25  John Wilander  <wilander@apple.com>
3876
3877         Re-enable the web process' keychain access to fix client certificate authentication
3878         https://bugs.webkit.org/show_bug.cgi?id=170074
3879         <rdar://problem/31095987>
3880
3881         Reviewed by Brent Fulgham.
3882
3883         This is a follow-up patch to
3884         https://trac.webkit.org/changeset/214389/webkit
3885         since according to Alexey Proskuryakov, resource
3886         loading has always required identical sandbox
3887         rules in WebContent and Networking processes.
3888
3889         * WebProcess/com.apple.WebProcess.sb.in:
3890             Reverted remaining change from
3891             https://trac.webkit.org/changeset/208702/webkit and
3892             https://trac.webkit.org/changeset/208707/webkit.
3893
3894 2017-03-24  Wenson Hsieh  <wenson_hsieh@apple.com>
3895
3896         [WK2] Add a UI delegate SPI hook to enable or disable navigation on drop
3897         https://bugs.webkit.org/show_bug.cgi?id=169168
3898         <rdar://problem/30688374>
3899
3900         Reviewed by Tim Horton.
3901
3902         Support customizing the set of allowed actions on drop in WebKit2 by introducing a new method to WKUIDelegatePrivate
3903         that returns a WKDragDestinationAction given platform dragging info. These flags are then used to initialize the
3904         DragData sent over to the web process, where they update DragController's view of the allowed destination actions.
3905
3906         Moving forward, the default action mask for WKWebViews will include everything except WKDragDestinationActionLoad,
3907         though for applciations linked on or before 10.12, we will still default to WKDragDestinationActionAny to mitigate
3908         any compatibility risk.
3909
3910         * Shared/API/Cocoa/WKDragDestinationAction.h:
3911
3912         Introduce WK2 client-facing versions of WebCore::DragDestinationAction flags.
3913
3914         * Shared/WebCoreArgumentCoders.cpp:
3915         (IPC::ArgumentCoder<DragData>::encode):
3916         (IPC::ArgumentCoder<DragData>::decode):
3917
3918         Serialize DragData's destination actions when sending DragData over IPC.
3919
3920         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
3921         * UIProcess/API/Cocoa/WKWebView.mm:
3922         (-[WKWebView _web_dragDestinationActionForDraggingInfo:]):
3923
3924         For WKWebView, allow all drag destination actions except for loading (i.e. drop-to-navigate).
3925
3926         * UIProcess/API/mac/WKView.mm:
3927         (-[WKView _web_dragDestinationActionForDraggingInfo:]):
3928
3929         For WKView, allow all types of drag destination actions.
3930
3931         * UIProcess/Cocoa/VersionChecks.h:
3932         * UIProcess/Cocoa/WebViewImpl.h:
3933         * UIProcess/Cocoa/WebViewImpl.mm:
3934         (WebKit::WebViewImpl::draggingEntered):
3935         (WebKit::WebViewImpl::draggingUpdated):
3936         * WebKit2.xcodeproj/project.pbxproj:
3937         * WebProcess/WebCoreSupport/WebDragClient.cpp:
3938         (WebKit::WebDragClient::actionMaskForDrag):
3939         * WebProcess/WebCoreSupport/WebDragClient.h:
3940
3941 2017-03-24  Simon Fraser  <simon.fraser@apple.com>
3942
3943         [iOS WK2] Move from a pre-commit handler to dispatch_async for visible content rect updates
3944         https://bugs.webkit.org/show_bug.cgi?id=170091
3945         rdar://problem/30682584
3946
3947         Reviewed by Tim Horton.
3948         
3949         [CATransaction addCommitHandler:forPhase:] is sometimes not called when running inside another
3950         commit callback (rdar://problem/31253952), and we don't yet have a reliable way to detect this.
3951
3952         So dispatch_async() to postpone the call to [CATransaction addCommitHandler:forPhase:] to a known-
3953         good time.
3954
3955         * UIProcess/API/Cocoa/WKWebView.mm:
3956         (-[WKWebView _scheduleVisibleContentRectUpdateAfterScrollInView:]):
3957
3958 2017-03-24  John Wilander  <wilander@apple.com>
3959
3960         Re-enable the network process' keychain access to fix client certificate authentication
3961         https://bugs.webkit.org/show_bug.cgi?id=170074
3962         <rdar://problem/31095987>
3963
3964         Reviewed by Brent Fulgham.
3965
3966         * NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in:
3967             Reverted remaining change from
3968             https://trac.webkit.org/changeset/208702/webkit and
3969             https://trac.webkit.org/changeset/208707/webkit.
3970
3971 2017-03-24  Eric Carlson  <eric.carlson@apple.com>
3972
3973         [MediaStream] "ideal" constraints passed to getUserMedia should affect fitness score
3974         https://bugs.webkit.org/show_bug.cgi?id=170056
3975
3976         Reviewed by Youenn Fablet.
3977
3978         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
3979         (WebKit::UserMediaPermissionRequestManagerProxy::requestUserMediaPermissionForFrame): When
3980         short-circuiting the user prompt because the page is already authorized, return the first
3981         audio and/or video device because so the page gets the one with the best fitness distance.
3982
3983 2017-03-24  Simon Fraser  <simon.fraser@apple.com>
3984
3985         Make UI-side compositing on macOS a bit more usable
3986         https://bugs.webkit.org/show_bug.cgi?id=170073
3987
3988         Reviewed by Tim Horton.
3989         
3990         Mach port as layer contents doesn't work on macOS, so don't use it there.
3991
3992         Also remove two assertions that hit with UI-side compositing in MiniBrowser.
3993
3994         * UIProcess/DrawingAreaProxy.cpp:
3995         (WebKit::DrawingAreaProxy::createFence):
3996         * UIProcess/mac/PageClientImpl.mm:
3997         (WebKit::PageClientImpl::requestScroll):
3998         * UIProcess/mac/RemoteLayerTreeHost.mm:
3999         (WebKit::RemoteLayerTreeHost::updateLayerTree):
4000
4001 2017-03-24  Alex Christensen  <achristensen@webkit.org>
4002
4003         Fix assertions after r214358.
4004         https://bugs.webkit.org/show_bug.cgi?id=169167
4005
4006         * UIProcess/API/APIContentExtensionStore.cpp:
4007         (API::ContentExtensionStore::compileContentExtension):
4008         AtomicString::init must be called for the first time from the main thread.
4009         We were calling it for the first time from a non-main thread sometimes.
4010         Call it from the main thread before initiating compiling on another thread.
4011
4012 == Rolled over to ChangeLog-2017-03-23 ==