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