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