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