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