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