[Cocoa] Web Automation: add SPI to tell whether the automation session is currently...
[WebKit-https.git] / Source / WebKit / ChangeLog
1 2017-10-23  Brian Burg  <bburg@apple.com>
2
3         [Cocoa] Web Automation: add SPI to tell whether the automation session is currently simulating user interactions
4         https://bugs.webkit.org/show_bug.cgi?id=178616
5
6         Reviewed by Joseph Pecoraro.
7
8         This is needed to disambiguate whether an action (such as selectAll:) came from
9         a user clicking on "Edit > Select All" in a menu or whether it was produced by
10         simulating the keystrokes to produce the chord for "Command + a". Some clients,
11         such as Safari, would allow the latter but not the former during automation.
12
13         * UIProcess/API/Cocoa/_WKAutomationSession.h:
14         * UIProcess/API/Cocoa/_WKAutomationSession.mm:
15         (-[_WKAutomationSession isSimulatingUserInteraction]):
16         Add new SPI property that's backed by the same WebAutomationSession method.
17
18         * UIProcess/Automation/WebAutomationSession.h:
19         * UIProcess/Automation/WebAutomationSession.cpp:
20         (WebKit::WebAutomationSession::keyboardEventsFlushedForPage):
21         (WebKit::WebAutomationSession::performMouseInteraction):
22         (WebKit::WebAutomationSession::performKeyboardInteractions):
23         Set m_simulatingUserInteraction prior to sending the synthesized events. It will
24         be cleared when keyboardEventsFlushedForPage() is called by WebPageProxy.
25
26         * UIProcess/WebPageProxy.cpp:
27         (WebKit::WebPageProxy::didReceiveEvent):
28         Notify the automation session that the key event queue was flushed *after* giving
29         delegates a chance to do something with the key event. This is necessary so that
30         any actions that are created from the NSEvent by the delegates are handled prior
31         to the automation session finishing its keyboard interaction command.
32
33 2017-10-23  Brian Burg  <bburg@apple.com>
34
35         [Mac] Web Automation: key modifiers for synthesized NSEvents are incorrect
36         https://bugs.webkit.org/show_bug.cgi?id=178615
37
38         Reviewed by Joseph Pecoraro.
39
40         In both PLATFORM(MAC) platform methods for simulating keyboard interactions,
41         we errantly relied on +[NSEvent modifierFlags] to get the current state of
42         sticky modifiers when creating synthesized events. This is incorrect for two reasons:
43         modifierFlags is never updated when simulating a sequence of events (because
44         all the events are synthesized before any are delivered); and the NSEvent class
45         method only reflects the modifier state of the primary physical keyboard, which
46         is not affected by synthesized NSEvents that happen to have modifier flags.
47
48         Instead, just keep our own m_currentModifiers state in the session and compute
49         the necessary NSEventModifierFlags to put on each synthesized event. This aligns
50         the implementation with the treatment of sticky keys in the iOS and GTK platform methods.
51
52         * UIProcess/Automation/WebAutomationSession.h: Every port gets this variable now.
53         * UIProcess/Automation/mac/WebAutomationSessionMac.mm:
54         (WebKit::WebAutomationSession::platformSimulateKeyStroke):
55         (WebKit::WebAutomationSession::platformSimulateKeySequence):
56         Use and update m_currentModifiers.
57
58 2017-10-23  Alex Christensen  <achristensen@webkit.org>
59
60         Fix ASAN test after r222824
61         https://bugs.webkit.org/show_bug.cgi?id=178688
62         <rdar://problem/35104706>
63
64         Reviewed by Tim Horton.
65
66         * UIProcess/WebBackForwardList.cpp:
67         (WebKit::WebBackForwardList::clear):
68         Resizing a list of Ref<T> after we've WTFMoved all the elements doesn't make ASAN happy.
69
70 2017-10-23  Tim Horton  <timothy_horton@apple.com>
71
72         Stop using _UIApplicationUsesLegacyUI()
73         https://bugs.webkit.org/show_bug.cgi?id=178680
74         <rdar://problem/35131949>
75
76         Reviewed by Dan Bernstein.
77
78         * Platform/spi/ios/UIKitSPI.h:
79         * UIProcess/ios/forms/WKFormSelectPopover.mm:
80         (-[WKSelectTableViewController tableView:cellForRowAtIndexPath:]):
81         (-[WKSelectPopover initWithView:hasGroups:]):
82         Resolve _UIApplicationUsesLegacyUI to false and simplify.
83
84 2017-10-23  Ryan Haddad  <ryanhaddad@apple.com>
85
86         Unreviewed, suppress deprecation warnings to fix the build.
87         <rdar://problem/35131949>
88
89         * UIProcess/ios/forms/WKFormSelectPopover.mm:
90         (-[WKSelectTableViewController tableView:cellForRowAtIndexPath:]):
91         (-[WKSelectPopover initWithView:hasGroups:]):
92
93 2017-10-23  Youenn Fablet  <youenn@apple.com>
94
95         TestController should clear all fetch caches when resetting its state
96         https://bugs.webkit.org/show_bug.cgi?id=178486
97         <rdar://problem/35066305>
98
99         Reviewed by Chris Dumez.
100
101         Adding a new DidNotHandle message to disambiguate with the DidFail fetch case.
102         With DidNotHandle, the loading should go the network process.
103         With DidFail, the loading should return a network error.
104
105         On receiving an order to start a fetch, ServiceWorkerThread will dispatch a fetch event.
106         The client of this event will retrieve the response and return it to the WebProcess through IPC.
107
108         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
109         (WebKit::WebSWServerConnection::didNotHandleFetch):
110         * StorageProcess/ServiceWorker/WebSWServerConnection.h:
111         * StorageProcess/StorageProcess.cpp:
112         (WebKit::StorageProcess::didNotHandleFetch):
113         * StorageProcess/StorageProcess.h:
114         * StorageProcess/StorageProcess.messages.in:
115         * WebKit.xcodeproj/project.pbxproj:
116         * WebProcess/Storage/ServiceWorkerClientFetch.cpp:
117         (WebKit::ServiceWorkerClientFetch::didFail):
118         (WebKit::ServiceWorkerClientFetch::didNotHandle):
119         * WebProcess/Storage/ServiceWorkerClientFetch.h:
120         * WebProcess/Storage/ServiceWorkerClientFetch.messages.in:
121         * WebProcess/Storage/ServiceWorkerContextManager.cpp:
122         (WebKit::ServiceWorkerContextManager::startFetch):
123         * WebProcess/Storage/ServiceWorkerContextManager.h:
124         * WebProcess/Storage/WebServiceWorkerFetchTaskClient.cpp: Added.
125         (WebKit::WebServiceWorkerFetchTaskClient::~WebServiceWorkerFetchTaskClient):
126         (WebKit::WebServiceWorkerFetchTaskClient::WebServiceWorkerFetchTaskClient):
127         (WebKit::WebServiceWorkerFetchTaskClient::didReceiveResponse):
128         (WebKit::WebServiceWorkerFetchTaskClient::didReceiveData):
129         (WebKit::WebServiceWorkerFetchTaskClient::didFail):
130         (WebKit::WebServiceWorkerFetchTaskClient::didFinish):
131         * WebProcess/Storage/WebServiceWorkerFetchTaskClient.h: Added.
132         * WebProcess/WebProcess.cpp:
133         (WebKit::WebProcess::startFetchInServiceWorker):
134         * WebProcess/WebProcess.h:
135
136 2017-10-22  Wenson Hsieh  <wenson_hsieh@apple.com>
137
138         [iOS] WebProcess::initializeWebProcess spends ~150ms spinning up AVSystemController on some devices
139         https://bugs.webkit.org/show_bug.cgi?id=178640
140         <rdar://problem/35113105>
141
142         Reviewed by Youenn Fablet.
143
144         In r213933, we added a mechanism to allow the web process to drive media capture, by setting an attribute on the
145         shared AVSystemController. This requires us to fault in the Celestial framework, which is a slight performance
146         hit on some hardware. Instead of doing this at the start of every web process launch, we can just do this work
147         lazily, the first time the web process requests permissions for user media access.
148
149         * WebProcess/WebCoreSupport/WebUserMediaClient.cpp:
150         (WebKit::WebUserMediaClient::requestUserMediaAccess):
151         * WebProcess/WebPage/WebPage.cpp:
152         (WebKit::WebPage::prepareToSendUserMediaPermissionRequest):
153         * WebProcess/WebPage/WebPage.h:
154         * WebProcess/WebPage/ios/WebPageIOS.mm:
155         (WebKit::WebPage::prepareToSendUserMediaPermissionRequest):
156         * WebProcess/cocoa/WebProcessCocoa.mm:
157         (WebKit::WebProcess::platformInitializeWebProcess):
158
159 2017-10-21  Michael Catanzaro  <mcatanzaro@igalia.com>
160
161         Unreviewed, silence a -Wunused-but-set-variable warning
162
163         * WebProcess/WebPage/EventDispatcher.cpp:
164         (WebKit::EventDispatcher::wheelEvent):
165
166 2017-10-20  Alex Christensen  <achristensen@webkit.org>
167
168         Add FIXME comment after r223803
169         https://bugs.webkit.org/show_bug.cgi?id=178418
170
171         * UIProcess/WebProcessPool.cpp:
172         (WebKit::WebProcessPool::ensureNetworkProcess):
173         We need some work to better support customized persistent data stores.  Add a comment indicating such.
174
175 2017-10-20  Alex Christensen  <achristensen@webkit.org>
176
177         Fix API tests after r223791.
178         https://bugs.webkit.org/show_bug.cgi?id=178418
179
180         * UIProcess/WebProcessPool.cpp:
181         (WebKit::WebProcessPool::ensureNetworkProcess):
182         Whatever NetworkSessionInitializationParameters we send with the NetworkProcess initialization message,
183         that's the default session.  This is needed for WebKit.WebsiteDataStoreCustomPaths.
184         (WebKit::WebProcessPool::createNewWebProcess):
185         Don't change behavior or NetworkProcess initialization like I did in r223791.
186
187 2017-10-20  Alex Christensen  <achristensen@webkit.org>
188
189         Fix download tests on El Capitan after r223730
190         https://bugs.webkit.org/show_bug.cgi?id=178547
191
192         * UIProcess/Downloads/DownloadProxy.cpp:
193         (WebKit::DownloadProxy::decideDestinationWithSuggestedFilename):
194         Revert to original behavior.  This uses suggestedFilename, which may have come from places like
195         the download attribute, instead of always using the filename from CFNetwork.
196
197 2017-10-20  Alex Christensen  <achristensen@webkit.org>
198
199         Expose _boundInterfaceIdentifier and _allowsCellularAccess to WKWebsiteDataStorePrivate
200         https://bugs.webkit.org/show_bug.cgi?id=178418
201         <rdar://problem/29599569>
202
203         Reviewed by Tim Horton.
204         
205         In r213747 I introduced allowsCellularAccess to _WKProcessPoolConfiguration because there
206         was no way to add parameters to the default (and other) NetworkSession constructors.  Since
207         clients have not adopted this SPI, we can introduce such a way in NetworkSessionCreationParameters
208         and move the SPI to WKWebsiteDataStore, which is where it and other NetworkSession properties
209         ought to be instead of making them WKProcessPool global.
210
211         We also need to expose access to NSURLRequest.boundInterfaceIdentifier.  Instead of serializing and
212         deserializing that property for each NSURLRequest and then having subresources mysteriously jump back
213         to having no bound interface identifiers, I'm adding this to WKWebsiteDataStore, too, to make it a
214         session networking property.
215         
216         I manually verified that these properties are being set properly with a custom test app and added logs.
217         Unfortunately, these properties don't do anything under circumstances anywhere close to what we test.
218         The architecture change of having NetworkSessionCreationParameters is verified to not have a change in
219         behavior by existing tests, such as any test that uses TestProtocol (which we should eventually remove).
220
221         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
222         (WebKit::NetworkConnectionToWebProcess::ensureLegacyPrivateBrowsingSession):
223         * NetworkProcess/NetworkProcess.cpp:
224         (WebKit::NetworkProcess::NetworkProcess):
225         (WebKit::NetworkProcess::initializeNetworkProcess):
226         (WebKit::NetworkProcess::clearCachedCredentials):
227         * NetworkProcess/NetworkProcessCreationParameters.cpp:
228         (WebKit::NetworkProcessCreationParameters::encode const):
229         (WebKit::NetworkProcessCreationParameters::decode):
230         * NetworkProcess/NetworkProcessCreationParameters.h:
231         * NetworkProcess/NetworkSession.cpp:
232         (WebKit::NetworkSession::create):
233         (WebKit::NetworkSession::defaultSession): Deleted.
234         * NetworkProcess/NetworkSession.h:
235         * NetworkProcess/NetworkSessionCreationParameters.h: Added.
236         (WebKit::NetworkSessionCreationParameters::encode const):
237         (WebKit::NetworkSessionCreationParameters::decode):
238         * NetworkProcess/cache/NetworkCacheSpeculativeLoad.cpp:
239         (WebKit::NetworkCache::SpeculativeLoad::SpeculativeLoad):
240         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
241         (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa):
242         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
243         (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa):
244         * NetworkProcess/cocoa/NetworkSessionCocoa.h:
245         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
246         (WebKit::NetworkSessionCocoa::setSourceApplicationSecondaryIdentifier):
247         (WebKit::NetworkSessionCocoa::create):
248         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
249         (WebKit::NetworkSessionCocoa::setLegacyCustomProtocolManager): Deleted.
250         (WebKit::NetworkSessionCocoa::setAllowsCellularAccess): Deleted.
251         (WebKit::NetworkSessionCocoa::defaultSession): Deleted.
252         * NetworkProcess/mac/RemoteNetworkingContext.mm:
253         (WebKit::RemoteNetworkingContext::ensurePrivateBrowsingSession):
254         (WebKit::RemoteNetworkingContext::ensureWebsiteDataStoreSession):
255         * Shared/SessionTracker.cpp:
256         (WebKit::SessionTracker::networkSession):
257         (WebKit::SessionTracker::setSession):
258         * Shared/WebsiteDataStoreParameters.cpp:
259         (WebKit::WebsiteDataStoreParameters::encode const):
260         (WebKit::WebsiteDataStoreParameters::decode):
261         * Shared/WebsiteDataStoreParameters.h:
262         * UIProcess/API/APIProcessPoolConfiguration.cpp:
263         (API::ProcessPoolConfiguration::copy):
264         * UIProcess/API/APIProcessPoolConfiguration.h:
265         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
266         (-[WKWebsiteDataStore _setBoundInterfaceIdentifier:]):
267         (-[WKWebsiteDataStore _boundInterfaceIdentifier]):
268         (-[WKWebsiteDataStore _setAllowsCellularAccess:]):
269         (-[WKWebsiteDataStore _allowsCellularAccess]):
270         * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
271         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
272         (-[_WKProcessPoolConfiguration allowsCellularAccess]):
273         (-[_WKProcessPoolConfiguration setAllowsCellularAccess:]):
274         * UIProcess/WebProcessPool.cpp:
275         (WebKit::WebProcessPool::ensureNetworkProcess):
276         (WebKit::WebProcessPool::setAnyPageGroupMightHavePrivateBrowsingEnabled):
277         * UIProcess/WebsiteData/WebsiteDataStore.h:
278         (WebKit::WebsiteDataStore::setBoundInterfaceIdentifier):
279         (WebKit::WebsiteDataStore::boundInterfaceIdentifier):
280         (WebKit::WebsiteDataStore::setAllowsCellularAccess):
281         (WebKit::WebsiteDataStore::allowsCellularAccess):
282         * WebKit.xcodeproj/project.pbxproj:
283         * WebProcess/InjectedBundle/InjectedBundle.cpp:
284         (WebKit::InjectedBundle::setPrivateBrowsingEnabled):
285         * WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.h:
286         * WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.mm:
287         (WebKit::WebFrameNetworkingContext::ensurePrivateBrowsingSession):
288         (WebKit::WebFrameNetworkingContext::ensureWebsiteDataStoreSession):
289         * WebProcess/WebProcess.cpp:
290         (WebKit::WebProcess::ensurePrivateBrowsingSession):
291         (WebKit::WebProcess::clearCachedCredentials):
292
293 2017-10-20  Alex Christensen  <achristensen@webkit.org>
294
295         Add ObjC SPI to _WKDownloadDelegate missing from WKContextDownloadClient
296         https://bugs.webkit.org/show_bug.cgi?id=178566
297         <rdar://problem/23041906>
298
299         Reviewed by Brady Eidson.
300
301         * UIProcess/API/Cocoa/_WKDownloadDelegate.h:
302         * UIProcess/Cocoa/DownloadClient.h:
303         * UIProcess/Cocoa/DownloadClient.mm:
304         (WebKit::DownloadClient::DownloadClient):
305         (WebKit::DownloadClient::didReceiveAuthenticationChallenge):
306         (WebKit::DownloadClient::shouldDecodeSourceDataOfMIMEType):
307         (WebKit::DownloadClient::didCreateDestination):
308         (WebKit::DownloadClient::processDidCrash):
309
310 2017-10-20  Youenn Fablet  <youenn@apple.com>
311
312         ResourceResponse should have a ServiceWorker source
313         https://bugs.webkit.org/show_bug.cgi?id=178593
314
315         Reviewed by Alex Christensen.
316
317         * WebProcess/Storage/ServiceWorkerClientFetch.cpp:
318         (WebKit::ServiceWorkerClientFetch::didReceiveResponse): setting response source to ServiceWorker.
319         * WebProcess/Storage/ServiceWorkerClientFetch.h:
320
321 2017-10-20  Antoine Quint  <graouts@apple.com>
322
323         [Web Animations] Provide basic timeline and animation interfaces
324         https://bugs.webkit.org/show_bug.cgi?id=178526
325
326         Reviewed by Dean Jackson.
327
328         Remove the WEB_ANIMATIONS compile-time flag.
329
330         * Configurations/FeatureDefines.xcconfig:
331         * WebProcess/InjectedBundle/InjectedBundle.cpp:
332         (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner):
333         (WebKit::InjectedBundle::setWebAnimationsEnabled):
334         * WebProcess/WebPage/WebPage.cpp:
335         (WebKit::WebPage::updatePreferences):
336
337 2017-10-02  Brian Burg  <bburg@apple.com>
338
339         Web Inspector: consolidate code that hosts the Inspector page inside a WKWebView
340         https://bugs.webkit.org/show_bug.cgi?id=177661
341         <rdar://problem/34740286>
342
343         Reviewed by Joseph Pecoraro.
344
345         Move setup and delegates of the inspector frontend page into implementations of
346         WebInspectorProxy::platformCreateFrontendPage. The Mac implementation
347         will be subsumed by WKInspectorViewController, while the GTK implementation
348         is inherited from the cross-platform version that uses C API. Eventually the
349         GTK version should use GTK API rather than the soon to be deprecated C API.
350
351         * UIProcess/WebInspectorProxy.cpp:
352         (WebKit::WebInspectorProxy::createFrontendPage):
353         (WebKit::webProcessDidCrash): Deleted.
354         (WebKit::decidePolicyForNavigationAction): Deleted.
355         (WebKit::getContextMenuFromProposedMenu): Deleted.
356         * UIProcess/gtk/WebInspectorProxyGtk.cpp:
357         (WebKit::exceededDatabaseQuota):
358         (WebKit::webProcessDidCrash):
359         (WebKit::decidePolicyForNavigationAction):
360         (WebKit::getContextMenuFromProposedMenu):
361         (WebKit::WebInspectorProxy::platformCreateFrontendPage):
362         * UIProcess/mac/WebInspectorProxyMac.mm:
363         (WebKit::exceededDatabaseQuota):
364         (WebKit::webProcessDidCrash):
365         (WebKit::decidePolicyForNavigationAction):
366         (WebKit::getContextMenuFromProposedMenu):
367         (WebKit::WebInspectorProxy::platformCreateFrontendPage):
368
369 2017-10-02  Brian Burg  <bburg@apple.com>
370
371         Web Inspector: consolidate code that hosts the Inspector page inside a WKWebView
372         https://bugs.webkit.org/show_bug.cgi?id=177661
373         <rdar://problem/34740286>
374
375         Reviewed by Joseph Pecoraro.
376
377         Adopt WKInspectorViewController in WebInspectorProxyMac to set up the
378         frontend's web view.
379
380         * UIProcess/WebInspectorProxy.cpp:
381         (WebKit::WebInspectorProxy::invalidate):
382         (WebKit::WebInspectorProxy::close):
383         (WebKit::WebInspectorProxy::didClose):
384         (WebKit::WebInspectorProxy::closeFrontendPageAndWindow):
385         Make closeFrontendPageAndWindow into the method that does work.
386         Only use didClose() as the IPC message entry point.
387
388         * UIProcess/WebInspectorProxy.h:
389         (WebKit::WebInspectorProxy::isUnderTest const): Make public.
390
391         * UIProcess/mac/WKInspectorViewController.h:
392         * UIProcess/mac/WKInspectorViewController.mm:
393         (+[WKInspectorViewController viewIsInspectorWebView:]):
394         Abstract away the -isInstanceOfClass: check for WKInspectorWKWebView.
395         Clients shouldn't need to know whether we use a subclass or what its name is.
396
397         * UIProcess/mac/WebInspectorProxyMac.mm:
398         (-[WKWebInspectorProxyObjCAdapter inspectorViewControllerInspectorDidCrash:]):
399         (-[WKWebInspectorProxyObjCAdapter inspectorViewControllerInspectorIsUnderTest:]):
400         Hook up view controller delegates.
401
402         (WebKit::WebInspectorProxy::platformCreateFrontendPage):
403         (WebKit::WebInspectorProxy::platformCreateFrontendWindow):
404         (WebKit::WebInspectorProxy::closeFrontendPage):
405         New implementation based on the view controller.
406
407         (WebKit::WebInspectorProxy::platformBringToFront):
408         (WebKit::WebInspectorProxy::platformIsFront):
409         (WebKit::WebInspectorProxy::platformCanAttach):
410         (WebKit::WebInspectorProxy::inspectedViewFrameDidChange):
411         (WebKit::WebInspectorProxy::platformAttach):
412         (WebKit::WebInspectorProxy::platformDetach):
413         (WebKit::WebInspectorProxy::platformStartWindowDrag):
414         Adjust to get the WKWebView out of the view controller for code that needs
415         to do something with the NSView, such as get/set the frame.
416
417         (WebKit::WebInspectorProxy::createFrontendConfiguration): Deleted.
418         (WebKit::exceededDatabaseQuota): Deleted.
419         (WebKit::webProcessDidCrash): Deleted.
420         (WebKit::decidePolicyForNavigationAction): Deleted.
421         (WebKit::getContextMenuFromProposedMenu): Deleted.
422
423 2017-10-02  Brian Burg  <bburg@apple.com>
424
425         Web Inspector: consolidate code that hosts the Inspector page inside a WKWebView
426         https://bugs.webkit.org/show_bug.cgi?id=177661
427         <rdar://problem/34740286>
428
429         Reviewed by Joseph Pecoraro.
430
431         Introduce new platform methods to open and close the frontend page and window.
432         This matches how RemoteWebInspectorProxy divides work up into platform methods.
433         Move existing code from platformDidClose, platformOpen, and other methods into
434         the new platform methods. Move some identical platform code into WebInspectorProxy.cpp.
435
436         * UIProcess/WebInspectorProxy.h:
437         * UIProcess/WebInspectorProxy.cpp:
438         (WebKit::WebInspectorProxy::connect):
439         (WebKit::WebInspectorProxy::showConsole):
440         (WebKit::WebInspectorProxy::showResources):
441         (WebKit::WebInspectorProxy::showTimelines):
442         (WebKit::WebInspectorProxy::showMainResourceForFrame):
443         (WebKit::WebInspectorProxy::createFrontendPage):
444         (WebKit::WebInspectorProxy::createInspectorPage):
445         (WebKit::WebInspectorProxy::open):
446         (WebKit::WebInspectorProxy::didClose):
447         (WebKit::WebInspectorProxy::eagerlyCreateInspectorPage): Renamed.
448
449         * UIProcess/gtk/WebInspectorProxyGtk.cpp:
450         (WebKit::WebInspectorProxy::updateInspectorWindowTitle const):
451         (WebKit::WebInspectorProxy::platformCreateFrontendPage):
452         Do everything necessary to set up the frontend page WebView.
453
454         (WebKit::WebInspectorProxy::platformCreateFrontendWindow):
455         Do everything necessary to set up the detached NSWindow for the frontend.
456
457         (WebKit::WebInspectorProxy::platformCloseFrontendPageAndWindow):
458         (WebKit::WebInspectorProxy::platformDetach):
459         (WebKit::WebInspectorProxy::platformCreateInspectorPage): Deleted.
460         (WebKit::WebInspectorProxy::createInspectorWindow): Deleted.
461         (WebKit::WebInspectorProxy::platformOpen): Deleted.
462         (WebKit::WebInspectorProxy::platformDidClose): Deleted.
463
464         * UIProcess/mac/WebInspectorProxyMac.mm:
465         (WebKit::WebInspectorProxy::updateInspectorWindowTitle const):
466         (WebKit::WebInspectorProxy::platformCreateFrontendPage): Added.
467         Do everything necessary to set up the frontend page WebView.
468
469         (WebKit::WebInspectorProxy::platformCreateFrontendWindow): Added.
470         Do everything necessary to set up the detached NSWindow for the frontend.
471
472         (WebKit::WebInspectorProxy::closeFrontendPage):
473         (WebKit::WebInspectorProxy::closeFrontendAfterInactivityTimerFired):
474         (WebKit::WebInspectorProxy::platformCloseFrontendPageAndWindow):
475         (WebKit::WebInspectorProxy::platformDidCloseForCrash):
476         (WebKit::WebInspectorProxy::platformInvalidate):
477         (WebKit::WebInspectorProxy::platformBringToFront): Carry through renamings.
478
479         (WebKit::WebInspectorProxy::platformDetach):
480         Defer to the general open() method to create a window if needed and bring it to front.
481
482         (WebKit::WebInspectorProxy::platformCanAttach): Move this below open/close code.
483
484         (WebKit::WebInspectorProxy::closeFrontend): Deleted.
485         (WebKit::WebInspectorProxy::createInspectorWindow): Deleted.
486         (WebKit::WebInspectorProxy::platformCreateInspectorPage): Deleted.
487         (WebKit::WebInspectorProxy::platformOpen): Deleted.
488         (WebKit::WebInspectorProxy::platformDidClose): Deleted.
489         Defer to the general open() method to create a window if needed and bring it to front.
490
491         * UIProcess/wpe/WebInspectorProxyWPE.cpp:
492         (WebKit::WebInspectorProxy::platformCreateFrontendPage):
493         (WebKit::WebInspectorProxy::platformCreateFrontendWindow):
494         (WebKit::WebInspectorProxy::platformCloseFrontendPageAndWindow):
495         (WebKit::WebInspectorProxy::platformCreateInspectorPage): Deleted.
496         (WebKit::WebInspectorProxy::createInspectorWindow): Deleted.
497         (WebKit::WebInspectorProxy::platformOpen): Deleted.
498         (WebKit::WebInspectorProxy::platformDidClose): Deleted.
499         Update stubs.
500
501 2017-10-02  Brian Burg  <bburg@apple.com>
502
503         Web Inspector: consolidate code that hosts the Inspector page inside a WKWebView
504         https://bugs.webkit.org/show_bug.cgi?id=177661
505         <rdar://problem/34740286>
506
507         Reviewed by Joseph Pecoraro.
508
509         This patch refactors some Cocoa code pathas.
510         Rename the timer that closes the WebView so it's more obvious what it is for.
511         Extract the common code to close the frontend window so its not implemented by
512         the timer callback.
513
514         In later patches, this will be extracted further into platform methods to open/close
515         the frontend and window, like how it is for RemoteWebInspectorProxy.
516
517         * UIProcess/WebInspectorProxy.cpp:
518         (WebKit::WebInspectorProxy::WebInspectorProxy):
519         * UIProcess/WebInspectorProxy.h:
520         * UIProcess/mac/WebInspectorProxyMac.mm:
521         (WebKit::WebInspectorProxy::closeFrontendAfterInactivityTimerFired):
522         (WebKit::WebInspectorProxy::closeFrontend):
523         (WebKit::WebInspectorProxy::platformCreateInspectorPage):
524         (WebKit::WebInspectorProxy::platformDidClose):
525         (WebKit::WebInspectorProxy::platformDidCloseForCrash):
526         (WebKit::WebInspectorProxy::platformInvalidate):
527         (WebKit::WebInspectorProxy::closeTimerFired): Deleted.
528
529 2017-09-30  Brian Burg  <bburg@apple.com>
530
531         Web Inspector: consolidate code that hosts the Inspector page inside a WKWebView
532         https://bugs.webkit.org/show_bug.cgi?id=177661
533         <rdar://problem/34740286>
534
535         Reviewed by Joseph Pecoraro.
536
537         Modernize the ObjC adapter and related code a bit before it is hooked
538         into WKInspectorViewController.
539
540         * UIProcess/API/C/mac/WKInspectorPrivateMac.h: No need for the
541         ivar to be declared here, move to @implementation.
542
543         * UIProcess/WebInspectorProxy.h: Simplify the name to match modern convention.
544
545         * UIProcess/mac/WebInspectorProxyMac.mm:
546         (-[WKWebInspectorProxyObjCAdapter inspectorRef]):
547         (-[WKWebInspectorProxyObjCAdapter initWithWebInspectorProxy:]):
548         (-[WKWebInspectorProxyObjCAdapter invalidate]):
549         (-[WKWebInspectorProxyObjCAdapter windowDidMove:]):
550         (-[WKWebInspectorProxyObjCAdapter windowDidResize:]):
551         (-[WKWebInspectorProxyObjCAdapter windowWillClose:]):
552         (-[WKWebInspectorProxyObjCAdapter windowDidEnterFullScreen:]):
553         (-[WKWebInspectorProxyObjCAdapter windowDidExitFullScreen:]):
554         (-[WKWebInspectorProxyObjCAdapter inspectedViewFrameDidChange:]):
555         Remove unnecessary casts to and from void*.
556
557         (WebKit::WebInspectorProxy::attachmentViewDidChange):
558         (WebKit::WebInspectorProxy::setInspectorWindowFrame):
559         (WebKit::WebInspectorProxy::closeTimerFired):
560         (WebKit::WebInspectorProxy::createInspectorWindow):
561         (WebKit::WebInspectorProxy::platformCreateInspectorPage):
562         Fix uses of member variable m_objCAdapter.
563
564         (-[WKWebInspectorProxyObjCAdapter close]): Deleted.
565         Rename this to invalidate to match modern convention. In this context,
566         'close' might trick someone into thinking that this closes a window/page.
567
568 2017-09-30  Brian Burg  <bburg@apple.com>
569
570         Web Inspector: consolidate code that hosts the Inspector page inside a WKWebView
571         https://bugs.webkit.org/show_bug.cgi?id=177661
572         <rdar://problem/34740286>
573
574         Reviewed by Joseph Pecoraro.
575
576         Move code that sets up and controls the inspector WebView into WKInspectorViewController.
577         This will be shared between RemoteWebInspectorProxy and WebInspectorProxy eventually,
578         but for now just pull out code from RemoteWebInspectorProxy. The next patch will move
579         over WebInspectorProxy.
580
581         WKInspectorViewController uses the ObjC API for setting up the WKWebView's delegates.
582         Previously, a WKWebView was used but the delegates were set up using the C API. In
583         a few cases it uses delegate methods to ask the owning [Remote]WebInspectorProxy some
584         things. In general, WKInspectorViewController doesn't dig into any internals of
585         WebPageProxy or WebInspectorProxy; that is delegated to the client.
586
587         * UIProcess/RemoteWebInspectorProxy.h:
588         (WebKit::RemoteWebInspectorProxy::isUnderTest const): Add a method stub for now.
589         We might want to enable tests for a _WKRemoteWebInspectorViewController-based UI
590         in the future, and WebInspectorProxy has the same method. Add this and connect it
591         to the view controller delegate method.
592
593         (WebKit::RemoteWebInspectorProxy::webView const):
594         This returns a plain WKWebView type now.
595
596         * UIProcess/mac/RemoteWebInspectorProxyMac.mm:
597         (-[WKRemoteWebInspectorProxyObjCAdapter inspectorViewControllerInspectorDidCrash:]):
598         (-[WKRemoteWebInspectorProxyObjCAdapter inspectorViewControllerInspectorIsUnderTest:]):
599         (-[WKRemoteWebInspectorProxyObjCAdapter webViewWebContentProcessDidTerminate:]): Deleted.
600         (-[WKRemoteWebInspectorProxyObjCAdapter webView:decidePolicyForNavigationAction:decisionHandler:]): Deleted.
601         Make the ObjCAdapter forward view controller delegate calls to the C++ class.
602         It no longer needs to be the delegate of the WebView, as the view controller handles that.
603
604         (WebKit::RemoteWebInspectorProxy::platformCreateFrontendPageAndWindow):
605         Clean up and move WKWebView setup code into the view controller.
606
607         (WebKit::RemoteWebInspectorProxy::platformCloseFrontendPageAndWindow):
608         The m_inspectorPage is closed by the caller before calling this method, so we don't need to do it here.
609
610         (WebKit::RemoteWebInspectorProxy::platformBringToFront):
611         (WebKit::RemoteWebInspectorProxy::platformSave):
612         (WebKit::RemoteWebInspectorProxy::platformAppend):
613         (WebKit::RemoteWebInspectorProxy::platformStartWindowDrag):
614         Use webView() instead of m_webView.
615
616         * UIProcess/mac/WKInspectorViewController.h: Added.
617         * UIProcess/mac/WKInspectorViewController.mm: Added.
618         (-[WKInspectorWKWebView tag]):
619         (-[WKInspectorViewController initWithInspectedPage:]):
620         (-[WKInspectorViewController dealloc]):
621         (-[WKInspectorViewController delegate]):
622         (-[WKInspectorViewController webView]):
623         (-[WKInspectorViewController setDelegate:]):
624         (-[WKInspectorViewController configuration]):
625         (-[WKInspectorViewController _webView:getWindowFrameWithCompletionHandler:]):
626         (-[WKInspectorViewController _webView:setWindowFrame:]):
627         (-[WKInspectorViewController webView:runOpenPanelWithParameters:initiatedByFrame:completionHandler:]):
628         (-[WKInspectorViewController _webView:decideDatabaseQuotaForSecurityOrigin:currentQuota:currentOriginUsage:currentDatabaseUsage:expectedUsage:decisionHandler:]):
629         (-[WKInspectorViewController webViewWebContentProcessDidTerminate:]):
630         (-[WKInspectorViewController webView:decidePolicyForNavigationAction:decisionHandler:]):
631         Move code from RemoteWebInspectorProxyMac into here.
632
633         * UIProcess/mac/WebInspectorProxyMac.mm:
634         (WebKit::WebInspectorProxy::createFrontendWindow):
635         Remove commented out code left over from the last time that this method got moved around.
636
637         * WebKit.xcodeproj/project.pbxproj:
638         Add new class.
639
640 2017-10-20  Zan Dobersek  <zdobersek@igalia.com>
641
642         [WK2] Drop 'CoordinatedGraphics' as a platform prefix from generate-forwarding-headers.pl
643         https://bugs.webkit.org/show_bug.cgi?id=178575
644
645         Reviewed by Carlos Garcia Campos.
646
647         * Scripts/generate-forwarding-headers.pl: Remove CoordinatedGraphics as
648         a supported platform prefix. No one invokes the script with this
649         argument anymore.
650
651 2017-10-19  Alex Christensen  <achristensen@webkit.org>
652
653         Introduce completionHandler-based SPI for _WKDownloadDelegate.decideDestinationWithSuggestedFilename
654         https://bugs.webkit.org/show_bug.cgi?id=178560
655
656         Reviewed by Tim Horton.
657
658         * UIProcess/API/Cocoa/_WKDownloadDelegate.h:
659         * UIProcess/Cocoa/DownloadClient.h:
660         * UIProcess/Cocoa/DownloadClient.mm:
661         (WebKit::DownloadClient::DownloadClient):
662         (WebKit::DownloadClient::didStart):
663         (WebKit::DownloadClient::didReceiveResponse):
664         (WebKit::DownloadClient::didReceiveData):
665         (WebKit::DownloadClient::decideDestinationWithSuggestedFilename):
666         (WebKit::DownloadClient::didFinish):
667         (WebKit::DownloadClient::didFail):
668         (WebKit::DownloadClient::didCancel):
669         (WebKit::DownloadClient::willSendRequest):
670
671 2017-10-19  Chris Dumez  <cdumez@apple.com>
672
673         ServiceWorkerContextManager should be an IPC::MessageReceiver
674         https://bugs.webkit.org/show_bug.cgi?id=178552
675
676         Reviewed by Youenn Fablet.
677
678         ServiceWorkerContextManager should be an IPC::MessageReceiver, to avoid putting too many
679         ServiceWorker related methods on WebProcess class.
680
681         * DerivedSources.make:
682         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
683         (WebKit::WebSWServerConnection::startServiceWorkerContext):
684         (WebKit::WebSWServerConnection::startFetch):
685         * WebKit.xcodeproj/project.pbxproj:
686         * WebProcess/Storage/ServiceWorkerContextManager.cpp:
687         (WebKit::ServiceWorkerContextManager::startFetchInServiceWorker):
688         (WebKit::ServiceWorkerContextManager::startFetch): Deleted.
689         * WebProcess/Storage/ServiceWorkerContextManager.h:
690         * WebProcess/Storage/ServiceWorkerContextManager.messages.in: Added.
691         * WebProcess/WebProcess.cpp:
692         (WebKit::WebProcess::didReceiveMessage):
693         (WebKit::WebProcess::getWorkerContextConnection):
694         (WebKit::WebProcess::startServiceWorkerContext): Deleted.
695         (WebKit::WebProcess::startFetchInServiceWorker): Deleted.
696         * WebProcess/WebProcess.h:
697         * WebProcess/WebProcess.messages.in:
698
699 2017-10-19  Alex Christensen  <achristensen@webkit.org>
700
701         Modernize authentication challenge handling in WebKit
702         https://bugs.webkit.org/show_bug.cgi?id=178555
703
704         Reviewed by Tim Horton.
705
706         * UIProcess/API/APILoaderClient.h:
707         (API::LoaderClient::didReceiveAuthenticationChallengeInFrame):
708         * UIProcess/API/APINavigationClient.h:
709         (API::NavigationClient::didReceiveAuthenticationChallenge):
710         * UIProcess/API/C/WKPage.cpp:
711         (WKPageSetPageLoaderClient):
712         (WKPageSetPageNavigationClient):
713         * UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h:
714         * UIProcess/Cocoa/NavigationState.h:
715         * UIProcess/Cocoa/NavigationState.mm:
716         (WebKit::NavigationState::NavigationClient::canAuthenticateAgainstProtectionSpace):
717         (WebKit::NavigationState::NavigationClient::didReceiveAuthenticationChallenge):
718         * UIProcess/WebPageProxy.cpp:
719         (WebKit::WebPageProxy::didReceiveAuthenticationChallengeProxy):
720
721 2017-10-19  Alex Christensen  <achristensen@webkit.org>
722
723         Modernize API::DownloadClient
724         https://bugs.webkit.org/show_bug.cgi?id=178547
725
726         Reviewed by Andy Estes.
727
728         Use more C++ references instead of pointers because they're never null.
729
730         Remove canAuthenticateAgainstProtectionSpace because there are no implementations
731         except the default implementation which always returns true and we don't intend to
732         add this to the SPI because that's just a legacy call anyways from when NSURLConnection
733         hadn't fully evolved, and we're moving away from NSURLConnection, especially in our API design.
734
735         Separate the NetworkSession-only and pre-NetworkSession-only callbacks.  All the synchronous
736         IPC messages are only used in the pre-NetworkSession code, so once we remove it we can remove them!
737
738         Make API::DownloadClient calls that NetworkSession uses use a completion handler so we will be able to
739         design an asynchronous API.
740
741         * NetworkProcess/Downloads/DownloadManager.cpp:
742         (WebKit::DownloadManager::continueCanAuthenticateAgainstProtectionSpace): Deleted.
743         * NetworkProcess/Downloads/DownloadManager.h:
744         * NetworkProcess/Downloads/PendingDownload.cpp:
745         (WebKit::PendingDownload::canAuthenticateAgainstProtectionSpaceAsync):
746         (WebKit::PendingDownload::continueCanAuthenticateAgainstProtectionSpace): Deleted.
747         * NetworkProcess/Downloads/PendingDownload.h:
748         * NetworkProcess/NetworkProcess.cpp:
749         (WebKit::NetworkProcess::continueCanAuthenticateAgainstProtectionSpaceDownload): Deleted.
750         * NetworkProcess/NetworkProcess.h:
751         * NetworkProcess/NetworkProcess.messages.in:
752         * UIProcess/API/APIDownloadClient.h:
753         (API::DownloadClient::didStart):
754         (API::DownloadClient::didReceiveAuthenticationChallenge):
755         (API::DownloadClient::didReceiveResponse):
756         (API::DownloadClient::didReceiveData):
757         (API::DownloadClient::shouldDecodeSourceDataOfMIMEType):
758         (API::DownloadClient::decideDestinationWithSuggestedFilename):
759         (API::DownloadClient::didCreateDestination):
760         (API::DownloadClient::didFinish):
761         (API::DownloadClient::didFail):
762         (API::DownloadClient::didCancel):
763         (API::DownloadClient::processDidCrash):
764         (API::DownloadClient::willSendRequest):
765         (API::DownloadClient::canAuthenticateAgainstProtectionSpace): Deleted.
766         * UIProcess/API/C/WKContext.cpp:
767         (WKContextSetDownloadClient):
768         * UIProcess/API/glib/WebKitDownloadClient.cpp:
769         * UIProcess/Cocoa/DownloadClient.h:
770         * UIProcess/Cocoa/DownloadClient.mm:
771         (WebKit::DownloadClient::didStart):
772         (WebKit::DownloadClient::didReceiveResponse):
773         (WebKit::DownloadClient::didReceiveData):
774         (WebKit::DownloadClient::decideDestinationWithSuggestedFilename):
775         (WebKit::DownloadClient::didFinish):
776         (WebKit::DownloadClient::didFail):
777         (WebKit::DownloadClient::didCancel):
778         (WebKit::DownloadClient::willSendRequest):
779         * UIProcess/Downloads/DownloadProxy.cpp:
780         (WebKit::DownloadProxy::processDidClose):
781         (WebKit::DownloadProxy::didStart):
782         (WebKit::DownloadProxy::didReceiveAuthenticationChallenge):
783         (WebKit::DownloadProxy::willSendRequest):
784         (WebKit::DownloadProxy::didReceiveResponse):
785         (WebKit::DownloadProxy::didReceiveData):
786         (WebKit::DownloadProxy::shouldDecodeSourceDataOfMIMEType):
787         (WebKit::DownloadProxy::decideDestinationWithSuggestedFilenameAsync):
788         (WebKit::DownloadProxy::decideDestinationWithSuggestedFilename):
789         (WebKit::DownloadProxy::didCreateDestination):
790         (WebKit::DownloadProxy::didFinish):
791         (WebKit::DownloadProxy::didFail):
792         (WebKit::DownloadProxy::didCancel):
793         (WebKit::DownloadProxy::canAuthenticateAgainstProtectionSpace): Deleted.
794         * UIProcess/Downloads/DownloadProxy.h:
795         * UIProcess/Downloads/DownloadProxy.messages.in:
796
797 2017-10-19  Nan Wang  <n_wang@apple.com>
798
799         AX: Provide a way for Accessibility to cache the selection while retrieving rects for speak selection
800         https://bugs.webkit.org/show_bug.cgi?id=176247
801         <rdar://problem/34217143>
802
803         Reviewed by Ryosuke Niwa.
804
805         When getting the rects for highlighting the spoken text within a selection range on iOS, we can get a
806         list of totally wrong rects if the user changed the selection to some other text. This is because the
807         calculation is based on the current selection range. Therefore, we need to provide a way for accessibility
808         codepath to store the selection during a speaking session.
809
810         * UIProcess/API/Cocoa/WKWebView.mm:
811         (-[WKWebView _accessibilityStoreSelection]):
812         (-[WKWebView _accessibilityClearSelection]):
813         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
814         * UIProcess/WebPageProxy.h:
815         * UIProcess/ios/WKContentViewInteraction.h:
816         * UIProcess/ios/WKContentViewInteraction.mm:
817         (-[WKContentView _accessibilityStoreSelection]):
818         (-[WKContentView _accessibilityClearSelection]):
819         * UIProcess/ios/WebPageProxyIOS.mm:
820         (WebKit::WebPageProxy::storeSelectionForAccessibility):
821         * WebProcess/WebPage/WebPage.h:
822         * WebProcess/WebPage/WebPage.messages.in:
823         * WebProcess/WebPage/ios/WebPageIOS.mm:
824         (WebKit::WebPage::getRectsForGranularityWithSelectionOffset):
825         (WebKit::WebPage::storeSelectionForAccessibility):
826         (WebKit::WebPage::getRectsAtSelectionOffsetWithText):
827
828 2017-10-19  Sam Weinig  <sam@webkit.org>
829
830         [Settings] Move global settings into their own file
831         https://bugs.webkit.org/show_bug.cgi?id=178512
832
833         Reviewed by Darin Adler.
834
835         Moves all global settigns out of SettingsBase and into the new DeprecatedGlobalSettings.
836
837         * NetworkProcess/NetworkProcess.cpp:
838         (WebKit::NetworkProcess::setAllowsAnySSLCertificateForWebSocket):
839         * Shared/WebPreferencesDefinitions.h:
840         * Shared/WebPreferencesStore.cpp:
841         * WebProcess/WebPage/WebPage.cpp:
842         (WebKit::m_cpuLimit):
843         (WebKit::WebPage::updatePreferences):
844         * WebProcess/WebProcess.cpp:
845         (WebKit::WebProcess::setResourceLoadStatisticsEnabled):
846         * WebProcess/cocoa/VideoFullscreenManager.mm:
847         (WebKit::VideoFullscreenManager::supportsVideoFullscreen const):
848
849 2017-10-19  Andy Estes  <aestes@apple.com>
850
851         [iOS] Conditionally rename DatabaseProcess to StorageProcess when building for iOS devices
852         https://bugs.webkit.org/show_bug.cgi?id=178181
853         <rdar://problem/33660282>
854
855         Reviewed by Dan Bernstein.
856
857         * Configurations/BaseTarget.xcconfig:
858         * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
859         (WebKit::serviceName):
860         * WebKit.xcodeproj/project.pbxproj:
861
862 2017-10-19  Youenn Fablet  <youenn@apple.com>
863
864         Add preliminary support for ServiceWorker Handle Fetch
865         https://bugs.webkit.org/show_bug.cgi?id=178475
866         <rdar://problem/35066424>
867
868         Reviewed by Chris Dumez.
869
870         Relanding now that underlying issue is fixed in https://bugs.webkit.org/show_bug.cgi?id=178527.
871
872         Preliminary support of Handle Fetch algorithm and integration with fetch spec.
873         Adding ServiceWorkerClientFetch as the class responsible to do the load through ServiceWorker.
874         It is similar to WebResourceLoader that do the load through NetworkProcess.
875         In case ServiceWorkerClientFetch is not able to load through ServiceWorker,
876         it will fallback to WebResourceLoader through a fallback callback.
877
878         Loading through Service Worker is done currently if:
879         - There is a service worker registered for that origin
880         - Request is a subresource
881         - service workers mode is all
882         There will be cases where the service worker will not do the loading, for instance when fetch event handler is not set.
883         Future work should try to reduce the cases where the IPC dance is done unnecessarily.
884
885         ServiceWorkerClientFetch is responsible to adapt the ServiceWorker response to ResourceLoader.
886         In particular, it is calling ResourceLoader error callback if response is of type error.
887         It should call ResourceLoader redirection callback if response is a redirection response.
888         This will be done as a follow-up.
889
890         Implementing the IPC communication dedicated to fetch between WebProcess and ServiceWorker through StorageProcess.
891         In the future, WebProcess should create a direct IPC communication to the ServiceWorker process.
892
893         Moved SWContextManager from WebCore to WebKit and renamed it to ServiceWorkerContextManager.
894         This class is moved to WebKit as it will have to handle IPC and having a separation will add some unnecessary boilerplate.
895
896         * CMakeLists.txt:
897         * DerivedSources.make:
898         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
899         (WebKit::WebSWServerConnection::startFetch):
900         (WebKit::WebSWServerConnection::didReceiveFetchResponse):
901         (WebKit::WebSWServerConnection::didReceiveFetchData):
902         (WebKit::WebSWServerConnection::didFinishFetch):
903         (WebKit::WebSWServerConnection::didFailFetch):
904         * StorageProcess/ServiceWorker/WebSWServerConnection.h:
905         * StorageProcess/ServiceWorker/WebSWServerConnection.messages.in:
906         * StorageProcess/StorageProcess.cpp:
907         (WebKit::StorageProcess::didFailFetch):
908         (WebKit::StorageProcess::didReceiveFetchResponse):
909         (WebKit::StorageProcess::didReceiveFetchData):
910         (WebKit::StorageProcess::didFinishFetch):
911         * StorageProcess/StorageProcess.h:
912         * StorageProcess/StorageProcess.messages.in:
913         * WebKit.xcodeproj/project.pbxproj:
914         * WebProcess/Network/WebLoaderStrategy.cpp:
915         (WebKit::WebLoaderStrategy::scheduleLoad):
916         (WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess):
917         (WebKit::WebLoaderStrategy::remove):
918         * WebProcess/Network/WebLoaderStrategy.h:
919         * WebProcess/Storage/ServiceWorkerClientFetch.cpp: Added.
920         (WebKit::ServiceWorkerClientFetch::ServiceWorkerClientFetch):
921         (WebKit::ServiceWorkerClientFetch::didReceiveResponse):
922         (WebKit::ServiceWorkerClientFetch::didReceiveData):
923         (WebKit::ServiceWorkerClientFetch::didFinish):
924         (WebKit::ServiceWorkerClientFetch::didFail):
925         (WebKit::ServiceWorkerClientFetch::cancel):
926         * WebProcess/Storage/ServiceWorkerClientFetch.h: Copied from Source/WebKit/WebProcess/Storage/WebSWClientConnection.h.
927         * WebProcess/Storage/ServiceWorkerClientFetch.messages.in: Copied from Source/WebKit/StorageProcess/ServiceWorker/WebSWServerConnection.messages.in.
928         * WebProcess/Storage/ServiceWorkerContextManager.cpp: Added.
929         (WebKit::ServiceWorkerContextManager::startServiceWorkerContext):
930         (WebKit::ServiceWorkerContextManager::startFetch):
931         * WebProcess/Storage/ServiceWorkerContextManager.h: Renamed from Source/WebCore/workers/service/context/SWContextManager.h.
932         (WebKit::ServiceWorkerContextManager::ServiceWorkerContextManager):
933         * WebProcess/Storage/WebSWClientConnection.cpp:
934         (WebKit::WebSWClientConnection::startFetch):
935         * WebProcess/Storage/WebSWClientConnection.h:
936         * WebProcess/Storage/WebServiceWorkerProvider.cpp:
937         (WebKit::shouldHandleFetch):
938         (WebKit::WebServiceWorkerProvider::handleFetch):
939         (WebKit::WebServiceWorkerProvider::cancelFetch):
940         (WebKit::WebServiceWorkerProvider::fetchFinished):
941         (WebKit::WebServiceWorkerProvider::didReceiveServiceWorkerClientFetchMessage):
942         * WebProcess/Storage/WebServiceWorkerProvider.h:
943         * WebProcess/Storage/WebToStorageProcessConnection.cpp:
944         (WebKit::WebToStorageProcessConnection::didReceiveMessage):
945         * WebProcess/WebProcess.cpp:
946         (WebKit::WebProcess::getWorkerContextConnection):
947         (WebKit::WebProcess::startServiceWorkerContext):
948         (WebKit::WebProcess::startFetchInServiceWorker):
949         * WebProcess/WebProcess.h:
950         * WebProcess/WebProcess.messages.in:
951
952 2017-10-19  Youenn Fablet  <youenn@apple.com>
953
954         Service Worker process should not be selected to open WebView on it
955         https://bugs.webkit.org/show_bug.cgi?id=178527
956
957         Reviewed by Chris Dumez.
958
959         Selection of process to open a page will no longer use an existing web process if it is the service worker process.
960
961         * UIProcess/WebProcessPool.cpp:
962         (WebKit::WebProcessPool::createNewWebProcessRespectingProcessCountLimit):
963
964 2017-10-19  Tim Horton  <timothy_horton@apple.com>
965
966         Display link bringup can block the main thread for ~150ms during WKWebView init
967         https://bugs.webkit.org/show_bug.cgi?id=178524
968
969         Reviewed by Dean Jackson.
970
971         * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.h:
972         * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm:
973         (WebKit::RemoteLayerTreeDrawingAreaProxy::RemoteLayerTreeDrawingAreaProxy):
974         (WebKit::RemoteLayerTreeDrawingAreaProxy::displayLinkHandler):
975         (WebKit::RemoteLayerTreeDrawingAreaProxy::commitLayerTree):
976         (WebKit::RemoteLayerTreeDrawingAreaProxy::didRefreshDisplay):
977         Lazily initialize the display link at first use.
978
979 2017-10-19  Tim Horton  <timothy_horton@apple.com>
980
981         Expand r209943 to suppress paste during provisional navigation as well
982         https://bugs.webkit.org/show_bug.cgi?id=178429
983         <rdar://problem/33952830>
984
985         Reviewed by Dean Jackson.
986
987         * Shared/WebPreferencesDefinitions.h:
988         * UIProcess/API/C/WKPreferences.cpp:
989         (WKPreferencesSetShouldSuppressKeyboardInputDuringProvisionalNavigation):
990         (WKPreferencesGetShouldSuppressKeyboardInputDuringProvisionalNavigation):
991         * UIProcess/API/Cocoa/WKPreferences.mm:
992         (-[WKPreferences _shouldSuppressKeyboardInputDuringProvisionalNavigation]):
993         (-[WKPreferences _setShouldSuppressKeyboardInputDuringProvisionalNavigation:]):
994         * WebProcess/WebPage/WebPage.cpp:
995         (WebKit::WebPage::updatePreferences):
996         Adjust to the changed preference name, except at the SPI level.
997
998 2017-10-19  Youenn Fablet  <youenn@apple.com>
999
1000         Add API to clean CacheStorage data
1001         https://bugs.webkit.org/show_bug.cgi?id=178034
1002
1003         Unreviewed.
1004
1005         * UIProcess/API/Cocoa/WKWebsiteDataRecord.h: Using WK_IOS_TBA instead of WK_MAC_TBA for iOS.
1006
1007 2017-10-19  Chris Dumez  <cdumez@apple.com>
1008
1009         Unreviewed build fix after r223692.
1010
1011         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
1012
1013 2017-10-19  Chris Dumez  <cdumez@apple.com>
1014
1015         Unreviewed, revert r223650 as it caused crashes on the bots.
1016
1017         * CMakeLists.txt:
1018         * DerivedSources.make:
1019         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
1020         * StorageProcess/ServiceWorker/WebSWServerConnection.h:
1021         * StorageProcess/ServiceWorker/WebSWServerConnection.messages.in:
1022         * StorageProcess/StorageProcess.cpp:
1023         * StorageProcess/StorageProcess.h:
1024         * StorageProcess/StorageProcess.messages.in:
1025         * WebKit.xcodeproj/project.pbxproj:
1026         * WebProcess/Network/WebLoaderStrategy.cpp:
1027         (WebKit::WebLoaderStrategy::scheduleLoad):
1028         (WebKit::WebLoaderStrategy::remove):
1029         * WebProcess/Network/WebLoaderStrategy.h:
1030         * WebProcess/Storage/ServiceWorkerClientFetch.cpp: Removed.
1031         * WebProcess/Storage/ServiceWorkerClientFetch.h: Removed.
1032         * WebProcess/Storage/ServiceWorkerClientFetch.messages.in: Removed.
1033         * WebProcess/Storage/ServiceWorkerContextManager.cpp: Removed.
1034         * WebProcess/Storage/WebSWClientConnection.cpp:
1035         * WebProcess/Storage/WebSWClientConnection.h:
1036         * WebProcess/Storage/WebServiceWorkerProvider.cpp:
1037         * WebProcess/Storage/WebServiceWorkerProvider.h:
1038         * WebProcess/Storage/WebToStorageProcessConnection.cpp:
1039         (WebKit::WebToStorageProcessConnection::didReceiveMessage):
1040         * WebProcess/WebProcess.cpp:
1041         (WebKit::WebProcess::getWorkerContextConnection):
1042         (WebKit::WebProcess::startServiceWorkerContext):
1043         * WebProcess/WebProcess.h:
1044         * WebProcess/WebProcess.messages.in:
1045
1046 2017-10-19  Chris Dumez  <cdumez@apple.com>
1047
1048         http/tests/workers/service/basic-register.html is a flaky failure.
1049         https://bugs.webkit.org/show_bug.cgi?id=178494
1050         <rdar://problem/35065315>
1051
1052         Reviewed by Youenn Fablet.
1053
1054         In WebSWServerConnection::resolveJobInClient(), when a service worker is
1055         registered, we:
1056         1. Add the origin to the WebSWOriginStore
1057         2. Send the IPC to the WebProcess to notify it that the registration succeeded.
1058
1059         The assumption was that step 1 would be synchronous and would therefore send
1060         the shared memory handle to the WebProcess (if the SharedMemory was invalidated)
1061         *before* step 2.
1062
1063         The issue is that step 1 was scheduling a zero-timer to schedule the addition.
1064         As a result, there was a race and the WebContent process could check the
1065         the WebSWOriginTable *after* being notified that a service worker was registered
1066         but *before* it received the SharedMemory handle for the WebSWOriginTable. This
1067         could lead to false negatives and was causing the layout test to be flaky.
1068
1069         To address the issue, step 1 is now synchronous.
1070
1071         * Shared/SharedStringHashStore.cpp:
1072         (WebKit::SharedStringHashStore::SharedStringHashStore):
1073         (WebKit::SharedStringHashStore::scheduleAddition):
1074         (WebKit::SharedStringHashStore::scheduleRemoval):
1075         (WebKit::SharedStringHashStore::contains):
1076         (WebKit::SharedStringHashStore::flushPendingChanges):
1077         (WebKit::SharedStringHashStore::processPendingOperations):
1078         * Shared/SharedStringHashStore.h:
1079         * StorageProcess/ServiceWorker/WebSWOriginStore.cpp:
1080         (WebKit::WebSWOriginStore::add):
1081         (WebKit::WebSWOriginStore::addAll):
1082         (WebKit::WebSWOriginStore::remove):
1083         * StorageProcess/ServiceWorker/WebSWOriginStore.h:
1084         * UIProcess/VisitedLinkStore.cpp:
1085         (WebKit::VisitedLinkStore::addVisitedLinkHash):
1086         (WebKit::VisitedLinkStore::removeVisitedLinkHash):
1087
1088 2017-10-18  Ryosuke Niwa  <rniwa@webkit.org>
1089
1090         Don't expose raw HTML in pasteboard to the web content
1091         https://bugs.webkit.org/show_bug.cgi?id=178422
1092
1093         Reviewed by Wenson Hsieh.
1094
1095         Encode & decode the origin string of the copied content written into the system pasteboard.
1096
1097         * Shared/WebCoreArgumentCoders.cpp:
1098         (IPC::ArgumentCoder<PasteboardWebContent>::encode):
1099         (IPC::ArgumentCoder<PasteboardWebContent>::decode):
1100
1101 2017-10-18  Chris Dumez  <cdumez@apple.com>
1102
1103         Implement ServiceWorkerRegistration.scope / updateViaCache
1104         https://bugs.webkit.org/show_bug.cgi?id=178497
1105
1106         Reviewed by Youenn Fablet.
1107
1108         * Shared/WebCoreArgumentCoders.h:
1109         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
1110
1111 2017-10-18  Youenn Fablet  <youenn@apple.com>
1112
1113         Add preliminary support for ServiceWorker Handle Fetch
1114         https://bugs.webkit.org/show_bug.cgi?id=178475
1115
1116         Reviewed by Chris Dumez.
1117
1118         Preliminary support of Handle Fetch algorithm and integration with fetch spec.
1119         Adding ServiceWorkerClientFetch as the class responsible to do the load through ServiceWorker.
1120         It is similar to WebResourceLoader that do the load through NetworkProcess.
1121         In case ServiceWorkerClientFetch is not able to load through ServiceWorker,
1122         it will fallback to WebResourceLoader through a fallback callback.
1123
1124         Loading through Service Worker is done currently if:
1125         - There is a service worker registered for that origin
1126         - Request is a subresource
1127         - service workers mode is all
1128         There will be cases where the service worker will not do the loading, for instance when fetch event handler is not set.
1129         Future work should try to reduce the cases where the IPC dance is done unnecessarily.
1130
1131         ServiceWorkerClientFetch is responsible to adapt the ServiceWorker response to ResourceLoader.
1132         In particular, it is calling ResourceLoader error callback if response is of type error.
1133         It should call ResourceLoader redirection callback if response is a redirection response.
1134         This will be done as a follow-up.
1135
1136         Implementing the IPC communication dedicated to fetch between WebProcess and ServiceWorker through StorageProcess.
1137         In the future, WebProcess should create a direct IPC communication to the ServiceWorker process.
1138
1139         Moved SWContextManager from WebCore to WebKit and renamed it to ServiceWorkerContextManager.
1140         This class is moved to WebKit as it will have to handle IPC and having a separation will add some unnecessary boilerplate.
1141
1142         * DerivedSources.make:
1143         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
1144         (WebKit::WebSWServerConnection::startFetch):
1145         (WebKit::WebSWServerConnection::didReceiveFetchResponse):
1146         (WebKit::WebSWServerConnection::didReceiveFetchData):
1147         (WebKit::WebSWServerConnection::didFinishFetch):
1148         (WebKit::WebSWServerConnection::failedFetch):
1149         * StorageProcess/ServiceWorker/WebSWServerConnection.h:
1150         * StorageProcess/ServiceWorker/WebSWServerConnection.messages.in:
1151         * StorageProcess/StorageProcess.cpp:
1152         (WebKit::StorageProcess::failedFetch):
1153         (WebKit::StorageProcess::didReceiveFetchResponse):
1154         (WebKit::StorageProcess::didReceiveFetchData):
1155         (WebKit::StorageProcess::didFinishFetch):
1156         * StorageProcess/StorageProcess.h:
1157         * StorageProcess/StorageProcess.messages.in:
1158         * WebKit.xcodeproj/project.pbxproj:
1159         * WebProcess/Network/WebLoaderStrategy.cpp:
1160         (WebKit::WebLoaderStrategy::scheduleLoad):
1161         (WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess):
1162         * WebProcess/Network/WebLoaderStrategy.h:
1163         * WebProcess/Storage/ServiceWorkerClientFetch.cpp: Added.
1164         (WebKit::ServiceWorkerClientFetch::didReceiveResponse):
1165         (WebKit::ServiceWorkerClientFetch::didReceiveData):
1166         (WebKit::ServiceWorkerClientFetch::didFinishFetch):
1167         (WebKit::ServiceWorkerClientFetch::didFail):
1168         * WebProcess/Storage/ServiceWorkerClientFetch.h: Added.
1169         * WebProcess/Storage/ServiceWorkerClientFetch.messages.in: Added.
1170         * WebProcess/Storage/ServiceWorkerContextManager.cpp: Renamed from Source/WebCore/workers/service/context/SWContextManager.cpp.
1171         (WebKit::ServiceWorkerContextManager::startServiceWorkerContext):
1172         (WebKit::ServiceWorkerContextManager::startFetch):
1173         * WebProcess/Storage/ServiceWorkerContextManager.h: Renamed from Source/WebCore/workers/service/context/SWContextManager.h.
1174         (WebKit::ServiceWorkerContextManager::ServiceWorkerContextManager):
1175         * WebProcess/Storage/WebSWClientConnection.cpp:
1176         (WebKit::WebSWClientConnection::startFetch):
1177         * WebProcess/Storage/WebSWClientConnection.h:
1178         * WebProcess/Storage/WebServiceWorkerProvider.cpp:
1179         (WebKit::shouldHandleFetch):
1180         (WebKit::WebServiceWorkerProvider::handleFetch):
1181         (WebKit::WebServiceWorkerProvider::didReceiveServiceWorkerClientFetchMessage):
1182         * WebProcess/Storage/WebServiceWorkerProvider.h:
1183         * WebProcess/Storage/WebToStorageProcessConnection.cpp:
1184         (WebKit::WebToStorageProcessConnection::didReceiveMessage):
1185         * WebProcess/WebProcess.cpp:
1186         (WebKit::WebProcess::getWorkerContextConnection):
1187         (WebKit::WebProcess::startServiceWorkerContext):
1188         (WebKit::WebProcess::startFetchInServiceWorker):
1189         * WebProcess/WebProcess.h:
1190         * WebProcess/WebProcess.messages.in:
1191
1192 2017-10-18  Chelsea Pugh  <cpugh@apple.com>
1193
1194         [iOS] Use new class name from UIKit when checking UITextSuggestion type
1195         https://bugs.webkit.org/show_bug.cgi?id=178416
1196         <rdar://problem/35010840>
1197
1198         Reviewed by Tim Horton.
1199
1200         Here we start using UITextAutofillSuggestion instead of the old name that was being used for
1201         AutoFill text suggestions.
1202
1203         * Platform/spi/ios/UIKitSPI.h:
1204         * UIProcess/ios/WKContentViewInteraction.mm:
1205         (-[WKContentView insertTextSuggestion:]): Use UITextAutofillSuggestion when checking the class
1206         and when casting instead of UIKeyboardLoginCredentialsSuggestion.
1207
1208 2017-10-17  Jiewen Tan  <jiewen_tan@apple.com>
1209
1210         Replace some stack raw pointers with RefPtrs within WebCore/html
1211         https://bugs.webkit.org/show_bug.cgi?id=178201
1212         <rdar://problem/34841692>
1213
1214         Reviewed by Ryosuke Niwa.
1215
1216         Change the type of node as toNode() is changed to return RefPtr.
1217
1218         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMPrivate.cpp:
1219         (WebKit::wrap):
1220         * WebProcess/WebCoreSupport/gtk/WebEditorClientGtk.cpp:
1221         (WebKit::WebEditorClient::handleKeyboardEvent):
1222         * WebProcess/WebCoreSupport/wpe/WebEditorClientWPE.cpp:
1223         (WebKit::WebEditorClient::handleKeyboardEvent):
1224         * WebProcess/WebPage/WebPage.cpp:
1225         (WebKit::WebPage::handleEditingKeyboardEvent):
1226         * WebProcess/WebPage/mac/WebPageMac.mm:
1227         (WebKit::frameForEvent):
1228
1229 2017-10-18  Chris Dumez  <cdumez@apple.com>
1230
1231         [Service Worker] Add stubs for Client / WindowClient / Clients
1232         https://bugs.webkit.org/show_bug.cgi?id=178469
1233
1234         Reviewed by Youenn Fablet.
1235
1236         Rename PageVisibilityState to VisibilityState.
1237
1238         * Shared/API/c/WKSharedAPICast.h:
1239         (WebKit::toVisibilityState):
1240         * WebProcess/WebPage/WebPage.h:
1241
1242 2017-10-18  John Wilander  <wilander@apple.com>
1243
1244         Check notifyPagesWhenTelemetryWasCaptured before notifying pages if there is no WebPageProxy
1245         https://bugs.webkit.org/show_bug.cgi?id=178470
1246         <rdar://problem/34417518>
1247
1248         Reviewed by Brian Burg.
1249
1250         * UIProcess/WebResourceLoadStatisticsTelemetry.cpp:
1251         (WebKit::WebResourceLoadStatisticsTelemetry::calculateAndSubmit):
1252             Add a missing check of notifyPagesWhenTelemetryWasCaptured.
1253             The page notification is only for testing purposes.
1254
1255 2017-10-18  Chris Dumez  <cdumez@apple.com>
1256
1257         Unreviewed, fix build error after r223608 with some SDKs.
1258
1259         * StorageProcess/StorageProcess.cpp:
1260         (WebKit::StorageProcess::ensureSWOriginStoreForSession):
1261
1262 2017-10-18  Chris Dumez  <cdumez@apple.com>
1263
1264         Add an efficient data structure for WebCore to query if there is a Service Worker registered for a given origin
1265         https://bugs.webkit.org/show_bug.cgi?id=177876
1266         <rdar://problem/34813129>
1267
1268         Reviewed by Ryosuke Niwa.
1269
1270         Introduce a Service Worker origin store which gets populated / updated on the StorageProcess side
1271         and queried on the WebContent process side via the WebSWOriginTable so that the WebProcess can
1272         efficiently check if there is a ServiceWorker registered for a given origin without actually doing
1273         an IPC to the StorageProcess.
1274
1275         For efficiency, the hash table is backed by SharedMemory so we only pass shared memory handles
1276         between the StorageProcess and the WebProcesses.
1277
1278         We currently add entries to the WebSWOriginStore whenever a service worker registration succeeds
1279         on the StorageProcess side. We also clear this store whenever the API to clear service worker
1280         registrations is called. Code to query the WebSWOriginTable from the WebContent process side is
1281         there but currently only used by Internals for testing. We will later leverage this code when
1282         integrating with Fetch API.
1283
1284         * CMakeLists.txt:
1285         * Shared/SharedStringHashStore.h:
1286         (WebKit::SharedStringHashStore::Client::didUpdateSharedStringHashes):
1287         * Shared/SharedStringHashTable.cpp:
1288         (WebKit::SharedStringHashTable::clear):
1289         * StorageProcess/ServiceWorker/WebSWOriginStore.cpp: Copied from Source/WebKit/WebProcess/Storage/WebServiceWorkerProvider.cpp.
1290         (WebKit::WebSWOriginStore::WebSWOriginStore):
1291         (WebKit::WebSWOriginStore::add):
1292         (WebKit::WebSWOriginStore::remove):
1293         (WebKit::WebSWOriginStore::clear):
1294         (WebKit::WebSWOriginStore::registerSWServerConnection):
1295         (WebKit::WebSWOriginStore::unregisterSWServerConnection):
1296         (WebKit::WebSWOriginStore::sendStoreHandle):
1297         (WebKit::WebSWOriginStore::didInvalidateSharedMemory):
1298         * StorageProcess/ServiceWorker/WebSWOriginStore.h: Copied from Source/WebKit/WebProcess/Storage/WebServiceWorkerProvider.h.
1299         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
1300         (WebKit::WebSWServerConnection::WebSWServerConnection):
1301         (WebKit::WebSWServerConnection::resolveJobInClient):
1302         * StorageProcess/ServiceWorker/WebSWServerConnection.h:
1303         (WebKit::WebSWServerConnection::sessionID const):
1304         * StorageProcess/StorageProcess.cpp:
1305         (WebKit::StorageProcess::deleteWebsiteData):
1306         (WebKit::StorageProcess::deleteWebsiteDataForOrigins):
1307         (WebKit::StorageProcess::ensureSWOriginStoreForSession):
1308         (WebKit::StorageProcess::swOriginStoreForSession const):
1309         (WebKit::StorageProcess::serviceWorkerContextStarted):
1310         (WebKit::StorageProcess::registerSWServerConnection):
1311         (WebKit::StorageProcess::unregisterSWServerConnection):
1312         * StorageProcess/StorageProcess.h:
1313         * StorageProcess/StorageProcess.messages.in:
1314         * WebKit.xcodeproj/project.pbxproj:
1315         * WebProcess/Storage/WebSWClientConnection.cpp:
1316         (WebKit::WebSWClientConnection::WebSWClientConnection):
1317         (WebKit::WebSWClientConnection::hasServiceWorkerRegisteredForOrigin const):
1318         (WebKit::WebSWClientConnection::setSWOriginTableSharedMemory):
1319         * WebProcess/Storage/WebSWClientConnection.h:
1320         * WebProcess/Storage/WebSWClientConnection.messages.in:
1321         * WebProcess/Storage/WebSWOriginTable.cpp: Copied from Source/WebKit/WebProcess/Storage/WebServiceWorkerProvider.h.
1322         (WebKit::WebSWOriginTable::contains const):
1323         (WebKit::WebSWOriginTable::setSharedMemory):
1324         * WebProcess/Storage/WebSWOriginTable.h: Copied from Source/WebKit/WebProcess/Storage/WebServiceWorkerProvider.h.
1325         * WebProcess/Storage/WebServiceWorkerProvider.cpp:
1326         (WebKit::WebServiceWorkerProvider::serviceWorkerConnectionForSession):
1327         * WebProcess/Storage/WebServiceWorkerProvider.h:
1328         * WebProcess/Storage/WebToStorageProcessConnection.cpp:
1329         (WebKit::WebToStorageProcessConnection::serviceWorkerConnectionForSession):
1330         * WebProcess/Storage/WebToStorageProcessConnection.h:
1331         * WebProcess/WebProcess.cpp:
1332         (WebKit::WebProcess::startServiceWorkerContext):
1333
1334 2017-10-16  Andy Estes  <aestes@apple.com>
1335
1336         [Apple Pay] Add subLocality and subAdministrativeArea to ApplePayPaymentContact and ApplePayError
1337         https://bugs.webkit.org/show_bug.cgi?id=178191
1338         <rdar://problem/34906367>
1339
1340         Reviewed by Tim Horton.
1341
1342         * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
1343         (WebKit::toNSError):
1344
1345 2017-10-17  Sam Weinig  <sam@webkit.org>
1346
1347         [Settings] Generate Settings.h/cpp
1348         https://bugs.webkit.org/show_bug.cgi?id=178361
1349
1350         Reviewed by Dean Jackson.
1351
1352         * PlatformGTK.cmake:
1353         * PlatformWPE.cmake:
1354
1355             Delete the old Settings.h from the forwarding 
1356             headers directory to allow the build to work.
1357
1358 2017-10-17  John Wilander  <wilander@apple.com>
1359
1360         Add and remove cookie partition accordingly in intermediary redirect requests
1361         https://bugs.webkit.org/show_bug.cgi?id=178369
1362         <rdar://problem/34467603>
1363
1364         Reviewed by Brent Fulgham.
1365
1366         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
1367         (WebKit::shouldChangePartition):
1368             Convenience function. Comment documents the logic.
1369         (WebKit::NetworkDataTaskCocoa::willPerformHTTPRedirection):
1370             Now adds and removes cookie partition based on the
1371             redirect-to URL's domain.
1372         * WebProcess/InjectedBundle/API/c/WKBundle.cpp:
1373         (WKBundleResourceLoadStatisticsNotifyObserver):
1374             Test infrastructure.
1375         * WebProcess/InjectedBundle/API/c/WKBundlePrivate.h:
1376
1377 2017-10-17  Youenn Fablet  <youenn@apple.com>
1378
1379         Cache API implementation should be able to compute storage size for WebKit client applications.
1380         https://bugs.webkit.org/show_bug.cgi?id=178350
1381
1382         Reviewed by Chris Dumez.
1383
1384         When gathering data from DOM Cache, we compute the size as follows:
1385         - If Caches object is not persistent, size is zero
1386         - If Caches object is persistent, we use the size computed by NetworkCache::Storage. 
1387         Covered by updated tests.
1388
1389         * NetworkProcess/cache/CacheStorageEngine.cpp:
1390         (WebKit::CacheStorage::ReadOriginsTaskCounter::create):
1391         (WebKit::CacheStorage::ReadOriginsTaskCounter::addOrigin):
1392         (WebKit::CacheStorage::Engine::fetchEntries):
1393         * NetworkProcess/cache/CacheStorageEngineCaches.cpp:
1394         (WebKit::CacheStorage::Caches::storageSize const):
1395         * NetworkProcess/cache/CacheStorageEngineCaches.h:
1396         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
1397         (WKWebsiteDataStoreGetFetchCacheSizeForOrigin):
1398         * UIProcess/API/C/WKWebsiteDataStoreRef.h:
1399
1400 2017-10-17  Keith Miller  <keith_miller@apple.com>
1401
1402         Change WebCore sources to work with unified source builds
1403         https://bugs.webkit.org/show_bug.cgi?id=178229
1404
1405         Rubber stamped by Tim Horton.
1406
1407         * Configurations/FeatureDefines.xcconfig:
1408
1409 2017-10-16  Wenson Hsieh  <wenson_hsieh@apple.com>
1410
1411         Unreviewed, fix the iOS build after r223431
1412
1413         Remove an unused variable captured in a lambda.
1414
1415         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
1416         (-[WKNetworkSessionDelegate URLSession:task:didReceiveChallenge:completionHandler:]):
1417
1418 2017-10-12  Matt Rajca  <mrajca@apple.com>
1419
1420         Add API support for quirk that lets an arbitrary click allow auto-play.
1421         https://bugs.webkit.org/show_bug.cgi?id=178227
1422
1423         Reviewed by Alex Christensen.
1424
1425         Instead of hardcoding sites in WebCore, let API clients control which websites opt into the quirk that lets
1426         an arbitrary click allow auto-play via website policies.
1427
1428         * Shared/WebsitePolicies.h:
1429         * UIProcess/API/C/WKWebsitePolicies.cpp:
1430         (WKWebsitePoliciesSetAllowedAutoplayQuirks):
1431         (WKWebsitePoliciesGetAllowedAutoplayQuirks):
1432         * UIProcess/API/C/WKWebsitePolicies.h:
1433         * UIProcess/API/Cocoa/_WKWebsitePolicies.h:
1434         * UIProcess/API/Cocoa/_WKWebsitePolicies.mm:
1435         (-[_WKWebsitePolicies setAllowedAutoplayQuirks:]):
1436         (-[_WKWebsitePolicies allowedAutoplayQuirks]):
1437         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1438         (WebKit::WebFrameLoaderClient::applyToDocumentLoader):
1439         * WebProcess/WebPage/WebPage.cpp:
1440         (WebKit::WebPage::updateWebsitePolicies):
1441
1442 2017-10-16  Andy Estes  <aestes@apple.com>
1443
1444         [Apple Pay] Add subLocality and subAdministrativeArea to ApplePayPaymentContact and ApplePayError
1445         https://bugs.webkit.org/show_bug.cgi?id=178191
1446         <rdar://problem/34906367>
1447
1448         Reviewed by Tim Horton.
1449
1450         * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
1451         (WebKit::toNSError):
1452
1453 2017-10-16  Tim Horton  <timothy_horton@apple.com>
1454
1455         Safari crashes after searching PDF (under [WKPDFView zoom:to:atPoint:kind:])
1456         https://bugs.webkit.org/show_bug.cgi?id=178358
1457         <rdar://problem/34676899>
1458
1459         Reviewed by Wenson Hsieh.
1460
1461         * UIProcess/ios/WKPDFView.mm:
1462         (-[WKPDFView _didFindMatch:]):
1463         UIPDFSelection can return a null rect as the selection's bounds.
1464         We can't zoom to a null rect (and doing so results in CA throwing an
1465         exception later).
1466
1467 2017-10-16  Alex Christensen  <achristensen@webkit.org>
1468
1469         Add a _WKThumbnailView initializer with a WKWebView
1470         https://bugs.webkit.org/show_bug.cgi?id=178351
1471         <rdar://problem/34979453>
1472
1473         Reviewed by Tim Horton.
1474
1475         * UIProcess/API/Cocoa/WKWebView.mm:
1476         (-[WKWebView _page]):
1477         (-[WKWebView _setThumbnailView:]):
1478         (-[WKWebView _thumbnailView]):
1479         (-[WKWebView _setIgnoresAllEvents:]):
1480         (-[WKWebView _ignoresAllEvents]):
1481         * UIProcess/API/Cocoa/WKWebViewInternal.h:
1482         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1483         * UIProcess/API/Cocoa/_WKThumbnailView.h:
1484         * UIProcess/API/Cocoa/_WKThumbnailView.mm:
1485         (-[_WKThumbnailView initWithFrame:fromWKWebView:]):
1486         (-[_WKThumbnailView _viewWasUnparented]):
1487         (-[_WKThumbnailView _viewWasParented]):
1488
1489 2017-10-16  Alex Christensen  <achristensen@webkit.org>
1490
1491         Expose more WKView properties as WKWebViewPrivate SPI
1492         https://bugs.webkit.org/show_bug.cgi?id=178349
1493         <rdar://problem/34980919>
1494
1495         Reviewed by Tim Horton.
1496
1497         _backgroundExtendsBeyondPage was already exposed on iOS, but we need it on Mac, too.
1498         A few other properties also need exposing.
1499
1500         * UIProcess/API/Cocoa/WKWebView.mm:
1501         (toAPIScrollbarStyle):
1502         (toCoreScrollbarStyle):
1503         (-[WKWebView _setBackgroundExtendsBeyondPage:]):
1504         (-[WKWebView _backgroundExtendsBeyondPage]):
1505         (-[WKWebView _setOverlayScrollbarStyle:]):
1506         (-[WKWebView _overlayScrollbarStyle]):
1507         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1508
1509 2017-10-16  Chris Dumez  <cdumez@apple.com>
1510
1511         Log using differential privacy domains where the WebContent process crashes
1512         https://bugs.webkit.org/show_bug.cgi?id=178346
1513         <rdar://problem/33293830>
1514
1515         Reviewed by Alex Christensen.
1516
1517         * UIProcess/WebPageProxy.cpp:
1518         (WebKit::WebPageProxy::reload):
1519         (WebKit::WebPageProxy::currentURL const):
1520         (WebKit::WebPageProxy::processDidTerminate):
1521         * UIProcess/WebPageProxy.h:
1522         * UIProcess/WebProcessProxy.cpp:
1523         (WebKit::WebProcessProxy::didClose):
1524
1525 2017-10-16  Youenn Fablet  <youenn@apple.com>
1526
1527         Activate Cache API by default
1528         https://bugs.webkit.org/show_bug.cgi?id=178186
1529
1530         Reviewed by Chris Dumez.
1531
1532         * Shared/WebPreferencesDefinitions.h:
1533
1534 2017-10-16  Sam Weinig  <sam@webkit.org>
1535
1536         [Settings] Remove all custom code from Settings.h/cpp
1537         https://bugs.webkit.org/show_bug.cgi?id=178330
1538
1539         Reviewed by Simon Fraser.
1540
1541         * Shared/WebPreferencesDefinitions.h:
1542         * UIProcess/API/C/WKPreferences.cpp:
1543         (WKPreferencesSetFrameFlatteningEnabled):
1544         (WKPreferencesGetFrameFlatteningEnabled):
1545         * UIProcess/API/glib/WebKitSettings.cpp:
1546         (webkit_settings_get_enable_frame_flattening):
1547         (webkit_settings_set_enable_frame_flattening):
1548         * WebProcess/InjectedBundle/InjectedBundle.cpp:
1549         (WebKit::InjectedBundle::setFrameFlatteningEnabled):
1550         
1551             Update for naming changes of FrameFlattening now that it is an enum class.
1552
1553         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
1554         (WebKit::WebChromeClient::contentsSizeChanged const):
1555
1556             Ge the effectiveFrameFlattening from the FrameView, rather than the Settings.
1557
1558 2017-10-16  Chris Dumez  <cdumez@apple.com>
1559
1560         [WK2][NetworkSession] Add support for resuming downloads
1561         https://bugs.webkit.org/show_bug.cgi?id=177625
1562         <rdar://problem/34345975>
1563
1564         Reviewed by Alex Christensen.
1565
1566         Add support for resuming downloads for the WK2 NETWORK_SESSION code path.
1567
1568         This was tested manually. I was unable to write an API test because our tests
1569         do not run an HTTP server and CFNetwork does not seem to generate resume data
1570         when cancelling a download over non-HTTP.
1571
1572         * NetworkProcess/Downloads/Download.cpp:
1573         (WebKit::Download::didReceiveChallenge):
1574         (WebKit::Download::continueCanAuthenticateAgainstProtectionSpace):
1575         * NetworkProcess/Downloads/Download.h:
1576         * NetworkProcess/Downloads/DownloadManager.cpp:
1577         (WebKit::DownloadManager::continueCanAuthenticateAgainstProtectionSpace):
1578         (WebKit::DownloadManager::resumeDownload):
1579         * NetworkProcess/Downloads/cocoa/DownloadCocoa.mm:
1580         (WebKit::Download::resume):
1581         This currently includes a workaround for <rdar://problem/34745171>. We update the
1582         resume data to include the NSURLSessionResumeInfoLocalPath key with the final
1583         destination path so that CFNetwork looks for the temporary data at the right
1584         location.
1585
1586         * NetworkProcess/cocoa/NetworkSessionCocoa.h:
1587         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
1588         (-[WKNetworkSessionDelegate URLSession:task:didReceiveChallenge:completionHandler:]):
1589         (WebKit::NetworkSessionCocoa::downloadTaskWithResumeData):
1590         * Shared/Authentication/AuthenticationManager.cpp:
1591         (WebKit::AuthenticationManager::didReceiveAuthenticationChallenge):
1592         * Shared/Authentication/AuthenticationManager.h:
1593
1594 2017-10-16  Adrian Perez de Castro  <aperez@igalia.com>
1595
1596         [WPE] Build failure due to invalid cast of EGLNativeWindowType when targetting 64-bit ARM
1597         https://bugs.webkit.org/show_bug.cgi?id=178090
1598
1599         Reviewed by Michael Catanzaro.
1600
1601         EGLNativeWindowType can be aliased to a different type depending (at least) on the EGL
1602         implementation, its build options, and the libepoxy build options.  Using "static_cast"
1603         works when it is a numeric value and the width of the value needs to be optionally
1604         extended to 64 bits (e.g. the EGL type is "int" in a 32-bit CPU) but not for pointers,
1605         and using "reinterpret_cast" works when the size of a pointer is 64 bits but not in other
1606         cases. Therefore it seems reasonable to use a plain C cast expression to solve this
1607         particular situation.
1608
1609         * WebProcess/WebPage/wpe/AcceleratedSurfaceWPE.cpp:
1610         (WebKit::AcceleratedSurfaceWPE::window const): Use a good old plain C cast expression.
1611
1612 2017-10-16  Chris Dumez  <cdumez@apple.com>
1613
1614         Clicks on Link with download attribute causes all (other) links to trigger download when clicked
1615         https://bugs.webkit.org/show_bug.cgi?id=178267
1616         <rdar://problem/34985016>
1617
1618         Reviewed by Darin Adler.
1619
1620         When clicking on an anchor with the download attribute, the m_syncNavigationActionHasDownloadAttribute
1621         flag on WebPageProxy would get set. This flag would not get reset right away and instead, it would get
1622         updated during the next call to WebPageProxy::decidePolicyForNavigationAction(). The issue is that if
1623         you later click on a link with target="_blank", WebPageProxy::decidePolicyForNewWindowAction() gets
1624         called instead of WebPageProxy::decidePolicyForNavigationAction() and we do not reset the
1625         m_syncNavigationActionHasDownloadAttribute flag and we force a download.
1626
1627         To address the problem, I got rid of this flag on WebPageProxy and it is error-prone and should really
1628         not be at page-level. Instead, I added a shouldForceDownload flag on the navigation object. It makes
1629         more sense to associate the flag with the navigation and makes it less error-prone.
1630
1631         * UIProcess/API/APINavigation.h:
1632         (API::Navigation::setShouldForceDownload):
1633         (API::Navigation::shouldForceDownload const):
1634         * UIProcess/WebPageProxy.cpp:
1635         (WebKit::WebPageProxy::receivedPolicyDecision):
1636         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
1637         * UIProcess/WebPageProxy.h:
1638
1639 2017-10-16  Ryan Haddad  <ryanhaddad@apple.com>
1640
1641         Unreviewed, rolling out r223271.
1642
1643         This change introduced LayoutTest failures on WK1.
1644
1645         Reverted changeset:
1646
1647         "Use asynchronous ResourceHandleClient calls for WebKit1"
1648         https://bugs.webkit.org/show_bug.cgi?id=160677
1649         https://trac.webkit.org/changeset/223271
1650
1651 2017-10-13  Youenn Fablet  <youenn@apple.com>
1652
1653         Implement listing origins for which CacheStorage is storing data
1654         https://bugs.webkit.org/show_bug.cgi?id=178236
1655
1656         Reviewed by Chris Dumez.
1657
1658         Cache storage is split on per-origin folders which name is obfuscated through salting.
1659         To retrieve the origin for each folder, an origin file is now stored within each folder.
1660         This file contains the actual origin.
1661
1662         Adding support to get the list of origin by iterating through each folder and
1663         getting the actual origin by reading the content of the 'origin' file.
1664
1665         Adding C API for WebKitTestRunner.
1666
1667         * NetworkProcess/cache/CacheStorageEngine.cpp:
1668         (WebKit::CacheStorage::Engine::fetchEntries):
1669         (WebKit::CacheStorage::ReadOriginsTaskCounter::create):
1670         (WebKit::CacheStorage::ReadOriginsTaskCounter::~ReadOriginsTaskCounter):
1671         (WebKit::CacheStorage::ReadOriginsTaskCounter::addOrigin):
1672         (WebKit::CacheStorage::ReadOriginsTaskCounter::ReadOriginsTaskCounter):
1673         * NetworkProcess/cache/CacheStorageEngine.h:
1674         * NetworkProcess/cache/CacheStorageEngineCaches.cpp:
1675         (WebKit::CacheStorage::cachesOriginFilename):
1676         (WebKit::CacheStorage::Caches::retrieveOriginFromDirectory):
1677         (WebKit::CacheStorage::Caches::Caches):
1678         (WebKit::CacheStorage::Caches::storeOrigin):
1679         (WebKit::CacheStorage::Caches::readOrigin):
1680         (WebKit::CacheStorage::Caches::initialize):
1681         * NetworkProcess/cache/CacheStorageEngineCaches.h:
1682         (WebKit::CacheStorage::Caches::origin const):
1683         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
1684         (WKWebsiteDataStoreGetFetchCacheOrigins):
1685         * UIProcess/API/C/WKWebsiteDataStoreRef.h:
1686
1687 2017-10-13  Alex Christensen  <achristensen@webkit.org>
1688
1689         Fix API tests after r223269.
1690         https://bugs.webkit.org/show_bug.cgi?id=178246
1691
1692         * UIProcess/API/APIContentRuleListStore.cpp:
1693         (API::ContentRuleListStore::getContentRuleListSource):
1694         Version 10 also has the ability to recover content rule list source.
1695
1696 2017-10-11  Gustavo Noronha Silva  <gustavo.noronha@collabora.co.uk>
1697
1698         [GLib] WebKitNavigationAction should tell whether it is a redirect
1699         https://bugs.webkit.org/show_bug.cgi?id=178178
1700
1701         There is no good way to know whether a given navigation action has been caused
1702         by a redirect through the glib API. This is necessary to implement some app mode
1703         heuristics for Epiphany.
1704
1705         Reviewed by Carlos Garcia Campos.
1706
1707         * UIProcess/API/glib/WebKitNavigationAction.cpp:
1708         (webkit_navigation_action_is_redirect): returns whether the navigation action is a redirect.
1709         * UIProcess/API/glib/WebKitNavigationActionPrivate.h: add isRedirect to the wrapper object.
1710         (_WebKitNavigationAction::_WebKitNavigationAction):
1711         * UIProcess/API/gtk/WebKitNavigationAction.h: add the new API.
1712         * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt: ditto.
1713         * UIProcess/API/wpe/WebKitNavigationAction.h: ditto.
1714
1715 2017-10-12  Brady Eidson  <beidson@apple.com>
1716
1717         SW "Hello world".
1718         https://bugs.webkit.org/show_bug.cgi?id=178187
1719
1720         Reviewed by Andy Estes.
1721
1722         * WebProcess/WebProcess.cpp:
1723         (WebKit::WebProcess::startServiceWorkerContext):
1724
1725 2017-10-12  Alex Christensen  <achristensen@webkit.org>
1726
1727         Remove unnecessary includes in WebKit
1728         https://bugs.webkit.org/show_bug.cgi?id=178235
1729
1730         Reviewed by Tim Horton.
1731
1732         * Platform/IPC/ArgumentCoders.h:
1733         * WebProcess/WebProcess.cpp:
1734         * WebProcess/WebStorage/StorageAreaImpl.h:
1735
1736 2017-10-12  Alex Christensen  <achristensen@webkit.org>
1737
1738         Increment ContentRuleListStore::CurrentContentRuleListFileVersion
1739         https://bugs.webkit.org/show_bug.cgi?id=178246
1740         <rdar://problem/34890057>
1741
1742         Reviewed by Tim Horton.
1743
1744         * UIProcess/API/APIContentRuleListStore.h:
1745         Things are crashing.  Something isn't binary reverse compatible.
1746         Probably something related to r222602.
1747         This is why we have a version number to update.
1748
1749 2017-10-12  Alex Christensen  <achristensen@webkit.org>
1750
1751         Expose some of WKView's WebViewImpl accessors through WKWebViewPrivate
1752         https://bugs.webkit.org/show_bug.cgi?id=178240
1753         <rdar://problem/34962720>
1754
1755         Reviewed by Tim Horton.
1756         
1757         Also renamed createFullScreenWindow to fullScreenWindow to reflect the fact that it returns
1758         an autoreleased NSWindow so we don't make the same naming mistake in the WKWebView SPI.
1759
1760         * UIProcess/API/Cocoa/WKWebView.mm:
1761         (-[WKWebView _dismissContentRelativeChildWindows]):
1762         (-[WKWebView _setFrame:andScrollBy:]):
1763         (-[WKWebView _setTotalHeightOfBanners:]):
1764         (-[WKWebView _totalHeightOfBanners]):
1765         (-[WKWebView _beginDeferringViewInWindowChanges]):
1766         (-[WKWebView _endDeferringViewInWindowChanges]):
1767         (-[WKWebView _endDeferringViewInWindowChangesSync]):
1768         (-[WKWebView _gestureEventWasNotHandledByWebCore:]):
1769         (-[WKWebView _setIgnoresNonWheelEvents:]):
1770         (-[WKWebView _ignoresNonWheelEvents]):
1771         (-[WKWebView _setCustomSwipeViews:]):
1772         (-[WKWebView _setCustomSwipeViewsTopContentInset:]):
1773         (-[WKWebView _tryToSwipeWithEvent:ignoringPinnedState:]):
1774         (-[WKWebView _setDidMoveSwipeSnapshotCallback:]):
1775         (-[WKWebView _fullScreenPlaceholderView]):
1776         (-[WKWebView _fullScreenWindow]):
1777         (-[WKWebView _disableFrameSizeUpdates]):
1778         (-[WKWebView _enableFrameSizeUpdates]):
1779         (-[WKWebView _canChangeFrameLayout:]):
1780         (-[WKWebView _underlayColor]):
1781         (-[WKWebView _setUnderlayColor:]):
1782         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1783         * UIProcess/API/mac/WKView.mm:
1784         (-[WKView createFullScreenWindow]):
1785         * UIProcess/Cocoa/WebViewImpl.h:
1786         * UIProcess/Cocoa/WebViewImpl.mm:
1787         (WebKit::WebViewImpl::fullScreenWindowController):
1788         (WebKit::WebViewImpl::fullScreenWindow):
1789         (WebKit::WebViewImpl::createFullScreenWindow): Deleted.
1790
1791 2017-10-12  Youenn Fablet  <youenn@apple.com>
1792
1793         Layout Test http/tests/cache-storage/cache-clearing.https.html is failing
1794         https://bugs.webkit.org/show_bug.cgi?id=178200
1795
1796         Reviewed by Chris Dumez.
1797
1798         Deleting only the per-origin folders inside the CacheStorage engine root folder.
1799
1800         * NetworkProcess/cache/CacheStorageEngine.cpp:
1801         (WebKit::CacheStorage::Engine::clearAllCaches):
1802         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
1803         (WKWebsiteDataStoreRemoveAllFetchCaches):
1804         (WKWebsiteDataStoreRemoveFetchCacheForOrigin):
1805         * UIProcess/API/C/WKWebsiteDataStoreRef.h:
1806
1807 2017-10-12  Chris Dumez  <cdumez@apple.com>
1808
1809         [Mac] Add support for MouseEvent.buttons
1810         https://bugs.webkit.org/show_bug.cgi?id=178214
1811
1812         Reviewed by Ryosuke Niwa.
1813
1814         * Shared/WebEvent.h:
1815         (WebKit::WebMouseEvent::buttons const):
1816         * Shared/WebEventConversion.cpp:
1817         (WebKit::WebKit2PlatformMouseEvent::WebKit2PlatformMouseEvent):
1818         * Shared/WebMouseEvent.cpp:
1819         (WebKit::WebMouseEvent::WebMouseEvent):
1820         (WebKit::WebMouseEvent::encode const):
1821         (WebKit::WebMouseEvent::decode):
1822         * Shared/mac/WebEventFactory.mm:
1823         (WebKit::currentlyPressedMouseButtons):
1824         (WebKit::WebEventFactory::createWebMouseEvent):
1825         * WebProcess/Plugins/PDF/PDFPlugin.mm:
1826         (WebKit::PDFPlugin::showContextMenuAtPoint):
1827         * WebProcess/Plugins/PluginView.cpp:
1828         (WebKit::PluginView::createWebEvent const):
1829         * WebProcess/WebPage/WebPage.cpp:
1830         (WebKit::WebPage::navigateToPDFLinkWithSimulatedClick):
1831         (WebKit::WebPage::simulateMouseDown):
1832         (WebKit::WebPage::simulateMouseUp):
1833         (WebKit::WebPage::simulateMouseMotion):
1834
1835 2017-10-12  Youenn Fablet  <youenn@apple.com>
1836
1837         Add API to clean CacheStorage data
1838         https://bugs.webkit.org/show_bug.cgi?id=178034
1839
1840         Unreviewed.
1841
1842         * Shared/WebsiteData/WebsiteDataType.h: fixing the DOMCache value. 
1843
1844 2017-10-12  Stephan Szabo  <stephan.szabo@sony.com>
1845
1846         [WinCairo] add WebProcess files for wincairo webkit
1847         https://bugs.webkit.org/show_bug.cgi?id=178024
1848
1849         Reviewed by Alex Christensen.
1850
1851         * PlatformWin.cmake:
1852         * WebProcess/Cookies/curl/WebCookieManagerCurl.cpp: Added.
1853         (WebKit::WebCookieManager::platformSetHTTPCookieAcceptPolicy):
1854         (WebKit::WebCookieManager::platformGetHTTPCookieAcceptPolicy):
1855         * WebProcess/InjectedBundle/win/InjectedBundleWin.cpp: Added.
1856         (WebKit::InjectedBundle::initialize):
1857         (WebKit::InjectedBundle::setBundleParameter):
1858         (WebKit::InjectedBundle::setBundleParameters):
1859         * WebProcess/Plugins/Netscape/JSNPObject.cpp:
1860         * WebProcess/Plugins/Netscape/win/PluginProxyWin.cpp: Added.
1861         (WebKit::PluginProxy::needsBackingStore const):
1862         * WebProcess/WebCoreSupport/win/WebContextMenuClientWin.cpp: Added.
1863         (WebKit::WebContextMenuClient::lookUpInDictionary):
1864         (WebKit::WebContextMenuClient::isSpeaking):
1865         (WebKit::WebContextMenuClient::speak):
1866         (WebKit::WebContextMenuClient::stopSpeaking):
1867         * WebProcess/WebCoreSupport/win/WebFrameNetworkingContext.cpp: Added.
1868         (WebKit::WebFrameNetworkingContext::ensurePrivateBrowsingSession):
1869         (WebKit::WebFrameNetworkingContext::ensureWebsiteDataStoreSession):
1870         (WebKit::WebFrameNetworkingContext::WebFrameNetworkingContext):
1871         (WebKit::WebFrameNetworkingContext::storageSession const):
1872         (WebKit::WebFrameNetworkingContext::webFrameLoaderClient const):
1873         (WebKit::WebFrameNetworkingContext::blockedError const):
1874         * WebProcess/WebCoreSupport/win/WebFrameNetworkingContext.h: Added.
1875         (WebKit::WebFrameNetworkingContext::create):
1876         * WebProcess/WebCoreSupport/win/WebPopupMenuWin.cpp: Added.
1877         (WebKit::WebPopupMenu::setUpPlatformData):
1878         * WebProcess/WebPage/win/WebInspectorUIWin.cpp: Added.
1879         (WebKit::WebInspectorUI::canSave):
1880         (WebKit::WebInspectorUI::localizedStringsURL):
1881         (WebKit::RemoteWebInspectorUI::localizedStringsURL):
1882         * WebProcess/WebPage/win/WebPageWin.cpp: Added.
1883         (WebKit::WebPage::platformInitialize):
1884         (WebKit::WebPage::platformDetach):
1885         (WebKit::WebPage::platformEditorState const):
1886         (WebKit::WebPage::platformPreferencesDidChange):
1887         (WebKit::WebPage::performDefaultBehaviorForKeyEvent):
1888         (WebKit::WebPage::platformHasLocalDataForURL):
1889         (WebKit::WebPage::cachedResponseMIMETypeForURL):
1890         (WebKit::WebPage::platformCanHandleRequest):
1891         (WebKit::WebPage::cachedSuggestedFilenameForURL):
1892         (WebKit::WebPage::cachedResponseDataForURL):
1893         (WebKit::WebPage::platformUserAgent const):
1894         (WebKit::WebPage::interpretKeyEvent):
1895         * WebProcess/WebProcess.cpp:
1896         (WebKit::WebProcess::ensureWebToStorageProcessConnection):
1897         * WebProcess/win/WebProcessWin.cpp: Added.
1898         (loadResourceIntoBuffer):
1899         (WebKit::WebProcess::platformInitializeWebProcess):
1900         (WebKit::WebProcess::platformTerminate):
1901         (WebKit::WebProcess::platformSetCacheModel):
1902
1903 2017-10-12  David Kilzer  <ddkilzer@apple.com>
1904
1905         [iOS] Fix -Wunused-lambda-capture warnings in WebCore/WebKit with new clang compiler
1906         <https://webkit.org/b/178226>
1907
1908         Reviewed by Chris Fleizach.
1909
1910         * UIProcess/ios/WKContentViewInteraction.mm:
1911         (-[WKContentView changeSelectionWithTouchAt:withSelectionTouch:baseIsStart:withFlags:]):
1912         - Remove unused lambda variable 'touch' which was also passed as
1913           an argument.
1914         (-[WKContentView changeSelectionWithTouchesFrom:to:withGesture:withState:]):
1915         - Remove unused lambda variable 'gestureState' which was also
1916           passed as an argument.
1917         (-[WKContentView _simulateLongPressActionAtLocation:]):
1918         - Remove unused lambda variable 'location'.
1919
1920 2017-10-12  John Wilander  <wilander@apple.com>
1921
1922         ResourceLoadObserver::logFrameNavigation() should use redirectResponse.url()
1923         https://bugs.webkit.org/show_bug.cgi?id=175257
1924         <rdar://problem/33359866>
1925
1926         Reviewed by Brent Fulgham.
1927
1928         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
1929         (-[WKWebsiteDataStore _resourceLoadStatisticsIsRegisteredAsSubFrameUnder:topFrameHost:completionHandler:]):
1930         (-[WKWebsiteDataStore _resourceLoadStatisticsIsRegisteredAsRedirectingTo:hostRedirectedTo:completionHandler:]):
1931             Test infrastructure.
1932         * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
1933         * UIProcess/WebResourceLoadStatisticsStore.cpp:
1934         (WebKit::WebResourceLoadStatisticsStore::isRegisteredAsSubFrameUnder):
1935         (WebKit::WebResourceLoadStatisticsStore::isRegisteredAsRedirectingTo):
1936             Test infrastructure.
1937         * UIProcess/WebResourceLoadStatisticsStore.h:
1938
1939 2017-10-12  Andy Estes  <aestes@apple.com>
1940
1941         [iOS] Conditionally rename DatabaseProcess to StorageProcess when building for iOS devices
1942         https://bugs.webkit.org/show_bug.cgi?id=178181
1943         <rdar://problem/33660282>
1944
1945         Reviewed by Dan Bernstein.
1946
1947         * Configurations/BaseTarget.xcconfig:
1948         * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
1949         (WebKit::serviceName):
1950         * WebKit.xcodeproj/project.pbxproj:
1951
1952 2017-10-12  Youenn Fablet  <youenn@apple.com>
1953
1954         CacheStorage persistent folder should be in /Library/Cache
1955         https://bugs.webkit.org/show_bug.cgi?id=178193
1956
1957         Reviewed by Brady Eidson.
1958
1959         * UIProcess/API/Cocoa/APIWebsiteDataStoreCocoa.mm:
1960         (API::WebsiteDataStore::defaultCacheStorageDirectory): Making CacheStorage
1961         directory a subfolder of Caches folder.
1962         (API::WebsiteDataStore::defaultDataStoreConfiguration):
1963         * UIProcess/WebProcessPool.cpp:
1964         (WebKit::legacyWebsiteDataStoreConfiguration):
1965         (WebKit::WebProcessPool::ensureNetworkProcess): Make sure the web site data store
1966         has the right cache directory path. Also make sure that the quota is set even if there is no folder specified.
1967         Quota may still be useful in case of non persistent sessions.
1968         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
1969         (WebKit::WebsiteDataStore::resolveDirectoriesIfNecessary):
1970         * UIProcess/API/glib/APIWebsiteDataStoreGLib.cpp:
1971         (API::WebsiteDataStore::defaultCacheStorageDirectory):
1972
1973 2017-10-11  Sam Weinig  <sam@webkit.org>
1974
1975         Remove out-parameter variants of copyToVector
1976         https://bugs.webkit.org/show_bug.cgi?id=178155
1977
1978         Reviewed by Tim Horton.
1979
1980         * Shared/API/Cocoa/_WKRemoteObjectInterface.mm:
1981         (-[_WKRemoteObjectInterface debugDescription]):
1982         * Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.cpp:
1983         (WebKit::dump):
1984         * UIProcess/WebPageProxy.cpp:
1985         (WebKit::WebPageProxy::resetState):
1986         * UIProcess/WebProcessPool.cpp:
1987         (WebKit::WebProcessPool::createNewWebProcess):
1988         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
1989         (WebKit::WebsiteDataStore::parameters):
1990         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
1991         (WebKit::WebsiteDataStore::pendingCookies const):
1992         * UIProcess/ios/ProcessAssertionIOS.mm:
1993         (-[WKProcessAssertionBackgroundTaskManager _notifyClientsOfImminentSuspension]):
1994         * WebProcess/Cookies/WebCookieManager.cpp:
1995         (WebKit::WebCookieManager::getHostnamesWithCookies):
1996         * WebProcess/Geolocation/WebGeolocationManager.cpp:
1997         (WebKit::WebGeolocationManager::didChangePosition):
1998         (WebKit::WebGeolocationManager::didFailToDeterminePosition):
1999         * WebProcess/Network/WebLoaderStrategy.cpp:
2000         (WebKit::WebLoaderStrategy::internallyFailedLoadTimerFired):
2001
2002             Replace out-parameter based copyToVector, with one that returns a Vector.
2003
2004 2017-10-11  Jaehun Lim  <ljaehun.lim@samsung.com>
2005
2006         Fix debug build
2007
2008         Unreviewed.
2009
2010         Add ENABLE(SERVICE_WORKER) guard.
2011
2012         * UIProcess/WebProcessPool.cpp:
2013         (WebKit::WebProcessPool::createWebPage):
2014
2015 2017-10-11  Youenn Fablet  <youenn@apple.com>
2016
2017         Add API to clean CacheStorage data
2018         https://bugs.webkit.org/show_bug.cgi?id=178034
2019
2020         Unreviewed.
2021
2022         * NetworkProcess/NetworkProcess.cpp:
2023         (WebKit::NetworkProcess::fetchWebsiteData): Fixing lifetime of aggregator.
2024
2025 2017-10-11  Youenn Fablet  <youenn@apple.com>
2026
2027         Add API to clean CacheStorage data
2028         https://bugs.webkit.org/show_bug.cgi?id=178034
2029
2030         Reviewed by Chris Dumez.
2031
2032         Introducing a new website data type for DOMCache.
2033         Adding API to delete DOMCache for a given origin or for all origins.
2034         This is added to WKWebsiteDataStore.
2035
2036         Cleaning a CacheStorage will remove all data in the Cache object but the object will stay live
2037         for the duration of the NetworkProcess.
2038         This allows ensuring that once a cache is cleaned, WebProcess will update to this new state.
2039
2040         Fetching of WebsiteData for DOMCache is not implemented yet since we do not keep a list of all origins for which we have data.
2041
2042         * NetworkProcess/NetworkProcess.cpp:
2043         (WebKit::fetchDOMCacheEntries):
2044         (WebKit::NetworkProcess::fetchWebsiteData):
2045         (WebKit::NetworkProcess::deleteWebsiteData):
2046         (WebKit::NetworkProcess::deleteWebsiteDataForOrigins):
2047         * NetworkProcess/cache/CacheStorageEngine.cpp:
2048         (WebKit::CacheStorage::Engine::cachesRootPath):
2049         (WebKit::CacheStorage::Engine::fetchEntries):
2050         (WebKit::CacheStorage::ClearTasksHandler::ClearTasksHandler):
2051         (WebKit::CacheStorage::ClearTasksHandler::~ClearTasksHandler):
2052         (WebKit::CacheStorage::Engine::clearEngines):
2053         (WebKit::CacheStorage::Engine::clearCachesForOrigins):
2054         (WebKit::CacheStorage::Engine::readCachesFromDisk):
2055         (WebKit::CacheStorage::deleteFolder):
2056         (WebKit::CacheStorage::Engine::clearCaches):
2057         (WebKit::CacheStorage::Engine::unlock): Removing the assertion as Cache objects are removed when clearing data.
2058         * NetworkProcess/cache/CacheStorageEngine.h:
2059         * NetworkProcess/cache/CacheStorageEngineCaches.cpp:
2060         (WebKit::CacheStorage::Caches::Caches):
2061         (WebKit::CacheStorage::Caches::clear):
2062         * NetworkProcess/cache/CacheStorageEngineCaches.h:
2063         (WebKit::CacheStorage::Caches::create):
2064         * Shared/WebsiteData/WebsiteDataType.h:
2065         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
2066         (WKWebsiteDataStoreRemoveAllDOMCaches):
2067         (WKWebsiteDataStoreRemoveDOMCacheForOrigin):
2068         * UIProcess/API/C/WKWebsiteDataStoreRef.h:
2069         * UIProcess/API/Cocoa/WKWebsiteDataRecord.h:
2070         * UIProcess/API/Cocoa/WKWebsiteDataRecord.mm:
2071         (dataTypesToString):
2072         * UIProcess/API/Cocoa/WKWebsiteDataRecordInternal.h:
2073         (WebKit::toWebsiteDataType):
2074         (WebKit::toWKWebsiteDataTypes):
2075         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
2076         (+[WKWebsiteDataStore allWebsiteDataTypes]):
2077         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
2078         (WebKit::computeNetworkProcessAccessTypeForDataFetch):
2079         (WebKit::computeNetworkProcessAccessTypeForDataRemoval):
2080
2081 2017-10-11  Chris Dumez  <cdumez@apple.com>
2082
2083         [Geolocation] Expose Coordinates.floorLevel
2084         https://bugs.webkit.org/show_bug.cgi?id=178173
2085         <rdar://problem/34918936>
2086
2087         Reviewed by Ryosuke Niwa.
2088
2089         * UIProcess/API/C/WKGeolocationPosition.cpp:
2090         (WKGeolocationPositionCreate):
2091         (WKGeolocationPositionCreate_b):
2092         (WKGeolocationPositionCreate_c):
2093         * UIProcess/API/C/WKGeolocationPosition.h:
2094
2095 2017-10-11  Youenn Fablet  <youenn@apple.com>
2096
2097         Bump default cache storage quota to 20MB
2098         https://bugs.webkit.org/show_bug.cgi?id=178132
2099
2100         Reviewed by Alex Christensen.
2101
2102         Adding the ability to set the quota per origin through WebsiteDataStore.
2103         Moving cache storage directory setting also in WebsiteDataStore.
2104
2105         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
2106         (WebKit::NetworkConnectionToWebProcess::ensureLegacyPrivateBrowsingSession):
2107         * NetworkProcess/NetworkProcess.cpp:
2108         (WebKit::NetworkProcess::initializeNetworkProcess):
2109         * NetworkProcess/mac/RemoteNetworkingContext.mm:
2110         (WebKit::RemoteNetworkingContext::ensureWebsiteDataStoreSession):
2111         * Shared/WebsiteDataStoreParameters.cpp:
2112         (WebKit::WebsiteDataStoreParameters::encode const):
2113         (WebKit::WebsiteDataStoreParameters::decode):
2114         * Shared/WebsiteDataStoreParameters.h:
2115         * UIProcess/API/APIProcessPoolConfiguration.cpp:
2116         (API::ProcessPoolConfiguration::createWithLegacyOptions):
2117         (API::ProcessPoolConfiguration::createWithWebsiteDataStoreConfiguration):
2118         (API::ProcessPoolConfiguration::ProcessPoolConfiguration):
2119         (API::ProcessPoolConfiguration::copy):
2120         * UIProcess/API/APIProcessPoolConfiguration.h:
2121         * UIProcess/API/C/WKContextConfigurationRef.cpp:
2122         * UIProcess/API/C/WKContextConfigurationRef.h:
2123         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
2124         (-[WKWebsiteDataStore _cacheStoragePerOriginQuota]):
2125         (-[WKWebsiteDataStore _setCacheStoragePerOriginQuota:]):
2126         (-[WKWebsiteDataStore _cacheStorageDirectory]):
2127         (-[WKWebsiteDataStore _setCacheStorageDirectory:]):
2128         * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
2129         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
2130         * UIProcess/WebProcessPool.cpp:
2131         (WebKit::legacyWebsiteDataStoreConfiguration):
2132         (WebKit::WebProcessPool::ensureNetworkProcess):
2133         (WebKit::WebProcessPool::setAnyPageGroupMightHavePrivateBrowsingEnabled):
2134         * UIProcess/WebProcessPool.h:
2135         * UIProcess/WebsiteData/WebsiteDataStore.h:
2136         (WebKit::WebsiteDataStore::cacheStoragePerOriginQuota const):
2137         (WebKit::WebsiteDataStore::setCacheStoragePerOriginQuota):
2138         (WebKit::WebsiteDataStore::cacheStorageDirectory const):
2139         (WebKit::WebsiteDataStore::setCacheStorageDirectory):
2140
2141 2017-10-11  Myles C. Maxfield  <mmaxfield@apple.com>
2142
2143         Allow PAL to log messages
2144         https://bugs.webkit.org/show_bug.cgi?id=171523
2145
2146         Reviewed by Alex Christensen.
2147
2148         * Platform/Logging.h:
2149         * Scripts/generate-forwarding-headers.pl:
2150
2151 2017-10-11  Ryosuke Niwa  <rniwa@webkit.org>
2152
2153         Sanitize URL in pasteboard for other applications and cross origin content
2154         https://bugs.webkit.org/show_bug.cgi?id=178060
2155         <rdar://problem/34874518>
2156
2157         Reviewed by Wenson Hsieh.
2158
2159         Plubmed the origin identifier through IPC from Pasteboard in WebContent process to PlatformPasteboard in UIProcess.
2160
2161         * UIProcess/Cocoa/WebPasteboardProxyCocoa.mm:
2162         (WebKit::WebPasteboardProxy::typesSafeForDOMToReadAndWrite):
2163         * UIProcess/WebPasteboardProxy.cpp:
2164         (WebKit::WebPasteboardProxy::typesSafeForDOMToReadAndWrite):
2165         * UIProcess/WebPasteboardProxy.h:
2166         * UIProcess/WebPasteboardProxy.messages.in:
2167         * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
2168         (WebKit::WebPlatformStrategies::typesSafeForDOMToReadAndWrite):
2169         * WebProcess/WebCoreSupport/WebPlatformStrategies.h:
2170
2171 2017-10-11  Chris Dumez  <cdumez@apple.com>
2172
2173         Modernize Geolocation code
2174         https://bugs.webkit.org/show_bug.cgi?id=178148
2175
2176         Reviewed by Ryosuke Niwa.
2177
2178         * Shared/WebGeolocationPosition.cpp:
2179         (WebKit::WebGeolocationPosition::create):
2180         (WebKit::WebGeolocationPosition::~WebGeolocationPosition):
2181         * Shared/WebGeolocationPosition.h:
2182         (WebKit::WebGeolocationPosition::timestamp const):
2183         (WebKit::WebGeolocationPosition::latitude const):
2184         (WebKit::WebGeolocationPosition::longitude const):
2185         (WebKit::WebGeolocationPosition::accuracy const):
2186         (WebKit::WebGeolocationPosition::altitude const):
2187         (WebKit::WebGeolocationPosition::altitudeAccuracy const):
2188         (WebKit::WebGeolocationPosition::heading const):
2189         (WebKit::WebGeolocationPosition::speed const):
2190         (WebKit::WebGeolocationPosition::corePosition const):
2191         (WebKit::WebGeolocationPosition::WebGeolocationPosition):
2192         * UIProcess/API/C/WKGeolocationPosition.cpp:
2193         (WKGeolocationPositionCreate_b):
2194         * UIProcess/API/Cocoa/_WKGeolocationPosition.mm:
2195         (WebKit::wrapper):
2196         * UIProcess/API/glib/WebKitGeolocationProvider.cpp:
2197         (WebKit::WebKitGeolocationProvider::notifyPositionChanged):
2198         * UIProcess/WebGeolocationManagerProxy.cpp:
2199         (WebKit::WebGeolocationManagerProxy::providerDidChangePosition):
2200         * UIProcess/ios/WKGeolocationProviderIOS.mm:
2201         (-[WKLegacyCoreLocationProvider positionChanged:]):
2202         * WebProcess/Geolocation/WebGeolocationManager.cpp:
2203         (WebKit::WebGeolocationManager::didChangePosition):
2204         * WebProcess/Geolocation/WebGeolocationManager.h:
2205         * WebProcess/Geolocation/WebGeolocationManager.messages.in:
2206         * WebProcess/WebCoreSupport/WebGeolocationClient.cpp:
2207         (WebKit::WebGeolocationClient::lastPosition):
2208         * WebProcess/WebCoreSupport/WebGeolocationClient.h:
2209
2210 2017-10-11  Brady Eidson  <beidson@apple.com>
2211
2212         Add a SW context process (where SW scripts will actually execute).
2213         https://bugs.webkit.org/show_bug.cgi?id=178156
2214
2215         Reviewed by Andy Estes.
2216
2217         This patch adds an auxiliary "ServiceWorker context" WebProcess to a WebProcessPool.
2218
2219         This process is where ServiceWorker scripts will execute, separate from the client WebProcess
2220         hosting the page(s) they are serving.
2221
2222         This patch also adds all of the plumbing to pass along a fetched service worker script to this
2223         context WebProcess, as well as message back failure to actually start the script so we can test.
2224
2225         Touches lots of code sites but is basically just a lot of plumbing.
2226
2227         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
2228         (WebKit::WebSWServerConnection::WebSWServerConnection):
2229         (WebKit::WebSWServerConnection::startServiceWorkerContext):
2230         (WebKit::WebSWServerConnection::sendToContextProcess):
2231         (WebKit::WebSWServerConnection::setContextConnection):
2232         * StorageProcess/ServiceWorker/WebSWServerConnection.h:
2233
2234         * StorageProcess/StorageProcess.cpp:
2235         (WebKit::StorageProcess::workerContextProcessConnection):
2236         (WebKit::StorageProcess::createWorkerContextProcessConnection):
2237         (WebKit::StorageProcess::didGetWorkerContextProcessConnection):
2238         (WebKit::StorageProcess::serviceWorkerContextFailedToStart):
2239         (WebKit::StorageProcess::registerSWServerConnection):
2240         (WebKit::StorageProcess::unregisterSWServerConnection):
2241         * StorageProcess/StorageProcess.h:
2242         * StorageProcess/StorageProcess.messages.in:
2243
2244         * StorageProcess/StorageToWebProcessConnection.cpp:
2245         (WebKit::StorageToWebProcessConnection::~StorageToWebProcessConnection):
2246         (WebKit::StorageToWebProcessConnection::establishSWServerConnection):
2247         (WebKit::StorageToWebProcessConnection::removeSWServerConnection):
2248         (WebKit::StorageToWebProcessConnection::workerContextProcessConnectionCreated):
2249         * StorageProcess/StorageToWebProcessConnection.h:
2250
2251         * UIProcess/Storage/StorageProcessProxy.cpp:
2252         (WebKit::StorageProcessProxy::create):
2253         (WebKit::StorageProcessProxy::StorageProcessProxy):
2254         (WebKit::StorageProcessProxy::didClose):
2255         (WebKit::StorageProcessProxy::getWorkerContextProcessConnection):
2256         (WebKit::StorageProcessProxy::didGetWorkerContextProcessConnection):
2257         * UIProcess/Storage/StorageProcessProxy.h:
2258         * UIProcess/Storage/StorageProcessProxy.messages.in:
2259
2260         * UIProcess/WebProcessPool.cpp:
2261         (WebKit::WebProcessPool::ensureStorageProcessAndWebsiteDataStore):
2262         (WebKit::WebProcessPool::getWorkerContextProcessConnection):
2263         (WebKit::WebProcessPool::didGetWorkerContextProcessConnection):
2264         (WebKit::WebProcessPool::disconnectProcess):
2265         (WebKit::WebProcessPool::createWebPage):
2266         * UIProcess/WebProcessPool.h:
2267
2268         * UIProcess/WebProcessProxy.cpp:
2269         (WebKit::WebProcessProxy::didGetWorkerContextConnection):
2270         * UIProcess/WebProcessProxy.h:
2271         * UIProcess/WebProcessProxy.messages.in:
2272
2273         * WebProcess/WebProcess.cpp:
2274         (WebKit::WebProcess::getWorkerContextConnection):
2275         (WebKit::WebProcess::startServiceWorkerContext):
2276         * WebProcess/WebProcess.h:
2277         * WebProcess/WebProcess.messages.in:
2278
2279 2017-10-11  Don Olmstead  <don.olmstead@sony.com>
2280
2281         Remove ENABLE_NETWORK_CACHE
2282         https://bugs.webkit.org/show_bug.cgi?id=177424
2283
2284         Reviewed by Antti Koivisto.
2285
2286         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
2287         (WebKit::NetworkConnectionToWebProcess::storeDerivedDataToCache):
2288         * NetworkProcess/NetworkConnectionToWebProcess.h:
2289         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
2290         * NetworkProcess/NetworkProcess.cpp:
2291         (WebKit::fetchDiskCacheEntries):
2292         (WebKit::clearDiskCacheEntries):
2293         (WebKit::NetworkProcess::setCacheModel):
2294         * NetworkProcess/NetworkProcess.h:
2295         (WebKit::NetworkProcess::cache):
2296         * NetworkProcess/NetworkProcessCreationParameters.cpp:
2297         (WebKit::NetworkProcessCreationParameters::encode const):
2298         (WebKit::NetworkProcessCreationParameters::decode):
2299         * NetworkProcess/NetworkProcessCreationParameters.h:
2300         * NetworkProcess/NetworkResourceLoader.cpp:
2301         (WebKit::NetworkResourceLoader::NetworkResourceLoader):
2302         (WebKit::NetworkResourceLoader::canUseCachedRedirect const):
2303         (WebKit::NetworkResourceLoader::start):
2304         (WebKit::NetworkResourceLoader::retrieveCacheEntry):
2305         (WebKit::NetworkResourceLoader::startNetworkLoad):
2306         (WebKit::NetworkResourceLoader::abort):
2307         (WebKit::NetworkResourceLoader::didReceiveResponse):
2308         (WebKit::NetworkResourceLoader::didReceiveBuffer):
2309         (WebKit::NetworkResourceLoader::didFinishLoading):
2310         (WebKit::NetworkResourceLoader::didFailLoading):
2311         (WebKit::NetworkResourceLoader::willSendRedirectedRequest):
2312         (WebKit::NetworkResourceLoader::continueWillSendRequest):
2313         (WebKit::NetworkResourceLoader::dispatchWillSendRequestForCacheEntry):
2314         * NetworkProcess/NetworkResourceLoader.h:
2315         * NetworkProcess/cache/NetworkCache.cpp:
2316         * NetworkProcess/cache/NetworkCache.h:
2317         * NetworkProcess/cache/NetworkCacheBlobStorage.cpp:
2318         * NetworkProcess/cache/NetworkCacheBlobStorage.h:
2319         * NetworkProcess/cache/NetworkCacheCoders.cpp:
2320         * NetworkProcess/cache/NetworkCacheCoders.h:
2321         * NetworkProcess/cache/NetworkCacheCodersCocoa.cpp:
2322         * NetworkProcess/cache/NetworkCacheCodersSoup.cpp:
2323         * NetworkProcess/cache/NetworkCacheData.cpp:
2324         * NetworkProcess/cache/NetworkCacheData.h:
2325         * NetworkProcess/cache/NetworkCacheDataCocoa.mm:
2326         * NetworkProcess/cache/NetworkCacheDataSoup.cpp:
2327         * NetworkProcess/cache/NetworkCacheEntry.cpp:
2328         * NetworkProcess/cache/NetworkCacheEntry.h:
2329         * NetworkProcess/cache/NetworkCacheFileSystem.cpp:
2330         * NetworkProcess/cache/NetworkCacheFileSystem.h:
2331         * NetworkProcess/cache/NetworkCacheIOChannel.h:
2332         * NetworkProcess/cache/NetworkCacheIOChannelCocoa.mm:
2333         * NetworkProcess/cache/NetworkCacheIOChannelSoup.cpp:
2334         * NetworkProcess/cache/NetworkCacheKey.cpp:
2335         * NetworkProcess/cache/NetworkCacheKey.h:
2336         * NetworkProcess/cache/NetworkCacheStatistics.cpp:
2337         * NetworkProcess/cache/NetworkCacheStatistics.h:
2338         * NetworkProcess/cache/NetworkCacheStorage.cpp:
2339         * NetworkProcess/cache/NetworkCacheStorage.h:
2340         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
2341         (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa):
2342         (WebKit::NetworkProcess::clearDiskCache):
2343         * NetworkProcess/ios/NetworkProcessIOS.mm:
2344         (WebKit::NetworkProcess::clearCacheForAllOrigins):
2345         * NetworkProcess/soup/NetworkProcessSoup.cpp:
2346         (WebKit::NetworkProcess::platformInitializeNetworkProcess):
2347         (WebKit::NetworkProcess::clearDiskCache):
2348         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
2349         (WebKit::registerUserDefaultsIfNeeded):
2350         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
2351         (WebKit::WebProcessPool::legacyPlatformDefaultNetworkCacheDirectory):
2352         (WebKit::WebProcessPool::isNetworkCacheEnabled):
2353         * UIProcess/soup/WebProcessPoolSoup.cpp:
2354         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
2355         * WebProcess/Network/WebLoaderStrategy.cpp:
2356         (WebKit::WebLoaderStrategy::storeDerivedDataToCache):
2357         * config.h:
2358
2359 2017-10-11  Michael Catanzaro  <mcatanzaro@igalia.com>
2360
2361         Unreviewed, rolling out r223146.
2362
2363         Better to not expose cairo in the WPE API
2364
2365         Reverted changeset:
2366
2367         "[WPE] Header cairo.h is used in GLib API headers but cannot
2368         be found"
2369         https://bugs.webkit.org/show_bug.cgi?id=178100
2370         http://trac.webkit.org/changeset/223146
2371
2372 2017-09-27  Frederic Wang  <fwang@igalia.com>
2373
2374         [iOS] Do not flatten frames when async frame scrolling is enabled
2375         https://bugs.webkit.org/show_bug.cgi?id=173704
2376
2377         Reviewed by Simon Fraser.
2378
2379         This patch disables frame flattening when async frame scrolling is enabled on iOS, as
2380         otherwise you can not scroll them. Once iframe scrolling is implemented in iOS (bug 149264),
2381         developers and beta testers will be able to check it by enabling "Async Frame Scrolling"
2382         in the "Experimental WebKit Features" menu of Safari iOS.
2383
2384         Test: platform/ios/fast/frames/flattening/iframe-flattening-with-async-frame-scrolling.html
2385
2386         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
2387         (WebKit::WebChromeClient::contentsSizeChanged): Use effectiveFrameFlattening() introduced in
2388         Source/WebCore.
2389
2390 2017-10-10  Ryosuke Niwa  <rniwa@webkit.org>
2391
2392         Enable custom pasteboard data in DumpRenderTree and WebKitTestRunner
2393         https://bugs.webkit.org/show_bug.cgi?id=178154
2394
2395         Reviewed by Wenson Hsieh.
2396
2397         Plumbed customPasteboardDataEnabled flag to be used in WebKitTestRunner.
2398
2399         * Shared/WebPreferencesDefinitions.h:
2400         * UIProcess/API/C/WKPreferences.cpp:
2401         (WKPreferencesSetCustomPasteboardDataEnabled):
2402         (WKPreferencesGetCustomPasteboardDataEnabled):
2403         * UIProcess/API/C/WKPreferencesRefPrivate.h:
2404         * WebProcess/WebPage/WebPage.cpp:
2405         (WebKit::WebPage::updatePreferences):
2406
2407 2017-10-10  Adrian Perez de Castro  <aperez@igalia.com>
2408
2409         [WPE] Remove the possibility of installing the old WebKit2 C API
2410         https://bugs.webkit.org/show_bug.cgi?id=178125
2411
2412         Reviewed by Michael Catanzaro.
2413
2414         * PlatformWPE.cmake: Remove support for installing the deprecated C API.
2415
2416 2017-10-10  Chris Dumez  <cdumez@apple.com>
2417
2418         [WK2] Add API to clear service worker registrations
2419         https://bugs.webkit.org/show_bug.cgi?id=178085
2420         <rdar://problem/34866025>
2421
2422         Reviewed by Ryosuke Niwa.
2423
2424         Add API to clear service worker registrations. Although the request to
2425         clear the registration is passed on to the StorageProcess, it is currently
2426         a no-op on StorageProcess side until we actually persist service worker
2427         registrations on disk.
2428
2429         * Shared/WebsiteData/WebsiteDataType.h:
2430         * StorageProcess/StorageProcess.cpp:
2431         (WebKit::StorageProcess::fetchWebsiteData):
2432         (WebKit::StorageProcess::deleteWebsiteData):
2433         (WebKit::StorageProcess::deleteWebsiteDataForOrigins):
2434         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
2435         (WKWebsiteDataStoreRemoveAllServiceWorkerRegistrations):
2436         * UIProcess/API/C/WKWebsiteDataStoreRef.h:
2437         * UIProcess/API/Cocoa/WKWebsiteDataRecord.h:
2438         * UIProcess/API/Cocoa/WKWebsiteDataRecord.mm:
2439         (dataTypesToString):
2440         * UIProcess/API/Cocoa/WKWebsiteDataRecordInternal.h:
2441         (WebKit::toWebsiteDataType):
2442         (WebKit::toWKWebsiteDataTypes):
2443         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
2444         (+[WKWebsiteDataStore allWebsiteDataTypes]):
2445         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
2446         (WebKit::WebsiteDataStore::fetchDataAndApply):
2447         (WebKit::WebsiteDataStore::removeData):
2448
2449 2017-10-10  Commit Queue  <commit-queue@webkit.org>
2450
2451         Unreviewed, rolling out r223130.
2452         https://bugs.webkit.org/show_bug.cgi?id=178147
2453
2454         Breaks the build when EGLNativeWindowType is a pointer
2455         (Requested by aperezdc on #webkit).
2456
2457         Reverted changeset:
2458
2459         "[WPE] Build failure due to invalid cast of
2460         EGLNativeWindowType when targetting 64-bit ARM"
2461         https://bugs.webkit.org/show_bug.cgi?id=178090
2462         http://trac.webkit.org/changeset/223130
2463
2464 2017-10-10  Sam Weinig  <sam@webkit.org>
2465
2466         Replace copyKeysToVector/copyValuesToVector with copyToVector(map.keys())/copyToVector(map.values())
2467         https://bugs.webkit.org/show_bug.cgi?id=178102
2468
2469         Reviewed by Tim Horton.
2470
2471         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
2472         (WebKit::NetworkConnectionToWebProcess::didClose):
2473         * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm:
2474         (WebKit::dumpChangedLayers):
2475         * UIProcess/API/glib/WebKitWebContext.cpp:
2476         (webkitWebContextInvalidateCustomProtocolRequests):
2477         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
2478         (webkitWebViewBaseContainerForall):
2479         * UIProcess/Cocoa/WKWebViewContentProviderRegistry.mm:
2480         (-[WKWebViewContentProviderRegistry _mimeTypesWithCustomContentProviders]):
2481         * UIProcess/GenericCallback.h:
2482         (WebKit::invalidateCallbackMap):
2483         * UIProcess/WebProcessProxy.cpp:
2484         (WebKit::WebProcessProxy::shutDown):
2485         (WebKit::WebProcessProxy::didClose):
2486         (WebKit::WebProcessProxy::didBecomeUnresponsive):
2487         (WebKit::WebProcessProxy::didBecomeResponsive):
2488         (WebKit::WebProcessProxy::willChangeIsResponsive):
2489         (WebKit::WebProcessProxy::didChangeIsResponsive):
2490         (WebKit::WebProcessProxy::disconnectFramesFromPage):
2491         (WebKit::WebProcessProxy::frameCountInPage const):
2492         (WebKit::WebProcessProxy::requestTermination):
2493         * WebProcess/Plugins/Netscape/NPRuntimeObjectMap.cpp:
2494         (WebKit::NPRuntimeObjectMap::invalidate):
2495         * WebProcess/Plugins/Netscape/NetscapePlugin.cpp:
2496         (WebKit::NetscapePlugin::stopAllStreams):
2497         * WebProcess/Plugins/PluginView.cpp:
2498         (WebKit::PluginView::cancelAllStreams):
2499         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeContext.mm:
2500         (WebKit::RemoteLayerTreeContext::buildTransaction):
2501         * WebProcess/WebProcess.cpp:
2502         (WebKit::WebProcess::didClose):
2503
2504 2017-10-10  Adrian Perez de Castro  <aperez@igalia.com>
2505
2506         [WPE] Header cairo.h is used in GLib API headers but cannot be found
2507         https://bugs.webkit.org/show_bug.cgi?id=178100
2508
2509         Reviewed by Michael Catanzaro.
2510
2511         * wpe/wpe-webkit.pc.in: Add Cairo to the "Requires" field, so its flags get pulled
2512         in and the "cairo.h", used in the WPE WebKit GLib API headers, can be found.
2513
2514 2017-10-10  Michael Catanzaro  <mcatanzaro@igalia.com>
2515
2516         CSS constant properties should not be enabled by default
2517         https://bugs.webkit.org/show_bug.cgi?id=177416
2518
2519         Reviewed by Darin Adler.
2520
2521         * Shared/WebPreferencesDefinitions.h:
2522
2523 2017-10-10  Brady Eidson  <beidson@apple.com>
2524
2525         Random StorageProcess and SWServer cleanup.
2526         https://bugs.webkit.org/show_bug.cgi?id=178141
2527
2528         Reviewed by Andy Estes.
2529
2530         -StorageProcess should own the set of SWServers
2531         -Some renaming and cleanup
2532
2533         * StorageProcess/StorageProcess.cpp:
2534         (WebKit::StorageProcess::createStorageToWebProcessConnection):
2535         (WebKit::StorageProcess::swServerForSession):
2536         * StorageProcess/StorageProcess.h:
2537         (WebKit::StorageProcess::queue):
2538
2539         * StorageProcess/StorageToWebProcessConnection.cpp:
2540         (WebKit::StorageToWebProcessConnection::establishSWServerConnection):
2541         * StorageProcess/StorageToWebProcessConnection.h:
2542
2543 2017-10-10  Michael Catanzaro  <mcatanzaro@igalia.com>
2544
2545         Unreviewed, rolling out r223136.
2546
2547         Forgot to update GTK API header
2548
2549         Reverted changeset:
2550
2551         "[WPE] Header cairo.h is used in GLib API headers but cannot
2552         be found"
2553         https://bugs.webkit.org/show_bug.cgi?id=178100
2554         http://trac.webkit.org/changeset/223136
2555
2556 2017-10-10  Adrian Perez de Castro  <aperez@igalia.com>
2557
2558         [WPE] Header cairo.h is used in GLib API headers but cannot be found
2559         https://bugs.webkit.org/show_bug.cgi?id=178100
2560
2561         Reviewed by Žan Doberšek.
2562
2563         Instead of including <cairo.h>, it is better to forward-declare cairo_surface_t,
2564         which is the one and only Cairo declaration needed by the WPE API header.
2565
2566         * UIProcess/API/glib/WebKitFaviconDatabase.cpp: Add inclusion of <cairo.h>.
2567         * UIProcess/API/glib/WebKitWebView.cpp: Add inclusion of <cairo.h>.
2568         * UIProcess/API/wpe/WebKitFaviconDatabase.h: Add forward declaration of cairo_surface_t.
2569
2570 2017-10-10  Adrian Perez de Castro  <aperez@igalia.com>
2571
2572         [WPE] Cannot link against libWPEWebkit due to wrong contents of wpe-webkit.pc
2573         https://bugs.webkit.org/show_bug.cgi?id=178133
2574
2575         Reviewed by Žan Doberšek.
2576
2577         * wpe/wpe-webkit.pc.in: Remove "-lWPE" and replace "Requires.private" with a plain "Requires".
2578
2579 2017-10-10  Adrian Perez de Castro  <aperez@igalia.com>
2580
2581         [WPE] Build failure due to invalid cast of EGLNativeWindowType when targetting 64-bit ARM
2582         https://bugs.webkit.org/show_bug.cgi?id=178090
2583
2584         Reviewed by Žan Doberšek.
2585
2586         * WebProcess/WebPage/wpe/AcceleratedSurfaceWPE.cpp:
2587         (WebKit::AcceleratedSurfaceWPE::window const): Use static_cast instead of reinterpret_cast,
2588         this way extending values of EGLNativeWindowType to 64 bits is allowed.
2589
2590 2017-10-10  Adrian Perez de Castro  <aperez@igalia.com>
2591
2592         [WPE] GLib API headers WebKitScriptDialog.h and WebKitFileChooserRequest.h are not installed
2593         https://bugs.webkit.org/show_bug.cgi?id=178104
2594
2595         Reviewed by Žan Doberšek.
2596
2597         * PlatformWPE.cmake: Add missing header paths to the WPE_API_INSTALLED_HEADERS variable.
2598
2599 2017-10-10  Adrian Perez de Castro  <aperez@igalia.com>
2600
2601         [WPE][CMake] The “install” target should install all public API headers
2602         https://bugs.webkit.org/show_bug.cgi?id=176475
2603
2604         Reviewed by Žan Doberšek.
2605
2606         Install the WPE port GLib-based API headers. The deprecated C API is still available,
2607         but disabled by default behind the "EXPORT_DEPRECATED_WEBKIT2_C_API" CMake option.
2608
2609         * PlatformWPE.cmake: Always install "wpe-webkit.pc" and the GLib C API for WPE.
2610
2611 2017-10-09  Jeremy Jones  <jeremyj@apple.com>
2612
2613         Fix typo of virtual keyword in PageClientImplIOS.h
2614         https://bugs.webkit.org/show_bug.cgi?id=178088
2615
2616         Reviewed by Simon Fraser.
2617
2618         This compile error happens when FULLSCREEN_API is enabled for iOS.
2619         Remove the redundant virtual keyword since function is marked override.
2620
2621         * UIProcess/ios/PageClientImplIOS.h:
2622
2623 2017-10-09  Chris Dumez  <cdumez@apple.com>
2624
2625         [iOS][WK2] Tiles outsides the viewport are sometimes missing after relaunching a crashes WebProcess
2626         https://bugs.webkit.org/show_bug.cgi?id=178095
2627         <rdar://problem/34415016>
2628
2629         Reviewed by Simon Fraser.
2630
2631         Make sure we reset WKWebView._hasScheduledVisibleRectUpdate to NO in WKWebView._processDidExit.
2632         _scheduleVisibleContentRectUpdateAfterScrollInView would otherwise return early because
2633         WKWebView._hasScheduledVisibleRectUpdate is always YES. Normally,
2634         _addUpdateVisibleContentRectPreCommitHandler sets a CATransaction commit handler that
2635         resets _hasScheduledVisibleRectUpdate to NO, but it does not do so when ![webView _isValid]
2636         (which is true when the WebProcess has crashed.
2637
2638         Also reset WKWebView._commitDidRestoreScrollPosition to NO in WKWebView._processDidExit even
2639         though it does not seem to be the cause of this bug. It seems to make sense to reset this member
2640         when the process crashes.
2641
2642         * UIProcess/API/Cocoa/WKWebView.mm:
2643         (-[WKWebView _processDidExit]):
2644
2645 2017-10-09  Youenn Fablet  <youenn@apple.com>
2646
2647         Add quota to cache API
2648         https://bugs.webkit.org/show_bug.cgi?id=177552
2649
2650         Reviewed by Alex Christensen.
2651
2652         Adding support for quota checking in CacheStorage::Caches.
2653         It is passed to NetworkProcess at creation time.
2654         Default quota size is configured to 400Ko by origin per default.
2655         This value is suitable for testing.
2656         Future patch should raise this default value and allows configuring it.
2657
2658         Quota is computed based on the response body size.
2659         This size is padded at WebCore for opaque responses.
2660         Size is stored persistently as opaque response padded size should remain stable.
2661         See https://github.com/whatwg/storage/issues/31 for the rationale about this padding.
2662
2663         In case of putting several records at the same time, the size of all records
2664         is computed so that all records will be written or rejected together.
2665
2666         Sending QuotaExceeded error when quota is exceeded.
2667         Future effort should allow asking UIProcess for quota extension.
2668
2669         * NetworkProcess/NetworkProcess.cpp:
2670         (WebKit::NetworkProcess::cacheStoragePerOriginQuota const):
2671         * NetworkProcess/NetworkProcess.h:
2672         * NetworkProcess/NetworkProcessCreationParameters.cpp:
2673         (WebKit::NetworkProcessCreationParameters::encode const):
2674         (WebKit::NetworkProcessCreationParameters::decode):
2675         * NetworkProcess/NetworkProcessCreationParameters.h:
2676         * NetworkProcess/cache/CacheStorageEngine.cpp:
2677         (WebKit::CacheStorage::Engine::readCachesFromDisk):
2678         * NetworkProcess/cache/CacheStorageEngineCache.cpp:
2679         (WebKit::CacheStorage::Cache::toRecordInformation):
2680         (WebKit::CacheStorage::isolatedCopy):
2681         (WebKit::CacheStorage::Cache::open):
2682         (WebKit::CacheStorage::Cache::storeRecords):
2683         (WebKit::CacheStorage::Cache::put):
2684         (WebKit::CacheStorage::Cache::writeRecordToDisk):
2685         (WebKit::CacheStorage::Cache::updateRecordToDisk):
2686         (WebKit::CacheStorage::Cache::removeRecordFromDisk):
2687         (WebKit::CacheStorage::Cache::encode):
2688         (WebKit::CacheStorage::Cache::decodeRecordHeader):
2689         (WebKit::CacheStorage::Cache::decode):
2690         * NetworkProcess/cache/CacheStorageEngineCache.h:
2691         * NetworkProcess/cache/CacheStorageEngineCaches.cpp:
2692         (WebKit::CacheStorage::Caches::Caches):
2693         (WebKit::CacheStorage::Caches::initialize):
2694         (WebKit::CacheStorage::Caches::initializeSize):
2695         (WebKit::CacheStorage::Caches::requestSpace):
2696         (WebKit::CacheStorage::Caches::writeRecord):
2697         (WebKit::CacheStorage::Caches::removeRecord):
2698         (WebKit::CacheStorage::Caches::removeCacheEntry):
2699         * NetworkProcess/cache/CacheStorageEngineCaches.h:
2700         (WebKit::CacheStorage::Caches::create):
2701         (WebKit::CacheStorage::Caches::hasEnoughSpace const):
2702         * NetworkProcess/cache/NetworkCacheStorage.cpp:
2703         (WebKit::NetworkCache::Storage::traverse):
2704         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
2705         (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa):
2706         * Shared/WebCoreArgumentCoders.cpp:
2707         (IPC::ArgumentCoder<DOMCacheEngine::Record>::encode):
2708         (IPC::ArgumentCoder<DOMCacheEngine::Record>::decode):
2709         * UIProcess/API/APIProcessPoolConfiguration.cpp:
2710         (API::ProcessPoolConfiguration::copy):
2711         * UIProcess/API/APIProcessPoolConfiguration.h:
2712         * UIProcess/WebProcessPool.cpp:
2713         (WebKit::WebProcessPool::ensureNetworkProcess):
2714
2715 2017-10-09  Sam Weinig  <sam@webkit.org>
2716
2717         Make HashMap::keys() and HashMap::values() work with WTF::map/WTF::copyToVector
2718         https://bugs.webkit.org/show_bug.cgi?id=178072
2719
2720         Reviewed by Darin Adler.
2721
2722         * Shared/AsyncRequest.h:
2723         (WebKit::AsyncRequestMap::values):
2724         * UIProcess/WebProcessProxy.h:
2725         (WebKit::WebProcessProxy::pages const):
2726
2727             Update for type change for HashMap::values().
2728
2729 2017-10-09  Jeremy Jones  <jeremyj@apple.com>
2730
2731         Incorrect fullscreen animation when element has a transform.
2732         https://bugs.webkit.org/show_bug.cgi?id=177558
2733         rdar://problem/29603741
2734
2735         Reviewed by Jer Noble.
2736
2737         Use a bit of code from element fullscreen to do this correctly for video fullscreen.
2738         The key is to get the absolute quad from the renderer. This will work for scaling,
2739         But since we still take the bounding box, it won't work for rotations.
2740
2741         * WebProcess/cocoa/VideoFullscreenManager.mm:
2742         (WebKit::inlineVideoFrame):
2743
2744 2017-10-09  Robin Morisset  <rmorisset@apple.com>
2745
2746         Make the names of the options consistent
2747         https://bugs.webkit.org/show_bug.cgi?id=177933
2748
2749         Reviewed by Saam Barati.
2750
2751         * NetworkProcess/capture/json.hpp:
2752         * Platform/IPC/Connection.cpp:
2753         (IPC::Connection::connectionDidClose):
2754         * UIProcess/API/Cocoa/WKWebView.mm:
2755         (-[WKWebView _keyboardWillHide:]):
2756         * UIProcess/WebPageProxy.cpp:
2757         (WebKit::WebPageProxy::runModal):
2758         * UIProcess/mac/WebInspectorProxyMac.mm:
2759         (WebKit::WebInspectorProxy::inspectedViewFrameDidChange):
2760         * WebProcess/WebPage/ios/WebPageIOS.mm:
2761         (WebKit::WebPage::selectWithGesture):
2762
2763 2017-10-09  Adrian Perez de Castro  <aperez@igalia.com>
2764
2765         [WPE][GTK] Propagate libepoxy compiler flags obtained from pkg-config
2766         https://bugs.webkit.org/show_bug.cgi?id=178081
2767
2768         Reviewed by Carlos Alberto Lopez Perez.
2769
2770         * CMakeLists.txt: Use ${LIBEPOXY_DEFINITIONS} for building WebKit.
2771
2772 2017-10-08  Tim Horton  <timothy_horton@apple.com>
2773
2774         mediaPlaybackRequiresUserAction API replacement annotation is wrong
2775         https://bugs.webkit.org/show_bug.cgi?id=178063
2776
2777         Reviewed by Dan Bernstein.
2778
2779         * UIProcess/API/Cocoa/WKWebViewConfiguration.h:
2780         mediaPlaybackRequiresUserAction suggests that you should use 
2781         requiresUserActionForMediaPlayback instead, but that is also deprecated.
2782         Instead, follow the chain and suggest mediaTypesRequiringUserActionForPlayback.
2783
2784 2017-10-06  Wenson Hsieh  <wenson_hsieh@apple.com>
2785
2786         [iOS WK2] API tests added in r222991 are failing in iOS 11 test runners
2787         https://bugs.webkit.org/show_bug.cgi?id=178037
2788
2789         Reviewed by Tim Horton.
2790
2791         This patch carries out some minor cleanup around UIKitSPI.h in WebKit2, so that the internal SDK isn't required
2792         to implement -[WKContentView insertTextSuggestion:].
2793
2794         * Platform/spi/ios/UIKitSPI.h:
2795         * UIProcess/ios/WKContentViewInteraction.mm:
2796         (-[WKContentView insertTextSuggestion:]):
2797
2798 2017-10-06  Chris Dumez  <cdumez@apple.com>
2799
2800         [Beacon][Cocoa] Beacon requests with BufferSource payload should not have a Content-Type HTTP header
2801         https://bugs.webkit.org/show_bug.cgi?id=178027
2802         <rdar://problem/34748470>
2803
2804         Reviewed by Youenn Fablet.
2805
2806         Use new NSURLSessionConfiguration._suppressedAutoAddedHTTPHeaders CFNetwork SPI to
2807         make sure that CFNetwork never adds a Content-Type HTTP headers to our requests
2808         when we did not add one.
2809
2810         This is covered by the following tests on newer OSes:
2811         - imported/w3c/web-platform-tests/beacon/headers/header-content-type.html
2812         - http/tests/blink/sendbeacon/beacon-same-origin.html
2813
2814         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
2815         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
2816
2817 2017-10-06  Aishwarya Nirmal  <anirmal@apple.com>
2818
2819         [iOS] Respect the "caret-color" CSS property when editing 
2820         https://bugs.webkit.org/show_bug.cgi?id=177489
2821         <rdar://problem/34600419>
2822
2823         Reviewed by Tim Horton.
2824
2825         This change adds support for the caret-color property on iOS.
2826
2827         * Shared/EditorState.cpp:
2828         (WebKit::EditorState::PostLayoutData::encode const):
2829         (WebKit::EditorState::PostLayoutData::decode):
2830         * Shared/EditorState.h:
2831         * UIProcess/ios/WKContentViewInteraction.mm:
2832         (-[WKContentView insertionPointColor]):
2833         * WebProcess/WebPage/ios/WebPageIOS.mm:
2834         (WebKit::WebPage::platformEditorState const):
2835
2836 2017-10-06  Brian Burg  <bburg@apple.com>
2837
2838         Web Inspector: clicking in Inspector webview clears the selection in the inspected page
2839         https://bugs.webkit.org/show_bug.cgi?id=178014
2840         <rdar://problem/12706857>
2841
2842         Reviewed by Timothy Hatcher.
2843
2844         If the Inspector is docked to the inspected view, clicking on the Inspector
2845         webview will cause selection in the inspected view to be lost. This is because
2846         the selection is lost when the web view resigns first responder.
2847
2848         Add a check in maintainsInactiveSelection to always retain selection if
2849         Web Inspector is open. This approach seems simpler than trying to sync a client's
2850         usage of WKPageSetMaintainsInactiveSelection with overrides that need to be applied
2851         and unapplied when an inspector web view is shown or hidden.
2852
2853         * UIProcess/WebPageProxy.cpp:
2854         (WebKit::WebPageProxy::maintainsInactiveSelection const):
2855         (WebKit::WebPageProxy::inspector const): Drive by, use nullptr.
2856
2857         * UIProcess/WebPageProxy.h:
2858         (WebKit::WebPageProxy::maintainsInactiveSelection const): Deleted.
2859
2860 2017-10-06  Alex Christensen  <achristensen@webkit.org>
2861
2862         Add more infrastructure to apply custom headers to same-origin requests
2863         https://bugs.webkit.org/show_bug.cgi?id=177629
2864
2865         Reviewed by Ryosuke Niwa.
2866
2867         * UIProcess/API/C/WKWebsitePolicies.cpp:
2868         (WKWebsitePoliciesCopyCustomHeaderFields):
2869         (WKWebsitePoliciesSetCustomHeaderFields):
2870         * UIProcess/API/C/WKWebsitePolicies.h:
2871         * UIProcess/API/Cocoa/_WKWebsitePolicies.h:
2872         * UIProcess/API/Cocoa/_WKWebsitePolicies.mm:
2873         (-[_WKWebsitePolicies customHeaderFields]):
2874         (-[_WKWebsitePolicies setCustomHeaderFields:]):
2875
2876         Make the SPI for setting custom header fields take a dictionary<String, String>
2877         instead of an array of Strings with colons. This matches NSURLRequest and other
2878         APIs that deal with header fields.
2879
2880 2017-10-06  Wenson Hsieh  <wenson_hsieh@apple.com>
2881
2882         [iOS] Tweak support for classifying form controls (followup to r222487)
2883         https://bugs.webkit.org/show_bug.cgi?id=177917
2884         <rdar://problem/34820122>
2885
2886         Reviewed by Dean Jackson.
2887
2888         This patch follows up with <http://trac.webkit.org/r222487>. It combines the functionality of two SPI hooks
2889         implemented on WKContentView into a single method that vends a context dictionary, and additionally addresses an
2890         issue with the original implementation, wherein some cached state on WebPageProxy is set upon starting node
2891         assistance, but is never unset when stopping node assistance, nor set anywhere else. See per-method comments for
2892         more detail.
2893
2894         * UIProcess/WebPageProxy.h:
2895
2896         Remove members m_acceptsAutofilledLoginCredentials and m_representingPageURL from WebPageProxy. This state is
2897         retrieved from the AssistedNodeInformation struct when starting node assistance, but is never reset anywhere
2898         else. Instead of introducing new members to remember this state, we can just use the WKContentView's current
2899         assisted node information.
2900
2901         This also means that programmatically focusing forms (without user gesture) will no longer cause WKContentView
2902         to accept autofilled login credentials, since we bail out of node assistance and don't begin an input session.
2903
2904         * UIProcess/ios/WKContentView.mm:
2905         (-[WKContentView acceptsAutofilledLoginCredentials]): Deleted.
2906         (-[WKContentView representingPageURL]): Deleted.
2907         * UIProcess/ios/WKContentViewInteraction.mm:
2908         (-[WKContentView _autofillContext]):
2909
2910         Merge functionality of the previous two SPI hooks, such that -_autofillContext will return a non-null dictionary
2911         containing the URL of the focused element's document if and only if WKContentView accepts autofilled login
2912         credentials, and there exists a representing page URL.
2913
2914         When the page stops assisting the focused node, we set the AssistedNodeInformation's element type to None, so we
2915         additionally bail and return nil if the element type is None. As an aside, it seems a more reasonable approach to
2916         resetting state upon stopping node assistance is to just completely reset _assistedNodeInformation to its initial
2917         value, i.e. via _assistedNodeInformation = { }. It's not clear whether there are behaviors relying on the fact
2918         that all members but the element type in the content view's assisted node information could be stale, so this
2919         seems worthy of some investigation.
2920
2921         * UIProcess/ios/WebPageProxyIOS.mm:
2922         (WebKit::WebPageProxy::startAssistingNode):
2923         (WebKit::WebPageProxy::acceptsAutofilledLoginCredentials): Deleted.
2924         (WebKit::WebPageProxy::representingPageURL): Deleted.
2925
2926 2017-10-06  Yousuke Kimoto  <yousuke.kimoto@sony.com>
2927
2928         [WinCairo] Add shared curl files
2929         https://bugs.webkit.org/show_bug.cgi?id=177999
2930
2931         Reviewed by Alex Christensen.
2932
2933         * PlatformWin.cmake:
2934         * Shared/Authentication/curl/AuthenticationManagerCurl.cpp: Added.
2935         (WebKit::AuthenticationManager::receivedCredential):
2936         (WebKit::AuthenticationManager::receivedRequestToContinueWithoutCredential):
2937         (WebKit::AuthenticationManager::receivedCancellation):
2938         (WebKit::AuthenticationManager::receivedRequestToPerformDefaultHandling):
2939         (WebKit::AuthenticationManager::receivedChallengeRejection):
2940         * Shared/curl/WebCoreArgumentCodersCurl.cpp: Added.
2941         (IPC::ArgumentCoder<ResourceRequest>::encodePlatformData):
2942         (IPC::ArgumentCoder<ResourceRequest>::decodePlatformData):
2943         (IPC::ArgumentCoder<CertificateInfo>::encode):
2944         (IPC::ArgumentCoder<CertificateInfo>::decode):
2945         (IPC::ArgumentCoder<ResourceError>::encodePlatformData):
2946         (IPC::ArgumentCoder<ResourceError>::decodePlatformData):
2947         (IPC::ArgumentCoder<ProtectionSpace>::encodePlatformData):
2948         (IPC::ArgumentCoder<ProtectionSpace>::decodePlatformData):
2949         (IPC::ArgumentCoder<Credential>::encodePlatformData):
2950         (IPC::ArgumentCoder<Credential>::decodePlatformData):
2951
2952 2017-10-06  Brent Fulgham  <bfulgham@apple.com>
2953
2954         Sandbox rules block PluginProcess using "File Open/Save" dialogs
2955         https://bugs.webkit.org/show_bug.cgi?id=177965
2956         <rdar://problem/33976846>
2957
2958         Reviewed by Alexey Proskuryakov.
2959
2960         Update the PluginProcess sandboxes to allow the same XPC services as
2961         the WebContent process. Also allow access to the openAndSavePanelServices.
2962
2963         * PluginProcess/mac/com.apple.WebKit.plugin-common.sb.in: 
2964
2965 2017-10-06  Brady Eidson  <beidson@apple.com>
2966
2967         Add (entirely incorrect) fetching of ServiceWorker scripts.
2968         https://bugs.webkit.org/show_bug.cgi?id=176179
2969
2970         Reviewed by Andy Estes.
2971
2972         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
2973         (WebKit::WebSWServerConnection::startScriptFetchInClient):
2974         * StorageProcess/ServiceWorker/WebSWServerConnection.h:
2975         * StorageProcess/ServiceWorker/WebSWServerConnection.messages.in:
2976
2977         * WebProcess/Storage/WebSWClientConnection.cpp:
2978         (WebKit::WebSWClientConnection::finishFetchingScriptInServer):
2979         * WebProcess/Storage/WebSWClientConnection.h:
2980         * WebProcess/Storage/WebSWClientConnection.messages.in:
2981
2982 2017-10-05  Carlos Garcia Campos  <cgarcia@igalia.com>
2983
2984         [GTK][WPE] Add API to configure and enable resource load statistics
2985         https://bugs.webkit.org/show_bug.cgi?id=177943
2986
2987         Reviewed by Michael Catanzaro.
2988
2989         Add new WebKitWebsiteDataManager construct only property to set the directory where the persistent stats are
2990         stored, and methods to enable resource load statistics and query whether it's currently enabled. Also add a new
2991         Website data type to be able to remove the persistent stats using WebKitWebsiteDataManager existing API.
2992
2993         * UIProcess/API/glib/WebKitWebContext.cpp:
2994         (websiteDataStoreConfigurationForWebProcessPoolConfiguration):
2995         (webkitWebContextConstructed):
2996         * UIProcess/API/glib/WebKitWebsiteData.cpp:
2997         (recordContainsSupportedDataTypes):
2998         (toWebKitWebsiteDataTypes):
2999         * UIProcess/API/glib/WebKitWebsiteDataManager.cpp:
3000         (webkitWebsiteDataManagerGetProperty):
3001         (webkitWebsiteDataManagerSetProperty):
3002         (webkitWebsiteDataManagerConstructed):
3003         (webkit_website_data_manager_class_init):
3004         (webkitWebsiteDataManagerGetDataStore):
3005         (webkit_website_data_manager_get_resource_load_stats_directory):
3006         (webkit_website_data_manager_set_resource_load_stats_enabled):
3007         (webkit_website_data_manager_get_resource_load_stats_enabled):
3008         (toWebsiteDataTypes):
3009         * UIProcess/API/gtk/WebKitWebsiteData.h:
3010         * UIProcess/API/gtk/WebKitWebsiteDataManager.h:
3011         * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt:
3012         * UIProcess/API/wpe/WebKitWebsiteData.h:
3013         * UIProcess/API/wpe/WebKitWebsiteDataManager.h:
3014
3015 2017-10-05  Carlos Garcia Campos  <cgarcia@igalia.com>
3016
3017         [GTK][WPE] All resource load statistics tests added in r212183 crash in GTK bots, timeout in GTK and WPE bots since r219049
3018         https://bugs.webkit.org/show_bug.cgi?id=168171
3019
3020         Reviewed by Chris Dumez.
3021
3022         Add C API to handle all resource load statistics requests made by the layout tests.
3023
3024         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
3025         (WKWebsiteDataStoreSetStatisticsLastSeen):
3026         (WKWebsiteDataStoreSetStatisticsPrevalentResource):
3027         (WKWebsiteDataStoreIsStatisticsPrevalentResource):
3028         (WKWebsiteDataStoreSetStatisticsHasHadUserInteraction):
3029         (WKWebsiteDataStoreIsStatisticsHasHadUserInteraction):
3030         (WKWebsiteDataStoreSetStatisticsGrandfathered):
3031         (WKWebsiteDataStoreIsStatisticsGrandfathered):
3032         (WKWebsiteDataStoreSetStatisticsSubframeUnderTopFrameOrigin):
3033         (WKWebsiteDataStoreSetStatisticsSubresourceUnderTopFrameOrigin):
3034         (WKWebsiteDataStoreSetStatisticsSubresourceUniqueRedirectTo):
3035         (WKWebsiteDataStoreSetStatisticsTimeToLiveUserInteraction):
3036         (WKWebsiteDataStoreSetStatisticsTimeToLiveCookiePartitionFree):
3037         (WKWebsiteDataStoreStatisticsProcessStatisticsAndDataRecords):
3038         (WKWebsiteDataStoreStatisticsUpdateCookiePartitioning):
3039         (WKWebsiteDataStoreSetStatisticsShouldPartitionCookiesForHost):
3040         (WKWebsiteDataStoreStatisticsSubmitTelemetry):
3041         (WKWebsiteDataStoreSetStatisticsNotifyPagesWhenDataRecordsWereScanned):
3042         (WKWebsiteDataStoreSetStatisticsShouldClassifyResourcesBeforeDataRecordsRemoval):
3043         (WKWebsiteDataStoreSetStatisticsNotifyPagesWhenTelemetryWasCaptured):
3044         (WKWebsiteDataStoreSetStatisticsMinimumTimeBetweenDataRecordsRemoval):
3045         (WKWebsiteDataStoreSetStatisticsGrandfatheringTime):
3046         (WKWebsiteDataStoreSetStatisticsMaxStatisticsEntries):
3047         (WKWebsiteDataStoreSetStatisticsPruneEntriesDownTo):
3048         (WKWebsiteDataStoreStatisticsClearInMemoryAndPersistentStore):
3049         (WKWebsiteDataStoreStatisticsClearInMemoryAndPersistentStoreModifiedSinceHours):
3050         (WKWebsiteDataStoreStatisticsClearThroughWebsiteDataRemoval):
3051         (WKWebsiteDataStoreStatisticsResetToConsistentState):
3052         * UIProcess/API/C/WKWebsiteDataStoreRef.h:
3053
3054 2017-10-05  Tim Horton  <timothy_horton@apple.com>
3055
3056         Fix the Mac CMake build
3057         https://bugs.webkit.org/show_bug.cgi?id=177985
3058
3059         Unreviewed build fix.
3060
3061         * CMakeLists.txt:
3062         * PlatformMac.cmake:
3063         After r222917, there's one more piece of WebKitSystemInterface left.
3064         And some missing bits of PaymentRequest.
3065
3066 2017-10-05  Keith Miller  <keith_miller@apple.com>
3067
3068         Unreviewed, tapi builds without optimization so we should have TAPI passes -DRELEASE_WITHOUT_OPTIMIZATIONS.
3069
3070         * Configurations/Base.xcconfig:
3071
3072 2017-10-05  Jer Noble  <jer.noble@apple.com>
3073
3074         [Cocoa] Enable ENABLE_ENCRYPTED_MEDIA build-time setting
3075         https://bugs.webkit.org/show_bug.cgi?id=177261
3076
3077         Reviewed by Eric Carlson.
3078
3079         * Configurations/FeatureDefines.xcconfig:
3080
3081 2017-10-05  Alex Christensen  <achristensen@webkit.org>
3082
3083         Add ObjC equivalent of WKPageNavigationClient.didChangeBackForwardList
3084         https://bugs.webkit.org/show_bug.cgi?id=177966
3085         <rdar://problem/22387135>
3086
3087         Reviewed by Tim Horton.
3088
3089         * UIProcess/API/APINavigationClient.h:
3090         (API::NavigationClient::didChangeBackForwardList):
3091         * UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h:
3092         * UIProcess/Cocoa/NavigationState.h:
3093         * UIProcess/Cocoa/NavigationState.mm:
3094         (WebKit::NavigationState::setNavigationDelegate):
3095         (WebKit::NavigationState::NavigationClient::didFailToInitializePlugIn):
3096         (WebKit::NavigationState::NavigationClient::didChangeBackForwardList):
3097         (WebKit::NavigationState::NavigationClient::willPerformClientRedirect):
3098         (WebKit::NavigationState::NavigationClient::didCancelClientRedirect):
3099         (WebKit::NavigationState::NavigationClient::renderingProgressDidChange):
3100         (WebKit::NavigationState::NavigationClient::canAuthenticateAgainstProtectionSpace):
3101         (WebKit::NavigationState::NavigationClient::processDidTerminate):
3102         (WebKit::NavigationState::NavigationClient::processDidBecomeResponsive):
3103         (WebKit::NavigationState::NavigationClient::processDidBecomeUnresponsive):
3104         (WebKit::NavigationState::NavigationClient::webCryptoMasterKey):
3105         (WebKit::NavigationState::NavigationClient::didFinishLoadForQuickLookDocumentInMainFrame):
3106         (WebKit::NavigationState::HistoryClient::didNavigateWithNavigationData):
3107         (WebKit::NavigationState::HistoryClient::didPerformClientRedirect):
3108         (WebKit::NavigationState::HistoryClient::didPerformServerRedirect):
3109         (WebKit::NavigationState::HistoryClient::didUpdateHistoryTitle):
3110         * UIProcess/WebPageProxy.cpp:
3111         (WebKit::WebPageProxy::didChangeBackForwardList):
3112
3113 2017-10-05  Alex Christensen  <achristensen@webkit.org>
3114
3115         Add ObjC SPI with userInfo corresponding to WKPageNavigationClient's decidePolicyForNavigationAction, didStartProvisionalNavigation, and didFailNavigation
3116         https://bugs.webkit.org/show_bug.cgi?id=177974
3117         <rdar://problem/22888802>
3118
3119         Reviewed by Tim Horton.
3120
3121         * UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h:
3122         * UIProcess/Cocoa/NavigationState.h:
3123         * UIProcess/Cocoa/NavigationState.mm:
3124         (WebKit::NavigationState::setNavigationDelegate):
3125         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
3126         (WebKit::NavigationState::NavigationClient::didStartProvisionalNavigation):
3127         (WebKit::NavigationState::NavigationClient::didFailNavigationWithError):
3128         * UIProcess/Cocoa/UIDelegate.mm:
3129         (WebKit::UIDelegate::ContextMenuClient::menuFromProposedMenu):
3130
3131 2017-10-05  John Wilander  <wilander@apple.com>
3132
3133         Storage Access API: Web process should ask UI process for grant/deny
3134         https://bugs.webkit.org/show_bug.cgi?id=176941
3135         <rdar://problem/34440036>
3136
3137         Reviewed by Chris Dumez and Sam Weinig.
3138
3139         This patch adds infrastructure to let WebCore::Document call
3140         WebKit::WebResourceLoadStatisticsStore and ask for storage
3141         access on behalf of an iframe. The communication goes through
3142         the ChromeClient since we might want to add a native prompt.
3143         From the ChromeClient it continues to the WebPage which
3144         messages the WebPageProxy. The WebPageProxy calls the
3145         WebsiteDataStore which owns the WebResourceLoadStatisticsStore.
3146         A uint64_t is used to match the right callback with the boolean
3147         result.
3148
3149         * UIProcess/WebPageProxy.cpp:
3150         (WebKit::WebPageProxy::requestStorageAccess):
3151         * UIProcess/WebPageProxy.h:
3152         * UIProcess/WebPageProxy.messages.in:
3153         * UIProcess/WebResourceLoadStatisticsStore.cpp:
3154         (WebKit::WebResourceLoadStatisticsStore::requestStorageAccess):
3155         * UIProcess/WebResourceLoadStatisticsStore.h:
3156         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
3157         (WebKit::WebsiteDataStore::requestStorageAccess):
3158         * UIProcess/WebsiteData/WebsiteDataStore.h:
3159         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
3160         (WebKit::WebChromeClient::requestStorageAccess):
3161         * WebProcess/WebCoreSupport/WebChromeClient.h:
3162         * WebProcess/WebPage/WebPage.cpp:
3163         (WebKit::nextRequestStorageAccessContextId):
3164         (WebKit::WebPage::requestStorageAccess):
3165         (WebKit::WebPage::storageAccessResponse):
3166         * WebProcess/WebPage/WebPage.h:
3167         * WebProcess/WebPage/WebPage.messages.in:
3168
3169 2017-10-05  Chris Dumez  <cdumez@apple.com>
3170
3171         Drop unused parameters for CookiesStrategy::cookiesEnabled()
3172         https://bugs.webkit.org/show_bug.cgi?id=177957
3173
3174         Reviewed by Alex Christensen.
3175
3176         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
3177         (WebKit::NetworkConnectionToWebProcess::cookiesEnabled):
3178         * NetworkProcess/NetworkConnectionToWebProcess.h:
3179         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
3180         * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
3181         (WebKit::WebPlatformStrategies::cookiesEnabled):
3182         * WebProcess/WebCoreSupport/WebPlatformStrategies.h:
3183
3184 2017-10-05  Tim Horton  <timothy_horton@apple.com>
3185
3186         Make progress toward properly-formed XPC services in the Mac CMake build
3187         https://bugs.webkit.org/show_bug.cgi?id=177918
3188
3189         Reviewed by Alex Christensen.
3190
3191         * CMakeLists.txt:
3192         * PlatformMac.cmake:
3193         Turn on the storage process on Mac, and fix its build.
3194         Move XPC services to Versions/A/XPCServices and add the toplevel
3195         XPCServices as a symlink of that.
3196         Run the XPC services' Info.plists through configure_file, and substitute
3197         the important variables (most critically the bundle identifier).
3198         Factor out the service setup so we don't keep duplicating it as it
3199         gets more complicated.
3200
3201 2017-10-05  Andy Estes  <aestes@apple.com>
3202
3203         [Payment Request] Add a payment method that supports Apple Pay
3204         https://bugs.webkit.org/show_bug.cgi?id=177850
3205
3206         Reviewed by Youenn Fablet.
3207
3208         * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
3209         (toShippingMethod): Converted the NSDecimalNumber amount to a string rather than an integer.
3210         (WebKit::toDecimalNumber): used -decimalNumberWithString:locale: rather than
3211         -initWithMantissa:exponent:isNegative: to create an NSDecimalNumber.
3212         (WebKit::toPKPaymentSummaryItem):
3213         (WebKit::toPKShippingMethod):
3214
3215 2017-10-05  Youenn Fablet  <youenn@apple.com>
3216
3217         Make LibWebRTCProvider port agnostic
3218         https://bugs.webkit.org/show_bug.cgi?id=177747
3219
3220         Reviewed by Alex Christensen & Alex Garcia.
3221
3222         * WebProcess/Network/webrtc/LibWebRTCProvider.h: Making sure Mac/iOS provider creates the codec factories.
3223
3224 2017-10-04  Alex Christensen  <achristensen@webkit.org>
3225
3226         Stop linking with WebKitSystemInterface
3227         https://bugs.webkit.org/show_bug.cgi?id=177915
3228
3229         Reviewed by Antti Koivisto.
3230
3231         * Configurations/DebugRelease.xcconfig:
3232         * WebKit.xcodeproj/project.pbxproj:
3233
3234 2017-10-04  Alex Christensen  <achristensen@webkit.org>
3235
3236         Remove unnecessary includes of WebKitSystemInterface on Cocoa platforms
3237         https://bugs.webkit.org/show_bug.cgi?id=177912
3238
3239         Reviewed by Saam Barati.
3240
3241         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
3242         * NetworkProcess/mac/NetworkProcessMac.mm:
3243         * NetworkProcess/mac/RemoteNetworkingContext.mm:
3244         * Platform/IPC/mac/ConnectionMac.mm:
3245         * Platform/mac/LayerHostingContext.mm:
3246         * PluginProcess/mac/PluginProcessMac.mm:
3247         * PluginProcess/mac/PluginProcessShim.mm:
3248         * Shared/ios/ChildProcessIOS.mm:
3249         * Shared/mac/ChildProcessMac.mm:
3250         * Shared/mac/SandboxExtensionMac.mm:
3251         * Shared/mac/WebCoreArgumentCodersMac.mm:
3252         * Shared/mac/WebEventFactory.mm:
3253         * StorageProcess/ios/StorageProcessIOS.mm:
3254         * StorageProcess/mac/StorageProcessMac.mm:
3255         * UIProcess/API/Cocoa/WKWebView.mm:
3256         * UIProcess/Cocoa/PlaybackSessionManagerProxy.mm:
3257         * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm:
3258         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
3259         * UIProcess/Cocoa/WebViewImpl.mm:
3260         * UIProcess/Plugins/mac/PluginProcessProxyMac.mm:
3261         * UIProcess/RemoteLayerTree/RemoteLayerTreeHost.mm:
3262         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeHostIOS.mm:
3263         * UIProcess/mac/PageClientImplMac.mm:
3264         * UIProcess/mac/WKTextInputWindowController.mm:
3265         * UIProcess/mac/WebContextMenuProxyMac.mm:
3266         * UIProcess/mac/WebPopupMenuProxyMac.mm:
3267         * UIProcess/mac/WindowServerConnection.mm:
3268         * WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm:
3269         * WebProcess/Plugins/Netscape/mac/PluginProxyMac.mm:
3270         * WebProcess/Plugins/PDF/PDFPlugin.mm:
3271         * WebProcess/WebCoreSupport/mac/WebDragClientMac.mm:
3272         * WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.mm:
3273         * WebProcess/WebCoreSupport/mac/WebSystemInterface.mm:
3274         * WebProcess/WebPage/ios/WebPageIOS.mm:
3275         * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectBase.mm:
3276         * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectMac.mm:
3277         * WebProcess/WebPage/mac/WebPageMac.mm:
3278         * WebProcess/cocoa/WebProcessCocoa.mm:
3279
3280 2017-10-04  Youenn Fablet  <youenn@apple.com>
3281
3282         rtc::PacketOptions should have its own IPC encoding/decoding routines
3283         https://bugs.webkit.org/show_bug.cgi?id=177812
3284
3285         Reviewed by Alex Christensen.
3286
3287         Replacing rtc::PacketOptions IPC encoding/decoding from passing the structure as individual parameters to the structure as a parameter.
3288         Introducing WebKit::RTCPacketOptions as a wrapper around it for which encode/decode routines are added.
3289         Updating code using rtc::PacketOptions accordingly.
3290
3291         * NetworkProcess/webrtc/NetworkRTCSocket.cpp:
3292         (WebKit::NetworkRTCSocket::sendTo):
3293         * NetworkProcess/webrtc/NetworkRTCSocket.h:
3294         * NetworkProcess/webrtc/NetworkRTCSocket.messages.in:
3295         * Platform/IPC/Decoder.cpp:
3296         (IPC::Decoder::operator>>):
3297         (IPC::Decoder::decode):
3298         * Platform/IPC/Decoder.h:
3299         * Platform/IPC/Encoder.cpp:
3300         (IPC::Encoder::encode):
3301         * Platform/IPC/Encoder.h:
3302         * Shared/RTCPacketOptions.cpp: Added.
3303         (WebKit::RTCPacketOptions::encode const):
3304         (WebKit::RTCPacketOptions::decode):
3305         * Shared/RTCPacketOptions.h: Added.
3306         * WebKit.xcodeproj/project.pbxproj:
3307         * WebProcess/Network/webrtc/LibWebRTCSocket.cpp:
3308         (WebKit::LibWebRTCSocket::SendTo):
3309
3310 2017-10-04  Don Olmstead  <don.olmstead@sony.com>
3311
3312         Include Pasteboard.h for all in WebCoreArgumentCoders
3313         https://bugs.webkit.org/show_bug.cgi?id=177902
3314
3315         Reviewed by Alex Christensen.
3316
3317         * Shared/WebCoreArgumentCoders.cpp:
3318
3319 2017-10-04  David Kilzer  <ddkilzer@apple.com>
3320
3321         Remove unused variables in lambdas for network process cache
3322         <https://webkit.org/b/177878>
3323         <rdar://problem/34038482>
3324
3325         Reviewed by Tim Horton.
3326
3327         * NetworkProcess/cache/CacheStorageEngine.cpp:
3328         (WebKit::CacheStorage::Engine::open):
3329         (WebKit::CacheStorage::Engine::putRecords):
3330         (WebKit::CacheStorage::Engine::deleteMatchingRecords):
3331         * NetworkProcess/cache/CacheStorageEngineConnection.cpp:
3332         (WebKit::CacheStorageEngineConnection::reference):
3333         - Remove unused |this| from lambda captures.
3334
3335 2017-10-04  Stephan Szabo  <stephan.szabo@sony.com>
3336
3337         [WinCairo] add PLATFORM(WIN) configurations to config.h
3338         https://bugs.webkit.org/show_bug.cgi?id=177846
3339
3340         Reviewed by Alex Christensen.
3341
3342         * config.h:
3343
3344 2017-10-04  Adrian Perez de Castro  <aperez@igalia.com>
3345
3346         [GTK] WebKit2GTK+ does not handle touchmove and touchend events correctly
3347         https://bugs.webkit.org/show_bug.cgi?id=158531
3348
3349         Reviewed by Carlos Alberto Lopez Perez.
3350
3351         Do not bypass WebCore event handling when receiving touch events.
3352
3353         Based on a patch by Andre Moreira Magalhaes <andre.magalhaes@collabora.co.uk>.
3354         Thanks to Carlos Garnacho <carlosg@gnome.org> for helping out reviewing the code.
3355
3356         * UIProcess/API/gtk/PageClientImpl.cpp:
3357         (WebKit::PageClientImpl::doneWithTouchEvent): Make sure touchend reaches gesture controller if touchbegin evet got to it.
3358         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
3359         (webkitWebViewBaseTouchEvent): Do not invoke gesture controller directly by bypassing WebCore event handling.
3360         * UIProcess/gtk/GestureController.cpp:
3361         (WebKit::GestureController::reset): Added.
3362         (WebKit::GestureController::handleEvent): Reset gesture controller when touchpadupdate/end is received without touchbegin.
3363         (WebKit::GestureController::Gesture::reset): Added.
3364         * UIProcess/gtk/GestureController.h:
3365
3366 2017-10-04  Michael Catanzaro  <mcatanzaro@igalia.com>
3367
3368         Unreviewed WPE build fix after r222837
3369         https://bugs.webkit.org/show_bug.cgi?id=177449
3370
3371         * Shared/wpe/WebEventFactory.cpp:
3372         (WebKit::wallTimeForEventTime):
3373
3374 2017-10-04  Ryosuke Niwa  <rniwa@webkit.org>
3375
3376         Use blob URL when pasting RTFD instead of overriding DocumentLoader
3377         https://bugs.webkit.org/show_bug.cgi?id=177801
3378         <rdar://problem/34542270>
3379
3380         Reviewed by Wenson Hsieh.
3381
3382         Fixed the assertion failure when RTFD content is empty.
3383
3384         * UIProcess/Cocoa/WebPasteboardProxyCocoa.mm:
3385         (WebKit::WebPasteboardProxy::getPasteboardBufferForType):
3386
3387 2017-10-04  Michael Catanzaro  <mcatanzaro@igalia.com>
3388
3389         REGRESSION(r222392): [WPE][GTK] Many forms tests are failing due to broken event timestamps
3390         https://bugs.webkit.org/show_bug.cgi?id=177449
3391
3392         Reviewed by Chris Dumez.
3393
3394         * Shared/wpe/WebEventFactory.cpp:
3395         (WebKit::wallTimeForEventTime):
3396
3397 2017-10-03  Brent Fulgham  <bfulgham@apple.com>
3398
3399         Correct nullptr dereference during shutdown
3400         https://bugs.webkit.org/show_bug.cgi?id=177845
3401         <rdar://problem/33651405>
3402
3403         Reviewed by Chris Dumez.
3404
3405         It looks like the ResourceLoadStatisticsPersistentStorage destructor is calling code that attempts
3406         to use member variables in its owning class (WebResourceLoadStatisticsStore). Since these may have
3407         already been destroyed, they are in an invalid state when accessed.
3408
3409         * UIProcess/ResourceLoadStatisticsPersistentStorage.cpp:
3410         (WebKit::ResourceLoadStatisticsPersistentStorage::~ResourceLoadStatisticsPersistentStorage): Do not call
3411         finishAllPendingWorkSynchronously() in the destructor, since it relies on the m_memoryStore to be
3412         a reference to completely valid object.
3413         * UIProcess/WebResourceLoadStatisticsStore.cpp:
3414         (WebKit::WebResourceLoadStatisticsStore::~WebResourceLoadStatisticsStore): Instead, call
3415         'finishAllPendingWorkSynchronously' here, when the object is still in a known valid state.
3416
3417 2017-10-03  Alex Christensen  <achristensen@webkit.org>
3418
3419         Moderize WebKit's back forward list code
3420         https://bugs.webkit.org/show_bug.cgi?id=177843
3421
3422         Reviewed by Tim Horton.
3423
3424         Use Ref instead of RefPtr when possible.
3425         Use references instead of pointers when possible.
3426         Remove unnecessary null checks.
3427         Reduce unnecessary Vector copying.
3428
3429         * Shared/SessionState.h:
3430         * Shared/WebBackForwardListItem.h:
3431         * UIProcess/API/APILoaderClient.h:
3432         (API::LoaderClient::didChangeBackForwardList):
3433         (API::LoaderClient::shouldKeepCurrentBackForwardListItemInList):
3434         * UIProcess/API/C/WKPage.cpp:
3435         (WKPageSetPageLoaderClient):
3436         * UIProcess/WebBackForwardList.cpp:
3437         (WebKit::WebBackForwardList::pageClosed):
3438         (WebKit::WebBackForwardList::addItem):
3439         (WebKit::WebBackForwardList::goToItem):
3440         (WebKit::WebBackForwardList::currentItem const):
3441         (WebKit::WebBackForwardList::backItem const):
3442         (WebKit::WebBackForwardList::forwardItem const):
3443         (WebKit::WebBackForwardList::itemAtIndex const):
3444         (WebKit::WebBackForwardList::backListAsAPIArrayWithLimit const):
3445         (WebKit::WebBackForwardList::forwardListAsAPIArrayWithLimit const):
3446         (WebKit::WebBackForwardList::removeAllItems):
3447         (WebKit::WebBackForwardList::clear):
3448