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