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