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