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