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