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