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