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