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