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