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