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