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