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