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