Plugin processes are repeatedly spun up to do nothing
[WebKit-https.git] / Source / WebKit / ChangeLog
1 2017-12-16  Brent Fulgham  <bfulgham@apple.com>
2
3         Plugin processes are repeatedly spun up to do nothing
4         https://bugs.webkit.org/show_bug.cgi?id=180885
5         <rdar://problem/36082564>
6
7         Reviewed by Geoffrey Garen.
8
9         Tested by TestWebKitAPI.
10
11         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
12         (WebKit::WebsiteDataStore::removeData): Don't ask plugins to remove data when no websites are
13         passed to the function.
14
15 2017-12-15  Chris Dumez  <cdumez@apple.com>
16
17         Support updating a service worker registration's updateViaCache flag
18         https://bugs.webkit.org/show_bug.cgi?id=180888
19
20         Reviewed by Brady Eidson.
21
22         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
23         (WebKit::WebSWServerConnection::setRegistrationUpdateViaCache):
24         * StorageProcess/ServiceWorker/WebSWServerConnection.h:
25         * WebProcess/Storage/WebSWClientConnection.messages.in:
26
27 2017-12-15  Alex Christensen  <achristensen@webkit.org>
28
29         Introduce SPI _WKWebsitePolicies.websiteDataStore
30         https://bugs.webkit.org/show_bug.cgi?id=180880
31         <rdar://problem/35535328>
32
33         Reviewed by Andy Estes.
34
35         The SPI doesn't do anything yet, but it already has some restrictions and tests!
36         WKWebView._updateWebsitePolicies can't be used to update a WKWebsiteDataStore.  Only during navigation.
37         Even during navigation, we are only supporting the default and ephemeral data stores right now.
38         This functionality won't be supported in the C API.  This is enforced with RELEASE_ASSERTs.
39         If we change our minds, we can change them and add restrictions similar to the ObjC restrictions.
40
41         * Shared/WebsitePoliciesData.cpp:
42         (WebKit::WebsitePoliciesData::encode const):
43         (WebKit::WebsitePoliciesData::decode):
44         * Shared/WebsitePoliciesData.h:
45         * UIProcess/API/APIWebsitePolicies.cpp:
46         (API::WebsitePolicies::WebsitePolicies):
47         (API::WebsitePolicies::setWebsiteDataStore):
48         (API::WebsitePolicies::data):
49         * UIProcess/API/APIWebsitePolicies.h:
50         * UIProcess/API/C/WKFramePolicyListener.cpp:
51         (WKFramePolicyListenerUseWithPolicies):
52         * UIProcess/API/C/WKPage.cpp:
53         (WKPageUpdateWebsitePolicies):
54         * UIProcess/API/Cocoa/WKWebView.mm:
55         (-[WKWebView _updateWebsitePolicies:]):
56         * UIProcess/API/Cocoa/_WKWebsitePolicies.h:
57         * UIProcess/API/Cocoa/_WKWebsitePolicies.mm:
58         (-[_WKWebsitePolicies websiteDataStore]):
59         (-[_WKWebsitePolicies setWebsiteDataStore:]):
60         * UIProcess/Cocoa/NavigationState.mm:
61         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
62
63 2017-12-15  Alex Christensen  <achristensen@webkit.org>
64
65         Fix GTK build.
66
67         * UIProcess/API/glib/WebKitPolicyDecision.cpp:
68         (webkit_policy_decision_use):
69
70 2017-12-15  Brent Fulgham  <bfulgham@apple.com>
71
72         Avoid waking plugin process up unnecessarily
73         https://bugs.webkit.org/show_bug.cgi?id=180819
74         <rdar://problem/36051548>
75
76         Reviewed by Geoffrey Garen.
77
78         WebKit purges data from origins marked as prevalent on an hourly interval. This includes waking up plugins
79         and removing relevant data stored in those plugins. This causes multiple plugin processes to be spawned,
80         even though the user is not interacting with any plugins.
81
82         Instead, we should delay removing data from plugins until they are loaded due to the user interacting with
83         a website using a plugin.
84
85         Make the following changes:
86         1. When looking for plugin data related to prevalent sites, only examine plugin data if the relevant plugin
87            is already running.
88         2. When the state of the active plugins changes, trigger a data removal check.
89
90         * Shared/WebsiteData/WebsiteDataFetchOption.h: Add a new option 'DoNotCreateProcesses'
91         * UIProcess/Plugins/PluginProcessManager.cpp:
92         (WebKit::PluginProcessManager::getPluginProcessConnection): Pass new argument 'Launch', since we always
93         want to launch processes in this case.
94         (WebKit::PluginProcessManager::fetchWebsiteData): Pass a new parameter 'processAccessType' so that the
95         caller can specify if they only want to examine already-active plugins, or if they want to spawn new
96         processes. Call the completion handler if we need to exit early when no process exists.
97         (WebKit::PluginProcessManager::deleteWebsiteData): Always launch new processes.
98         (WebKit::PluginProcessManager::deleteWebsiteDataForHostNames): Ditto.
99         (WebKit::PluginProcessManager::getOrCreatePluginProcess): Accept new parameter indicating if new processes
100         shoudl be launched. Also switch to C++ style loops.
101         * UIProcess/Plugins/PluginProcessManager.h:
102         * UIProcess/WebProcessProxy.cpp:
103         (WebKit::WebProcessProxy::deleteWebsiteDataForTopPrivatelyControlledDomainsInAllPersistentDataStores): Use the
104         new 'DoNotCreatePrcesses' access type.
105         * UIProcess/WebResourceLoadStatisticsStore.cpp:
106         (WebKit::WebResourceLoadStatisticsStore::removeDataRecords): Update the active plugin count when we
107         remove data.
108         (WebKit::WebResourceLoadStatisticsStore::shouldRemoveDataRecords const): Return true if the active plugin
109         process count changed since the last time data was removed.
110         * UIProcess/WebResourceLoadStatisticsStore.h:
111         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
112         (WebKit::WebsiteDataStore::fetchDataAndApply): Check fetch option for new 'DoNotCreateProcesses' flag,
113         and tell the PluginProcessManager which mode we are using.
114
115 2017-12-15  Brady Eidson  <beidson@apple.com>
116
117         Make sure only WebsiteDataStores with valid SessionIDs register themselves.
118         https://bugs.webkit.org/show_bug.cgi?id=180869
119
120         Reviewed by Chris Dumez.
121
122         Some code in WebsiteDataStore assumes an invalid SessionID is a possibility,
123         but we didn't account for that in the map added in r225935.
124
125         Seems prudent to make sure we're not doing hash table operations with invalid keys.
126
127         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
128         (WebKit::WebsiteDataStore::WebsiteDataStore):
129         (WebKit::WebsiteDataStore::~WebsiteDataStore):
130         (WebKit::WebsiteDataStore::maybeRegisterWithSessionIDMap):
131         (WebKit::WebsiteDataStore::existingNonDefaultDataStoreForSessionID):
132         * UIProcess/WebsiteData/WebsiteDataStore.h:
133
134 2017-12-14  Simon Fraser  <simon.fraser@apple.com>
135
136         Rotating when zoomed in with fingers down can result in a broken tab
137         https://bugs.webkit.org/show_bug.cgi?id=180859
138         rdar://problem/34532817
139
140         Reviewed by Tim Horton.
141
142         If you zoom in fully, then, with two fingers down, rotate the iPhone and rotate back,
143         then the tab can get into a broken state where the WKContentView has a non-zero position
144         which may push it entirely off-screen. The tab never recovers.
145
146         This is caused by a bug in UIKit (rdar://problem/36065495) so work around it by always
147         re-setting the position of the content view after zooming. We initialize contentView.frame
148         from self.bounds, so setting the position (via "center") to the bounds origin should always be safe.
149
150         * UIProcess/API/Cocoa/WKWebView.mm:
151         (-[WKWebView scrollViewDidEndZooming:withView:atScale:]):
152
153 2017-12-15  Brady Eidson  <beidson@apple.com>
154
155         API test WebKit.WebsiteDataStoreCustomPaths is failing
156         https://bugs.webkit.org/show_bug.cgi?id=180870
157
158         Reviewed by Chris Dumez.
159
160         To avoid unintentionally creating the default WebsiteDataStore we need to pass around the
161         relevant SessionID to more places.
162
163         * UIProcess/ServiceWorkerProcessProxy.cpp:
164         (WebKit::ServiceWorkerProcessProxy::start):
165         * UIProcess/ServiceWorkerProcessProxy.h:
166
167         * UIProcess/WebProcessPool.cpp:
168         (WebKit::WebProcessPool::getStorageProcessConnection):
169         (WebKit::WebProcessPool::establishWorkerContextConnectionToStorageProcess):
170         * UIProcess/WebProcessPool.h:
171
172         * UIProcess/WebProcessProxy.cpp:
173         (WebKit::WebProcessProxy::getStorageProcessConnection):
174         * UIProcess/WebProcessProxy.h:
175         * UIProcess/WebProcessProxy.messages.in:
176
177         * WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.cpp:
178         (WebKit::WebIDBConnectionToServer::messageSenderConnection):
179
180         * WebProcess/Databases/WebDatabaseProvider.cpp:
181         (WebKit::WebDatabaseProvider::idbConnectionToServerForSession):
182
183         * WebProcess/Storage/WebServiceWorkerProvider.cpp:
184         (WebKit::WebServiceWorkerProvider::serviceWorkerConnectionForSession):
185         (WebKit::WebServiceWorkerProvider::handleFetch):
186
187         * WebProcess/WebProcess.cpp:
188         (WebKit::WebProcess::ensureWebToStorageProcessConnection):
189         (WebKit::WebProcess::establishWorkerContextConnectionToStorageProcess):
190         * WebProcess/WebProcess.h:
191         * WebProcess/WebProcess.messages.in:
192
193 2017-12-15  Alex Christensen  <achristensen@webkit.org>
194
195         Move WebKit::WebsitePolicies to API::WebsitePolicies
196         https://bugs.webkit.org/show_bug.cgi?id=180873
197
198         Reviewed by Joseph Pecoraro.
199
200         It's just an API data object now.  I need it to be in the API namespace so we can
201         give it references to other API namespace objects without weird layering violations.
202
203         * CMakeLists.txt:
204         * Shared/WebsiteAutoplayPolicy.h: Added.
205         * Shared/WebsiteAutoplayQuirk.h: Added.
206         * Shared/WebsitePoliciesData.cpp:
207         (WebKit::WebsitePoliciesData::fromWebsitePolicies): Deleted.
208         * Shared/WebsitePoliciesData.h:
209         * UIProcess/API/APIWebsitePolicies.cpp: Added.
210         (API::WebsitePolicies::~WebsitePolicies):
211         (API::WebsitePolicies::data):
212         * UIProcess/API/APIWebsitePolicies.h: Copied from Source/WebKit/UIProcess/WebsitePolicies.h.
213         * UIProcess/API/C/WKAPICast.h:
214         * UIProcess/API/C/WKFramePolicyListener.cpp:
215         (WKFramePolicyListenerUseWithPolicies):
216         * UIProcess/API/C/WKPage.cpp:
217         (WKPageUpdateWebsitePolicies):
218         * UIProcess/API/C/WKWebsitePolicies.cpp:
219         (WKWebsitePoliciesGetTypeID):
220         (WKWebsitePoliciesCreate):
221         * UIProcess/API/Cocoa/WKWebView.mm:
222         (-[WKWebView _updateWebsitePolicies:]):
223         * UIProcess/API/Cocoa/_WKWebsitePolicies.h:
224         * UIProcess/API/Cocoa/_WKWebsitePolicies.mm:
225         (-[_WKWebsitePolicies dealloc]):
226         (-[_WKWebsitePolicies init]):
227         * UIProcess/API/Cocoa/_WKWebsitePoliciesInternal.h:
228         (WebKit::wrapper): Deleted.
229         * UIProcess/Cocoa/NavigationState.mm:
230         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
231         * UIProcess/WebFormSubmissionListenerProxy.cpp:
232         * UIProcess/WebsitePolicies.h: Removed.
233         * WebKit.xcodeproj/project.pbxproj:
234         * WebProcess/WebPage/WebPage.cpp:
235
236 2017-12-14  Zan Dobersek  <zdobersek@igalia.com>
237
238         Unreviewed GTK+ build fix after r225954.
239
240         * UIProcess/API/glib/WebKitPolicyDecision.cpp:
241         Explicitly include the WebsitePoliciesData.h header, avoiding build
242         failures due to incomplete WebsitePoliciesData type.
243
244 2017-12-14  David Kilzer  <ddkilzer@apple.com>
245
246         Enable -Wstrict-prototypes for WebKit
247         <https://webkit.org/b/180757>
248         <rdar://problem/36024132>
249
250         Rubber-stamped by Joseph Pecoraro.
251
252         * Configurations/Base.xcconfig:
253         (CLANG_WARN_STRICT_PROTOTYPES): Add. Set to YES.
254         * Platform/spi/ios/UIKitSPI.h:
255         (_UIDragInteractionDefaultLiftDelay): Add 'void' to C function declaration.
256         (UIKeyboardEnabledInputModesAllowOneToManyShortcuts): Ditto.
257
258 2017-12-14  Alex Christensen  <achristensen@webkit.org>
259
260         Serialize WebsitePoliciesData instead of WebsitePolicies
261         https://bugs.webkit.org/show_bug.cgi?id=180847
262
263         Reviewed by Joseph Pecoraro.
264
265         No change in behavior.  This will allow me to add things to WebsitePolicies that have 
266         a different form when serialized to another process.
267         
268         Also, remove API::WebsitePolicies because the wrapper isn't necessary.
269         WebsitePolicies is now the API type that only exists in the UIProcess.
270
271         * Shared/WebsitePolicies.cpp: Removed.
272         * Shared/WebsitePolicies.h:
273         (WebKit::WebsitePolicies::contentBlockersEnabled const): Deleted.
274         (WebKit::WebsitePolicies::setContentBlockersEnabled): Deleted.
275         (WebKit::WebsitePolicies::allowedAutoplayQuirks const): Deleted.
276         (WebKit::WebsitePolicies::setAllowedAutoplayQuirks): Deleted.
277         (WebKit::WebsitePolicies::autoplayPolicy const): Deleted.
278         (WebKit::WebsitePolicies::setAutoplayPolicy): Deleted.
279         (WebKit::WebsitePolicies::customHeaderFields): Deleted.
280         (WebKit::WebsitePolicies::takeCustomHeaderFields): Deleted.
281         (WebKit::WebsitePolicies::setCustomHeaderFields): Deleted.
282         * Shared/WebsitePoliciesData.cpp: Copied from Source/WebKit/Shared/WebsitePolicies.cpp.
283         (WebKit::WebsitePoliciesData::fromWebsitePolicies):
284         (WebKit::WebsitePoliciesData::encode const):
285         (WebKit::WebsitePoliciesData::decode):
286         (WebKit::WebsitePoliciesData::applyToDocumentLoader):
287         (WebKit::WebsitePolicies::WebsitePolicies): Deleted.
288         (WebKit::WebsitePolicies::encode const): Deleted.
289         (WebKit::WebsitePolicies::decode): Deleted.
290         (WebKit::WebsitePolicies::applyToDocumentLoader): Deleted.
291         * Shared/WebsitePoliciesData.h: Added.
292         * UIProcess/API/APINavigationClient.h:
293         (API::NavigationClient::decidePolicyForNavigationAction):
294         (API::NavigationClient::decidePolicyForNavigationResponse):
295         * UIProcess/API/APIPolicyClient.h:
296         (API::PolicyClient::decidePolicyForNavigationAction):
297         (API::PolicyClient::decidePolicyForNewWindowAction):
298         (API::PolicyClient::decidePolicyForResponse):
299         * UIProcess/API/APIWebsitePolicies.cpp: Removed.
300         * UIProcess/API/APIWebsitePolicies.h: Removed.
301         * UIProcess/API/C/WKAPICast.h:
302         * UIProcess/API/C/WKFramePolicyListener.cpp:
303         (WKFramePolicyListenerUse):
304         (WKFramePolicyListenerUseWithPolicies):
305         * UIProcess/API/C/WKPage.cpp:
306         (WKPageUpdateWebsitePolicies):
307         (WKPageSetPagePolicyClient):
308         (WKPageSetPageNavigationClient):
309         * UIProcess/API/C/WKWebsitePolicies.cpp:
310         (WKWebsitePoliciesGetTypeID):
311         (WKWebsitePoliciesCreate):
312         * UIProcess/API/Cocoa/WKWebView.mm:
313         (-[WKWebView _updateWebsitePolicies:]):
314         * UIProcess/API/Cocoa/_WKWebsitePolicies.mm:
315         (-[_WKWebsitePolicies dealloc]):
316         (-[_WKWebsitePolicies init]):
317         * UIProcess/API/Cocoa/_WKWebsitePoliciesInternal.h:
318         (WebKit::wrapper):
319         * UIProcess/Cocoa/NavigationState.mm:
320         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
321         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationResponse):
322         * UIProcess/WebFrameListenerProxy.cpp:
323         (WebKit::WebFrameListenerProxy::receivedPolicyDecision):
324         * UIProcess/WebFrameListenerProxy.h:
325         * UIProcess/WebFramePolicyListenerProxy.cpp:
326         (WebKit::WebFramePolicyListenerProxy::use):
327         (WebKit::WebFramePolicyListenerProxy::download):
328         (WebKit::WebFramePolicyListenerProxy::ignore):
329         * UIProcess/WebFramePolicyListenerProxy.h:
330         * UIProcess/WebFrameProxy.cpp:
331         (WebKit::WebFrameProxy::receivedPolicyDecision):
332         * UIProcess/WebFrameProxy.h:
333         * UIProcess/WebPageProxy.cpp:
334         (WebKit::WebPageProxy::receivedPolicyDecision):
335         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
336         (WebKit::WebPageProxy::updateWebsitePolicies):
337         * UIProcess/WebPageProxy.h:
338         * UIProcess/WebPageProxy.messages.in:
339         * WebKit.xcodeproj/project.pbxproj:
340         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
341         (WebKit::WebFrameLoaderClient::applyToDocumentLoader):
342         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
343         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
344         * WebProcess/WebPage/WebFrame.cpp:
345         (WebKit::WebFrame::didReceivePolicyDecision):
346         * WebProcess/WebPage/WebFrame.h:
347         * WebProcess/WebPage/WebPage.cpp:
348         (WebKit::WebPage::didReceivePolicyDecision):
349         (WebKit::WebPage::updateWebsitePolicies):
350         * WebProcess/WebPage/WebPage.h:
351         * WebProcess/WebPage/WebPage.messages.in:
352
353 2017-12-14  Ryan Haddad  <ryanhaddad@apple.com>
354
355         Unreviewed, rolling out r225931.
356
357         Breaks internal builds.
358
359         Reverted changeset:
360
361         "Fix Mac CMake build"
362         https://bugs.webkit.org/show_bug.cgi?id=180835
363         https://trac.webkit.org/changeset/225931
364
365 2017-12-14  Chris Dumez  <cdumez@apple.com>
366
367         Clearing WebSite data on iOS does not clear the Fetch Cache
368         https://bugs.webkit.org/show_bug.cgi?id=180846
369         <rdar://problem/36060129>
370
371         Reviewed by Youenn Fablet.
372
373         When clearing WebSite data, construct the engine for the given sessionID
374         if missing, instead of not clearing anything when the engine is missing.
375
376         * NetworkProcess/NetworkProcess.cpp:
377         (WebKit::NetworkProcess::deleteWebsiteData):
378         (WebKit::NetworkProcess::deleteWebsiteDataForOrigins):
379
380 2017-12-14  Chris Dumez  <cdumez@apple.com>
381
382         self.importScripts() should obey updateViaCache inside service workers
383         https://bugs.webkit.org/show_bug.cgi?id=180826
384
385         Reviewed by Youenn Fablet.
386
387         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
388         (WebKit::WebSWServerConnection::setRegistrationLastUpdateTime):
389         * StorageProcess/ServiceWorker/WebSWServerConnection.h:
390         * WebProcess/Storage/WebSWClientConnection.messages.in:
391
392 2017-12-14  Yusuke Suzuki  <utatane.tea@gmail.com>
393
394         Drop Thread::tryCreate
395         https://bugs.webkit.org/show_bug.cgi?id=180808
396
397         Reviewed by Darin Adler.
398
399         We still return bool since IconDatabase::open returns `false` if it is opened twice.
400
401         * UIProcess/API/glib/IconDatabase.cpp:
402         (WebKit::IconDatabase::open):
403         * UIProcess/API/glib/IconDatabase.h:
404
405 2017-12-14  Brady Eidson  <beidson@apple.com>
406
407         REGRESSION (r225789): API tests WKProcessPool.InitialWarmedProcessUsed and WebKit.WebsiteDataStoreCustomPaths are failing.
408         https://bugs.webkit.org/show_bug.cgi?id=180722
409
410         Reviewed by Chris Dumez.
411
412         - Add a test-only accessor to get the number of WebProcesses hosting WebPages
413         - Have WebsiteDataStore keep track of all instances so they can be looked up by SessionID
414         - When the StorageProcess needs to establish a SW context connection on behalf of a specific SessionID,
415           the UI process will now prefer using the WebsiteDataStore associated with that SessionID. This allows
416           us to continue deferring creation of the default data store if it's not needed.
417
418         * StorageProcess/StorageProcess.cpp:
419         (WebKit::StorageProcess::connectionToContextProcessWasClosed):
420         (WebKit::StorageProcess::createServerToContextConnection):
421         * StorageProcess/StorageProcess.h:
422
423         * StorageProcess/StorageToWebProcessConnection.cpp:
424         (WebKit::StorageToWebProcessConnection::establishSWServerConnection):
425
426         * UIProcess/API/Cocoa/WKProcessPool.mm:
427         (-[WKProcessPool _webPageContentProcessCount]):
428         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
429
430         * UIProcess/Storage/StorageProcessProxy.cpp:
431         (WebKit::StorageProcessProxy::establishWorkerContextConnectionToStorageProcess):
432         (WebKit::StorageProcessProxy::establishWorkerContextConnectionToStorageProcessForExplicitSession):
433         * UIProcess/Storage/StorageProcessProxy.h:
434         * UIProcess/Storage/StorageProcessProxy.messages.in:
435
436         * UIProcess/WebProcessPool.cpp:
437         (WebKit::WebProcessPool::establishWorkerContextConnectionToStorageProcess):
438         * UIProcess/WebProcessPool.h:
439
440         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
441         (WebKit::WebsiteDataStore::WebsiteDataStore):
442         (WebKit::WebsiteDataStore::~WebsiteDataStore):
443         (WebKit::WebsiteDataStore::existingDataStoreForSessionID):
444         * UIProcess/WebsiteData/WebsiteDataStore.h:
445
446 2017-12-14  John Wilander  <wilander@apple.com>
447
448         Storage Access API: Implement frame-specific access in the document.cookie layer
449         https://bugs.webkit.org/show_bug.cgi?id=180682
450         <rdar://problem/35982257>
451
452         Reviewed by Alex Christensen.
453
454         CookiesStrategy::cookiesForDOM(), CookiesStrategy::setCookiesFromDOM(),
455         CookiesStrategy::cookieRequestHeaderFieldValue(), and
456         CookiesStrategy::getRawCookies() now take optional parameters for
457         frameID and pageID to allow frame-specific scoping of cookies.
458
459         This change makes the return values of FrameLoaderClient::frameID()
460         and FrameLoaderClient::pageID() std::optional<uint64_t> so that
461         WebCore can call those getters and get the right return values in
462         WebKit and std:nullopt in WebKitLegacy.
463
464         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
465         (WebKit::NetworkConnectionToWebProcess::cookiesForDOM):
466         (WebKit::NetworkConnectionToWebProcess::setCookiesFromDOM):
467         (WebKit::NetworkConnectionToWebProcess::cookieRequestHeaderFieldValue):
468         (WebKit::NetworkConnectionToWebProcess::getRawCookies):
469         * NetworkProcess/NetworkConnectionToWebProcess.h:
470         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
471         * Shared/mac/CookieStorageShim.mm:
472         (WebKit::webKitCookieStorageCopyRequestHeaderFieldsForURL):
473         * WebProcess/Network/WebLoaderStrategy.cpp:
474         (WebKit::WebLoaderStrategy::scheduleLoad):
475             Now handles the fact that FrameLoaderClient::frameID() and
476             FrameLoaderClient::pageID() return an optional.
477         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
478         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
479         (WebKit::WebFrameLoaderClient::pageID const):
480         (WebKit::WebFrameLoaderClient::frameID const):
481             Now return an optional.
482         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
483         * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
484         (WebKit::WebPlatformStrategies::cookiesForDOM):
485         (WebKit::WebPlatformStrategies::setCookiesFromDOM):
486         (WebKit::WebPlatformStrategies::cookieRequestHeaderFieldValue):
487         (WebKit::WebPlatformStrategies::getRawCookies):
488         * WebProcess/WebCoreSupport/WebPlatformStrategies.h:
489
490 2017-12-14  Alex Christensen  <achristensen@webkit.org>
491
492         Fix Mac CMake build
493         https://bugs.webkit.org/show_bug.cgi?id=180835
494
495         Reviewed by Andy Estes.
496
497         * PlatformMac.cmake:
498         * Shared/WebsiteDataStoreParameters.cpp:
499         (WebKit::WebsiteDataStoreParameters::ephemeralParametersWithSessionID):
500         * Shared/WebsiteDataStoreParameters.h:
501         * UIProcess/API/APIAttachment.h:
502         * WebProcess/InjectedBundle/InjectedBundle.cpp:
503         (WebKit::InjectedBundle::setPrivateBrowsingEnabled):
504         * WebProcess/WebPage/WebPage.cpp:
505         (WebKit::WebPage::setSessionID):
506
507 2017-12-14  Alex Christensen  <achristensen@webkit.org>
508
509         Use move semantics for SandboxExtension::Handle
510         https://bugs.webkit.org/show_bug.cgi?id=180792
511
512         Reviewed by Andy Estes.
513         
514         Passing them around as const SandboxExtension::Handle& is wrong because ownership is transferred and they are consumed.
515         It only works now because their contents are mutable, which isn't a good use of mutable.
516
517         * NetworkProcess/Downloads/Download.cpp:
518         (WebKit::Download::decideDestinationWithSuggestedFilename):
519         (WebKit::Download::didDecideDownloadDestination):
520         * NetworkProcess/Downloads/Download.h:
521         * NetworkProcess/Downloads/DownloadManager.cpp:
522         (WebKit::DownloadManager::continueDecidePendingDownloadDestination):
523         (WebKit::DownloadManager::resumeDownload):
524         * NetworkProcess/Downloads/DownloadManager.h:
525         * NetworkProcess/Downloads/cocoa/DownloadCocoa.mm:
526         (WebKit::Download::resume):
527         * NetworkProcess/Downloads/ios/DownloadIOS.mm:
528         (WebKit::Download::resume):
529         * NetworkProcess/Downloads/mac/DownloadMac.mm:
530         (WebKit::Download::resume):
531         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
532         (WebKit::NetworkConnectionToWebProcess::registerFileBlobURL):
533         (WebKit::NetworkConnectionToWebProcess::preregisterSandboxExtensionsForOptionallyFileBackedBlob):
534         * NetworkProcess/NetworkConnectionToWebProcess.h:
535         * NetworkProcess/NetworkDataTask.h:
536         (WebKit::NetworkDataTask::setPendingDownloadLocation):
537         * NetworkProcess/NetworkDataTaskBlob.cpp:
538         (WebKit::NetworkDataTaskBlob::setPendingDownloadLocation):
539         * NetworkProcess/NetworkDataTaskBlob.h:
540         * NetworkProcess/NetworkProcess.cpp:
541         (WebKit::NetworkProcess::resumeDownload):
542         (WebKit::NetworkProcess::continueDecidePendingDownloadDestination):
543         * NetworkProcess/NetworkProcess.h:
544         * NetworkProcess/NetworkResourceLoadParameters.cpp:
545         (WebKit::NetworkResourceLoadParameters::decode):
546         * NetworkProcess/cocoa/NetworkDataTaskCocoa.h:
547         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
548         (WebKit::NetworkDataTaskCocoa::setPendingDownloadLocation):
549         * Shared/SandboxExtension.h:
550         (WebKit::SandboxExtension::create):
551         * Shared/WebMemorySampler.cpp:
552         (WebKit::WebMemorySampler::start):
553         (WebKit::WebMemorySampler::initializeSandboxedLogFile):
554         * Shared/WebMemorySampler.h:
555         * Shared/mac/SandboxExtensionMac.mm:
556         (WebKit::SandboxExtension::create):
557         * StorageProcess/StorageProcess.cpp:
558         (WebKit::StorageProcess::grantSandboxExtensionsForBlobs):
559         * StorageProcess/StorageProcess.h:
560         * UIProcess/Cocoa/WebViewImpl.mm:
561         (WebKit::WebViewImpl::performDragOperation):
562         * UIProcess/WebPageProxy.cpp:
563         (WebKit::WebPageProxy::dragEntered):
564         (WebKit::WebPageProxy::dragUpdated):
565         (WebKit::WebPageProxy::dragExited):
566         (WebKit::WebPageProxy::performDragOperation):
567         (WebKit::WebPageProxy::performDragControllerAction):
568         * UIProcess/WebPageProxy.h:
569         * WebProcess/InjectedBundle/InjectedBundle.cpp:
570         (WebKit::InjectedBundle::create):
571         * WebProcess/InjectedBundle/InjectedBundle.h:
572         * WebProcess/MediaStream/MediaDeviceSandboxExtensions.cpp:
573         (WebKit::MediaDeviceSandboxExtensions::operator[]):
574         (WebKit::MediaDeviceSandboxExtensions::operator[] const): Deleted.
575         * WebProcess/MediaStream/MediaDeviceSandboxExtensions.h:
576         * WebProcess/MediaStream/UserMediaPermissionRequestManager.cpp:
577         (WebKit::UserMediaPermissionRequestManager::grantUserMediaDeviceSandboxExtensions):
578         * WebProcess/MediaStream/UserMediaPermissionRequestManager.h:
579         * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
580         (WebKit::WebPlatformStrategies::getPathnamesForType):
581         * WebProcess/WebPage/WebBackForwardListProxy.cpp:
582         (WebKit::WebBackForwardListProxy::goToItem):
583         * WebProcess/WebPage/WebPage.cpp:
584         (WebKit::WebPage::loadRequest):
585         (WebKit::WebPage::reload):
586         (WebKit::WebPage::performDragControllerAction):
587         (WebKit::WebPage::grantUserMediaDeviceSandboxExtensions):
588         (WebKit::WebPage::SandboxExtensionTracker::beginLoad):
589         * WebProcess/WebPage/WebPage.h:
590         * WebProcess/WebProcess.cpp:
591         (WebKit::WebProcess::startMemorySampler):
592         * WebProcess/WebProcess.h:
593
594 2017-12-14  Alex Christensen  <achristensen@webkit.org>
595
596         Make WebsitePolicies a proper class with getters and setters
597         https://bugs.webkit.org/show_bug.cgi?id=180788
598
599         Reviewed by Andy Estes.
600
601         Also introduce WebsitePolicies::applyToDocumentLoader to reduce duplicate code.
602         This has a side-effect of now applying custom http header fields and content blocking enabled status
603         when updating WebsitePolicies.  This will result in these being applied when a user updates
604         the per-site settings, and they weren't before.
605
606         * CMakeLists.txt:
607         * Shared/WebsitePolicies.cpp: Added.
608         (WebKit::WebsitePolicies::WebsitePolicies):
609         (WebKit::WebsitePolicies::encode const):
610         (WebKit::WebsitePolicies::decode):
611         (WebKit::WebsitePolicies::applyToDocumentLoader):
612         * Shared/WebsitePolicies.h:
613         (WebKit::WebsitePolicies::contentBlockersEnabled const):
614         (WebKit::WebsitePolicies::setContentBlockersEnabled):
615         (WebKit::WebsitePolicies::allowedAutoplayQuirks const):
616         (WebKit::WebsitePolicies::setAllowedAutoplayQuirks):
617         (WebKit::WebsitePolicies::autoplayPolicy const):
618         (WebKit::WebsitePolicies::setAutoplayPolicy):
619         (WebKit::WebsitePolicies::customHeaderFields):
620         (WebKit::WebsitePolicies::takeCustomHeaderFields):
621         (WebKit::WebsitePolicies::setCustomHeaderFields):
622         (WebKit::WebsitePolicies::encode const): Deleted.
623         (WebKit::WebsitePolicies::decode): Deleted.
624         * UIProcess/API/APIWebsitePolicies.h:
625         * WebKit.xcodeproj/project.pbxproj:
626         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
627         (WebKit::WebFrameLoaderClient::applyToDocumentLoader):
628         * WebProcess/WebPage/WebPage.cpp:
629         (WebKit::WebPage::updateWebsitePolicies):
630         * WebProcess/WebPage/WebPage.h:
631
632 2017-12-14  Chris Dumez  <cdumez@apple.com>
633
634         Enable Service Workers on iOS
635         https://bugs.webkit.org/show_bug.cgi?id=180836
636
637         Reviewed by Alex Christensen.
638
639         * Shared/WebPreferencesDefaultValues.h:
640         * UIProcess/WebProcessPool.cpp:
641         Enable Service Workers on iOS.
642
643         (WebKit::WebProcessPool::ensureNetworkProcess):
644         Fall back to defaultCacheStorageDirectory() instead of the empty string
645         for the cache storage directory, when we do not have a store.
646
647 2017-12-14  Chris Dumez  <cdumez@apple.com>
648
649         Service worker script fetching currently always uses the network cache
650         https://bugs.webkit.org/show_bug.cgi?id=180816
651
652         Reviewed by Alex Christensen.
653
654         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
655         (WebKit::WebSWServerConnection::startScriptFetchInClient):
656         * StorageProcess/ServiceWorker/WebSWServerConnection.h:
657         * WebProcess/Storage/WebSWClientConnection.messages.in:
658
659 2017-12-14  Chris Dumez  <cdumez@apple.com>
660
661         StorageProcess::deleteWebsiteData() should ensure there is a SWServer for the given sessionID
662         https://bugs.webkit.org/show_bug.cgi?id=180784
663
664         Reviewed by Youenn Fablet.
665
666         StorageProcess::deleteWebsiteData() should ensure there is a SWServer for the given sessionID
667         instead of not clearing anything when no such SWServer exists.
668
669         This will be useful on iOS once <rdar://problem/36034667> is fully fixed.
670
671         * StorageProcess/StorageProcess.cpp:
672         (WebKit::StorageProcess::deleteWebsiteData):
673         (WebKit::StorageProcess::deleteWebsiteDataForOrigins):
674         * UIProcess/API/APIProcessPoolConfiguration.cpp:
675         (API::ProcessPoolConfiguration::createWithWebsiteDataStoreConfiguration):
676
677 2017-12-14  Chris Dumez  <cdumez@apple.com>
678
679         WebsiteDataStore::defaultDataStoreConfiguration() fails to set default value for serviceWorkerRegistrationDirectory
680         https://bugs.webkit.org/show_bug.cgi?id=180794
681         <rdar://problem/36034667>
682
683         Reviewed by Youenn Fablet.
684
685         Set the default IndexedDB and ServiceWorker database paths in WebsiteDataStore::defaultDataStoreConfiguration().
686         Without this, the client is forced to set the expected path.
687
688         * UIProcess/API/Cocoa/APIWebsiteDataStoreCocoa.mm:
689         (API::WebsiteDataStore::defaultDataStoreConfiguration):
690         * UIProcess/API/glib/APIWebsiteDataStoreGLib.cpp:
691         (API::WebsiteDataStore::defaultDataStoreConfiguration):
692
693 2017-12-14  Joseph Pecoraro  <pecoraro@apple.com>
694
695         Web Inspector: Cmd-Option-R in docked inspector causes the inspector to reload instead of the inspected page
696         https://bugs.webkit.org/show_bug.cgi?id=180775
697         <rdar://problem/35964592>
698
699         Reviewed by Brian Burg.
700
701         * WebKit.xcodeproj/project.pbxproj:
702         Remove old files add new files.
703
704         * PlatformMac.cmake:
705         * UIProcess/mac/WKWebInspectorWKWebView.h: Removed.
706         * UIProcess/mac/WKWebInspectorWKWebView.mm: Removed.
707         Remove unused WKWebInspectorWKWebView.
708
709         * UIProcess/API/Cocoa/_WKRemoteWebInspectorViewController.mm:
710         * UIProcess/mac/WKInspectorViewController.mm:
711         (-[WKInspectorViewController dealloc]):
712         (-[WKInspectorViewController webView]):
713         (-[WKInspectorViewController inspectorWKWebViewReload:]):
714         (-[WKInspectorViewController inspectorWKWebViewReloadFromOrigin:]):
715         Handle WKWebView IBActions sent to the inspector frontend WKWebView.
716
717         * UIProcess/mac/WKInspectorWKWebView.h:
718         * UIProcess/mac/WKInspectorWKWebView.mm:
719         (-[WKInspectorWKWebView tag]):
720         (-[WKInspectorWKWebView inspectorWKWebViewDelegate]):
721         (-[WKInspectorWKWebView setInspectorWKWebViewDelegate:]):
722         (-[WKInspectorWKWebView reload:]):
723         (-[WKInspectorWKWebView reloadFromOrigin:]):
724         Move WKInspectorWKWebView into its own file. Include a delegate
725         to handle reload IBActions that will want to override.
726
727 2017-12-13  Chris Dumez  <cdumez@apple.com>
728
729         Fix copy/paste error in ProcessPoolConfiguration::createWithWebsiteDataStoreConfiguration()
730         https://bugs.webkit.org/show_bug.cgi?id=180782
731
732         Reviewed by Youenn Fablet.
733
734         * UIProcess/API/APIProcessPoolConfiguration.cpp:
735         (API::ProcessPoolConfiguration::createWithWebsiteDataStoreConfiguration):
736
737 2017-12-13  Daniel Bates  <dabates@apple.com>
738
739         Add more auto fill button types
740         https://bugs.webkit.org/show_bug.cgi?id=180651
741         <rdar://problem/35891125>
742         And
743         <rdar://problem/35977943>
744
745         Reviewed by Brent Fulgham.
746
747         Adds enumerators for the new auto fill button types.
748
749         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandle.mm:
750         (toAutoFillButtonType):
751         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandlePrivate.h:
752         * WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.cpp:
753         (toAutoFillButtonType):
754         * WebProcess/InjectedBundle/API/c/WKBundleNodeHandlePrivate.h:
755
756 2017-12-13  Matt Lewis  <jlewis3@apple.com>
757
758         Unreviewed, rolling out r225864.
759
760         This caused the Layout test step to crash out on Debug testers
761
762         Reverted changeset:
763
764         "REGRESSION (r225789): API tests
765         WKProcessPool.InitialWarmedProcessUsed and
766         WebKit.WebsiteDataStoreCustomPaths are failing."
767         https://bugs.webkit.org/show_bug.cgi?id=180722
768         https://trac.webkit.org/changeset/225864
769
770 2017-12-13  Brady Eidson  <beidson@apple.com>
771
772         REGRESSION (r225789): API tests WKProcessPool.InitialWarmedProcessUsed and WebKit.WebsiteDataStoreCustomPaths are failing.
773         https://bugs.webkit.org/show_bug.cgi?id=180722
774
775         Reviewed by Chris Dumez.
776
777         - Add a test-only accessor to get the number of WebProcesses hosting WebPages
778         - Have WebsiteDataStore keep track of all instances so they can be looked up by SessionID
779         - When the StorageProcess needs to establish a SW context connection on behalf of a specific SessionID,
780           the UI process will now prefer using the WebsiteDataStore associated with that SessionID. This allows
781           us to continue deferring creation of the default data store if it's not needed.
782
783         * StorageProcess/StorageProcess.cpp:
784         (WebKit::StorageProcess::connectionToContextProcessWasClosed):
785         (WebKit::StorageProcess::createServerToContextConnection):
786         * StorageProcess/StorageProcess.h:
787
788         * StorageProcess/StorageToWebProcessConnection.cpp:
789         (WebKit::StorageToWebProcessConnection::establishSWServerConnection):
790
791         * UIProcess/API/Cocoa/WKProcessPool.mm:
792         (-[WKProcessPool _webPageContentProcessCount]):
793         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
794
795         * UIProcess/Storage/StorageProcessProxy.cpp:
796         (WebKit::StorageProcessProxy::establishWorkerContextConnectionToStorageProcess):
797         (WebKit::StorageProcessProxy::establishWorkerContextConnectionToStorageProcessForExplicitSession):
798         * UIProcess/Storage/StorageProcessProxy.h:
799         * UIProcess/Storage/StorageProcessProxy.messages.in:
800
801         * UIProcess/WebProcessPool.cpp:
802         (WebKit::WebProcessPool::establishWorkerContextConnectionToStorageProcess):
803         * UIProcess/WebProcessPool.h:
804
805         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
806         (WebKit::WebsiteDataStore::WebsiteDataStore):
807         (WebKit::WebsiteDataStore::~WebsiteDataStore):
808         (WebKit::WebsiteDataStore::existingDataStoreForSessionID):
809         * UIProcess/WebsiteData/WebsiteDataStore.h:
810
811 2017-12-13  Per Arne Vollan  <pvollan@apple.com>
812
813         REGRESSION(225597): Can't select a text box or web view on a page when VO is on.
814         https://bugs.webkit.org/show_bug.cgi?id=180756
815         <rdar://problem/35996158>
816
817         Reviewed by Brent Fulgham.
818
819         * Platform/IPC/mac/ConnectionMac.mm:
820         (IPC::AccessibilityProcessSuspendedNotification):
821         * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
822         (WebKit::shouldLeakBoost):
823         * WebProcess/EntryPoint/mac/XPCService/WebContentService/Info-OSX.plist:
824         * WebProcess/WebProcess.cpp:
825         (WebKit::WebProcess::initializeProcess):
826
827 2017-12-13  Brent Fulgham  <bfulgham@apple.com>
828
829         [iOS] Further Trim WebContent Process sandbox
830         https://bugs.webkit.org/show_bug.cgi?id=180727
831         <rdar://problem/18899506>
832
833         Reviewed by Eric Carlson.
834
835         Take another pass over the contents of the file and remove addition items that
836         don't have call sites in WebKit.
837
838         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
839
840 2017-12-13  Daniel Bates  <dabates@apple.com>
841
842         Move out-parameter in API::FormClient::willBeginInputSession() to the end of the parameter list
843         https://bugs.webkit.org/show_bug.cgi?id=180754
844
845         Reviewed by Wenson Hsieh.
846
847         Group all in-parameters in the signature of API::FormClient::willBeginInputSession() at
848         the front of the parameter list instead of interspersing in- and out- parameters.
849
850         No functionality changed. So, no new tests.
851
852         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:
853         (-[WKWebProcessPlugInBrowserContextController _setFormDelegate:]):
854         * WebProcess/InjectedBundle/APIInjectedBundleFormClient.h:
855         (API::InjectedBundle::FormClient::willBeginInputSession):
856         * WebProcess/WebPage/WebPage.cpp:
857         (WebKit::WebPage::elementDidFocus):
858
859 2017-12-13  Chris Dumez  <cdumez@apple.com>
860
861         [iOS] Take process assertion to prevent the service worker process from getting suspended
862         https://bugs.webkit.org/show_bug.cgi?id=180735
863
864         Reviewed by Brady Eidson.
865
866         Take process assertion to prevent the service worker process from getting suspended while
867         it is still needed. We use the same policy as for the network process, meaning that
868         unsuspended WebContent processes prevent the service worker process from getting suspended.
869
870         This patch still does not enable service workers on iOS. The demo at https://mdn.github.io/sw-test/
871         appears to work. However, things are not working as expected for mobile.twitter.com where I
872         see the fetches intercepted by the service worker fail when offline for some reason (unrelated
873         to process suspension).
874
875         * UIProcess/WebProcessPool.cpp:
876         (WebKit::m_foregroundWebProcessCounter):
877         (WebKit::m_backgroundWebProcessCounter):
878         (WebKit::WebProcessPool::ensureNetworkProcess):
879         (WebKit::WebProcessPool::establishWorkerContextConnectionToStorageProcess):
880         (WebKit::WebProcessPool::disconnectProcess):
881         (WebKit::WebProcessPool::updateProcessAssertions):
882         (WebKit::WebProcessPool::reinstateNetworkProcessAssertionState):
883         * UIProcess/WebProcessPool.h:
884         * UIProcess/WebProcessProxy.cpp:
885         (WebKit::WebProcessProxy::didSetAssertionState):
886         * UIProcess/WebProcessProxy.h:
887
888 2017-12-13  Carlos Garcia Campos  <cgarcia@igalia.com>
889
890         Unreviewed. Update OptionsGTK.cmake and NEWS for 2.19.3 release.
891
892         * gtk/NEWS: Add release notes for 2.19.3.
893
894 2017-12-12  Daniel Bates  <dabates@apple.com>
895
896         [WK] Add modern WebKit SPI to set auto fill button type and query if the auto fill button is enabled
897         https://bugs.webkit.org/show_bug.cgi?id=180686
898
899         Reviewed by Alex Christensen.
900
901         * WebKit.xcodeproj/project.pbxproj:
902         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandle.mm:
903         (-[WKWebProcessPlugInNodeHandle isHTMLInputElementAutoFillButtonEnabled]):
904         (toAutoFillButtonType):
905         (-[WKWebProcessPlugInNodeHandle setHTMLInputElementAutoFillButtonEnabledWithButtonType:]):
906         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandleInternal.h:
907         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandlePrivate.h:
908
909 2017-12-12  John Wilander  <wilander@apple.com>
910
911         Storage Access API: Implement frame-specific access in the network storage session layer
912         https://bugs.webkit.org/show_bug.cgi?id=180679
913         <rdar://problem/35982116>
914
915         Reviewed by Alex Christensen.
916
917         This changes adds frameID and pageID to what is communicated for
918         storage access and also stored in the network process' table of
919         partitioning exceptions.
920
921         * NetworkProcess/NetworkDataTask.cpp:
922         (WebKit::NetworkDataTask::create):
923             Now stores frameID and pageID for the task for easy retrieval
924             in the HSTS checks.
925         * NetworkProcess/NetworkProcess.cpp:
926         (WebKit::NetworkProcess::updateStorageAccessForPrevalentDomains):
927         * NetworkProcess/NetworkProcess.h:
928         * NetworkProcess/NetworkProcess.messages.in:
929         * NetworkProcess/cocoa/NetworkDataTaskCocoa.h:
930         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
931         (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa):
932         (WebKit::NetworkDataTaskCocoa::willPerformHTTPRedirection):
933             These two methods now submit frameID and pageID to the
934             partitioning query call.
935         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
936         (-[WKNetworkSessionDelegate URLSession:task:willPerformHTTPRedirection:newRequest:completionHandler:]):
937         (-[WKNetworkSessionDelegate URLSession:task:_schemeUpgraded:completionHandler:]):
938             These two methods now submit frameID and pageID to the
939             partitioning query call.
940         * UIProcess/Network/NetworkProcessProxy.cpp:
941         (WebKit::NetworkProcessProxy::updateStorageAccessForPrevalentDomains):
942         * UIProcess/Network/NetworkProcessProxy.h:
943         * UIProcess/WebPageProxy.cpp:
944         (WebKit::WebPageProxy::requestStorageAccess):
945         * UIProcess/WebPageProxy.h:
946         * UIProcess/WebPageProxy.messages.in:
947         * UIProcess/WebResourceLoadStatisticsStore.cpp:
948         (WebKit::WebResourceLoadStatisticsStore::requestStorageAccess):
949         * UIProcess/WebResourceLoadStatisticsStore.h:
950         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
951         (WebKit::WebsiteDataStore::updateStorageAccessForPrevalentDomainsHandler):
952         (WebKit::WebsiteDataStore::enableResourceLoadStatisticsAndSetTestingCallback):
953         (WebKit::WebsiteDataStore::requestStorageAccess):
954         * UIProcess/WebsiteData/WebsiteDataStore.h:
955         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
956         (WebKit::WebChromeClient::requestStorageAccess):
957         * WebProcess/WebCoreSupport/WebChromeClient.h:
958         * WebProcess/WebPage/WebPage.cpp:
959         (WebKit::WebPage::requestStorageAccess):
960         * WebProcess/WebPage/WebPage.h:
961
962 2017-12-12  Alex Christensen  <achristensen@webkit.org>
963
964         Modernize WebsiteDataStoreParameters and SandboxExtension::Handle decoding
965         https://bugs.webkit.org/show_bug.cgi?id=180621
966
967         Reviewed by Youenn Fablet.
968
969         * NetworkProcess/NetworkProcessCreationParameters.cpp:
970         (WebKit::NetworkProcessCreationParameters::decode):
971         * NetworkProcess/NetworkResourceLoadParameters.cpp:
972         (WebKit::NetworkResourceLoadParameters::decode):
973         * Shared/LoadParameters.cpp:
974         (WebKit::LoadParameters::decode):
975         * Shared/SandboxExtension.h:
976         (WebKit::decode):
977         (WebKit::SandboxExtension::Handle::decode): Deleted.
978         * Shared/Storage/StorageProcessCreationParameters.cpp:
979         (WebKit::StorageProcessCreationParameters::decode):
980         * Shared/WebProcessCreationParameters.cpp:
981         (WebKit::WebProcessCreationParameters::decode):
982         * Shared/WebsiteDataStoreParameters.cpp:
983         (WebKit::WebsiteDataStoreParameters::decode):
984         * Shared/WebsiteDataStoreParameters.h:
985         * Shared/mac/SandboxExtensionMac.mm:
986         (WebKit::SandboxExtension::Handle::decode):
987         (WebKit::SandboxExtension::HandleArray::HandleArray):
988         (WebKit::SandboxExtension::HandleArray::encode const):
989         (WebKit::SandboxExtension::HandleArray::decode):
990         (WebKit::SandboxExtension::SandboxExtension):
991
992 2017-12-12  John Wilander  <wilander@apple.com>
993
994         Dispatch resource load statistics telemetry on the main thread
995         https://bugs.webkit.org/show_bug.cgi?id=180602
996         <rdar://problem/35942205>
997
998         Reviewed by Brent Fulgham.
999
1000         * UIProcess/WebResourceLoadStatisticsTelemetry.cpp:
1001         (WebKit::WebResourceLoadStatisticsTelemetry::calculateAndSubmit):
1002             Now switches to the main thread for the telemetry submission
1003             through a webpage proxy. The reason is that the webpage we
1004             use may go away while we're still using it. This kind of
1005             telemetry isn't associated with a specific webpage but the
1006             infrastructure requires a webpage proxy.
1007
1008 2017-12-12  Myles C. Maxfield  <mmaxfield@apple.com>
1009
1010         IPC code doesn't understand NSDictionaries with non-NSString keys
1011         https://bugs.webkit.org/show_bug.cgi?id=180307
1012         <rdar://problem/35812382>
1013
1014         Reviewed by Alex Christensen.
1015
1016         Variable fonts have a dictionary inside its descriptor which represents the values
1017         of all the axes of the variable font. Our IPC code wasn't expecting this.
1018
1019         * Shared/mac/ArgumentCodersMac.mm:
1020         (IPC::encode):
1021         (IPC::decode):
1022
1023 2017-12-12  Brent Fulgham  <bfulgham@apple.com>
1024
1025         Unreviewed build fix after r225763.
1026
1027         Remove dangling close-parentheses character.
1028
1029         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
1030
1031 2017-12-12  Zach Li  <zachli@apple.com>
1032
1033         [WK2] Expose image via WKBundleHitTestResult API.
1034         https://bugs.webkit.org/show_bug.cgi?id=180552.
1035         rdar://problem/23951521
1036
1037         Reviewed by Simon Fraser.
1038
1039         * WebProcess/InjectedBundle/API/c/WKBundleHitTestResult.cpp:
1040         (WKBundleHitTestResultGetImage):
1041         * WebProcess/InjectedBundle/API/c/WKBundleHitTestResult.h:
1042
1043         * WebProcess/InjectedBundle/InjectedBundleHitTestResult.cpp:
1044         (WebKit::InjectedBundleHitTestResult::image const):
1045         Convert from WebCore::Image to WebImage by creating a WebImage
1046         and paint the WebCore::Image into its graphics context. For now,
1047         only handle bitmap images.
1048         * WebProcess/InjectedBundle/InjectedBundleHitTestResult.h:
1049
1050 2017-12-12  Simon Fraser  <simon.fraser@apple.com>
1051
1052         Remove ColorSpaceDeviceRGB and most users of the obsolete deviceRGB colorspace
1053         https://bugs.webkit.org/show_bug.cgi?id=180689
1054
1055         Reviewed by Tim Horton.
1056
1057         Remove encoding of ColorSpaceDeviceRGB.
1058
1059         * Shared/WebCoreArgumentCoders.h:
1060
1061 2017-12-12  Brent Fulgham  <bfulgham@apple.com>
1062
1063         REGRESSION(r216941): Plugin Process can't access AppStore Plugin Service
1064         https://bugs.webkit.org/show_bug.cgi?id=180701
1065         <rdar://problem/35940948>
1066
1067         Reviewed by Daniel Bates.
1068
1069         The PluginProcess needs access to the AppStore Plugin XPC service.
1070
1071         * PluginProcess/mac/com.apple.WebKit.plugin-common.sb.in:
1072
1073 2017-12-12  Brady Eidson  <beidson@apple.com>
1074
1075         Make ServiceWorkers follow the DEFAULT_EXPERIMENTAL_FEATURES_ENABLED flag on Mac.
1076         <rdar://problem/35978311> and https://bugs.webkit.org/show_bug.cgi?id=180697
1077
1078         Reviewed by Chris Dumez.
1079
1080         * Shared/WebPreferences.yaml:
1081         * Shared/WebPreferencesDefaultValues.h:
1082
1083 2017-12-12  Chris Dumez  <cdumez@apple.com>
1084
1085         Simplify IPC code between WebProcess and StorageProcess for serviceWorker.postMessage()
1086         https://bugs.webkit.org/show_bug.cgi?id=180683
1087
1088         Reviewed by Brady Eidson.
1089
1090         Merge the 2 code paths from calling postMessage() from a ServiceWorkerClient and from
1091         a ServiceWorker. Also, postMessage() now only IPCs an identifier from the WebContent
1092         process to the StorageProcess. The ServiceWorkerClientData is looked up on Storage
1093         process side from the identifier before being sent to the context process.
1094
1095         * Scripts/webkit/messages.py:
1096         (forward_declarations_and_headers):
1097         (headers_for_type):
1098         * Shared/WebCoreArgumentCoders.cpp:
1099         (IPC::ArgumentCoder<ServiceWorkerOrClientIdentifier>::encode):
1100         (IPC::ArgumentCoder<ServiceWorkerOrClientIdentifier>::decode):
1101         * Shared/WebCoreArgumentCoders.h:
1102         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
1103         (WebKit::WebSWServerConnection::postMessageToServiceWorker):
1104         * StorageProcess/ServiceWorker/WebSWServerConnection.h:
1105         * StorageProcess/ServiceWorker/WebSWServerConnection.messages.in:
1106         * WebProcess/Storage/WebSWClientConnection.cpp:
1107         (WebKit::WebSWClientConnection::postMessageToServiceWorker):
1108         * WebProcess/Storage/WebSWClientConnection.h:
1109
1110 2017-12-12  Yusuke Suzuki  <utatane.tea@gmail.com>
1111
1112         [WTF] Thread::create should have Thread::tryCreate
1113         https://bugs.webkit.org/show_bug.cgi?id=180333
1114
1115         Reviewed by Darin Adler.
1116
1117         * UIProcess/API/glib/IconDatabase.cpp:
1118         (WebKit::IconDatabase::open):
1119         * UIProcess/linux/MemoryPressureMonitor.cpp:
1120         (WebKit::MemoryPressureMonitor::MemoryPressureMonitor):
1121
1122 2017-12-11  Zan Dobersek  <zdobersek@igalia.com>
1123
1124         [CoordGraphics] Move UpdateAtlas, AreaAllocator into the platform layer
1125         https://bugs.webkit.org/show_bug.cgi?id=180641
1126
1127         Reviewed by Michael Catanzaro.
1128
1129         Move the UpdateAtlas and AreaAllocator classes into the platform layer,
1130         moving over build targets and adjust UpdateAtlas class references in
1131         CompositingCoordinator.
1132
1133         * PlatformGTK.cmake:
1134         * PlatformWPE.cmake:
1135         * PlatformWin.cmake:
1136         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.h:
1137
1138 2017-12-11  Alex Christensen  <achristensen@webkit.org>
1139
1140         Add a WKPageGroupRef setter in WKWebViewConfiguration
1141         https://bugs.webkit.org/show_bug.cgi?id=180674
1142         <rdar://problem/35920392>
1143
1144         Reviewed by Brady Eidson.
1145
1146         There is a Mac app trying to transition to WKWebView, and it uses WKPageGroupRef extensively.
1147         To help it transition, we are temporarily giving it an ObjC way to use this organization for
1148         its UserContentControllers to be united per PageGroup before it transitions away from SPIs like
1149         WKBundleAddUserScript.  Make it Mac-only to indicate that this should be transitioned away from,
1150         rather than adopted on iOS.
1151         
1152         No change in behavior for apps not using the new WKWebViewConfiguration._pageGroup SPI.
1153
1154         * UIProcess/API/Cocoa/WKWebView.mm:
1155         (-[WKWebView _initializeWithConfiguration:]):
1156         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
1157         (-[WKWebViewConfiguration copyWithZone:]):
1158         (-[WKWebViewConfiguration _pageGroup]):
1159         (-[WKWebViewConfiguration _setPageGroup:]):
1160         * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
1161
1162 2017-12-11  Brent Fulgham  <bfulgham@apple.com>
1163
1164         [iOS] Remove unused services from WebContent Process sandbox
1165         https://bugs.webkit.org/show_bug.cgi?id=180670
1166
1167         Reviewed by Eric Carlson.
1168
1169         Pare down the set of sandbox exceptions in the iOS WebContent process sandbox to just
1170         those services actually in use:
1171         1. Remove unused code.
1172         2. Instead of defining a 'UIKit-app' function and calling it, just declare the individual sandbox
1173         commands inline. This will allow them to be more easily consolidated with other parts of the
1174         sandbox in a future step.
1175
1176         This update should not change behavior.
1177
1178         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
1179
1180 2017-12-11  Chris Dumez  <cdumez@apple.com>
1181
1182         Merge ServiceWorkerClientIdentifier into ServiceWorkerClientData
1183         https://bugs.webkit.org/show_bug.cgi?id=180669
1184
1185         Reviewed by Youenn Fablet.
1186
1187         Merge ServiceWorkerClientIdentifier into ServiceWorkerClientData, for consistency with
1188         ServiceWorkerIdentifier / ServiceWorkerData, and start simplifying the postMessage() code.
1189
1190         * Scripts/webkit/messages.py:
1191         (forward_declarations_and_headers):
1192         (headers_for_type):
1193         * Shared/WebCoreArgumentCoders.cpp:
1194         (IPC::ArgumentCoder<ServiceWorkerOrClientData>::encode):
1195         (IPC::ArgumentCoder<ServiceWorkerOrClientData>::decode):
1196         * Shared/WebCoreArgumentCoders.h:
1197         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
1198         (WebKit::WebSWServerConnection::~WebSWServerConnection):
1199         (WebKit::WebSWServerConnection::postMessageToServiceWorkerFromClient):
1200         (WebKit::WebSWServerConnection::postMessageToServiceWorkerFromServiceWorker):
1201         (WebKit::WebSWServerConnection::registerServiceWorkerClient):
1202         (WebKit::WebSWServerConnection::unregisterServiceWorkerClient):
1203         * StorageProcess/ServiceWorker/WebSWServerConnection.h:
1204         * StorageProcess/ServiceWorker/WebSWServerConnection.messages.in:
1205         * StorageProcess/ServiceWorker/WebSWServerToContextConnection.cpp:
1206         (WebKit::WebSWServerToContextConnection::matchAllCompleted):
1207         * StorageProcess/ServiceWorker/WebSWServerToContextConnection.h:
1208         * WebProcess/Storage/WebSWClientConnection.cpp:
1209         (WebKit::WebSWClientConnection::registerServiceWorkerClient):
1210         (WebKit::WebSWClientConnection::unregisterServiceWorkerClient):
1211         * WebProcess/Storage/WebSWClientConnection.h:
1212         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
1213         (WebKit::WebSWContextManagerConnection::postMessageToServiceWorker):
1214         (WebKit::WebSWContextManagerConnection::matchAllCompleted):
1215         * WebProcess/Storage/WebSWContextManagerConnection.h:
1216         * WebProcess/Storage/WebSWContextManagerConnection.messages.in:
1217
1218 2017-12-11  Youenn Fablet  <youenn@apple.com>
1219
1220         RTCPacketOptions::packet_id should be encoded as 32 bits integer.
1221         https://bugs.webkit.org/show_bug.cgi?id=180654
1222
1223         Reviewed by Eric Carlson.
1224
1225         packet_id is a 16 bit unsigned integer, but it can also take -1 if its value is not set.
1226         Before the patch, it was IPC encoded as a 16 bit signed integer which is not large enough.
1227
1228         * Shared/RTCPacketOptions.cpp:
1229         (WebKit::RTCPacketOptions::encode const):
1230         (WebKit::RTCPacketOptions::decode):
1231
1232 2017-12-11  Chris Dumez  <cdumez@apple.com>
1233
1234         Layout Test http/tests/workers/service/postmessage-after-sw-process-crash.https.html is flaky
1235         https://bugs.webkit.org/show_bug.cgi?id=180659
1236
1237         Reviewed by Youenn Fablet.
1238
1239         Fix flaky crash due to capturing an IPC::DataReference in a lambda, which would point to invalid
1240         memory when the lambda is called asynchronously.
1241
1242         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
1243         (WebKit::WebSWServerConnection::postMessageToServiceWorkerFromClient):
1244         (WebKit::WebSWServerConnection::postMessageToServiceWorkerFromServiceWorker):
1245
1246 2017-12-11  Brent Fulgham  <bfulgham@apple.com>
1247
1248         [iOS] Don't import 'UIKit-apps.sb' to the WebContent process sandbox
1249         https://bugs.webkit.org/show_bug.cgi?id=180610
1250         <rdar://problem/18899506>
1251
1252         Reviewed by Dean Jackson.
1253
1254         Stop including 'system.sb', and just include the portions of that sandbox that we
1255         actually use in WebContent Process. This is the first step in some further sandbox
1256         tightening.
1257
1258         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
1259
1260 2017-12-11  Yusuke Suzuki  <utatane.tea@gmail.com>
1261
1262         [WTF] Add Converter traits to StringHasher instead of function pointer
1263         https://bugs.webkit.org/show_bug.cgi?id=180656
1264
1265         Reviewed by JF Bastien.
1266
1267         * WebProcess/WebProcess.cpp:
1268         (WebKit::addCaseFoldedCharacters):
1269
1270 2017-12-11  David Quesada  <david_quesada@apple.com>
1271
1272         Turn on ENABLE_APPLICATION_MANIFEST
1273         https://bugs.webkit.org/show_bug.cgi?id=180562
1274         rdar://problem/35924737
1275
1276         Reviewed by Geoffrey Garen.
1277
1278         * Configurations/FeatureDefines.xcconfig:
1279
1280 2017-12-11  Dean Jackson  <dino@apple.com>
1281
1282         Add a runtime feature flag for ImageBitmap and OffscreenCanvas
1283         https://bugs.webkit.org/show_bug.cgi?id=180652
1284         <rdar://problem/35969611>
1285
1286         Reviewed by Antoine Quint.
1287
1288         Add an experimental feature flag for these interfaces.
1289
1290         * Shared/WebPreferences.yaml:
1291
1292 2017-12-10  Stephan Szabo  <stephan.szabo@sony.com>
1293
1294         APIClient.h uses things from <tuple> without including it explicitly
1295         https://bugs.webkit.org/show_bug.cgi?id=180609
1296
1297         Reviewed by Darin Adler.
1298
1299         * Shared/API/APIClient.h:
1300
1301 2017-12-08  Youenn Fablet  <youenn@apple.com>
1302
1303         Service Worker should use a correct user agent
1304         https://bugs.webkit.org/show_bug.cgi?id=180566
1305         <rdar://problem/35926295>
1306
1307         Reviewed by Chris Dumez.
1308
1309         Addendum to landed patch.
1310         This change was removed from the last version of the patch but proves to be needed by Safari.
1311
1312         * UIProcess/WebProcessPool.cpp:
1313         (WebKit::WebProcessPool::establishWorkerContextConnectionToStorageProcess):
1314         Added back setting the user agent at start of service worker in case a page is already created.
1315
1316 2017-12-08  Brady Eidson  <beidson@apple.com>
1317
1318         Delay some service worker operations until after the database import completes.
1319         https://bugs.webkit.org/show_bug.cgi?id=180573
1320
1321         Reviewed by Chris Dumez.
1322
1323         * StorageProcess/ServiceWorker/WebSWOriginStore.cpp:
1324         (WebKit::WebSWOriginStore::importComplete): Tell the Origin Table on all connects that
1325           the import is complete.
1326         (WebKit::WebSWOriginStore::registerSWServerConnection):
1327         * StorageProcess/ServiceWorker/WebSWOriginStore.h:
1328
1329         * WebProcess/Storage/WebSWClientConnection.cpp:
1330         (WebKit::WebSWClientConnection::mayHaveServiceWorkerRegisteredForOrigin const):
1331         (WebKit::WebSWClientConnection::setSWOriginTableIsImported): Run deferred tasks!
1332         (WebKit::WebSWClientConnection::matchRegistration): If the import isn't complete yet, delay
1333           the match registration task until later.
1334         (WebKit::WebSWClientConnection::runOrDelayTask): Either send the message now or save off
1335           the task to wait until the import is complete.
1336         (WebKit::WebSWClientConnection::getRegistrations): If the import isn't complete yet, delay
1337           the get registrations task until later.
1338         (WebKit::WebSWClientConnection::initializeSWOriginTableAsEmpty): Deleted.
1339         * WebProcess/Storage/WebSWClientConnection.h:
1340         * WebProcess/Storage/WebSWClientConnection.messages.in:
1341
1342         * WebProcess/Storage/WebSWOriginTable.cpp:
1343         (WebKit::WebSWOriginTable::setSharedMemory):
1344         * WebProcess/Storage/WebSWOriginTable.h:
1345         (WebKit::WebSWOriginTable::isImported const):
1346         (WebKit::WebSWOriginTable::setIsImported):
1347         (WebKit::WebSWOriginTable::isInitialized const): Deleted.
1348         (WebKit::WebSWOriginTable::initializeAsEmpty): Deleted.
1349
1350 2017-12-08  Youenn Fablet  <youenn@apple.com>
1351
1352         Service Worker should use a correct user agent
1353         https://bugs.webkit.org/show_bug.cgi?id=180566
1354         <rdar://problem/35926295>
1355
1356         Reviewed by Chris Dumez.
1357
1358         Add support to set service worker user agent from UIProcess to service worker process.
1359         One user agent is currently supported per service worker process and it can be changed at any given time.
1360         Only new service worker will use the new value.
1361         Once a service worker is launched, it will stay with the same user agent value.
1362
1363         This sets both navigator.userAgent and User-Agent header name used for fetch within a service worker.
1364         Compute the service worker process user agent by picking the last user agent set for a web page.
1365
1366         * UIProcess/ServiceWorkerProcessProxy.cpp:
1367         (WebKit::ServiceWorkerProcessProxy::start):
1368         (WebKit::ServiceWorkerProcessProxy::setUserAgent):
1369         * UIProcess/ServiceWorkerProcessProxy.h:
1370         * UIProcess/WebPageProxy.cpp:
1371         (WebKit::WebPageProxy::setApplicationNameForUserAgent):
1372         * UIProcess/WebProcessPool.cpp:
1373         (WebKit::WebProcessPool::establishWorkerContextConnectionToStorageProcess):
1374         (WebKit::WebProcessPool::createWebPage):
1375         (WebKit::WebProcessPool::updateServiceWorkerUserAgent):
1376         * UIProcess/WebProcessPool.h:
1377         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
1378         (WebKit::WebSWContextManagerConnection::installServiceWorker):
1379         (WebKit::WebSWContextManagerConnection::setUserAgent):
1380         (WebKit::WebSWContextManagerConnection::removeFrameLoaderClient):
1381         * WebProcess/Storage/WebSWContextManagerConnection.h:
1382         * WebProcess/Storage/WebSWContextManagerConnection.messages.in:
1383
1384 2017-12-07  Simon Fraser  <simon.fraser@apple.com>
1385
1386         Wrong caret position for input field inside a fixed position parent on iOS 11
1387         https://bugs.webkit.org/show_bug.cgi?id=176896
1388         rdar://problem/33726145
1389
1390         Reviewed by Tim Horton.
1391
1392         In r219668 I added code to compute a layout viewport rect in the web process, so that
1393         after programmatic scrolling, getBoundingClientRect() would return the correct values.
1394         However, that computation sometimes used a different visual viewport than the UI process,
1395         resulting in a different layout viewport being set. This would happen when the keyboard
1396         was visible, and the combination of this and zooming when focusing an input would result
1397         in a state where the scrolling tree contained notes computed with the bad layout viewport.
1398         This could cause apparently offset fixed elements, and bad caret positioning if those fixed
1399         elements contained the focused input.
1400
1401         Fix by passing to the web process the same visual viewport rect that the UI process is using,
1402         namely "unobscuredContentRectRespectingInputViewBounds". This was already being set in
1403         VisibleContentRectUpdateInfo but wasn't encoded/decoded, so fix that. Set it as an optional<>
1404         on FrameView when different from the normal visual viewport, and return it from
1405         visualViewportRect().
1406
1407         Some other minor logging changes.
1408
1409         * Shared/VisibleContentRectUpdateInfo.cpp:
1410         (WebKit::VisibleContentRectUpdateInfo::encode const):
1411         (WebKit::VisibleContentRectUpdateInfo::decode):
1412         (WebKit::operator<<):
1413         * Shared/VisibleContentRectUpdateInfo.h:
1414         (WebKit::VisibleContentRectUpdateInfo::VisibleContentRectUpdateInfo):
1415         * WebProcess/WebPage/ios/WebPageIOS.mm:
1416         (WebKit::WebPage::updateVisibleContentRects):
1417
1418 2017-12-06  Simon Fraser  <simon.fraser@apple.com>
1419
1420         When the iPhone keyboard is up, sometimes we never commit a stable update and re-show the caret
1421         https://bugs.webkit.org/show_bug.cgi?id=180498
1422
1423         Reviewed by Tim Horton.
1424
1425         When the keyboard is showing, we would think that the page was in a rubber-banding state
1426         because contentOffsetBoundedInValidRange() would always clamp the content offset to a different
1427         value.
1428
1429         This happened because scrollView.contentInset don't change when the keyboard is showing,
1430         but UIKit actually consults scrollView.adjustedContentInset, which does. If we use
1431         scrollView.adjustedContentInset in this computation, we'll get a correct answer.
1432
1433         Also rewrote the clamping logic to be more similar to what UIKit does internally when computing
1434         min/max content offset.
1435
1436         * UIProcess/API/Cocoa/WKWebView.mm:
1437         (contentOffsetBoundedInValidRange):
1438
1439 2017-12-08  Chris Dumez  <cdumez@apple.com>
1440
1441         Clearing all Website Data should remove service worker registrations on disk
1442         https://bugs.webkit.org/show_bug.cgi?id=180558
1443
1444         Reviewed by Youenn Fablet.
1445
1446         * StorageProcess/StorageProcess.cpp:
1447         (WebKit::StorageProcess::deleteWebsiteData):
1448         (WebKit::StorageProcess::deleteWebsiteDataForOrigins):
1449
1450 2017-12-08  Youenn Fablet  <youenn@apple.com>
1451
1452         WebServiceWorkerProvider should use Cancellation error to notify DTL that it cannot handle a fetch
1453         https://bugs.webkit.org/show_bug.cgi?id=180584
1454
1455         Reviewed by Alex Christensen.
1456
1457         * WebProcess/Network/WebLoaderStrategy.cpp:
1458         (WebKit::WebLoaderStrategy::scheduleLoad):
1459
1460 2017-12-08  Youenn Fablet  <youenn@apple.com>
1461
1462         Service Worker should use a correct SessionID
1463         https://bugs.webkit.org/show_bug.cgi?id=180585
1464
1465         Reviewed by Alex Christensen.
1466
1467         Store SessionID in SWServer and send it as part of service worker instantiation.
1468         Use it when creating service worker thread in service worker process.
1469
1470         * StorageProcess/ServiceWorker/WebSWServerToContextConnection.cpp:
1471         (WebKit::WebSWServerToContextConnection::installServiceWorkerContext):
1472         * StorageProcess/ServiceWorker/WebSWServerToContextConnection.h:
1473         * StorageProcess/StorageProcess.cpp:
1474         (WebKit::StorageProcess::swServerForSession):
1475         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
1476         (WebKit::WebSWContextManagerConnection::installServiceWorker):
1477         * WebProcess/Storage/WebSWContextManagerConnection.h:
1478         * WebProcess/Storage/WebSWContextManagerConnection.messages.in:
1479
1480 2017-12-08  Youenn Fablet  <youenn@apple.com>
1481
1482         FetchResponse should keep unfiltered ResourceResponse so that it can be used in Service Worker
1483         https://bugs.webkit.org/show_bug.cgi?id=179641
1484         <rdar://problem/35923570>
1485
1486         Reviewed by Alex Christensen.
1487
1488         * WebProcess/Storage/ServiceWorkerClientFetch.cpp:
1489         (WebKit::ServiceWorkerClientFetch::didReceiveResponse): In case of opaque redirected response, handle it as a regular response.
1490
1491 2017-12-08  Alex Christensen  <achristensen@webkit.org>
1492
1493         Remove unused code in WebPageGroup
1494         https://bugs.webkit.org/show_bug.cgi?id=180604
1495
1496         Reviewed by Youenn Fablet.
1497
1498         * UIProcess/WebPageGroup.cpp:
1499         (WebKit::WebPageGroup::userContentController):
1500         (WebKit::WebPageGroup::createNonNull): Deleted.
1501         (WebKit::WebPageGroup::preferencesDidChange): Deleted.
1502         * UIProcess/WebPageGroup.h:
1503         * UIProcess/WebProcessPool.cpp:
1504         (WebKit::WebProcessPool::WebProcessPool):
1505
1506 2017-12-08  Alex Christensen  <achristensen@webkit.org>
1507
1508         Modernize APIWebsiteDataStore.h and WebProcessPool.h
1509         https://bugs.webkit.org/show_bug.cgi?id=180588
1510
1511         Reviewed by Chris Dumez.
1512
1513         pragma once, Ref instead of RefPtr, initializer list in header instead of literals in constructor.
1514
1515         * UIProcess/API/APIWebsiteDataStore.h:
1516         * UIProcess/WebProcessPool.cpp:
1517         (WebKit::WebProcessPool::WebProcessPool):
1518         * UIProcess/WebProcessPool.h:
1519
1520 2017-12-08  Yusuke Suzuki  <utatane.tea@gmail.com>
1521
1522         Remove pthread_once in favor of dispatch_once
1523         https://bugs.webkit.org/show_bug.cgi?id=180591
1524
1525         Reviewed by Saam Barati.
1526
1527         * PluginProcess/mac/PluginProcessMac.mm:
1528         (WebKit::shouldCallRealDebugger):
1529         (WebKit::initShouldCallRealDebugger): Deleted.
1530
1531 2017-12-08  Chris Dumez  <cdumez@apple.com>
1532
1533         ProcessPoolConfiguration::copy() fails to copy the service worker path
1534         https://bugs.webkit.org/show_bug.cgi?id=180595
1535
1536         Reviewed by Brady Eidson.
1537
1538         * UIProcess/API/APIProcessPoolConfiguration.cpp:
1539         (API::ProcessPoolConfiguration::copy):
1540
1541 2017-12-08  Chris Dumez  <cdumez@apple.com>
1542
1543         Different WebKitTestRunner instances should use different service worker registrations databases
1544         https://bugs.webkit.org/show_bug.cgi?id=180589
1545
1546         Reviewed by Brady Eidson.
1547
1548         * UIProcess/API/C/WKContextConfigurationRef.cpp:
1549         (WKContextConfigurationCopyServiceWorkerDatabaseDirectory):
1550         (WKContextConfigurationSetServiceWorkerDatabaseDirectory):
1551         * UIProcess/API/C/WKContextConfigurationRef.h:
1552
1553 2017-12-08  Alex Christensen  <achristensen@webkit.org>
1554
1555         Pass std::optional<WebsitePolicies> instead of WebsitePolicies
1556         https://bugs.webkit.org/show_bug.cgi?id=180563
1557
1558         Reviewed by Andy Estes.
1559
1560         WebsitePolicies are only passed along when a decidePolicyForNavigationAction SPI completion handler
1561         is called with a valid _WKWebsitePolicies object.  In other cases, we don't have one.  Rather than
1562         making WebsitePolicies have a default value for everything that won't change policies, pass
1563         a std::optional<WebsitePolicies> which indicates better when we don't have new policies.
1564
1565         No change in behavior, but this will enable me to add things to WebsitePolicies that have no default value.
1566
1567         * Shared/WebsitePolicies.h:
1568         Make WebsitePolicies a class with public members because the IPC code generators don't understand std::optional<struct type>
1569         * UIProcess/API/C/WKAPICast.h:
1570         * UIProcess/Cocoa/NavigationState.mm:
1571         (WebKit::tryAppLink):
1572         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
1573         * UIProcess/WebFrameListenerProxy.cpp:
1574         (WebKit::WebFrameListenerProxy::receivedPolicyDecision):
1575         * UIProcess/WebFrameListenerProxy.h:
1576         * UIProcess/WebFramePolicyListenerProxy.cpp:
1577         (WebKit::WebFramePolicyListenerProxy::use):
1578         * UIProcess/WebFramePolicyListenerProxy.h:
1579         * UIProcess/WebFrameProxy.cpp:
1580         (WebKit::WebFrameProxy::receivedPolicyDecision):
1581         * UIProcess/WebFrameProxy.h:
1582         * UIProcess/WebPageProxy.cpp:
1583         (WebKit::WebPageProxy::receivedPolicyDecision):
1584         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
1585         * UIProcess/WebPageProxy.h:
1586         * UIProcess/WebPageProxy.messages.in:
1587         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1588         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
1589         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
1590         * WebProcess/WebPage/WebFrame.cpp:
1591         (WebKit::WebFrame::didReceivePolicyDecision):
1592         * WebProcess/WebPage/WebFrame.h:
1593         * WebProcess/WebPage/WebPage.cpp:
1594         (WebKit::WebPage::didReceivePolicyDecision):
1595         * WebProcess/WebPage/WebPage.h:
1596         * WebProcess/WebPage/WebPage.messages.in:
1597
1598 2017-12-08  Yusuke Suzuki  <utatane.tea@gmail.com>
1599
1600         [WTF] Remove remaining use of Mutex
1601         https://bugs.webkit.org/show_bug.cgi?id=180579
1602
1603         Reviewed by Alex Christensen.
1604
1605         Remove unused "BinarySemaphore.h".
1606
1607         * Platform/IPC/win/ConnectionWin.cpp:
1608
1609 2017-12-08  Michael Catanzaro  <mcatanzaro@igalia.com>
1610
1611         [GTK] WebInspectorProxyClient needs a virtual destructor
1612         https://bugs.webkit.org/show_bug.cgi?id=180533
1613
1614         Reviewed by Carlos Garcia Campos.
1615
1616         Otherwise the derived class portion of the object, WebKitInspectorClient, is not destroyed.
1617
1618         * UIProcess/gtk/WebInspectorProxyClient.h:
1619
1620 2017-12-07  Yousuke Kimoto  <yousuke.kimoto@sony.com>
1621
1622         [WinCairo] Fix ResourceError handling in ArgumentCoder for wincairo webkit
1623         https://bugs.webkit.org/show_bug.cgi?id=180483
1624
1625         Reviewed by Alex Christensen.
1626
1627         * Shared/curl/WebCoreArgumentCodersCurl.cpp:
1628         (IPC::ArgumentCoder<ResourceError>::encodePlatformData):
1629         (IPC::ArgumentCoder<ResourceError>::decodePlatformData):
1630
1631 2017-12-07  Youenn Fablet  <youenn@apple.com>
1632
1633         StartFetch should take a ServiceWorkerIdentifier
1634         https://bugs.webkit.org/show_bug.cgi?id=180478
1635
1636         Reviewed by Brady Eidson.
1637
1638         Before the patch, StartFetch was taking an optional ServiceWorkerIdentifier.
1639         Now that every navigation fetch is querying its matching registration, it can no longer be optional.
1640
1641         In the case there is a problem in running the service worker at start fetch time,
1642         answer to the WebProcess to go to network so that the request does not get stalled.
1643
1644         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
1645         (WebKit::WebSWServerConnection::startFetch):
1646         * StorageProcess/ServiceWorker/WebSWServerConnection.h:
1647         * StorageProcess/ServiceWorker/WebSWServerConnection.messages.in:
1648         * WebProcess/Storage/WebSWClientConnection.cpp:
1649         (WebKit::WebSWClientConnection::startFetch):
1650         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
1651         (WebKit::WebSWContextManagerConnection::startFetch):
1652         * WebProcess/Storage/WebSWContextManagerConnection.h:
1653         * WebProcess/Storage/WebSWContextManagerConnection.messages.in:
1654
1655 2017-12-07  Saam Barati  <sbarati@apple.com>
1656
1657         We need to grab the JSLock in InjectedBundle::createWebDataFromUint8Array
1658         https://bugs.webkit.org/show_bug.cgi?id=180492
1659
1660         Reviewed by Alex Christensen.
1661
1662         InjectedBundle::createWebDataFromUint8Array calls into WebCore APIs that allocate
1663         out of the JS heap. It's only legal to allocate out of the JS heap when holding the JS lock.
1664
1665         * WebProcess/InjectedBundle/InjectedBundle.cpp:
1666         (WebKit::InjectedBundle::createWebDataFromUint8Array):
1667
1668 2017-12-07  Simon Fraser  <simon.fraser@apple.com>
1669
1670         Propagate WebKit2Logging channels to the Web Process
1671         https://bugs.webkit.org/show_bug.cgi?id=180517
1672
1673         Reviewed by Tim Horton.
1674
1675         If you set WebKit2Logging, you want those channels active in both the UI process and
1676         the web process, but without tricky 'defaults' gyrations, setting them in the web process
1677         was hard.
1678
1679         Instead, send them through to the process via WebProcessCreationParameters, as we do
1680         for WebCoreLogging channels.
1681
1682         * Platform/LogInitialization.h:
1683         * Platform/Logging.cpp:
1684         (WebKit::initializeLogChannelsIfNecessary):
1685         * Shared/WebProcessCreationParameters.cpp:
1686         (WebKit::WebProcessCreationParameters::encode const):
1687         (WebKit::WebProcessCreationParameters::decode):
1688         * Shared/WebProcessCreationParameters.h:
1689         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
1690         (WebKit::WebProcessPool::platformInitializeWebProcess):
1691         * WebProcess/cocoa/WebProcessCocoa.mm:
1692         (WebKit::WebProcess::platformInitializeWebProcess):
1693
1694 2017-12-07  Simon Fraser  <simon.fraser@apple.com>
1695
1696         Add logging for EditorState in RemoteLayerTree transactions
1697         https://bugs.webkit.org/show_bug.cgi?id=180515
1698
1699         Reviewed by Wenson Hsieh.
1700        
1701         Make EditorState TextStream-able, and dump it in layer tree transactions.
1702
1703         * Shared/EditorState.cpp:
1704         (WebKit::operator<<):
1705         * Shared/EditorState.h:
1706         * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm:
1707         (WebKit::RemoteLayerTreeTransaction::description const):
1708
1709 2017-12-07  Youenn Fablet  <youenn@apple.com>
1710
1711         CacheStorage Cache should not remove any disk entry when clearing its memory representation
1712         https://bugs.webkit.org/show_bug.cgi?id=180546
1713
1714         Reviewed by Brady Eidson.
1715
1716         * NetworkProcess/cache/CacheStorageEngineCache.cpp:
1717         (WebKit::CacheStorage::Cache::clearMemoryRepresentation):
1718
1719 2017-12-07  Myles C. Maxfield  <mmaxfield@apple.com>
1720
1721         [Cocoa] Add SPI to disallow user-installed fonts
1722         https://bugs.webkit.org/show_bug.cgi?id=180062
1723         <rdar://problem/35042408>
1724
1725         Reviewed by Simon Fraser.
1726
1727         * Shared/WebPreferences.yaml:
1728         * UIProcess/API/C/WKPreferences.cpp:
1729         (WKPreferencesSetShouldDisallowUserInstalledFonts):
1730         (WKPreferencesGetShouldDisallowUserInstalledFonts):
1731         * UIProcess/API/C/WKPreferencesRefPrivate.h:
1732         * UIProcess/API/Cocoa/WKPreferences.mm:
1733         (-[WKPreferences _shouldDisallowUserInstalledFonts]):
1734         (-[WKPreferences _setShouldDisallowUserInstalledFonts:]):
1735         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
1736
1737 2017-12-07  David Quesada  <david_quesada@apple.com>
1738
1739         [Web App Manifest] Support display-mode media feature
1740         https://bugs.webkit.org/show_bug.cgi?id=180376
1741         rdar://problem/35837993
1742
1743         Reviewed by Geoffrey Garen.
1744
1745         * UIProcess/API/Cocoa/_WKApplicationManifest.h:
1746         * UIProcess/API/Cocoa/_WKApplicationManifest.mm:
1747         (-[_WKApplicationManifest initWithCoder:]):
1748         (-[_WKApplicationManifest encodeWithCoder:]):
1749         (-[_WKApplicationManifest displayMode]):
1750
1751 2017-12-07  Chris Dumez  <cdumez@apple.com>
1752
1753         Unreviewed build fix after r225622.
1754
1755         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
1756         (WebKit::WebSWServerConnection::postMessageToServiceWorkerFromServiceWorker):
1757
1758 2017-12-06  Chris Dumez  <cdumez@apple.com>
1759
1760         We should be able to recover after a Service Worker process crash
1761         https://bugs.webkit.org/show_bug.cgi?id=180477
1762
1763         Reviewed by Brady Eidson and Youenn Fablet.
1764
1765         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
1766         (WebKit::WebSWServerConnection::startFetch):
1767         (WebKit::WebSWServerConnection::postMessageToServiceWorkerFromClient):
1768         (WebKit::WebSWServerConnection::postMessageToServiceWorkerFromServiceWorker):
1769         Update calls to SWServer::runServiceWorkerIfNecessary() that that it is asynchronous
1770         and takes in a lambda.
1771
1772         * StorageProcess/ServiceWorker/WebSWServerConnection.h:
1773         (WebKit::WebSWServerConnection::ipcConnection const):
1774         Add getter for the underlying IPC connection.
1775
1776         * StorageProcess/StorageProcess.cpp:
1777         (WebKit::StorageProcess::didClose):
1778         (WebKit::StorageProcess::connectionToContextProcessWasClosed):
1779         Move some code to connectionToContextProcessWasClosed() to avoid duplication.
1780         Also, relaunch the Service Worker process if it has exited but we still
1781         have SWServer connections to regular Web Processes.
1782
1783         (WebKit::StorageProcess::needsServerToContextConnection const):
1784         Utility function to determine if we still need the service worker process.
1785         The current rule is that we need the service worker (aka "context") process
1786         if we still have SWServer connections to regular Web Processes.
1787
1788         * StorageProcess/StorageProcess.h:
1789
1790         * StorageProcess/StorageToWebProcessConnection.cpp:
1791         (WebKit::StorageToWebProcessConnection::didClose):
1792         If didClose() is called for the connection to the service worker context,
1793         let the StorageProcess know so that it can clear its state and relaunch
1794         the process if necessary.
1795
1796         * UIProcess/API/C/WKContext.cpp:
1797         (WKContextTerminateServiceWorkerProcess):
1798         * UIProcess/API/C/WKContextPrivate.h:
1799         * UIProcess/API/Cocoa/WKProcessPool.mm:
1800         (-[WKProcessPool _terminateServiceWorkerProcess]):
1801         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
1802         Add SPI to terminate the service worker process.
1803
1804         * UIProcess/WebProcessPool.cpp:
1805         (WebKit::m_serviceWorkerProcessTerminationTimer):
1806         (WebKit::WebProcessPool::createNewWebProcess):
1807         (WebKit::WebProcessPool::disconnectProcess):
1808         (WebKit::WebProcessPool::terminateServiceWorkerProcess):
1809         * UIProcess/WebProcessPool.h:
1810         We used to shutdown the ServiceWorker process right away as soon as the last regular
1811         WebProcess was gone. We now give it a grace period of 5 seconds in case a new
1812         WebProcess gets launched shortly after.
1813
1814 2017-12-02  Darin Adler  <darin@apple.com>
1815
1816         Modernize some aspects of text codecs, eliminate WebKit use of strcasecmp
1817         https://bugs.webkit.org/show_bug.cgi?id=180009
1818
1819         Reviewed by Alex Christensen.
1820
1821         * WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp:
1822         (WebKit::initializeProtectionSpace): Use equalLettersIgnoringASCIICase instead
1823         of strcasecmp.
1824
1825 2017-12-06  David Quesada  <david_quesada@apple.com>
1826
1827         [Web App Manifest] Add SPI for applying a manifest to a top-level browsing context
1828         https://bugs.webkit.org/show_bug.cgi?id=180368
1829         rdar://problem/34748067
1830
1831         Reviewed by Geoffrey Garen.
1832
1833         Add a new property WKWebViewConfiguration._applicationManifest to specify manifest
1834         to apply to application contexts (aka. top-level browsing contexts, i.e. web views).
1835         The manifest is ultimately stored on the MainFrame of the Pages created from the
1836         web view configuration.
1837
1838         No new tests, no change in behavior.
1839
1840         * Shared/WebPageCreationParameters.cpp:
1841         (WebKit::WebPageCreationParameters::encode const):
1842         (WebKit::WebPageCreationParameters::decode):
1843         * Shared/WebPageCreationParameters.h:
1844         * UIProcess/API/APIPageConfiguration.cpp:
1845         (API::PageConfiguration::copy const):
1846         (API::PageConfiguration::applicationManifest const):
1847         (API::PageConfiguration::setApplicationManifest):
1848         * UIProcess/API/APIPageConfiguration.h:
1849         * UIProcess/API/Cocoa/WKWebView.mm:
1850         (-[WKWebView _initializeWithConfiguration:]):
1851         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
1852         (-[WKWebViewConfiguration copyWithZone:]):
1853         (-[WKWebViewConfiguration _applicationManifest]):
1854         (-[WKWebViewConfiguration _setApplicationManifest:]):
1855         * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
1856         * UIProcess/API/Cocoa/_WKApplicationManifestInternal.h:
1857         * UIProcess/WebPageProxy.cpp:
1858         (WebKit::WebPageProxy::creationParameters):
1859         * WebProcess/WebPage/WebPage.cpp:
1860         (WebKit::m_cpuLimit):
1861
1862 2017-12-06  Jeff Miller  <jeffm@apple.com>
1863
1864         -[WKWebViewConfiguration copyWithZone] doesn't copy _groupIdentifier
1865         https://bugs.webkit.org/show_bug.cgi?id=180504
1866
1867         Reviewed by Geoffrey Garen.
1868
1869         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
1870         (-[WKWebViewConfiguration copyWithZone:]):
1871         Copy _groupIdentifier.
1872
1873 2017-12-06  David Quesada  <david_quesada@apple.com>
1874
1875         [Web App Manifest] Add SPI for fetching the manifest
1876         https://bugs.webkit.org/show_bug.cgi?id=180294
1877         rdar://problem/34747968
1878
1879         Reviewed by Geoffrey Garen.
1880
1881         Add a new method -[WKWebView _getApplicationManifestWithCompletionHandler:] to request
1882         the manifest associated with the current page.
1883
1884         * Shared/API/APIObject.h:
1885         * Shared/Cocoa/APIObject.mm:
1886         (API::Object::newObject):
1887         * UIProcess/API/APIApplicationManifest.h: Copied from Source/WebCore/Modules/applicationmanifest/ApplicationManifest.h.
1888             Add a new API object type for application manifests.
1889         * UIProcess/API/C/WKPage.cpp:
1890         (WKPageGetApplicationManifest_b):
1891             Add a C version of this SPI for WebKitTestRunner.
1892         * UIProcess/API/C/WKPagePrivate.h:
1893         * UIProcess/API/Cocoa/WKWebView.mm:
1894         (-[WKWebView _getApplicationManifestWithCompletionHandler:]):
1895         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1896         * UIProcess/API/Cocoa/_WKApplicationManifest.h: Copied from Source/WebCore/Modules/applicationmanifest/ApplicationManifest.h.
1897         * UIProcess/API/Cocoa/_WKApplicationManifest.mm: Added.
1898         (-[_WKApplicationManifest initWithCoder:]):
1899         (-[_WKApplicationManifest encodeWithCoder:]):
1900         (+[_WKApplicationManifest applicationManifestFromJSON:manifestURL:documentURL:]):
1901         (-[_WKApplicationManifest _apiObject]):
1902         (nullableNSString):
1903         (-[_WKApplicationManifest name]):
1904         (-[_WKApplicationManifest shortName]):
1905         (-[_WKApplicationManifest applicationDescription]):
1906         (-[_WKApplicationManifest scope]):
1907         (-[_WKApplicationManifest startURL]):
1908         * UIProcess/API/Cocoa/_WKApplicationManifestInternal.h: Copied from Source/WebCore/Modules/applicationmanifest/ApplicationManifest.h.
1909         (API::wrapper):
1910         * UIProcess/WebPageProxy.cpp:
1911         (WebKit::WebPageProxy::applicationManifestCallback):
1912         (WebKit::WebPageProxy::getApplicationManifest):
1913         * UIProcess/WebPageProxy.h:
1914         * UIProcess/WebPageProxy.messages.in:
1915         * WebKit.xcodeproj/project.pbxproj:
1916         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1917         (WebKit::WebFrameLoaderClient::finishedLoadingApplicationManifest):
1918         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
1919         * WebProcess/WebPage/WebPage.cpp:
1920         (WebKit::WebPage::getApplicationManifest):
1921         (WebKit::WebPage::didFinishLoadingApplicationManifest):
1922         * WebProcess/WebPage/WebPage.h:
1923         * WebProcess/WebPage/WebPage.messages.in:
1924
1925 2017-12-06  Per Arne Vollan  <pvollan@apple.com>
1926
1927         The WebProcess should use the NSRunLoop runloop type.
1928         https://bugs.webkit.org/show_bug.cgi?id=179804
1929         <rdar://problem/14012823>
1930
1931         Reviewed by Brent Fulgham.
1932
1933         * Platform/IPC/mac/ConnectionMac.mm:
1934         (IPC::AccessibilityProcessSuspendedNotification):
1935         * Shared/ChildProcess.h:
1936         * Shared/mac/ChildProcessMac.mm:
1937         (WebKit::ChildProcess::launchServicesCheckIn):
1938         * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
1939         (WebKit::shouldLeakBoost):
1940         * WebProcess/EntryPoint/mac/XPCService/WebContentService/Info-OSX.plist:
1941         * WebProcess/WebProcess.cpp:
1942         (WebKit::WebProcess::initializeProcess):
1943
1944 2017-12-06  Nan Wang  <n_wang@apple.com>
1945
1946         AX: [iOS] Post accessibility notification when a web process changes its suspended state
1947         https://bugs.webkit.org/show_bug.cgi?id=180458
1948         <rdar://problem/35869115>
1949
1950         Reviewed by Chris Dumez.
1951
1952         Post accessibility notification with the pid information when a web process
1953         becomes suspended or resumes running.
1954
1955         * WebProcess/WebProcess.cpp:
1956         (WebKit::WebProcess::actualPrepareToSuspend):
1957         (WebKit::WebProcess::processDidResume):
1958         * WebProcess/WebProcess.h:
1959         * WebProcess/cocoa/WebProcessCocoa.mm:
1960         (WebKit::WebProcess::accessibilityProcessSuspendedNotification):
1961
1962 2017-12-06  Ryan Haddad  <ryanhaddad@apple.com>
1963
1964         Unreviewed build fix, removed unused lambda capture.
1965
1966         * NetworkProcess/cache/CacheStorageEngineConnection.cpp:
1967         (WebKit::CacheStorageEngineConnection::open):
1968
1969 2017-12-06  John Wilander  <wilander@apple.com>
1970
1971         Storage Access API: Make document.hasStorageAccess a function and always allow access for same-origin iframes
1972         https://bugs.webkit.org/show_bug.cgi?id=176944
1973         <rdar://problem/34440658>
1974
1975         Reviewed by Brent Fulgham.
1976
1977         This change introduces document.hasStorageAccess() as a function which
1978         returns a promise instead of being a property. Since cookie access can
1979         be due to both a granted request and recent user interaction as first
1980         party, the WebKit::WebResourceLoadStatisticsStore needs to be consulted.
1981
1982         * UIProcess/WebPageProxy.cpp:
1983         (WebKit::WebPageProxy::hasStorageAccess):
1984         * UIProcess/WebPageProxy.h:
1985         * UIProcess/WebPageProxy.messages.in:
1986         * UIProcess/WebResourceLoadStatisticsStore.cpp:
1987         (WebKit::WebResourceLoadStatisticsStore::hasStorageAccess):
1988         (WebKit::WebResourceLoadStatisticsStore::requestStorageAccess):
1989             Now adds an entry for granted access. A bug found through testing.
1990             Switched from WTF::Function to WTF::CompletionHandler.
1991         * UIProcess/WebResourceLoadStatisticsStore.h:
1992         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
1993         (WebKit::WebsiteDataStore::hasStorageAccess):
1994         (WebKit::WebsiteDataStore::requestStorageAccess):
1995             Switched from WTF::Function to WTF::CompletionHandler.
1996         * UIProcess/WebsiteData/WebsiteDataStore.h:
1997         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
1998         (WebKit::WebChromeClient::hasStorageAccess):
1999         (WebKit::WebChromeClient::requestStorageAccess):
2000             Switched from WTF::Function to WTF::CompletionHandler.
2001         * WebProcess/WebCoreSupport/WebChromeClient.h:
2002         * WebProcess/WebPage/WebPage.cpp:
2003         (WebKit::WebPage::hasStorageAccess):
2004         (WebKit::WebPage::requestStorageAccess):
2005             Switched from WTF::Function to WTF::CompletionHandler.
2006         * WebProcess/WebPage/WebPage.h:
2007
2008 2017-12-06  Youenn Fablet  <youenn@apple.com>
2009
2010         CacheStorageEngineConnection should protect its IPC Connection when doing asynchronous tasks
2011         https://bugs.webkit.org/show_bug.cgi?id=180461
2012
2013         Reviewed by Chris Dumez.
2014
2015         Protecting the IPC connection instead of the CacheStorageEngineConnection
2016         since CacheStorageEngineConnection only keeps a reference to the NetworkConnectionToWebProcess.
2017
2018         * NetworkProcess/cache/CacheStorageEngineConnection.cpp:
2019         (WebKit::CacheStorageEngineConnection::open):
2020         (WebKit::CacheStorageEngineConnection::remove):
2021         (WebKit::CacheStorageEngineConnection::caches):
2022         (WebKit::CacheStorageEngineConnection::retrieveRecords):
2023         (WebKit::CacheStorageEngineConnection::deleteMatchingRecords):
2024         (WebKit::CacheStorageEngineConnection::putRecords):
2025         (WebKit::CacheStorageEngineConnection::clearMemoryRepresentation):
2026
2027 2017-12-06  Zan Dobersek  <zdobersek@igalia.com>
2028
2029         [CoordGraphics] Introduce Nicosia::PaintingContext, add Cairo implementation
2030         https://bugs.webkit.org/show_bug.cgi?id=180239
2031
2032         Reviewed by Michael Catanzaro.
2033
2034         With Nicosia::Buffer now only providing the memory area into which the
2035         tile content was rasterized, we can simplify the BitmapTexture update
2036         greatly -- we don't have to create a BitmapImage anymore and retrieve
2037         memory pointer from the contained cairo_surface_t object. Instead, we
2038         just copy to GPU the memory that Nicosia::Buffer controls.
2039
2040         * Shared/CoordinatedGraphics/CoordinatedBackingStore.cpp:
2041         (WebKit::CoordinatedBackingStoreTile::swapBuffers):
2042
2043 2017-12-05  Brent Fulgham  <bfulgham@apple.com>
2044
2045         Limit user agent versioning to an upper bound
2046         https://bugs.webkit.org/show_bug.cgi?id=180365
2047         <rdar://problem/34550617>
2048
2049         Reviewed by Joseph Pecoraro.
2050
2051         * UIProcess/ios/WebPageProxyIOS.mm:
2052         (WebKit::WebPageProxy::standardUserAgent): Don't pass the WebKit bundle version when
2053         creatin the User Agent string.
2054         (WebKit::webKitBundleVersionString): Deleted.
2055         * UIProcess/mac/WebPageProxyMac.mm:
2056         (WebKit::WebPageProxy::standardUserAgent): Ditto.
2057         (WebKit::webKitBundleVersionString): Deleted.
2058
2059 2017-12-05  Alex Christensen  <achristensen@webkit.org>
2060
2061         Fix crash when loading a file URL that does not have a fileSystemPath representation
2062         https://bugs.webkit.org/show_bug.cgi?id=180448
2063         <rdar://problem/22805921>
2064
2065         Reviewed by Chris Dumez.
2066
2067         * UIProcess/WebProcessProxy.cpp:
2068         (WebKit::WebProcessProxy::assumeReadAccessToBaseURL):
2069         Check if a String is null before adding it to a HashSet.
2070
2071 2017-12-05  Youenn Fablet  <youenn@apple.com>
2072
2073         Implement https://w3c.github.io/ServiceWorker/#clients-claim
2074         https://bugs.webkit.org/show_bug.cgi?id=180261
2075
2076         Reviewed by Chris Dumez.
2077
2078         Add IPC plumbery for clients claim between ServiceWorker process and Storage process.
2079
2080         * StorageProcess/ServiceWorker/WebSWServerToContextConnection.cpp:
2081         (WebKit::WebSWServerToContextConnection::claimCompleted):
2082         * StorageProcess/ServiceWorker/WebSWServerToContextConnection.h:
2083         * StorageProcess/ServiceWorker/WebSWServerToContextConnection.messages.in:
2084         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
2085         (WebKit::WebSWContextManagerConnection::claim):
2086         (WebKit::WebSWContextManagerConnection::claimCompleted):
2087         * WebProcess/Storage/WebSWContextManagerConnection.h:
2088         * WebProcess/Storage/WebSWContextManagerConnection.messages.in:
2089
2090 2017-12-05  Chris Dumez  <cdumez@apple.com>
2091
2092         Add support for ServiceWorkerContainer.prototype.ready
2093         https://bugs.webkit.org/show_bug.cgi?id=180383
2094
2095         Reviewed by Youenn Fablet.
2096
2097         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
2098         (WebKit::WebSWServerConnection::whenRegistrationReady):
2099         (WebKit::WebSWServerConnection::resolveRegistrationReadyRequests):
2100         * StorageProcess/ServiceWorker/WebSWServerConnection.h:
2101         * StorageProcess/ServiceWorker/WebSWServerConnection.messages.in:
2102         * WebProcess/Storage/WebSWClientConnection.cpp:
2103         (WebKit::WebSWClientConnection::matchRegistration):
2104         (WebKit::WebSWClientConnection::whenRegistrationReady):
2105         (WebKit::WebSWClientConnection::registrationReady):
2106         (WebKit::WebSWClientConnection::getRegistrations):
2107         * WebProcess/Storage/WebSWClientConnection.h:
2108         * WebProcess/Storage/WebSWClientConnection.messages.in:
2109
2110 2017-12-05  Youenn Fablet  <youenn@apple.com>
2111
2112         Implement setting of service worker to client in SWServer without going to WebProcess
2113         https://bugs.webkit.org/show_bug.cgi?id=180382
2114
2115         Reviewed by Chris Dumez.
2116
2117         * StorageProcess/ServiceWorker/WebSWServerConnection.messages.in:
2118         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
2119         (WebKit::WebSWServerConnection::registerServiceWorkerClient):
2120         * StorageProcess/ServiceWorker/WebSWServerConnection.h:
2121         * StorageProcess/ServiceWorker/WebSWServerConnection.messages.in:
2122         * WebProcess/Storage/WebSWClientConnection.cpp:
2123         (WebKit::WebSWClientConnection::registerServiceWorkerClient):
2124         (WebKit::WebSWClientConnection::serviceWorkerStartedControllingClient): Deleted.
2125         (WebKit::WebSWClientConnection::serviceWorkerStoppedControllingClient): Deleted.
2126         * WebProcess/Storage/WebSWClientConnection.h:
2127
2128 2017-12-04  Chris Dumez  <cdumez@apple.com>
2129
2130         Support container.getRegistration() / getRegistrations() inside service workers
2131         https://bugs.webkit.org/show_bug.cgi?id=180360
2132
2133         Reviewed by Youenn Fablet.
2134
2135         * WebProcess/Storage/WebSWClientConnection.cpp:
2136         (WebKit::WebSWClientConnection::didMatchRegistration):
2137         (WebKit::WebSWClientConnection::didGetRegistrations):
2138         (WebKit::WebSWClientConnection::matchRegistration):
2139         (WebKit::WebSWClientConnection::getRegistrations):
2140
2141 2017-12-04  Brady Eidson  <beidson@apple.com>
2142
2143         Followup to:
2144         Get a directory path to SWServers for storing ServiceWorker registrations
2145         https://bugs.webkit.org/show_bug.cgi?id=180362
2146
2147         Unreviewed.
2148
2149         * StorageProcess/StorageProcess.cpp:
2150         (WebKit::StorageProcess::swServerForSession): Change this ASSERT which is invalid in private browsing sessions.
2151
2152 2017-12-04  Simon Fraser  <simon.fraser@apple.com>
2153
2154         Minor DisplayRefreshMonitor-related cleanup
2155         https://bugs.webkit.org/show_bug.cgi?id=179802
2156
2157         Reviewed by Sam Weinig.
2158
2159         Use RunLoopObserver::WellKnownRunLoopOrders. We want to fire before layer flushing.
2160
2161         * UIProcess/WebPageProxy.cpp:
2162         (WebKit::m_configurationPreferenceValues):
2163
2164 2017-12-04  Brent Fulgham  <bfulgham@apple.com>
2165
2166         Don't force creation of process pool when enabling resource load statistics
2167         https://bugs.webkit.org/show_bug.cgi?id=180374
2168         <rdar://problem/35545639>
2169
2170         Reviewed by Alex Christensen.
2171
2172         Pass appropriate arguments to the 'processPool' accessor so that we only get the
2173         set of existing process pools. We don't want to pay the cost of launching new
2174         process pools just to set this flag. The flag will be properly set when the pools
2175         are created as soon as a WebView is instantiated.
2176
2177         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
2178         (WebKit::WebsiteDataStore::setResourceLoadStatisticsEnabled):
2179
2180 2017-12-04  David Quesada  <david_quesada@apple.com>
2181
2182         Add a class for parsing application manifests
2183         https://bugs.webkit.org/show_bug.cgi?id=177973
2184         rdar://problem/34747949
2185
2186         Reviewed by Geoffrey Garen.
2187
2188         * Configurations/FeatureDefines.xcconfig: Add ENABLE_APPLICATION_MANIFEST feature flag.
2189
2190 2017-12-04  Wenson Hsieh  <wenson_hsieh@apple.com>
2191
2192         Rename a static helper in TouchBarMenuItemData.cpp to match style guidelines.
2193         https://bugs.webkit.org/show_bug.cgi?id=180305
2194
2195         Reviewed by Andy Estes.
2196
2197         Style guidelines state that we should use bare words for getters, so getItemType should just be
2198         itemType. Since this collides with the itemType member variable, this patch also renames that
2199         member variable to the more concise "type".
2200
2201         No change in behavior.
2202
2203         * Shared/TouchBarMenuItemData.cpp:
2204         (WebKit::itemType):
2205         (WebKit::TouchBarMenuItemData::TouchBarMenuItemData):
2206         (WebKit::TouchBarMenuItemData::encode const):
2207         (WebKit::TouchBarMenuItemData::decode):
2208         (WebKit::getItemType): Deleted.
2209         * Shared/TouchBarMenuItemData.h:
2210         (WebKit::operator==):
2211
2212 2017-12-04  Brian Burg  <bburg@apple.com>
2213
2214         Web Automation: add flag to preserve legacy page screenshot behavior
2215         https://bugs.webkit.org/show_bug.cgi?id=180313
2216         <rdar://problem/34379930>
2217
2218         Reviewed by Joseph Pecoraro.
2219
2220         For compatibility with JSON Wire Protocol implemented by Safari,
2221         we need to retain the ability to perform whole page contents
2222         snapshots using Automation.takeScreenshot. Add an extra flag,
2223         clipToViewport, which can be used by W3C-conforming drivers.
2224
2225         * UIProcess/Automation/Automation.json: Add new flag.
2226         * UIProcess/Automation/WebAutomationSession.h:
2227         * UIProcess/Automation/WebAutomationSession.cpp:
2228         (WebKit::WebAutomationSession::takeScreenshot):
2229         * WebProcess/Automation/WebAutomationSessionProxy.h:
2230         * WebProcess/Automation/WebAutomationSessionProxy.messages.in:
2231         * WebProcess/Automation/WebAutomationSessionProxy.cpp:
2232         (WebKit::snapshotRectForScreenshot):
2233         (WebKit::WebAutomationSessionProxy::takeScreenshot):
2234         If the flag is false, take a screenshot of the whole page contents.
2235
2236 2017-12-04  JF Bastien  <jfbastien@apple.com>
2237
2238         Update std::expected to match libc++ coding style
2239         https://bugs.webkit.org/show_bug.cgi?id=180264
2240
2241         Reviewed by Alex Christensen.
2242
2243         Update various uses of Expected, mostly renaming valueOr and
2244         hasValue to the STL naming convention.
2245
2246         * NetworkProcess/cache/CacheStorageEngine.cpp:
2247         (WebKit::CacheStorage::Engine::open):
2248         (WebKit::CacheStorage::Engine::retrieveCaches):
2249         (WebKit::CacheStorage::Engine::retrieveRecords):
2250         (WebKit::CacheStorage::Engine::putRecords):
2251         (WebKit::CacheStorage::Engine::deleteMatchingRecords):
2252         (WebKit::CacheStorage::Engine::fetchEntries):
2253         (WebKit::CacheStorage::Engine::clearMemoryRepresentation):
2254         * NetworkProcess/cache/CacheStorageEngineCache.cpp:
2255         (WebKit::CacheStorage::ReadRecordTaskCounter::appendRecord):
2256         (WebKit::CacheStorage::Cache::updateRecordToDisk):
2257         * NetworkProcess/cache/CacheStorageEngineCaches.cpp:
2258         (WebKit::CacheStorage::Caches::initialize):
2259         (WebKit::CacheStorage::Caches::readCachesFromDisk):
2260         * NetworkProcess/webrtc/NetworkRTCProvider.cpp:
2261         (WebKit::NetworkRTCProvider::createResolver):
2262         * Platform/IPC/ArgumentCoders.h:
2263
2264 2017-12-04  Brady Eidson  <beidson@apple.com>
2265
2266         Get a directory path to SWServers for storing ServiceWorker registrations.
2267         https://bugs.webkit.org/show_bug.cgi?id=180362
2268
2269         Reviewed by Chris Dumez.
2270
2271         This gets all of the plumbing in place for specifying a ServiceWorker registration storage path
2272         in a particular WebsiteDataStore.
2273
2274         * Shared/Storage/StorageProcessCreationParameters.cpp:
2275         (WebKit::StorageProcessCreationParameters::encode const):
2276         (WebKit::StorageProcessCreationParameters::decode):
2277         * Shared/Storage/StorageProcessCreationParameters.h:
2278
2279         * StorageProcess/StorageProcess.cpp:
2280         (WebKit::StorageProcess::initializeWebsiteDataStore):
2281         (WebKit::StorageProcess::swServerForSession):
2282         * StorageProcess/StorageProcess.h:
2283
2284         * UIProcess/API/APIProcessPoolConfiguration.cpp:
2285         (API::ProcessPoolConfiguration::createWithLegacyOptions):
2286         (API::ProcessPoolConfiguration::createWithWebsiteDataStoreConfiguration):
2287         (API::ProcessPoolConfiguration::ProcessPoolConfiguration):
2288         * UIProcess/API/APIProcessPoolConfiguration.h:
2289
2290         * UIProcess/API/APIWebsiteDataStore.h:
2291         * UIProcess/API/Cocoa/APIWebsiteDataStoreCocoa.mm:
2292         (API::WebsiteDataStore::defaultServiceWorkerRegistrationDirectory):
2293         * UIProcess/API/glib/APIWebsiteDataStoreGLib.cpp:
2294         (API::WebsiteDataStore::defaultServiceWorkerRegistrationDirectory):
2295
2296         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
2297         (WebKit::WebProcessPool::legacyPlatformDefaultIndexedDBDatabaseDirectory):
2298         (WebKit::WebProcessPool::legacyPlatformDefaultServiceWorkerRegistrationDirectory):
2299         * UIProcess/WebProcessPool.cpp:
2300         (WebKit::WebProcessPool::ensureStorageProcessAndWebsiteDataStore):
2301         * UIProcess/WebProcessPool.h:
2302
2303         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
2304         (WebKit::WebsiteDataStore::resolveDirectoriesIfNecessary):
2305         (WebKit::WebsiteDataStore::storageProcessParameters):
2306         * UIProcess/WebsiteData/WebsiteDataStore.h:
2307         (WebKit::WebsiteDataStore::resolvedServiceWorkerRegistrationDirectory const):
2308
2309         * UIProcess/gtk/WebProcessPoolGtk.cpp:
2310         (WebKit::WebProcessPool::legacyPlatformDefaultServiceWorkerRegistrationDirectory):
2311
2312         * UIProcess/wpe/WebProcessPoolWPE.cpp:
2313         (WebKit::WebProcessPool::legacyPlatformDefaultServiceWorkerRegistrationDirectory):
2314
2315 2017-12-04  Frederic Wang  <fwang@igalia.com>
2316
2317         Make ScrollingTreeNode::enclosingFrameNode return the node itself for frame nodes
2318         https://bugs.webkit.org/show_bug.cgi?id=180353
2319
2320         Reviewed by Antonio Gomes.
2321
2322         This function was introduced in bug 175135 to solve a rendering bug with fixed positioned
2323         nodes in overflow nodes. For a frame node, the reference frame to use for fixed nodes is
2324         actually the frame node itself or otherwise we will get the same rendering bug. This patch
2325         makes enclosingFrameNode return the node itself when it is a frame node and renames it to
2326         clarify this behavior. Currently, enclosingFrameNode is not used for frame nodes so the
2327         behavior is unchanged.
2328
2329         * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm:
2330         (WebKit::ScrollingTreeScrollingNodeDelegateIOS::updateChildNodesAfterScroll): Use auto* and
2331         the new function name.
2332
2333 2017-12-04  Michael Catanzaro  <mcatanzaro@igalia.com>
2334
2335         [GTK] Implement PAL::SleepDisabler
2336         https://bugs.webkit.org/show_bug.cgi?id=178485
2337
2338         Reviewed by Carlos Garcia Campos.
2339
2340         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
2341         (webkitWebViewBaseDispose):
2342         (webkitWebViewBaseEnterFullScreen):
2343         (webkitWebViewBaseExitFullScreen):
2344         (screenSaverInhibitedCallback): Deleted.
2345         (webkitWebViewBaseSendInhibitMessageToScreenSaver): Deleted.
2346         (screenSaverProxyCreatedCallback): Deleted.
2347         (webkitWebViewBaseInhibitScreenSaver): Deleted.
2348         (webkitWebViewBaseUninhibitScreenSaver): Deleted.
2349
2350 2017-12-03  Yusuke Suzuki  <utatane.tea@gmail.com>
2351
2352         WTF shouldn't have both Thread and ThreadIdentifier
2353         https://bugs.webkit.org/show_bug.cgi?id=180308
2354
2355         Reviewed by Darin Adler.
2356
2357         * UIProcess/API/glib/IconDatabase.cpp:
2358         * UIProcess/GenericCallback.h:
2359         (WebKit::GenericCallback::~GenericCallback):
2360         (WebKit::GenericCallback::performCallbackWithReturnValue):
2361
2362 2017-12-03  Chris Dumez  <cdumez@apple.com>
2363
2364         Support serviceWorker.postMessage() inside service workers
2365         https://bugs.webkit.org/show_bug.cgi?id=180328
2366
2367         Reviewed by Darin Adler.
2368
2369         Support serviceWorker.postMessage() inside service workers.
2370
2371         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
2372         (WebKit::WebSWServerConnection::postMessageToServiceWorkerFromClient):
2373         (WebKit::WebSWServerConnection::postMessageToServiceWorkerFromServiceWorker):
2374         * StorageProcess/ServiceWorker/WebSWServerConnection.h:
2375         * StorageProcess/ServiceWorker/WebSWServerConnection.messages.in:
2376         * WebProcess/Storage/WebSWClientConnection.cpp:
2377         (WebKit::WebSWClientConnection::postMessageToServiceWorker):
2378         * WebProcess/Storage/WebSWClientConnection.h:
2379         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
2380         (WebKit::WebSWContextManagerConnection::postMessageToServiceWorkerFromClient):
2381         (WebKit::WebSWContextManagerConnection::postMessageToServiceWorkerFromServiceWorker):
2382         * WebProcess/Storage/WebSWContextManagerConnection.h:
2383         * WebProcess/Storage/WebSWContextManagerConnection.messages.in:
2384
2385 2017-12-03  Chris Dumez  <cdumez@apple.com>
2386
2387         Implement self.skipWaiting() inside service workers
2388         https://bugs.webkit.org/show_bug.cgi?id=180329
2389
2390         Reviewed by Darin Adler.
2391
2392         * StorageProcess/ServiceWorker/WebSWServerToContextConnection.cpp:
2393         (WebKit::WebSWServerToContextConnection::didFinishSkipWaiting):
2394         * StorageProcess/ServiceWorker/WebSWServerToContextConnection.h:
2395         * StorageProcess/ServiceWorker/WebSWServerToContextConnection.messages.in:
2396         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
2397         (WebKit::WebSWContextManagerConnection::skipWaiting):
2398         (WebKit::WebSWContextManagerConnection::didFinishSkipWaiting):
2399         * WebProcess/Storage/WebSWContextManagerConnection.h:
2400         * WebProcess/Storage/WebSWContextManagerConnection.messages.in:
2401
2402 2017-12-02  Youenn Fablet  <youenn@apple.com>
2403
2404         Implement https://w3c.github.io/ServiceWorker/#clients-getall
2405         https://bugs.webkit.org/show_bug.cgi?id=180276
2406
2407         Reviewed by Chris Dumez.
2408
2409         Add IPC plumbery for clients.matchAll between ServiceWorker process and Storage process.
2410
2411         * StorageProcess/ServiceWorker/WebSWServerToContextConnection.cpp:
2412         (WebKit::WebSWServerToContextConnection::matchAllCompleted):
2413         * StorageProcess/ServiceWorker/WebSWServerToContextConnection.h:
2414         * StorageProcess/ServiceWorker/WebSWServerToContextConnection.messages.in:
2415         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
2416         (WebKit::WebSWContextManagerConnection::matchAll):
2417         (WebKit::WebSWContextManagerConnection::matchAllCompleted):
2418         * WebProcess/Storage/WebSWContextManagerConnection.h:
2419         * WebProcess/Storage/WebSWContextManagerConnection.messages.in:
2420
2421 2017-12-02  Joseph Pecoraro  <pecoraro@apple.com>
2422
2423         Remote Web Inspector window always shows up at the default size
2424         https://bugs.webkit.org/show_bug.cgi?id=180284
2425         <rdar://problem/35430255>
2426
2427         Reviewed by Brian Burg.
2428
2429         * UIProcess/mac/RemoteWebInspectorProxyMac.mm:
2430         (WebKit::RemoteWebInspectorProxy::platformCreateFrontendPageAndWindow):
2431         Give remote web inspector windows an autosave name so that their frame can
2432         be automatically saved and restored by the system.
2433
2434 2017-12-02  Simon Fraser  <simon.fraser@apple.com>
2435
2436         Add a log channel for viewports
2437         https://bugs.webkit.org/show_bug.cgi?id=180295
2438
2439         Reviewed by Zalan Bujtas.
2440
2441         Add a "Viewports" log channel to log viewport scaling information, and enhance the
2442         WebKit "VisibleRects" channel to log additional data for the same reason.
2443
2444         * UIProcess/API/Cocoa/WKWebView.mm:
2445         (-[WKWebView _didCommitLayerTree:]):
2446         (-[WKWebView _dynamicViewportUpdateChangedTargetToScale:position:nextValidLayerTreeTransactionID:]):
2447         (-[WKWebView _dispatchSetMinimumLayoutSize:]):
2448         (-[WKWebView _endAnimatedResize]):
2449         (-[WKWebView _resizeWhileHidingContentWithUpdates:]):
2450         * WebProcess/WebPage/WebPage.cpp:
2451         (WebKit::WebPage::setFixedLayoutSize):
2452         (WebKit::WebPage::mainFrameDidLayout):
2453         (WebKit::WebPage::didCommitLoad):
2454         * WebProcess/WebPage/ios/WebPageIOS.mm:
2455         (WebKit::scaleAfterViewportWidthChange):
2456         (WebKit::WebPage::setViewportConfigurationMinimumLayoutSize):
2457         (WebKit::WebPage::dynamicViewportSizeUpdate):
2458         (WebKit::WebPage::resetViewportDefaultConfiguration):
2459         (WebKit::WebPage::viewportConfigurationChanged):
2460         (WebKit::WebPage::updateVisibleContentRects):
2461
2462 2017-12-02  Carlos Garcia Campos  <cgarcia@igalia.com>
2463
2464         WebDriver: handle user prompts shown while executing scripts
2465         https://bugs.webkit.org/show_bug.cgi?id=179979
2466
2467         Reviewed by Brian Burg.
2468
2469         * UIProcess/Automation/Automation.json: Add UnexpectedAlertOpen error.
2470         * UIProcess/Automation/WebAutomationSession.cpp:
2471         (WebKit::WebAutomationSession::willShowJavaScriptDialog): Finish pending evaluateJavaScriptFunction operations
2472         with UnexpectedAlertOpen error.
2473
2474 2017-12-02  Wenson Hsieh  <wenson_hsieh@apple.com>
2475
2476         Make some minor adjustments to TouchBarMenuData and TouchBarMenuItemData
2477         https://bugs.webkit.org/show_bug.cgi?id=180305
2478
2479         Reviewed by Joseph Pecoraro.
2480
2481         Mark some methods and parameters as const, use the default constructor in more places, and also remove a few
2482         extraneous imported headers.
2483
2484         * Shared/TouchBarMenuData.cpp:
2485         (WebKit::TouchBarMenuData::TouchBarMenuData):
2486
2487         Add a FIXME regarding the use of the 'id' attribute.
2488
2489         (WebKit::TouchBarMenuData::decode):
2490         * Shared/TouchBarMenuData.h:
2491         (WebKit::TouchBarMenuData::items const):
2492         (WebKit::TouchBarMenuData::setID):
2493         (WebKit::TouchBarMenuData::isPageCustomized const):
2494         (WebKit::TouchBarMenuData::items): Deleted.
2495         (WebKit::TouchBarMenuData::isPageCustomized): Deleted.
2496         * Shared/TouchBarMenuItemData.cpp:
2497         (WebKit::getItemType):
2498
2499         Change a helper method from a static class function to a static function in the implementation file.
2500
2501         (WebKit::TouchBarMenuItemData::TouchBarMenuItemData):
2502         (WebKit::TouchBarMenuItemData::encode const):
2503         (WebKit::TouchBarMenuItemData::decode):
2504         (WebKit::TouchBarMenuItemData::getItemType): Deleted.
2505         * Shared/TouchBarMenuItemData.h:
2506         (WebKit::operator==):
2507
2508         Remove the commandName member variable, since it doesn't make sense to propagate an event handler
2509         attribute from WebCore to the client layer.
2510
2511         * UIProcess/WebPageProxy.messages.in:
2512
2513 2017-12-01  Zan Dobersek  <zdobersek@igalia.com>
2514
2515         Unreviewed GTK+ debug build fix. Replace ASSERT_UNUSED() with UNUSED_PARAM()
2516         in WebKit::WebPage methods that used to operate on HTMLMenuElement pointer
2517         values (which have been converted to references).
2518
2519         * WebProcess/WebPage/WebPage.cpp:
2520         (WebKit::WebPage::didInsertMenuElement):
2521         (WebKit::WebPage::didRemoveMenuElement):
2522         (WebKit::WebPage::didInsertMenuItemElement):
2523         (WebKit::WebPage::didRemoveMenuItemElement):
2524
2525 2017-12-01  Simon Fraser  <simon.fraser@apple.com>
2526
2527         Reduce the number of calls to ViewportConfiguration::updateConfiguration()
2528         https://bugs.webkit.org/show_bug.cgi?id=180299
2529
2530         Reviewed by Zalan Bujtas.
2531
2532         There are several calls to ViewportConfiguration::setDefaultConfiguration() during loading
2533         with the same arguments. We can avoid unnecessary calls to updateConfiguration() by returning
2534         early if the configuration hasn't changed.
2535
2536         Also move the fetching of ViewportConfiguration::xhtmlMobileParameters() from didReceiveMobileDocType()
2537         into resetViewportDefaultConfiguration() where we grab all the other default configs.
2538
2539         * WebProcess/WebPage/WebPage.h:
2540         * WebProcess/WebPage/ios/WebPageIOS.mm:
2541         (WebKit::WebPage::didReceiveMobileDocType):
2542         (WebKit::WebPage::resetViewportDefaultConfiguration):
2543
2544 2017-12-01  Aishwarya Nirmal  <anirmal@apple.com>
2545
2546         [Touch Bar Web API] Object representing Touch Bar Menu to send between Web and UI Processes
2547         https://bugs.webkit.org/show_bug.cgi?id=179714
2548
2549         Reviewed by Wenson Hsieh.
2550
2551         These changes define the TouchBarMenuData and TouchBarMenuItemData objects which draw information
2552         from touch bar HTMLMenuElement and HTMLMenuItemElement. These objects represent the contents of
2553         the page-customized touch bar. Changes to the html elements representing the touch bar are sent 
2554         to the UI process.
2555
2556         * Shared/TouchBarMenuData.cpp: Copied from Source/WebCore/html/HTMLMenuItemElement.cpp.
2557         (WebKit::TouchBarMenuData::TouchBarMenuData):
2558         (WebKit::TouchBarMenuData::addMenuItem):
2559         (WebKit::TouchBarMenuData::removeMenuItem):
2560         (WebKit::TouchBarMenuData::encode const):
2561         (WebKit::TouchBarMenuData::decode):
2562         * Shared/TouchBarMenuData.h: Copied from Source/WebCore/html/HTMLMenuItemElement.h.
2563         (WebKit::TouchBarMenuData::items):
2564         (WebKit::TouchBarMenuData::isPageCustomized):
2565         (WebKit::TouchBarMenuData::setIsPageCustomized):
2566         * Shared/TouchBarMenuItemData.cpp: Added.
2567         (WebKit::TouchBarMenuItemData::getItemType):
2568         (WebKit::TouchBarMenuItemData::TouchBarMenuItemData):
2569         (WebKit::TouchBarMenuItemData::encode const):
2570         (WebKit::TouchBarMenuItemData::decode):
2571         * Shared/TouchBarMenuItemData.h: Added.
2572         (WebKit::operator<):
2573         (WebKit::operator>):
2574         (WebKit::operator<=):
2575         (WebKit::operator>=):
2576         (WebKit::operator==):
2577         (WebKit::operator!=):
2578         * UIProcess/WebPageProxy.cpp:
2579         (WebKit::WebPageProxy::touchBarMenuDataChanged):
2580         (WebKit::WebPageProxy::touchBarMenuItemDataAdded):
2581         (WebKit::WebPageProxy::touchBarMenuItemDataRemoved):
2582         * UIProcess/WebPageProxy.h:
2583         (WebKit::WebPageProxy::touchBarMenuData const):
2584         * UIProcess/WebPageProxy.messages.in:
2585         * WebKit.xcodeproj/project.pbxproj:
2586         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
2587         (WebKit::WebChromeClient::didInsertMenuElement):
2588         (WebKit::WebChromeClient::didRemoveMenuElement):
2589         (WebKit::WebChromeClient::didInsertMenuItemElement):
2590         (WebKit::WebChromeClient::didRemoveMenuItemElement):
2591         * WebProcess/WebCoreSupport/WebChromeClient.h:
2592         * WebProcess/WebPage/WebPage.cpp:
2593         (WebKit::WebPage::didInsertMenuElement):
2594         (WebKit::WebPage::didRemoveMenuElement):
2595         (WebKit::WebPage::didInsertMenuItemElement):
2596         (WebKit::WebPage::didRemoveMenuItemElement):
2597         (WebKit::WebPage::sendTouchBarMenuDataRemovedUpdate):
2598         (WebKit::WebPage::sendTouchBarMenuDataAddedUpdate):
2599         (WebKit::WebPage::sendTouchBarMenuItemDataAddedUpdate):
2600         (WebKit::WebPage::sendTouchBarMenuItemDataRemovedUpdate):
2601         * WebProcess/WebPage/WebPage.h:
2602
2603 2017-12-01  Daniel Bates  <dabates@apple.com>
2604
2605         Alternative Presentation Button: Provide a way to query for the replaced elements
2606         https://bugs.webkit.org/show_bug.cgi?id=180114
2607         <rdar://problem/35710539>
2608
2609         Reviewed by Tim Horton.
2610
2611         Add SPI to query for the elements that were replaced by an Alternative Presentation Button.
2612
2613         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInFrame.mm:
2614         (-[WKWebProcessPlugInFrame elementsReplacedByAlternativePresentationButtonWithIdentifier:]): Added.
2615         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInFramePrivate.h:
2616         * WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp:
2617         (WKBundleElementsReplacedByAlternativePresentationButton): Added.
2618         * WebProcess/InjectedBundle/API/c/WKBundleFramePrivate.h:
2619
2620 2017-12-01  Youenn Fablet  <youenn@apple.com>
2621
2622         Implement https://w3c.github.io/ServiceWorker/#clients-get
2623         https://bugs.webkit.org/show_bug.cgi?id=180167
2624
2625         Reviewed by Chris Dumez.
2626
2627         Add IPC plumbery for clientFromId between ServiceWorker process and Storage process.
2628
2629         * StorageProcess/ServiceWorker/WebSWServerToContextConnection.cpp:
2630         (WebKit::WebSWServerToContextConnection::clientFromIdCompleted):
2631         * StorageProcess/ServiceWorker/WebSWServerToContextConnection.h:
2632         * StorageProcess/ServiceWorker/WebSWServerToContextConnection.messages.in:
2633         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
2634         (WebKit::WebSWContextManagerConnection::findClientByIdentifier):
2635         (WebKit::WebSWContextManagerConnection::findClientByIdentifierCompleted):
2636         * WebProcess/Storage/WebSWContextManagerConnection.h:
2637         * WebProcess/Storage/WebSWContextManagerConnection.messages.in:
2638
2639 2017-12-01  Brian Burg  <bburg@apple.com>
2640
2641         Web Inspector: move Inspector::Protocol::Array<T> to JSON namespace
2642         https://bugs.webkit.org/show_bug.cgi?id=173662
2643
2644         Reviewed by Joseph Pecoraro.
2645
2646         Adopt new type names.
2647
2648         * UIProcess/Automation/WebAutomationSession.cpp:
2649         (WebKit::WebAutomationSession::getNextContext):
2650         (WebKit::WebAutomationSession::getBrowsingContexts):
2651         (WebKit::buildArrayForCookies):
2652         (WebKit::WebAutomationSession::getSessionPermissions):
2653         * UIProcess/Automation/WebAutomationSession.h:
2654
2655 2017-12-01  Wenson Hsieh  <wenson_hsieh@apple.com>
2656
2657         [Attachment Support] Implement SPI for clients to update a given attachment's data
2658         https://bugs.webkit.org/show_bug.cgi?id=180184
2659         <rdar://problem/35355731>
2660
2661         Reviewed by Tim Horton.
2662
2663         Add plumbing to the web process for setting the attachment data (and optionally, the content type and/or file
2664         name) of a given attachment. See WebCore ChangeLog for more detail. Changes covered by new API tests.
2665
2666         * UIProcess/API/APIAttachment.cpp:
2667         (API::Attachment::setDataAndContentType):
2668         * UIProcess/API/APIAttachment.h:
2669         * UIProcess/API/Cocoa/_WKAttachment.h:
2670
2671         Add nullability annotations around _WKAttachment SPI methods.
2672
2673         * UIProcess/API/Cocoa/_WKAttachment.mm:
2674         (-[_WKAttachment setData:newContentType:newFilename:completion:]):
2675         * UIProcess/WebPageProxy.cpp:
2676         (WebKit::WebPageProxy::setAttachmentDataAndContentType):
2677         * UIProcess/WebPageProxy.h:
2678         * WebProcess/WebPage/WebPage.cpp:
2679         (WebKit::WebPage::setAttachmentDataAndContentType):
2680         * WebProcess/WebPage/WebPage.h:
2681         * WebProcess/WebPage/WebPage.messages.in:
2682
2683 2017-12-01  Brady Eidson  <beidson@apple.com>
2684
2685         Add Internals.terminateServiceWorker, and the ability to restart service workers for postMessage.
2686         https://bugs.webkit.org/show_bug.cgi?id=180170
2687
2688         Reviewed by Chris Dumez.
2689
2690         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
2691         (WebKit::WebSWServerConnection::startFetch):
2692         (WebKit::WebSWServerConnection::postMessageToServiceWorkerGlobalScope):
2693         * StorageProcess/ServiceWorker/WebSWServerConnection.h:
2694         * StorageProcess/ServiceWorker/WebSWServerConnection.messages.in:
2695
2696         * StorageProcess/ServiceWorker/WebSWServerToContextConnection.cpp:
2697         (WebKit::WebSWServerToContextConnection::syncTerminateWorker):
2698         * StorageProcess/ServiceWorker/WebSWServerToContextConnection.h:
2699
2700         * StorageProcess/StorageToWebProcessConnection.cpp:
2701         (WebKit::StorageToWebProcessConnection::didReceiveSyncMessage):
2702
2703         * WebProcess/Storage/WebSWClientConnection.cpp:
2704         (WebKit::WebSWClientConnection::syncTerminateWorker):
2705         * WebProcess/Storage/WebSWClientConnection.h:
2706
2707         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
2708         (WebKit::WebSWContextManagerConnection::terminateWorker):
2709         (WebKit::WebSWContextManagerConnection::syncTerminateWorker):
2710         * WebProcess/Storage/WebSWContextManagerConnection.h:
2711         * WebProcess/Storage/WebSWContextManagerConnection.messages.in:
2712
2713         * WebProcess/Storage/WebToStorageProcessConnection.cpp:
2714         (WebKit::WebToStorageProcessConnection::didReceiveSyncMessage):
2715         * WebProcess/Storage/WebToStorageProcessConnection.h:
2716
2717 2017-12-01  Youenn Fablet  <youenn@apple.com>
2718
2719         Clear WebSWClientConnection in case storage process IPC connection is closing
2720         https://bugs.webkit.org/show_bug.cgi?id=180210
2721
2722         Reviewed by Chris Dumez.
2723
2724         Clear the sw connection maps when connection is closing.
2725         Call related completion handlers for each connection.
2726
2727         * WebProcess/Storage/WebSWClientConnection.cpp:
2728         (WebKit::WebSWClientConnection::connectionToServerLost):
2729         * WebProcess/Storage/WebSWClientConnection.h:
2730         * WebProcess/Storage/WebToStorageProcessConnection.cpp:
2731         (WebKit::WebToStorageProcessConnection::didClose):
2732         (WebKit::WebToStorageProcessConnection::idbConnectionToServerForSession):
2733         (WebKit::WebToStorageProcessConnection::serviceWorkerConnectionForSession):
2734         * WebProcess/Storage/WebToStorageProcessConnection.h:
2735
2736 2017-12-01  Eric Carlson  <eric.carlson@apple.com>
2737
2738         [MediaStream] Use CaptureDevice instead of device ID to identify devices
2739         https://bugs.webkit.org/show_bug.cgi?id=180206
2740         <rdar://problem/35775758>
2741
2742         Reviewed by Youenn Fablet.
2743
2744         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp:
2745         (WebKit::UserMediaCaptureManagerProxy::createMediaSourceForCaptureDeviceWithConstraints):
2746         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.h:
2747         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.messages.in:
2748         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
2749         (WebKit::UserMediaPermissionRequestManagerProxy::userMediaAccessWasGranted):
2750         (WebKit::UserMediaPermissionRequestManagerProxy::grantAccess):
2751         (WebKit::UserMediaPermissionRequestManagerProxy::requestUserMediaPermissionForFrame):
2752         * UIProcess/UserMediaPermissionRequestManagerProxy.h:
2753         * UIProcess/UserMediaPermissionRequestProxy.cpp:
2754         (WebKit::UserMediaPermissionRequestProxy::allow):
2755         * WebProcess/MediaStream/UserMediaPermissionRequestManager.cpp:
2756         (WebKit::UserMediaPermissionRequestManager::userMediaAccessWasGranted):
2757         * WebProcess/MediaStream/UserMediaPermissionRequestManager.h:
2758         * WebProcess/WebPage/WebPage.cpp:
2759         (WebKit::WebPage::userMediaAccessWasGranted):
2760         * WebProcess/WebPage/WebPage.h:
2761         * WebProcess/WebPage/WebPage.messages.in:
2762         * WebProcess/cocoa/UserMediaCaptureManager.cpp:
2763         (WebKit::UserMediaCaptureManager::createCaptureSource):
2764         * WebProcess/cocoa/UserMediaCaptureManager.h:
2765
2766 2017-12-01  Carlos Garcia Campos  <cgarcia@igalia.com>
2767
2768         WebDriver: link and partial links queries don't work in xhtml documents
2769         https://bugs.webkit.org/show_bug.cgi?id=180191
2770
2771         Reviewed by Brian Burg.
2772
2773         We convert the queries to use xpath, which works for html documents, but it doesn't work for xhtml. In case of
2774         xhtml we would need to provide a namespace resolver and elements would need to be prefixed with 'xhtml:'. It's
2775         easier to simply iterate the link elements and compare the text.
2776
2777         Fixes: imported/w3c/webdriver/tests/retrieval/find_element_from_element.py::test_xhtml_namespace[link text-full link text]
2778                imported/w3c/webdriver/tests/retrieval/find_element_from_element.py::test_xhtml_namespace[partial link text-link text]
2779                imported/w3c/webdriver/tests/retrieval/find_element_from_elements.py::test_xhtml_namespace[link text-full link text]
2780                imported/w3c/webdriver/tests/retrieval/find_element_from_elements.py::test_xhtml_namespace[partial link text-link text]
2781                imported/w3c/webdriver/tests/retrieval/find_element.py::test_xhtml_namespace[link text-full link text]
2782                imported/w3c/webdriver/tests/retrieval/find_element.py::test_xhtml_namespace[partial link text-link text]
2783                imported/w3c/webdriver/tests/retrieval/find_elements.py::test_xhtml_namespace[link text-full link text]
2784                imported/w3c/webdriver/tests/retrieval/find_elements.py::test_xhtml_namespace[partial link text-link text]
2785
2786         * UIProcess/Automation/atoms/FindNodes.js:
2787         (switch):
2788         (tryToFindNode):
2789
2790 2017-11-30  Alex Christensen  <achristensen@webkit.org>
2791
2792         REGRESSION (r224791): cookies are shared between ephemeral sessions in the same process pool
2793         https://bugs.webkit.org/show_bug.cgi?id=180235
2794
2795         Reviewed by Joseph Pecoraro.
2796
2797         In r224791 I assumed that uiProcessCookieStorageIdentifier would be empty in the ephemeral session initialization message.
2798         This is not the case.  We did not catch this because almost all of our ephemeral session testing uses the legacyPrivateSessionID.
2799         I add checks for if the SessionID is ephemeral like we already have in WebFrameNetworkingContext::ensureWebsiteDataStoreSession.
2800         I also add an API test that makes sure cookies are not shared between ephemeral sessions the way they are made through the API.
2801
2802         * NetworkProcess/mac/RemoteNetworkingContext.mm:
2803         (WebKit::RemoteNetworkingContext::ensureWebsiteDataStoreSession):
2804
2805 2017-11-30  Stephan Szabo  <stephan.szabo@sony.com>
2806
2807         Make LegacyCustomProtocolManager optional for network process
2808         https://bugs.webkit.org/show_bug.cgi?id=176230
2809
2810         Reviewed by Alex Christensen.
2811
2812         * CMakeLists.txt:
2813         * Configurations/FeatureDefines.xcconfig:
2814         * NetworkProcess/NetworkProcess.cpp:
2815         (WebKit::NetworkProcess::NetworkProcess):
2816         (WebKit::NetworkProcess::initializeNetworkProcess):
2817         * PlatformGTK.cmake:
2818         * PlatformMac.cmake:
2819         * PlatformWPE.cmake:
2820         * UIProcess/Network/NetworkProcessProxy.cpp:
2821         (WebKit::NetworkProcessProxy::NetworkProcessProxy):
2822         (WebKit::NetworkProcessProxy::didClose):
2823         * UIProcess/Network/NetworkProcessProxy.h:
2824         * UIProcess/WebProcessPool.cpp:
2825         (WebKit::WebProcessPool::setLegacyCustomProtocolManagerClient):
2826         (WebKit::WebProcessPool::registerSchemeForCustomProtocol):
2827         (WebKit::WebProcessPool::unregisterSchemeForCustomProtocol):
2828
2829 2017-11-30  Ryan Haddad  <ryanhaddad@apple.com>
2830
2831         Unreviewed build fix, suppress deprecation warnings.
2832
2833         * Shared/mac/SandboxExtensionMac.mm:
2834         (WebKit::SandboxExtensionImpl::sandboxExtensionForType):
2835
2836 2017-11-30  Daniel Bates  <dabates@apple.com>
2837
2838         Expose SPI didClickAlternativePresentationButtonWithUserInfo on iOS
2839         https://bugs.webkit.org/show_bug.cgi?id=180218
2840         <rdar://problem/35782555>
2841
2842         Reviewed by Alex Christensen.
2843
2844         We want to support the SPI didClickAlternativePresentationButtonWithUserInfo on Cocoa platforms.
2845
2846         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
2847         * UIProcess/Cocoa/UIDelegate.h:
2848         * UIProcess/Cocoa/UIDelegate.mm:
2849         (WebKit::UIDelegate::setDelegate):
2850         (WebKit::UIDelegate::UIClient::didClickAlternativePresentationButton):
2851
2852 2017-11-30  Joseph Pecoraro  <pecoraro@apple.com>
2853
2854         [Cocoa] Web Automation: _WKAutomationSessionConfiguration leak
2855         https://bugs.webkit.org/show_bug.cgi?id=180222
2856
2857         Reviewed by Brian Burg.
2858
2859         * UIProcess/Cocoa/AutomationClient.mm:
2860         (WebKit::AutomationClient::requestAutomationSessionWithCapabilities):
2861
2862 2017-11-30  Joseph Pecoraro  <pecoraro@apple.com>
2863
2864         Fix some NSOperationQueue leaks
2865         https://bugs.webkit.org/show_bug.cgi?id=180221
2866
2867         Reviewed by Wenson Hsieh.
2868
2869         * UIProcess/Cocoa/WebViewImpl.mm:
2870         (WebKit::WebViewImpl::performDragOperation):
2871
2872 2017-11-30  Brian Burg  <bburg@apple.com>
2873
2874         Web Automation: computeElementLayout does not correctly translate iframe client coordinates to main frame coordinates
2875         https://bugs.webkit.org/show_bug.cgi?id=180213
2876         <rdar://problem/30260141>
2877
2878         Reviewed by Simon Fraser.
2879
2880         The current implementation computes points in terms of the frame in which the element is located.
2881         However, WebDriver expects coordinates to be relative to the top-level document since
2882         these coordinates are used for generating click events, among other things.
2883
2884         To convert from frame client coordinates to main frame client coordinates, round-trip
2885         both inViewCenterPoint and elementBounds to root view coordinates and back
2886         to the main frame's contents/client coordinates. Then convert this to page coordinates if needed.
2887
2888         This progresses several tests in the Selenium Python test suite:
2889
2890          - event_firing_webdriver_tests.py::test_should_fire_navigation_events
2891          - frame_switching_tests.py::testShouldBeAbleToClickInAFrameThatRewritesTopWindowLocation
2892          - frame_switching_tests.py::testShouldBeAbleToSwitchToTheTopIfTheFrameIsDeletedFromUnderUs
2893          - frame_switching_tests.py::testShouldBeAbleToSwitchToTheTopIfTheFrameIsDeletedFromUnderUsWithFrameIndex
2894          - frame_switching_tests.py::testShouldBeAbleToSwitchToTheTopIfTheFrameIsDeletedFromUnderUsWithWebelement
2895          - frame_switching_tests.py::testShouldNotBeAbleToDoAnythingTheFrameIsDeletedFromUnderUs
2896          - position_and_size_tests.py::testShouldGetCoordinatesOfAnInvisibleElement
2897
2898         * WebProcess/Automation/WebAutomationSessionProxy.cpp:
2899         (WebKit::WebAutomationSessionProxy::computeElementLayout):
2900         Get both the frame and main frame FrameViews and convert coordinates to the root view.
2901         This is somewhat lossy as clientToDocument* deals with FloatPoints but contentsToRootView
2902         deals with IntPoints. For the purposes of WebDriver, lossiness is not a problem since
2903         integer values are expected anyway.
2904
2905         The imperative nature of the coordinate calculations is difficult to debug, so I converted
2906         this function to only assign to each variable once.
2907
2908 2017-11-30  Alex Christensen  <achristensen@webkit.org>
2909
2910         WKURLSchemeHandler.request should include HTTPBody
2911         https://bugs.webkit.org/show_bug.cgi?id=180220
2912
2913         Reviewed by Brady Eidson.
2914
2915         * Shared/URLSchemeTaskParameters.cpp: Added.
2916         (WebKit::URLSchemeTaskParameters::encode const):
2917         (WebKit::URLSchemeTaskParameters::decode):
2918         * Shared/URLSchemeTaskParameters.h: Added.
2919         * UIProcess/API/Cocoa/WKURLSchemeTask.mm:
2920         (-[WKURLSchemeTaskImpl request]):
2921         * UIProcess/WebPageProxy.cpp:
2922         (WebKit::WebPageProxy::startURLSchemeTask):
2923         * UIProcess/WebPageProxy.h:
2924         * UIProcess/WebPageProxy.messages.in:
2925         * UIProcess/WebURLSchemeHandler.cpp:
2926         (WebKit::WebURLSchemeHandler::startTask):
2927         * UIProcess/WebURLSchemeHandler.h:
2928         * UIProcess/WebURLSchemeTask.cpp:
2929         (WebKit::WebURLSchemeTask::create):
2930         (WebKit::WebURLSchemeTask::WebURLSchemeTask):
2931         * UIProcess/WebURLSchemeTask.h:
2932         * WebKit.xcodeproj/project.pbxproj:
2933         * WebProcess/WebPage/WebURLSchemeTaskProxy.cpp:
2934         (WebKit::WebURLSchemeTaskProxy::startLoading):
2935
2936 2017-11-30  Darin Adler  <darin@apple.com>
2937
2938         [Mac] remove unneeded RetainPtr use introduced in r225142
2939         https://bugs.webkit.org/show_bug.cgi?id=180202
2940
2941         Reviewed by Tim Horton.
2942
2943         * WebProcess/Plugins/PDF/PDFPlugin.h: Got rid of unnecessary RetainPtr.
2944         * WebProcess/Plugins/PDF/PDFPlugin.mm:
2945         (WebKit::PDFPlugin::lookupTextAtLocation const): Ditto.
2946         * WebProcess/WebPage/WebPage.h: Ditto.
2947         * WebProcess/WebPage/mac/WebPageMac.mm:
2948         (WebKit::WebPage::performDictionaryLookupAtLocation): Ditto.
2949         (WebKit::WebPage::performDictionaryLookupForSelection): Ditto.
2950         (WebKit::WebPage::performImmediateActionHitTestAtLocation): Ditto.
2951         (WebKit::WebPage::lookupTextAtLocation): Ditto.
2952
2953 2017-11-30  Zan Dobersek  <zdobersek@igalia.com>
2954
2955         [CoordGraphics] Move CoordinatedGraphicsLayer painting behind Nicosia::PaintingEngine
2956         https://bugs.webkit.org/show_bug.cgi?id=180141
2957
2958         Reviewed by Carlos Garcia Campos.
2959
2960         CompositingCoordinator must implement the paintingEngine() method now
2961         that the method's been added to the CoordinatedGraphicsLayerClient
2962         interface. The CompositingCoordinator manages the Nicosia::PaintingEngine
2963         object through the new m_paintingEngine member variable, and returns the
2964         reference to this object in the paintingEngine() method.
2965
2966         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp:
2967         (WebKit::CompositingCoordinator::CompositingCoordinator):
2968         (WebKit::CompositingCoordinator::paintingEngine):
2969         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.h:
2970         Drop unnecessary typedefs.
2971
2972 2017-11-29  Wenson Hsieh  <wenson_hsieh@apple.com>
2973
2974         [Attachment Support] Implement SPI for clients to make an attachment element display in-place
2975         https://bugs.webkit.org/show_bug.cgi?id=180153
2976         <rdar://problem/35735252>
2977
2978         Reviewed by Tim Horton.
2979
2980         Add new WebKit SPI, -[_WKAttachment setDisplayOptions:completion:], and add plumbing for attachment display
2981         options to the web content process. Changes covered by 4 new API tests.
2982
2983         * Scripts/webkit/messages.py:
2984         (headers_for_type):
2985         * UIProcess/API/APIAttachment.cpp:
2986         (API::Attachment::setDisplayOptions):
2987         * UIProcess/API/APIAttachment.h:
2988         * UIProcess/API/Cocoa/WKWebView.mm:
2989         (-[WKWebView _insertAttachmentWithFilename:contentType:data:options:completion:]):
2990
2991         Respect given display options when inserting a new attachment.
2992
2993         * UIProcess/API/Cocoa/_WKAttachment.h:
2994         * UIProcess/API/Cocoa/_WKAttachment.mm:
2995         (-[_WKAttachmentDisplayOptions coreDisplayOptions]):
2996
2997         Introduce a helper to convert from the Cocoa _WKAttachmentDisplayOptions object to platform-agnostic
2998         AttachmentDisplayOptions.
2999
3000         (-[_WKAttachment setDisplayOptions:completion:]):
3001         (WebKit::if): Deleted.
3002         * UIProcess/API/Cocoa/_WKAttachmentInternal.h:
3003         * UIProcess/WebPageProxy.cpp:
3004         (WebKit::WebPageProxy::insertAttachment):
3005         (WebKit::WebPageProxy::setAttachmentDisplayOptions):
3006         * UIProcess/WebPageProxy.h:
3007         * WebProcess/WebPage/WebPage.cpp:
3008         (WebKit::WebPage::insertAttachment):
3009         (WebKit::WebPage::requestAttachmentData):
3010         (WebKit::WebPage::setAttachmentDisplayOptions):
3011         (WebKit::WebPage::attachmentElementWithIdentifier const):
3012
3013         Pull common logic to retrieve an attachment element matching a given identifier out into a helper.
3014
3015         * WebProcess/WebPage/WebPage.h:
3016         * WebProcess/WebPage/WebPage.messages.in:
3017
3018 2017-11-29  Brent Fulgham  <bfulgham@apple.com>
3019
3020         Part 2: Adopt updated NSKeyed[Un]Archiver API when available
3021         https://bugs.webkit.org/show_bug.cgi?id=180127
3022         <rdar://problem/35710738>
3023
3024         Reviewed by Simon Fraser.
3025
3026         The API that accepts a user-allocated NSMutableData is deprecated. Switch (for macOS 10.12 and newer)
3027         to the modern API. Use the original API for macOS builds prior to 10.12.
3028
3029         * Shared/Cocoa/DataDetectionResult.mm:
3030         (WebKit::DataDetectionResult::encode const):
3031         * Shared/Cocoa/WebCoreArgumentCodersCocoa.mm:
3032         (IPC::ArgumentCoder<WebCore::Payment>::encode):
3033         (IPC::ArgumentCoder<WebCore::PaymentContact>::encode):
3034         (IPC::ArgumentCoder<WebCore::PaymentMerchantSession>::encode):
3035         (IPC::ArgumentCoder<WebCore::PaymentMethod>::encode):
3036         * Shared/ios/InteractionInformationAtPosition.mm:
3037         (WebKit::InteractionInformationAtPosition::encode const):
3038         * Shared/mac/WebCoreArgumentCodersMac.mm:
3039         (IPC::ArgumentCoder<ProtectionSpace>::encodePlatformData):
3040         (IPC::ArgumentCoder<Credential>::encodePlatformData):
3041         (IPC::ArgumentCoder<ContentFilterUnblockHandler>::encode):
3042         (IPC::ArgumentCoder<MediaPlaybackTargetContext>::encodePlatformData):
3043         * Shared/mac/WebHitTestResultData.mm:
3044         (WebKit::WebHitTestResultData::platformEncode const):
3045         * UIProcess/API/Cocoa/WKProcessPool.mm:
3046         (-[WKProcessPool _setObject:forBundleParameter:]):
3047         (-[WKProcessPool _setObjectsForBundleParametersWithDictionary:]):
3048         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
3049         (WebKit::WebProcessPool::platformInitializeWebProcess):
3050         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:
3051         (-[WKWebProcessPlugInBrowserContextController _setFormDelegate:]):
3052
3053 2017-11-29  Brady Eidson  <beidson@apple.com>
3054
3055         When managing context startups, make ServiceWorkerJobDataIdentifier's optional.
3056         https://bugs.webkit.org/show_bug.cgi?id=180166
3057
3058         Reviewed by Chris Dumez.
3059
3060         * StorageProcess/ServiceWorker/WebSWServerToContextConnection.messages.in:
3061
3062         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
3063         (WebKit::WebSWContextManagerConnection::serviceWorkerStartedWithMessage):
3064         (WebKit::WebSWContextManagerConnection::didFinishInstall):
3065         * WebProcess/Storage/WebSWContextManagerConnection.h:
3066
3067 2017-11-29  Youenn Fablet  <youenn@apple.com>
3068
3069         Add support for service worker generated redirections
3070         https://bugs.webkit.org/show_bug.cgi?id=179498
3071
3072         Reviewed by Darin Adler.
3073
3074         Small refactoring to allow a service worker redirected fetch to follow the redirection through the service worker.
3075
3076         * WebProcess/Network/WebLoaderStrategy.cpp:
3077         (WebKit::WebLoaderStrategy::scheduleLoad): Make use of the loader request in case a network load is needed after a service worker redirection.
3078         * WebProcess/Storage/ServiceWorkerClientFetch.cpp:
3079         (WebKit::ServiceWorkerClientFetch::create):
3080         (WebKit::ServiceWorkerClientFetch::~ServiceWorkerClientFetch):
3081         (WebKit::ServiceWorkerClientFetch::ServiceWorkerClientFetch):
3082         (WebKit::ServiceWorkerClientFetch::start):
3083         (WebKit::ServiceWorkerClientFetch::didReceiveResponse): Check for response.
3084         Generate redirected request if needed and call loader callback to process the redirection.
3085         Adding some states so that if didFinish is called before the willSendRequest callback, redirection is followed.
3086         (WebKit::ServiceWorkerClientFetch::didFinish):
3087         In case redirection should be followed, wait for didFinish to follow it.
3088         This simplifies the model although introducing some limited latency.
3089         * WebProcess/Storage/ServiceWorkerClientFetch.h:
3090         * WebProcess/Storage/WebSWClientConnection.cpp:
3091         (WebKit::WebSWClientConnection::startFetch):
3092         * WebProcess/Storage/WebSWClientConnection.h:
3093         * WebProcess/Storage/WebServiceWorkerProvider.cpp:
3094         (WebKit::WebServiceWorkerProvider::handleFetch):
3095
3096 2017-11-29  Youenn Fablet  <youenn@apple.com>
3097
3098         Add support for FetchEvent.clientId
3099         https://bugs.webkit.org/show_bug.cgi?id=180052
3100
3101         Reviewed by Chris Dumez.
3102
3103         Using FetchOption persistency coders for cache API and modernizing IPC FetchOptions decoding.
3104
3105         * WebKit/Shared/WebCoreArgumentCoders.cpp:
3106         * NetworkProcess/cache/CacheStorageEngineCache.cpp:
3107         (WebKit::CacheStorage::Cache::encode):
3108         (WebKit::CacheStorage::Cache::decodeRecordHeader):
3109         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
3110         (WebKit::WebSWContextManagerConnection::startFetch):
3111         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
3112         (WebKit::WebSWContextManagerConnection::startFetch):
3113
3114 2017-11-29  Alex Christensen  <achristensen@webkit.org>
3115
3116         Make WebFrameLoaderClient more robust against null pointer dereferencing
3117         https://bugs.webkit.org/show_bug.cgi?id=180157
3118         <rdar://problem/34895616>
3119
3120         Reviewed by Tim Horton.
3121
3122         There has always been rare null pointer crashes in this code, but they have become more common
3123         now that we are waiting for completion handlers for redirects, which makes it more likely that
3124         we are hitting this code after we have detached from the core frame.
3125
3126         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
3127         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForResponse):
3128         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNewWindowAction):
3129         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
3130         * WebProcess/WebPage/WebFrame.cpp:
3131         (WebKit::WebFrame::page const):
3132
3133 2017-11-29  Alex Christensen  <achristensen@webkit.org>
3134
3135         Fix Mac CMake build.
3136
3137         * PlatformMac.cmake:
3138
3139 2017-11-29  Chris Dumez  <cdumez@apple.com>
3140
3141         StorageToWebProcessConnection & WebSWServerToContextConnection should use the same underlying IPC::Connection
3142         https://bugs.webkit.org/show_bug.cgi?id=180147
3143
3144         Reviewed by Brady Eidson.
3145
3146         StorageToWebProcessConnection & WebSWServerToContextConnection should use the same underlying IPC::Connection.
3147         Otherwise, we have with 2 IPC::Connections between the StorageProcess and the ServiceWorker (aka Context) process,
3148         which makes synchronization of IPC messages difficult.
3149
3150         * StorageProcess/StorageProcess.cpp:
3151         (WebKit::StorageProcess::createStorageToWebProcessConnection):
3152         (WebKit::StorageProcess::createServerToContextConnection):
3153         * StorageProcess/StorageProcess.h:
3154         * StorageProcess/StorageProcess.messages.in:
3155         * StorageProcess/StorageToWebProcessConnection.cpp:
3156         (WebKit::StorageToWebProcessConnection::didReceiveMessage):
3157         * UIProcess/ServiceWorkerProcessProxy.cpp:
3158         (WebKit::ServiceWorkerProcessProxy::start):
3159         * UIProcess/ServiceWorkerProcessProxy.h:
3160         * UIProcess/Storage/StorageProcessProxy.cpp:
3161         (WebKit::StorageProcessProxy::getStorageProcessConnection):
3162         (WebKit::StorageProcessProxy::didFinishLaunching):
3163         (WebKit::StorageProcessProxy::establishWorkerContextConnectionToStorageProcess):
3164         * UIProcess/Storage/StorageProcessProxy.h:
3165         * UIProcess/Storage/StorageProcessProxy.messages.in:
3166         * UIProcess/WebProcessPool.cpp:
3167         (WebKit::WebProcessPool::getStorageProcessConnection):
3168         (WebKit::WebProcessPool::establishWorkerContextConnectionToStorageProcess):
3169         * UIProcess/WebProcessPool.h:
3170         * UIProcess/WebProcessProxy.cpp:
3171         (WebKit::WebProcessProxy::getStorageProcessConnection):
3172         * UIProcess/WebProcessProxy.h:
3173         (WebKit::WebProcessProxy::isServiceWorkerProcess const):
3174         * UIProcess/WebProcessProxy.messages.in:
3175         * WebProcess/Storage/WebToStorageProcessConnection.cpp:
3176         (WebKit::WebToStorageProcessConnection::didReceiveMessage):
3177         * WebProcess/WebProcess.cpp:
3178         (WebKit::WebProcess::didReceiveMessage):
3179         (WebKit::WebProcess::establishWorkerContextConnectionToStorageProcess):
3180         * WebProcess/WebProcess.h:
3181         * WebProcess/WebProcess.messages.in:
3182
3183 2017-11-29  Chris Dumez  <cdumez@apple.com>
3184
3185         ensure*Connection() methods on WebProcess should return a reference
3186         https://bugs.webkit.org/show_bug.cgi?id=180149
3187
3188         Reviewed by Alex Christensen.
3189
3190         ensure*Connection() methods on WebProcess should return a reference instead of not returning
3191         anything. Also get rid of the non-ensure variants which called "ensure" internally and are
3192         no longer needed.
3193
3194         * Shared/mac/CookieStorageShim.mm:
3195         (WebKit::webKitCookieStorageCopyRequestHeaderFieldsForURL):
3196         * WebProcess/Cache/WebCacheStorageConnection.cpp:
3197         (WebKit::WebCacheStorageConnection::connection):
3198         * WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.cpp:
3199         (WebKit::WebIDBConnectionToServer::messageSenderConnection):
3200         (WebKit::preregisterSandboxExtensionsIfNecessary):
3201         * WebProcess/Databases/WebDatabaseProvider.cpp:
3202         (WebKit::WebDatabaseProvider::idbConnectionToServerForSession):
3203         * WebProcess/FileAPI/BlobRegistryProxy.cpp:
3204         (WebKit::BlobRegistryProxy::registerFileBlobURL):
3205         (WebKit::BlobRegistryProxy::registerBlobURL):
3206         (WebKit::BlobRegistryProxy::registerBlobURLOptionallyFileBacked):
3207         (WebKit::BlobRegistryProxy::unregisterBlobURL):
3208         (WebKit::BlobRegistryProxy::registerBlobURLForSlice):
3209         (WebKit::BlobRegistryProxy::blobSize):
3210         (WebKit::BlobRegistryProxy::writeBlobsToTemporaryFiles):
3211         * WebProcess/Network/NetworkProcessConnection.cpp:
3212         (WebKit::NetworkProcessConnection::writeBlobsToTemporaryFiles):
3213         * WebProcess/Network/WebLoaderStrategy.cpp:
3214         (WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess):
3215         (WebKit::WebLoaderStrategy::remove):
3216         (WebKit::WebLoaderStrategy::setDefersLoading):
3217         (WebKit::WebLoaderStrategy::loadResourceSynchronously):
3218         (WebKit::WebLoaderStrategy::startPingLoad):
3219         (WebKit::WebLoaderStrategy::preconnectTo):
3220         (WebKit::WebLoaderStrategy::storeDerivedDataToCache):
3221         (WebKit::WebLoaderStrategy::setCaptureExtraNetworkLoadMetricsEnabled):
3222         * WebProcess/Network/WebResourceLoader.cpp:
3223         (WebKit::WebResourceLoader::messageSenderConnection):
3224         * WebProcess/Network/WebSocketStream.cpp:
3225         (WebKit::WebSocketStream::WebSocketStream):
3226         (WebKit::WebSocketStream::messageSenderConnection):
3227         * WebProcess/Network/webrtc/LibWebRTCResolver.cpp:
3228         (WebKit::sendOnMainThread):
3229         * WebProcess/Network/webrtc/LibWebRTCSocket.cpp:
3230         (WebKit::sendOnMainThread):
3231         * WebProcess/Network/webrtc/LibWebRTCSocketFactory.cpp:
3232         (WebKit::LibWebRTCSocketFactory::CreateServerTcpSocket):
3233         (WebKit::LibWebRTCSocketFactory::CreateUdpSocket):
3234         (WebKit::LibWebRTCSocketFactory::CreateClientTcpSocket):
3235         (WebKit::LibWebRTCSocketFactory::createNewConnectionSocket):
3236         * WebProcess/Network/webrtc/WebRTCMonitor.cpp:
3237         (WebKit::sendOnMainThread):
3238         * WebProcess/Storage/WebServiceWorkerProvider.cpp:
3239         (WebKit::WebServiceWorkerProvider::serviceWorkerConnectionForSession):
3240         (WebKit::WebServiceWorkerProvider::handleFetch):
3241         * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
3242         (WebKit::WebPlatformStrategies::cookiesForDOM):
3243         (WebKit::WebPlatformStrategies::setCookiesFromDOM):
3244         (WebKit::WebPlatformStrategies::cookiesEnabled):
3245         (WebKit::WebPlatformStrategies::cookieRequestHeaderFieldValue):
3246         (WebKit::WebPlatformStrategies::getRawCookies):
3247         (WebKit::WebPlatformStrategies::deleteCookie):
3248         * WebProcess/WebPage/WebFrame.cpp:
3249         (WebKit::WebFrame::startDownload):
3250         (WebKit::WebFrame::convertMainResourceLoadToDownload):
3251         * WebProcess/WebProcess.cpp:
3252         (WebKit::WebProcess::ensureLegacyPrivateBrowsingSessionInNetworkProcess):
3253         (WebKit::WebProcess::ensureNetworkProcessConnection):
3254         (WebKit::WebProcess::ensureWebToStorageProcessConnection):
3255         (WebKit::WebProcess::prefetchDNS):
3256         * WebProcess/WebProcess.h:
3257
3258 2017-11-29  Alex Christensen  <achristensen@webkit.org>
3259
3260         Modernize API::SerializedScriptValue
3261         https://bugs.webkit.org/show_bug.cgi?id=180115
3262
3263         Reviewed by Brady Eidson.
3264
3265         Also remove some SPI that hasn't been used anywhere since Mountain Lion.
3266
3267         * Shared/API/APISerializedScriptValue.h:
3268         (API::SerializedScriptValue::create):
3269         (API::SerializedScriptValue::internalRepresentation):
3270         (API::SerializedScriptValue::SerializedScriptValue):
3271         * Shared/API/c/WKSerializedScriptValue.cpp:
3272         (WKSerializedScriptValueDeserialize):
3273         (WKSerializedScriptValueCreateWithInternalRepresentation): Deleted.
3274         (WKSerializedScriptValueGetInternalRepresentation): Deleted.
3275         * Shared/API/c/WKSerializedScriptValuePrivate.h: Removed.
3276         * UIProcess/API/Cocoa/WKWebView.mm:
3277         (-[WKWebView _evaluateJavaScript:forceUserGesture:completionHandler:]):
3278         * WebKit.xcodeproj/project.pbxproj:
3279
3280 2017-11-29  Michael Catanzaro  <mcatanzaro@igalia.com>
3281
3282         REGRESSION(r218064): [GTK] Broke entering fullscreen mode in debug builds
3283         https://bugs.webkit.org/show_bug.cgi?id=180120
3284
3285         Reviewed by Carlos Garcia Campos.
3286
3287         These assertions need to be swapped. Fixes /webkit2/WebKitWebView/fullscreen in debug mode.
3288
3289         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
3290         (webkitWebViewBaseEnterFullScreen):
3291         (webkitWebViewBaseExitFullScreen):
3292
3293 2017-11-29  Zan Dobersek  <zdobersek@igalia.com>
3294
3295         [CoordGraphics] Rename CoordinatedBuffer to Nicosia::Buffer
3296         https://bugs.webkit.org/show_bug.cgi?id=180135
3297
3298         Reviewed by Carlos Garcia Campos.
3299
3300         Adjust code to the CoordinatedBuffer -> Nicosia::Buffer transition.
3301
3302         * Shared/CoordinatedGraphics/CoordinatedBackingStore.cpp:
3303         (WebKit::CoordinatedBackingStoreTile::setBackBuffer):
3304         (WebKit::CoordinatedBackingStore::updateTile):
3305         * Shared/CoordinatedGraphics/CoordinatedBackingStore.h:
3306         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
3307         (WebKit::CoordinatedGraphicsScene::createUpdateAtlas):
3308         (WebKit::CoordinatedGraphicsScene::updateImageBacking):
3309         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.h:
3310         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp:
3311         (WebKit::CompositingCoordinator::updateImageBacking):
3312         (WebKit::CompositingCoordinator::createUpdateAtlas):
3313         (WebKit::CompositingCoordinator::getCoordinatedBuffer):
3314         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.h:
3315         * WebProcess/WebPage/CoordinatedGraphics/UpdateAtlas.cpp:
3316         (WebKit::UpdateAtlas::UpdateAtlas):
3317         (WebKit::UpdateAtlas::getCoordinatedBuffer):
3318         * WebProcess/WebPage/CoordinatedGraphics/UpdateAtlas.h:
3319
3320 2017-11-28  Brent Fulgham  <bfulgham@apple.com>
3321
3322         Adopt updated NSKeyed[Un]Archiver API when available
3323         https://bugs.webkit.org/show_bug.cgi?id=180127
3324         <rdar://problem/35710738>
3325
3326         Reviewed by Alex Christensen.
3327
3328         Switch to new NSKeyed[Un]Archiver methods when available. We do not attempt
3329         to adopt secure coding in places we were not under the original API.
3330
3331         * Platform/ios/AccessibilityIOS.mm:
3332         (WebKit::newAccessibilityRemoteToken): Use secure-by-default API.
3333         * Shared/Cocoa/DataDetectionResult.mm:
3334         (WebKit::DataDetectionResult::encode const): Ditto.
3335         (WebKit::DataDetectionResult::decode): Ditto.
3336         * Shared/Cocoa/WebCoreArgumentCodersCocoa.mm:
3337         (IPC::ArgumentCoder<WebCore::Payment>::encode): Ditto.
3338         (IPC::ArgumentCoder<WebCore::Payment>::decode): Ditto.
3339         (IPC::ArgumentCoder<WebCore::PaymentContact>::encode): Ditto.
3340         (IPC::ArgumentCoder<WebCore::PaymentContact>::decode): Ditto.
3341         (IPC::ArgumentCoder<WebCore::PaymentMerchantSession>::encode): Ditto.
3342         (IPC::ArgumentCoder<WebCore::PaymentMerchantSession>::decode): Ditto.
3343         (IPC::ArgumentCoder<WebCore::PaymentMethod>::encode): Ditto.
3344         (IPC::ArgumentCoder<WebCore::PaymentMethod>::decode): Ditto.
3345         * Shared/ios/InteractionInformationAtPosition.mm:
3346         (WebKit::InteractionInformationAtPosition::encode const): Ditto.
3347         (WebKit::InteractionInformationAtPosition::decode): Ditto.
3348         * Shared/mac/WebCoreArgumentCodersMac.mm:
3349         (IPC::ArgumentCoder<ProtectionSpace>::encodePlatformData): Ditto.
3350         (IPC::ArgumentCoder<ProtectionSpace>::decodePlatformData): Ditto.
3351         (IPC::ArgumentCoder<Credential>::encodePlatformData): Ditto.
3352         (IPC::ArgumentCoder<Credential>::decodePlatformData): Ditto.
3353         (IPC::ArgumentCoder<ContentFilterUnblockHandler>::encode): Ditto.
3354         (IPC::ArgumentCoder<ContentFilterUnblockHandler>::decode): Ditto.
3355         (IPC::ArgumentCoder<MediaPlaybackTargetContext>::encodePlatformData): Ditto.
3356         (IPC::ArgumentCoder<MediaPlaybackTargetContext>::decodePlatformData): Ditto.
3357         * Shared/mac/WebHitTestResultData.mm:
3358         (WebKit::WebHitTestResultData::platformEncode const): Ditto.
3359         (WebKit::WebHitTestResultData::platformDecode): Ditto.
3360         * UIProcess/API/Cocoa/WKProcessPool.mm:
3361         (-[WKProcessPool _setObject:forBundleParameter:]): Ditto.
3362         (-[WKProcessPool _setObjectsForBundleParametersWithDictionary:]): Ditto.
3363         * UIProcess/API/Cocoa/WKWebView.mm:
3364         (-[WKWebView _setInputDelegate:]): Ditto.
3365         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
3366         (WebKit::WebProcessPool::platformInitializeWebProcess): Ditto.
3367         * UIProcess/ios/PageClientImplIOS.mm:
3368         (WebKit::PageClientImpl::startAssistingNode): Ditto.
3369         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:
3370         (-[WKWebProcessPlugInBrowserContextController _setFormDelegate:]): Ditto.
3371         * WebProcess/InjectedBundle/mac/InjectedBundleMac.mm:
3372         (WebKit::InjectedBundle::initialize): Ditto.
3373         (WebKit::InjectedBundle::setBundleParameter): Ditto.
3374         (WebKit::InjectedBundle::setBundleParameters): Ditto.
3375
3376 2017-11-28  Youenn Fablet  <youenn@apple.com>
3377
3378         NetworkCache::Storage should protect itself when removing operations from its maps
3379         https://bugs.webkit.org/show_bug.cgi?id=180118
3380
3381         Reviewed by Antti Koivisto.
3382
3383         The operations can contain ref to the Storage object and removing them from the map may destroy the Storage object
3384
3385         * NetworkProcess/cache/NetworkCacheStorage.cpp:
3386         (WebKit::NetworkCache::Storage::remove):
3387         (WebKit::NetworkCache::Storage::finishReadOperation):
3388         (WebKit::NetworkCache::Storage::finishWriteOperation):
3389         (WebKit::NetworkCache::Storage::traverse):
3390
3391 2017-11-28  Youenn Fablet  <youenn@apple.com>
3392
3393         Register Documents as ServiceWorker clients to the StorageProcess
3394         https://bugs.webkit.org/show_bug.cgi?id=180047
3395
3396         Reviewed by Brady Eidson.
3397
3398         Adding IPC to register/unregister clients to the storage process.
3399         This will be used to enable service worker termination, and implementation of Clients API.
3400
3401         WebSWServerConnection keeps a hash map of all its related clients.
3402         This allows unregistering these clients if the corresponding web process crashes.
3403
3404         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
3405         (WebKit::WebSWServerConnection::~WebSWServerConnection):
3406         (WebKit::WebSWServerConnection::registerServiceWorkerClient):
3407         (WebKit::WebSWServerConnection::unregisterServiceWorkerClient):
3408         * StorageProcess/ServiceWorker/WebSWServerConnection.h:
3409         * StorageProcess/ServiceWorker/WebSWServerConnection.messages.in:
3410         * StorageProcess/ServiceWorker/WebSWServerToContextConnection.h:
3411         * WebProcess/Storage/WebSWClientConnection.cpp:
3412         (WebKit::WebSWClientConnection::registerServiceWorkerClient):
3413         (WebKit::WebSWClientConnection::unregisterServiceWorkerClient):
3414         * WebProcess/Storage/WebSWClientConnection.h:
3415
3416 2017-11-28  Said Abou-Hallawa  <sabouhallawa@apple.com>
3417
3418         [CG] PostScript images should be supported if they are sub-resource images
3419         https://bugs.webkit.org/show_bug.cgi?id=178502
3420         <rdar://problem/35102988>
3421
3422         Reviewed by Simon Fraser.
3423
3424         Make convertPostScriptDataToPDF() be as static function of PDFDocumentImage
3425         in WebCore.
3426
3427         * WebProcess/Plugins/PDF/PDFPlugin.mm:
3428         (WebKit::PDFPlugin::convertPostScriptDataIfNeeded):
3429         (WebKit::convertPostScriptDataToPDF): Deleted.
3430
3431 2017-11-28  Alex Christensen  <achristensen@webkit.org>
3432
3433         Add SPI for adding strings directly to a _WKVisitedLinkStore
3434         https://bugs.webkit.org/show_bug.cgi?id=180100
3435
3436         Reviewed by Geoffrey Garen.
3437
3438         * UIProcess/API/Cocoa/_WKVisitedLinkStore.h:
3439         * UIProcess/API/Cocoa/_WKVisitedLinkStore.mm:
3440         (-[_WKVisitedLinkStore addVisitedLinkWithString:]):
3441         This is a performance optimization for rdar://problem/16321391
3442
3443 2017-11-28  Joseph Pecoraro  <pecoraro@apple.com>
3444
3445         REGRESSION: Web Inspector: context menu actions "Download Image" and "Open Image in New Window" don't work
3446         https://bugs.webkit.org/show_bug.cgi?id=178808
3447         <rdar://problem/35176608>
3448
3449         Reviewed by Brian Burg.
3450
3451         * UIProcess/mac/WKInspectorViewController.mm:
3452         (-[WKInspectorViewController _webView:contextMenu:forElement:]):
3453         Continue to hide the image context menu actions like we used to.
3454         Investigating making these context menus work can be done as a
3455         follow-up task.
3456
3457         * UIProcess/mac/WKWebInspectorWKWebView.mm:
3458         (-[WKWebInspectorWKWebView initWithFrame:configuration:]):
3459         Use nullptr instead of 0.
3460
3461 2017-11-14  Carlos Garcia Campos  <cgarcia@igalia.com>
3462
3463         Move JSONValues to WTF and convert uses of InspectorValues.h to JSONValues.h
3464         https://bugs.webkit.org/show_bug.cgi?id=173793
3465
3466         Reviewed by Joseph Pecocaro.
3467
3468         Based on patch by Brian Burg.
3469
3470         * UIProcess/Automation/WebAutomationSession.cpp:
3471         (WebKit::WebAutomationSession::resizeWindowOfBrowsingContext):
3472         (WebKit::WebAutomationSession::moveWindowOfBrowsingContext):
3473         (WebKit::WebAutomationSession::waitForNavigationToCompleteOnPage):
3474         (WebKit::WebAutomationSession::waitForNavigationToCompleteOnFrame):
3475         (WebKit::WebAutomationSession::respondToPendingPageNavigationCallbacksWithTimeout):
3476     &