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