Ensure that style is updated when the effective appearance changes
[WebKit-https.git] / Source / WebKit / ChangeLog
1 2018-03-16  Megan Gardner  <megan_gardner@apple.com>
2
3         Ensure that style is updated when the effective appearance changes
4         https://bugs.webkit.org/show_bug.cgi?id=183690
5         <rdar://problem/38385900>
6
7         Reviewed by Tim Horton and Wenson Hsieh.
8
9         Respond to and respect the effective appearance changing.
10
11         * UIProcess/API/Cocoa/WKWebView.mm:
12         (-[WKWebView effectiveAppearanceDidChange]):
13         * WebProcess/WebPage/WebPage.cpp:
14         (WebKit::WebPage::setDefaultAppearance):
15
16 2018-03-16  Chris Dumez  <cdumez@apple.com>
17
18         URLSchemeHandler.Basic API test fails with async policy delegates
19         https://bugs.webkit.org/show_bug.cgi?id=183678
20
21         Reviewed by Alex Christensen.
22
23         The issue is that the client calls _didPerformRedirection / didReceiveResponse / didReceiveData / didFinish
24         on the URLScheme task one after the one, synchronously. However, redirects and responses can be processed
25         asynchronously. To address the issue, we now queue operations requested by the client if we're waiting
26         for an async policy delegate.
27
28         * WebProcess/WebPage/WebURLSchemeTaskProxy.cpp:
29         (WebKit::WebURLSchemeTaskProxy::didPerformRedirection):
30         (WebKit::WebURLSchemeTaskProxy::didReceiveResponse):
31         (WebKit::WebURLSchemeTaskProxy::didReceiveData):
32         (WebKit::WebURLSchemeTaskProxy::didComplete):
33         (WebKit::WebURLSchemeTaskProxy::processNextPendingTask):
34         * WebProcess/WebPage/WebURLSchemeTaskProxy.h:
35         (WebKit::WebURLSchemeTaskProxy::queueTask):
36
37 2018-03-16  Claudio Saavedra  <csaavedra@igalia.com>
38
39         Suppress GCC warnings by using #include instead of #import
40
41         Unreviewed.
42         * UIProcess/SystemPreviewController.cpp:
43
44 2018-03-15  Keith Rollin  <krollin@apple.com>
45
46         Telemetry for stalled webpage loads
47         https://bugs.webkit.org/show_bug.cgi?id=183221
48         <rdar://problem/36549013>
49
50         Reviewed by Chris Dumez.
51
52         Add telemetry for page loads, tracking the pages that succeed, fail,
53         or are canceled. This information will be used to track the overall
54         health of our page loading as time goes on.
55
56         * UIProcess/WebPageProxy.cpp:
57         (WebKit::WebPageProxy::close):
58         (WebKit::WebPageProxy::didStartProvisionalLoadForFrame):
59         (WebKit::WebPageProxy::didFailProvisionalLoadForFrame):
60         (WebKit::WebPageProxy::didFinishLoadForFrame):
61         (WebKit::WebPageProxy::didFailLoadForFrame):
62         (WebKit::WebPageProxy::reportPageLoadResult):
63         * UIProcess/WebPageProxy.h:
64         (WebKit::WebPageProxy::reportPageLoadResult):
65
66 2018-03-15  Wenson Hsieh  <wenson_hsieh@apple.com>
67
68         [iOS WK2] Hit-testing fails when specifying a large top content inset
69         https://bugs.webkit.org/show_bug.cgi?id=183648
70         <rdar://problem/38421894>
71
72         Reviewed by Tim Horton.
73
74         Currently, in the process of computing unobscured content rect in the UI process on iOS, we subtract away parts
75         of the view that are obscured by insets (e.g. MobileSafari's chrome). The helper method -[WKWebView
76         _computeContentInset] is intended to compute these obscuring insets around the view, but it takes scroll view
77         insets into account. This means that if WKWebView's inner scroll view has content insets, we'll end up shrinking
78         the unobscured content rect as if the insetted region obscures the viewport; this causes visible content on the
79         page to be uninteractible, since WKWebView erroneously thinks it's obscured.
80
81         To address this, we rename _computeContentInset to _computeObscuredInset, and make it _not_ affected by the
82         scroll view's content insets. From code inspection and testing, all but one of the former call sites of
83         _computeContentInset really need the obscured inset instead (see below). The one exception, -[WKWebView
84         _adjustedContentOffset:], takes a scroll position from the page and maps it to a content offset in the inner
85         UIScrollView (see below for more details).
86
87         Tests:  ScrollViewInsetTests.InnerHeightWithLargeTopContentInset
88                 ScrollViewInsetTests.InnerHeightWithLargeBottomContentInset
89                 ScrollViewInsetTests.RestoreInitialContentOffsetAfterCrash
90                 ScrollViewInsetTests.RestoreInitialContentOffsetAfterNavigation
91
92         * UIProcess/API/Cocoa/WKWebView.mm:
93         (-[WKWebView _setHasCustomContentView:loadedMIMEType:]):
94         (-[WKWebView _initialContentOffsetForScrollView]):
95
96         See -_contentOffsetAdjustedForObscuredInset: below.
97
98         (-[WKWebView _contentOffsetAdjustedForObscuredInset:]):
99
100         Formerly -_adjustedContentOffset:. -_contentOffsetAdjustedForObscuredInset: no longer takes scroll view content
101         inset into account, and only cares about insets that obscure the view. This means that the scroll position
102         (0, 0) in the document now maps to the content offset in the inner UIScrollView, such that the top of the page
103         is aligned with the top of the viewport.
104
105         However, many call sites of -_adjustedContentOffset: were intended to compute the initial, top-left-most content
106         offset in the scroll view to scroll to when resetting the web view (i.e., they pass in CGPointZero for the
107         scroll position). An example of this is the scroll position to jump to after web content process termination, or
108         the scroll position after main frame navigation. In these cases, we actually want to jump to the top of the
109         scroll view, so we do want to use the version of the computed content insets that accounts for scroll view
110         insets.
111
112         Since these cases are limited to finding the top-left-most scroll position, we pull this out into a separate
113         helper method (-_initialContentOffsetForScrollView) and replace calls to
114         `-[self _adjustedContentOffset:CGPointZero]` with this instead.
115
116         (-[WKWebView _computedObscuredInset]):
117
118         A version of -_computeContentInset that doesn't care about scroll view insets. Used whereever we need to account
119         for obscured insets rather than the combination of content insets and unobscured insets (e.g.
120         -_initialContentOffsetForScrollView).
121
122         (-[WKWebView _processDidExit]):
123         (-[WKWebView _didCommitLayerTree:]):
124         (-[WKWebView _dynamicViewportUpdateChangedTargetToScale:position:nextValidLayerTreeTransactionID:]):
125         (-[WKWebView _scrollToContentScrollPosition:scrollOrigin:]):
126         (-[WKWebView scrollViewWillEndDragging:withVelocity:targetContentOffset:]):
127         (-[WKWebView _updateVisibleContentRects]):
128         (-[WKWebView _navigationGestureDidBegin]):
129
130         In all these places where we inset the view bounds to compute the unobscured region of the viewport, it doesn't
131         make sense to additionally inset by the scroll view's content insets, since (1) the scroll view's content insets
132         don't obscure the viewport, and (2) it's perfectly valid for the inner scroll view to have arbitrarily large
133         content insets.
134
135         (-[WKWebView _adjustedContentOffset:]): Deleted.
136
137         Renamed to -_contentOffsetAdjustedForObscuredInset:.
138
139         * UIProcess/API/Cocoa/WKWebViewInternal.h:
140         * UIProcess/ios/WKPDFView.mm:
141         (-[WKPDFView _offsetForPageNumberIndicator]):
142
143         Similar to -_scrollToFragment: (see below).
144
145         (-[WKPDFView _scrollToFragment:]):
146
147         This helper figures out which content offset to scroll to, given the y-origin of a page in a PDF document. If
148         insets are added to the scroll view, we end up scrolling to the wrong content offset since we'll add the height
149         of the top content inset (imagine that the top content inset is enormous — then we'll scroll an amount equal to
150         the top content inset _past_ the point where the y-origin of the page is at the top of the viewport).
151
152 2018-03-15  Brent Fulgham  <bfulgham@apple.com>
153
154         [macOS] Correct sandbox violations during Flash playback under ToT WebKit
155         https://bugs.webkit.org/show_bug.cgi?id=183672
156         <rdar://problem/38510839>
157
158         Reviewed by Eric Carlson.
159
160         * PluginProcess/mac/com.apple.WebKit.plugin-common.sb.in:
161         * WebProcess/com.apple.WebProcess.sb.in:
162
163 2018-03-15  Brent Fulgham  <bfulgham@apple.com>
164
165         REGRESSION(r229484): Plugins often require CGS Connections to draw
166         https://bugs.webkit.org/show_bug.cgi?id=183663
167         <rdar://problem/38439218>
168
169         Reviewed by Per Arne Vollan.
170
171         Flash requires an active CGSConnection to work properly. Since we don't want the WebContent
172         process to have on, create a new plugin process-specific layer host creation method that
173         gives this access.
174
175         * Platform/mac/LayerHostingContext.h:
176         * Platform/mac/LayerHostingContext.mm:
177         (WebKit::LayerHostingContext::createForExternalPluginHostingProcess): Added.
178         * PluginProcess/mac/PluginControllerProxyMac.mm:
179         (WebKit::PluginControllerProxy::updateLayerHostingContext): Use the new creation
180         method.
181
182 2018-03-15  Zan Dobersek  <zdobersek@igalia.com>
183
184         [TexMap] Remove TextureMapperLayer::texture()
185         https://bugs.webkit.org/show_bug.cgi?id=183635
186
187         Reviewed by Michael Catanzaro.
188
189         Remove the CoordinatedBackingStore::texture() override since the virtual
190         method is also being removed.
191
192         * Shared/CoordinatedGraphics/CoordinatedBackingStore.cpp:
193         (WebKit::CoordinatedBackingStore::texture const): Deleted.
194         * Shared/CoordinatedGraphics/CoordinatedBackingStore.h:
195
196 2018-03-14  John Wilander  <wilander@apple.com>
197
198         Resource Load Statistics: Add clearing of storage access to WebResourceLoadStatisticsStore::clearInMemory()
199         https://bugs.webkit.org/show_bug.cgi?id=183641
200         <rdar://problem/38469497>
201
202         Reviewed by Brent Fulgham and Chris Dumez.
203
204         This change is to stabilize existing layout tests by removing
205         all storage access entries on a call to 
206         WebResourceLoadStatisticsStore::clearInMemory().
207         See Ryan Haddad's comment in https://bugs.webkit.org/show_bug.cgi?id=183620.
208
209         Almost all of the code changes are piping to get this
210         call from the WebResourceLoadStatisticsStore to
211         WebCore::NetworkStorageSession where entries reside.
212
213         * NetworkProcess/NetworkProcess.cpp:
214         (WebKit::NetworkProcess::removeAllStorageAccess):
215         * NetworkProcess/NetworkProcess.h:
216         * NetworkProcess/NetworkProcess.messages.in:
217         * UIProcess/Network/NetworkProcessProxy.cpp:
218         (WebKit::NetworkProcessProxy::removeAllStorageAccess):
219         * UIProcess/Network/NetworkProcessProxy.h:
220         * UIProcess/WebResourceLoadStatisticsStore.cpp:
221         (WebKit::WebResourceLoadStatisticsStore::WebResourceLoadStatisticsStore):
222         (WebKit::WebResourceLoadStatisticsStore::removeAllStorageAccess):
223         (WebKit::WebResourceLoadStatisticsStore::clearInMemory):
224             Now also clears all storage access entries in the network process.
225         * UIProcess/WebResourceLoadStatisticsStore.h:
226         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
227         (WebKit::WebsiteDataStore::removeAllStorageAccessHandler):
228         (WebKit::WebsiteDataStore::enableResourceLoadStatisticsAndSetTestingCallback):
229         * UIProcess/WebsiteData/WebsiteDataStore.h:
230
231 2018-03-14  Ryan Haddad  <ryanhaddad@apple.com>
232
233         Unreviewed, rolling out r229613.
234
235         Caused API test failures
236
237         Reverted changeset:
238
239         "Make policy decisions asynchronous"
240         https://bugs.webkit.org/show_bug.cgi?id=180568
241         https://trac.webkit.org/changeset/229613
242
243 2018-03-14  Chris Dumez  <cdumez@apple.com>
244
245         Reduce use of SWServerToContextConnection::globalServerToContextConnection()
246         https://bugs.webkit.org/show_bug.cgi?id=183626
247
248         Reviewed by Youenn Fablet.
249
250         Reduce use of SWServerToContextConnection::globalServerToContextConnection() as we are moving
251         towards having multiple context connections.
252
253         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
254         (WebKit::WebSWServerConnection::startFetch):
255         (WebKit::WebSWServerConnection::postMessageToServiceWorker):
256
257 2018-03-14  Chris Dumez  <cdumez@apple.com>
258
259         Make policy decisions asynchronous
260         https://bugs.webkit.org/show_bug.cgi?id=180568
261         <rdar://problem/37131297>
262
263         Reviewed by Alex Christensen.
264
265         Get rid of synchronous IPC and synchronous code paths for policy delegates.
266         Policy decisions are now all made asynchronously and rely on asynchronous
267         IPC.
268
269         This code change is based on work by Alex Christensen.
270
271         * UIProcess/WebPageProxy.cpp:
272         (WebKit::WebPageProxy::receivedPolicyDecision):
273         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
274         (WebKit::WebPageProxy::decidePolicyForResponse):
275         * UIProcess/WebPageProxy.h:
276         * UIProcess/WebPageProxy.messages.in:
277         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
278         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForResponse):
279         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
280
281 2018-03-14  Chris Dumez  <cdumez@apple.com>
282
283         Drop unnecessary StorageToWebProcessConnection::workerContextProcessConnectionCreated()
284         https://bugs.webkit.org/show_bug.cgi?id=183624
285
286         Reviewed by Youenn Fablet.
287
288         Drop unnecessary StorageToWebProcessConnection::workerContextProcessConnectionCreated()
289         since it was going through all SWServers. Calling workerContextProcessConnectionCreated()
290         on every StorageToWebProcessConnection was thus doing redundant work.
291
292         * StorageProcess/StorageProcess.cpp:
293         (WebKit::StorageProcess::createStorageToWebProcessConnection):
294         * StorageProcess/StorageToWebProcessConnection.cpp:
295         (WebKit::StorageToWebProcessConnection::establishSWServerConnection):
296         (WebKit::StorageToWebProcessConnection::workerContextProcessConnectionCreated): Deleted.
297         * StorageProcess/StorageToWebProcessConnection.h:
298
299 2018-03-14  Tim Horton  <timothy_horton@apple.com>
300
301         Fix the build after r229567
302
303         * Configurations/FeatureDefines.xcconfig:
304
305 2018-03-13  John Wilander  <wilander@apple.com>
306
307         Resource Load Statistics: Immediately forward cookie access for domains with previous user interaction when there's an opener document
308         https://bugs.webkit.org/show_bug.cgi?id=183620
309         <rdar://problem/38431469>
310
311         Reviewed by Brent Fulgham.
312
313         It turns out the fix in https://bugs.webkit.org/show_bug.cgi?id=183577
314         wasn't enough to address the compatibility issues with popups. Some of
315         them just detect their unpartitioned cookies, auto-dismiss themselves,
316         and expect their unpartitioned cookies to be available under the opener
317         afterwards. We should grant them access if the popup's domain has had
318         user interaction _previously_.
319
320         Note that we still need https://bugs.webkit.org/show_bug.cgi?id=183577
321         because if the popup's domain has not received user interaction
322         previously, we will not grant it storage access on just the window open.
323
324         * UIProcess/WebResourceLoadStatisticsStore.cpp:
325         (WebKit::WebResourceLoadStatisticsStore::requestStorageAccessUnderOpener):
326         (WebKit::WebResourceLoadStatisticsStore::grantStorageAccessUnderOpener): Deleted.
327             Renamed WebResourceLoadStatisticsStore::grantStorageAccessUnderOpener()
328             to WebResourceLoadStatisticsStore::requestStorageAccessUnderOpener()
329             since there is now a case where access will not be granted, i.e. when
330             the popup domain has not had user interaction previously.
331         * UIProcess/WebResourceLoadStatisticsStore.h:
332         * UIProcess/WebResourceLoadStatisticsStore.messages.in:
333              Similar renaming.
334         * WebProcess/WebProcess.cpp:
335         (WebProcess::WebProcess):
336              Similar renaming.
337
338 2018-03-13  Jer Noble  <jer.noble@apple.com>
339
340         Add missing artwork for fullscreen mode.
341         https://bugs.webkit.org/show_bug.cgi?id=183618
342
343         Reviewed by Jon Lee.
344
345         * Resources/ios/iOS.xcassets/Done.imageset/Contents.json: Added.
346         * Resources/ios/iOS.xcassets/Done.imageset/Done.pdf: Added.
347         * Resources/ios/iOS.xcassets/StartPictureInPictureButton.imageset/Contents.json: Added.
348         * Resources/ios/iOS.xcassets/StartPictureInPictureButton.imageset/StartPictureInPictureButton@1x.png: Added.
349         * Resources/ios/iOS.xcassets/StartPictureInPictureButton.imageset/StartPictureInPictureButton@2x.png: Added.
350         * Resources/ios/iOS.xcassets/StartPictureInPictureButton.imageset/StartPictureInPictureButton@3x.png: Added.
351         * Resources/ios/iOS.xcassets/StopPictureInPictureButton.imageset/Contents.json: Added.
352         * Resources/ios/iOS.xcassets/StopPictureInPictureButton.imageset/StopPictureInPictureButton@1x.png: Added.
353         * Resources/ios/iOS.xcassets/StopPictureInPictureButton.imageset/StopPictureInPictureButton@2x.png: Added.
354         * Resources/ios/iOS.xcassets/StopPictureInPictureButton.imageset/StopPictureInPictureButton@3x.png: Added.
355
356 2018-03-13  Brian Burg  <bburg@apple.com>
357
358         [WK2] Web Inspector: NavigationAction for opening a link in a new tab should have a UserGestureIndicator
359         https://bugs.webkit.org/show_bug.cgi?id=183612
360         <rdar://problem/38388641>
361
362         Reviewed by Timothy Hatcher.
363
364         The current gesture token will be attached to the NavigationAction at construction time,
365         so set up a UserGestureIndicator when creating the action and sending it out.
366
367         * WebProcess/WebPage/WebInspector.cpp:
368         (WebKit::WebInspector::openInNewTab):
369
370 2018-03-13  Dean Jackson  <dino@apple.com>
371
372         WKSystemPreviewView needs to implement some of UIScrollViewDelegate
373         https://bugs.webkit.org/show_bug.cgi?id=183607
374         <rdar://problem/38427622>
375
376         Reviewed by Antoine Quint.
377
378         Add an empty implementation of scrollViewDidScroll.
379
380         * UIProcess/ios/WKSystemPreviewView.mm:
381         (-[WKSystemPreviewView scrollViewDidScroll:]):
382
383 2018-03-13  Jiewen Tan  <jiewen_tan@apple.com>
384
385         Soft-link LocalAuthentication.Framework
386         https://bugs.webkit.org/show_bug.cgi?id=183587
387         <rdar://problem/38219763>
388
389         Reviewed by Brian Burg.
390
391         * UIProcess/CredentialManagement/cocoa/WebCredentialsMessengerProxyCocoa.mm:
392         (WebKit::WebCredentialsMessengerProxy::platformIsUserVerifyingPlatformAuthenticatorAvailable):
393         * WebKit.xcodeproj/project.pbxproj:
394
395 2018-03-12  Dean Jackson  <dino@apple.com>
396
397         Add a WKWebViewContentProvider for system previews
398         https://bugs.webkit.org/show_bug.cgi?id=183582
399         <rdar://problem/38393569>
400
401         Reviewed by Tim Horton.
402
403         Implement WKSystemPreviewView, which conforms to WKWebViewContentProvider, in
404         order to view content as a "system preview". This effectively replaces the
405         SystemPreviewController, which will be removed soon.
406
407         Some of the required methods of WKWebViewContentProvider are not necessary on
408         this instance, so a follow-up patch will clean the protocol up a bit.
409
410         * UIProcess/Cocoa/NavigationState.mm: Don't trigger a SystemPreview when downloading.
411         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationResponse):
412
413         * UIProcess/Cocoa/WKWebViewContentProviderRegistry.mm:
414         (-[WKWebViewContentProviderRegistry init]): Register the WKSystemPreviewView for
415         MIME types retrieved from WebKitAdditions.
416
417         * UIProcess/ios/WKSystemPreviewView.h: Added.
418         * UIProcess/ios/WKSystemPreviewView.mm: Added.
419
420         (-[WKSystemPreviewView web_initWithFrame:webView:]):
421         (-[WKSystemPreviewView web_setContentProviderData:suggestedFilename:]): This is the
422         method that actually creates a QuickLook preview and provides the data.
423         (-[WKSystemPreviewView web_setMinimumSize:]):
424         (-[WKSystemPreviewView web_setOverlaidAccessoryViewsInset:]):
425         (-[WKSystemPreviewView web_computedContentInsetDidChange]):
426         (-[WKSystemPreviewView web_setFixedOverlayView:]):
427         (-[WKSystemPreviewView web_didSameDocumentNavigation:]):
428         (-[WKSystemPreviewView web_countStringMatches:options:maxCount:]):
429         (-[WKSystemPreviewView web_findString:options:maxCount:]):
430         (-[WKSystemPreviewView web_hideFindUI]):
431
432         (-[WKSystemPreviewView numberOfPreviewItemsInPreviewController:]): QuickLook delegates.
433         (-[WKSystemPreviewView previewController:previewItemAtIndex:]):
434         (-[WKSystemPreviewView provideDataForItem:]):
435         (-[WKSystemPreviewView previewControllerWillDismiss:]):
436
437         * WebKit.xcodeproj/project.pbxproj: Add new files.
438
439 2018-03-12  John Wilander  <wilander@apple.com>
440
441         Resource Load Statistics: Immediately forward cookie access at user interaction when there's an opener document
442         https://bugs.webkit.org/show_bug.cgi?id=183577
443         <rdar://problem/38266987>
444
445         Reviewed by Brent Fulgham.
446
447         * NetworkProcess/NetworkProcess.cpp:
448         (WebKit::NetworkProcess::hasStorageAccessForFrame):
449             Now also checks for general page access.
450         (WebKit::NetworkProcess::grantStorageAccess):
451             Renamed from grantStorageAccessForFrame since the frameID now is optional.
452         (WebKit::NetworkProcess::grantStorageAccessForFrame): Deleted.
453             Renamed since the frameID now is optional.
454         * NetworkProcess/NetworkProcess.h:
455             Renaming since the frameID now is optional.
456         * NetworkProcess/NetworkProcess.messages.in:
457             Renaming since the frameID now is optional.
458         * NetworkProcess/NetworkResourceLoader.cpp:
459         (WebKit::NetworkResourceLoader::logCookieInformation):
460             Consequence of function renaming.
461         * UIProcess/Network/NetworkProcessProxy.cpp:
462         (WebKit::NetworkProcessProxy::grantStorageAccess):
463         (WebKit::NetworkProcessProxy::grantStorageAccessForFrame): Deleted.
464             Renaming since the frameID now is optional.
465         * UIProcess/Network/NetworkProcessProxy.h:
466         * UIProcess/WebResourceLoadStatisticsStore.cpp:
467         (WebKit::WebResourceLoadStatisticsStore::WebResourceLoadStatisticsStore):
468             Renaming since the frameID now is optional.
469         (WebKit::WebResourceLoadStatisticsStore::requestStorageAccess):
470             Handler renaming since the frameID now is optional.
471         (WebKit::WebResourceLoadStatisticsStore::grantStorageAccessUnderOpener):
472             New function for that grants cookie access under a whole page.
473         * UIProcess/WebResourceLoadStatisticsStore.h:
474             Member renaming since the frameID now is optional.
475         * UIProcess/WebResourceLoadStatisticsStore.messages.in:
476             New message received straight from WebCore::ResourceLoadObserver.
477         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
478         (WebKit::WebsiteDataStore::grantStorageAccessHandler):
479             Renamed and made frameID optional.
480         (WebKit::WebsiteDataStore::enableResourceLoadStatisticsAndSetTestingCallback):
481             Consequence of renaming and making frameID optional.
482         (WebKit::WebsiteDataStore::grantStorageAccessForFrameHandler): Deleted.
483             Renamed and made frameID optional.
484         * UIProcess/WebsiteData/WebsiteDataStore.h:
485         * WebProcess/WebProcess.cpp:
486         (WebProcess::WebProcess):
487             Now calls setGrantStorageAccessUnderOpenerCallback() on the shared
488             WebCore::ResourceLoadObserver.
489
490 2018-03-12  Tim Horton  <timothy_horton@apple.com>
491
492         Stop using SDK conditionals to control feature definitions
493         https://bugs.webkit.org/show_bug.cgi?id=183430
494         <rdar://problem/38251619>
495
496         Reviewed by Dan Bernstein.
497
498         * Configurations/FeatureDefines.xcconfig:
499         * Configurations/WebKitTargetConditionals.xcconfig: Renamed.
500
501 2018-03-12  Yoav Weiss  <yoav@yoav.ws>
502
503         Runtime flag for link prefetch and remove link subresource.
504         https://bugs.webkit.org/show_bug.cgi?id=183540
505
506         Reviewed by Chris Dumez.
507
508         Remove the LINK_PREFETCH build time flag.
509
510         * Configurations/FeatureDefines.xcconfig:
511         * WebProcess/Network/WebLoaderStrategy.cpp:
512         (WebKit::maximumBufferingTime):
513
514 2018-03-12  Chris Dumez  <cdumez@apple.com>
515
516         Load may get committed before receiving policy for the resource response
517         https://bugs.webkit.org/show_bug.cgi?id=183579
518         <rdar://problem/38268780>
519
520         Reviewed by Youenn Fablet.
521
522         r228852 updated WebResourceLoader::didReceiveResponse to only send the
523         ContinueDidReceiveResponse IPC back to the Networkprocess *after* the
524         policy decision for the resource response has been made. This is necessary
525         now that policy decisions can be made asynchronously.
526
527         However, one of the 2 code paths in NetworkProcess side (code path when
528         the resource is already in the HTTP disk cache) failed to wait for the
529         ContinueDidReceiveResponse IPC before sending over the data to the WebProcess.
530         As a result, the WebProcess could commit the load before even receiving the
531         policy response from the client.        
532
533         * NetworkProcess/NetworkResourceLoader.cpp:
534         (WebKit::NetworkResourceLoader::continueDidReceiveResponse):
535         (WebKit::NetworkResourceLoader::didRetrieveCacheEntry):
536         (WebKit::NetworkResourceLoader::continueProcessingCachedEntryAfterDidReceiveResponse):
537         * NetworkProcess/NetworkResourceLoader.h:
538         Make sure NetworkResourceLoader::didRetrieveCacheEntry() does not start sending the data
539         until the network process gets the ContinueDidReceiveResponse IPC back from the WebProcess.
540
541         * WebProcess/Network/WebResourceLoader.cpp:
542         (WebKit::WebResourceLoader::didReceiveResponse):
543         (WebKit::WebResourceLoader::didReceiveData):
544         * WebProcess/Network/WebResourceLoader.h:
545         Add assertion to make sure didReceiveData() never gets called before didReceiveResponse's
546         completion handler has been called. If this hits, then the load may get committed even
547         though the client did not reply to the policy for the resource response yet.
548
549 2018-03-12  Ali Juma  <ajuma@chromium.org>
550
551         http/tests/workers/service/service-worker-download.https.html times out with async policy delegates
552         https://bugs.webkit.org/show_bug.cgi?id=183479
553
554         Reviewed by Youenn Fablet.
555
556         Ensure that ServiceWorkerFetchClient::m_isCheckingResponse is set before code that depends on it
557         executes. This bit was set by code that's posted to the runloop using 'callOnMainThread' in
558         ServiceWorkerFetchClient::didReceiveResponse. But when didReceiveResponse is executing, tasks for
559         handling didReceiveData, didFail, or didFinish may already have been posted to the runloop, and in
560         that case would execute before m_isCheckingResponse gets set, and then incorrectly fail to 
561         early-out. Fix this by directly setting m_isCheckingResponse in didReceiveResponse.
562
563         * WebProcess/Storage/ServiceWorkerClientFetch.cpp:
564         (WebKit::ServiceWorkerClientFetch::start):
565         (WebKit::ServiceWorkerClientFetch::didReceiveResponse):
566
567 2018-03-12  Wenson Hsieh  <wenson_hsieh@apple.com>
568
569         REGRESSION(r211643): Dismissing WKActionSheet should not also dismiss its presenting view controller
570         https://bugs.webkit.org/show_bug.cgi?id=183549
571         <rdar://problem/34960698>
572
573         Reviewed by Andy Estes.
574
575         Fixes the bug by dismissing the presented view controller (i.e. the action sheet or the view controller being
576         presented during rotation) rather than the presenting view controller.
577
578         Test: ActionSheetTests.DismissingActionSheetShouldNotDismissPresentingViewController
579
580         * UIProcess/ios/WKActionSheet.mm:
581         (-[WKActionSheet doneWithSheet:]):
582
583 2018-03-12  Javier Fernandez  <jfernandez@igalia.com>
584
585         Remove GridLayout runtime flag
586         https://bugs.webkit.org/show_bug.cgi?id=183484
587
588         Reviewed by Myles C. Maxfield.
589
590         The Grid Layout feature has been enabled by default for almost a
591         year, so I think it's time to remove the runtime flag and the
592         codepath run when the feature is disabled.
593
594         * Shared/WebPreferences.yaml:
595         * WebProcess/InjectedBundle/InjectedBundle.cpp:
596         (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner):
597
598 2018-03-11  Wenson Hsieh  <wenson_hsieh@apple.com>
599
600         Fix the internal iOS build after r229512
601         https://bugs.webkit.org/show_bug.cgi?id=183550
602
603         Reviewed by Zalan Bujtas.
604
605         Fixes a typo in a header import, as well as a nullability error. `SecTrustEvaluate()` takes in a nonnull outparam,
606         which was removed in r229512; this adds the outparam back, but does not consult its value when setting the
607         `infoDictionary`.
608
609         * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm:
610         (-[WKFullScreenWindowController _EVOrganizationName]):
611
612 2018-03-10  Jer Noble  <jer.noble@apple.com>
613
614         Improvements to fullscreen; new UI and security features
615         https://bugs.webkit.org/show_bug.cgi?id=183503
616
617         Reviewed by Dean Jackson.
618
619         Now that the iOS Fullscreen code has more than one major class, move it into an ios/
620         directory.
621
622         Clean up the WKFullScreenWindowControllerIOS class to more clearly separate external
623         facing API from purely internal functions.
624
625         Move the WKFullScreenViewController out into its own file. Add support for fullscreen
626         top inset and fullscreen autohide duration CSS constants.
627
628         Add a heuristic to distinguish between media control related touches and ones that look
629         more keyboard interactions.
630
631         Add a new UIStackView based control to hold the fullscreen controls.
632
633         * UIProcess/ios/WKFullScreenWindowControllerIOS.mm: Removed.
634         * UIProcess/ios/fullscreen/FullscreenTouchSecheuristic.cpp: Added.
635         (WebKit::FullscreenTouchSecheuristic::scoreOfNextTouch):
636         (WebKit::FullscreenTouchSecheuristic::reset):
637         (WebKit::FullscreenTouchSecheuristic::distanceScore):
638         (WebKit::FullscreenTouchSecheuristic::attenuationFactor):
639         * UIProcess/ios/fullscreen/FullscreenTouchSecheuristic.h: 
640         (WebKit::FullscreenTouchSecheuristic::setRampUpSpeed):
641         (WebKit::FullscreenTouchSecheuristic::setRampDownSpeed):
642         (WebKit::FullscreenTouchSecheuristic::setXWeight):
643         (WebKit::FullscreenTouchSecheuristic::setYWeight):
644         (WebKit::FullscreenTouchSecheuristic::setSize):
645         (WebKit::FullscreenTouchSecheuristic::setGamma):
646         (WebKit::FullscreenTouchSecheuristic::setGammaCutoff):
647         * UIProcess/ios/fullscreen/WKFullScreenViewController.h:
648         * UIProcess/ios/fullscreen/WKFullScreenViewController.mm: Added.
649         (WKFullScreenViewControllerPlaybackSessionModelClient::setParent):
650         (WKFullScreenViewControllerPlaybackSessionModelClient::setInterface):
651         (-[_WKExtrinsicButton setExtrinsicContentSize:]):
652         (-[_WKExtrinsicButton intrinsicContentSize]):
653         (-[WKFullScreenViewController initWithWebView:]):
654         (-[WKFullScreenViewController dealloc]):
655         (-[WKFullScreenViewController showUI]):
656         (-[WKFullScreenViewController hideUI]):
657         (-[WKFullScreenViewController videoControlsManagerDidChange]):
658         (-[WKFullScreenViewController setPrefersStatusBarHidden:]):
659         (-[WKFullScreenViewController setPlaying:]):
660         (-[WKFullScreenViewController setPictureInPictureActive:]):
661         (-[WKFullScreenViewController loadView]):
662         (-[WKFullScreenViewController viewWillAppear:]):
663         (-[WKFullScreenViewController viewDidLayoutSubviews]):
664         (-[WKFullScreenViewController viewWillTransitionToSize:withTransitionCoordinator:]):
665         (-[WKFullScreenViewController preferredStatusBarStyle]):
666         (-[WKFullScreenViewController prefersStatusBarHidden]):
667         (-[WKFullScreenViewController gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer:]):
668         (-[WKFullScreenViewController gestureRecognizer:shouldReceiveTouch:]):
669         (-[WKFullScreenViewController _manager]):
670         (-[WKFullScreenViewController _effectiveFullscreenInsetTop]):
671         (-[WKFullScreenViewController _cancelAction:]):
672         (-[WKFullScreenViewController _togglePiPAction:]):
673         (-[WKFullScreenViewController _touchDetected:]):
674         (-[WKFullScreenViewController _statusBarFrameDidChange:]):
675         (-[WKFullScreenViewController _updateWebViewFullscreenInsets]):
676         (-[WKFullScreenViewController _showPhishingAlert]):
677         * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.h: Copied from Source/WebKit/UIProcess/ios/WKFullScreenWindowControllerIOS.h.
678         * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm: Added.
679         (WebKit::replaceViewWithView):
680         (WebKit::WKWebViewState::applyTo):
681         (WebKit::WKWebViewState::store):
682         (-[WKFullscreenAnimationController transitionDuration:]):
683         (-[WKFullscreenAnimationController configureInitialAndFinalStatesForTransition:]):
684         (-[WKFullscreenAnimationController animateTransition:]):
685         (-[WKFullscreenAnimationController animationEnded:]):
686         (-[WKFullscreenAnimationController startInteractiveTransition:]):
687         (-[WKFullscreenAnimationController updateWithPercent:]):
688         (-[WKFullscreenAnimationController updateWithPercent:translation:anchor:]):
689         (-[WKFullscreenAnimationController end:]):
690         (-[WKFullScreenInteractiveTransition initWithAnimator:anchor:]):
691         (-[WKFullScreenInteractiveTransition wantsInteractiveStart]):
692         (-[WKFullScreenInteractiveTransition startInteractiveTransition:]):
693         (-[WKFullScreenInteractiveTransition updateInteractiveTransition:withTranslation:]):
694         (-[WKFullScreenInteractiveTransition cancelInteractiveTransition]):
695         (-[WKFullScreenInteractiveTransition finishInteractiveTransition]):
696         (-[WKFullScreenWindowController initWithWebView:]):
697         (-[WKFullScreenWindowController dealloc]):
698         (-[WKFullScreenWindowController isFullScreen]):
699         (-[WKFullScreenWindowController webViewPlaceholder]):
700         (-[WKFullScreenWindowController enterFullScreen]):
701         (-[WKFullScreenWindowController beganEnterFullScreenWithInitialFrame:finalFrame:]):
702         (-[WKFullScreenWindowController requestExitFullScreen]):
703         (-[WKFullScreenWindowController exitFullScreen]):
704         (-[WKFullScreenWindowController beganExitFullScreenWithInitialFrame:finalFrame:]):
705         (-[WKFullScreenWindowController _completedExitFullScreen]):
706         (-[WKFullScreenWindowController close]):
707         (-[WKFullScreenWindowController webViewDidRemoveFromSuperviewWhileInFullscreen]):
708         (-[WKFullScreenWindowController videoControlsManagerDidChange]):
709         (-[WKFullScreenWindowController gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer:]):
710         (-[WKFullScreenWindowController animationControllerForPresentedController:presentingController:sourceController:]):
711         (-[WKFullScreenWindowController animationControllerForDismissedController:]):
712         (-[WKFullScreenWindowController interactionControllerForDismissal:]):
713         (-[WKFullScreenWindowController _exitFullscreenImmediately]):
714         (-[WKFullScreenWindowController _invalidateEVOrganizationName]):
715         (-[WKFullScreenWindowController _isSecure]):
716         (-[WKFullScreenWindowController _serverTrust]):
717         (-[WKFullScreenWindowController _EVOrganizationName]):
718         (-[WKFullScreenWindowController _updateLocationInfo]):
719         (-[WKFullScreenWindowController _manager]):
720         (-[WKFullScreenWindowController _startToDismissFullscreenChanged:]):
721         (-[WKFullScreenWindowController _interactiveDismissChanged:]):
722         * UIProcess/ios/fullscreen/WKFullscreenStackView.h: Renamed from Source/WebKit/UIProcess/ios/WKFullScreenWindowControllerIOS.h.
723         * UIProcess/ios/fullscreen/WKFullscreenStackView.mm: Added.
724         (+[WKFullscreenStackView baseEffects]):
725         (+[WKFullscreenStackView configureView:forTintEffectWithColor:filterType:]):
726         (+[WKFullscreenStackView configureView:withBackgroundFillOfColor:opacity:filter:]):
727         (+[WKFullscreenStackView secondaryMaterialOverlayView]):
728         (+[WKFullscreenStackView applyPrimaryGlyphTintToView:]):
729         (+[WKFullscreenStackView applySecondaryGlyphTintToView:]):
730         (-[WKFullscreenStackView initWithArrangedSubviews:axis:]):
731         (-[WKFullscreenStackView setTargetViewForSecondaryMaterialOverlay:]):
732         (-[WKFullscreenStackView contentView]):
733         (-[WKFullscreenStackView _setArrangedSubviews:axis:]):
734         (-[WKFullscreenStackView setBounds:]):
735         (-[WKFullscreenStackView updateConstraints]):
736         * WebKit.xcodeproj/project.pbxproj:
737
738 2018-03-10  Megan Gardner  <megan_gardner@apple.com>
739
740         Media query for default appearance
741         https://bugs.webkit.org/show_bug.cgi?id=183539
742         <rdar://problem/38326388>
743
744         Reviewed by Tim Horton.
745
746         Write a media query to evaluate appearance.
747
748         * Shared/WebPageCreationParameters.cpp:
749         (WebKit::WebPageCreationParameters::encode const):
750         (WebKit::WebPageCreationParameters::decode):
751         * Shared/WebPageCreationParameters.h:
752         * UIProcess/API/Cocoa/WKWebView.mm:
753         (-[WKWebView _initializeWithConfiguration:]):
754         (-[WKWebView _setUseSystemAppearance:]):
755         * UIProcess/WebPageProxy.cpp:
756         (WebKit::WebPageProxy::creationParameters):
757         (WebKit::WebPageProxy::setDefaultAppearance):
758         * UIProcess/WebPageProxy.h:
759         (WebKit::WebPageProxy::defaultAppearance const):
760         * WebProcess/WebPage/WebPage.cpp:
761         (WebKit::m_credentialsMessenger):
762         (WebKit::WebPage::setDefaultAppearance):
763         * WebProcess/WebPage/WebPage.h:
764         * WebProcess/WebPage/WebPage.messages.in:
765
766 2018-03-09  Jer Noble  <jer.noble@apple.com>
767
768         Unconditionalize more methods in VideoFullscreenInterface (and related classes)
769         https://bugs.webkit.org/show_bug.cgi?id=183501
770         <rdar://problem/38312038>
771
772         Unreviewed build fix; add correct pragmas to code referencing m_playbackSessionManager.
773
774         * UIProcess/WebPageProxy.cpp:
775         (WebKit::WebPageProxy::hasActiveVideoForControlsManager const):
776         (WebKit::WebPageProxy::requestControlledElementID const):
777         (WebKit::WebPageProxy::isPlayingVideoInEnhancedFullscreen const):
778
779 2018-03-09  Brian Burg  <bburg@apple.com>
780
781         Web Inspector: there should only be one way for async backend commands to send failure
782         https://bugs.webkit.org/show_bug.cgi?id=183524
783
784         Reviewed by Timothy Hatcher.
785
786         Remove useless ErrorString argument from async commands.
787
788         For Automation protocol, introduce sync and async macros for filling
789         in and sending a failure response. Now that async commands don't have
790         an ErrorString and sync commands don't have a callback, trying to send
791         an error with the wrong macro is a compile-time error.
792
793         * UIProcess/Automation/WebAutomationSession.cpp:
794         (WebKit::WebAutomationSession::getBrowsingContexts):
795         (WebKit::WebAutomationSession::getBrowsingContext):
796         (WebKit::WebAutomationSession::createBrowsingContext):
797         (WebKit::WebAutomationSession::closeBrowsingContext):
798         (WebKit::WebAutomationSession::switchToBrowsingContext):
799         (WebKit::WebAutomationSession::setWindowFrameOfBrowsingContext):
800         (WebKit::WebAutomationSession::waitForNavigationToComplete):
801         (WebKit::WebAutomationSession::navigateBrowsingContext):
802         (WebKit::WebAutomationSession::goBackInBrowsingContext):
803         (WebKit::WebAutomationSession::goForwardInBrowsingContext):
804         (WebKit::WebAutomationSession::reloadBrowsingContext):
805         (WebKit::WebAutomationSession::evaluateJavaScriptFunction):
806         (WebKit::WebAutomationSession::resolveChildFrameHandle):
807         (WebKit::WebAutomationSession::resolveParentFrameHandle):
808         (WebKit::WebAutomationSession::computeElementLayout):
809         (WebKit::WebAutomationSession::selectOptionElement):
810         (WebKit::WebAutomationSession::isShowingJavaScriptDialog):
811         (WebKit::WebAutomationSession::dismissCurrentJavaScriptDialog):
812         (WebKit::WebAutomationSession::acceptCurrentJavaScriptDialog):
813         (WebKit::WebAutomationSession::messageOfCurrentJavaScriptDialog):
814         (WebKit::WebAutomationSession::setUserInputForCurrentJavaScriptPrompt):
815         (WebKit::WebAutomationSession::setFilesToSelectForFileUpload):
816         (WebKit::WebAutomationSession::getAllCookies):
817         (WebKit::WebAutomationSession::deleteSingleCookie):
818         (WebKit::WebAutomationSession::addSingleCookie):
819         (WebKit::WebAutomationSession::deleteAllCookies):
820         (WebKit::WebAutomationSession::setSessionPermissions):
821         (WebKit::WebAutomationSession::performMouseInteraction):
822         (WebKit::WebAutomationSession::performKeyboardInteractions):
823         (WebKit::WebAutomationSession::takeScreenshot):
824         (WebKit::WebAutomationSession::didTakeScreenshot):
825         * UIProcess/Automation/WebAutomationSession.h:
826         * UIProcess/Automation/WebAutomationSessionMacros.h:
827         * UIProcess/Automation/mac/WebAutomationSessionMac.mm:
828         (WebKit::WebAutomationSession::inspectBrowsingContext):
829
830 2018-03-09  Jer Noble  <jer.noble@apple.com>
831
832         Don't pass NULL to the result parameter of SecTrustEvaluate()
833         https://bugs.webkit.org/show_bug.cgi?id=183495
834         <rdar://problem/38185688>
835
836         Reviewed by Andy Estes.
837
838         * UIProcess/ios/WKFullScreenWindowControllerIOS.mm:
839         (-[WKFullScreenWindowController _EVOrganizationName]):
840
841 2018-03-09  Dean Jackson  <dino@apple.com>
842
843         Allow NavigationState to intercept requests and send them to SystemPreviewController
844         https://bugs.webkit.org/show_bug.cgi?id=183526
845         <rdar://problem/37801140>
846
847         Reviewed by Tim Horton.
848
849         Implement a bit more of SystemPreviewController, such that it can be used
850         from NavigationState to identify and handle content that can be previewed.
851
852         * UIProcess/Cocoa/NavigationState.mm:
853         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationResponse):
854             If we'd in a download response policy, then check if SystemPreviewController
855             can show the content. We ignore the download, but pass the original URL onto
856             the preview. Ultimately, we'd want to avoid the navigation
857             but use the download destination URL for preview.
858
859         * UIProcess/Cocoa/SystemPreviewControllerCocoa.mm:
860         (-[_WKPreviewControllerDataSource initWithURL:]):
861             Move the URL to property, to help use a single datasource object for all previews.
862         (-[_WKPreviewControllerDataSource previewController:previewItemAtIndex:]):
863         (-[_WKPreviewControllerDelegate initWithSystemPreviewController:]):
864             Add a delegate object, so we can detect when the preview is dismissed and return
865             to the previous page.
866         (-[_WKPreviewControllerDelegate previewControllerWillDismiss:]):
867         (WebKit::SystemPreviewController::showPreview):
868             Use single instances of the QLPreviewController, its datasource and delegate.
869
870         * UIProcess/SystemPreviewController.cpp:
871             Add a helper to navigate back.
872         (WebKit::SystemPreviewController::SystemPreviewController):
873         (WebKit::SystemPreviewController::sendPageBack):
874         * UIProcess/SystemPreviewController.h:
875
876 2018-03-09  Jer Noble  <jer.noble@apple.com>
877
878         webkitfullscreenchange event not fired at the same time as :-webkit-full-screen pseudo selector changes; causes glitchiness
879         https://bugs.webkit.org/show_bug.cgi?id=183383
880         <rdar://problem/38197028>
881
882         Reviewed by Eric Carlson.
883
884         Follow-up patch: now that the 'fullscreenchange' event is being fired slightly earlier, the
885         Fullscreen.TopContentInset tests triggers what appears to be an existing behavior: if you
886         exit in the middle of an enter fullscreen animation, the exit never happens, because the
887         NSWindow never starts the exit animation. The solution is to store the exit fullscreen
888         request, and only act upon it when the enter animation completes.
889
890         * UIProcess/mac/WKFullScreenWindowController.h:
891         * UIProcess/mac/WKFullScreenWindowController.mm:
892         (-[WKFullScreenWindowController finishedEnterFullScreenAnimation:]):
893         (-[WKFullScreenWindowController exitFullScreen]):
894
895 2018-03-09  Jer Noble  <jer.noble@apple.com>
896
897         Unconditionalize more methods in VideoFullscreenInterface (and related classes)
898         https://bugs.webkit.org/show_bug.cgi?id=183501
899
900         Reviewed by Eric Carlson.
901
902         No reason for these methods to be PLATFORM(MAC) only.
903
904         * UIProcess/API/Cocoa/WKWebView.mm:
905         (-[WKWebView _videoControlsManagerDidChange]):
906         * UIProcess/API/Cocoa/WKWebViewInternal.h:
907         * UIProcess/Cocoa/PlaybackSessionManagerProxy.mm:
908         (WebKit::PlaybackSessionManagerProxy::setUpPlaybackControlsManagerWithID):
909         (WebKit::PlaybackSessionManagerProxy::clearPlaybackControlsManager):
910         * UIProcess/Cocoa/VideoFullscreenManagerProxy.h:
911         * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm:
912         * UIProcess/PageClient.h:
913         * UIProcess/WebPageProxy.cpp:
914         (WebKit::WebPageProxy::isPlayingMediaDidChange):
915         (WebKit::WebPageProxy::handleControlledElementIDResponse const):
916         (WebKit::WebPageProxy::isPlayingVideoInEnhancedFullscreen const):
917         * UIProcess/WebPageProxy.h:
918         * UIProcess/ios/PageClientImplIOS.h:
919         * UIProcess/ios/PageClientImplIOS.mm:
920         (WebKit::PageClientImpl::videoControlsManagerDidChange):
921         * UIProcess/ios/WKFullScreenWindowControllerIOS.h:
922         * UIProcess/ios/WKFullScreenWindowControllerIOS.mm:
923         (-[WKFullScreenWindowController videoControlsManagerDidChange]):
924         * WebProcess/cocoa/PlaybackSessionManager.mm:
925         (WebKit::PlaybackSessionManager::setUpPlaybackControlsManager):
926
927 2018-03-09  Per Arne Vollan  <pvollan@apple.com>
928
929         Create CA layer contexts with +remoteContextWithOptions.
930         https://bugs.webkit.org/show_bug.cgi?id=182747
931
932         Reviewed by Brent Fulgham.
933
934         CA layer contexts (CAContext) are currently created with +contextWithCGSConnection, which is
935         using the main WindowServer connection to create the context. Instead, the contexts can be
936         created with +remoteContextWithOptions, which does not use the main WindowServer connection.
937         This is a step towards limiting the access the WebContent process has to the window server.
938         To make the +remoteContextWithOptions call succeed, the sandbox has to be modified to allow
939         access to CARenderServer. Also, access to the WindowServer should be denied by calling
940         CGSSetDenyWindowServerConnections(true) before entering the sandbox. This is planned to do
941         in a follow-up patch. The call to +remoteContextWithOptions will open up WindowServer
942         connections, since the WindowServer is the system default CA render server, but these
943         connections come with limited WindowServer exposure. In addition, we need to open up the
944         sandbox for accessing some IOKit properties.
945
946         * Platform/mac/LayerHostingContext.mm:
947         (WebKit::LayerHostingContext::createForExternalHostingProcess):
948         * Shared/mac/HangDetectionDisablerMac.mm:
949         (WebKit::setClientsMayIgnoreEvents):
950         * WebProcess/com.apple.WebProcess.sb.in:
951
952 2018-03-09  Brent Fulgham  <bfulgham@apple.com>
953
954         Remove cookie API access from WebContent Process
955         https://bugs.webkit.org/show_bug.cgi?id=183519
956         <rdar://problem/35368802>
957
958         Reviewed by Alex Christensen.
959
960         All cookie access is now handled in the Network Process. However, there are vestiges of the original logic that used CFNetwork APIs in the WebContent process.
961
962         This patch removes CFNetwork calls from the WebProcess code paths, since they serve no purpose in modern WebKit.
963
964         No tests because this is a code cleanup with no expected change in behavior.
965
966         * NetworkProcess/Cookies/mac/WebCookieManagerMac.mm:
967         (WebKit::WebCookieManager::platformSetHTTPCookieAcceptPolicy): Moved from WebFrameNetworkingContext.
968         * NetworkProcess/NetworkProcess.h:
969         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
970         (WebKit::NetworkProcess::setSharedHTTPCookieStorage): Moved from ChildProcess, since this should only be
971         called in the NetworkProcess.
972         * Shared/ChildProcess.h:
973         * Shared/mac/ChildProcessMac.mm:
974         (WebKit::ChildProcess::setSharedHTTPCookieStorage): Deleted.
975         * WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.h:
976         * WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.mm:
977         (WebKit::WebFrameNetworkingContext::ensureWebsiteDataStoreSession): Remove CFNetwork code. This version of
978         'ensureWebsiteDataStoreSession' is needed to maintain a dictionary on the WebProcess side so we can refer to
979         the same network session in both the WebContent and Network processes.
980         (WebKit::WebFrameNetworkingContext::webFrameLoaderClient const):
981         (WebKit::WebFrameNetworkingContext::setCookieAcceptPolicyForAllContexts): Deleted.
982         * WebProcess/cocoa/WebProcessCocoa.mm:
983         (WebKit::WebProcess::platformInitializeWebProcess): Remove calls to CFNetwork.
984
985 2018-03-09  Youenn Fablet  <youenn@apple.com>
986
987         ServiceWorkerClientFetch should send data to its resource loader once the didReceiveResponse completion handler is called
988         https://bugs.webkit.org/show_bug.cgi?id=183110
989
990         Reviewed by Chris Dumez.
991
992         Buffering data/finish event/fail event until the response completion handler is called.
993
994         * WebProcess/Storage/ServiceWorkerClientFetch.cpp:
995         (WebKit::ServiceWorkerClientFetch::didReceiveResponse):
996         (WebKit::ServiceWorkerClientFetch::didReceiveData):
997         (WebKit::ServiceWorkerClientFetch::didFinish):
998         (WebKit::ServiceWorkerClientFetch::didFail):
999         (WebKit::ServiceWorkerClientFetch::didNotHandle):
1000         (WebKit::ServiceWorkerClientFetch::cancel):
1001         (WebKit::ServiceWorkerClientFetch::continueLoadingAfterCheckingResponse):
1002         * WebProcess/Storage/ServiceWorkerClientFetch.h:
1003
1004 2018-03-09  Jer Noble  <jer.noble@apple.com>
1005
1006         Add new CSS env constants for use with fullscreen
1007         https://bugs.webkit.org/show_bug.cgi?id=183498
1008
1009         Reviewed by Dean Jackson.
1010
1011         Pass the values given to WebFullScreenManagerProxy through the process boundary and
1012         into WebCore.
1013
1014         * UIProcess/WebFullScreenManagerProxy.cpp:
1015         (WebKit::WebFullScreenManagerProxy::setFullscreenInsetTop):
1016         (WebKit::WebFullScreenManagerProxy::setFullscreenAutoHideDelay):
1017         * UIProcess/WebFullScreenManagerProxy.h:
1018         * WebProcess/FullScreen/WebFullScreenManager.cpp:
1019         (WebKit::WebFullScreenManager::didExitFullScreen):
1020         (WebKit::WebFullScreenManager::setFullscreenInsetTop):
1021         (WebKit::WebFullScreenManager::setFullscreenAutoHideDelay):
1022         * WebProcess/FullScreen/WebFullScreenManager.h:
1023         * WebProcess/FullScreen/WebFullScreenManager.messages.in:
1024
1025 2018-03-09  Jer Noble  <jer.noble@apple.com>
1026
1027         Add isPictureInPictureActive messaging across WebKit process boundary
1028         https://bugs.webkit.org/show_bug.cgi?id=183499
1029
1030         Reviewed by Eric Carlson.
1031
1032         * UIProcess/Cocoa/PlaybackSessionManagerProxy.h:
1033         * UIProcess/Cocoa/PlaybackSessionManagerProxy.messages.in:
1034         * UIProcess/Cocoa/PlaybackSessionManagerProxy.mm:
1035         (WebKit::PlaybackSessionModelContext::pictureInPictureActiveChanged):
1036         (WebKit::PlaybackSessionManagerProxy::pictureInPictureActiveChanged):
1037
1038 2018-03-09  Stephan Szabo  <stephan.szabo@sony.com>
1039
1040         Add guard for wtf/glib include
1041         https://bugs.webkit.org/show_bug.cgi?id=183521
1042
1043         Reviewed by Alex Christensen.
1044
1045         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedDisplayRefreshMonitor.cpp:
1046
1047 2018-03-09  Andy Estes  <aestes@apple.com>
1048
1049         [Mac] WebKit fails to receive file promises when the embedding app is sandboxed
1050         https://bugs.webkit.org/show_bug.cgi?id=183489
1051         <rdar://problem/38267517>
1052
1053         WebKit calls -[NSFilePromiseReceiver receivePromisedFilesAtDestination:...] with
1054         NSTemporaryDirectory() as the destination for receiving file promise drops. AppKit attempts
1055         to issue a sandbox extension for this directory, but for security reasons App Sandbox
1056         refuses to do so for NSTemporaryDirectory() itself. As a result, AppKit will call our reader
1057         block with a nil error and a valid file URL, but no file will actually exist at that URL.
1058
1059         In order for App Sandbox to grant issuing the sandbox extension needed by AppKit, we need to
1060         use some other destination directory. This patch uses FileSystem::createTemporaryDirectory()
1061         to securely create a unique temporary directory inside NSTemporaryDirectory() for use as the
1062         drop destination.
1063
1064         Reviewed by Wenson Hsieh.
1065
1066         * UIProcess/Cocoa/WebViewImpl.mm:
1067         (WebKit::WebViewImpl::performDragOperation):
1068
1069 2018-03-09  Carlos Garcia Campos  <cgarcia@igalia.com>
1070
1071         [GTK] Do not use WebKitDOMHTMLFormElement as argument of signal WebKitWebPage::will-submit-form
1072         https://bugs.webkit.org/show_bug.cgi?id=183510
1073
1074         Reviewed by Michael Catanzaro.
1075
1076         In 2.22 WebKitDOMHTMLFormElement will be deprecated in GTK+ port and won't still exist in WPE. The new
1077         JavaScript GLib API will be used to replace most of the DOM API, but a few classes will remain with a minimal
1078         API for things that can't be done with JavaScript. WebKitDOMElement will stay and will be added to WPE as well,
1079         so if we change the signal parameter to WebKitDOMElement we will be able to keep using
1080         WebKitWebPage::will-submit-form without any changes. WPE will gain this signal and the rest of the API that uses
1081         DOM.
1082
1083         * WebProcess/InjectedBundle/API/glib/WebKitWebPage.cpp:
1084         (webkit_web_page_class_init):
1085
1086 2018-03-09  Carlos Garcia Campos  <cgarcia@igalia.com>
1087
1088         Unreviewed. [GTK][WPE] Bump Since tags of resource load stats API.
1089
1090         The functionality hasn't been properly tested to be released in WebKitGTK+ 2.20.
1091
1092         * UIProcess/API/glib/WebKitWebsiteDataManager.cpp:
1093         (webkit_website_data_manager_class_init):
1094         * UIProcess/API/gtk/WebKitWebsiteData.h:
1095         * UIProcess/API/wpe/WebKitWebsiteData.h:
1096
1097 2018-03-08  Zan Dobersek  <zdobersek@igalia.com>
1098
1099         Unreviewed. Suppress GCC warnings in SystemPreviewController.cpp by
1100         using the cross-platform #include directives for header inclusion,
1101         instead of #import.
1102
1103         * UIProcess/SystemPreviewController.cpp:
1104
1105 2018-03-08  Megan Gardner  <megan_gardner@apple.com>
1106
1107         Allow WebViews to disable system appearance
1108         https://bugs.webkit.org/show_bug.cgi?id=183418
1109         <rdar://problem/36975642>
1110
1111         Reviewed by Tim Horton.
1112         
1113         Allow webviews to choose whether or not to follow the default system appearance.
1114
1115         * Shared/WebPageCreationParameters.cpp:
1116         (WebKit::WebPageCreationParameters::encode const):
1117         (WebKit::WebPageCreationParameters::decode):
1118         * Shared/WebPageCreationParameters.h:
1119         * UIProcess/API/Cocoa/WKWebView.mm:
1120         (-[WKWebView _useSystemAppearance]):
1121         (-[WKWebView _setUseSystemAppearance:]):
1122         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1123         * UIProcess/WebPageProxy.cpp:
1124         (WebKit::WebPageProxy::creationParameters):
1125         (WebKit::WebPageProxy::setUseSystemAppearance):
1126         * UIProcess/WebPageProxy.h:
1127         (WebKit::WebPageProxy::useSystemAppearance const):
1128         * WebProcess/WebPage/WebPage.cpp:
1129         (WebKit::WebPage::setUseSystemAppearance):
1130         * WebProcess/WebPage/WebPage.h:
1131         * WebProcess/WebPage/WebPage.messages.in:
1132
1133 2018-03-08  Michael Catanzaro  <mcatanzaro@igalia.com>
1134
1135         Unreviewed, speculative attempt to fix CMake build after r229426
1136         https://bugs.webkit.org/show_bug.cgi?id=183382
1137         <rdar://problem/38191450>
1138
1139         * CMakeLists.txt:
1140
1141 2018-03-08  Wenson Hsieh  <wenson_hsieh@apple.com>
1142
1143         [Extra zoom mode] Support resigning first responder status when focusing a form control
1144         https://bugs.webkit.org/show_bug.cgi?id=183477
1145         <rdar://problem/38225994>
1146
1147         Reviewed by Tim Horton.
1148
1149         Currently, when presenting an input view controller in extra zoom mode, if the web view loses first responder
1150         status, we will blur the focused element, which dismisses all focused form control UI. For certain types of form
1151         controls, this prevents the user from using key pieces of functionality.
1152
1153         To address this, disconnect the notion of first responder status from DOM element focus while the form control
1154         overlay is shown. Later, when the active input session ends, if the web content view was first responder before
1155         upon focusing the element, restore first responder status on the web view. This extra tweak is needed to ensure
1156         that certain UI affordances which require first responder status on the web view continue to work after
1157         interacting with a form control that changes the first responder.
1158
1159         * UIProcess/ios/WKContentViewInteraction.h:
1160         * UIProcess/ios/WKContentViewInteraction.mm:
1161         (-[WKContentView presentFocusedFormControlViewController:]):
1162         (-[WKContentView dismissFocusedFormControlViewController:]):
1163
1164 2018-03-08  John Wilander  <wilander@apple.com>
1165
1166         Resource Load Statistics: Revert defaults read of zero values
1167         https://bugs.webkit.org/show_bug.cgi?id=183476
1168
1169         Unreviewed revert of three small changes landed in r229427.
1170
1171         * UIProcess/Cocoa/WebResourceLoadStatisticsStoreCocoa.mm:
1172         (WebKit::WebResourceLoadStatisticsStore::registerUserDefaultsIfNeeded):
1173             Reverted back to strict check of greater than zero for defaults reads.
1174
1175 2018-03-08  Tim Horton  <timothy_horton@apple.com>
1176
1177         Don't have SafariServices in minimal simulator build
1178         https://bugs.webkit.org/show_bug.cgi?id=183436
1179         <rdar://problem/38254778>
1180
1181         Reviewed by Dan Bernstein.
1182
1183         * config.h:
1184
1185 2018-03-08  John Wilander  <wilander@apple.com>
1186
1187         Resource Load Statistics: Make debug mode always partition prevalent resources
1188         https://bugs.webkit.org/show_bug.cgi?id=183468
1189         <rdar://problem/38269437>
1190
1191         Reviewed by Brent Fulgham.
1192
1193         After some testing we decided that a 30 second timeout in ITP debug mode just makes
1194         it confusing. We should instead always partition prevalent resources in debug mode
1195         to make it easy to understand. The partitioned state is what developers want to test
1196         anyway.
1197
1198         * UIProcess/Cocoa/WebResourceLoadStatisticsStoreCocoa.mm:
1199         (WebKit::WebResourceLoadStatisticsStore::registerUserDefaultsIfNeeded):
1200             Minor change to include 0 as valid setting.
1201         * UIProcess/WebResourceLoadStatisticsStore.cpp:
1202         (WebKit::WebResourceLoadStatisticsStore::setResourceLoadStatisticsDebugMode):
1203             Now just stores the setting of debug mode instead of changing the timeout.
1204         (WebKit::WebResourceLoadStatisticsStore::logUserInteraction):
1205             Now does not disable partitioning under debug mode.
1206         (WebKit::WebResourceLoadStatisticsStore::shouldPartitionCookies const):
1207             Now returns true for prevalent resources with user interaction under debug mode.            
1208         (WebKit::WebResourceLoadStatisticsStore::updateCookiePartitioning):
1209             Removed duplicate debug logging statement.
1210         * UIProcess/WebResourceLoadStatisticsStore.h:
1211             Added member m_debugModeEnabled.
1212
1213 2018-03-08  Brent Fulgham  <bfulgham@apple.com>
1214
1215         Remove WebCookieManager and messaging from WebContent process.
1216         https://bugs.webkit.org/show_bug.cgi?id=183382
1217         <rdar://problem/38191450>
1218
1219         Reviewed by Alex Christensen.
1220
1221         Networking access was fully removed from the WebContent process in Bug 183192 (and related bugs). The
1222         UIProcess no longer needs to ask the WebContent process about networking-related things, and shouldn't
1223         waste everyone's time doing so.
1224
1225         This bug removes some left-over WebCookieManager API stuff, and is a first step in purging the
1226         WebContent Process from accessing cookie data.
1227
1228         * NetworkProcess/Cookies: Copied from WebProcess/Cookies.
1229         * NetworkProcess/Cookies/WebCookieManager.h:
1230         * WebKit.xcodeproj/project.pbxproj:
1231         * WebProcess/Cookies: Removed.
1232         * WebProcess/Cookies/WebCookieManager.cpp: Removed.
1233         * WebProcess/Cookies/WebCookieManager.h: Removed.
1234         * WebProcess/Cookies/WebCookieManager.messages.in: Removed.
1235         * WebProcess/Cookies/curl: Removed.
1236         * WebProcess/Cookies/curl/WebCookieManagerCurl.cpp: Removed.
1237         * WebProcess/Cookies/mac: Removed.
1238         * WebProcess/Cookies/mac/WebCookieManagerMac.mm: Removed.
1239         * WebProcess/Cookies/soup: Removed.
1240         * WebProcess/Cookies/soup/WebCookieManagerSoup.cpp: Removed.
1241         * WebProcess/InjectedBundle/InjectedBundle.cpp: Remove 'WebCookieManager.h" header.
1242         * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp: Ditto.
1243         * WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.mm: Ditto.
1244         * WebProcess/WebProcess.cpp:
1245         (WebKit::WebProcess::WebProcess): Remove call to add WebCookieManager as a
1246         WebProcessSupplement.
1247         * CMakeLists.txt: Revised paths.
1248         * DerivedSources.make: Ditto.
1249         * PlatformMac.cmake: Ditto.
1250         * PlatformWin.cmake: Ditto.
1251         * SourcesGTK.txt: Ditto.
1252         * SourcesWPE.txt: Ditto.
1253
1254 2018-03-08  Youenn Fablet  <youenn@apple.com>
1255
1256         libwebrtc update broke internal builds
1257         https://bugs.webkit.org/show_bug.cgi?id=183454
1258
1259         Reviewed by Eric Carlson.
1260
1261         * Configurations/BaseTarget.xcconfig:
1262
1263 2018-03-08  Youenn Fablet  <youenn@apple.com>
1264
1265         PluginInfoStore::isSupportedPlugin should check for empty mime type
1266         https://bugs.webkit.org/show_bug.cgi?id=183457
1267         <rdar://problem/38159575>
1268
1269         Reviewed by Chris Dumez.
1270
1271         * UIProcess/Plugins/PluginInfoStore.cpp:
1272         (WebKit::PluginInfoStore::isSupportedPlugin):
1273
1274 2018-03-08  Yusuke Suzuki  <utatane.tea@gmail.com>
1275
1276         [JSC][WebCore] Extend jsDynamicCast for WebCore types in WebCore and remove jsDynamicDowncast
1277         https://bugs.webkit.org/show_bug.cgi?id=183449
1278
1279         Reviewed by Mark Lam.
1280
1281         * WebProcess/Automation/WebAutomationSessionProxy.cpp:
1282         (WebKit::WebAutomationSessionProxy::elementForNodeHandle):
1283         * WebProcess/WebPage/WebFrame.cpp:
1284         (WebKit::WebFrame::frameForContext):
1285
1286 2018-03-08  Yusuke Suzuki  <utatane.tea@gmail.com>
1287
1288         [JSC] Add inherits<T>(VM&) leveraging JSCast fast path
1289         https://bugs.webkit.org/show_bug.cgi?id=183429
1290
1291         Reviewed by Mark Lam.
1292
1293         * WebProcess/Plugins/Netscape/JSNPMethod.cpp:
1294         (WebKit::callMethod):
1295         * WebProcess/Plugins/Netscape/JSNPObject.cpp:
1296         (WebKit::callNPJSObject):
1297         (WebKit::constructWithConstructor):
1298         * WebProcess/Plugins/Netscape/NPJSObject.cpp:
1299         (WebKit::NPJSObject::create):
1300         * WebProcess/WebPage/WebFrame.cpp:
1301         (WebKit::WebFrame::counterValue):
1302
1303 2018-03-08  Zan Dobersek  <zdobersek@igalia.com>
1304
1305         Remove WebCore::TextureMapperAnimation as a special case in WebKit IPC
1306         generation. Values of this type aren't being transferred across IPC.
1307
1308         Rubber-stamped by Carlos Garcia Campos.
1309
1310         * Scripts/webkit/messages.py:
1311
1312 2018-03-08  Tim Horton  <timothy_horton@apple.com>
1313
1314         Stop linking ApplicationServices directly
1315         https://bugs.webkit.org/show_bug.cgi?id=182867
1316         <rdar://problem/38252142>
1317
1318         Reviewed by Alex Christensen.
1319
1320         The frameworks that we use that live inside ApplicationServices
1321         have mostly moved out, so import them directly.
1322
1323         * Configurations/WebKit.xcconfig:
1324
1325 2018-03-08  Wenson Hsieh  <wenson_hsieh@apple.com>
1326
1327         [Extra zoom mode] Specify password mode as needed when inputting text
1328         https://bugs.webkit.org/show_bug.cgi?id=183428
1329         <rdar://problem/37609386>
1330
1331         Reviewed by Tim Horton.
1332
1333         If the focused element is a password field, or the input delegate has forced secure text entry, set a flag on
1334         the text input view controller to opt in to password text input mode.
1335
1336         * UIProcess/ios/WKContentViewInteraction.mm:
1337         (-[WKContentView presentTextInputViewController:]):
1338
1339 2018-03-07  Tim Horton  <timothy_horton@apple.com>
1340
1341         Sort and separate FeatureDefines.xcconfig
1342         https://bugs.webkit.org/show_bug.cgi?id=183427
1343
1344         Reviewed by Dan Bernstein.
1345
1346         * Configurations/FeatureDefines.xcconfig:
1347         Sort and split FeatureDefines into paragraphs
1348         (to make it easier to sort later).
1349
1350 2018-03-07  Carlos Garcia Campos  <cgarcia@igalia.com>
1351
1352         REGRESSION(r218089): [GTK] webkit_web_view_get_inspector() needs to be called, otherwise inspector does not close
1353         https://bugs.webkit.org/show_bug.cgi?id=181126
1354
1355         Reviewed by Carlos Alberto Lopez Perez.
1356
1357         Fix the condition to decide whether to detach the inspector view ourselves.
1358
1359         * UIProcess/gtk/WebInspectorProxyGtk.cpp:
1360         (WebKit::WebInspectorProxy::platformDetach): Remove the inspector view from its parent if we don't have a client
1361         or the client didn't detach it.
1362
1363 2018-03-07  Carlos Garcia Campos  <cgarcia@igalia.com>
1364
1365         [GTK][WPE] Leak checker is not working in WebKitGLib web process tests
1366         https://bugs.webkit.org/show_bug.cgi?id=183404
1367
1368         Reviewed by Michael Catanzaro.
1369
1370         Add private helper for testing to do a garbage collection when the page is closing.
1371
1372         * WebProcess/InjectedBundle/API/glib/WebKitWebExtension.cpp:
1373         (webkitWebExtensionSetGarbageCollectOnPageDestroy):
1374         * WebProcess/InjectedBundle/API/glib/WebKitWebExtensionPrivate.h:
1375         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMClientRectList.h: Fix annotation of
1376         webkit_dom_client_rect_list_item(), it should be transfer full.
1377
1378 2018-03-07  Youenn Fablet  <youenn@apple.com>
1379
1380         Match unsupported plugins based on domains and not origin
1381         https://bugs.webkit.org/show_bug.cgi?id=183384
1382
1383         Reviewed by Chris Dumez.
1384
1385         Moved from a HashMap of plugins to a Vector of plugins since we cannot match exactly based on the origin.
1386
1387         * Scripts/webkit/messages.py:
1388         * UIProcess/API/C/WKContext.cpp:
1389         (WKContextAddSupportedPlugin):
1390         * UIProcess/API/Cocoa/WKProcessPool.mm:
1391         (-[WKProcessPool _addSupportedPlugin:named:withMimeTypes:withExtensions:]):
1392         * UIProcess/Plugins/PluginInfoStore.cpp:
1393         (WebKit::PluginInfoStore::isSupportedPlugin):
1394         (WebKit::PluginInfoStore::supportedPluginNames):
1395         (WebKit::PluginInfoStore::addSupportedPlugin):
1396         * UIProcess/Plugins/PluginInfoStore.h:
1397         * UIProcess/WebProcessPool.cpp:
1398         (WebKit::WebProcessPool::addSupportedPlugin):
1399         * UIProcess/WebProcessPool.h:
1400         * UIProcess/WebProcessProxy.cpp:
1401         (WebKit::WebProcessProxy::getPlugins):
1402         * UIProcess/WebProcessProxy.h:
1403         * UIProcess/WebProcessProxy.messages.in:
1404         * WebProcess/Plugins/WebPluginInfoProvider.cpp:
1405         (WebKit::WebPluginInfoProvider::getPluginInfo):
1406         (WebKit::WebPluginInfoProvider::getWebVisiblePluginInfo):
1407         * WebProcess/Plugins/WebPluginInfoProvider.h:
1408
1409 2018-03-07  Brent Fulgham  <bfulgham@apple.com>
1410
1411         REGRESSION (r229093): Media playback on Facebook and Hulu require mDNSResponder access
1412         https://bugs.webkit.org/show_bug.cgi?id=183421
1413         <rdar://problem/38191574>
1414
1415         Reviewed by Dean Jackson.
1416
1417         CoreMedia fails to properly play back media on Facebook and Hulu if access to the
1418         mDNSResponder is blocked by the sandbox. This Bug unblocks that access while we
1419         investigate the underlying issue.
1420
1421         * WebProcess/com.apple.WebProcess.sb.in:
1422
1423 2018-03-07  Dean Jackson  <dino@apple.com>
1424
1425         Try to fix build for watchOS and tvOS.
1426
1427         * UIProcess/Cocoa/SystemPreviewControllerCocoa.mm:
1428         * UIProcess/SystemPreviewController.cpp:
1429
1430 2018-03-07  Dean Jackson  <dino@apple.com>
1431
1432         Add SystemPreviewController for showing system-level views of special file types
1433         https://bugs.webkit.org/show_bug.cgi?id=183413
1434         <rdar://problem/37800834>
1435
1436         Reviewed by Tim Horton.
1437
1438         Add a new controller class that hangs off WebPageProxy, with the goal
1439         of providing system-level viewing of some some file types. Specifically
1440         those that can't be shown by WebKit.
1441
1442         This is the initial implementation which is quite simple. The controller
1443         can be queried about whether it supports a MIME type, then it can be
1444         asked to show a URL.
1445
1446         * UIProcess/Cocoa/SystemPreviewControllerCocoa.mm: Added.
1447         (-[_WKPreviewControllerDataSource initWithURL:]):
1448         (-[_WKPreviewControllerDataSource numberOfPreviewItemsInPreviewController:]):
1449         (-[_WKPreviewControllerDataSource previewController:previewItemAtIndex:]):
1450         (WebKit::SystemPreviewController::canPreview const):
1451         (WebKit::SystemPreviewController::showPreview):
1452         * UIProcess/SystemPreviewController.cpp: Added.
1453         (WebKit::SystemPreviewController::SystemPreviewController):
1454         (WebKit::SystemPreviewController::canPreview const):
1455         (WebKit::SystemPreviewController::showPreview):
1456         * UIProcess/SystemPreviewController.h: Added.
1457         * UIProcess/WebPageProxy.cpp:
1458         (WebKit::m_configurationPreferenceValues):
1459         (WebKit::WebPageProxy::reattachToWebProcess):
1460         (WebKit::WebPageProxy::resetState):
1461         * UIProcess/WebPageProxy.h:
1462         (WebKit::WebPageProxy::systemPreviewController):
1463         * WebKit.xcodeproj/project.pbxproj:
1464
1465 2018-03-07  Alejandro G. Castro  <alex@igalia.com>
1466
1467         Make NetworkRTCResolver port agnostic
1468         https://bugs.webkit.org/show_bug.cgi?id=178855
1469
1470         Reviewed by Youenn Fablet.
1471
1472         Create a specific Cocoa class to isolate the generic code in the base class, make the base implementation port
1473         agnostic and dependent on DNS API in the platform directory which encapsulates the platform specific details.
1474
1475         * NetworkProcess/webrtc/NetworkRTCProvider.cpp: Create an alias class name defined per platform to instantiate the resolver.
1476         (WebKit::NetworkRTCProvider::createResolver): Used the alias class name and receive a new IPAddress class that is not
1477         dependent on rtc libwebrtc library.
1478         * NetworkProcess/webrtc/NetworkRTCResolver.cpp: Remove the platform specific code. Use the DNS API to implement the
1479         platform specific code in the default start and stop methods. Add the identifier of the resolve operation to the class.
1480         (WebKit::NetworkRTCResolver::NetworkRTCResolver): Add the identifier in the initialization.
1481         (WebKit::NetworkRTCResolver::~NetworkRTCResolver): Remove the platform specific code.
1482         (WebKit::NetworkRTCResolver::completed): Ditto.
1483         (WebKit::NetworkRTCResolver::start): Add a new implementation using the DNS API.
1484         (WebKit::NetworkRTCResolver::stop): Ditto
1485         * NetworkProcess/webrtc/NetworkRTCResolver.h: Remove the platform specific code and use the DNSResolveQueue for a general
1486         solution to implement the platform specific code. Avoid using the IPAddress class that depends on libwertc classes to make
1487         it more general regarding DNS name resolution.
1488         (WebKit::NetworkRTCResolver::start): Make this class virtual.
1489         (WebKit::NetworkRTCResolver::stop): Ditto.
1490         * NetworkProcess/webrtc/NetworkRTCResolverCocoa.cpp: Copied Cocoa code from Source/WebKit/NetworkProcess/webrtc/NetworkRTCResolver.cpp.
1491         Now this class overrides the start and stop methods that use DNS, cocoa implementation should use the DNS methods in the future and
1492         remove this class, making sure all the platform specific class is in the platform directory.
1493         * NetworkProcess/webrtc/NetworkRTCResolverCocoa.h: Copied Cocoa code from Source/WebKit/NetworkProcess/webrtc/NetworkRTCResolver.h.
1494         * PlatformGTK.cmake: Add NetworkRTCResolver compilation for GTK.
1495         * WebKit.xcodeproj/project.pbxproj: Add the NetworkRTCResolverCocoa class to the compilation.
1496
1497 2018-03-06  Brent Fulgham  <bfulgham@apple.com>
1498
1499         NetworkDataTask should enable logging for automation clients
1500         https://bugs.webkit.org/show_bug.cgi?id=183378
1501         <rdar://problem/38189556>
1502
1503         Reviewed by Brian Burg.
1504
1505         The NetworkDataTaskCocoa class was only logging if the SessionID object allowed logging.
1506         It should also be considering whether the current session is working on behalf of an
1507         automation client. If so, it should allow logging.
1508
1509         * NetworkProcess/cocoa/NetworkDataTaskCocoa.h:
1510         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
1511         (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa):
1512         (WebKit::NetworkDataTaskCocoa::willPerformHTTPRedirection):
1513         (WebKit::NetworkDataTaskCocoa::isAlwaysOnLoggingAllowed const):
1514
1515 2018-03-06  Ryan Haddad  <ryanhaddad@apple.com>
1516
1517         Unreviewed build fix.
1518
1519         * UIProcess/ios/WKFullScreenWindowControllerIOS.mm:
1520         (-[WKFullScreenWindowController _EVOrganizationName]):
1521
1522 2018-03-06  Antoine Quint  <graouts@apple.com>
1523
1524         [Web Animations] Add a new runtime flag to control whether CSS Animations and CSS Transitions should run using the Web Animations timeline
1525         https://bugs.webkit.org/show_bug.cgi?id=183370
1526         <rdar://problem/38180729>
1527
1528         Reviewed by Dean Jackson.
1529
1530         Before we start creating WebAnimation objects to perform CSS Animations and CSS Transitions, which will replace the existing codepath
1531         involving CSSAnimationController and CompositeAnimation, we need a runtime flag that will allow all the new code to be turned off by
1532         default while we bring this feature up.
1533
1534         * Shared/WebPreferences.yaml:
1535         * UIProcess/API/C/WKPreferences.cpp:
1536         (WKPreferencesSetCSSAnimationsAndCSSTransitionsBackedByWebAnimationsEnabled):
1537         (WKPreferencesGetCSSAnimationsAndCSSTransitionsBackedByWebAnimationsEnabled):
1538         * UIProcess/API/C/WKPreferencesRefPrivate.h:
1539         * UIProcess/API/Cocoa/WKPreferences.mm:
1540         (-[WKPreferences _setCSSAnimationsAndCSSTransitionsBackedByWebAnimationsEnabled:]):
1541         (-[WKPreferences _cssAnimationsAndCSSTransitionsBackedByWebAnimationsEnabled]):
1542         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
1543         * WebProcess/InjectedBundle/InjectedBundle.cpp:
1544         (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner):
1545         (WebKit::InjectedBundle::setCSSAnimationsAndCSSTransitionsBackedByWebAnimationsEnabled):
1546         * WebProcess/InjectedBundle/InjectedBundle.h:
1547
1548 2018-03-06  Ms2ger  <Ms2ger@igalia.com>
1549
1550         [GLib] Implement WebsiteDataStore::defaultServiceWorkerRegistrationDirectory().
1551         https://bugs.webkit.org/show_bug.cgi?id=183364
1552
1553         Reviewed by Michael Catanzaro.
1554
1555         * UIProcess/API/glib/APIWebsiteDataStoreGLib.cpp:
1556         (API::WebsiteDataStore::defaultServiceWorkerRegistrationDirectory): implement.
1557
1558 2018-03-06  Zan Dobersek  <zdobersek@igalia.com>
1559
1560         Unreviewed. Addressing further review feedback for patch landed in r229315.
1561
1562         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
1563         (WebKit::CoordinatedGraphicsScene::commitSceneState): There's no need for
1564         explicit calls of the clear() method on both containers in the CommitScope
1565         objects, the destructors invoked for these objects from the CommitScope
1566         destructor will have the same effect.
1567
1568 2018-03-06  Zan Dobersek  <zdobersek@igalia.com>
1569
1570         [CoordGraphics] Remove unused scrolling-related code in TextureMapperLayer, CoordinatedGraphics stack
1571         https://bugs.webkit.org/show_bug.cgi?id=183340
1572
1573         Reviewed by Michael Catanzaro.
1574
1575         With most of the scrolling-related code in TextureMapperLayer on the
1576         chopping block, we can now drop the ScrollingClient inheritance and the
1577         commitScrollOffset() virtual method implementation. This enables
1578         removing the whole commitScrollOffset() call chain that ran from
1579         CoordinatedGraphicsScene through CoordinatedLayerTreeHost and
1580         CompositingCoordinator to the affected CoordinatedGraphicsLayer object.
1581
1582         The CoordinatedGraphicsScene::findScrollableContentsLayerAt() method is
1583         also unused and can be deleted.
1584
1585         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
1586         (WebKit::CoordinatedGraphicsScene::setLayerState):
1587         (WebKit::CoordinatedGraphicsScene::createLayer):
1588         (WebKit::CoordinatedGraphicsScene::commitScrollOffset): Deleted.
1589         (WebKit::CoordinatedGraphicsScene::findScrollableContentsLayerAt): Deleted.
1590         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.h:
1591         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
1592         (WebKit::ThreadedCompositor::commitScrollOffset): Deleted.
1593         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h:
1594         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp:
1595         (WebKit::CompositingCoordinator::commitScrollOffset): Deleted.
1596         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.h:
1597         * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp:
1598         (WebKit::CoordinatedLayerTreeHost::commitScrollOffset): Deleted.
1599         * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h:
1600         * WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.h:
1601
1602 2018-03-06  Zan Dobersek  <zdobersek@igalia.com>
1603
1604         [CoordGraphics] Apply TextureMapperLayer animations with a single MonotonicTime value
1605         https://bugs.webkit.org/show_bug.cgi?id=183360
1606
1607         Reviewed by Sergio Villar Senin.
1608
1609         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
1610         (WebKit::CoordinatedGraphicsScene::paintToCurrentGLContext):
1611         Pass the monotic time value, as returned by MonotonicTime::now(), to the
1612         TextureMapperLayer::applyAnimationsRecursively() call.
1613
1614 2018-03-06  Zan Dobersek  <zdobersek@igalia.com>
1615
1616         [CoordGraphics] Clean up CoordinatedImageBacking
1617         https://bugs.webkit.org/show_bug.cgi?id=183332
1618
1619         Reviewed by Carlos Garcia Campos.
1620
1621         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp:
1622         (WebKit::CompositingCoordinator::createImageBackingIfNeeded):
1623         Adjust call to CoordinatedImageBacking::getCoordinatedImageBackingID().
1624
1625 2018-03-06  Zan Dobersek  <zdobersek@igalia.com>
1626
1627         CoordinatedGraphicsScene: properly limit data specific to state commit operation
1628         https://bugs.webkit.org/show_bug.cgi?id=183326
1629
1630         Reviewed by Sergio Villar Senin.
1631
1632         In the process of state commit in CoordinatedGraphicsScene, the released
1633         image backings and backing stores with pending updates are stored in
1634         Vector and HashSet objects, respectively. Instead of these two objects
1635         being member variables on the CoordinatedGraphicsScene class, keep them
1636         in the CommitScope structure that's limited to the operations done in
1637         the commitSceneState() method.
1638
1639         The two member variables are dropped, and the CommitScope object is
1640         passed by reference to any helper method that needs to append either
1641         kind of object to the respective container. At the end of the state
1642         commit, backing stores with pending updates have those updates applied,
1643         and the two containers are cleared out as the CommitScope object is
1644         destroyed.
1645
1646         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
1647         (WebKit::CoordinatedGraphicsScene::setLayerState):
1648         (WebKit::CoordinatedGraphicsScene::prepareContentBackingStore):
1649         (WebKit::CoordinatedGraphicsScene::resetBackingStoreSizeToLayerSize):
1650         (WebKit::CoordinatedGraphicsScene::removeTilesIfNeeded):
1651         (WebKit::CoordinatedGraphicsScene::updateTilesIfNeeded):
1652         (WebKit::CoordinatedGraphicsScene::syncImageBackings):
1653         (WebKit::CoordinatedGraphicsScene::updateImageBacking):
1654         (WebKit::CoordinatedGraphicsScene::clearImageBackingContents):
1655         (WebKit::CoordinatedGraphicsScene::removeImageBacking):
1656         (WebKit::CoordinatedGraphicsScene::commitSceneState):
1657         (WebKit::CoordinatedGraphicsScene::purgeGLResources):
1658         (WebKit::CoordinatedGraphicsScene::removeReleasedImageBackingsIfNeeded): Deleted.
1659         (WebKit::CoordinatedGraphicsScene::commitPendingBackingStoreOperations): Deleted.
1660         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.h:
1661
1662 2018-03-05  Yusuke Suzuki  <utatane.tea@gmail.com>
1663
1664         Fix std::make_unique / new[] using system malloc
1665         https://bugs.webkit.org/show_bug.cgi?id=182975
1666
1667         Reviewed by JF Bastien.
1668
1669         Use Vector instead.
1670
1671         * NetworkProcess/win/SystemProxyWin.cpp:
1672         (WindowsSystemProxy::getSystemHttpProxy):
1673         * Platform/IPC/unix/ConnectionUnix.cpp:
1674         (IPC::Connection::processMessage):
1675         (IPC::Connection::sendOutputMessage):
1676         * Platform/win/LoggingWin.cpp:
1677         (WebKit::logLevelString):
1678         * Shared/SandboxExtension.h:
1679         * Shared/mac/SandboxExtensionMac.mm:
1680         (WebKit::SandboxExtension::HandleArray::allocate):
1681         (WebKit::SandboxExtension::HandleArray::operator[]):
1682         (WebKit::SandboxExtension::HandleArray::operator[] const):
1683         (WebKit::SandboxExtension::HandleArray::size const):
1684         (WebKit::SandboxExtension::HandleArray::encode const):
1685
1686 2018-03-05  Andy Estes  <aestes@apple.com>
1687
1688         [Mac] Teach WebCore::Pasteboard about file promise drags
1689         https://bugs.webkit.org/show_bug.cgi?id=183314
1690         <rdar://problem/38105493>
1691
1692         Reviewed by Darin Adler.
1693
1694         Added a FIXME comment.
1695
1696         * UIProcess/Cocoa/WebViewImpl.mm:
1697         (WebKit::WebViewImpl::performDragOperation):
1698
1699 2018-03-05  Jeff Miller  <jeffm@apple.com>
1700
1701         Expose still more WKPreferences SPI to match C SPI
1702         https://bugs.webkit.org/show_bug.cgi?id=183045
1703
1704         Reviewed by Alex Christensen.
1705
1706         * UIProcess/API/Cocoa/WKPreferences.mm:
1707         (-[WKPreferences _setAllowsInlineMediaPlayback:]):
1708         (-[WKPreferences _allowsInlineMediaPlayback]):
1709         (-[WKPreferences _setApplePayEnabled:]):
1710         (-[WKPreferences _applePayEnabled]):
1711         (-[WKPreferences _setDNSPrefetchingEnabled:]):
1712         (-[WKPreferences _dnsPrefetchingEnabled]):
1713         (-[WKPreferences _setInlineMediaPlaybackRequiresPlaysInlineAttribute:]):
1714         (-[WKPreferences _inlineMediaPlaybackRequiresPlaysInlineAttribute]):
1715         (-[WKPreferences _setInvisibleMediaAutoplayNotPermitted:]):
1716         (-[WKPreferences _invisibleMediaAutoplayNotPermitted]):
1717         (-[WKPreferences _setLegacyEncryptedMediaAPIEnabled:]):
1718         (-[WKPreferences _legacyEncryptedMediaAPIEnabled]):
1719         (-[WKPreferences _setMainContentUserGestureOverrideEnabled:]):
1720         (-[WKPreferences _mainContentUserGestureOverrideEnabled]):
1721         (-[WKPreferences _setMediaStreamEnabled:]):
1722         (-[WKPreferences _mediaStreamEnabled]):
1723         (-[WKPreferences _setNeedsStorageAccessFromFileURLsQuirk:]):
1724         (-[WKPreferences _needsStorageAccessFromFileURLsQuirk]):
1725         (-[WKPreferences _setPDFPluginEnabled:]):
1726         (-[WKPreferences _pdfPluginEnabled]):
1727         (-[WKPreferences _setRequiresUserGestureForAudioPlayback:]):
1728         (-[WKPreferences _requiresUserGestureForAudioPlayback]):
1729         (-[WKPreferences _setRequiresUserGestureForVideoPlayback:]):
1730         (-[WKPreferences _requiresUserGestureForVideoPlayback]):
1731         (-[WKPreferences _setServiceControlsEnabled:]):
1732         (-[WKPreferences _serviceControlsEnabled]):
1733         (-[WKPreferences _setShowsToolTipOverTruncatedText:]):
1734         (-[WKPreferences _showsToolTipOverTruncatedText]):
1735         (-[WKPreferences _setTextAreasAreResizable:]):
1736         (-[WKPreferences _textAreasAreResizable]):
1737         (-[WKPreferences _setUseGiantTiles:]):
1738         (-[WKPreferences _useGiantTiles]):
1739         (-[WKPreferences _setWantsBalancedSetDefersLoadingBehavior:]):
1740         (-[WKPreferences _wantsBalancedSetDefersLoadingBehavior]):
1741         (-[WKPreferences _setWebAudioEnabled:]):
1742         (-[WKPreferences _webAudioEnabled]):
1743         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
1744
1745 2018-03-05  Carlos Garcia Campos  <cgarcia@igalia.com>
1746
1747         Automation: clicking on a disabled option element shouldn't produce an error
1748         https://bugs.webkit.org/show_bug.cgi?id=183284
1749
1750         Reviewed by Brian Burg.
1751
1752         This was expected by selenium, but the WebDriver spec says we should simply do nothing in those cases.
1753
1754         14.1 Element Click.
1755         https://w3c.github.io/webdriver/webdriver-spec.html#element-click
1756
1757         Fixes: imported/w3c/webdriver/tests/element_click/select.py::test_option_disabled
1758
1759         * WebProcess/Automation/WebAutomationSessionProxy.cpp:
1760         (WebKit::WebAutomationSessionProxy::selectOptionElement):
1761
1762 2018-03-05  Carlos Garcia Campos  <cgarcia@igalia.com>
1763
1764         Automation: stale elements not detected when removed from the DOM
1765         https://bugs.webkit.org/show_bug.cgi?id=183278
1766
1767         Reviewed by Brian Burg.
1768
1769         We detect stale elements when the page is reloaded because the maps are recreated, but if an element is removed
1770         from the DOM for the same document we keep the nodes in the maps. We should clear stale elements before
1771         accessing the maps.
1772
1773         Fixes: imported/selenium/py/test/selenium/webdriver/common/webdriverwait_tests.py::testExpectedConditionStalenessOf
1774
1775         * WebProcess/Automation/WebAutomationSessionProxy.js:
1776         (let.AutomationSessionProxy.prototype.evaluateJavaScriptFunction): Call _clearStaleNodes()
1777         (let.AutomationSessionProxy.prototype.nodeForIdentifier): Ditto.
1778         (let.AutomationSessionProxy.prototype._clearStaleNodes): Check if cached nodes are still in document and remove them
1779         from the maps if they aren't.
1780
1781 2018-03-04  Yusuke Suzuki  <utatane.tea@gmail.com>
1782
1783         [WTF] Move currentCPUTime and sleep(Seconds) to CPUTime.h and Seconds.h respectively
1784         https://bugs.webkit.org/show_bug.cgi?id=183312
1785
1786         Reviewed by Mark Lam.
1787
1788         Remove wtf/CurrentTime.h include pragma.
1789
1790         * NetworkProcess/NetworkResourceLoader.cpp:
1791         * NetworkProcess/cache/CacheStorageEngineCache.cpp:
1792         * NetworkProcess/cache/NetworkCacheSpeculativeLoad.cpp:
1793         * Platform/IPC/Connection.cpp:
1794         * Platform/unix/SharedMemoryUnix.cpp:
1795         * PluginProcess/WebProcessConnection.cpp:
1796         * Shared/ios/NativeWebTouchEventIOS.mm:
1797         * UIProcess/DrawingAreaProxyImpl.cpp:
1798         * UIProcess/ios/WKContentView.mm:
1799         * UIProcess/linux/MemoryPressureMonitor.cpp:
1800         * WebProcess/Gamepad/WebGamepad.cpp:
1801         * WebProcess/Plugins/PDF/PDFPlugin.mm:
1802         * WebProcess/WebCoreSupport/WebInspectorClient.cpp:
1803         * WebProcess/WebPage/RemoteLayerTree/PlatformCAAnimationRemote.mm:
1804         * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.cpp:
1805         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDisplayRefreshMonitor.mm:
1806         * WebProcess/WebPage/WebURLSchemeTaskProxy.cpp:
1807         * WebProcess/WebProcess.cpp:
1808         * WebProcess/cocoa/WebProcessCocoa.mm:
1809         * WebProcess/gtk/WebProcessMainGtk.cpp:
1810         * WebProcess/win/WebProcessMainWin.cpp:
1811         * WebProcess/wpe/WebProcessMainWPE.cpp:
1812
1813 2018-03-02  Brian Burg  <bburg@apple.com>
1814
1815         Web Automation: script evaluations via WebDriver should have a user gesture indicator
1816         https://bugs.webkit.org/show_bug.cgi?id=183230
1817         <rdar://problem/37959739>
1818
1819         Reviewed by Andy Estes.
1820
1821         APIs that normally require a user gesture should just work when using via WebDriver.
1822         To support cases where tests need to simulate user actions with JavaScript, use a
1823         fake user gesture, similar to how -[WKWebView evaluateJavaScript:] forces a user
1824         gesture when clients evaluate JavaScript in their web view.
1825
1826         No new tests, this is covered by W3C tests that use the Fullscreen API.
1827         This API does nothing if there is no user gesture; with this patch, it just works.
1828
1829         * WebProcess/Automation/WebAutomationSessionProxy.cpp:
1830         (WebKit::WebAutomationSessionProxy::evaluateJavaScriptFunction):
1831
1832 2018-03-04  Tim Horton  <timothy_horton@apple.com>
1833
1834         Make !ENABLE(DATA_DETECTION) iOS build actually succeed
1835         https://bugs.webkit.org/show_bug.cgi?id=183283
1836         <rdar://problem/38062148>
1837
1838         Reviewed by Sam Weinig.
1839
1840         * UIProcess/ios/WKContentViewInteraction.mm:
1841         (-[WKContentView _interactionShouldBeginFromPreviewItemController:forPosition:]):
1842         (-[WKContentView _dataForPreviewItemController:atPosition:type:]):
1843         Guard some more code with ENABLE(DATA_DETECTION).
1844
1845 2018-03-04  Dan Bernstein  <mitz@apple.com>
1846
1847         Building with ONLY_ACTIVE_ARCH=NO and ARCHS=x86_64 fails
1848         https://bugs.webkit.org/show_bug.cgi?id=183320
1849
1850         Reviewed by Tim Horton.
1851
1852         * Configurations/PluginService.32.xcconfig: If the Apple build tool specifies
1853           RC_ARCHS=x86_64, then let the service build for x86_64, but don’t install it.
1854
1855 2018-03-03  Brent Fulgham  <bfulgham@apple.com>
1856
1857         Notify the NetworkProcess when a session is servicing an automation client
1858         https://bugs.webkit.org/show_bug.cgi?id=183306
1859         <rdar://problem/37835783>
1860
1861         Reviewed by Brian Burg.
1862
1863         Network loads servicing WebDriver are done through an ephemeral session. While this is great
1864         for protecting a developer's machine from sharing state with test runs, it has the unintended
1865         effect of blocking certain logging operations.
1866
1867         We do not log content in ephemeral sessions to protect user privacy. However, ephemeral sessions
1868         generated by WebDriver should participate in logging so that proper testing (with logging) can
1869         be done.
1870
1871         This patch signals the NetworkProcess when an ephemeral session (created for automation purposes)
1872         is created, so that it can allow logging.
1873
1874         * NetworkProcess/NetworkProcess.cpp:
1875         (WebKit::NetworkProcess::destroySession): Remove controlled-by-automation entry.
1876         (WebKit::NetworkProcess::sessionIsControlledByAutomation const): Added.
1877         (WebKit::NetworkProcess::setSessionIsControlledByAutomation): Added.
1878         * NetworkProcess/NetworkProcess.h:
1879         * NetworkProcess/NetworkProcess.messages.in:
1880         * NetworkProcess/NetworkResourceLoader.cpp:
1881         (WebKit::NetworkResourceLoader::isAlwaysOnLoggingAllowed const): Checks if the relevant session
1882         is servicing an automation client, and returns true if it is.
1883         * UIProcess/WebPageProxy.cpp:
1884         (WebKit::WebPageProxy::WebPageProxy): Signal the network process if this page is being created
1885         for an automation client.
1886
1887 2018-03-02  Yusuke Suzuki  <utatane.tea@gmail.com>
1888
1889         [WTF] Remove RunLoop and RunLoop::Timer's interface using double as seconds
1890         https://bugs.webkit.org/show_bug.cgi?id=183293
1891
1892         Reviewed by Alex Christensen.
1893
1894         * Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.cpp:
1895         (WebKit::CompositingRunLoop::scheduleUpdate):
1896         (WebKit::CompositingRunLoop::compositionCompleted):
1897         (WebKit::CompositingRunLoop::updateCompleted):
1898         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedDisplayRefreshMonitor.cpp:
1899         (WebKit::ThreadedDisplayRefreshMonitor::dispatchDisplayRefreshCallback):
1900
1901 2018-03-02  Don Olmstead  <don.olmstead@sony.com>
1902
1903         Share common WebError implementation
1904         https://bugs.webkit.org/show_bug.cgi?id=183303
1905
1906         Reviewed by Ryosuke Niwa.
1907
1908         * Shared/WebErrors.cpp:
1909         (WebKit::cancelledError):
1910         (WebKit::fileDoesNotExistError):
1911         * Shared/glib/WebErrorsGlib.cpp: Removed.
1912         * SourcesGTK.txt:
1913         * SourcesWPE.txt:
1914
1915 2018-03-02  Youenn Fablet  <youenn@apple.com>
1916
1917         LayoutTest imported/w3c/web-platform-tests/service-workers/service-worker/fetch-event-within-sw.https.html is a flaky failure
1918         https://bugs.webkit.org/show_bug.cgi?id=179248
1919         <rdar://problem/35377756>
1920
1921         Reviewed by Chris Dumez.
1922
1923         In case we go up to the initializeSize step and Caches was cleared
1924         between the time we stated to initialize and the time we got there,
1925         we need to make as if Caches was not initialized,
1926         thus keeping m_isInitialized to false and m_storage to nullptr.
1927
1928         * NetworkProcess/cache/CacheStorageEngineCaches.cpp:
1929         (WebKit::CacheStorage::Caches::initializeSize):
1930
1931 2018-03-02  Youenn Fablet  <youenn@apple.com>
1932
1933         Clients should register to StorageProcess with their service worker registration identifier
1934         https://bugs.webkit.org/show_bug.cgi?id=182313
1935         <rdar://problem/38044403>
1936
1937         Reviewed by Chris Dumez.
1938
1939         Relanding.
1940
1941         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
1942         (WebKit::WebSWServerConnection::registerServiceWorkerClient):
1943         * StorageProcess/ServiceWorker/WebSWServerConnection.h:
1944         * StorageProcess/ServiceWorker/WebSWServerConnection.messages.in:
1945         * WebProcess/Storage/WebSWClientConnection.cpp:
1946         (WebKit::WebSWClientConnection::registerServiceWorkerClient):
1947         * WebProcess/Storage/WebSWClientConnection.h:
1948
1949 2018-03-02  Tim Horton  <timothy_horton@apple.com>
1950
1951         Make it possible to disable WKPDFView
1952         https://bugs.webkit.org/show_bug.cgi?id=183281
1953         <rdar://problem/38060815>
1954
1955         Reviewed by Dan Bates.
1956
1957         * UIProcess/API/Cocoa/WKWebView.mm:
1958         (-[WKWebView _isBackground]):
1959         (-[WKWebView _isDisplayingPDF]):
1960         (-[WKWebView _dataForDisplayedPDF]):
1961         (-[WKWebView _suggestedFilenameForDisplayedPDF]):
1962         * UIProcess/Cocoa/WKWebViewContentProviderRegistry.mm:
1963         (-[WKWebViewContentProviderRegistry init]):
1964         * UIProcess/ios/WKPDFView.h:
1965         * UIProcess/ios/WKPDFView.mm:
1966
1967 2018-03-02  Youenn Fablet  <youenn@apple.com>
1968
1969         WebProcessProxy should handle its completion handler at destruction time
1970         https://bugs.webkit.org/show_bug.cgi?id=183224
1971
1972         Reviewed by Brady Eidson.
1973
1974         * UIProcess/WebProcessProxy.cpp:
1975         (WebKit::WebProcessProxy::~WebProcessProxy):
1976         * UIProcess/WebProcessProxy.h:
1977
1978 2018-03-02  Brent Fulgham  <bfulgham@apple.com>
1979
1980         Update WebContent process sandbox IOKit properties
1981         https://bugs.webkit.org/show_bug.cgi?id=183269
1982         <rdar://problem/37853282>
1983
1984         Reviewed by Eric Carlson.
1985
1986         * WebProcess/com.apple.WebProcess.sb.in:
1987
1988 2018-03-01  Yusuke Suzuki  <utatane.tea@gmail.com>
1989
1990         Remove monotonicallyIncreasingTime
1991         https://bugs.webkit.org/show_bug.cgi?id=182911
1992
1993         Reviewed by Michael Catanzaro.
1994
1995         * NetworkProcess/cache/CacheStorageEngineCache.cpp:
1996         (WebKit::CacheStorage::Cache::toRecordInformation):
1997         * Platform/IPC/ArgumentCoders.cpp:
1998         (IPC::ArgumentCoder<Seconds>::encode):
1999         (IPC::ArgumentCoder<Seconds>::decode):
2000         (IPC::ArgumentCoder<MonotonicTime>::encode):
2001         (IPC::ArgumentCoder<MonotonicTime>::decode):
2002         * Platform/IPC/ArgumentCoders.h:
2003         * Shared/Gamepad/GamepadData.cpp:
2004         (WebKit::GamepadData::GamepadData):
2005         * Shared/Gamepad/GamepadData.h:
2006         (WebKit::GamepadData::lastUpdateTime const):
2007         * Shared/WebCoreArgumentCoders.cpp:
2008         (IPC::ArgumentCoder<MonotonicTime>::encode): Deleted.
2009         (IPC::ArgumentCoder<MonotonicTime>::decode): Deleted.
2010         (IPC::ArgumentCoder<Seconds>::encode): Deleted.
2011         (IPC::ArgumentCoder<Seconds>::decode): Deleted.
2012         ArgumentCoders for MonotonicTime and Seconds are now used internally.
2013         Move them to Platform/IPC/ArgumentCoders.h.
2014
2015         * Shared/WebCoreArgumentCoders.h:
2016         * UIProcess/API/glib/IconDatabase.cpp:
2017         (WebKit::IconDatabase::iconDatabaseSyncThread):
2018         * UIProcess/DrawingAreaProxyImpl.cpp:
2019         (WebKit::DrawingAreaProxyImpl::DrawingMonitor::start):
2020         (WebKit::DrawingAreaProxyImpl::DrawingMonitor::stop):
2021         (WebKit::DrawingAreaProxyImpl::DrawingMonitor::didDraw):
2022         * UIProcess/DrawingAreaProxyImpl.h:
2023         * UIProcess/Gamepad/UIGamepad.h:
2024         * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.h:
2025         * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm:
2026         (WebKit::RemoteLayerTreeDrawingAreaProxy::acceleratedAnimationDidStart):
2027         * UIProcess/RemoteLayerTree/RemoteLayerTreeHost.h:
2028         * UIProcess/RemoteLayerTree/RemoteLayerTreeHost.mm:
2029         (WebKit::RemoteLayerTreeHost::animationDidStart):
2030         * WebProcess/WebPage/DrawingArea.h:
2031         (WebKit::DrawingArea::acceleratedAnimationDidStart):
2032         * WebProcess/WebPage/DrawingArea.messages.in:
2033         * WebProcess/WebPage/RemoteLayerTree/PlatformCAAnimationRemote.h:
2034         * WebProcess/WebPage/RemoteLayerTree/PlatformCAAnimationRemote.mm:
2035         (mediaTimeToCurrentTime):
2036         (-[WKAnimationDelegate animationDidStart:]):
2037         * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.cpp:
2038         (WebKit::PlatformCALayerRemote::animationStarted):
2039         This argument `beginTime` is not CFTimeInverval actually. We add currentTimeToMediaTime
2040         conversion here to fix this issue.
2041
2042         * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.h:
2043         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeContext.h:
2044         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeContext.mm:
2045         (WebKit::RemoteLayerTreeContext::animationDidStart):
2046         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.h:
2047         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
2048         (WebKit::RemoteLayerTreeDrawingArea::acceleratedAnimationDidStart):
2049         * WebProcess/cocoa/WebProcessCocoa.mm:
2050         (WebKit::WebProcess::destroyRenderingResources):
2051
2052 2018-03-02  Brent Fulgham  <bfulgham@apple.com>
2053
2054         [iOS] whitelist missing AppleJPEG logging feature
2055         https://bugs.webkit.org/show_bug.cgi?id=183270
2056         <rdar://problem/37808612>
2057
2058         Reviewed by Alex Christensen.
2059
2060         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
2061
2062 2018-03-02  Youenn Fablet  <youenn@apple.com>
2063
2064         IOChannel::read and IOChannel::write can destroy the completion handler in the thread used to manipulate thread
2065         https://bugs.webkit.org/show_bug.cgi?id=183261
2066
2067         Reviewed by Antti Koivisto.
2068
2069         Moving the completion handler when being called so that it gets desttroyed in the thread it is called.
2070
2071         * NetworkProcess/cache/NetworkCacheIOChannelCocoa.mm:
2072         (WebKit::NetworkCache::IOChannel::read):
2073         (WebKit::NetworkCache::IOChannel::write):
2074
2075 2018-03-02  Dan Bernstein  <mitz@apple.com>
2076
2077         Safari uses WebContent.Development when loading injected bundle embedded in its app bundle
2078         https://bugs.webkit.org/show_bug.cgi?id=183275
2079
2080         Reviewed by Tim Horton.
2081
2082         * UIProcess/mac/WebProcessProxyMac.mm:
2083         (WebKit::WebProcessProxy::shouldAllowNonValidInjectedCode const): Return false if this is
2084           a platform binary. We can also return false unconditionally when building for any shipping
2085           major macOS release.
2086
2087 2018-03-01  Commit Queue  <commit-queue@webkit.org>
2088
2089         Unreviewed, rolling out r229153.
2090         https://bugs.webkit.org/show_bug.cgi?id=183274
2091
2092         it is breaking imported/w3c/web-platform-tests/service-workers
2093         /service-worker/clients-matchall-exact-controller.https.html
2094         (Requested by youenn on #webkit).
2095
2096         Reverted changeset:
2097
2098         "Clients should register to StorageProcess with their service
2099         worker registration identifier"
2100         https://bugs.webkit.org/show_bug.cgi?id=182313
2101         https://trac.webkit.org/changeset/229153
2102
2103 2018-03-01  Brent Fulgham  <bfulgham@apple.com>
2104
2105         Add the "com.apple.security.cs.disable-library-validation” entitlement to the Plugin Process
2106         https://bugs.webkit.org/show_bug.cgi?id=183252
2107         <rdar://problem/37887136>
2108
2109         Reviewed by David Kilzer.
2110
2111         * Configurations/PluginService.entitlements:
2112
2113 2018-03-01  Youenn Fablet  <youenn@apple.com>
2114
2115         Clients should register to StorageProcess with their service worker registration identifier
2116         https://bugs.webkit.org/show_bug.cgi?id=182313
2117
2118         Reviewed by Chris Dumez.
2119
2120         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
2121         (WebKit::WebSWServerConnection::registerServiceWorkerClient):
2122         * StorageProcess/ServiceWorker/WebSWServerConnection.h:
2123         * StorageProcess/ServiceWorker/WebSWServerConnection.messages.in:
2124         * WebProcess/Storage/WebSWClientConnection.cpp:
2125         (WebKit::WebSWClientConnection::registerServiceWorkerClient):
2126         * WebProcess/Storage/WebSWClientConnection.h:
2127
2128 2018-03-01  Youenn Fablet  <youenn@apple.com>
2129
2130         LayoutTest imported/w3c/web-platform-tests/service-workers/service-worker/fetch-event-within-sw.https.html is a flaky failure
2131         https://bugs.webkit.org/show_bug.cgi?id=179248
2132         <rdar://problem/35377756>
2133
2134         Reviewed by Chris Dumez.
2135
2136         WebKitTestRunner is clearing caches for every test but there might still be some on-going cache activity due to a previous test.
2137         In that case, the activity might try to open the Caches object at the same time the files are deleted by the clearing task.
2138         If the new test is trying to open the same caches, it will also receive the same error, hence the console log message.
2139
2140         To fix that issue, we clear the initialization pending callbacks when clearing the caches.
2141         This prevents the new test to receive the error since the new test should only start some cache activity after the cache clear task is done.
2142         Made refactoring to append the first callback into the list of pending callbacks.
2143
2144         * NetworkProcess/cache/CacheStorageEngineCaches.cpp:
2145         (WebKit::CacheStorage::Caches::initialize):
2146         (WebKit::CacheStorage::Caches::initializeSize):
2147         (WebKit::CacheStorage::Caches::clear):
2148         * NetworkProcess/cache/CacheStorageEngineCaches.h:
2149
2150 2018-03-01  Youenn Fablet  <youenn@apple.com>
2151
2152         Add API test to validate setting of service worker and cache storage directories
2153         https://bugs.webkit.org/show_bug.cgi?id=182543
2154
2155         Reviewed by Chris Dumez.
2156
2157         Add cache engine directory path to its representation dump.
2158         This is used in API tests to check that the path is correctly set.
2159
2160         Add a way for to know whether a service worker was registered from a WKWebsiteDataStore.
2161         This is used in API tests to check that the path is correctly set.
2162
2163         * NetworkProcess/cache/CacheStorageEngine.cpp:
2164         (WebKit::CacheStorage::Engine::representation):
2165         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
2166         (-[WKWebsiteDataStore _hasRegisteredServiceWorker]):
2167         * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
2168
2169 2018-03-01  Wenson Hsieh  <wenson_hsieh@apple.com>
2170
2171         Fix some errors due to some mach port APIs being unavailable on watchOS
2172         https://bugs.webkit.org/show_bug.cgi?id=183262
2173         <rdar://problem/38028521>
2174
2175         Reviewed by Tim Horton.
2176
2177         Minor build fix; mach_port_guard and mach_port_unguard are not available on this platform.
2178
2179         * Platform/IPC/mac/ConnectionMac.mm:
2180         (IPC::Connection::platformInvalidate):
2181         (IPC::Connection::platformInitialize):
2182         (IPC::Connection::open):
2183
2184 2018-03-01  Per Arne Vollan  <pvollan@apple.com>
2185
2186         Unreviewed build fix after r229140.
2187
2188         * WebProcess/cocoa/WebProcessCocoa.mm:
2189
2190 2018-03-01  Per Arne Vollan  <pvollan@apple.com>
2191
2192         Scrollbar preferences are ignored when the WebContent process doesn't have access to the WindowServer.
2193         https://bugs.webkit.org/show_bug.cgi?id=183231
2194         <rdar://problem/37793457>
2195
2196         Reviewed by Brent Fulgham.
2197
2198         When the WebContent process doesn't have access to the WindowServer, the scrollbars are always of the overlay type.
2199         The notification about scrollbar preferences is never received by the WebContent process when there is no
2200         WindowServer access. This can be fixed by adding an observer of scrollbar preferences in the UI process, and
2201         notifying the WebProcess about this by sending it a message. This message should also contain the preferred
2202         scrollbar type, since the call '[NSScroller preferredScrollerStyle]' will always return the overlay style when
2203         there is no WindowServer access.
2204
2205         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
2206         (WebKit::WebProcessPool::registerNotificationObservers):
2207         (WebKit::WebProcessPool::unregisterNotificationObservers):
2208         * UIProcess/WebProcessPool.h:
2209         * WebProcess/WebProcess.cpp:
2210         (WebKit::WebProcess::initializeProcess):
2211         * WebProcess/WebProcess.h:
2212         * WebProcess/WebProcess.messages.in:
2213         * WebProcess/cocoa/WebProcessCocoa.mm:
2214         (WebKit::WebProcess::scrollerStylePreferenceChanged):
2215
2216 2018-03-01  Antti Koivisto  <antti@apple.com>
2217
2218         Crash when updating cache entry after validation in apps that uses class A file protection
2219         https://bugs.webkit.org/show_bug.cgi?id=183242
2220         <rdar://problem/33289058>
2221
2222         Reviewed by Chris Dumez.
2223
2224         When validating a cache entry, we keep it alive until we get a network response. With 304 response
2225         we then update the headers of this existing entry. This accesses the body data of the entry which
2226         may be backed by a mapped file. If the app uses class A protection, user might have locked
2227         the device and the entry might have become inaccessible, leading to a crash.
2228
2229         * NetworkProcess/cache/NetworkCacheEntry.cpp:
2230         (WebKit::NetworkCache::Entry::setNeedsValidation):
2231
2232         In case of class A protection, pull the data to a memory buffer immediately before starting a revalidation request.
2233         This makes the window where the file could become inaccessible much shorter (since it no longer depends on network).
2234
2235 2018-03-01  Carlos Garcia Campos  <cgarcia@igalia.com>
2236
2237         REGRESSION(r221514): [GTK] UI process crash in WebKit::WaylandCompositor::Surface::flushPendingFrameCallbacks
2238         https://bugs.webkit.org/show_bug.cgi?id=183091
2239
2240         Reviewed by Michael Catanzaro.
2241
2242         Invalidate the surface in the page map when the backing store is destroyed.
2243
2244         * UIProcess/gtk/WaylandCompositor.cpp:
2245         (WebKit::WaylandCompositor::willDestroySurface):
2246         * UIProcess/gtk/WaylandCompositor.h:
2247
2248 2018-02-28  Brian Burg  <bburg@apple.com>
2249
2250         [Cocoa] Web Automation: provide a way to ask clients the type of a JavaScript dialog
2251         https://bugs.webkit.org/show_bug.cgi?id=182660
2252         <rdar://problem/37408183>
2253
2254         Reviewed by Tim Horton and Carlos Garcia Campos.
2255
2256         Add another delegate method to ask what type of dialog is being shown.
2257         This is used to implement §18.4 Step 5, where sending text to a dialog
2258         without a prompt will return several different kinds of errors.
2259
2260         No new tests, covered by web platform tests once Safari side has landed.
2261
2262         * UIProcess/API/Cocoa/_WKAutomationSessionDelegate.h: Update FIXME radar numbers.
2263         * UIProcess/Cocoa/AutomationSessionClient.h:
2264         * UIProcess/Cocoa/AutomationSessionClient.mm:
2265         (WebKit::AutomationSessionClient::AutomationSessionClient):
2266         (WebKit::toImpl):
2267         (WebKit::AutomationSessionClient::typeOfCurrentJavaScriptDialogOnPage):
2268         If there is no current dialog to be checked, the client can return the 'None'
2269         type. This gets converted into a std::nullopt and causes a command error later.
2270
2271 2018-02-28  John Wilander  <wilander@apple.com>
2272
2273         Remove assertion from ResourceLoadStatisticsClassifier::calculateResourcePrevalence() which causes crashes when domains are explicitly set as prevalent without the associated statistics
2274         https://bugs.webkit.org/show_bug.cgi?id=183233
2275
2276         Unreviewed removal of an assertion that's causing layout test crashes.
2277
2278         * Platform/classifier/ResourceLoadStatisticsClassifier.cpp:
2279         (WebKit::ResourceLoadStatisticsClassifier::calculateResourcePrevalence):
2280             Removed ASSERT(currentPrevalence == Low).
2281
2282 2018-02-28  John Wilander  <wilander@apple.com>
2283
2284         Add a second tier of prevalence to facilitate telemetry on very prevalent domains
2285         https://bugs.webkit.org/show_bug.cgi?id=183218
2286         <rdar://problem/37992388>
2287
2288         Reviewed by Brent Fulgham.
2289
2290         * Platform/classifier/ResourceLoadStatisticsClassifier.cpp:
2291         (WebKit::vectorLength):
2292             New convenience function.
2293         (WebKit::ResourceLoadStatisticsClassifier::calculateResourcePrevalence):
2294             Renamed from ResourceLoadStatisticsClassifier::hasPrevalentResourceCharacteristics().
2295             Now returns a value from the enum ResourceLoadPrevalence.
2296         (WebKit::ResourceLoadStatisticsClassifier::classifyWithVectorThreshold):
2297             Now uses the new vectorLength() convenience function.
2298         (WebKit::ResourceLoadStatisticsClassifier::hasPrevalentResourceCharacteristics): Deleted.
2299             Renamed to ResourceLoadStatisticsClassifier::calculateResourcePrevalence().
2300         * Platform/classifier/ResourceLoadStatisticsClassifier.h:
2301             Added enum ResourceLoadPrevalence.
2302         * Shared/WebCoreArgumentCoders.cpp:
2303         (IPC::ArgumentCoder<ResourceLoadStatistics>::encode):
2304         (IPC::ArgumentCoder<ResourceLoadStatistics>::decode):
2305             Handling of the new boolean field isVeryPrevalentResource.
2306         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
2307         (WKWebsiteDataStoreSetStatisticsVeryPrevalentResource):
2308         (WKWebsiteDataStoreIsStatisticsVeryPrevalentResource):
2309             Test infrastructure.
2310         * UIProcess/API/C/WKWebsiteDataStoreRef.h:
2311         * UIProcess/WebResourceLoadStatisticsStore.cpp:
2312         (WebKit::WebResourceLoadStatisticsStore::processStatisticsAndDataRecords):
2313         (WebKit::WebResourceLoadStatisticsStore::setPrevalentResource):
2314         (WebKit::WebResourceLoadStatisticsStore::setVeryPrevalentResource):
2315         (WebKit::WebResourceLoadStatisticsStore::isVeryPrevalentResource):
2316         (WebKit::WebResourceLoadStatisticsStore::clearPrevalentResource):
2317             All of these are for handling of the two-tier classification.
2318             Also bumped the statisticsModelVersion to 12.
2319         * UIProcess/WebResourceLoadStatisticsStore.h:
2320
2321 2018-02-28  Alex Christensen  <achristensen@webkit.org>
2322
2323         Reduce use of NetworkingContext in WebKit
2324         https://bugs.webkit.org/show_bug.cgi?id=183213
2325
2326         Reviewed by Brady Eidson.
2327
2328         * NetworkProcess/RemoteNetworkingContext.h:
2329         * WebProcess/Network/WebLoaderStrategy.cpp:
2330         (WebKit::WebLoaderStrategy::loadResourceSynchronously):
2331         (WebKit::WebLoaderStrategy::preconnectTo):
2332         * WebProcess/Network/WebLoaderStrategy.h:
2333         * WebProcess/Plugins/PluginView.cpp:
2334         (WebKit::PluginView::proxiesForURL):
2335         * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
2336         * WebProcess/WebPage/WebFrame.cpp:
2337
2338 2018-02-28  Brent Fulgham  <bfulgham@apple.com>
2339
2340         Remove network access from the WebContent process sandbox
2341         https://bugs.webkit.org/show_bug.cgi?id=183192
2342         <rdar://problem/35369115>
2343
2344         Reviewed by Alex Christensen.
2345
2346         Remove the 'system-network', 'allow-network-common', and 'network-client' access from the WebContent process.
2347         That's why we have a Network Process! 
2348
2349         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
2350         * WebProcess/com.apple.WebProcess.sb.in:
2351
2352 2018-02-27  Tim Horton  <timothy_horton@apple.com>
2353
2354         Ensure target triple is propagated correctly to DerivedSources.make
2355         https://bugs.webkit.org/show_bug.cgi?id=183189
2356         <rdar://problem/37959694>
2357
2358         Reviewed by Dan Bernstein.
2359
2360         * Configurations/Base.xcconfig:
2361         * DerivedSources.make:
2362         Ditto the WebCore ChangeLog.
2363
2364 2018-02-27  Yongjun Zhang  <yongjun_zhang@apple.com>
2365
2366         Make it possible to set suggestions in extra zoom mode.
2367         https://bugs.webkit.org/show_bug.cgi?id=183154
2368         <rdar://problem/35227450>
2369
2370         Reviewed by Tim Horton.
2371
2372         In extra zoom mode, when presenting WKFocusedFormControlViewController, make it the inputDelegate for
2373         WKContentView. This is needed to ensure we can capture/cache the suggestions when _WKInputSession's
2374         suggestions is updated. Later, when we present WKTextInputViewController, we can pass the cached
2375         suggestions.
2376
2377         * UIProcess/ios/WKContentViewInteraction.mm:
2378         (-[WKContentView presentFocusedFormControlViewController:]): Set _focusedFormControlViewController as
2379             the inputDelegate for WKContentView.
2380         (-[WKContentView dismissFocusedFormControlViewController:]): Null the inputDelegate on dismissal.
2381         (-[WKContentView presentTextInputViewController:]): Pass the suggestions from WKFocusedFormControlViewController to
2382             WKTextInputViewController when the latter is presented.
2383         (-[WKContentView textInputController:didCommitText:]): Call the new delegate method textInputController:didCommitText:withSuggestion:.
2384         (-[WKContentView textInputController:didCommitText:withSuggestion:]): When a suggestions is selected, insert the
2385             suggestion which will notify the client.
2386         (-[WKContentView focusedFormControllerDidUpdateSuggestions:]): Called when the suggestion is updated after the input
2387             view controller is presented.
2388
2389 2018-02-27  Tim Horton  <timothy_horton@apple.com>
2390
2391         Stop using deprecated CADisplay SPI
2392         https://bugs.webkit.org/show_bug.cgi?id=183150
2393         <rdar://problem/37918297>
2394
2395         Reviewed by Simon Fraser.
2396
2397         * Platform/spi/ios/FrontBoardServicesSPI.h: Added.
2398         * Platform/spi/ios/UIKitSPI.h:
2399         * UIProcess/API/Cocoa/WKWebView.mm:
2400         (-[WKWebView _snapshotRect:intoImageOfWidth:completionHandler:]):
2401         * WebKit.xcodeproj/project.pbxproj:
2402         Switch to the more modern way of getting the display name.
2403
2404 2018-02-27  Ryan Haddad  <ryanhaddad@apple.com>
2405
2406         Unreviewed, rolling out r229055.
2407
2408         Breaks internal builds.
2409
2410         Reverted changeset:
2411
2412         "Stop using deprecated CADisplay SPI"
2413         https://bugs.webkit.org/show_bug.cgi?id=183150
2414         https://trac.webkit.org/changeset/229055
2415
2416 2018-02-27  Wenson Hsieh  <wenson_hsieh@apple.com>
2417
2418         [Extra zoom mode] Implement additional SPI for adjusting viewport shrink-to-fit behavior
2419         https://bugs.webkit.org/show_bug.cgi?id=183100
2420         <rdar://problem/37840987>
2421
2422         Reviewed by Tim Horton.
2423
2424         Add new SPI hooks to provide finer control over certain aspects of the shrink-to-fit viewport heuristic.
2425         Currently, in certain cases of iPad multitasking, Safari allows shrinking content to fit by default. This means
2426         that even when "width=device-width" is used, if the contents of the page are too wide to fit within the
2427         viewport's width, we'll adjust the initial scale such that the viewport can fit all of the content.
2428
2429         However, in certain viewport dimensions, this heuristic is insufficient to ensure that pages are laid out and
2430         displayed properly within the viewport. Namely, one could imagine that an element with a hard-coded width that
2431         is larger than the real viewport width would cause all other elements with dimensions relative to the body to be
2432         excessively shrunk down once shrink-to-fit is applied, so the page would still look broken even if the contents
2433         of the page all fit within the viewport.
2434
2435         To mitigate this, we decouple the notions of minimum layout size from the size of the actual viewport (which we
2436         simply refer to as "view size"). This allows us to introduce a mechanism where we lay out the page at a given
2437         minimum layout size that is larger than the size of the view; later, when we determine the initial scale, we
2438         then apply shrink-to-fit scaling using the view size rather than the minimum layout size. This grants us the
2439         ability to lay out content as if our view were large, but still ensure that the contents of the page fit within
2440         the actual view.
2441
2442         * Shared/VisibleContentRectUpdateInfo.cpp:
2443         (WebKit::VisibleContentRectUpdateInfo::encode const):
2444         (WebKit::VisibleContentRectUpdateInfo::decode):
2445         (WebKit::operator<<):
2446         * Shared/VisibleContentRectUpdateInfo.h:
2447         (WebKit::VisibleContentRectUpdateInfo::VisibleContentRectUpdateInfo):
2448         (WebKit::VisibleContentRectUpdateInfo::forceHorizontalShrinkToFit const):
2449         (WebKit::operator==):
2450
2451         Plumb the forceHorizontalShrinkToFit flag through VisibleContentRectUpdateInfo.
2452
2453         * Shared/WebPageCreationParameters.cpp:
2454         (WebKit::WebPageCreationParameters::encode const):
2455         (WebKit::WebPageCreationParameters::decode):
2456         * Shared/WebPageCreationParameters.h:
2457
2458         Plumb viewSize through IPC to WebPage.
2459
2460         * UIProcess/API/Cocoa/WKWebView.mm:
2461         (-[WKWebView _initializeWithConfiguration:]):
2462
2463         Start off WKWebView flags at their initial values.
2464
2465         (-[WKWebView _minimumAllowedLayoutWidth]):
2466         (-[WKWebView _setMinimumAllowedLayoutWidth:]):
2467
2468         This provides the minimum width at which the page will lay out, such that if the view width dips below this
2469         value, we'll use this minimum allowed layout width instead. 0 by default.
2470
2471         (-[WKWebView activeMinimumLayoutSizes:]):
2472
2473         Refactor this from a static function to a helper method on WKWebView that computes both the minimum layout size
2474         (which takes minimum allowed layout width into account) as well as the real view size. Refactor all call sites
2475         to use this new method, and also propagate the view size down via IPC, alongside the minimum layout size.
2476
2477         (-[WKWebView _dispatchSetMinimumLayoutSize:viewSize:]):
2478         (-[WKWebView _frameOrBoundsChanged]):
2479         (-[WKWebView _setMinimumLayoutSizeOverride:]):
2480         (-[WKWebView _setForceHorizontalViewportShrinkToFit:]):
2481         (-[WKWebView _forceHorizontalViewportShrinkToFit]):
2482
2483         Setting this flag to YES forces us to always shrink-to-fit in the horizontal axis. NO by default.
2484
2485         (-[WKWebView _beginAnimatedResizeWithUpdates:]):
2486         (-[WKWebView _endAnimatedResize]):
2487         (activeMinimumLayoutSize): Deleted.
2488
2489         More refactoring to replace activeMinimumLayoutSize() with -activeMinimumLayoutSizes:.
2490
2491         (-[WKWebView _dispatchSetMinimumLayoutSize:]): Deleted.
2492         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
2493         * UIProcess/WebPageProxy.cpp:
2494         (WebKit::WebPageProxy::creationParameters):
2495         * UIProcess/WebPageProxy.h:
2496         * UIProcess/ios/WKContentView.mm:
2497         (-[WKContentView didUpdateVisibleRect:unobscuredRect:unobscuredRectInScrollViewCoordinates:obscuredInsets:unobscuredSafeAreaInsets:inputViewBounds:scale:minimumScale:inStableState:isChangingObscuredInsetsInteractively:enclosedInScrollableAncestorView:]):
2498
2499         Pass _forceHorizontalViewportShrinkToFit into the visible content rect update.
2500
2501         * UIProcess/ios/WebPageProxyIOS.mm:
2502         (WebKit::WebPageProxy::dynamicViewportSizeUpdate):
2503         (WebKit::WebPageProxy::setViewportConfigurationMinimumLayoutSize):
2504
2505         Plumb viewSize alongside the existing minimumLayoutSize.
2506
2507         * WebProcess/WebPage/WebPage.cpp:
2508         (WebKit::m_credentialsMessenger):
2509         * WebProcess/WebPage/WebPage.h:
2510         * WebProcess/WebPage/WebPage.messages.in:
2511         * WebProcess/WebPage/ios/WebPageIOS.mm:
2512         (WebKit::WebPage::setViewportConfigurationMinimumLayoutSize):
2513         (WebKit::WebPage::dynamicViewportSizeUpdate):
2514         (WebKit::WebPage::updateVisibleContentRects):
2515
2516         Set forceHorizontalShrinkToFit on the viewport configuration here.
2517
2518 2018-02-27  Tim Horton  <timothy_horton@apple.com>
2519
2520         Stop using deprecated CADisplay SPI
2521         https://bugs.webkit.org/show_bug.cgi?id=183150
2522         <rdar://problem/37918297>
2523
2524         Reviewed by Simon Fraser.
2525
2526         * Platform/spi/ios/FrontBoardServicesSPI.h: Added.
2527         * Platform/spi/ios/UIKitSPI.h:
2528         * UIProcess/API/Cocoa/WKWebView.mm:
2529         (-[WKWebView _snapshotRect:intoImageOfWidth:completionHandler:]):
2530         * WebKit.xcodeproj/project.pbxproj:
2531         Switch to the more modern way of getting the display name.
2532
2533 2018-02-26  Youenn Fablet  <youenn@apple.com>
2534
2535         Caches::m_storage should be set to null in case of error at initialization time
2536         https://bugs.webkit.org/show_bug.cgi?id=183068
2537
2538         Reviewed by Chris Dumez.
2539
2540         In case of error, we need to set m_storage back to nullptr so that
2541         next tries to initialize it will restart from scratch.
2542         If we do not set it to nullptr, we end up storing the initialize
2543         callback in a queue and the callback will never be called.
2544
2545         This is difficult to test as we need the following conditions:
2546         - we need to have an error case, like a disk writing error
2547         - we need the web app to open a cache in two different pages/frames at about the same time.
2548
2549         * NetworkProcess/cache/CacheStorageEngineCaches.cpp:
2550         (WebKit::CacheStorage::Caches::initialize):
2551
2552 2018-02-26  Commit Queue  <commit-queue@webkit.org>
2553
2554         Unreviewed, rolling out r226330.
2555         https://bugs.webkit.org/show_bug.cgi?id=183152
2556
2557         incorrectly assumes enumeration callback happens once
2558         (Requested by alexchristensen on #webkit).
2559
2560         Reverted changeset:
2561
2562         "Use BlockPtrs and lambdas instead of new/delete to pass
2563         parameters to blocks in WebViewImpl::performDragOperation"
2564         https://bugs.webkit.org/show_bug.cgi?id=180795
2565         https://trac.webkit.org/changeset/226330
2566
2567 2018-02-26  Ryosuke Niwa  <rniwa@webkit.org>
2568
2569         Release assertion in WebPage::updatePreferences
2570         https://bugs.webkit.org/show_bug.cgi?id=183075
2571
2572         Reviewed by Youenn Fablet and Chris Dumez.
2573
2574         Replaced the release assertion added in r228589 with a more graceful disabling of the feature when the entitlement is missing.
2575
2576         * StorageProcess/StorageProcess.cpp:
2577         (WebKit::StorageProcess::didReceiveMessage): Added an early exit with an entitlement check to disable the feature.
2578         (WebKit::StorageProcess::initializeWebsiteDataStore): Ditto.
2579         (WebKit::StorageProcess::createStorageToWebProcessConnection): Replaced the release assertion with a debug assertion.
2580         (WebKit::StorageProcess::swServerForSession): Removed the assertion. This code can be reached when the service worker is disabled.
2581         (WebKit::StorageProcess::registerSWServerConnection): Replaced the release assertion with a debug assertion.
2582         * WebProcess/WebPage/WebPage.cpp:
2583         (WebKit::WebPage::updatePreferences): Disable the feature instead of crashing when the entitlement is missing.
2584
2585 2018-02-26  Chris Dumez  <cdumez@apple.com>
2586
2587         Regression(r223431): Crash under didReceiveChallenge in NetworkSessionCocoa
2588         https://bugs.webkit.org/show_bug.cgi?id=183134
2589         <rdar://problem/36339049>
2590
2591         Reviewed by Alex Christensen.
2592
2593         Like other delegates functions in this file, it is possible for didReceiveChallenge to get called
2594         after _session has been nulled out. Other delegate functions already had early returns when
2595         _session is null. However, such early return was missing in didReceiveChallenge.
2596
2597         This patch ends the early return to didReceiveChallenge so that we do not end up calling
2598         _session->downloadID(taskIdentifier) on a null _session.
2599
2600         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
2601         (-[WKNetworkSessionDelegate URLSession:task:didReceiveChallenge:completionHandler:]):
2602
2603 2018-02-26  Youenn Fablet  <youenn@apple.com>
2604
2605         MessagePort is not always destroyed in the right thread
2606         https://bugs.webkit.org/show_bug.cgi?id=183053
2607
2608         Reviewed by Chris Dumez.
2609
2610         Update code to pass a lambda to MessagePort::existingMessagePortForIdentifier.
2611
2612         * WebProcess/WebCoreSupport/WebMessagePortChannelProvider.cpp:
2613         (WebKit::WebMessagePortChannelProvider::checkProcessLocalPortForActivity):
2614         * WebProcess/WebProcess.cpp:
2615         (WebKit::WebProcess::messagesAvailableForPort):
2616
2617 2018-02-25  Alexey Proskuryakov  <ap@apple.com>
2618
2619         Font smoothing doesn't get disabled if the preference is set before launching WebContent process
2620         https://bugs.webkit.org/show_bug.cgi?id=183108
2621
2622         Reviewed by Tim Horton.
2623
2624         * WebProcess/WebProcess.cpp: (WebKit::WebProcess::initializeWebProcess):
2625         Fix the bug. While at it, also avoid the anti-pattern in setAlwaysUsesComplexTextCodePath.
2626
2627 2018-02-25  Philippe Normand  <pnormand@igalia.com>
2628
2629         Unreviewed GTK Debug build fix after r228942.
2630
2631         * UIProcess/API/glib/IconDatabase.cpp:
2632         (WebKit::IconDatabase::iconDatabaseSyncThread):
2633         (WebKit::IconDatabase::syncThreadMainLoop):
2634         (WebKit::IconDatabase::readFromDatabase):
2635         (WebKit::IconDatabase::writeToDatabase):
2636         (WebKit::IconDatabase::cleanupSyncThread):
2637
2638 2018-02-25  Chris Dumez  <cdumez@apple.com>
2639
2640         Service workers do not work well inside Web.app
2641         https://bugs.webkit.org/show_bug.cgi?id=183105
2642         <rdar://problem/37864140>
2643
2644         Reviewed by Youenn Fablet.
2645
2646         * StorageProcess/StorageProcess.cpp:
2647         (WebKit::StorageProcess::didReceiveMessage):
2648         We were failing to forward IPC messages to the ChildProcess class here. As a result,
2649         the ChildProcess::RegisterURLSchemeServiceWorkersCanHandle IPC was being ignored
2650         by the StorageProcess.
2651
2652 2018-02-24  Zan Dobersek  <zdobersek@igalia.com>
2653
2654         Unreviewed WPE breakage fix.
2655
2656         * WebProcess/wpe/WebProcessMainWPE.cpp: Call g_set_prgname() in WebProcess 
2657         to prepare the GLib state for subsequent GStreamer initialization.
2658
2659 2018-02-23  John Wilander  <wilander@apple.com>
2660
2661         Introduce ITP debug logging as an opt-in developer feature
2662         https://bugs.webkit.org/show_bug.cgi?id=183065
2663         <rdar://problem/37803761>
2664
2665         Reviewed by Brent Fulgham.
2666
2667         * Platform/Logging.h:
2668             Added a dedicated channel for Resource Load Statistics debug logging
2669             since this will be part of a developer-facing feature and should not
2670             be mixed with general Resource Load Statistics logging.
2671         * UIProcess/Cocoa/WebResourceLoadStatisticsStoreCocoa.mm:
2672         (WebKit::WebResourceLoadStatisticsStore::registerUserDefaultsIfNeeded):
2673             Now picks up the user default setting for
2674             ResourceLoadStatisticsDebugLoggingEnabled.
2675         * UIProcess/WebResourceLoadStatisticsStore.cpp:
2676         (WebKit::WebResourceLoadStatisticsStore::removeDataRecords):
2677             Now logs for which domains it purges website data if
2678             ResourceLoadStatisticsDebugLoggingEnabled is set.
2679         (WebKit::WebResourceLoadStatisticsStore::updateCookiePartitioning):
2680             Now logs for which domains it partitions and blocks cookies
2681             in third-party contexts if ResourceLoadStatisticsDebugLoggingEnabled
2682             is set.
2683         * UIProcess/WebResourceLoadStatisticsStore.h:
2684
2685 2018-02-23  Brent Fulgham  <bfulgham@apple.com>
2686
2687         [macOS] Correct sandbox violation during media playback
2688         https://bugs.webkit.org/show_bug.cgi?id=183092
2689         <rdar://problem/37718495>
2690
2691         Reviewed by Eric Carlson.
2692
2693         * WebProcess/com.apple.WebProcess.sb.in:
2694
2695 2018-02-23  Yousuke Kimoto  <yousuke.kimoto@sony.com>
2696
2697         [MSVC] Unknown a type definition error in WebResourceLoadStatisticsStore on wincairo webkit
2698         https://bugs.webkit.org/show_bug.cgi?id=182873
2699
2700         Reviewed by Yusuke Suzuki.
2701
2702         * UIProcess/WebResourceLoadStatisticsStore.h:
2703
2704 2018-02-23  Carlos Garcia Campos  <cgarcia@igalia.com>
2705
2706         [GStreamer][MiniBrowser] Honor GStreamer command line parameters in MiniBrowser
2707         https://bugs.webkit.org/show_bug.cgi?id=173655
2708         <rdar://problem/37706341>
2709
2710         Reviewed by Philippe Normand.
2711
2712         Actually pass the gst command line options to the WebProcess. The options in /proc/self/cmdline are separated by
2713         null characters, so we are effectively passing always the first option only, which is the program name. Then, in
2714         the web process we always ignore the first option and providing WebProcess unconditionally, so we were doing
2715         nothing.
2716
2717         * UIProcess/gtk/WebProcessPoolGtk.cpp:
2718         (WebKit::WebProcessPool::platformInitializeWebProcess): Use WebCore::extractGStreamerOptionsFromCommandLine()
2719         * UIProcess/wpe/WebProcessPoolWPE.cpp:
2720         (WebKit::WebProcessPool::platformInitializeWebProcess): Ditto.
2721         * WebProcess/soup/WebProcessSoup.cpp:
2722         (WebKit::WebProcess::platformInitializeWebProcess): Move the vector.
2723
2724 2018-02-22  Yusuke Suzuki  <utatane.tea@gmail.com>
2725
2726         Remove currentTime() / currentTimeMS()
2727         https://bugs.webkit.org/show_bug.cgi?id=183052
2728
2729         Reviewed by Mark Lam.
2730
2731         * NetworkProcess/cache/CacheStorageEngineCache.cpp:
2732         * PluginProcess/WebProcessConnection.cpp:
2733         * Shared/WebProcessCreationParameters.h:
2734         * Shared/linux/WebMemorySamplerLinux.cpp:
2735         (WebKit::WebMemorySampler::sampleWebKit const):
2736         * Shared/mac/WebMemorySampler.mac.mm:
2737         (WebKit::WebMemorySampler::sampleWebKit const):
2738         * UIProcess/API/C/WKContext.cpp:
2739         (WKContextSetPlugInAutoStartOriginsFilteringOutEntriesAddedAfterTime):
2740         * UIProcess/API/glib/IconDatabase.cpp:
2741         (WebKit::IconDatabase::setIconDataForIconURL):
2742         (WebKit::IconDatabase::synchronousLoadDecisionForIconURL):
2743         (WebKit::IconDatabase::performURLImport):
2744         * UIProcess/DrawingAreaProxyImpl.cpp:
2745         * UIProcess/Plugins/PlugInAutoStartProvider.cpp:
2746         (WebKit::expirationTimeFromNow):
2747         (WebKit::PlugInAutoStartProvider::addAutoStartOriginHash):
2748         (WebKit::PlugInAutoStartProvider::autoStartOriginsTableCopy const):
2749         (WebKit::PlugInAutoStartProvider::setAutoStartOriginsTable):
2750         (WebKit::PlugInAutoStartProvider::setAutoStartOriginsFilteringOutEntriesAddedAfterTime):
2751         (WebKit::PlugInAutoStartProvider::setAutoStartOriginsTableWithItemsPassingTest):
2752         (WebKit::PlugInAutoStartProvider::didReceiveUserInteraction):
2753         * UIProcess/Plugins/PlugInAutoStartProvider.h:
2754         * UIProcess/WebProcessPool.cpp:
2755         (WebKit::WebProcessPool::processDidFinishLaunching):
2756         (WebKit::WebProcessPool::startMemorySampler):
2757         (WebKit::WebProcessPool::setPlugInAutoStartOriginsFilteringOutEntriesAddedAfterTime):
2758         * UIProcess/WebProcessPool.h:
2759         * WebProcess/InjectedBundle/API/APIInjectedBundlePageLoaderClient.h:
2760         (API::InjectedBundle::PageLoaderClient::willPerformClientRedirectForFrame):
2761         * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp:
2762         (WebKit::InjectedBundlePageLoaderClient::willPerformClientRedirectForFrame):
2763         * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h:
2764         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
2765         (WebKit::WebFrameLoaderClient::dispatchWillPerformClientRedirect):
2766         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
2767         * WebProcess/WebProcess.cpp:
2768         (WebKit::m_webSQLiteDatabaseTracker):
2769         (WebKit::WebProcess::isPlugInAutoStartOriginHash):
2770         (WebKit::WebProcess::plugInDidStartFromOrigin):
2771         (WebKit::WebProcess::didAddPlugInAutoStartOriginHash):
2772         (WebKit::WebProcess::resetPlugInAutoStartOriginDefaultHashes):
2773         (WebKit::WebProcess::resetPlugInAutoStartOriginHashes):
2774         (WebKit::WebProcess::plugInDidReceiveUserInteraction):
2775         * WebProcess/WebProcess.h:
2776         * WebProcess/WebProcess.messages.in:
2777         * WebProcess/cocoa/WebProcessCocoa.mm:
2778         * WebProcess/wpe/WebProcessMainWPE.cpp:
2779
2780 2018-02-22  Matt Baker  <mattbaker@apple.com>
2781
2782         Web Inspector: REGRESSION (r228349): ImageBitmap builtin is now runtime guarded
2783         https://bugs.webkit.org/show_bug.cgi?id=183056
2784         <rdar://problem/37799067>
2785
2786         Reviewed by Joseph Pecoraro.
2787
2788         * WebProcess/WebPage/WebInspectorUI.cpp:
2789         (WebKit::WebInspectorUI::WebInspectorUI):
2790
2791 2018-02-22  Youenn Fablet  <youenn@apple.com>
2792
2793         Caches::initialize should call all pending initialization callbacks in case of error
2794         https://bugs.webkit.org/show_bug.cgi?id=183062
2795
2796         Reviewed by Chris Dumez.
2797
2798         * NetworkProcess/cache/CacheStorageEngineCaches.cpp:
2799         (WebKit::CacheStorage::Caches::initialize):
2800         (WebKit::CacheStorage::Caches::initializeSize):
2801
2802 2018-02-22  Youenn Fablet  <youenn@apple.com>
2803
2804         CacheStorage::Engine::Caches::writeRecord is not always calling the completion handler
2805         https://bugs.webkit.org/show_bug.cgi?id=183055
2806
2807         Reviewed by Chris Dumez.
2808
2809         Add a completion handler to Storage::store.
2810         Use it instead in Caches::writeRecord.
2811         This ensures that the Cache add/put promise will be called once all write operations have been done.
2812
2813         * NetworkProcess/cache/CacheStorageEngineCaches.cpp:
2814         (WebKit::CacheStorage::Caches::writeRecord):
2815         * NetworkProcess/cache/NetworkCacheStorage.cpp:
2816         (WebKit::NetworkCache::Storage::WriteOperation::WriteOperation):
2817         (WebKit::NetworkCache::Storage::finishWriteOperation):
2818         (WebKit::NetworkCache::Storage::store):
2819         * NetworkProcess/cache/NetworkCacheStorage.h:
2820         (WebKit::NetworkCache::Storage::store):
2821
2822 2018-02-22  Ryosuke Niwa  <rniwa@webkit.org>
2823
2824         Add an entitlement check for service worker on iOS
2825         https://bugs.webkit.org/show_bug.cgi?id=182865
2826
2827         Reviewed by Dan Bernstein.
2828
2829         Addressed Dan's comment by using xpc_connection_copy_entitlement_value instead of obtaining the audit token first.
2830
2831         * Shared/mac/SandboxUtilities.h:
2832         * Shared/mac/SandboxUtilities.mm:
2833         (WebKit::connectedProcessHasEntitlement):
2834         * StorageProcess/ios/StorageProcessIOS.mm:
2835         (WebKit::StorageProcess::parentProcessHasServiceWorkerEntitlement const):
2836         * WebProcess/WebPage/ios/WebPageIOS.mm:
2837         (WebKit::WebPage::parentProcessHasServiceWorkerEntitlement const):
2838
2839 2018-02-22  Youenn Fablet  <youenn@apple.com>
2840
2841         Fetch event release assert should take into account the fetch mode
2842         https://bugs.webkit.org/show_bug.cgi?id=183047
2843
2844         Reviewed by Chris Dumez.
2845
2846         In case of navigation tasks, we should use the request URL and not the origin of the loading client.
2847
2848         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
2849         (WebKit::isValidFetch):
2850         (WebKit::WebSWContextManagerConnection::startFetch):
2851
2852 2018-02-22  Yousuke Kimoto  <yousuke.kimoto@sony.com>
2853
2854         [WinCairo] Fix compile errors in WebPageWin.cpp and WebProcessWin.cpp due to WebCore forwarding header paths
2855         https://bugs.webkit.org/show_bug.cgi?id=182969
2856
2857         Reviewed by Konstantin Tokarev.
2858
2859         * WebProcess/WebPage/win/WebPageWin.cpp:
2860         * WebProcess/win/WebProcessWin.cpp:
2861
2862 2018-02-22  Yusuke Suzuki  <utatane.tea@gmail.com>
2863
2864         Remove sleep(double) and sleepMS(double) interfaces
2865         https://bugs.webkit.org/show_bug.cgi?id=183038
2866
2867         Reviewed by Mark Lam.
2868
2869         * PluginProcess/WebProcessConnection.cpp:
2870         (WebKit::WebProcessConnection::createPluginAsynchronously):
2871         * UIProcess/linux/MemoryPressureMonitor.cpp:
2872         (WebKit::pollIntervalForUsedMemoryPercentage):
2873         (WebKit::MemoryPressureMonitor::MemoryPressureMonitor):
2874         * WebProcess/wpe/WebProcessMainWPE.cpp:
2875
2876 2018-02-22  Youenn Fablet  <youenn@apple.com>
2877
2878         Add release logging for CacheStorage::Engine disk related functions
2879         https://bugs.webkit.org/show_bug.cgi?id=183042
2880
2881         Reviewed by Chris Dumez.
2882
2883         * NetworkProcess/cache/CacheStorageEngine.cpp:
2884         (WebKit::CacheStorage::Engine::writeFile):
2885         (WebKit::CacheStorage::Engine::readFile):
2886
2887 2018-02-22  Matt Lewis  <jlewis3@apple.com>
2888
2889         Unreviewed, rolling out r228902.
2890
2891         This broke internal builds.
2892
2893         Reverted changeset:
2894
2895         "[Cocoa] Web Automation: provide a way to ask clients the type
2896         of a JavaScript dialog"
2897         https://bugs.webkit.org/show_bug.cgi?id=182660
2898         https://trac.webkit.org/changeset/228902
2899
2900 2018-02-22  Youenn Fablet  <youenn@apple.com>
2901
2902         Add release asserts for service worker fetch and postMessage events
2903         https://bugs.webkit.org/show_bug.cgi?id=183025
2904         rdar://problem/37765052
2905
2906         Reviewed by Daniel Bates.
2907
2908         Add assertion to protect interception of a fetch load by a service worker with
2909         a different origin from the page.
2910
2911         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
2912         (WebKit::WebSWContextManagerConnection::startFetch):
2913
2914 2018-02-22  Ms2ger  <Ms2ger@igalia.com>
2915
2916         [GTK][WPE] Fix some build errors in service workers code
2917         https://bugs.webkit.org/show_bug.cgi?id=182966
2918
2919         Reviewed by Žan Doberšek.
2920
2921         * CMakeLists.txt: add missing files.
2922         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp: add missing includes.
2923         * UIProcess/ServiceWorkerProcessProxy.cpp: use #include rather than #import in C++; add missing ifdef.
2924         * UIProcess/ServiceWorkerProcessProxy.h: add missing ifdef.
2925         * WebProcess/Storage/WebSWClientConnection.cpp: add missing includes.
2926         * WebProcess/Storage/WebSWContextManagerConnection.cpp: add missing includes.
2927         (WebKit::WebSWContextManagerConnection::WebSWContextManagerConnection):
2928           call the function that exists outside cocoa.
2929
2930 2018-02-21  Per Arne Vollan  <pvollan@apple.com>
2931
2932         The WebContent process should not use NSScreen in the screenAvailableRect/screenRect implementations.
2933         https://bugs.webkit.org/show_bug.cgi?id=182855
2934
2935         Reviewed by Brent Fulgham.
2936
2937         On macOS, the functions screenAvailableRect and screenRect is implemented using NSScreen, which is communicating
2938         with the WindowServer. To avoid this WindowServer communication from the WebContent process when calling
2939         screenAvailableRect and screenRect, it is possible to let the UIProcess send a message to the WebContent
2940         process whenever there is a change in the display properties, and have the WebContent process cache these
2941         display properties. This message should also be sent to a newly started WebContent process.
2942
2943         * UIProcess/WebProcessPool.cpp:
2944         (WebKit::displayReconfigurationCallBack):
2945         (WebKit::registerDisplayConfigurationCallback):
2946         (WebKit::WebProcessPool::initializeNewWebProcess):
2947         (WebKit::WebProcessPool::warmInitialProcess):
2948         * WebProcess/WebProcess.cpp:
2949         (WebKit::WebProcess::setScreenProperties):
2950         * WebProcess/WebProcess.h:
2951         * WebProcess/WebProcess.messages.in:
2952
2953 2018-02-21  Christopher Reid  <chris.reid@sony.com>
2954
2955         [Curl] Curl Cookie Database File should be configurable using NetworkProcessCreationParameters
2956         https://bugs.webkit.org/show_bug.cgi?id=182751
2957
2958         Reviewed by Youenn Fablet.
2959
2960         Adding a cookiePersistentStorageFile parameter to Curl's NetworkProcessCreationParameters.
2961         This parameter is based on Soup's cookiePersistentStoragePath.
2962         This parameter is not used yet, it is added to prepare for WinCairo WebKit support.
2963
2964         * NetworkProcess/NetworkProcessCreationParameters.cpp:
2965         * NetworkProcess/NetworkProcessCreationParameters.h:
2966         * NetworkProcess/curl/NetworkProcessCurl.cpp:
2967         * WebProcess/Cookies/WebCookieManager.h:
2968         * WebProcess/Cookies/curl/WebCookieManagerCurl.cpp:
2969
2970 2018-02-21  Brian Burg  <bburg@apple.com>
2971
2972         [Cocoa] Web Automation: provide a way to ask clients the type of a JavaScript dialog
2973         https://bugs.webkit.org/show_bug.cgi?id=182660
2974         <rdar://problem/37408183>
2975
2976         Reviewed by Tim Horton and Carlos Garcia Campos.
2977
2978         Add another delegate method to ask what type of dialog is being shown.
2979         This is used to implement §18.4 Step 5, where sending text to a dialog
2980         without a prompt will return several different kinds of errors.
2981
2982         No new tests, covered by web platform tests once Safari side has landed.
2983
2984         * UIProcess/API/Cocoa/_WKAutomationSessionDelegate.h: Update FIXME radar numbers.
2985         * UIProcess/Cocoa/AutomationSessionClient.h:
2986         * UIProcess/Cocoa/AutomationSessionClient.mm:
2987         (WebKit::AutomationSessionClient::AutomationSessionClient):
2988         (WebKit::toImpl):
2989         (WebKit::AutomationSessionClient::typeOfCurrentJavaScriptDialogOnPage):
2990         If there is no current dialog to be checked, the client can return the 'None'
2991         type. This gets converted into a std::nullopt and causes a command error later.
2992
2993 2018-02-21  Yousuke Kimoto  <yousuke.kimoto@sony.com>
2994
2995         [WinCairo] Fix compile errors of WebProcess and NetworkProcess due to no implementation for windows
2996         https://bugs.webkit.org/show_bug.cgi?id=182870
2997
2998         Reviewed by Youenn Fablet.
2999
3000         * NetworkProcess/NetworkProcess.cpp:
3001         (WebKit::NetworkProcess::createNetworkConnectionToWebProcess):
3002         * WebProcess/Plugins/PluginProcessConnectionManager.cpp:
3003         (WebKit::PluginProcessConnectionManager::getPluginProcessConnection):
3004         * WebProcess/WebPage/WebInspector.cpp:
3005         (WebKit::WebInspector::openFrontendConnection):
3006         * WebProcess/WebPage/WebInspectorUI.cpp:
3007         (WebKit::WebInspectorUI::establishConnection):
3008         * WebProcess/WebProcess.cpp:
3009         (WebKit::WebProcess::ensureNetworkProcessConnection):
3010
3011 2018-02-21  Don Olmstead  <don.olmstead@sony.com>
3012
3013         [CMake][Win] Use cmakeconfig.h rather than config.h and Platform.h
3014         https://bugs.webkit.org/show_bug.cgi?id=182883
3015
3016         Reviewed by Per Arne Vollan.
3017
3018         * config.h:
3019
3020 2018-02-21  Brian Burg  <bburg@apple.com>
3021
3022         Web Automation: failed provisional loads cause "Navigate To" command to hang
3023         https://bugs.webkit.org/show_bug.cgi?id=183007
3024         <rdar://problem/37751819>
3025
3026         Reviewed by Andy Estes.
3027
3028         This hang was revealed by WPT test current_url.py::get_current_url_file_protocol. Now the
3029         test simply fails because Safari chooses a policy of 'Ignore' for externally-opened files.
3030         I filed an upstream issue with the test here: https://github.com/w3c/webdriver/issues/1232
3031
3032         * UIProcess/WebPageProxy.cpp:
3033         (WebKit::WebPageProxy::didFailProvisionalLoadForFrame):
3034         Notify the session that the load failed in the frame, just like we do
3035         for non-provisional failed loads and successful loads.
3036
3037 2018-02-20  Nan Wang  <n_wang@apple.com>
3038
3039         AX: Keyboard focus not following VoiceOver cursor into web content or within web content.
3040         https://bugs.webkit.org/show_bug.cgi?id=182752
3041         <rdar://problem/37518233>
3042
3043         Reviewed by Ryosuke Niwa.
3044
3045         * UIProcess/PageClient.h:
3046         * UIProcess/WebPageProxy.h:
3047         * UIProcess/WebPageProxy.messages.in:
3048         * UIProcess/ios/PageClientImplIOS.h:
3049         * UIProcess/ios/PageClientImplIOS.mm:
3050         (WebKit::PageClientImpl::assistiveTechnologyMakeFirstResponder):
3051         * UIProcess/ios/WebPageProxyIOS.mm:
3052         (WebKit::WebPageProxy::assistiveTechnologyMakeFirstResponder):
3053         * UIProcess/mac/PageClientImplMac.h:
3054         * UIProcess/mac/PageClientImplMac.mm:
3055         (WebKit::PageClientImpl::assistiveTechnologyMakeFirstResponder):
3056         * UIProcess/mac/WebPageProxyMac.mm:
3057         (WebKit::WebPageProxy::assistiveTechnologyMakeFirstResponder):
3058         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
3059         (WebKit::WebChromeClient::assistiveTechnologyMakeFirstResponder):
3060         * WebProcess/WebCoreSupport/WebChromeClient.h:
3061
3062 2018-02-14  Brian Burg  <bburg@apple.com>
3063
3064         Web Automation: combine session commands to resize and move top-level browsing contexts
3065         https://bugs.webkit.org/show_bug.cgi?id=182749
3066         <rdar://problem/37515170>
3067
3068         Reviewed by Andy Estes.
3069
3070         Since moving and resizing the window are both accomplished by setting the window frame,
3071         and the W3C WebDriver specification has a Get/Set Window Rect command, it's time to
3072         deduplicate these two methods which basically do the same thing.
3073
3074         Adopt modern JSON::Value getters that return std::optional<float>. I have been trying
3075         to move the protocol over to this style wholesale, but it is probably easier to do
3076         this conversion in smaller pieces. And so, I have started to do so.
3077
3078         This change is covered by existing WebDriver tests.
3079
3080         * UIProcess/Automation/Automation.json: Add new command.
3081         * UIProcess/Automation/WebAutomationSession.cpp:
3082         (WebKit::WebAutomationSession::setWindowFrameOfBrowsingContext): Added.
3083         (WebKit::WebAutomationSession::resizeWindowOfBrowsingContext): Deleted.
3084         (WebKit::WebAutomationSession::moveWindowOfBrowsingContext): Deleted.
3085         * UIProcess/Automation/WebAutomationSession.h:
3086
3087 2018-02-20  Brian Burg  <bburg@apple.com>
3088
3089         ASSERT under WebAutomationSession::setProcessPool() when running W3C test suite a second time
3090         https://bugs.webkit.org/show_bug.cgi?id=182991
3091         <rdar://problem/37620578>
3092
3093         Reviewed by Timothy Hatcher.
3094
3095         Sometimes when running more than one session end-to-end with the same browser instance,
3096         UIProcess would crash under addMessageReceiver because another WebAutomationSession was still
3097         registered. This is hard to reproduce, but upon code inspection, the receiver management code
3098         is somewhat problematic because it only runs when the WebAutomationSession destructor runs.
3099         In some cases the client could retain two sessions and cause the first one to never remove itself
3100         as the message receiver.
3101
3102         Instead of unregistering the session as a message receiver underneath the session's destructor,
3103         do this whenever a new session supplants an old session since there is only one active session at a time.
3104
3105         * UIProcess/Automation/WebAutomationSession.cpp:
3106         (WebKit::WebAutomationSession::~WebAutomationSession):
3107         * UIProcess/WebProcessPool.cpp:
3108         (WebKit::WebProcessPool::setAutomationSession):
3109
3110 2018-02-20  Tim Horton  <timothy_horton@apple.com>
3111
3112         Introduce HAVE(IOSURFACE_ACCELERATOR)
3113         https://bugs.webkit.org/show_bug.cgi?id=182955
3114         <rdar://problem/37699510>
3115
3116         Reviewed by Sam Weinig.
3117
3118         * Shared/RemoteLayerTree/RemoteLayerBackingStore.h:
3119         * Shared/RemoteLayerTree/RemoteLayerBackingStore.mm:
3120         * Shared/cg/ShareableBitmapCG.cpp:
3121         * UIProcess/API/Cocoa/WKWebView.mm:
3122         * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm:
3123         * UIProcess/RemoteLayerTree/RemoteLayerTreeHost.mm:
3124         * UIProcess/mac/ViewSnapshotStore.h:
3125         * UIProcess/mac/ViewSnapshotStore.mm:
3126
3127 2018-02-20  Chris Dumez  <cdumez@apple.com>
3128
3129         Provisional load may get committed before receiving the decidePolicyForNavigationResponse response
3130         https://bugs.webkit.org/show_bug.cgi?id=182720
3131         <rdar://problem/37515204>
3132
3133         Reviewed by Alex Christensen.
3134
3135         * WebProcess/Network/WebResourceLoader.cpp:
3136         (WebKit::WebResourceLoader::didReceiveResponse):
3137         * WebProcess/Storage/ServiceWorkerClientFetch.cpp:
3138         (WebKit::ServiceWorkerClientFetch::didReceiveResponse):
3139         * WebProcess/WebPage/WebURLSchemeTaskProxy.cpp:
3140         (WebKit::WebURLSchemeTaskProxy::didReceiveResponse):
3141
3142 2018-02-20  Matt Lewis  <jlewis3@apple.com>
3143
3144         Unreviewed, rolling out r228829.
3145
3146         This caused a consistent failure in the API test
3147         WebKit.InteractionDeadlockAfterCrash on iOS Simulator
3148
3149         Reverted changeset:
3150
3151         "Switch to UIWKTextInteractionAssistant for non-editable text"
3152         https://bugs.webkit.org/show_bug.cgi?id=182834
3153         https://trac.webkit.org/changeset/228829
3154
3155 2018-02-20  Megan Gardner  <megan_gardner@apple.com>
3156
3157         Switch to UIWKTextInteractionAssistant for non-editable text
3158         https://bugs.webkit.org/show_bug.cgi?id=182834
3159         
3160         Reviewed by Wenson Hsieh and Tim Horton.
3161         
3162         Switching to only using the UIWKTextInteractionAssistant. Only character granularity is now supported. 
3163         Also keep the from regressing gating the keyboard bring up on user interaction. The presents of a  
3164         textInteractionAssistant can no longer be used as proxy for the presence of the keyboard.
3165
3166         * UIProcess/ios/WKContentViewInteraction.mm:
3167         (-[WKContentView useSelectionAssistantWithGranularity:]):
3168         (-[WKContentView _startAssistingNode:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
3169
3170 2018-02-20  John Wilander  <wilander@apple.com>
3171
3172         Make WebResourceLoadStatisticsStore::processStatisticsAndDataRecords() call WebProcessProxy::notifyPageStatisticsAndDataRecordsProcessed() in a proper callback
3173         https://bugs.webkit.org/show_bug.cgi?id=182719
3174         <rdar://problem/37517370>
3175
3176         Reviewed by Brent Fulgham.
3177
3178         This will allow the page notification, statistics pruning, and persistence write
3179         to be done at the right time and hopefully stabilize the layout tests including:
3180         http/tests/resourceLoadStatistics/partitioned-and-unpartitioned-cookie-deletion.html
3181
3182         * UIProcess/WebResourceLoadStatisticsStore.cpp:
3183         (WebKit::WebResourceLoadStatisticsStore::removeDataRecords):
3184             Now takes a callback parameter.
3185         (WebKit::WebResourceLoadStatisticsStore::processStatisticsAndDataRecords):
3186         * UIProcess/WebResourceLoadStatisticsStore.h:
3187             Now calls WebProcessProxy::notifyPageStatisticsAndDataRecordsProcessed()
3188             in a callback provided to WebResourceLoadStatisticsStore::removeDataRecords().
3189
3190 2018-02-20  Zan Dobersek  <zdobersek@igalia.com>
3191
3192         [Cairo] Drop target GraphicsContext usage in Cairo operations
3193         https://bugs.webkit.org/show_bug.cgi?id=182964
3194
3195         Reviewed by Carlos Garcia Campos.
3196
3197         The GraphicsContext parameters in various Cairo operations are not used
3198         anymore, so they can be removed. Callsites are updated to reflect this.
3199
3200         * Shared/cairo/ShareableBitmapCairo.cpp:
3201         (WebKit::ShareableBitmap::paint):
3202         * WebProcess/WebCoreSupport/gtk/WebDragClientGtk.cpp:
3203         (WebKit::convertCairoSurfaceToShareableBitmap):
3204
3205 2018-02-20  Philippe Normand  <pnormand@igalia.com>
3206
3207         [GStreamer][MiniBrowser] Honor GStreamer command line parameters in MiniBrowser
3208         https://bugs.webkit.org/show_bug.cgi?id=173655
3209
3210         Reviewed by Xabier Rodriguez-Calvar.
3211
3212         The FIXME in GStreamerUtilities.cpp asks to pass the command line
3213         parameters to the GStreamer initialization function.
3214
3215         Based on initial patch by: Vanessa Chipirrás Navalón  <vchipirras@igalia.com>
3216
3217         * Shared/WebProcessCreationParameters.cpp:
3218         (WebKit::WebProcessCreationParameters::encode const):
3219         (WebKit::WebProcessCreationParameters::decode):
3220         * Shared/WebProcessCreationParameters.h: Define the vector which contains the GStreamer options.
3221         * UIProcess/gtk/WebProcessPoolGtk.cpp:
3222         (WebKit::WebProcessPool::platformInitializeWebProcess): Read from cmdline file
3223         the GStreamer options written by console.
3224         * WebProcess/soup/WebProcessSoup.cpp:
3225         (WebKit::WebProcess::platformInitializeWebProcess): Call initializeGStreamer() method passing
3226         the vector which contains the options.
3227
3228 2018-02-20  Yousuke Kimoto  <yousuke.kimoto@sony.com>
3229
3230         [Win] Fix MSVC's treating __attribute__((warn_unused_result))
3231         https://bugs.webkit.org/show_bug.cgi?id=182479
3232
3233         Reviewed by Darin Adler.
3234
3235         Since MSVC doesn't understand "__attribute__", "_Check_return_" is used instead.
3236         If clang and VisualStudio 2017 are used, a macro with "__attriute__" will be chosen.
3237
3238         * UIProcess/API/cpp/WKRetainPtr.h:
3239
3240 2018-02-19  Brady Eidson  <beidson@apple.com>
3241
3242         Add WebProcessPool option for process swapping on navigation.
3243         https://bugs.webkit.org/show_bug.cgi?id=182945
3244
3245         Reviewed by Alex Christensen.
3246
3247         Just the most basic groundwork for testing a new WK2 feature.
3248
3249         * UIProcess/API/APIProcessPoolConfiguration.h:
3250
3251         * UIProcess/API/C/WKContextConfigurationRef.cpp:
3252         (WKContextConfigurationProcessSwapsOnNavigation):
3253         (WKContextConfigurationSetProcessSwapsOnNavigation):
3254         * UIProcess/API/C/WKContextConfigurationRef.h:
3255
3256         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
3257         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
3258         (-[_WKProcessPoolConfiguration setProcessSwapsOnNavigation:]):
3259         (-[_WKProcessPoolConfiguration processSwapsOnNavigation]):
3260
3261 2018-02-19  Daniel Bates  <dabates@apple.com>
3262
3263         Null pointer dereference in WebPageProxy::urlSchemeHandlerForScheme()
3264         https://bugs.webkit.org/show_bug.cgi?id=182905
3265         <rdar://problem/37676775>
3266
3267         Reviewed by Alex Christensen.
3268
3269         Return nullptr when querying for the scheme handler of the null string.
3270
3271         Before a navigation is performed WebKit checks if the destination URL is associated with an app
3272         unless the embedding client overrides the WKNavigationDelegate delegate callback -webView:decidePolicyForNavigationAction:decisionHandler.
3273         If the URL is not associated with an app then WebKit may fall back to checking if the embedding
3274         client registered a scheme handler for it. Currently we assume that the scheme is a non-null
3275         string when checking the scheme handler registry. However the scheme can be a null string if
3276         it is part of a malformed URL. And this leads to bad news bears when we try to use it to look
3277         for a scheme handler. Instead check that the scheme is a non-null string before checking to see
3278         if it is in the scheme handler registry.
3279
3280         * UIProcess/WebPageProxy.cpp:
3281         (WebKit::WebPageProxy::urlSchemeHandlerForScheme):
3282
3283 2018-02-19  Eric Carlson  <eric.carlson@apple.com>
3284
3285         [Extra zoom mode] Don't allow PiP media playback
3286         https://bugs.webkit.org/show_bug.cgi?id=182930
3287         <rdar://problem/37676259>
3288
3289         Reviewed by Andy Estes.
3290
3291         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
3292         (-[WKWebViewConfiguration init]): Don't enable PiP mode. Require user interaction for
3293         all media types.
3294
3295 2018-02-19  Ryan Haddad  <ryanhaddad@apple.com>
3296
3297         Unreviewed, rolling out r228696.
3298
3299         The API test added with this change is timing out on macOS.
3300
3301         Reverted changeset:
3302
3303         "Null pointer dereference in
3304         WebPageProxy::urlSchemeHandlerForScheme()"
3305         https://bugs.webkit.org/show_bug.cgi?id=182905
3306         https://trac.webkit.org/changeset/228696
3307
3308 2018-02-19  Daniel Bates  <dabates@apple.com>
3309
3310         Null pointer dereference in WebPageProxy::urlSchemeHandlerForScheme()
3311         https://bugs.webkit.org/show_bug.cgi?id=182905
3312
3313         Reviewed by Alex Christensen.
3314
3315         Return nullptr when querying for the scheme handler of the null string.
3316
3317         Before a navigation is performed WebKit checks if the destination URL is associated with an app
3318         unless the embedding client overrides the WKNavigationDelegate delegate callback -webView:decidePolicyForNavigationAction:decisionHandler.
3319         If the URL is not associated with an app then WebKit may fall back to checking if the embedding
3320         client registered a scheme handler for it. Currently we assume that the scheme is a non-null
3321         string when checking the scheme handler registry. However the scheme can be a null string if
3322         it is part of a malformed URL. And this leads to bad news bears when we try to use it to look
3323         for a scheme handler. Instead check that the scheme is a non-null string before checking to see
3324         if it is in the scheme handler registry.
3325
3326         * UIProcess/WebPageProxy.cpp:
3327         (WebKit::WebPageProxy::urlSchemeHandlerForScheme):
3328
3329 2018-02-19  Ms2ger  <Ms2ger@igalia.com>
3330
3331         Explicitly qualify some method calls on this in lamdas in Service Worker code.
3332         https://bugs.webkit.org/show_bug.cgi?id=182875
3333
3334         Reviewed by Chris Dumez.
3335
3336         This is necessary for the code to build with GCC 5. Other code already
3337         appears to have been adapted similarly.
3338
3339         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
3340         (WebKit::WebSWServerConnection::startFetch):
3341
3342 2018-02-18  Reza Abbasian  <rabbasian@apple.com>
3343
3344         Set the appropriate AutoFill context for suggested passwords.
3345         https://bugs.webkit.org/show_bug.cgi?id=182718
3346         <rdar://problem/36326863>
3347
3348         Reviewed by Wenson Hsieh and Tim Horton.
3349
3350         Before starting the input session, call the new delegate to query if AutoFill password suggestion assistance
3351         is required for the focused element.
3352
3353         * UIProcess/API/Cocoa/_WKFormInputSession.h:
3354         * UIProcess/API/Cocoa/_WKInputDelegate.h:
3355         Introduce a new delegate to be called  before starting an input session to query if AutoFill password suggestion
3356         assistance is required for the focused element.
3357         * UIProcess/ios/WKContentViewInteraction.h:
3358         * UIProcess/ios/WKContentViewInteraction.mm:
3359         (-[WKFormInputSession initWithContentView:focusedElementInfo:requiresStrongPasswordAssistance:]):
3360         (-[WKFormInputSession requiresStrongPasswordAssistance]):
3361         (-[WKContentView cleanupInteraction]):
3362         (-[WKContentView _startAssistingNode:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
3363         Call the delegate to find out if AutoFill suggested password assistance is required.
3364         (-[WKContentView _stopAssistingNode]):
3365         (-[WKContentView _autofillContext]): If the first responder is a password element and requires
3366         assistance for AutoFill suggested password, set the appropriate AutoFill context.
3367         (-[WKFormInputSession initWithContentView:focusedElementInfo:]): Deleted.
3368
3369 2018-02-17  Wenson Hsieh  <wenson_hsieh@apple.com>
3370
3371         [Extra zoom mode] Form control values are stale after dismissing and representing input view controllers
3372         https://bugs.webkit.org/show_bug.cgi?id=182877
3373         <rdar://problem/37604395>
3374
3375         Reviewed by Tim Horton.
3376
3377         Currently, when presenting an input view controller for a focused element, we populate the initial form control
3378         value using the WKContentView's assisted node information when it was last focused. However, if the user edits
3379         the value of a form control, dismisses to the form control view controller (while the element is still focused)
3380         and then begins editing the field again, the initial text will be the previous value of the input, since the
3381         AssistedNodeInformation isn't up to date.
3382
3383         To fix this, we introduce a mechanism to update WKContentView's AssistedNodeInformation for the current assisted
3384         node. This overwrites _assistedNodeInformation with new information computed from the web process, as long as
3385         the assisted node before and after the request is made in the UI process has not changed. We accomplish this by
3386         adding an identifier to AssistedNodeInformation, which is monotonically incremented when an element is focused
3387         in the web process. The UI process may then use this identifier to determine whether AssistedNodeInformations
3388         are describing the same focused element.
3389
3390         One interesting consideration here is that a normal AssistedNodeInformation update (propagated when focusing an
3391         element) may be deferred in the UI process until the next layer tree commit. In the absence of the assisted node
3392         identifier check, one could imagine a scenario in which the assisted node information in the UI process gets
3393         "updated" from a new value to an old value:
3394
3395         1. The web process focuses an element and sends AssistedNodeInformation `A`.
3396         2. WKContentView calls -updateCurrentAssistedNodeInformation.
3397         3. The web process sends AssistedNodeInformation `B`.
3398         4. `A` is received in the UI process, but deferred.
3399         5. The UI process receives `B` and sets _assistedNodeInformation to `B`.
3400         6. The UI process calls -_startAssistingNode: and sets _assistedNodeInformation to `A`.
3401
3402         This would mean that the _assistedNodeInformation is set to an earlier value, `A`, after being set to a later
3403         value, `B`. However, because the AssistedNodeInformation identifier in step (2) refers to the assisted node
3404         prior to step (1), the assisted node identifier in (5) would not match this identifier, and we would simply bail
3405         instead of overwriting assisted node information.
3406
3407         We use this AssistedNodeInformation update mechanism after inserting text via input view controllers, and also
3408         after reentering edit mode from the focused form control view controller. This fixes two issues where changing
3409         the size of the focused element after editing it results in the focused form overlay highlighting a stale frame,
3410         and also when setting the initial text when reentering edit mode for a form control that is already focused.
3411
3412         * Shared/AssistedNodeInformation.cpp:
3413         (WebKit::AssistedNodeInformation::encode const):
3414         (WebKit::AssistedNodeInformation::decode):
3415         * Shared/AssistedNodeInformation.h:
3416
3417         Add a new monotonically increasi