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