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