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