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