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