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