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