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