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