dc97695de3459d6ffe65bf5498ea197f18a1ca8b
[WebKit-https.git] / Source / WebKit / ChangeLog
1 2018-10-15  Remy Demarest  <rdemarest@apple.com>
2
3         Web Inspector: RDM: Toolbar hidden in when Inspector is docked to side.
4         https://bugs.webkit.org/show_bug.cgi?id=190545
5         rdar://problem/44674500
6
7         Reviewed by Brian Burg.
8
9         When the inspector is placed next to the web view it uses its _topContentInset and _totalHeightOfBanners
10         to lay out the inspector so it does not underlap the window toolbar, but this technique does not work when
11         in responsive design mode because of the different attachment view. This patch fixes the issue by using
12         -[NSWindow contentLayoutRect] to figure out the height of the inspector instead of relying on the content
13         insets of the web view. This requires observing -contentLayoutRect and ensure we only observe its changes
14         when the view is actually on the screen.
15
16         * UIProcess/WebInspectorProxy.h:
17         Declare helpers to add/remove observer on the attached inspector window.
18
19         * UIProcess/mac/WKInspectorViewController.h:
20         * UIProcess/mac/WKInspectorViewController.mm:
21         (-[WKInspectorViewController inspectorWKWebView:willMoveToWindow:]):
22         (-[WKInspectorViewController inspectorWKWebViewDidMoveToWindow:]):
23
24         * UIProcess/mac/WKInspectorWKWebView.h:
25         * UIProcess/mac/WKInspectorWKWebView.mm:
26         (-[WKInspectorWKWebView viewWillMoveToWindow:]):
27         (-[WKInspectorWKWebView viewDidMoveToWindow]):
28
29         * UIProcess/mac/WebInspectorProxyMac.mm:
30         (-[WKWebInspectorProxyObjCAdapter observeValueForKeyPath:ofObject:change:context:]): Update inspector layout
31         whenever the contentLayoutRect changes. Except when live resizing since the attachment view also sends
32         notifications at the same time.
33         (-[WKWebInspectorProxyObjCAdapter inspectorViewController:willMoveToWindow:]):
34         (-[WKWebInspectorProxyObjCAdapter inspectorViewControllerDidMoveToWindow:]):
35         (WebKit::WebInspectorProxy::attachmentWillMoveFromWindow): Remove the observer only if we set it up before.
36         (WebKit::WebInspectorProxy::attachmentDidMoveToWindow): Set up the observer and immediately update the frame
37         of the inspector since it just moved to its final destination.
38         (WebKit::WebInspectorProxy::inspectedViewFrameDidChange): Adjust the frame of the attached inspector based
39         on the contentLayoutRect of the window rather than the topContentInset of the web view.
40
41 2018-10-15  Wenson Hsieh  <wenson_hsieh@apple.com>
42
43         Changing view scale should zoom to initial scale if the page is already at initial scale
44         https://bugs.webkit.org/show_bug.cgi?id=190570
45         <rdar://problem/45261877>
46
47         Reviewed by Tim Horton.
48
49         r237087 added support for changing the view scale on iOS, by making it possible to let the minimum layout size
50         be a factor of the view size; this allows internal clients to change page zoom levels on iOS. Currently,
51         changing the page zoom level automatically zooms to the new initial scale only if the user has not manually
52         scaled the page before, even if the page is already at initial scale (e.g. after the user double taps to zoom on
53         a small element, and double taps again to zoom back out to initial scale).
54
55         This patch makes some minor adjustments to automatically zoom to the new initial scale after changing the view
56         scale, as long as the page was at initial scale when changing zoom levels.
57
58         Test: fast/viewport/ios/initial-scale-after-changing-view-scale.html
59
60         * WebProcess/WebPage/WebPage.h:
61         * WebProcess/WebPage/ios/WebPageIOS.mm:
62         (WebKit::areEssentiallyEqualAsFloat):
63
64         Move this function further up in the file, so that we can use it in `setViewportConfigurationViewLayoutSize`.
65
66         (WebKit::WebPage::setViewportConfigurationViewLayoutSize):
67
68         If the page is near initial scale and the zoom level changes, zoom to the new initial scale.
69
70         (WebKit::WebPage::viewportConfigurationChanged):
71
72         Make this take a new enum argument that determines whether we want to zoom to initial scale as a result of the
73         viewport configuration change (`No` by default).
74
75 2018-10-15  Chris Dumez  <cdumez@apple.com>
76
77         Restrict browsing context lookup by name to frames that are related to one another
78         https://bugs.webkit.org/show_bug.cgi?id=190475
79
80         Reviewed by Alex Christensen.
81
82         * WebProcess/Plugins/PluginView.cpp:
83         (WebKit::PluginView::performJavaScriptURLRequest):
84
85 2018-10-15  Alex Christensen  <achristensen@webkit.org>
86
87         Fix assertion after r237102
88         https://bugs.webkit.org/show_bug.cgi?id=190459
89
90         * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp:
91         (WebKit::InjectedBundlePageLoaderClient::InjectedBundlePageLoaderClient):
92         Shipping Safari still uses shouldGoToBackForwardListItem, so only assert on
93         newer platforms like we do in WKPageSetPageLoaderClient.
94
95 2018-10-15  Alex Christensen  <achristensen@webkit.org>
96
97         Shrink more enum classes
98         https://bugs.webkit.org/show_bug.cgi?id=190540
99
100         Reviewed by Chris Dumez.
101
102         * NetworkProcess/NetworkConnectionToWebProcess.h:
103         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
104         * NetworkProcess/NetworkDataTask.h:
105         * NetworkProcess/NetworkProcess.h:
106         * NetworkProcess/NetworkProcess.messages.in:
107         * Shared/Authentication/AuthenticationChallengeDisposition.h:
108         * Shared/Authentication/AuthenticationManager.h:
109         * Shared/Authentication/AuthenticationManager.messages.in:
110         * Shared/DragControllerAction.h:
111         * Shared/LayerTreeContext.h:
112         * Shared/UndoOrRedo.h:
113         * UIProcess/Authentication/AuthenticationDecisionListener.h:
114         * UIProcess/Cocoa/WebViewImpl.h:
115         * UIProcess/Network/NetworkProcessProxy.h:
116         * UIProcess/Network/NetworkProcessProxy.messages.in:
117         * UIProcess/Notifications/WebNotification.h:
118         * UIProcess/Notifications/WebNotificationManagerProxy.h:
119         * UIProcess/PageClient.h:
120         * UIProcess/UserContent/WebUserContentControllerProxy.h:
121         * UIProcess/WebPageProxy.h:
122         * UIProcess/WebPageProxy.messages.in:
123         * UIProcess/ios/PageClientImplIOS.h:
124         * UIProcess/ios/WKContentViewInteraction.h:
125         * UIProcess/ios/forms/WKAirPlayRoutePicker.h:
126         * WebProcess/Automation/WebAutomationSessionProxy.messages.in:
127         * WebProcess/MediaStream/UserMediaPermissionRequestManager.h:
128         * WebProcess/Storage/WebSWClientConnection.messages.in:
129         * WebProcess/UserContent/InjectUserScriptImmediately.h:
130         * WebProcess/UserContent/WebUserContentController.h:
131         * WebProcess/UserContent/WebUserContentController.messages.in:
132         * WebProcess/WebPage/WebPage.h:
133         * WebProcess/WebPage/WebPage.messages.in:
134
135 2018-10-15  Michael Catanzaro  <mcatanzaro@igalia.com>
136
137         Add new files missing from previous commit.
138
139         * Source/cmake/FindLibseccomp.cmake: Added.
140
141 2018-10-15  Patrick Griffis  <pgriffis@igalia.com>
142
143         [GTK][WPE] Implement subprocess sandboxing
144         https://bugs.webkit.org/show_bug.cgi?id=188568
145
146         Reviewed by Michael Catanzaro.
147
148         This implements sandboxing of WebKitWebProcesses.
149
150         The sandbox is opt-in at runtime as it is a behavior change.
151         See webkit_web_context_set_sandbox_enabled() and the
152         WEBKIT_FORCE_SANDBOX env var for developers.
153
154         This is Linux specific using Namespaces, Seccomp, and a DBus proxy service.
155         This introduces three new dependencies:
156
157         - bwrap executable
158         - libseccomp library
159         - xdg-dbus-proxy executable
160
161         The use of xdg-dbus-proxy will ideally be replaced once upstream DBus
162         gains the same filtering abilities which is a work in progress.
163
164         Currently the sandbox is not completed and there are a few large holes:
165
166         - Pulseaudio: The Pipewire project will solve this.
167         - DRI device access: No immediate solutions planned.
168         - Webcam device access: Pipewire will also solve this.
169         - Webprocess network access: Will require GStreamer changes.
170         - DConf access: Custom proxy planned.
171         - X11 access: Wayland solves this.
172
173         That is not an exhaustive list but are the noteworthy ones. Filesystem access
174         is still an evolving list as problems are found as is specific DBus name access.
175
176         * PlatformGTK.cmake:
177         * PlatformWPE.cmake:
178         * SourcesGTK.txt:
179         * SourcesWPE.txt:
180         * UIProcess/API/glib/WebKitWebContext.cpp:
181         (webkit_web_context_set_sandbox_enabled):
182         (webkit_web_context_get_sandbox_enabled):
183         * UIProcess/API/gtk/WebKitWebContext.h:
184         * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt:
185         * UIProcess/API/wpe/WebKitWebContext.h:
186         * UIProcess/ChildProcessProxy.cpp:
187         (WebKit::ChildProcessProxy::getLaunchOptions):
188         * UIProcess/ChildProcessProxy.h:
189         (WebKit::ChildProcessProxy::platformGetLaunchOptions):
190         * UIProcess/Launcher/ProcessLauncher.h:
191         * UIProcess/Launcher/glib/BubblewrapLauncher.cpp: Added.
192         (WebKit::memfd_create):
193         (WebKit::argsToFd):
194         (WebKit::XDGDBusProxyLauncher::setAddress):
195         (WebKit::XDGDBusProxyLauncher::isRunning const):
196         (WebKit::XDGDBusProxyLauncher::path const):
197         (WebKit::XDGDBusProxyLauncher::proxyPath const):
198         (WebKit::XDGDBusProxyLauncher::setPermissions):
199         (WebKit::XDGDBusProxyLauncher::launch):
200         (WebKit::XDGDBusProxyLauncher::childSetupFunc):
201         (WebKit::XDGDBusProxyLauncher::makeProxyPath):
202         (WebKit::XDGDBusProxyLauncher::dbusAddressToPath):
203         (WebKit::bindIfExists):
204         (WebKit::bindDBusSession):
205         (WebKit::bindX11):
206         (WebKit::bindDconf):
207         (WebKit::bindWayland):
208         (WebKit::bindPulse):
209         (WebKit::bindFonts):
210         (WebKit::bindGtkData):
211         (WebKit::bindA11y):
212         (WebKit::bindPathVar):
213         (WebKit::bindGStreamerData):
214         (WebKit::bindOpenGL):
215         (WebKit::bindV4l):
216         (WebKit::bindSymlinksRealPath):
217         (WebKit::setupSeccomp):
218         (WebKit::bubblewrapSpawn):
219         * UIProcess/Launcher/glib/BubblewrapLauncher.h: Added.
220         * UIProcess/Launcher/glib/FlatpakLauncher.cpp: Added.
221         (WebKit::flatpakSpawn):
222         * UIProcess/Launcher/glib/FlatpakLauncher.h: Added.
223         * UIProcess/Launcher/glib/ProcessLauncherGLib.cpp:
224         (WebKit::isInsideFlatpak):
225         (WebKit::ProcessLauncher::launchProcess):
226         * UIProcess/Plugins/PluginProcessProxy.cpp:
227         (WebKit::PluginProcessProxy::getLaunchOptions):
228         * UIProcess/Plugins/PluginProcessProxy.h:
229         * UIProcess/Plugins/mac/PluginProcessProxyMac.mm:
230         (WebKit::PluginProcessProxy::platformGetLaunchOptionsWithAttributes):
231         * UIProcess/Plugins/unix/PluginProcessProxyUnix.cpp:
232         (WebKit::PluginProcessProxy::platformGetLaunchOptionsWithAttributes):
233         * UIProcess/WebProcessPool.h:
234         * UIProcess/WebProcessProxy.cpp:
235         (WebKit::WebProcessProxy::platformGetLaunchOptions):
236         * UIProcess/WebProcessProxy.h:
237         * UIProcess/glib/WebProcessProxyGLib.cpp: Added.
238         (WebKit::WebProcessProxy::platformGetLaunchOptions):
239
240 2018-10-15  Alex Christensen  <achristensen@webkit.org>
241
242         Add a temporarily off by default preference for doing safe browsing checks
243         https://bugs.webkit.org/show_bug.cgi?id=190522
244
245         Reviewed by Chris Dumez.
246
247         Safe browsing development has taken longer than anticipated.
248         To prevent the unused possible contacting the safe browsing provider for no benefit, make this off by default for now.
249         I'll make it on by default when it's actually used.
250
251         * Shared/WebPreferences.yaml:
252         * UIProcess/API/Cocoa/WKPreferences.mm:
253         (-[WKPreferences _setSafeBrowsingEnabled:]):
254         (-[WKPreferences _safeBrowsingEnabled]):
255         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
256         * UIProcess/WebPageProxy.cpp:
257         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
258
259 2018-10-15  Alex Christensen  <achristensen@webkit.org>
260
261         Include EnumTraits.h less
262         https://bugs.webkit.org/show_bug.cgi?id=190535
263
264         Reviewed by Chris Dumez.
265
266         * NetworkProcess/NetworkSessionCreationParameters.h:
267         * Shared/Authentication/AuthenticationChallengeDisposition.h:
268         * Shared/CoordinateSystem.h:
269         * Shared/LayerTreeContext.h:
270         * Shared/UndoOrRedo.h:
271         * Shared/WebsiteAutoplayPolicy.h:
272         * Shared/WebsitePopUpPolicy.h:
273         * UIProcess/API/APIWebsitePolicies.h:
274         * WebProcess/UserContent/InjectUserScriptImmediately.h:
275
276 2018-10-15  Alex Christensen  <achristensen@webkit.org>
277
278         Remove InjectedBundle processing of back/forward lists
279         https://bugs.webkit.org/show_bug.cgi?id=190459
280
281         Reviewed by Chris Dumez.
282
283         * Shared/API/c/WKDeprecated.h:
284         * UIProcess/API/APINavigationClient.h:
285         (API::NavigationClient::willGoToBackForwardListItem):
286         * UIProcess/Cocoa/NavigationState.h:
287         * UIProcess/Cocoa/NavigationState.mm:
288         (WebKit::NavigationState::NavigationClient::willGoToBackForwardListItem):
289         * UIProcess/WebPageProxy.cpp:
290         (WebKit::WebPageProxy::willGoToBackForwardListItem):
291         * UIProcess/WebPageProxy.h:
292         * UIProcess/WebPageProxy.messages.in:
293         * WebProcess/InjectedBundle/API/APIInjectedBundlePageLoaderClient.h:
294         (API::InjectedBundle::PageLoaderClient::shouldGoToBackForwardListItem): Deleted.
295         * WebProcess/InjectedBundle/API/c/WKBundleBackForwardListItem.cpp:
296         (WKBundleBackForwardListItemCopyOriginalURL):
297         (WKBundleBackForwardListItemCopyTitle):
298         (WKBundleBackForwardListItemIsTargetItem):
299         (WKBundleBackForwardListItemIsInPageCache):
300         (WKBundleBackForwardListItemHasCachedPageExpired):
301         * WebProcess/InjectedBundle/API/c/WKBundleBackForwardListItem.h:
302         * WebProcess/InjectedBundle/API/c/WKBundleFileHandleRef.h:
303         * WebProcess/InjectedBundle/API/c/WKBundleFrame.h:
304         * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp:
305         (WebKit::InjectedBundlePageLoaderClient::InjectedBundlePageLoaderClient):
306         (WebKit::InjectedBundlePageLoaderClient::shouldGoToBackForwardListItem): Deleted.
307         * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h:
308         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
309         (WebKit::WebFrameLoaderClient::shouldGoToHistoryItem const):
310         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
311
312 2018-10-15  Alex Christensen  <achristensen@webkit.org>
313
314         WebPageProxy should always have a HistoryClient
315         https://bugs.webkit.org/show_bug.cgi?id=190450
316
317         Reviewed by Chris Dumez.
318
319         This will make it so we don't forget to null check it.
320         No change in behavior because the default HistoryClient does nothing.
321
322         * UIProcess/API/APIHistoryClient.h:
323         * UIProcess/Cocoa/NavigationState.h:
324         * UIProcess/Cocoa/NavigationState.mm:
325         (WebKit::NavigationState::createHistoryClient):
326         * UIProcess/WebPageProxy.cpp:
327         (WebKit::WebPageProxy::WebPageProxy):
328         (WebKit::WebPageProxy::setHistoryClient):
329         (WebKit::WebPageProxy::didNavigateWithNavigationData):
330         (WebKit::WebPageProxy::didPerformClientRedirect):
331         (WebKit::WebPageProxy::didPerformServerRedirect):
332         (WebKit::WebPageProxy::didUpdateHistoryTitle):
333         * UIProcess/WebPageProxy.h:
334
335 2018-10-15  Alex Christensen  <achristensen@webkit.org>
336
337         Use std::optional<size_t> for a WebBackForwardList's current index
338         https://bugs.webkit.org/show_bug.cgi?id=190448
339
340         Reviewed by Chris Dumez.
341
342         Also remove m_capacity, which was immutable.
343
344         * UIProcess/WebBackForwardList.cpp:
345         (WebKit::WebBackForwardList::WebBackForwardList):
346         (WebKit::WebBackForwardList::~WebBackForwardList):
347         (WebKit::WebBackForwardList::pageClosed):
348         (WebKit::WebBackForwardList::addItem):
349         (WebKit::WebBackForwardList::goToItem):
350         (WebKit::WebBackForwardList::currentItem const):
351         (WebKit::WebBackForwardList::backItem const):
352         (WebKit::WebBackForwardList::forwardItem const):
353         (WebKit::WebBackForwardList::itemAtIndex const):
354         (WebKit::WebBackForwardList::backListCount const):
355         (WebKit::WebBackForwardList::forwardListCount const):
356         (WebKit::WebBackForwardList::backListAsAPIArrayWithLimit const):
357         (WebKit::WebBackForwardList::forwardListAsAPIArrayWithLimit const):
358         (WebKit::WebBackForwardList::removeAllItems):
359         (WebKit::WebBackForwardList::clear):
360         (WebKit::WebBackForwardList::backForwardListState const):
361         (WebKit::WebBackForwardList::restoreFromState):
362         (WebKit::WebBackForwardList::loggingString):
363         * UIProcess/WebBackForwardList.h:
364         (WebKit::WebBackForwardList::currentIndex const): Deleted.
365
366 2018-10-14  Yusuke Suzuki  <yusukesuzuki@slowstart.org>
367
368         [JSC] Remove Option::useAsyncIterator
369         https://bugs.webkit.org/show_bug.cgi?id=190567
370
371         Reviewed by Saam Barati.
372
373         * Configurations/FeatureDefines.xcconfig:
374
375 2018-10-12  Wenson Hsieh  <wenson_hsieh@apple.com>
376
377         [iOS] Allow SPI clients to lay out at arbitrarily scaled sizes and scale to fit the view
378         https://bugs.webkit.org/show_bug.cgi?id=190504
379         <rdar://problem/45117760>
380
381         Reviewed by Tim Horton.
382
383         Add support for _setViewScale: and _viewScale on iOS. While similar in concept to macOS, changing this property
384         on iOS uses viewport configurations to change the minimum layout size of the document and apply view scaling.
385         Setting the view scale on iOS to a value `s` multiplies the minimium layout size by a factor `1 / s`, but also
386         multiplies the initial, minimum and maximum scales by a factor of `s`. The net effect of applying this scale
387         causes the page to lay out at a larger width and shrink (or a smaller width and expand) to fit the viewport.
388
389         * Shared/WebPageCreationParameters.cpp:
390         (WebKit::WebPageCreationParameters::encode const):
391         (WebKit::WebPageCreationParameters::decode):
392         * Shared/WebPageCreationParameters.h:
393
394         Send `viewportConfigurationLayoutSizeScaleFactor` alongside `viewportConfigurationViewLayoutSize`.
395
396         (-[WKWebView _dispatchSetViewLayoutSize:]):
397         (-[WKWebView _viewScale]):
398         (-[WKWebView _setViewScale:]):
399
400         Provide a different implementation of `_setViewScale:` on iOS, by scaling the effective minimum layout size.
401         (See above for more detail).
402
403         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
404
405         Add missing API availability annotations for the _viewScale property.
406
407         * UIProcess/API/mac/WKView.mm:
408         (-[WKView _setViewScale:]):
409         * UIProcess/Cocoa/WebViewImpl.mm:
410
411         Both -[WKView _setViewScale:] and -[WKWebView _setViewScale:] throw Objective C exceptions upon receiving a bad
412         argument (e.g. scale <= 0). However, logic for throwing this exception is specific to iOS in WKWebView, and
413         handled in WebViewImpl on macOS. To make this less confusing, move the exception throwing code out of
414         !PLATFORM(MAC) in WKWebView, and move the path for raising this exception in WKView on macOS from WebViewImpl to
415         WKView.
416
417         * UIProcess/WebPageProxy.cpp:
418         (WebKit::WebPageProxy::creationParameters):
419         * UIProcess/WebPageProxy.h:
420         (WebKit::WebPageProxy::layoutSizeScaleFactor const):
421
422         Tie the notion of "view scale" on iOS to `layoutSizeScaleFactor`. As its name suggests, this is a scale factor
423         by which we transform the layout size.
424
425         * UIProcess/ios/WebPageProxyIOS.mm:
426         (WebKit::WebPageProxy::setViewportConfigurationViewLayoutSize):
427         * WebProcess/WebPage/WebPage.cpp:
428         * WebProcess/WebPage/WebPage.h:
429         * WebProcess/WebPage/WebPage.messages.in:
430
431         Plumb the layout size scale factor over to the web process, along with the layout size.
432
433         * WebProcess/WebPage/ios/WebPageIOS.mm:
434         (WebKit::WebPage::setViewportConfigurationViewLayoutSize):
435
436 2018-10-12  Alex Christensen  <achristensen@webkit.org>
437
438         Allow encoding of small enum classes
439         https://bugs.webkit.org/show_bug.cgi?id=190531
440
441         Reviewed by Tim Horton.
442
443         * NetworkProcess/NetworkLoadClient.h:
444         * Scripts/webkit/messages.py:
445         * Scripts/webkit/parser.py:
446         (parse_parameters_string):
447         * UIProcess/API/APINavigation.h:
448         * UIProcess/WebFramePolicyListenerProxy.h:
449         * UIProcess/WebNavigationState.h:
450         * UIProcess/WebPageProxy.h:
451         * UIProcess/WebPageProxy.messages.in:
452         * WebProcess/WebPage/WebPage.messages.in:
453
454 2018-10-12  Rob Buis  <rbuis@igalia.com>
455
456         Solve the confusion around blankURL() and isBlankURL() in URL
457         https://bugs.webkit.org/show_bug.cgi?id=158988
458
459         Reviewed by Alex Christensen.
460
461         * NetworkProcess/NetworkResourceLoader.cpp:
462         (WebKit::NetworkResourceLoader::continueWillSendRequest):
463         * UIProcess/WebProcessPool.cpp:
464         (WebKit::WebProcessPool::processForNavigationInternal):
465         * UIProcess/WebResourceLoadStatisticsStore.cpp:
466         (WebKit::WebResourceLoadStatisticsStore::logUserInteraction):
467         (WebKit::WebResourceLoadStatisticsStore::clearUserInteraction):
468         (WebKit::WebResourceLoadStatisticsStore::hasHadUserInteraction):
469         (WebKit::WebResourceLoadStatisticsStore::setLastSeen):
470         (WebKit::WebResourceLoadStatisticsStore::setPrevalentResource):
471         (WebKit::WebResourceLoadStatisticsStore::setVeryPrevalentResource):
472         (WebKit::WebResourceLoadStatisticsStore::isPrevalentResource):
473         (WebKit::WebResourceLoadStatisticsStore::isVeryPrevalentResource):
474         (WebKit::WebResourceLoadStatisticsStore::clearPrevalentResource):
475         (WebKit::WebResourceLoadStatisticsStore::setGrandfathered):
476         (WebKit::WebResourceLoadStatisticsStore::isGrandfathered):
477         (WebKit::WebResourceLoadStatisticsStore::setSubframeUnderTopFrameOrigin):
478         (WebKit::WebResourceLoadStatisticsStore::setSubresourceUnderTopFrameOrigin):
479         (WebKit::WebResourceLoadStatisticsStore::setSubresourceUniqueRedirectTo):
480         (WebKit::WebResourceLoadStatisticsStore::setSubresourceUniqueRedirectFrom):
481         (WebKit::WebResourceLoadStatisticsStore::setTopFrameUniqueRedirectTo):
482         (WebKit::WebResourceLoadStatisticsStore::setTopFrameUniqueRedirectFrom):
483
484 2018-10-12  Youenn Fablet  <youenn@apple.com>
485
486         Cache API tests are flaky due to file writing failing from time to time
487         https://bugs.webkit.org/show_bug.cgi?id=190321
488
489         Reviewed by Chris Dumez.
490
491         Make NetworkCache::Storage::store callback return an error in case of writing failure.
492         Use this to surface this error at Cache API level.
493
494         Minor clean-up to make Storage::clear take a completion handler.
495
496         Make also sure to create the folder before writing the file in CacheStorageEngine.
497         As can be seen from some logging, it does happen that writing the 'origin' file sometimes fail with Posix error 9,
498         which might mean the folder is not present.
499
500         Changes are covered by current tests, flaky tests like http/wpt/cache-storage/cache-put-keys.https.any.worker.html
501         will show a "failed writing data to the file system" error message.
502
503         * NetworkProcess/cache/CacheStorageEngine.cpp:
504         (WebKit::CacheStorage::Engine::writeFile):
505         * NetworkProcess/cache/CacheStorageEngine.h:
506         * NetworkProcess/cache/CacheStorageEngineCaches.cpp:
507         (WebKit::CacheStorage::Caches::storeOrigin):
508         (WebKit::CacheStorage::Caches::writeCachesToDisk):
509         (WebKit::CacheStorage::Caches::writeRecord):
510         * NetworkProcess/cache/NetworkCacheStorage.cpp:
511         (WebKit::NetworkCache::Storage::WriteOperation::WriteOperation):
512         (WebKit::NetworkCache::Storage::dispatchWriteOperation):
513         (WebKit::NetworkCache::Storage::finishWriteOperation):
514         (WebKit::NetworkCache::Storage::store):
515         (WebKit::NetworkCache::Storage::clear):
516         * NetworkProcess/cache/NetworkCacheStorage.h:
517         (WebKit::NetworkCache::Storage::store):
518
519 2018-10-11  Youenn Fablet  <youenn@apple.com>
520
521         IOS 12 - Service worker cache not shared when added to homescreen
522         https://bugs.webkit.org/show_bug.cgi?id=190269
523         <rdar://problem/45009961>
524
525         Reviewed by Alex Christensen.
526
527         NetworkProcessProxy does not always have all its stores in its hash map.
528         Make sure to check for the default web process pool store when grabbing cache storage parameters from a given session ID.
529
530         Add a way to remove the default website data for testing.
531         This is used in the new API test.
532
533         * UIProcess/API/APIWebsiteDataStore.cpp:
534         (API::WebsiteDataStore::deleteDefaultDataStoreForTesting):
535         * UIProcess/API/APIWebsiteDataStore.h:
536         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
537         (+[WKWebsiteDataStore _deleteDefaultDataStoreForTesting]):
538         * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
539         * UIProcess/Network/NetworkProcessProxy.cpp:
540         (WebKit::NetworkProcessProxy::retrieveCacheStorageParameters):
541
542 2018-10-10  Simon Fraser  <simon.fraser@apple.com>
543
544         Hide RenderLayer z-order and normal flow lists behind iterators
545         https://bugs.webkit.org/show_bug.cgi?id=190457
546
547         Reviewed by Zalan Bujtas.
548
549         Expose the positive z-order, negative z-order and normal flow lists
550         from RenderLayer as iterators rather than vectors of raw pointers.
551         
552         Use a lambda function to get access to the private constructor, while not having
553         to refer to the nested RenderLayer::LayerIterator class in the header.
554
555         * Shared/WebRenderLayer.cpp:
556         (WebKit::WebRenderLayer::WebRenderLayer):
557         (WebKit::WebRenderLayer::createArrayFromLayerList): Deleted.
558         * Shared/WebRenderLayer.h:
559
560 2018-10-11  Tim Horton  <timothy_horton@apple.com>
561
562         iOS: Scrolling using the arrow keys doesn't show the scroll indicator like it does on macOS
563         https://bugs.webkit.org/show_bug.cgi?id=190478
564         <rdar://problem/22194031>
565
566         Reviewed by Megan Gardner.
567
568         * Platform/spi/ios/UIKitSPI.h:
569         Add some SPI.
570
571         * UIProcess/ios/WKKeyboardScrollingAnimator.mm:
572         (-[WKKeyboardScrollViewAnimator scrollToContentOffset:animated:]):
573         Do a persistent flash when scrolling continuously.
574
575         (-[WKKeyboardScrollViewAnimator scrollWithScrollToExtentAnimationTo:]):
576         Do a single flash when doing a scroll-to-top/bottom.
577
578 2018-10-11  Tim Horton  <timothy_horton@apple.com>
579
580         Clicking on bookmarklet crashes at NavigationState::willRecordNavigationSnapshot
581         https://bugs.webkit.org/show_bug.cgi?id=190476
582         <rdar://problem/32757191>
583
584         Reviewed by Megan Gardner.
585
586         * UIProcess/API/Cocoa/WKWebView.mm:
587         (-[WKWebView _saveBackForwardSnapshotForItem:]):
588         The WKBackForwardListItem can be nil. Then we retrieve a reference from it.
589         An Objective-C method that returns a reference is a great way to get
590         a null reference. Other code then assumes it's not null and crashes.
591         Add a nil check.
592
593 2018-10-11  Tim Horton  <timothy_horton@apple.com>
594
595         Hardware keyboard arrow keys/spacebar don't scroll PDFs (works for web content)
596         https://bugs.webkit.org/show_bug.cgi?id=190495
597         <rdar://problem/22734616>
598
599         Reviewed by Andy Estes.
600
601         Hook up WKKeyboardScrollViewAnimator to the scroll view when
602         WKPDFView is installed.
603
604         * Platform/spi/ios/UIKitSPI.h:
605         Move _inputFlags to the IPI section so we can remove it
606         from WKContentViewInteraction.
607
608         * SourcesCocoa.txt:
609         * UIProcess/ios/WKWebEvent.h:
610         * UIProcess/ios/WKWebEvent.mm:
611         * UIProcess/ios/WKContentViewInteraction.mm:
612         (-[WKContentView handleKeyEvent:]):
613         (-[WKWebEvent dealloc]): Deleted.
614         * WebKit.xcodeproj/project.pbxproj:
615         Move WKWebEvent out of WKContentViewInteraction.
616         We tend to prefer one file per class.
617         Also, move the code to make a WKWebEvent from a UIEvent into
618         -initWithEvent:, instead of being ad-hoc in WKContentViewInteraction.
619         Adopt RetainPtr for the WKWebEvent's uiEvent property.
620
621         * UIProcess/API/Cocoa/WKWebView.mm:
622         (-[WKWebView _handleKeyUIEvent:]):
623         * UIProcess/Cocoa/WKWebViewContentProvider.h:
624         Plumb hardware keyboard events to custom content views, if they want them.
625
626         * UIProcess/ios/WKPDFView.mm:
627         (-[WKPDFView dealloc]):
628         (-[WKPDFView web_handleKeyEvent:]):
629         (-[WKPDFView web_initWithFrame:webView:mimeType:]):
630         Install a WKKeyboardScrollViewAnimator and plumb key events to it.
631
632 2018-10-11  Antoine Quint  <graouts@apple.com>
633
634         [Web Animations] Allow iOS to also control toggling Web Animations CSS Integration
635         https://bugs.webkit.org/show_bug.cgi?id=190489
636
637         Reviewed by Tim Horton.
638
639         * UIProcess/API/Cocoa/WKPreferences.mm:
640         (-[WKPreferences _setWebAnimationsCSSIntegrationEnabled:]):
641         (-[WKPreferences _webAnimationsCSSIntegrationEnabled]):
642         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
643
644 2018-10-11  Keith Rollin  <krollin@apple.com>
645
646         CURRENT_ARCH should not be used in Run Script phase.
647         https://bugs.webkit.org/show_bug.cgi?id=190407
648         <rdar://problem/45133556>
649
650         Reviewed by Alexey Proskuryakov.
651
652         CURRENT_ARCH is used in a number of Xcode Run Script phases. However,
653         CURRENT_ARCH is not well-defined during this phase (and may even have
654         the value "undefined") since this phase is run just once per build
655         rather than once per supported architecture. Migrate away from
656         CURRENT_ARCH in favor of ARCHS, either by iterating over ARCHS and
657         performing an operation for each value, or by picking the first entry
658         in ARCHS and using that as a representative value.
659
660         * DerivedSources.make: When forming TARGET_TRIPLE_FLAGS, grab the
661         first entry in ARCHS rather than use CURRENT_ARCH.
662
663 2018-10-11  Chris Dumez  <cdumez@apple.com>
664
665         Regression(PSON): Deal with the drawing area potentially being null under WebChromeClient::contentsSizeChanged()
666         https://bugs.webkit.org/show_bug.cgi?id=190474
667
668         Reviewed by Geoffrey Garen.
669
670         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
671         (WebKit::WebChromeClient::contentsSizeChanged const):
672
673 2018-10-11  Alejandro G. Castro  <alex@igalia.com>
674
675         [GTK][WPE] Add mediaDevices.enumerateDevices support
676         https://bugs.webkit.org/show_bug.cgi?id=185761
677
678         Reviewed by Youenn Fablet.
679
680         Implemented the enumerateDevices API using a new WebKit class
681         (DeviceIdHashSaltStorage) that generates and stores the device ids
682         hash salts per origin, used to avoid fingerprinting in the
683         webpages.
684
685         The patch also adds a new type of data for the WebsiteDataStore.
686         That way the users can call the WebsiteDataStore to show what
687         origins have hash salt generated and remove them at some point.
688
689         For the moment just GTK+ and WPE ports are using this class to
690         generate the hash salts. The patch adds code to the
691         checkUserMediaPermissionForOrigin API implementation, it was empty
692         until now for these ports. In this function we create an instance
693         of a new class WebKitDeviceInfoPermissionRequest that implements
694         the WebKitPermissionRequestIface interface, that allows the ports
695         to use the current permission managers implemented in the
696         embedders to handle this new kind of request the way they like
697         it. The default implementation is deny.
698
699         The class WebKitDeviceInfoPermissionRequest takes care of
700         contacting the DeviceIdHashSaltStorage and request/regenerate the
701         hash salts accordingly.
702
703         Persistency is still not implemented, we will add it in a
704         future patch.
705
706         * Shared/WebsiteData/WebsiteDataType.h: Added the new type of
707         webside data: DeviceIdHashSalt.
708         * Sources.txt: Added new files to compilation.
709         * SourcesGTK.txt: Ditto.
710         * SourcesWPE.txt: Ditto.
711         * UIProcess/API/glib/WebKitDeviceInfoPermissionRequest.cpp: Added
712         this class to represent a request of permission to access the
713         devices information. This is specific for glib ports and implements
714         the policies regarding the hash salts when the embedder allows or
715         denies the access using the DeviceIdHashSaltStorage class.
716         (webkitDeviceInfoPermissionRequestAllow): Get the device hash salt
717         when the origin is allowed and set it in the original request.
718         (webkitDeviceInfoPermissionRequestDeny): Regenerate the device id
719         hash salt when the user does not allow to access the device information.
720         (webkit_permission_request_interface_init):
721         (webkitDeviceInfoPermissionRequestDispose):
722         (webkit_device_info_permission_request_class_init):
723         (webkitDeviceInfoPermissionRequestCreate): Create the class using
724         the proxy request from the webprocess and a reference to the
725         DeviceIdHashSaltStorage.
726         * UIProcess/API/glib/WebKitDeviceInfoPermissionRequestPrivate.h:
727         Ditto.
728         * UIProcess/API/glib/WebKitUIClient.cpp: Added the implementation
729         for the checkUserMediaPermissionForOrigin API for the glib ports,
730         it creates the device info request and calls the permission
731         request API.
732         * UIProcess/API/glib/WebKitWebsiteData.cpp:
733         (recordContainsSupportedDataTypes): Added the DeviceIdHashSalt
734         type.
735         (toWebKitWebsiteDataTypes): Added the conversion from the WebKit
736         types to the glib types for the WebsiteDataType::DeviceIdHashSalt.
737         * UIProcess/API/glib/WebKitWebsiteDataManager.cpp:
738         (toWebsiteDataTypes): Added the conversion from the glib type
739         WEBKIT_WEBSITE_DATA_DEVICE_ID_HASH_SALT to the WebKit type.
740         (webkit_website_data_manager_remove): Make sure we remote the
741         DeviceIdHashSalt if the Cookies are selected.
742         * UIProcess/API/gtk/WebKitDeviceInfoPermissionRequest.h: Added
743         this new class that represents a permission request for the device
744         information in the GTK+ port.
745         * UIProcess/API/gtk/WebKitWebsiteData.h: Added the new type of
746         website that in the GTK+ port:
747         WEBKIT_WEBSITE_DATA_DEVICE_ID_HASH_SALT.
748         * UIProcess/API/wpe/WebKitDeviceInfoPermissionRequest.h: Added
749         this new class that represents a permission request for the device
750         information in the WPE port.
751         * UIProcess/API/wpe/WebKitWebsiteData.h: Added the new type of
752         website that in the WPE port:
753         WEBKIT_WEBSITE_DATA_DEVICE_ID_HASH_SALT.
754         * UIProcess/DeviceIdHashSaltStorage.cpp: Added this new class that
755         handles how to generate and store the hash salts inside
756         WebKit. Persistency is still not implemented, we will add it in a
757         future patch.
758         (WebKit::DeviceIdHashSaltStorage::create):
759         (WebKit::DeviceIdHashSaltStorage::deviceIdentifierHashSaltForOrigin):
760         Check the map to get the hash salt for an origin, if there is none
761         create a new random one.
762         (WebKit::DeviceIdHashSaltStorage::regenerateDeviceIdentifierHashSaltForOrigin):
763         Delete the hash salt of an origin if it already exists and create a new one.
764         (WebKit::DeviceIdHashSaltStorage::getDeviceIdHashSaltOrigins):
765         Returns the list of origins that have a hash salt generated for
766         them. It is used in the WebsiteDataStore.
767         (WebKit::DeviceIdHashSaltStorage::deleteDeviceIdHashSaltForOrigins):
768         Deletes the hash salts in the map for an origin.
769         (WebKit::DeviceIdHashSaltStorage::deleteDeviceIdHashSaltOriginsModifiedSince):
770         Delete the origins that have not been modified since a time.
771         * UIProcess/DeviceIdHashSaltStorage.h: Ditto.
772         * UIProcess/UserMediaPermissionCheckProxy.h: Remove uneeded class
773         definition.
774         * UIProcess/WebsiteData/WebsiteDataStore.cpp: Added support to
775         return and remove the origins with a generate hash salt used to
776         generate the device ids.
777         (WebKit::WebsiteDataStore::WebsiteDataStore): Added the new
778         reference to the DeviceIdHashSaltStorage class, used to handle the
779         hash salts.
780         (WebKit::WebsiteDataStore::fetchDataAndApply): Get the list of
781         origins with a hash salts in the DeviceIdHashSaltStorage.
782         (WebKit::WebsiteDataStore::removeData): Remove the hash salts in
783         DeviceIdHashSaltStorage for an origin.
784         * UIProcess/WebsiteData/WebsiteDataStore.h: Ditto.
785         (WebKit::WebsiteDataStore::deviceIdHashSaltStorage):
786         * WebKit.xcodeproj/project.pbxproj: Added the
787         DeviceIdHashSaltStorage to the compilation.
788
789 2018-10-10  Tim Horton  <timothy_horton@apple.com>
790
791         Safari crashes when attempting to share a YouTube video while in full-screen
792         https://bugs.webkit.org/show_bug.cgi?id=190456
793         <rdar://problem/45130748>
794
795         Reviewed by Wenson Hsieh.
796
797         * Platform/spi/ios/UIKitSPI.h:
798         * UIProcess/Cocoa/WKShareSheet.mm:
799         (-[WKShareSheet presentWithParameters:completionHandler:]):
800         Allow the share sheet to present centered, since we don't have enough
801         context to put it in a more sensible place.
802
803 2018-10-10  Tim Horton  <timothy_horton@apple.com>
804
805         REGRESSION (r236935): Layout test fast/events/ios/keyboard-scrolling-distance.html is timing out
806         https://bugs.webkit.org/show_bug.cgi?id=190444
807         <rdar://problem/45110698>
808
809         Reviewed by Simon Fraser.
810
811         There's a race in WKKeyboardScrollingAnimator that's exacerbated by HIDEventGenerator
812         being much faster than a human finger. We get our "begin" events from interpretKeyEvent,
813         after the Web Content process has had its way with it, but currently the
814         back-channel "handle" events (e.g. for key up, which doesn't go to interpretKeyEvent)
815         are retrieved from handleKeyWebEvent in the UI process, which is *before*
816         the Web Content process has had a swing at it.
817
818         If you lose the race (an insanely short tap like you get from HIDEventGenerator,
819         or with a very busy Web Content process), we see handle(keyDown), handle(keyUp), begin(keyDown),
820         and get stuck scrolling!
821
822         Instead, retrieve the out-of-band "handle" events from _didHandleKeyEvent,
823         so that they're sensibly and strictly ordered with respect to the timing of interpretKeyEvent/"begin".
824
825         Also, hook up didFinishScrolling, so that UIScriptController's callbacks work correctly.
826
827         * UIProcess/API/Cocoa/WKWebViewInternal.h:
828         * UIProcess/ios/WKContentViewInteraction.mm:
829         (-[WKContentView handleKeyWebEvent:]):
830         (-[WKContentView _didHandleKeyEvent:eventWasHandled:]):
831         (-[WKContentView keyboardScrollViewAnimatorDidFinishScrolling:]):
832         * UIProcess/ios/WKKeyboardScrollingAnimator.h:
833         * UIProcess/ios/WKKeyboardScrollingAnimator.mm:
834         (-[WKKeyboardScrollingAnimator handleKeyEvent:]):
835         (-[WKKeyboardScrollingAnimator displayLinkFired:]):
836         (-[WKKeyboardScrollViewAnimator setDelegate:]):
837         (-[WKKeyboardScrollViewAnimator handleKeyEvent:]):
838         (-[WKKeyboardScrollViewAnimator didFinishScrolling]):
839
840 2018-10-10  Tim Horton  <timothy_horton@apple.com>
841
842         Share more WKShareSheet code between macOS and iOS, and fix a few bugs
843         https://bugs.webkit.org/show_bug.cgi?id=190420
844
845         Reviewed by Simon Fraser.
846
847         * UIProcess/API/Cocoa/WKWebView.mm:
848         (-[WKWebView _resolutionForShareSheetImmediateCompletionForTesting]):
849         (-[WKWebView _setShareSheetCompletesImmediatelyWithResolutionForTesting:]):
850         (-[WKWebView _invokeShareSheetWithResolution:]): Deleted.
851         Add a new mechanism to tell the share sheet up-front that it should
852         immediately dismiss with a particular resolution, for testing.
853         See the Tools ChangeLog for justification.
854         We keep the bit on WKWebView instead of WKShareSheet so that it can be
855         called prior to invoking the share sheet.
856
857         * UIProcess/API/Cocoa/WKWebViewInternal.h:
858         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
859         * UIProcess/Cocoa/WKShareSheet.h:
860         * UIProcess/Cocoa/WKShareSheet.mm:
861         (-[WKShareSheet initWithView:]):
862         (-[WKShareSheet presentWithParameters:completionHandler:]):
863         (-[WKShareSheet sharingServicePicker:didChooseSharingService:]):
864         (-[WKShareSheet _didCompleteWithSuccess:]):
865         (-[WKShareSheet dismiss]):
866         (-[WKShareSheet dispatchDidDismiss]):
867         (-[WKShareSheet initWithView:initWithView:]): Deleted.
868         (-[WKShareSheet _dispatchDidDismiss]): Deleted.
869         (-[WKShareSheet _cancel]): Deleted.
870         (-[WKShareSheet _dismissDisplayAnimated:]): Deleted.
871         (-[WKShareSheet _presentFullscreenViewController:animated:]): Deleted.
872         (-[WKShareSheet invokeShareSheetWithResolution:]): Deleted.
873         Reduce the number of extraneous members, methods, and #ifdefs.
874         Try to share as much of WKShareSheet between the platforms as makes sense.
875         The interface is now totally identical on the two platforms.
876
877         * UIProcess/Cocoa/WebViewImpl.mm:
878         (WebKit::WebViewImpl::showShareSheet):
879         * UIProcess/ios/WKContentViewInteraction.h:
880         * UIProcess/ios/WKContentViewInteraction.mm:
881         (-[WKContentView _showShareSheet:completionHandler:]):
882         (-[WKContentView invokeShareSheetWithResolution:]): Deleted.
883         Instead of silently failing (without even calling the completion handler!)
884         if we try to present one share sheet on top of another, dismiss the first
885         and present the new one. This is important because there are (separately
886         filed) bugs on both platforms where the completion handler is not called;
887         now, instead of a tab getting stuck forever, we'll reject the promise
888         when another share takes place.
889
890 2018-10-10  Tim Horton  <timothy_horton@apple.com>
891
892         REGRESSION (r236678): Keyboard scrolling with arrow keys doesn't work on iOS
893         https://bugs.webkit.org/show_bug.cgi?id=190433
894         <rdar://problem/45111986>
895
896         Reviewed by Simon Fraser.
897
898         * UIProcess/ios/WKKeyboardScrollingAnimator.mm:
899         (-[WKKeyboardScrollingAnimator keyboardScrollForEvent:]):
900         (-[WKKeyboardScrollingAnimator beginWithEvent:]): Deleted.
901         (-[WKKeyboardScrollViewAnimator beginWithEvent:]): Deleted.
902         r236678 changes the characters in charactersIgnoringModifiers to match AppKit.
903         We similarly need to update WKKeyboardScrollingAnimator's comparison.
904
905 2018-10-10  Yusuke Suzuki  <yusukesuzuki@slowstart.org>
906
907         [JSC] Rename createXXX to tryCreateXXX if it can return RefPtr
908         https://bugs.webkit.org/show_bug.cgi?id=190429
909
910         Reviewed by Saam Barati.
911
912         Use `tryCreate` or new `create`. If we use new `create`, we can use Ref<> and remove null check.
913
914         * Shared/API/c/WKString.cpp:
915         (WKStringCopyJSString):
916         * WebProcess/Automation/WebAutomationSessionProxy.cpp:
917         (WebKit::toJSValue):
918         (WebKit::callPropertyFunction):
919         (WebKit::WebAutomationSessionProxy::scriptObjectForFrame):
920         (WebKit::WebAutomationSessionProxy::evaluateJavaScriptFunction):
921         * WebProcess/Plugins/PDF/PDFPlugin.mm:
922         (WebKit::PDFPlugin::runScriptsInPDFDocument):
923
924 2018-10-10  Chris Dumez  <cdumez@apple.com>
925
926         Regression(PSON): Assertion hit under WebPageProxy::didNavigateWithNavigationData()
927         https://bugs.webkit.org/show_bug.cgi?id=190418
928         <rdar://problem/45059769>
929
930         Reviewed by Geoffrey Garen.
931
932         When process swapping and "suspending" the previous WebProcess in a SuspendedPageProxy,
933         we need to keep around the main frame's ID that still exists on in this process. This
934         is needed so that we can re-create a UI-side WebFrameProxy for the WebFrame that exists
935         in the WebProcess, if we ever swap back to this suspended process (see login in
936         WebPageProxy::swapToWebProcess()).
937
938         The bug was that the main frame ID was stored on the WebPageProxy via m_mainFrameID instead of the
939         SuspendedPageProxy. This means that m_mainFrameID would get overriden when navigating in the new
940         WebProcess with the value 1 (because WebFrame identifiers start at 1 and are per-WebProcess).
941         This would lead to us constructing a WebFrameProxy with the wrong frame identifier in
942         WebPageProxy::swapToWebProcess(), which would override an existing unrelated WebFrame in the
943         WebProcessProxy's HashMap of frames. This would lead to crashes later on as the WebFrame
944         would not be associated to the WebPageProxy we expect.
945
946         * UIProcess/SuspendedPageProxy.cpp:
947         (WebKit::SuspendedPageProxy::SuspendedPageProxy):
948         * UIProcess/SuspendedPageProxy.h:
949         (WebKit::SuspendedPageProxy::mainFrameID const):
950         * UIProcess/WebPageProxy.cpp:
951         (WebKit::WebPageProxy::maybeCreateSuspendedPage):
952         (WebKit::WebPageProxy::swapToWebProcess):
953         (WebKit::WebPageProxy::continueNavigationInNewProcess):
954         (WebKit::WebPageProxy::didCreateMainFrame):
955         * UIProcess/WebPageProxy.h:
956         * UIProcess/WebProcessProxy.cpp:
957         (WebKit::WebProcessProxy::suspendWebPageProxy):
958         * UIProcess/WebProcessProxy.h:
959
960 2018-10-10  Antti Koivisto  <antti@apple.com>
961
962         Do domain prewarming for processes for new tabs
963         https://bugs.webkit.org/show_bug.cgi?id=190425
964
965         Reviewed by Chris Dumez.
966
967         We currently only do domain prewarming for navigation process swaps.
968
969         * UIProcess/WebProcessPool.cpp:
970         (WebKit::WebProcessPool::processForNavigationInternal):
971
972         Do domain prewarming when using an existing but so far unused process.
973
974         (WebKit::WebProcessPool::tryPrewarmWithDomainInformation):
975
976         Factor into a function.
977
978         * UIProcess/WebProcessPool.h:
979         * WebProcess/WebPage/WebPage.cpp:
980         (WebKit::WebPage::close):
981
982         This didn't usually get invoked.
983
984         (WebKit::WebPage::didReceivePolicyDecision):
985         (WebKit::WebPage::didFinishLoad):
986
987         Update prewarm information when a top level load finishes.
988
989         * WebProcess/WebProcess.cpp:
990         (WebKit::WebProcess::sendPrewarmInformation):
991         * WebProcess/WebProcess.h:
992
993 2018-10-09  Antoine Quint  <graouts@apple.com>
994
995         Remove the frames() timing function
996         https://bugs.webkit.org/show_bug.cgi?id=190034
997         <rdar://problem/44827544>
998
999         Reviewed by Dean Jackson.
1000
1001         * Shared/WebCoreArgumentCoders.cpp:
1002         (IPC::ArgumentCoder<FramesTimingFunction>::encode): Deleted.
1003         (IPC::ArgumentCoder<FramesTimingFunction>::decode): Deleted.
1004         * Shared/WebCoreArgumentCoders.h:
1005         * WebProcess/WebPage/RemoteLayerTree/PlatformCAAnimationRemote.mm:
1006         (WebKit::PlatformCAAnimationRemote::Properties::encode const):
1007         (WebKit::PlatformCAAnimationRemote::Properties::decode):
1008
1009 2018-10-09  Youenn Fablet  <youenn@apple.com>
1010
1011         ASSERTION FAILED: m_cachesLocks.contains(sessionID) in WebKit::CacheStorageEngineConnection::dereference(PAL::SessionID, unsigned long long)
1012         https://bugs.webkit.org/show_bug.cgi?id=190373
1013         <rdar://problem/45106402>
1014
1015         Reviewed by Alex Christensen.
1016
1017         This assertion can be hit if:
1018         - WebProcess has a DOMCache
1019         - NetworkProcess crashes
1020         - WebProcess navigates and dereference DOMCache.
1021         Remove this assertion as it is hit when a test is using testRunner.terminateNetworkProcess().
1022
1023         * NetworkProcess/cache/CacheStorageEngineConnection.cpp:
1024         (WebKit::CacheStorageEngineConnection::dereference):
1025
1026 2018-10-09  Jer Noble  <jer.noble@apple.com>
1027
1028         Crash when closing WKWebView during enter fullscreen animation
1029         https://bugs.webkit.org/show_bug.cgi?id=190412
1030
1031         Reviewed by Brian Burg.
1032
1033         We need a valid _webView if, during -[NSWindow close], we catch a notification saying we failed to enter
1034         fullscreen and try to replace the placeholder with the actual _webView.
1035
1036         * UIProcess/mac/WKFullScreenWindowController.mm:
1037         (-[WKFullScreenWindowController close]):
1038
1039 2018-10-09  Alex Christensen  <achristensen@webkit.org>
1040
1041         REGRESSION(r231663) loading in hidden WKWebViews stalls because WebProcess is suspended
1042         https://bugs.webkit.org/show_bug.cgi?id=190417
1043         <rdar://problem/43391014>
1044
1045         Reviewed by Chris Dumez.
1046
1047         * UIProcess/Cocoa/NavigationState.mm:
1048         (WebKit::NavigationState::didChangeIsLoading):
1049         Revert r321663, but keep the change to TestWKWebView.mm because that made the tests more reliable.
1050
1051 2018-10-09  Chris Dumez  <cdumez@apple.com>
1052
1053         Allow behavior when the parent process IPC::Connection closes to be overridden by ChildProcess subclasses
1054         https://bugs.webkit.org/show_bug.cgi?id=190294
1055
1056         Reviewed by Geoffrey Garen.
1057
1058         Allow behavior when the parent process IPC::Connection closes to be overridden by ChildProcess subclasses.
1059         This will be useful to allow the NetworkProcess to not exit if it still has pending downloads.
1060
1061         * NetworkProcess/NetworkProcess.cpp:
1062         (WebKit::callExitSoon):
1063         (WebKit::NetworkProcess::initializeConnection):
1064         * NetworkProcess/NetworkProcess.h:
1065         * PluginProcess/PluginProcess.cpp:
1066         (WebKit::callExit):
1067         (WebKit::PluginProcess::initializeConnection):
1068         * PluginProcess/PluginProcess.h:
1069         * Shared/ChildProcess.cpp:
1070         (WebKit::ChildProcess::didClose):
1071         (WebKit::ChildProcess::initialize):
1072         (WebKit::callExitNow): Deleted.
1073         (WebKit::callExitSoon): Deleted.
1074         * Shared/ChildProcess.h:
1075         (WebKit::ChildProcess::shouldCallExitWhenConnectionIsClosed const): Deleted.
1076         * WebProcess/WebProcess.cpp:
1077         (WebKit::callExit):
1078         (WebKit::WebProcess::initializeConnection):
1079
1080 2018-10-09  Jer Noble  <jer.noble@apple.com>
1081
1082         WebDriver: thrown ObjC exception under -[WKFullScreenWindowController windowDidFailToEnterFullScreen:] when session is terminated
1083         https://bugs.webkit.org/show_bug.cgi?id=190098
1084         <rdar://problem/42822671>
1085
1086         Reviewed by Brian Burg.
1087
1088         Forcibly exit fullscreen in resetState(), while the VideoFullscreenManagerProxy is still valid.
1089
1090         * UIProcess/WebPageProxy.cpp:
1091         (WebKit::WebPageProxy::resetState):
1092
1093 2018-10-09  Daniel Bates  <dabates@apple.com>
1094
1095         [iOS] Ignore some deprecated declarations
1096         https://bugs.webkit.org/show_bug.cgi?id=190371
1097
1098         Reviewed by Dan Bernstein.
1099
1100         * UIProcess/ios/WKActionSheet.mm:
1101         (-[WKActionSheet init]):
1102         (-[WKActionSheet presentSheet:]):
1103         * UIProcess/ios/WKActionSheetAssistant.mm:
1104         (-[WKActionSheetAssistant presentSheet]):
1105         * UIProcess/ios/WKContentViewInteraction.mm:
1106         * UIProcess/ios/forms/WKFormSelectPicker.mm:
1107         (-[WKMultipleSelectPicker initWithView:]):
1108         * UIProcess/ios/forms/WKFormSelectPopover.mm:
1109         (-[WKSelectTableViewController initWithView:hasGroups:]):
1110
1111 2018-10-09  Claudio Saavedra  <csaavedra@igalia.com>
1112
1113         [WPE] Explicitly link against gmodule where used
1114         https://bugs.webkit.org/show_bug.cgi?id=190398
1115
1116         Reviewed by Michael Catanzaro.
1117
1118         * PlatformWPE.cmake:
1119
1120 2018-10-09  Chris Dumez  <cdumez@apple.com>
1121
1122         PSON: Doing a cross-site navigation via the URL bar does not swap process on iOS
1123         https://bugs.webkit.org/show_bug.cgi?id=190378
1124         <rdar://problem/45059466>
1125
1126         Reviewed by Geoffrey Garen.
1127
1128         Process swapping was sometimes not happening via URL bar navigation on iOS due to top-hit preloading,
1129         which would use a new WKWebView for the speculative load and rely on the _relatedWebView SPI to use
1130         the same WebContent process as the view currently on screen.
1131
1132         To address the issue, if the source URL is empty and the page has a related page, use the related
1133         page's URL as source URL when doing the process-swap decision.
1134
1135         * UIProcess/API/APIPageConfiguration.cpp:
1136         (API::PageConfiguration::relatedPage const):
1137         (API::PageConfiguration::relatedPage): Deleted.
1138         * UIProcess/API/APIPageConfiguration.h:
1139         * UIProcess/WebProcessPool.cpp:
1140         (WebKit::WebProcessPool::processForNavigationInternal):
1141
1142 2018-10-09  Andy Estes  <aestes@apple.com>
1143
1144         [iOS] Replace @"UIPreviewDataAttachmentListIsContentManaged" with a UIKit constant
1145         https://bugs.webkit.org/show_bug.cgi?id=190400
1146         <rdar://problem/35442879>
1147
1148         Reviewed by Wenson Hsieh.
1149
1150         Also fixed the iOS version check in WKContentViewInteraction.mm.
1151
1152         * Platform/spi/ios/UIKitSPI.h:
1153         * UIProcess/ios/WKContentViewInteraction.mm:
1154         (-[WKContentView _dataForPreviewItemController:atPosition:type:]):
1155
1156 2018-10-09  Tim Horton  <timothy_horton@apple.com>
1157
1158         REGRESSION (r232416): Can not scroll after swiping back on quoteunquoteapps.com
1159         https://bugs.webkit.org/show_bug.cgi?id=190377
1160         <rdar://problem/45108222>
1161
1162         Reviewed by Andy Estes.
1163
1164         Introduce the notion of 'pausing' to SnapshotRemovalTracker.
1165         Reimplement r232416 in terms of this: the SnapshotRemovalTracker
1166         starts out paused (not accepting events), and un-pauses when
1167         we get a provisional load or same-document navigation.
1168         This way, we don't lose the watchdog timer in cases where we get
1169         no provisional load, same-document navigation, or main frame load
1170         (which is the separate root cause for this bug -- this just papers
1171         over it with a timeout).
1172
1173         * UIProcess/Cocoa/ViewGestureController.cpp:
1174         (WebKit::ViewGestureController::didStartProvisionalLoadForMainFrame):
1175         (WebKit::ViewGestureController::didSameDocumentNavigationForMainFrame):
1176         Resume the snapshot removal tracker.
1177
1178         (WebKit::ViewGestureController::didReachMainFrameLoadTerminalState):
1179         If we didn't see a provisional load or same document navigation,
1180         but somehow got to the terminal load state, immediately remove the snapshot.
1181         
1182         (WebKit::ViewGestureController::SnapshotRemovalTracker::resume):
1183         (WebKit::ViewGestureController::SnapshotRemovalTracker::start):
1184         Start the SnapshotRemovalTracker out in the paused state; it will be
1185         resumed in the same places we previously would call the
1186         provisionalOrSameDocumentLoadCallback.
1187
1188         (WebKit::ViewGestureController::SnapshotRemovalTracker::stopWaitingForEvent):
1189         Ignore (but debug log) incoming events while paused.
1190
1191         * UIProcess/Cocoa/ViewGestureController.h:
1192         (WebKit::ViewGestureController::SnapshotRemovalTracker::pause):
1193         (WebKit::ViewGestureController::SnapshotRemovalTracker::isPaused const):
1194         Add the pausing bit.
1195
1196         * UIProcess/ios/ViewGestureControllerIOS.mm:
1197         (WebKit::ViewGestureController::endSwipeGesture):
1198         * UIProcess/mac/ViewGestureControllerMac.mm:
1199         (WebKit::ViewGestureController::endSwipeGesture):
1200         Remove m_provisionalOrSameDocumentLoadCallback.
1201
1202 2018-10-09  Antti Koivisto  <antti@apple.com>
1203
1204         Prewarm FontDatabase on process swap
1205         https://bugs.webkit.org/show_bug.cgi?id=190312
1206
1207         Reviewed by Chris Dumez.
1208
1209         Add mechanism for caching prewarm information per domain on UI process side. This information
1210         is then passed to newly initialized web processes that are being used for the same domain.
1211
1212         * UIProcess/WebPageProxy.h:
1213         * UIProcess/WebProcessPool.cpp:
1214         (WebKit::WebProcessPool::processForNavigationInternal):
1215
1216         Pass prewarm information on process swap to the new process.
1217
1218         (WebKit::WebProcessPool::didCollectPrewarmInformation):
1219
1220         UI process side cache.
1221
1222         * UIProcess/WebProcessPool.h:
1223         * UIProcess/WebProcessProxy.cpp:
1224         (WebKit::WebProcessProxy::didCollectPrewarmInformation):
1225         * UIProcess/WebProcessProxy.h:
1226         * UIProcess/WebProcessProxy.messages.in:
1227         * WebProcess/WebPage/WebPage.cpp:
1228         (WebKit::WebPage::close):
1229         (WebKit::WebPage::didReceivePolicyDecision):
1230
1231         Collect and cache prewarm information for the previous process on process swap.
1232
1233         * WebProcess/WebProcess.cpp:
1234         (WebKit::WebProcess::prewarmGlobally):
1235
1236         Renamed for clarity.
1237
1238         (WebKit::WebProcess::prewarmWithDomainInformation):
1239         (WebKit::WebProcess::sendPrewarmInformation):
1240         * WebProcess/WebProcess.h:
1241         * WebProcess/WebProcess.messages.in:
1242
1243 2018-10-08  Wenson Hsieh  <wenson_hsieh@apple.com>
1244
1245         [Cocoa] [WK2] Add support for text alignment and text lists in font attributes
1246         https://bugs.webkit.org/show_bug.cgi?id=190342
1247         <rdar://problem/44767118>
1248
1249         Reviewed by Tim Horton.
1250
1251         Add encoding and decoding for text alignment and text lists in FontAttributes.
1252
1253         * Shared/WebCoreArgumentCoders.cpp:
1254         (IPC::ArgumentCoder<FontAttributes>::encode):
1255         (IPC::ArgumentCoder<FontAttributes>::decode):
1256
1257 2018-10-08  Justin Fan  <justin_fan@apple.com>
1258
1259         WebGPU: Rename old WebGPU prototype to WebMetal
1260         https://bugs.webkit.org/show_bug.cgi?id=190325
1261         <rdar://problem/44990443>
1262
1263         Reviewed by Dean Jackson.
1264
1265         Rename WebGPU prototype files to WebMetal in preparation for implementing the new (Oct 2018) WebGPU interface.
1266
1267         * Configurations/FeatureDefines.xcconfig:
1268         * Shared/WebPreferences.yaml:
1269         * WebProcess/InjectedBundle/InjectedBundle.cpp:
1270         (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner):
1271
1272 2018-10-08  Wenson Hsieh  <wenson_hsieh@apple.com>
1273
1274         Followup to r236942: Make input type=color an internal feature
1275         https://bugs.webkit.org/show_bug.cgi?id=189162
1276
1277         Rubber-stamped by Dean Jackson.
1278
1279         I've learned from Dean that an internal feature is more suitable than an experimental feature in this scenario.
1280
1281         * Shared/WebPreferences.yaml:
1282
1283 2018-10-08  Aditya Keerthi  <akeerthi@apple.com>
1284
1285         Make <input type=color> a runtime enabled (on-by-default) feature
1286         https://bugs.webkit.org/show_bug.cgi?id=189162
1287
1288         Reviewed by Wenson Hsieh and Tim Horton.
1289
1290         * Configurations/FeatureDefines.xcconfig:
1291         * Shared/WebPreferences.yaml:
1292
1293         Add an experimental feature flag for input type=color.
1294
1295         * UIProcess/mac/WebColorPickerMac.mm:
1296         (-[WKPopoverColorWell webDelegate]):
1297         (-[WKPopoverColorWell setWebDelegate:]):
1298
1299 2018-10-08  Tim Horton  <timothy_horton@apple.com>
1300
1301         Try to fix the build
1302
1303         * UIProcess/ios/WKKeyboardScrollingAnimator.mm:
1304
1305 2018-10-08  Brian Burg  <bburg@apple.com>
1306
1307         [Mac] Web Automation: some keyboard interactions don't generate events, causing event simulation to stall
1308         https://bugs.webkit.org/show_bug.cgi?id=190316
1309         <rdar://problem/42833290>
1310
1311         Reviewed by Tim Horton.
1312
1313         Some users have reported that Cmd-A for Select All no longer works in safaridriver.
1314         Instead, this hangs the session. This happens because the WebAutomationSession class
1315         assumes that each call to simulateKeyboardInteraction causes keyboard events to be processed,
1316         but in corner cases like Cmd-A, some events that we simulate are swallowed by AppKit and
1317         never make it back to WebKit. Because the session never gets the "keyboard events flushed"
1318         callback, it assumes the interaction is still ongoing, and never returns, causing a hang.
1319
1320         This patch consists of two parts:
1321          - Add logging of important state changes and events when simulating user input.
1322          - Make code more robust when simulating key actions that generate no events on macOS.
1323
1324         This change progresses WPT test key_shortcuts.py::test_mod_a_and_backspace_deletes_all_text on Mac.
1325
1326         * Platform/Logging.h: Add a logging channel.
1327         * UIProcess/Automation/SimulatedInputDispatcher.cpp:
1328         (WebKit::SimulatedInputDispatcher::keyFrameTransitionDurationTimerFired):
1329         (WebKit::SimulatedInputDispatcher::transitionBetweenKeyFrames):
1330         (WebKit::SimulatedInputDispatcher::transitionInputSourceToState):
1331         (WebKit::SimulatedInputDispatcher::run):
1332         (WebKit::SimulatedInputDispatcher::finishDispatching):
1333         Add a bunch of logging so its easier to figure out where things get stuck.
1334
1335         * UIProcess/Automation/WebAutomationSession.cpp:
1336         (WebKit::WebAutomationSession::simulateKeyboardInteraction):
1337         In some cases, no keyboard events need to be processed for the simulated interaction.
1338         When that happens, early exit rather than waiting for keyboard events to be flushed.
1339
1340         * UIProcess/Automation/mac/WebAutomationSessionMac.mm:
1341         (WebKit::WebAutomationSession::sendSynthesizedEventsToPage): Logging.
1342         (WebKit::WebAutomationSession::platformSimulateKeyboardInteraction):
1343         On Mac, if you tap a character key while Command is held down, only a KeyDown event
1344         is forwarded to the first responder by AppKit, even if you send a KeyUp event too.
1345         In this case don't send an NSEvent since it won't ever be delivered back to WebKit.
1346
1347         * UIProcess/WebPageProxy.h:
1348         * UIProcess/WebPageProxy.cpp:
1349         (WebKit::WebPageProxy::isProcessingKeyboardEvents const): Expose this state for keyboard
1350         events too.
1351
1352 2018-10-08  Youenn Fablet  <youenn@apple.com>
1353
1354         NetworkCache::Storage should be WTF::DestructionThread::Main
1355         https://bugs.webkit.org/show_bug.cgi?id=190324
1356
1357         Reviewed by Alex Christensen.
1358
1359         Use WTF::DestructionThread::Main to make sure that Storage is destroyed in the main thread.
1360         Remove the code that was making sure that any ref was destroyed in the main thread.
1361
1362         * NetworkProcess/cache/CacheStorageEngineCaches.cpp: Make sure the completion handler is not null.
1363         * NetworkProcess/cache/NetworkCacheStorage.cpp:
1364         (WebKit::NetworkCache::Storage::TraverseOperation::TraverseOperation): Make it clear that a ref is taken.
1365         (WebKit::NetworkCache::Storage::Storage):
1366         (WebKit::NetworkCache::Storage::synchronize): Protect 'this' when dispatching back to the main thread.
1367         Move the code that was after dispatch before dispatch to allow moving protectedThis in the dispatch lambda.
1368         (WebKit::NetworkCache::Storage::remove):
1369         (WebKit::NetworkCache::Storage::traverse):
1370         (WebKit::NetworkCache::Storage::clear):
1371         (WebKit::NetworkCache::Storage::deleteOldVersions):
1372         * NetworkProcess/cache/NetworkCacheStorage.h:
1373
1374 2018-10-08  Tim Horton  <timothy_horton@apple.com>
1375
1376         Adjust keyboard scrolling animator to springy and semiphysical
1377         https://bugs.webkit.org/show_bug.cgi?id=190345
1378         <rdar://problem/43494393>
1379
1380         Reviewed by Simon Fraser.
1381
1382         Introduce WKKeyboardScrollViewAnimator, which wraps WKKeyboardScrollingAnimator
1383         and provides a reasonable set of default behaviors for UIScrollView.
1384         This is the first step on the way to WKKeyboardScrollingAnimator
1385         being platform- and toolkit-agnostic, and helps avoid adding a whole
1386         bunch of code to WKContentView.
1387
1388         Adopt UIKit's scroll-to-top animation curve for whole-document scrolls.
1389
1390         Adjust WKKeyboardScrollingAnimator's physics; it now simulates a spring
1391         attached to the page when decelerating. When a key is pressed, it applies
1392         a constant force to the page (up to some maximum velocity). When released,
1393         the spring causes the page to decelerate smoothly.
1394
1395         Add rubber-banding to keyboard scrolling, based on the same spring that
1396         decelerates the page.
1397
1398         Remove the initial bounce on keydown before starting the smooth scroll.
1399
1400         Remove arrow key commands from WKContentView; this avoids double-processing
1401         incoming arrow key events, makes the event stream make more sense, and was
1402         entirely unnecessary.
1403
1404         * Platform/spi/ios/UIKitSPI.h:
1405         Add a wide variety of useful SPI.
1406
1407         * UIProcess/API/Cocoa/WKWebView.mm:
1408         * UIProcess/API/Cocoa/WKWebViewInternal.h:
1409         Remove _scrollByContentOffset:animated: because it's only used by
1410         the keyboard scrolling mechanism.
1411
1412         Remove _arrowKey because we're removing the arrow key commands.
1413
1414         * UIProcess/ios/WKContentViewInteraction.h:
1415         * UIProcess/ios/WKContentViewInteraction.mm:
1416         (-[WKContentView setupInteraction]):
1417         Create a WKKeyboardScrollViewAnimator (which knows how to directly
1418         manipulate a UIScrollView) instead of a WKKeyboardScrollingAnimator
1419         (which requires its clients to implement everything in terms of an
1420         abstract interface.
1421
1422         (-[WKContentView scrollViewWillStartPanOrPinchGesture]):
1423         Inform the keyboard scrolling animator that the user is going to start
1424         an interactive gesture that needs control of the scroll view, so it
1425         can stop its current animated scroll.
1426
1427         (-[WKContentView canPerformActionForWebView:withSender:]):
1428         (-[WKContentView keyCommands]):
1429         (-[WKContentView _arrowKeyForWebView:]): Deleted.
1430         Remove arrow key commands.
1431
1432         (-[WKContentView keyboardScrollViewAnimator:distanceForIncrement:]):
1433         Scale from content to WKWebView coordinate space; the keyboard scrolling
1434         animator operates in WKWebView coordinates. This was broken before.
1435
1436         (-[WKContentView keyboardScrollViewAnimatorWillScroll:]):
1437         (-[WKContentView isScrollableForKeyboardScrollViewAnimator:]):
1438         (-[WKContentView isKeyboardScrollable]): Deleted.
1439         (-[WKContentView distanceForScrollingIncrement:]): Deleted.
1440         (-[WKContentView scrollByContentOffset:animated:]): Deleted.
1441         Reimplement these as keyboardScrollViewAnimator delegate methods.
1442
1443         * UIProcess/ios/WKKeyboardScrollingAnimator.h:
1444         Add WKKeyboardScrollViewAnimator, hide the interface for
1445         WKKeyboardScrollingAnimator itself in the implementation file.
1446
1447         * UIProcess/ios/WKKeyboardScrollingAnimator.mm:
1448         (-[WKKeyboardScrollingAnimator initWithScrollable:]):
1449         (-[WKKeyboardScrollingAnimator parameters]):
1450         (-[WKKeyboardScrollingAnimator invalidate]):
1451         (unitVector):
1452         Return a unit vector in the given direction.
1453
1454         (perpendicularAbsoluteUnitVector):
1455         Return a positive unit vector perpendicular to the axis of the given direction.
1456         Useful for multiplying with another vector to remove the component in the
1457         axis of the given direction.
1458
1459         (boxSide):
1460         Convert ScrollingDirection to WebCore::PhysicalBoxSide, for use with RectEdges.
1461
1462         (-[WKKeyboardScrollingAnimator keyboardScrollForEvent:]):
1463         Instead of just returning the desired increment, compute everything we'll need
1464         for the lifetime of the scroll (including the force applied, maximum
1465         velocity, etc.) and return them together.
1466
1467         (-[WKKeyboardScrollingAnimator beginWithEvent:]):
1468         Use the scrollable's native scroll-to-extent animation (e.g. UIScrollView's
1469         scroll-to-top curve) for whole-document scrolls.
1470
1471         Remove the first discrete scroll; start the smooth scroll immediately.
1472
1473         (-[WKKeyboardScrollingAnimator handleKeyEvent:]):
1474         (farthestPointInDirection):
1475         (-[WKKeyboardScrollingAnimator stopAnimatedScroll]):
1476         Stop the current scroll. Let the spring coast to its natural stopping
1477         point given the system's current energy, unless that stopping point is
1478         less than one increment from the starting point. In that case, we attach
1479         the spring to /that/ point and let it run.
1480
1481         (-[WKKeyboardScrollingAnimator startDisplayLinkIfNeeded]):
1482         (-[WKKeyboardScrollingAnimator stopDisplayLink]):
1483         (-[WKKeyboardScrollingAnimator willStartInteractiveScroll]):
1484         Immediately stop all motion if the user touches the screen to scroll
1485         or zoom with fingers.
1486
1487         (-[WKKeyboardScrollingAnimator displayLinkFired:]):
1488         Update the position of the scrollable based on the applied force and spring.
1489         See the comments in this function for more details.
1490
1491         (-[WKKeyboardScrollViewAnimator init]):
1492         (-[WKKeyboardScrollViewAnimator initWithScrollView:]):
1493         (-[WKKeyboardScrollViewAnimator dealloc]):
1494         (-[WKKeyboardScrollViewAnimator invalidate]):
1495         (-[WKKeyboardScrollViewAnimator setDelegate:]):
1496         (-[WKKeyboardScrollViewAnimator willStartInteractiveScroll]):
1497         (-[WKKeyboardScrollViewAnimator beginWithEvent:]):
1498         (-[WKKeyboardScrollViewAnimator handleKeyEvent:]):
1499         (-[WKKeyboardScrollViewAnimator isKeyboardScrollable]):
1500         (-[WKKeyboardScrollViewAnimator distanceForIncrement:]):
1501         (-[WKKeyboardScrollViewAnimator scrollToContentOffset:animated:]):
1502         (-[WKKeyboardScrollViewAnimator scrollWithScrollToExtentAnimationTo:]):
1503         (-[WKKeyboardScrollViewAnimator contentOffset]):
1504         (-[WKKeyboardScrollViewAnimator boundedContentOffset:]):
1505         (-[WKKeyboardScrollViewAnimator interactiveScrollVelocity]):
1506         (-[WKKeyboardScrollViewAnimator scrollableDirectionsFromOffset:]):
1507         (-[WKKeyboardScrollViewAnimator rubberbandableDirections]):
1508         Add WKKeyboardScrollViewAnimator, which wraps WKKeyboardScrollingAnimator
1509         and provides animated keyboard scrolling for a UIScrollView without much
1510         additional plumbing work. It contains reasonable default behaviors,
1511         with a few optional delegate methods for customization.
1512
1513         (-[WKKeyboardScrollingAnimator _scrollOffsetForEvent:]): Deleted.
1514         (-[WKKeyboardScrollingAnimator startAnimatedScroll]): Deleted.
1515
1516 2018-10-08  Jeremy Jones  <jeremyj@apple.com>
1517
1518         Remove dead code: VideoFullscreenModel::isVisible()
1519         https://bugs.webkit.org/show_bug.cgi?id=190356
1520
1521         Reviewed by Jon Lee.
1522
1523         Remove isVisible since it is no longer used.
1524
1525         * UIProcess/Cocoa/VideoFullscreenManagerProxy.h:
1526         * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm:
1527         (WebKit::VideoFullscreenModelContext::isVisible const): Deleted.
1528         (WebKit::VideoFullscreenManagerProxy::isVisible const): Deleted.
1529
1530 2018-10-08  Jeremy Jones  <jeremyj@apple.com>
1531
1532         Remove dead code: resetMediaState.
1533         https://bugs.webkit.org/show_bug.cgi?id=190355
1534
1535         Reviewed by Jon Lee.
1536
1537         Remove resetMediaState since it is no longer used.
1538
1539         * UIProcess/Cocoa/PlaybackSessionManagerProxy.h:
1540         * UIProcess/Cocoa/PlaybackSessionManagerProxy.messages.in:
1541         * UIProcess/Cocoa/PlaybackSessionManagerProxy.mm:
1542         (WebKit::PlaybackSessionManagerProxy::resetMediaState): Deleted.
1543         * WebProcess/cocoa/PlaybackSessionManager.h:
1544         * WebProcess/cocoa/PlaybackSessionManager.mm:
1545         (WebKit::PlaybackSessionInterfaceContext::resetMediaState): Deleted.
1546
1547 2018-10-08  Jeremy Jones  <jeremyj@apple.com>
1548
1549         Use MediaPlayerEnums::VideoGravity in VideoFullscreenModel.
1550         https://bugs.webkit.org/show_bug.cgi?id=190357
1551
1552         Reviewed by Jon Lee.
1553
1554         Use MediaPlayerEnums::VideoGravity instead of creating another identical enum in VideoFullscreenModel.
1555
1556         * UIProcess/Cocoa/VideoFullscreenManagerProxy.h:
1557         * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm:
1558         (WebKit::VideoFullscreenModelContext::setVideoLayerGravity):
1559         (WebKit::VideoFullscreenManagerProxy::setVideoLayerGravity):
1560         * WebProcess/cocoa/VideoFullscreenManager.mm:
1561         (WebKit::VideoFullscreenManager::setVideoLayerGravityEnum):
1562
1563 2018-10-08  Alex Christensen  <achristensen@webkit.org>
1564
1565         Remove WKBundleFileHandleRef
1566         https://bugs.webkit.org/show_bug.cgi?id=190360
1567
1568         Reviewed by Tim Horton.
1569
1570         WKBundleFrameGetJavaScriptWrapperForFileForWorld and WKBundleFileHandleCreateWithPath were only used in Mail
1571         and were removed in rdar://problem/44955158
1572         I need to remove them for rdar://problem/24576194
1573
1574         * Shared/API/APIObject.h:
1575         * Shared/API/c/WKDeprecated.h:
1576         * Shared/API/c/WKDeprecatedFunctions.cpp:
1577         (WKBundleFrameGetJavaScriptWrapperForFileForWorld):
1578         (WKBundleFileHandleCreateWithPath):
1579         * Sources.txt:
1580         * SourcesCocoa.txt:
1581         * WebKit.xcodeproj/project.pbxproj:
1582         * WebProcess/InjectedBundle/API/c/WKBundleAPICast.h:
1583         * WebProcess/InjectedBundle/API/c/WKBundleFileHandleRef.cpp: Removed.
1584         * WebProcess/InjectedBundle/API/c/WKBundleFileHandleRef.h:
1585         * WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp:
1586         (WKBundleFrameGetJavaScriptWrapperForFileForWorld): Deleted.
1587         * WebProcess/InjectedBundle/API/c/WKBundleFrame.h:
1588         * WebProcess/InjectedBundle/DOM/InjectedBundleFileHandle.cpp: Removed.
1589         * WebProcess/InjectedBundle/DOM/InjectedBundleFileHandle.h: Removed.
1590         * WebProcess/WebPage/WebFrame.cpp:
1591         * WebProcess/WebPage/WebFrame.h:
1592
1593 2018-10-08  Konstantin Tokarev  <annulen@yandex.ru>
1594
1595         Validation in Connection::readBytesFromSocket() is too aggressive
1596         https://bugs.webkit.org/show_bug.cgi?id=190281
1597
1598         Reviewed by Michael Catanzaro.
1599
1600         Since r217206 Connection::readBytesFromSocket() validates size of
1601         control message. However, it compares cmsg_len with attachmentMaxAmount,
1602         while Connection::sendOutgoingMessage() computes it as
1603         CMSG_LEN(sizeof(int) * attachmentFDBufferLength) where
1604         attachmentFDBufferLength <= attachmentMaxAmount. This mismatch between
1605         sender and receiver leads to possibility of assertion failure with large
1606         number of attachments, e.g. here 62 attachments have cmsg_length == 264.
1607
1608         * Platform/IPC/unix/ConnectionUnix.cpp:
1609         (IPC::readBytesFromSocket):
1610
1611 2018-10-08  Chris Dumez  <cdumez@apple.com>
1612
1613         Have DOMWindowProperty get is frame from its associated DOMWindow
1614         https://bugs.webkit.org/show_bug.cgi?id=190341
1615
1616         Reviewed by Alex Christensen.
1617
1618         * WebProcess/InjectedBundle/InjectedBundleDOMWindowExtension.cpp:
1619         (WebKit::InjectedBundleDOMWindowExtension::InjectedBundleDOMWindowExtension):
1620
1621 2018-10-07  Dan Bernstein  <mitz@apple.com>
1622
1623         Tried to fix HAVE(LINK_PREVIEW) iOS builds.
1624
1625         * UIProcess/WKImagePreviewViewController.mm:
1626         (-[WKImagePreviewViewController previewActions]):
1627
1628 2018-10-06  Dan Bernstein  <mitz@apple.com>
1629
1630         Tried to fix the macOS Mojave build.
1631
1632         * UIProcess/API/Cocoa/LegacyBundleForClass.mm:
1633
1634 2018-10-06  Dan Bernstein  <mitz@apple.com>
1635
1636         WebKit part of [Xcode] Update some build settings as recommended by Xcode 10
1637         https://bugs.webkit.org/show_bug.cgi?id=190250
1638
1639         Reviewed by Andy Estes.
1640
1641         * Configurations/Base.xcconfig: Enabled CLANG_WARN_COMMA,
1642           CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS, CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF, and
1643           CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED.
1644
1645         * WebKit.xcodeproj/project.pbxproj: Let Xcode update LastUpgradeCheck.
1646
1647         * UIProcess/API/Cocoa/WKBrowsingContextController.mm:
1648         * UIProcess/API/Cocoa/WKBrowsingContextGroup.mm:
1649         * UIProcess/API/Cocoa/WKConnection.mm:
1650         * UIProcess/API/Cocoa/WKNavigationData.mm:
1651         * UIProcess/API/Cocoa/WKProcessGroup.mm:
1652         * UIProcess/API/Cocoa/WKTypeRefWrapper.mm:
1653         * UIProcess/API/Cocoa/WKWebView.mm:
1654         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
1655         * UIProcess/API/Cocoa/_WKWebsiteDataStore.mm:
1656         * UIProcess/API/mac/WKView.mm:
1657         * WebProcess/Plugins/PDF/PDFPlugin.mm:
1658         * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectMac.mm:
1659
1660           Suppressed -Wdeprecated-implementations around some class, category and method
1661           implementations the above files.
1662
1663 2018-10-05  Alex Christensen  <achristensen@webkit.org>
1664
1665         REGRESSION(r236154) Page loads are not drawn when loaded in shipped Safari11/12
1666         https://bugs.webkit.org/show_bug.cgi?id=190202
1667
1668         Reviewed by Youenn Fablet.
1669
1670         Safari11/12 had a WKPageLoaderClient and a WKPageNavigationClient.
1671         It did not actually draw the page until its WKPageNavigationClient.renderingProgressDidChange was called.
1672         r236154 made it so we only call WKPageLoaderClient.didLayout if an application has both clients.
1673         This fixes open source WebKit running with shipped Safari.
1674
1675         * UIProcess/WebPageProxy.cpp:
1676         (WebKit::WebPageProxy::didReachLayoutMilestone):
1677
1678 2018-10-05  Chris Dumez  <cdumez@apple.com>
1679
1680         [PSON] Drop snapshotting workaround introduced in r235898
1681         https://bugs.webkit.org/show_bug.cgi?id=190314
1682
1683         Reviewed by Geoffrey Garen.
1684
1685         Drop snapshotting workaround introduced in r235898 as it is no longer needed now
1686         that the flashing bug has been fixed.
1687
1688         * UIProcess/WebPageProxy.cpp:
1689         (WebKit::WebPageProxy::continueNavigationInNewProcess):
1690
1691 2018-10-05  Eric Carlson  <eric.carlson@apple.com>
1692
1693         [MediaStream] RealtimeMediaSource should be able to vend hashed IDs
1694         https://bugs.webkit.org/show_bug.cgi?id=190142
1695         <rdar://problem/44911109>
1696
1697         Reviewed by Youenn Fablet.
1698
1699         * Shared/WebCoreArgumentCoders.cpp:
1700         (IPC::ArgumentCoder<MediaConstraints>::encode):
1701         (IPC::ArgumentCoder<MediaConstraints>::decode):
1702         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp:
1703         (WebKit::UserMediaCaptureManagerProxy::createMediaSourceForCaptureDeviceWithConstraints):
1704         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.h:
1705         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.messages.in:
1706         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
1707         (WebKit::UserMediaPermissionRequestManagerProxy::requestUserMediaPermissionForFrame):
1708         * WebProcess/cocoa/UserMediaCaptureManager.cpp:
1709         (WebKit::UserMediaCaptureManager::Source::Source):
1710         (WebKit::UserMediaCaptureManager::createCaptureSource):
1711         * WebProcess/cocoa/UserMediaCaptureManager.h:
1712
1713 2018-10-03  Jer Noble  <jer.noble@apple.com>
1714
1715         Add support for reporting "display composited video frames" through the VideoPlaybackQuality object.
1716         https://bugs.webkit.org/show_bug.cgi?id=190266
1717
1718         Reviewed by Eric Carlson.
1719
1720         Add a new preference to control the visibility of displayCompositedVideoFrames in the VideoPlaybackQualityObject.
1721
1722         * Shared/WebPreferences.yaml:
1723         * UIProcess/API/Cocoa/WKPreferences.mm:
1724         (-[WKPreferences _setVideoQualityIncludesDisplayCompositingEnabled:]):
1725         (-[WKPreferences _videoQualityIncludesDisplayCompositingEnabled]):
1726         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
1727
1728 2018-10-05  Ryan Haddad  <ryanhaddad@apple.com>
1729
1730         Unreviewed, rolling out r236866.
1731
1732         Breaks internal builds.
1733
1734         Reverted changeset:
1735
1736         "Add support for reporting "display composited video frames"
1737         through the VideoPlaybackQuality object."
1738         https://bugs.webkit.org/show_bug.cgi?id=190266
1739         https://trac.webkit.org/changeset/236866
1740
1741 2018-10-05  Zach Li  <zachli@apple.com>
1742
1743         Expose whether WKWebProcessPlugInNodeHandle is a select element to clients
1744         https://bugs.webkit.org/show_bug.cgi?id=190302
1745         <rdar://problem/45031469>
1746
1747         Reviewed by Tim Horton.
1748
1749         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandle.h:
1750         Introduce a new property `isSelectElement`.
1751         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandle.mm:
1752         (-[WKWebProcessPlugInNodeHandle isSelectElement]):
1753         * WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp:
1754         (WebKit::InjectedBundleNodeHandle::isSelectElement const):
1755         Check whether the node is a select element.
1756         * WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.h:
1757
1758 2018-10-04  Wenson Hsieh  <wenson_hsieh@apple.com>
1759
1760         [iOS] [WK2] Expose some more editing SPI on WKWebView
1761         https://bugs.webkit.org/show_bug.cgi?id=190232
1762         <rdar://problem/44963368>
1763
1764         Reviewed by Tim Horton.
1765
1766         Exposes a few additional editing commands as SPI on WKWebView, by defining a new extension on WKWebView that
1767         also conforms to <UIResponderStandardEditActions>. This patch implements nearly all of the remaining
1768         unimplemented methods on UIResponderStandardEditActions, and the new extension augments this set of editing
1769         methods by adding additional editing helpers that don't currently exist on iOS (e.g. toggleStrikeThrough and
1770         insertUnorderedList). The names of these new methods have been largely been borrowed from their counterparts on
1771         macOS (see: `NSResponder.h`).
1772
1773         The new edit actions are added in this patch on iOS are:
1774
1775         ```
1776         - (void)alignCenter:(id)sender;
1777         - (void)alignJustified:(id)sender;
1778         - (void)alignLeft:(id)sender;
1779         - (void)alignRight:(id)sender;
1780         - (void)indent:(id)sender;
1781         - (void)insertOrderedList:(id)sender;
1782         - (void)insertUnorderedList:(id)sender;
1783         - (void)outdent:(id)sender;
1784         - (void)toggleStrikeThrough:(id)sender;
1785         - (void)setFont:(UIFont *)font sender:(id)sender;
1786         - (void)setFontSize:(CGFloat)fontSize sender:(id)sender;
1787         - (void)setTextColor:(UIColor *)color sender:(id)sender;
1788         ```
1789
1790         Tests:  WKWebViewEditActions.ListInsertion
1791                 WKWebViewEditActions.ChangeIndentation
1792                 WKWebViewEditActions.SetAlignment
1793                 WKWebViewEditActions.ToggleStrikeThrough
1794                 WKWebViewEditActions.ChangeFontSize
1795                 WKWebViewEditActions.SetTextColor
1796                 WKWebViewEditActions.SetFontFamily
1797
1798         * Platform/spi/ios/UIKitSPI.h:
1799         * UIProcess/API/Cocoa/WKWebView.mm:
1800         (-[WKWebView canPerformAction:withSender:]):
1801
1802         Update this to handle the new editing actions. For now, we simply treat all of the new edit actions in the same
1803         way as we currently treat bold, italic and underline: that is, they are enabled only when the user is in a
1804         richly contenteditable element.
1805
1806         (-[WKWebView setFont:sender:]):
1807         (-[WKWebView setFontSize:sender:]):
1808
1809         Construct and send a set of FontChanges.
1810
1811         (-[WKWebView setTextColor:sender:]):
1812
1813         Invoke "ForeColor" with the serialized color representation. This allows us to handle `rgba()` color values,
1814         which hex format would not permit.
1815
1816         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1817
1818         Add the new SPI.
1819
1820         * UIProcess/WebPageProxy.cpp:
1821         (WebKit::WebPageProxy::changeFontAttributes):
1822         (WebKit::WebPageProxy::changeFont):
1823
1824         Pull logic for applying font and font attribute style changes out of macOS-specific code, and into
1825         platform-agnostic code in WebPage and WebPageProxy.
1826
1827         * UIProcess/WebPageProxy.h:
1828         * UIProcess/ios/WKContentViewInteraction.h:
1829
1830         Add the new supported editing commands as supported actions in WKWebView. The only new editing commands that
1831         aren't present in this list are -setFont:sender:, -setColor:sender:, and -setFontSize:sender: which are manually
1832         handled in places where the `FOR_EACH_WKCONTENTVIEW_ACTION` macro is otherwise used. In a followup, we could
1833         consider augmenting `FOR_EACH_WKCONTENTVIEW_ACTION` to handle actions with multiple arguments.
1834
1835         * UIProcess/ios/WKContentViewInteraction.mm:
1836
1837         Define a new helper macro here to define boilerplate implementations of the -…ForWebView edit command
1838         implementations that turn around and invoke `_page->executeEditCommand` with no additional arguments, and an
1839         edit command name matching that of the WebCore edit command.
1840
1841         (-[WKContentView toggleStrikeThroughForWebView:]):
1842         (-[WKContentView increaseSizeForWebView:]):
1843         (-[WKContentView decreaseSizeForWebView:]):
1844         (-[WKContentView setFontForWebView:sender:]):
1845         (-[WKContentView setFontSizeForWebView:sender:]):
1846         (-[WKContentView setTextColorForWebView:sender:]):
1847         (-[WKContentView canPerformActionForWebView:sender:]):
1848
1849         Add …ForWebView plumbing for the new editing actions, so they turn around and call into WKContentView by
1850         default, but behavior may be overridden in WKWebView.
1851
1852         * UIProcess/mac/WebPageProxyMac.mm:
1853         (WebKit::WebPageProxy::changeFontAttributes): Deleted.
1854         (WebKit::WebPageProxy::changeFont): Deleted.
1855         * WebProcess/WebPage/WebPage.cpp:
1856         (WebKit::WebPage::changeFontAttributes):
1857         (WebKit::WebPage::changeFont):
1858         * WebProcess/WebPage/WebPage.h:
1859         * WebProcess/WebPage/WebPage.messages.in:
1860         * WebProcess/WebPage/mac/WebPageMac.mm:
1861         (WebKit::WebPage::changeFontAttributes): Deleted.
1862         (WebKit::WebPage::changeFont): Deleted.
1863
1864 2018-10-04  Jer Noble  <jer.noble@apple.com>
1865
1866         Add support for reporting "display composited video frames" through the VideoPlaybackQuality object.
1867         https://bugs.webkit.org/show_bug.cgi?id=190266
1868
1869         Reviewed by Eric Carlson.
1870
1871         Add a new preference to control the visibility of displayCompositedVideoFrames in the VideoPlaybackQualityObject.
1872
1873         * Shared/WebPreferences.yaml:
1874         * UIProcess/API/Cocoa/WKPreferences.mm:
1875         (-[WKPreferences _setVideoQualityIncludesDisplayCompositingEnabled:]):
1876         (-[WKPreferences _videoQualityIncludesDisplayCompositingEnabled]):
1877         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
1878
1879 2018-10-04  Wenson Hsieh  <wenson_hsieh@apple.com>
1880
1881         [Cocoa] Add SPI to expose typing attributes at the current selection on WKWebView
1882         https://bugs.webkit.org/show_bug.cgi?id=190119
1883         <rdar://problem/44767062>
1884
1885         Reviewed by Tim Horton.
1886
1887         Add support for new WebKit2 SPI to notify the UI delegate about font attributes when the editor state changes
1888         (e.g. due to selection changes, or executing an edit command). See below for more detail.
1889
1890         Test: FontAttributes.FontAttributesAfterChangingSelection
1891
1892         * Shared/EditorState.cpp:
1893         (WebKit::EditorState::PostLayoutData::encode const):
1894         (WebKit::EditorState::PostLayoutData::decode):
1895         * Shared/EditorState.h:
1896
1897         Add a new optional `FontAttributes` member to EditorState's post-layout data. FontAttributes are computed and
1898         sent over IPC only if the UI delegate implements the new delegate hook which requires information about font
1899         attributes.
1900
1901         * Shared/WebPageCreationParameters.cpp:
1902         (WebKit::WebPageCreationParameters::encode const):
1903         (WebKit::WebPageCreationParameters::decode):
1904         * Shared/WebPageCreationParameters.h:
1905
1906         Add a new flag for the UI process to let a new web page know whether it should additionally compute font
1907         attributes when computing editor state.
1908
1909         * UIProcess/API/APIUIClient.h:
1910         (API::UIClient::needsFontAttributes const):
1911         (API::UIClient::didChangeFontAttributes):
1912         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
1913         * UIProcess/API/Cocoa/WKWebView.mm:
1914         (-[WKWebView _didChangeEditorState]):
1915         * UIProcess/Cocoa/UIDelegate.h:
1916         * UIProcess/Cocoa/UIDelegate.mm:
1917         (WebKit::UIDelegate::setDelegate):
1918         (WebKit::UIDelegate::UIClient::didChangeFontAttributes):
1919
1920         Call out to the UI delegate with a font attribute dictionary, created via FontAttributes on EditorState's
1921         post-layout data.
1922
1923         * UIProcess/WebPageProxy.cpp:
1924         (WebKit::WebPageProxy::setUIClient):
1925
1926         Update whether or not the UI process needs to know about font attributes. The UI process only requires font
1927         attribute information if the UI delegate implements `-_webView:didChangeFontAttributes:`.
1928
1929         (WebKit::WebPageProxy::setNeedsFontAttributes):
1930         (WebKit::WebPageProxy::creationParameters):
1931         * UIProcess/WebPageProxy.h:
1932         * UIProcess/ios/WebPageProxyIOS.mm:
1933         (WebKit::WebPageProxy::editorStateChanged):
1934         * UIProcess/mac/WebPageProxyMac.mm:
1935         (WebKit::WebPageProxy::editorStateChanged):
1936
1937         Update the cached font attributes in the UI process when receiving a new editor state update.
1938
1939         * WebProcess/WebPage/WebPage.cpp:
1940         (WebKit::m_cpuLimit):
1941         (WebKit::WebPage::editorState const):
1942         (WebKit::WebPage::setNeedsFontAttributes):
1943
1944         Add a new IPC hook to update whether or not the page should additionally compute font attributes. In the case
1945         where the UI delegate changes from something that does not require font attributes to one that does, we
1946         additionally schedule an editor state update.
1947
1948         (WebKit::WebPage::updateFontAttributesAfterEditorStateChange):
1949
1950         Private helper function to plumb FontAttributes to the UI client after an editor state change.
1951
1952         * WebProcess/WebPage/WebPage.h:
1953         * WebProcess/WebPage/WebPage.messages.in:
1954
1955 2018-10-04  Jeremy Jones  <jeremyj@apple.com>
1956
1957         Unify implementation in VideoFullscreenInterfaceAVKit
1958         https://bugs.webkit.org/show_bug.cgi?id=190091
1959         rdar://problem/44734523
1960
1961         Reviewed by Jer Noble.
1962
1963         Unified code in VideoFullscreenInterfaceAVKit now that new code path is proven and include
1964         any changes that had been made in the old path.
1965
1966         * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm:
1967         * WebProcess/cocoa/VideoFullscreenManager.mm:
1968         (WebKit::VideoFullscreenManager::supportsVideoFullscreenStandby const):
1969         (WebKit::VideoFullscreenManager::didSetupFullscreen):
1970         (WebKit::VideoFullscreenManager::didExitFullscreen):
1971
1972 2018-10-04  Matt Lewis  <jlewis3@apple.com>
1973
1974         Unreviewed, rolling out r236730.
1975
1976         This caused a consistent crash in test http/tests/media/media-
1977         stream/get-display-media-prompt.html.
1978
1979         Reverted changeset:
1980
1981         "[MediaStream] RealtimeMediaSource should be able to vend
1982         hashed IDs"
1983         https://bugs.webkit.org/show_bug.cgi?id=190142
1984         https://trac.webkit.org/changeset/236730
1985
1986 2018-10-04  Brian Burg  <bburg@apple.com>
1987
1988         Web Automation: clear pending callbacks when the session terminates
1989         https://bugs.webkit.org/show_bug.cgi?id=190259
1990         <rdar://problem/44958352>
1991
1992         Reviewed by Joseph Pecoraro.
1993
1994         WebAutomationSession::terminate() can be called at any time to nuke the session.
1995         However, it's possible that the session is in the midst of simulating keyboard/mouse
1996         events. While in that state, there are some CompletionHandler objects waiting
1997         for key/mouse events to be flushed. We need to empty out callback maps with
1998         CompletionHandler instances so that they do not assert because they were never called.
1999
2000         I was able to test this manually by running a test that erroneously hangs
2001         while waiting for keyboard input. While the test was hung, I killed the NetworkProcess
2002         manually to trigger WebAutomationSession::terminate(). From there, I saw that the
2003         Perform Actions REST API call gets cancelled with the appropriate error code.
2004
2005         * UIProcess/Automation/WebAutomationSession.cpp:
2006         (WebKit::WebAutomationSession::terminate):
2007
2008 2018-10-04  Jiewen Tan  <jiewen_tan@apple.com>
2009
2010         [WebAuthN] Move time out control from WebProcess to UIProcess
2011         https://bugs.webkit.org/show_bug.cgi?id=189642
2012         <rdar://problem/44476765>
2013
2014         Reviewed by Chris Dumez.
2015
2016         Besides adding a time out timer in the AuthenticatorManager, this patch also adds a new
2017         option in MockWebAuthenticationConfiguration to turn on silent failure which is the
2018         default policy of treating authenticators' error as suggested by spec.
2019
2020         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
2021         (WKWebsiteDataStoreSetWebAuthenticationMockConfiguration):
2022         * UIProcess/WebAuthentication/AuthenticatorManager.cpp:
2023         (WebKit::AuthenticatorManagerInternal::collectTransports):
2024         (WebKit::AuthenticatorManager::makeCredential):
2025         (WebKit::AuthenticatorManager::getAssertion):
2026         (WebKit::AuthenticatorManager::respondReceived):
2027         (WebKit::AuthenticatorManager::initTimeOutTimer):
2028         * UIProcess/WebAuthentication/AuthenticatorManager.h:
2029         (WebKit::AuthenticatorManager::requestTimeOutTimer):
2030         * UIProcess/WebAuthentication/Mock/MockAuthenticatorManager.cpp:
2031         (WebKit::MockAuthenticatorManager::respondReceivedInternal):
2032         * UIProcess/WebAuthentication/Mock/MockWebAuthenticationConfiguration.h:
2033
2034 2018-10-04  Yuhan Wu  <yuhan_wu@apple.com>
2035
2036         runtime flag and IDL for MediaRecorder
2037         https://bugs.webkit.org/show_bug.cgi?id=190018
2038
2039         Reviewed by Youenn Fablet and Chris Dumez.
2040
2041         * Shared/WebPreferences.yaml:
2042
2043 2018-10-03  Dan Bernstein  <mitz@apple.com>
2044
2045         Tried to fix non-Cocoa, ENABLE(ATTACHMENT_ELEMENT) builds after r236822.
2046
2047         * UIProcess/PageClient.h:
2048
2049 2018-10-03  Dan Bernstein  <mitz@apple.com>
2050
2051         [Cocoa] Let clients specify an NSFileWrapper subclassed to be used for _WKAttachment
2052         https://bugs.webkit.org/show_bug.cgi?id=190270
2053
2054         Reviewed by Wenson Hsieh.
2055
2056         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
2057         (-[WKWebViewConfiguration copyWithZone:]): Copy new _attachmentFileWrapperClass ivar.
2058         (-[WKWebViewConfiguration _attachmentFileWrapperClass]): Added this getter.
2059         (-[WKWebViewConfiguration _setAttachmentFileWrapperClass:]): Added this setter, which raises
2060           an exception if the argument is not an NSFileWrapper subclass.
2061
2062         * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h: Declared new property.
2063
2064         * UIProcess/Cocoa/PageClientImplCocoa.h:
2065         * UIProcess/Cocoa/PageClientImplCocoa.mm:
2066         (WebKit::PageClientImplCocoa::allocFileWrapperInstance): Added. Allocates an instance of
2067           the class specified in the configuration, or NSFileWrapper if no custom class is specified.
2068
2069         * UIProcess/Cocoa/WebPageProxyCocoa.mm:
2070         (WebKit::WebPageProxy::platformRegisterAttachment): Use PageClient::allocFileWrapperInstance
2071           instead of allocating an NSFileWrapper instance.
2072
2073         * UIProcess/PageClient.h:
2074         (WebKit::PageClient::allocFileWrapperInstance): Defined new function. The default
2075           implementation returns nil.
2076
2077 2018-10-03  Youenn Fablet  <youenn@apple.com>
2078
2079         Add VP8 support to WebRTC
2080         https://bugs.webkit.org/show_bug.cgi?id=189976
2081
2082         Reviewed by Eric Carlson.
2083
2084         * Shared/WebPreferences.yaml:
2085
2086 2018-10-03  Zamiul Haque  <zhaque@apple.com>
2087
2088         Search does not cancel after number of matching terms exceed set max limit
2089         https://bugs.webkit.org/show_bug.cgi?id=190020
2090         <rdar://problem/39585214>
2091
2092         Reviewed by Andy Estes.
2093
2094         When searching a PDF document on MobileSafari, the maximum number of matching
2095         terms are limited to a set constant. Beyond this limit, a PDF document should not
2096         be searched, since the UI will not be updated correspondingly. To this effect,
2097         a new SPI was made to cancel a search when the maximum limit of matching terms
2098         is reached. This is done without clearing the highlighting for the all the terms
2099         that were found under the limit. This bug was a result of not having implemented 
2100         the new SPI in WKPDFView.
2101
2102         This will be tested in a follow-up patch, after re-enabling WKPDFView tests
2103         on iOS 12.
2104
2105         * UIProcess/ios/WKPDFView.mm:
2106         (-[WKPDFView pdfHostViewController:findStringUpdate:done:]):
2107
2108 2018-10-03  Brian Burg  <bburg@apple.com>
2109
2110         [Cocoa] REGRESSION: web content process paused in debugger is considered to be unresponsive if WebKit client is sandboxed
2111         https://bugs.webkit.org/show_bug.cgi?id=190256
2112         <rdar://problem/44957921>
2113
2114         Reviewed by Alexey Proskuryakov.
2115
2116         Instead of giving up when the client is sandboxed, check whether it has the
2117         exception that's necessary to get process information. If it is possible,
2118         proceed to check whether the web content process has a debugger attached.
2119
2120         * UIProcess/Cocoa/WebProcessProxyCocoa.mm:
2121         (WebKit::WebProcessProxy::platformIsBeingDebugged const):
2122         Check 'process-info-pidinfo' to see if the sysctl call would be allowed.
2123
2124 2018-10-03  Michael Catanzaro  <mcatanzaro@igalia.com>
2125
2126         [WPE][GTK] Enable MSE by default
2127         https://bugs.webkit.org/show_bug.cgi?id=190243
2128
2129         Reviewed by Xabier Rodriguez-Calvar.
2130
2131         * UIProcess/API/glib/WebKitSettings.cpp:
2132         (webkit_settings_class_init):
2133
2134 2018-10-02  Alex Christensen  <achristensen@webkit.org>
2135
2136         Deprecate WKConnection
2137         https://bugs.webkit.org/show_bug.cgi?id=190147
2138
2139         Reviewed by Andy Estes.
2140
2141         * Shared/Cocoa/APIObject.mm:
2142         (API::Object::newObject):
2143         * UIProcess/API/Cocoa/WKConnection.h:
2144         * UIProcess/API/Cocoa/WKConnection.mm:
2145         (didReceiveMessage):
2146         (didClose):
2147         * UIProcess/API/Cocoa/WKConnectionInternal.h:
2148         * UIProcess/API/Cocoa/WKProcessGroup.h:
2149         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugIn.h:
2150         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugIn.mm:
2151
2152 2018-10-01  Dean Jackson  <dino@apple.com>
2153
2154         [macOS] Switching to discrete GPU should be done in the UI process
2155         https://bugs.webkit.org/show_bug.cgi?id=189361
2156         <rdar://problem/43949622>
2157
2158         Reviewed by Simon Fraser.
2159
2160         Implement the UI-side process for triggering a GPU mux.
2161
2162         * Platform/Logging.h: Add a WebGL logging channel.
2163
2164         * SourcesCocoa.txt: Add the new files: WebSwitchingGPUClient and HighPerformanceGPUManager.
2165
2166         * UIProcess/Cocoa/WebProcessProxyCocoa.mm: UI process calls that use HighPerformanceGPUManager
2167         to keep track of whether or not this process needs the high-performance GPU.
2168         (WebKit::WebProcessProxy::requestHighPerformanceGPU):
2169         (WebKit::WebProcessProxy::releaseHighPerformanceGPU):
2170
2171         * UIProcess/WebProcessProxy.cpp:
2172         (WebKit::WebProcessProxy::~WebProcessProxy): Make sure to unregister with the HighPerformanceGPUManager
2173         as the process disappears without manually removing itself (e.g. crashes).
2174         * UIProcess/WebProcessProxy.h:
2175         * UIProcess/WebProcessProxy.messages.in: New messages.
2176
2177         * UIProcess/mac/HighPerformanceGPUManager.cpp: New class that copies most of what used
2178         to live in GraphicsContext3DManager. It creates a CGLPixelFormat object when it sees
2179         that at least one process needs the high-performance GPU.
2180         (WebKit::HighPerformanceGPUManager::singleton):
2181         (WebKit::HighPerformanceGPUManager::addProcessRequiringHighPerformance):
2182         (WebKit::HighPerformanceGPUManager::removeProcessRequiringHighPerformance):
2183         (WebKit::HighPerformanceGPUManager::updateState):
2184         * UIProcess/mac/HighPerformanceGPUManager.h: Added.
2185
2186         * WebKit.xcodeproj/project.pbxproj: Add new files.
2187
2188         * WebProcess/WebCoreSupport/mac/WebSwitchingGPUClient.cpp: Implementation of the SwitchingGPUClient for
2189         WebCore, which sends messages to the UI process.
2190         (WebKit::WebSwitchingGPUClient::singleton):
2191         (WebKit::WebSwitchingGPUClient::requestHighPerformanceGPU):
2192         (WebKit::WebSwitchingGPUClient::releaseHighPerformanceGPU):
2193         * WebProcess/WebCoreSupport/mac/WebSwitchingGPUClient.h: Added.
2194
2195         * WebProcess/cocoa/WebProcessCocoa.mm: Register the GPUClient.
2196         (WebKit::WebProcess::platformInitializeProcess):
2197
2198 2018-10-02  Sihui Liu  <sihui_liu@apple.com>
2199
2200         Fix a potential crash in NetworkProcess::deleteWebsiteDataForOrigins
2201         https://bugs.webkit.org/show_bug.cgi?id=190220
2202
2203         Reviewed by Chris Dumez.
2204
2205         * NetworkProcess/NetworkProcess.cpp:
2206         (WebKit::NetworkProcess::deleteWebsiteDataForOrigins):
2207
2208 2018-10-02  Wenson Hsieh  <wenson_hsieh@apple.com>
2209
2210         [WebKit2] Format > Bold and Format > Italic don't toggle between bold and italic style
2211         https://bugs.webkit.org/show_bug.cgi?id=179787
2212         <rdar://problem/35593389>
2213
2214         Reviewed by Tim Horton.
2215
2216         Fixes the bug by relaxing our policy in WebViewImpl::updateFontManagerIfNeeded. Instead of updating only when
2217         the font panel is visible, update when either the font panel is visible, or the selection is in a richly
2218         editable area. In the latter case, an up-to-date NSFontManager state is needed in order for certain font
2219         formatting menu items, such as bold and italic, to correctly toggle state.
2220
2221         Test: FontManagerTests.ToggleBoldAndItalicWithMenuItems
2222
2223         * UIProcess/Cocoa/WebViewImpl.h:
2224         * UIProcess/Cocoa/WebViewImpl.mm:
2225         (-[WKWindowVisibilityObserver observeValueForKeyPath:ofObject:change:context:]):
2226         (WebKit::WebViewImpl::selectionDidChange):
2227         (WebKit::WebViewImpl::updateFontManagerIfNeeded):
2228
2229         Rename updateFontPanelIfNeeded to updateFontManagerIfNeeded, to reflect the new behavior.
2230
2231         (WebKit::WebViewImpl::changeFontAttributesFromSender):
2232         (WebKit::WebViewImpl::changeFontFromFontManager):
2233         (WebKit::WebViewImpl::updateFontPanelIfNeeded): Deleted.
2234
2235 2018-10-02  Alex Christensen  <achristensen@webkit.org>
2236
2237         Remove ParsedURLString
2238         https://bugs.webkit.org/show_bug.cgi?id=190154
2239
2240         Reviewed by Chris Dumez.
2241
2242         * NetworkProcess/FileAPI/NetworkBlobRegistry.cpp:
2243         (WebKit::NetworkBlobRegistry::writeBlobToFilePath):
2244         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
2245         (WebKit::NetworkConnectionToWebProcess::writeBlobsToTemporaryFiles):
2246         * PluginProcess/PluginControllerProxy.cpp:
2247         (WebKit::PluginControllerProxy::streamWillSendRequest):
2248         (WebKit::PluginControllerProxy::streamDidReceiveResponse):
2249         (WebKit::PluginControllerProxy::manualStreamDidReceiveResponse):
2250         * Shared/API/APIUserContentURLPattern.h:
2251         (API::UserContentURLPattern::matchesURL const):
2252         * Shared/WebBackForwardListItem.cpp:
2253         (WebKit::WebBackForwardListItem::itemIsInSameDocument const):
2254         * UIProcess/API/gtk/WebKitRemoteInspectorProtocolHandler.cpp:
2255         (WebKit::RemoteInspectorProtocolHandler::handleRequest):
2256         (WebKit::RemoteInspectorProtocolHandler::targetListChanged):
2257         * UIProcess/Plugins/mac/PluginProcessProxyMac.mm:
2258         (WebKit::PluginProcessProxy::openURL):
2259         * UIProcess/SuspendedPageProxy.cpp:
2260         (WebKit::SuspendedPageProxy::SuspendedPageProxy):
2261         * UIProcess/WebPageProxy.cpp:
2262         (WebKit::WebPageProxy::loadFile):
2263         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
2264         (WebKit::WebPageProxy::decidePolicyForNewWindowAction):
2265         (WebKit::WebPageProxy::createNewPage):
2266         (WebKit::WebPageProxy::processDidTerminate):
2267         * UIProcess/WebProcessPool.cpp:
2268         (WebKit::WebProcessPool::addProcessToOriginCacheSet):
2269         (WebKit::WebProcessPool::processForNavigationInternal):
2270         * UIProcess/WebProcessProxy.cpp:
2271         (WebKit::WebProcessProxy::processDidTerminateOrFailedToLaunch):
2272         * UIProcess/mac/WebContextMenuProxyMac.mm:
2273         (WebKit::WebContextMenuProxyMac::createShareMenuItem):
2274         * WebProcess/InjectedBundle/InjectedBundle.cpp:
2275         (WebKit::InjectedBundle::addUserScript):
2276         (WebKit::InjectedBundle::addUserStyleSheet):
2277         (WebKit::InjectedBundle::removeUserScript):
2278         (WebKit::InjectedBundle::removeUserStyleSheet):
2279         * WebProcess/Plugins/Plugin.cpp:
2280         (WebKit::Plugin::Parameters::decode):
2281         * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
2282         (WebKit::WebPlatformStrategies::url):
2283         (WebKit::WebPlatformStrategies::readURLFromPasteboard):
2284
2285 2018-10-01  Dean Jackson  <dino@apple.com>
2286
2287         Remove CSS Animation Triggers
2288         https://bugs.webkit.org/show_bug.cgi?id=190175
2289         <rdar://problem/44925626>
2290
2291         Reviewed by Simon Fraser.
2292
2293         * Configurations/FeatureDefines.xcconfig:
2294
2295 2018-10-02  Michael Catanzaro  <mcatanzaro@igalia.com>
2296
2297         REGRESSION(r236662): Fix -Wformat warnings in CacheStorageEngineCaches.cpp
2298         https://bugs.webkit.org/show_bug.cgi?id=190205
2299
2300         Reviewed by Chris Dumez.
2301
2302         Passing enums to %d is not kosher, at least not according to GCC's -Wformat. Avoid it.
2303
2304         * NetworkProcess/cache/CacheStorageEngineCaches.cpp:
2305         (WebKit::CacheStorage::Caches::initialize):
2306         (WebKit::CacheStorage::Caches::readCachesFromDisk):
2307         (WebKit::CacheStorage::Caches::writeCachesToDisk):
2308
2309 2018-10-02  Commit Queue  <commit-queue@webkit.org>
2310
2311         Unreviewed, rolling out r236624 and r236671.
2312         https://bugs.webkit.org/show_bug.cgi?id=190207
2313
2314         The change in r236624 introduced crashes on the bots
2315         (Requested by ryanhaddad on #webkit).
2316
2317         Reverted changesets:
2318
2319         "Refactoring: eliminate raw pointer usage in Fullscreen code"
2320         https://bugs.webkit.org/show_bug.cgi?id=188747
2321         https://trac.webkit.org/changeset/236624
2322
2323         "Unify implementation in VideoFullscreenInterfaceAVKit"
2324         https://bugs.webkit.org/show_bug.cgi?id=190091
2325         https://trac.webkit.org/changeset/236671
2326
2327 2018-10-02  Antti Koivisto  <antti@apple.com>
2328
2329         WebPageProxy::reattachToWebProcess cleanups
2330         https://bugs.webkit.org/show_bug.cgi?id=189881
2331
2332         Reviewed by Chris Dumez.
2333
2334         Change the factoring to separate swap and crash code paths into different functions.
2335
2336         * UIProcess/WebPageProxy.cpp:
2337         (WebKit::WebPageProxy::reattachToWebProcess):
2338         (WebKit::WebPageProxy::swapToWebProcess):
2339
2340         Separate function for the swap case.
2341
2342         (WebKit::WebPageProxy::finishAttachingToWebProcess):
2343
2344         Factor the common parts here.
2345
2346         (WebKit::WebPageProxy::continueNavigationInNewProcess):
2347         * UIProcess/WebPageProxy.h:
2348
2349 2018-10-02  Adrian Perez de Castro  <aperez@igalia.com>
2350
2351         [GTK] Theming of authentication dialog breaks with themes other than Adwaita
2352         https://bugs.webkit.org/show_bug.cgi?id=190117
2353
2354         Reviewed by Michael Catanzaro.
2355
2356         Adds the missing GTK_STYLE_CLASS_BACKGROUND to the WebKitWebViewDialog
2357         widget, which was missing for GTK+ 3.20 or newer, and set the widget
2358         as app-paintable to avoid the base class paint method to add an opaque
2359         background.
2360
2361         Thanks to Benjamin Otte for the guidance to debug the theming issues.
2362
2363         * UIProcess/API/gtk/WebKitWebViewDialog.cpp:
2364         (webkitWebViewDialogDraw): Remove the style context save/restore, it
2365         is unneeded because the style classes are set at widget construction
2366         time and not changed ever after.
2367         (webkitWebViewDialogConstructed): Mark the widget as app-paintable to
2368         avoid the base widget paint operation to fill the whole background,
2369         because the dialog widget paints the translucent overlay itself; and
2370         also add the missing GTK_STYLE_CLASS_BACKGROUND class at construction
2371         when building against GTK+ 3.20 or newer.
2372
2373 2018-10-02  Eric Carlson  <eric.carlson@apple.com>
2374
2375         [MediaStream] RealtimeMediaSource should be able to vend hashed IDs
2376         https://bugs.webkit.org/show_bug.cgi?id=190142
2377         <rdar://problem/44911109>
2378
2379         Reviewed by Youenn Fablet.
2380
2381         * Shared/WebCoreArgumentCoders.cpp:
2382         (IPC::ArgumentCoder<MediaConstraints>::encode):
2383         (IPC::ArgumentCoder<MediaConstraints>::decode):
2384         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp:
2385         (WebKit::UserMediaCaptureManagerProxy::createMediaSourceForCaptureDeviceWithConstraints):
2386         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.h:
2387         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.messages.in:
2388         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
2389         (WebKit::UserMediaPermissionRequestManagerProxy::requestUserMediaPermissionForFrame):
2390         * WebProcess/cocoa/UserMediaCaptureManager.cpp:
2391         (WebKit::UserMediaCaptureManager::Source::Source):
2392         (WebKit::UserMediaCaptureManager::createCaptureSource):
2393         * WebProcess/cocoa/UserMediaCaptureManager.h:
2394
2395 2018-10-02  Wenson Hsieh  <wenson_hsieh@apple.com>
2396
2397         [macOS] Implement a way for the UI process to request typing attributes at the current selection
2398         https://bugs.webkit.org/show_bug.cgi?id=189983
2399         <rdar://problem/44648705>
2400
2401         Reviewed by Ryosuke Niwa.
2402
2403         Implements `-[WKWebView typingAttributesWithCompletionHandler:]`, which asynchronously retrieves an NSDictionary
2404         containing the typing attributes at the start of the current selection. This is a new asynchronous text input
2405         client hook on macOS that is needed in order to support NSInspectorBar on WKWebView.
2406
2407         At a high level, this patch builds on top of refactoring done in r236445 to make it possible to send typing
2408         attributes from the web process to the UI process, and then adds plumbing in the WebKit2 client layer to surface
2409         typing attributes to WKWebView on macOS.
2410
2411         Tests:  FontManagerTests.TypingAttributesAfterSubscriptAndSuperscript
2412                 FontManagerTests.ChangeTypingAttributesWithInspectorBar
2413                 FontManagerTests.ChangeAttributesWithFontEffectsBox
2414
2415         * Platform/spi/mac/AppKitSPI.h:
2416         * Shared/WebCoreArgumentCoders.cpp:
2417         (IPC::ArgumentCoder<FontAttributes>::encode):
2418         (IPC::ArgumentCoder<FontAttributes>::decode):
2419
2420         Implement IPC coding support for FontAttributes.
2421
2422         * Shared/WebCoreArgumentCoders.h:
2423         * Shared/mac/ArgumentCodersMac.h:
2424         * Shared/mac/ArgumentCodersMac.mm:
2425         (IPC::encode):
2426         (IPC::decode):
2427
2428         Add the ability to encode and decode UIFont. This allows Cocoa platforms to send `FontAttributes.font` over IPC
2429         with a single call to IPC::encode/IPC::decode.
2430
2431         * UIProcess/API/Cocoa/WKWebView.mm:
2432         (-[WKWebView typingAttributesWithCompletionHandler:]):
2433
2434         Add plumbing to WebViewImpl.
2435
2436         * UIProcess/Cocoa/WebViewImpl.h:
2437         * UIProcess/Cocoa/WebViewImpl.mm:
2438         (WebKit::WebViewImpl::selectionDidChange):
2439
2440         Update the NSInspectorBar on selection change, but only if it is present and visible, and WKWebView is currently
2441         first responder.
2442
2443         (WebKit::WebViewImpl::typingAttributesWithCompletionHandler):
2444
2445         Call into WebPageProxy to retrieve FontAttributes from the web process, and invoke the callback with an
2446         NSDictionary constructed from the retrieved FontAttributes.
2447
2448         * UIProcess/WebPageProxy.cpp:
2449         (WebKit::WebPageProxy::requestFontAttributesAtSelectionStart):
2450         (WebKit::WebPageProxy::fontAttributesCallback):
2451
2452         Add plumbing to retrieve FontAttributes from the web process at the current selection. Additionally, cache the
2453         font attributes to avoid doing extra work during subsequent requests.
2454
2455         (WebKit::WebPageProxy::resetStateAfterProcessExited):
2456         * UIProcess/WebPageProxy.h:
2457         (WebKit::WebPageProxy::cachedFontAttributesAtSelectionStart const):
2458         * UIProcess/WebPageProxy.messages.in:
2459         * UIProcess/ios/WebPageProxyIOS.mm:
2460         (WebKit::WebPageProxy::editorStateChanged):
2461         * UIProcess/mac/WebPageProxyMac.mm:
2462         (WebKit::WebPageProxy::editorStateChanged):
2463
2464         Invalidate cached font attributes.
2465
2466         * WebKit.xcodeproj/project.pbxproj:
2467         * WebProcess/WebPage/WebPage.cpp:
2468         (WebKit::WebPage::requestFontAttributesAtSelectionStart):
2469
2470         Use the currently focused frame's Editor to compute FontAttributes at the current selection, and send the
2471         computed FontAttributes back to the UI process.
2472
2473         * WebProcess/WebPage/WebPage.h:
2474         * WebProcess/WebPage/WebPage.messages.in:
2475
2476 2018-10-01  Devin Rousso  <drousso@apple.com>
2477
2478         Web Inspector: remove analyzer manager
2479         https://bugs.webkit.org/show_bug.cgi?id=190162
2480
2481         Reviewed by Joseph Pecoraro.
2482
2483         * InspectorGResources.cmake:
2484         Remove eslint.
2485
2486 2018-09-30  Ryosuke Niwa  <rniwa@webkit.org>
2487
2488         Add a new variant of serializePreservingVisualAppearance which takes VisibleSelection
2489         https://bugs.webkit.org/show_bug.cgi?id=190108
2490
2491         Reviewed by Wenson Hsieh.
2492
2493         Adopt the new variant which directly takes VisibleSelection.
2494
2495         * WebProcess/WebCoreSupport/gtk/WebEditorClientGtk.cpp:
2496         (WebKit::WebEditorClient::updateGlobalSelection):
2497
2498 2018-10-01  Andy Estes  <aestes@apple.com>
2499
2500         [watchOS] Adopt NSURLSessionCompanionProxyPreference
2501         https://bugs.webkit.org/show_bug.cgi?id=190177
2502         <rdar://problem/43402114>
2503
2504         Reviewed by Wenson Hsieh.
2505
2506         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
2507         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
2508
2509 2018-10-01  Chris Dumez  <cdumez@apple.com>
2510
2511         [Mac] The UIProcess should listen to memory pressure signals
2512         https://bugs.webkit.org/show_bug.cgi?id=190166
2513
2514         Reviewed by Simon Fraser.
2515
2516         The UIProcess should listen to memory pressure signals on Mac in order to free memory, similarly to what we already
2517         do on iOS. The memory pressure handler currently discards view snapshots and prewarmed processes.
2518
2519         * SourcesCocoa.txt:
2520         * UIProcess/Cocoa/WebMemoryPressureHandlerCocoa.h: Renamed from Source/WebKit/UIProcess/ios/WebMemoryPressureHandlerIOS.h.
2521         * UIProcess/Cocoa/WebMemoryPressureHandlerCocoa.mm: Renamed from Source/WebKit/UIProcess/ios/WebMemoryPressureHandlerIOS.mm.
2522         (WebKit::installMemoryPressureHandler):
2523         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
2524         (WebKit::WebProcessPool::platformInitialize):
2525         * WebKit.xcodeproj/project.pbxproj:
2526
2527 2018-10-01  Sihui Liu  <sihui_liu@apple.com>
2528
2529         Fix Internal iOS Build after r236690
2530         https://bugs.webkit.org/show_bug.cgi?id=190171
2531
2532         Reviewed by Alex Christensen.
2533
2534         * Platform/ExtraPrivateSymbolsForTAPI.h:
2535
2536 2018-10-01  Wenson Hsieh  <wenson_hsieh@apple.com>
2537
2538         [iOS] Add SPI to customize the input accessory view when focusing an element
2539         https://bugs.webkit.org/show_bug.cgi?id=190152
2540         <rdar://problem/42754975>
2541
2542         Reviewed by Dan Bernstein.
2543
2544         Adds SPI on WKFormInputSession to customize the input accessory view, alongside the input view. See below for
2545         more details.
2546
2547         Test: KeyboardInputTests.CustomInputViewAndInputAccessoryView
2548
2549         * UIProcess/API/Cocoa/_WKFormInputSession.h:
2550         * UIProcess/ios/WKContentViewInteraction.mm:
2551         (-[WKFormInputSession customInputAccessoryView]):
2552         (-[WKFormInputSession setCustomInputAccessoryView:]):
2553
2554         Reload input views when the custom input accessory view changes.
2555
2556         (-[WKContentView requiresAccessoryView]):
2557
2558         If a custom input accessory view is specified, return YES.
2559
2560         (-[WKContentView inputAccessoryView]):
2561
2562         Return the custom input accessory view if present, and fall back to the default web form accessory view.
2563
2564 2018-10-01  Sihui Liu  <sihui_liu@apple.com>
2565
2566         Remove StorageProcess
2567         https://bugs.webkit.org/show_bug.cgi?id=189975
2568
2569         Reviewed by Geoffrey Garen.
2570
2571         * CMakeLists.txt:
2572         * Configurations/Storage-OSX-sandbox.entitlements: Removed.
2573         * Configurations/StorageService.xcconfig: Removed.
2574         * Configurations/WebKit.xcconfig:
2575         * DerivedSources.make:
2576         * NetworkProcess/IndexedDB/WebIDBConnectionToClient.cpp:
2577         (WebKit::WebIDBConnectionToClient::putOrAdd):
2578         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
2579         (WebKit::NetworkConnectionToWebProcess::establishIDBConnectionToServer):
2580         * PlatformGTK.cmake:
2581         * PlatformMac.cmake:
2582         * PlatformWPE.cmake:
2583         * PlatformWin.cmake:
2584         * Shared/ProcessExecutablePath.h:
2585         * Shared/Storage/StorageProcessCreationParameters.cpp: Removed.
2586         * Shared/Storage/StorageProcessCreationParameters.h: Removed.
2587         * Shared/glib/ProcessExecutablePathGLib.cpp:
2588         (WebKit::executablePathOfStorageProcess): Deleted.
2589         * Sources.txt:
2590         * SourcesCocoa.txt:
2591         * SourcesGTK.txt:
2592         * SourcesWPE.txt:
2593         * StorageProcess/EntryPoint/mac/XPCService/StorageService/Info.plist: Removed.
2594         * StorageProcess/EntryPoint/mac/XPCService/StorageServiceEntryPoint.mm: Removed.
2595         * StorageProcess/EntryPoint/unix/StorageProcessMain.cpp: Removed.
2596         * StorageProcess/EntryPoint/win/StorageProcessMain.cpp: Removed.
2597         * StorageProcess/StorageProcess.cpp: Removed.
2598         * StorageProcess/StorageProcess.h: Removed.
2599         * StorageProcess/StorageProcess.messages.in: Removed.
2600         * StorageProcess/StorageToWebProcessConnection.cpp: Removed.
2601         * StorageProcess/StorageToWebProcessConnection.h: Removed.
2602         * StorageProcess/StorageToWebProcessConnection.messages.in: Removed.
2603         * StorageProcess/glib/StorageProcessMainGLib.cpp: Removed.
2604         * StorageProcess/ios/StorageProcessIOS.mm: Removed.
2605         * StorageProcess/mac/StorageProcessMac.mm: Removed.
2606         * StorageProcess/mac/com.apple.WebKit.Storage.sb.in: Removed.
2607         * StorageProcess/unix/StorageProcessMainUnix.h: Removed.
2608         * StorageProcess/win/StorageProcessMainWin.cpp: Removed.
2609         * StorageProcess/win/StorageProcessMainWin.h: Removed.
2610         * UIProcess/API/C/WKContext.cpp:
2611         (WKContextTerminateStorageProcess): Deleted.
2612         (WKContextGetDatabaseProcessIdentifier): Deleted.
2613         * UIProcess/API/C/WKContext.h:
2614         * UIProcess/API/C/WKContextPrivate.h:
2615         * UIProcess/API/Cocoa/WKProcessPool.mm:
2616         (-[WKProcessPool _terminateStorageProcess]): Deleted.
2617         (-[WKProcessPool _storageProcessIdentifier]): Deleted.
2618         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
2619         * UIProcess/Launcher/glib/ProcessLauncherGLib.cpp:
2620         (WebKit::ProcessLauncher::launchProcess):
2621         * UIProcess/Launcher/win/ProcessLauncherWin.cpp:
2622         (WebKit::processName):
2623         * UIProcess/Storage/StorageProcessProxy.cpp: Removed.
2624         * UIProcess/Storage/StorageProcessProxy.h: Removed.
2625         * UIProcess/Storage/StorageProcessProxy.messages.in: Removed.
2626         * UIProcess/WebContextClient.cpp:
2627         (WebKit::WebContextClient::storageProcessDidCrash): Deleted.
2628         * UIProcess/WebContextClient.h:
2629         * UIProcess/WebContextSupplement.h:
2630         * UIProcess/WebProcessPool.cpp:
2631         (WebKit::WebProcessPool::sendMemoryPressureEvent):
2632         (WebKit::WebProcessPool::setAnyPageGroupMightHavePrivateBrowsingEnabled):
2633         (WebKit::WebProcessPool::ensureStorageProcessAndWebsiteDataStore): Deleted.
2634         (WebKit::WebProcessPool::getStorageProcessConnection): Deleted.
2635         (WebKit::WebProcessPool::storageProcessCrashed): Deleted.
2636         (WebKit::WebProcessPool::storageProcessIdentifier): Deleted.
2637         (WebKit::WebProcessPool::terminateStorageProcessForTesting): Deleted.
2638         * UIProcess/WebProcessPool.h:
2639         (WebKit::WebProcessPool::sendToStorageProcess): Deleted.
2640         (WebKit::WebProcessPool::sendToStorageProcessRelaunchingIfNecessary): Deleted.
2641         * UIProcess/WebProcessProxy.cpp:
2642         (WebKit::WebProcessProxy::getStorageProcessConnection): Deleted.
2643         * UIProcess/WebProcessProxy.h:
2644         * UIProcess/WebProcessProxy.messages.in:
2645         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
2646         (WebKit::WebsiteDataStore::~WebsiteDataStore):
2647         (WebKit::WebsiteDataStore::storageProcessParameters): Deleted.
2648         * UIProcess/WebsiteData/WebsiteDataStore.h:
2649         * WebKit.xcodeproj/project.pbxproj:
2650         * WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.h:
2651         * WebProcess/Storage/WebServiceWorkerProvider.cpp:
2652         * WebProcess/Storage/WebToStorageProcessConnection.cpp: Removed.
2653         * WebProcess/Storage/WebToStorageProcessConnection.h: Removed.
2654         * WebProcess/WebProcess.cpp:
2655         (WebKit::WebProcess::establishWorkerContextConnectionToNetworkProcess):
2656         (WebKit::WebProcess::webToStorageProcessConnectionClosed): Deleted.
2657         (WebKit::WebProcess::ensureWebToStorageProcessConnection): Deleted.
2658         * WebProcess/WebProcess.h:
2659         * webkitglib-symbols.map:
2660
2661 2018-10-01  David Quesada  <david_quesada@apple.com>
2662
2663         Add missing Objective-C versions of downloads SPI
2664         https://bugs.webkit.org/show_bug.cgi?id=190149
2665         rdar://problem/44915592
2666
2667         Reviewed by Alex Christensen.
2668
2669         * UIProcess/API/Cocoa/WKProcessPool.mm:
2670         (-[WKProcessPool _downloadURLRequest:]):
2671         (-[WKProcessPool _resumeDownloadFromData:path:]):
2672         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
2673         * UIProcess/API/Cocoa/_WKDownload.h:
2674         * UIProcess/API/Cocoa/_WKDownload.mm:
2675         (-[_WKDownload resumeData]):
2676         * UIProcess/API/Cocoa/_WKDownloadInternal.h:
2677         * UIProcess/Cocoa/DownloadClient.mm:
2678             Move the DownloadProxy's WrapperTraits out of DownloadClient, and into the internal
2679             header so it can be used from other classes (i.e. WKProcessPool here).
2680
2681 2018-10-01  Alex Christensen  <achristensen@webkit.org>
2682
2683         Fix internal build after r236665
2684         https://bugs.webkit.org/show_bug.cgi?id=189850
2685
2686         * UIProcess/API/Cocoa/WKNSURLAuthenticationChallenge.h:
2687         * WebKit.xcodeproj/project.pbxproj:
2688
2689 2018-10-01  Jiewen Tan  <jiewen_tan@apple.com>
2690
2691         [WebAuthN] Import a JS CBOR coder
2692         https://bugs.webkit.org/show_bug.cgi?id=189877
2693         <rdar://problem/44701124>
2694
2695         Reviewed by Chris Dumez.
2696
2697         Update MockWebAuthenticationConfiguration to have userCertificateBase64 and intermediateCACertificateBase64
2698         as Local's memeber such that tests can pass those certificates to MockLocalConnection instead of letting it
2699         holds some static ones.
2700
2701         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
2702         (WKWebsiteDataStoreSetWebAuthenticationMockConfiguration):
2703         * UIProcess/WebAuthentication/Mock/MockLocalConnection.mm:
2704         (WebKit::MockLocalConnection::getAttestation const):
2705         * UIProcess/WebAuthentication/Mock/MockWebAuthenticationConfiguration.h:
2706
2707 2018-10-01  Chris Dumez  <cdumez@apple.com>
2708
2709         Regression(r236512): http/tests/navigation/keyboard-events-during-provisional-navigation.html is flaky
2710         https://bugs.webkit.org/show_bug.cgi?id=190052
2711
2712         Reviewed by Ryosuke Niwa.
2713
2714         * Platform/IPC/Connection.cpp:
2715         (IPC::Connection::sendMessage):
2716         * Platform/IPC/Connection.h:
2717         * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
2718         (WKBundlePagePostMessageIgnoringFullySynchronousMode):
2719         * WebProcess/InjectedBundle/API/c/WKBundlePage.h:
2720         * WebProcess/WebPage/WebPage.cpp:
2721         (WebKit::WebPage::postMessageIgnoringFullySynchronousMode):
2722         * WebProcess/WebPage/WebPage.h:
2723
2724 2018-10-01  Daniel Bates  <dabates@apple.com>
2725
2726         [iOS] Special keys are misidentified in DOM keyboard events
2727         https://bugs.webkit.org/show_bug.cgi?id=189974
2728
2729         Reviewed by Wenson Hsieh.
2730
2731         Take the key code of WebEvent to be the key code for the new WebKeyboardEvent verbatim
2732         now that we normalize the character strings of the WebEvent to account for the special
2733         UIKit input strings.
2734
2735         * Shared/ios/WebIOSEventFactory.mm:
2736         (WebIOSEventFactory::createWebKeyboardEvent):
2737
2738 2018-10-01  Alex Christensen  <achristensen@webkit.org>
2739
2740         Fix an internal build after r236665
2741         https://bugs.webkit.org/show_bug.cgi?id=189850
2742
2743         * WebKit.xcodeproj/project.pbxproj:
2744         Make WKNSURLAuthenticationChallenge.h a private header.
2745
2746 2018-10-01  Alex Christensen  <achristensen@webkit.org>
2747
2748         URL should not use TextEncoding internally
2749         https://bugs.webkit.org/show_bug.cgi?id=190111
2750
2751         Reviewed by Andy Estes.
2752
2753         * UIProcess/WebInspectorProxy.cpp:
2754
2755 2018-10-01  Jeremy Jones  <jeremyj@apple.com>
2756
2757         Unify implementation in VideoFullscreenInterfaceAVKit
2758         https://bugs.webkit.org/show_bug.cgi?id=190091
2759         rdar://problem/44734523
2760
2761         Reviewed by Jer Noble.
2762
2763         Unified code in VideoFullscreenInterfaceAVKit now that new code path is proven and include
2764         any changes that had been made in the old path.
2765
2766         * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm:
2767         * WebProcess/cocoa/VideoFullscreenManager.mm:
2768         (WebKit::VideoFullscreenManager::supportsVideoFullscreenStandby const):
2769         (WebKit::VideoFullscreenManager::didSetupFullscreen):
2770         (WebKit::VideoFullscreenManager::didExitFullscreen):
2771
2772 2018-10-01  Daniel Bates  <dabates@apple.com>
2773
2774         [iOS] Wrong key event may be sent to UIKit
2775         https://bugs.webkit.org/show_bug.cgi?id=189992
2776
2777         Reviewed by Simon Fraser.
2778
2779         Retain a clone of a received UIEvent if it is for a hardware key event so as to ensure that we
2780         notify the UIKit keyboard code of the correct keyboard event.
2781
2782         Currently the UIProcess retains the UIEvent associated with a keyboard event so as to defer
2783         notifying the UIKit keyboard code (via -_handleKeyUIEvent) about a received keyboard event until
2784         after the WebProcess has processed the raw key event. If this UIEvent is for a hardware keyboard
2785         event then it is not sufficient to retain it to preserve its value because UIKit uses a singleton
2786         UIEvent for all hardware keyboard events ;=> its value will be clobbered as each hardware keyboard
2787         event is received. Instead we need to explicitly clone a UIEvent for a hardware key event before
2788         retaining it.
2789
2790         * Platform/spi/ios/UIKitSPI.h: Forward declare SPI.
2791         * UIProcess/ios/WKContentViewInteraction.mm:
2792         (-[WKContentView handleKeyEvent:]): Clone the UIEvent if it is for a hardware key event.
2793
2794 2018-10-01  Alex Christensen  <achristensen@webkit.org>
2795
2796         Deprecate ObjC SPI in Deprecated Xcode group
2797         https://bugs.webkit.org/show_bug.cgi?id=189850
2798
2799         Reviewed by Andy Estes.
2800
2801         * Shared/Cocoa/APIObject.mm:
2802         (API::Object::newObject):
2803         * Shared/mac/ObjCObjectGraph.mm:
2804         (WebKit::typeFromObject):
2805         (WebKit::ObjCObjectGraph::encode):
2806         (WebKit::ObjCObjectGraph::decode):
2807         * UIProcess/API/Cocoa/WKBrowsingContextController.h:
2808         * UIProcess/API/Cocoa/WKBrowsingContextController.mm:
2809         (didStartProvisionalNavigation):
2810         (didReceiveServerRedirectForProvisionalNavigation):
2811         (didFailProvisionalNavigation):
2812         (didCommitNavigation):
2813         (didFinishNavigation):
2814         (didFailNavigation):
2815         (canAuthenticateAgainstProtectionSpace):
2816         (didReceiveAuthenticationChallenge):
2817         (processDidCrash):
2818         (setUpPagePolicyClient):
2819         * UIProcess/API/Cocoa/WKBrowsingContextGroup.h:
2820         * UIProcess/API/Cocoa/WKBrowsingContextGroupInternal.h:
2821         * UIProcess/API/Cocoa/WKBrowsingContextHistoryDelegate.h:
2822         * UIProcess/API/Cocoa/WKBrowsingContextLoadDelegate.h:
2823         * UIProcess/API/Cocoa/WKBrowsingContextLoadDelegatePrivate.h:
2824         * UIProcess/API/Cocoa/WKBrowsingContextPolicyDelegate.h:
2825         * UIProcess/API/Cocoa/WKNSURLAuthenticationChallenge.h:
2826         * UIProcess/API/Cocoa/WKNSURLAuthenticationChallenge.mm:
2827         (-[WKNSURLAuthenticationChallengeSender cancelAuthenticationChallenge:]):
2828         (-[WKNSURLAuthenticationChallengeSender continueWithoutCredentialForAuthenticationChallenge:]):
2829         (-[WKNSURLAuthenticationChallengeSender useCredential:forAuthenticationChallenge:]):
2830         (-[WKNSURLAuthenticationChallengeSender performDefaultHandlingForAuthenticationChallenge:]):
2831         (-[WKNSURLAuthenticationChallengeSender rejectProtectionSpaceAndContinueWithChallenge:]):
2832         * UIProcess/API/Cocoa/WKNavigationData.h:
2833         * UIProcess/API/Cocoa/WKNavigationDataInternal.h:
2834         * UIProcess/API/Cocoa/WKProcessGroup.h:
2835         * UIProcess/API/Cocoa/WKProcessGroup.mm:
2836         (didCreateConnection):
2837         (getInjectedBundleInitializationUserData):
2838         (didNavigateWithNavigationData):
2839         (didPerformClientRedirect):
2840         (didPerformServerRedirect):
2841         (didUpdateHistoryTitle):
2842         * UIProcess/API/Cocoa/WKTypeRefWrapper.h:
2843         * UIProcess/API/Cocoa/WKView.h:
2844         (WK_CLASS_DEPRECATED_WITH_REPLACEMENT):
2845         * UIProcess/API/Cocoa/_WKThumbnailView.h:
2846         * UIProcess/API/Cocoa/_WKThumbnailView.mm:
2847         * UIProcess/Cocoa/WebProcessProxyCocoa.mm:
2848         (WebKit::WebProcessProxy::transformHandlesToObjects):
2849         (WebKit::WebProcessProxy::transformObjectsToHandles):
2850         * UIProcess/Cocoa/WebViewImpl.h:
2851         * UIProcess/Cocoa/WebViewImpl.mm:
2852         * UIProcess/Gamepad/mac/UIGamepadProviderMac.mm:
2853         (WebKit::UIGamepadProvider::platformWebPageProxyForGamepadInput):
2854         * UIProcess/ios/WKContentView.h:
2855         * UIProcess/mac/WebInspectorProxyMac.mm:
2856         (WebKit::WebInspectorProxy::inspectedViewFrameDidChange):
2857         * WebProcess/cocoa/WebProcessCocoa.mm:
2858         (WebKit::WebProcess::transformHandlesToObjects):
2859         (WebKit::WebProcess::transformObjectsToHandles):
2860
2861 2018-10-01  Youenn Fablet  <youenn@apple.com>
2862
2863         [macOS Sierra] Layout Test http/wpt/cache-storage/cache-put-keys.https.any.worker.html is a flaky failure
2864         https://bugs.webkit.org/show_bug.cgi?id=184204
2865
2866         Reviewed by Chris Dumez.
2867
2868         NetworkCache::Storage by default limits the length to read to 1500 milliseconds.
2869         This is good for the HTTP cache since networking might be faster.
2870         It does not work for DOM cache which needs to get these resources even if it takes a long time.
2871
2872         Since this is disabled by a Mode::Testing option, use it for DOMCache after renaming it to Mode::AvoidRandomness.
2873
2874         Add a bunch of release logging to help debugging error cases.
2875
2876         * NetworkProcess/cache/CacheStorageEngineCaches.cpp:
2877         (WebKit::CacheStorage::Caches::retrieveOriginFromDirectory):
2878         (WebKit::CacheStorage::Caches::initialize):
2879         (WebKit::CacheStorage::Caches::writeCachesToDisk):
2880         (WebKit::CacheStorage::Caches::readRecord):
2881         * NetworkProcess/cache/NetworkCache.cpp:
2882         (WebKit::NetworkCache::Cache::open):
2883         * NetworkProcess/cache/NetworkCacheStorage.cpp:
2884         (WebKit::NetworkCache::Storage::dispatchReadOperation):
2885         (WebKit::NetworkCache::Storage::shrinkIfNeeded):
2886         * NetworkProcess/cache/NetworkCacheStorage.h:
2887
2888 2018-10-01  Olivier Blin  <olivier.blin@softathome.com>
2889
2890         [WPE] Remove WebKit2InspectorGResourceBundle.xml
2891         https://bugs.webkit.org/show_bug.cgi?id=190132
2892
2893         Reviewed by Michael Catanzaro.
2894
2895         * UIProcess/API/wpe/WebKit2InspectorGResourceBundle.xml: Removed.
2896         This is unused since legacy INSPECTOR_SERVER implementation has
2897         been removed in r217924.
2898
2899 2018-09-30  Eric Carlson  <eric.carlson@apple.com>
2900
2901         [MediaStream] Clean up RealtimeMediaSource settings change handling
2902         https://bugs.webkit.org/show_bug.cgi?id=189998
2903         <rdar://problem/44797884>
2904
2905         Reviewed by Youenn Fablet.
2906
2907         * WebProcess/cocoa/UserMediaCaptureManager.cpp:
2908         (WebKit::UserMediaCaptureManager::Source::setSettings):
2909
2910 2018-09-30  Eric Carlson  <eric.carlson@apple.com>
2911
2912         [MediaStream] Use display-specific capture factories
2913         https://bugs.webkit.org/show_bug.cgi?id=190043
2914         <rdar://problem/44834412>
2915
2916         Reviewed by Youenn Fablet.
2917
2918         * WebProcess/cocoa/UserMediaCaptureManager.h:
2919
2920 2018-09-29  Commit Queue  <commit-queue@webkit.org>
2921
2922         Unreviewed, rolling out r236631.
2923         https://bugs.webkit.org/show_bug.cgi?id=190112
2924
2925         Caused various eventSender tests, including fast/css/pseudo-
2926         active-style-sharing*, to fail (Requested by smfr on #webkit).
2927
2928         Reverted changeset:
2929
2930         "Regression(r236512): http/tests/navigation/keyboard-events-
2931         during-provisional-navigation.html is flaky"
2932         https://bugs.webkit.org/show_bug.cgi?id=190052
2933         https://trac.webkit.org/changeset/236631
2934
2935 2018-09-29  Chris Dumez  <cdumez@apple.com>
2936
2937         [PSON] Deal with the drawing area potentially being null in WebFrameLoaderClient::transitionToCommittedForNewPage()
2938         https://bugs.webkit.org/show_bug.cgi?id=190084
2939         <rdar://problem/44844561>
2940
2941         Reviewed by Antti Koivisto.
2942
2943         Deal with the drawing area potentially being null in WebFrameLoaderClient::transitionToCommittedForNewPage(), as a
2944         result of calling WebPage::tearDownDrawingAreaForSuspend().
2945
2946         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
2947         (WebKit::WebFrameLoaderClient::transitionToCommittedForNewPage):
2948
2949 2018-09-28  Wenson Hsieh  <wenson_hsieh@apple.com>
2950
2951         No DOM API to instantiate an attachment for an img element
2952         https://bugs.webkit.org/show_bug.cgi?id=189934
2953         <rdar://problem/44743222>
2954
2955         Reviewed by Ryosuke Niwa.
2956
2957         Makes some adjustments to support using _WKAttachment's file wrapper to change the contents of any image element
2958         hosting the attachment in its shadow root. To do this, we add some plumbing to allow the UI process to update an
2959         attachment element's enclosing image with data from its file wrapper.
2960
2961         * UIProcess/API/APIAttachment.cpp:
2962         (API::Attachment::isEmpty const):
2963         (API::Attachment::enclosingImageData const):
2964
2965         Helper method that creates a SharedBuffer representing image data for the attachment. Only returns a non-null
2966         value for attachment elements that are enclosed within an image.
2967
2968         * UIProcess/API/APIAttachment.h:
2969         * UIProcess/API/Cocoa/APIAttachmentCocoa.mm:
2970         (API::Attachment::enclosingImageData const):
2971         (API::Attachment::isEmpty const):
2972         * UIProcess/API/Cocoa/WKWebView.mm:
2973         (-[WKWebView _attachmentForIdentifier:]):
2974
2975         Add new SPI to request a _WKAttachment for a given unique identifier. Currently, this is only used for testing.
2976
2977         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
2978         * UIProcess/Cocoa/WebPageProxyCocoa.mm:
2979         (WebKit::WebPageProxy::platformRegisterAttachment):
2980         * UIProcess/WebPageProxy.cpp:
2981         (WebKit::WebPageProxy::updateAttachmentAttributes):
2982         (WebKit::WebPageProxy::registerAttachmentIdentifier):
2983         (WebKit::WebPageProxy::didInsertAttachmentWithIdentifier):
2984
2985         Plumb whether or not the attachment is enclosed by an image from the web process to the UI process.
2986
2987         (WebKit::WebPageProxy::didRemoveAttachmentWithIdentifier):
2988         (WebKit::WebPageProxy::didInsertAttachment): Deleted.
2989         (WebKit::WebPageProxy::didRemoveAttachment):
2990         * UIProcess/WebPageProxy.h:
2991         * UIProcess/WebPageProxy.messages.in:
2992         * WebProcess/WebCoreSupport/WebEditorClient.cpp:
2993         (WebKit::WebEditorClient::registerAttachmentIdentifier):
2994         (WebKit::WebEditorClient::didInsertAttachmentWithIdentifier):
2995
2996         Update attachment attributes after inserting an attachment. This ensures that an attachment that was created and
2997         later inserted via script into the document will be synced with state in the UI process, if the client has
2998         changed the contents of the attachment.
2999
3000         * WebProcess/WebCoreSupport/WebEditorClient.h:
3001         * WebProcess/WebPage/WebPage.cpp:
3002         (WebKit::WebPage::updateAttachmentAttributes):
3003
3004         Plumb attachment data from the UI process to the web process.
3005
3006         * WebProcess/WebPage/WebPage.h:
3007         * WebProcess/WebPage/WebPage.messages.in:
3008
3009 2018-09-28  Chris Dumez  <cdumez@apple.com>
3010
3011         Regression(r236512): http/tests/navigation/keyboard-events-during-provisional-navigation.html is flaky
3012         https://bugs.webkit.org/show_bug.cgi?id=190052
3013
3014         Reviewed by Ryosuke Niwa.
3015
3016         Introduce a new IPC::SendOption indicating that the IPC should always be sent asynchronously,
3017         even if the connection is in fully synchronous mode. This is used by WebKitTestRunner for
3018         all text outputting (e.g. console.log) is asynchronous, and thus in order.
3019
3020         * Platform/IPC/Connection.cpp:
3021         (IPC::Connection::sendMessage):
3022         * Platform/IPC/Connection.h:
3023         * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
3024         (WKBundlePagePostMessageIgnoringFullySynchronousMode):
3025         * WebProcess/InjectedBundle/API/c/WKBundlePage.h:
3026         * WebProcess/WebPage/WebPage.cpp:
3027         (WebKit::WebPage::postMessageIgnoringFullySynchronousMode):
3028         * WebProcess/WebPage/WebPage.h:
3029
3030 2018-09-28  John Wilander  <wilander@apple.com>
3031
3032         Skip debug assertion in ResourceLoadStatisticsMemoryStore::recursivelyGetAllDomainsThatHaveRedirectedToThisDomain()
3033         https://bugs.webkit.org/show_bug.cgi?id=190097
3034         <rdar://problem/44877080>
3035
3036         Reviewed by Chris Dumez.
3037
3038         The change in https://bugs.webkit.org/show_bug.cgi?id=190055 causes a
3039         re-classification that may trigger a debug assertion in
3040         ResourceLoadStatisticsMemoryStore::recursivelyGetAllDomainsThatHaveRedirectedToThisDomain().
3041         We should skip the assertion for statistics model version 14 to avoid
3042         this.
3043
3044         * UIProcess/ResourceLoadStatisticsMemoryStore.cpp:
3045         (WebKit::ResourceLoadStatisticsMemoryStore::recursivelyGetAllDomainsThatHaveRedirectedToThisDomain const):
3046
3047 2018-09-28  Devin Rousso  <drousso@apple.com>
3048
3049         Web Inspector: crash in InspectorNetworkAgent::didReceiveResponse when loading denied x-frame resources
3050         https://bugs.webkit.org/show_bug.cgi?id=190046
3051
3052         Reviewed by Joseph Pecoraro.
3053
3054         * NetworkProcess/NetworkResourceLoader.cpp:
3055         (WebKit::NetworkResourceLoader::didReceiveResponse):
3056         (WebKit::NetworkResourceLoader::didRetrieveCacheEntry):
3057         Send the sanitized `ResourceResponse` with the message so WebInspector is able to access it.
3058
3059         * WebProcess/Network/WebResourceLoader.h:
3060         * WebProcess/Network/WebResourceLoader.cpp:
3061         * WebProcess/Network/WebResourceLoader.messages.in:
3062         (WebKit::WebResourceLoader::stopLoadingAfterXFrameOptionsOrContentSecurityPolicyDenied):
3063
3064 2018-09-28  Jiewen Tan  <jiewen_tan@apple.com>
3065
3066         [WebAuthN] Polish WebAuthN auto-test environment
3067         https://bugs.webkit.org/show_bug.cgi?id=189283
3068         <rdar://problem/44117828>
3069
3070         Reviewed by Chris Dumez.
3071
3072         This patch changes MockWebAuthenticationConfiguration.local to optional such that tests can express
3073         absence of local authenticators.
3074
3075         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
3076         (WKWebsiteDataStoreSetWebAuthenticationMockConfiguration):
3077         * UIProcess/WebAuthentication/Mock/MockLocalConnection.mm:
3078         (WebKit::MockLocalConnection::getUserConsent const):
3079         (WebKit::MockLocalConnection::getAttestation const):
3080         * UIProcess/WebAuthentication/Mock/MockLocalService.cpp:
3081         (WebKit::MockLocalService::platformStartDiscovery const):
3082         * UIProcess/WebAuthentication/Mock/MockWebAuthenticationConfiguration.h:
3083
3084 2018-09-28  Jer Noble  <jer.noble@apple.com>
3085
3086         Refactoring: eliminate raw pointer usage in Fullscreen code
3087         https://bugs.webkit.org/show_bug.cgi?id=188747
3088         <rdar://problem/43541164>
3089
3090         Reviewed by Alex Christensen.
3091
3092         Adopt those Ref and WeakPtr changes made in WebCore.
3093
3094         * UIProcess/Cocoa/PlaybackSessionManagerProxy.h:
3095         * UIProcess/Cocoa/PlaybackSessionManagerProxy.mm:
3096         (WebKit::PlaybackSessionModelContext::addClient):
3097         (WebKit::PlaybackSessionModelContext::removeClient):
3098         (WebKit::PlaybackSessionModelContext::durationChanged):
3099         (WebKit::PlaybackSessionModelContext::currentTimeChanged):
3100         (WebKit::PlaybackSessionModelContext::bufferedTimeChanged):
3101         (WebKit::PlaybackSessionModelContext::rateChanged):
3102         (WebKit::PlaybackSessionModelContext::seekableRangesChanged):
3103         (WebKit::PlaybackSessionModelContext::canPlayFastReverseChanged):
3104         (WebKit::PlaybackSessionModelContext::audioMediaSelectionOptionsChanged):
3105         (WebKit::PlaybackSessionModelContext::legibleMediaSelectionOptionsChanged):
3106         (WebKit::PlaybackSessionModelContext::audioMediaSelectionIndexChanged):
3107         (WebKit::PlaybackSessionModelContext::legibleMediaSelectionIndexChanged):
3108         (WebKit::PlaybackSessionModelContext::externalPlaybackChanged):
3109         (WebKit::PlaybackSessionModelContext::wirelessVideoPlaybackDisabledChanged):
3110         (WebKit::PlaybackSessionModelContext::mutedChanged):
3111         (WebKit::PlaybackSessionModelContext::volumeChanged):
3112         (WebKit::PlaybackSessionModelContext::pictureInPictureActiveChanged):
3113         (WebKit::PlaybackSessionManagerProxy::invalidate):
3114         (WebKit::PlaybackSessionManagerProxy::createModelAndInterface):
3115         (WebKit::PlaybackSessionManagerProxy::removeClientForContext):
3116         * UIProcess/Cocoa/VideoFullscreenManagerProxy.h:
3117         * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm:
3118         (WebKit::VideoFullscreenModelContext::create):
3119         (WebKit::VideoFullscreenModelContext::VideoFullscreenModelContext):
3120         (WebKit::VideoFullscreenModelContext::addClient):
3121         (WebKit::VideoFullscreenModelContext::removeClient):
3122         (WebKit::VideoFullscreenModelContext::willEnterPictureInPicture):
3123         (WebKit::VideoFullscreenModelContext::didEnterPictureInPicture):
3124         (WebKit::VideoFullscreenModelContext::failedToEnterPictureInPicture):
3125         (WebKit::VideoFullscreenModelContext::willExitPictureInPicture):
3126         (WebKit::VideoFullscreenModelContext::didExitPictureInPicture):
3127         (WebKit::VideoFullscreenManagerProxy::invalidate):
3128         (WebKit::VideoFullscreenManagerProxy::createModelAndInterface):
3129         (WebKit::VideoFullscreenManagerProxy::removeClientForContext):
3130         (WebKit::VideoFullscreenModelContext::~VideoFullscreenModelContext): Deleted.
3131         * UIProcess/ios/fullscreen/WKFullScreenViewController.mm:
3132         (WKFullScreenViewControllerPlaybackSessionModelClient::setInterface):
3133         (WKFullScreenViewControllerVideoFullscreenModelClient::setInterface):
3134         (-[WKFullScreenViewController videoControlsManagerDidChange]):
3135         (-[WKFullScreenViewController _togglePiPAction:]):
3136         * UIProcess/mac/WKFullScreenWindowController.mm:
3137         (WebKit::WKFullScreenWindowControllerVideoFullscreenModelClient::setInterface):
3138         * WebProcess/cocoa/PlaybackSessionManager.h:
3139         * WebProcess/cocoa/PlaybackSessionManager.mm:
3140         (WebKit::PlaybackSessionInterfaceContext::PlaybackSessionInterfaceContext):
3141         (WebKit::PlaybackSessionManager::~PlaybackSessionManager):
3142         (WebKit::PlaybackSessionManager::createModelAndInterface):
3143         (WebKit::PlaybackSessionManager::removeContext):
3144         (WebKit::PlaybackSessionInterfaceContext::~PlaybackSessionInterfaceContext): Deleted.
3145         * WebProcess/cocoa/VideoFullscreenManager.h:
3146         (WebKit::VideoFullscreenInterfaceContext::create):
3147         (WebKit::VideoFullscreenInterfaceContext::createWeakPtr):
3148         * WebProcess/cocoa/VideoFullscreenManager.mm:
3149         (WebKit::VideoFullscreenInterfaceContext::VideoFullscreenInterfaceContext):
3150         (WebKit::VideoFullscreenManager::~VideoFullscreenManager):
3151         (WebKit::VideoFullscreenManager::createModelAndInterface):
3152         (WebKit::VideoFullscreenManager::removeContext):
3153
3154 2018-09-28  Chris Dumez  <cdumez@apple.com>
3155
3156         Drop support for cross-origin-window-policy header
3157         https://bugs.webkit.org/show_bug.cgi?id=190081
3158
3159         Reviewed by Ryosuke Niwa.
3160
3161         * Shared/WebPreferences.yaml:
3162         * UIProcess/API/C/WKPreferences.cpp:
3163         * UIProcess/API/C/WKPreferencesRef.h:
3164         * WebProcess/WebPage/WebPage.cpp:
3165         (WebKit::WebPage::frameBecameRemote):
3166
3167 2018-09-28  Chris Dumez  <cdumez@apple.com>
3168
3169         Do not do automatic process prewarming while under memory pressure
3170         https://bugs.webkit.org/show_bug.cgi?id=190082
3171         <rdar://problem/39771424>
3172
3173         Reviewed by Geoffrey Garen.
3174
3175         Do not do automatic process prewarming while under memory pressure and
3176         also terminate any prewarmed process when receiving a memory warning.
3177
3178         * UIProcess/WebProcessPool.cpp:
3179         (WebKit::WebProcessPool::prewarmProcess):
3180         (WebKit::WebProcessPool::didReachGoodTimeToPrewarm):
3181         (WebKit::WebProcessPool::handleMemoryPressureWarning):
3182         * UIProcess/WebProcessPool.h:
3183         * UIProcess/ios/WebMemoryPressureHandlerIOS.mm:
3184         (WebKit::installMemoryPressureHandler):
3185
3186 2018-09-28  Daniel Bates  <dabates@apple.com>
3187
3188         [iOS] Allow programmatic focus when hardware keyboard is attached
3189         https://bugs.webkit.org/show_bug.cgi?id=190017
3190         <rdar://problem/42270463>
3191
3192         Reviewed by Wenson Hsieh.
3193
3194         Make the experience of using iOS with a hardware keyboard more desktop-like by allowing
3195         programmatic focusing of editable elements.
3196
3197         * Platform/spi/ios/UIKitSPI.h: Forward declare SPI.
3198         * Shared/NativeWebKeyboardEvent.h:
3199         * Shared/ios/NativeWebKeyboardEventIOS.mm:
3200         (WebKit::isInHardwareKeyboardMode): Returns whether we are in hardware keyboard mode. In DumpRenderTree
3201         and WebKitTestRunner this function always returns false to keep test results deterministic.
3202         * UIProcess/ios/WKContentViewInteraction.mm:
3203         (-[WKContentView _startAssistingNode:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
3204         Allow starting an input session if we are in hardware keyboard mode.
3205         * WebProcess/WebPage/ios/WebPageIOS.mm:
3206         (WebKit::WebPage::platformEditorState const): Send the full editor state if we are in hardware
3207         keyboard mode regardless of whether layout has been performed so that UIProcess can update UI,
3208         including the position of the caret, immediately.
3209
3210 2018-09-28  Ryosuke Niwa  <rniwa@webkit.org>
3211
3212         Rename createMarkup to serializePreservingVisualAppearance
3213         https://bugs.webkit.org/show_bug.cgi?id=190086
3214
3215         Reviewed by Wenson Hsieh.
3216
3217         * WebProcess/WebCoreSupport/gtk/WebEditorClientGtk.cpp:
3218         (WebKit::WebEditorClient::updateGlobalSelection):
3219
3220 2018-09-28  Commit Queue  <commit-queue@webkit.org>
3221
3222         Unreviewed, rolling out r236605.
3223         https://bugs.webkit.org/show_bug.cgi?id=190087
3224
3225         caused three API test timeouts (Requested by jernoble on
3226         #webkit).
3227
3228         Reverted changeset:
3229
3230         "Refactoring: eliminate raw pointer usage in Fullscreen code"
3231         https://bugs.webkit.org/show_bug.cgi?id=188747
3232         https://trac.webkit.org/changeset/236605
3233
3234 2018-09-28  Jer Noble  <jer.noble@apple.com>
3235
3236         Refactoring: eliminate raw pointer usage in Fullscreen code
3237         https://bugs.webkit.org/show_bug.cgi?id=188747
3238         <rdar://problem/43541164>
3239
3240         Reviewed by Alex Christensen.
3241
3242         Adopt those Ref and WeakPtr changes made in WebCore.
3243
3244         * UIProcess/Cocoa/PlaybackSessionManagerProxy.h:
3245         * UIProcess/Cocoa/PlaybackSessionManagerProxy.mm:
3246         (WebKit::PlaybackSessionModelContext::addClient):
3247         (WebKit::PlaybackSessionModelContext::removeClient):
3248         (WebKit::PlaybackSessionModelContext::durationChanged):
3249         (WebKit::PlaybackSessionModelContext::currentTimeChanged):
3250         (WebKit::PlaybackSessionModelContext::bufferedTimeChanged):
3251         (WebKit::PlaybackSessionModelContext::rateChanged):
3252         (WebKit::PlaybackSessionModelContext::seekableRangesChanged):
3253         (WebKit::PlaybackSessionModelContext::canPlayFastReverseChanged):
3254         (WebKit::PlaybackSessionModelContext::audioMediaSelectionOptionsChanged):
3255         (WebKit::PlaybackSessionModelContext::legibleMediaSelectionOptionsChanged):
3256         (WebKit::PlaybackSessionModelContext::audioMediaSelectionIndexChanged):
3257         (WebKit::PlaybackSessionModelContext::legibleMediaSelectionIndexChanged):
3258         (WebKit::PlaybackSessionModelContext::externalPlaybackChanged):
3259         (WebKit::PlaybackSessionModelContext::wirelessVideoPlaybackDisabledChanged):
3260         (WebKit::PlaybackSessionModelContext::mutedChanged):
3261         (WebKit::PlaybackSessionModelContext::volumeChanged):
3262         (WebKit::PlaybackSessionModelContext::pictureInPictureActiveChanged):
3263         (WebKit::PlaybackSessionManagerProxy::invalidate):
3264         (WebKit::PlaybackSessionManagerProxy::createModelAndInterface):
3265         (WebKit::PlaybackSessionManagerProxy::removeClientForContext):
3266         * UIProcess/Cocoa/VideoFullscreenManagerProxy.h:
3267         * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm:
3268         (WebKit::VideoFullscreenModelContext::create):
3269         (WebKit::VideoFullscreenModelContext::VideoFullscreenModelContext):
3270         (WebKit::VideoFullscreenModelContext::addClient):
3271         (WebKit::VideoFullscreenModelContext::removeClient):
3272         (WebKit::VideoFullscreenModelContext::willEnterPictureInPicture):
3273         (WebKit::VideoFullscreenModelContext::didEnterPictureInPicture):
3274         (WebKit::VideoFullscreenModelContext::failedToEnterPictureInPicture):
3275         (WebKit::VideoFullscreenModelContext::willExitPictureInPicture):
3276         (WebKit::VideoFullscreenModelContext::didExitPictureInPicture):
3277         (WebKit::VideoFullscreenManagerProxy::invalidate):
3278         (WebKit::VideoFullscreenManagerProxy::createModelAndInterface):
3279         (WebKit::VideoFullscreenManagerProxy::removeClientForContext):
3280         (WebKit::VideoFullscreenModelContext::~VideoFullscreenModelContext): Deleted.
3281         * UIProcess/ios/fullscreen/WKFullScreenViewController.mm:
3282         (WKFullScreenViewControllerPlaybackSessionModelClient::setInterface):
3283         (WKFullScreenViewControllerVideoFullscreenModelClient::setInterface):
3284         (-[WKFullScreenViewController videoControlsManagerDidChange]):
3285         (-[WKFullScreenViewController _togglePiPAction:]):
3286         * UIProcess/mac/WKFullScreenWindowController.mm:
3287         (WebKit::WKFullScreenWindowControllerVideoFullscreenModelClient::setInterface):
3288         * WebProcess/cocoa/PlaybackSessionManager.h:
3289         * WebProcess/cocoa/PlaybackSessionManager.mm:
3290         (WebKit::PlaybackSessionInterfaceContext::PlaybackSessionInterfaceContext):
3291         (WebKit::PlaybackSessionManager::~PlaybackSessionManager):
3292         (WebKit::PlaybackSessionManager::createModelAndInterface):
3293         (WebKit::PlaybackSessionManager::removeContext):
3294         (WebKit::PlaybackSessionInterfaceContext::~PlaybackSessionInterfaceContext): Deleted.
3295         * WebProcess/cocoa/VideoFullscreenManager.h:
3296         (WebKit::VideoFullscreenInterfaceContext::create):
3297         (WebKit::VideoFullscreenInterfaceContext::createWeakPtr):
3298         * WebProcess/cocoa/VideoFullscreenManager.mm:
3299         (WebKit::VideoFullscreenInterfaceContext::VideoFullscreenInterfaceContext):
3300         (WebKit::VideoFullscreenManager::~VideoFullscreenManager):
3301         (WebKit::VideoFullscreenManager::createModelAndInterface):
3302         (WebKit::VideoFullscreenManager::removeContext):
3303
3304 2018-09-28  Fujii Hironori  <Hironori.Fujii@sony.com>
3305
3306         [WinCairo] error C2027: use of undefined type 'WTF::EnumTraits<E>' while compiling AuthenticationChallengeProxy.cpp
3307         https://bugs.webkit.org/show_bug.cgi?id=190071
3308
3309         Unreviewed build fix for WinCairo port.
3310
3311         AuthenticationChallengeDisposition was not defined in this file.
3312
3313         * UIProcess/Authentication/AuthenticationChallengeProxy.cpp: Include "AuthenticationChallengeDisposition.h".
3314
3315 2018-09-26  Ryosuke Niwa  <rniwa@webkit.org>
3316
3317         Use enum class in createMarkup arguments
3318         https://bugs.webkit.org/show_bug.cgi?id=190028
3319
3320         Reviewed by Wenson Hsieh.
3321
3322         * WebProcess/WebCoreSupport/gtk/WebEditorClientGtk.cpp:
3323         (WebKit::WebEditorClient::updateGlobalSelection):
3324
3325 2018-09-27  John Wilander  <wilander@apple.com>
3326
3327         Resource Load Statistics: Non-redirected top frame navigation should not get captured in statistics
3328         https://bugs.webkit.org/show_bug.cgi?id=190055
3329         <rdar://problem/44843460>
3330
3331         Reviewed by Chris Dumez.
3332
3333         * UIProcess/ResourceLoadStatisticsMemoryStore.cpp:
3334             Bumped the statisticsModelVersion to 14 to be able to
3335             correct legacy statistics.
3336         (WebKit::ResourceLoadStatisticsMemoryStore::logFrameNavigation):
3337             Now skips capture if it's the main frame.
3338
3339 2018-09-27  Brent Fulgham  <bfulgham@apple.com>
3340
3341         [iOS] Allow access to VoiceServices features needed for accessibility
3342         https://bugs.webkit.org/show_bug.cgi?id=190019
3343         <rdar://problem/43621111>
3344
3345         Reviewed by Chris Fleizach.
3346
3347         Revise the sandbox to allow access to relevant WebSpeech features.
3348
3349         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
3350
3351 2018-09-27  Sihui Liu  <sihui_liu@apple.com>
3352
3353         Fix IOSMAC build
3354         https://bugs.webkit.org/show_bug.cgi?id=190021
3355
3356         Reviewed by Alex Christensen.
3357
3358         * NetworkProcess/mac/NetworkProcessMac.mm:
3359         (WebKit::NetworkProcess::parentProcessHasServiceWorkerEntitlement const):
3360
3361 2018-09-27  John Wilander  <wilander@apple.com>
3362
3363         Resource Load Statistics: Remove temporary compatibility fix for auto-dismiss popups
3364         https://bugs.webkit.org/show_bug.cgi?id=189980
3365         <rdar://problem/44780645>
3366
3367         Reviewed by Alex Christensen.
3368
3369         The change in https://bugs.webkit.org/show_bug.cgi?id=183620 was a temporary
3370         compatibility fix as explained in:
3371         https://webkit.org/blog/8311/intelligent-tracking-prevention-2-0/. We should
3372         remove it.
3373
3374         These changes remove the parameter isTriggeredByUserGesture since it's no longer needed.
3375
3376         * UIProcess/ResourceLoadStatisticsMemoryStore.cpp:
3377         (WebKit::ResourceLoadStatisticsMemoryStore::requestStorageAccessUnderOpener):
3378         * UIProcess/ResourceLoadStatisticsMemoryStore.h:
3379         * UIProcess/WebResourceLoadStatisticsStore.cpp:
3380         (WebKit::WebResourceLoadStatisticsStore::requestStorageAccessUnderOpener):
3381         * UIProcess/WebResourceLoadStatisticsStore.h:
3382         * UIProcess/WebResourceLoadStatisticsStore.messages.in:
3383         * WebProcess/WebProcess.cpp:
3384         (WebKit::WebProcess::WebProcess):
3385
3386 2018-09-27  Ryan Haddad  <ryanhaddad@apple.com>
3387
3388         Unreviewed, rolling out r236557.
3389
3390         Really roll out r236557 this time because it breaks internal
3391         builds.
3392
3393         Reverted changeset:
3394
3395         "Add VP8 support to WebRTC"
3396         https://bugs.webkit.org/show_bug.cgi?id=189976
3397         https://trac.webkit.org/changeset/236557
3398
3399 2018-09-27  Youenn Fablet  <youenn@apple.com>
3400
3401         Add VP8 support to WebRTC
3402         https://bugs.webkit.org/show_bug.cgi?id=189976
3403
3404         Reviewed by Eric Carlson.
3405
3406         * Shared/WebPreferences.yaml:
3407
3408 2018-09-27  Chris Dumez  <cdumez@apple.com>
3409
3410         The WebContent process should not process incoming IPC while waiting for a sync IPC reply
3411         https://bugs.webkit.org/show_bug.cgi?id=184183
3412         <rdar://problem/36800576>
3413
3414         Reviewed by Ryosuke Niwa.
3415
3416         In recent years, we have experienced re-entrancy bugs/crashes in WebCore due to the WebContent process
3417         processing unrelated incoming synchronous IPC when waiting for a reply to one of its synchronous IPC
3418         to another process. In order to deal with this, we introduced a DoNotProcessIncomingMessagesWhenWaitingForSyncReply
3419         IPC::SendOption which we used on sendSync() calls where we knew re-entering would be unsafe. However,
3420         it turns out to be needed for a lot of the WebProcess's sync IPC and it is error-prone. In order to
3421         address the issue, we've decided to update the WebContent process behavior so that it processes all its
3422         IPC in order (not matter if synchronous or not) and thus so that we never dispatch unrelated synchronous
3423         IPC while waiting for a synchronous IPC reply, expect in cases where it would cause a deadlock.
3424
3425         As a result, this patch also drops support for the DoNotProcessIncomingMessagesWhenWaitingForSyncReply
3426         IPC::SendOption which is no longer needed and has some code complexity.
3427
3428         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
3429         (WebKit::NetworkConnectionToWebProcess::NetworkConnectionToWebProcess):
3430         * Platform/IPC/Connection.cpp:
3431         (IPC::Connection::sendSyncMessage):
3432         (IPC::Connection::waitForSyncReply):
3433         * Platform/IPC/Connection.h:
3434         (IPC::Connection::sendSync):
3435         * PluginProcess/WebProcessConnection.cpp:
3436         (WebKit::WebProcessConnection::WebProcessConnection):
3437         * StorageProcess/StorageToWebProcessConnection.cpp:
3438         (WebKit::StorageToWebProcessConnection::StorageToWebProcessConnection):
3439         * UIProcess/WebProcessProxy.cpp:
3440         (WebKit::WebProcessProxy::connectionWillOpen):
3441         * UIProcess/WebProcessProxy.h:
3442         * UIProcess/WebProcessProxy.messages.in:
3443         * WebProcess/InjectedBundle/InjectedBundle.cpp:
3444         (WebKit::InjectedBundle::postSynchronousMessage):
3445         * WebProcess/Network/WebLoaderStrategy.cpp:
3446         (WebKit::WebLoaderStrategy::loadResourceSynchronously):
3447         (WebKit::WebLoaderStrategy::responseFromResourceLoadIdentifier):
3448         (WebKit::WebLoaderStrategy::intermediateLoadInformationFromResourceLoadIdentifier):
3449         (WebKit::WebLoaderStrategy::networkMetricsFromResourceLoadIdentifier):
3450         * WebProcess/Plugins/PluginProxy.cpp:
3451         (WebKit::PluginProxy::destroy):
3452         (WebKit::PluginProxy::supportsSnapshotting const):
3453         * WebProcess/Plugins/WebPluginInfoProvider.cpp:
3454         (WebKit::WebPluginInfoProvider::populatePluginCache):
3455         * WebProcess/Storage/WebSWClientConnection.cpp:
3456         (WebKit::WebSWClientConnection::WebSWClientConnection):
3457         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
3458         * WebProcess/WebCoreSupport/WebChromeClient.h:
3459         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
3460         (WebKit::WebFrameLoaderClient::savePlatformDataToCachedFrame):
3461         * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
3462         (WebKit::WebPlatformStrategies::cookieRequestHeaderFieldValue):
3463         * WebProcess/WebPage/WebPage.cpp:
3464         (WebKit::WebPage::rootViewToScreen):
3465         * WebProcess/WebProcess.cpp:
3466         (WebKit::getNetworkProcessConnection):
3467         * WebProcess/WebProcess.h:
3468         * WebProcess/WebProcess.messages.in:
3469
3470 2018-09-27  Antoine Quint  <graouts@apple.com>
3471
3472         [Web Animations] Turn Web Animations with CSS integration on
3473         https://bugs.webkit.org/show_bug.cgi?id=184819
3474         <rdar://problem/39597337>
3475
3476         Reviewed by Dean Jackson.
3477
3478         * Shared/WebPreferences.yaml:
3479
3480 2018-09-26  James Savage  <james.savage@apple.com>
3481
3482         Allow override of viewport configuration.
3483         https://bugs.webkit.org/show_bug.cgi?id=188772.
3484         <rdar://problem/43538892>.
3485
3486         Reviewed by Simon Fraser.
3487
3488         * Shared/WebPreferences.yaml:
3489         * UIProcess/API/Cocoa/WKPreferences.mm:
3490         (-[WKPreferences _setShouldIgnoreMetaViewport:]):
3491         (-[WKPreferences _shouldIgnoreMetaViewport]):
3492         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
3493         * WebProcess/WebPage/WebPage.cpp:
3494         (WebKit::WebPage::viewportPropertiesDidChange): If we are ignoring the
3495         <meta> viewport, short circuit calling setViewportArguments() and do not
3496         do any updates.
3497         (WebKit::WebPage::didCommitLoad): Ditto.
3498         * WebProcess/WebPage/ios/WebPageIOS.mm:
3499         (WebKit::WebPage::resetViewportDefaultConfiguration): Select the default
3500         configuration based on UIProcess setting.
3501
3502 2018-09-26  Chris Dumez  <cdumez@apple.com>
3503
3504         Regression(r236512): WKWebViewCandidateTests.SoftSpaceReplacementAfterCandidateInsertionWithoutReplacement API test is failing
3505         https://bugs.webkit.org/show_bug.cgi?id=190007
3506
3507         Reviewed by Alex Christensen.
3508
3509         Drop DispatchMessageEvenWhenWaitingForSyncReply SendOption from EditorStateChanged IPC calls to restore
3510         pre-r236512 behavior. Before r236512, this option had no effect on IPC from the WebContent to the UIProcess
3511         because the m_onlySendMessagesAsDispatchWhenWaitingForSyncReplyWhenProcessingSuchAMessage flag was set
3512         on that IPC::Connection. However, after r236512, m_onlySendMessagesAsDispatchWhenWaitingForSyncReplyWhenProcessingSuchAMessage
3513         is no longer set on the connection, and the DispatchMessageEvenWhenWaitingForSyncReply SendOption was
3514         causing this message to get processed out of order with regards to other async IPC, thus causing the
3515         API test failure.
3516
3517         * WebProcess/WebPage/WebPage.cpp:
3518         (WebKit::WebPage::sendEditorStateUpdate):
3519         (WebKit::WebPage::sendPartialEditorStateAndSchedulePostLayoutUpdate):
3520
3521 2018-09-26  Alex Christensen  <achristensen@webkit.org>
3522
3523         Fix UAF after r236463
3524         https://bugs.webkit.org/show_bug.cgi?id=190011
3525
3526         Reviewed by Chris Dumez.
3527
3528         I had removed an early return in NetworkResourceLoader::continueDidReceiveResponse.
3529         Reading the (probably) null m_responseCompletionHandler was reading after the object had been destroyed.
3530
3531         * NetworkProcess/NetworkResourceLoader.cpp:
3532         (WebKit::NetworkResourceLoader::continueDidReceiveResponse):
3533
3534 2018-09-26  Ryosuke Niwa  <rniwa@webkit.org>
3535
3536         Selection should work across shadow boundary when initiated by a mouse drag
3537         https://bugs.webkit.org/show_bug.cgi?id=151380
3538         <rdar://problem/24363872>
3539
3540         Reviewed by Antti Koivisto.
3541
3542         Added SelectionAcrossShadowBoundariesEnabled as an internal debug feature,
3543         and moved CSSCustomPropertiesAndValuesEnabled to where other experimental features are located.
3544
3545         * Shared/WebPreferences.yaml:
3546
3547 2018-09-26  Chris Dumez  <cdumez@apple.com>
3548
3549         Unreviewed, apply post-landing review comments after r236512.
3550
3551         * UIProcess/WebPageProxy.cpp:
3552         (WebKit::WebPageProxy::didCreateMainFrame):
3553         (WebKit::WebPageProxy::didCreateSubframe):
3554
3555 2018-09-26  Chris Dumez  <cdumez@apple.com>
3556
3557         UIProcess should process incoming sync IPC from WebProcess when waiting for a sync IPC reply from it
3558         https://bugs.webkit.org/show_bug.cgi?id=189927
3559
3560         Reviewed by Geoffrey Garen.
3561
3562         UIProcess should process incoming sync IPC from WebProcess when waiting for a sync IPC reply from it
3563         in order to avoid deadlocks. This is not an issue currently because the WebProcess does process
3564         incoming sync IPC when waiting for a sync IPC reply. However, we plan to change this in the future
3565         in order to avoid bugs caused by re-entering WebCore at unsafe times.
3566
3567         The reason the UIProcess previously did not do out of order sync IPC process was to avoid processing
3568         a synchronous policy decision IPC for a frameID it did not know about yet, due to the DidCreateMainFrame /
3569         DidCreateSubframe IPC messages being asynchronous. To address this issue, the decidePolicyForNavigationActionSync
3570         IPC handler now calls didCreateMainFrame() / didCreateSubframe() as needed if it does not know about
3571         the frame yet. Note that synchronous policy decisions are rare and are currently only needed by initial
3572         about:blank and fragment navigations.
3573
3574         * UIProcess/WebPageProxy.cpp:
3575         (WebKit::WebPageProxy::didCreateMainFrame):
3576         (WebKit::WebPageProxy::didCreateSubframe):
3577         (WebKit::WebPageProxy::decidePolicyForNavigationActionAsync):
3578         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
3579         (WebKit::WebPageProxy::decidePolicyForNavigationActionSync):
3580         * UIProcess/WebPageProxy.h:
3581         * UIProcess/WebPageProxy.messages.in:
3582         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
3583         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
3584
3585         * WebProcess/WebPage/WebFrame.cpp:
3586         (WebKit::WebFrame::createWithCoreMainFrame):
3587         (WebKit::WebFrame::createSubframe):
3588         Drop DispatchMessageEvenWhenWaitingForSyncReply SendOption when sending the
3589         DidCreateMainFrame / DidCreateSubframe IPC. Previously, this SendOption has
3590         no effect because the IPC::Connection would have the
3591         m_onlySendMessagesAsDispatchWhenWaitingForSyncReplyWhenProcessingSuchAMessage
3592         flag set to true. However, now that we stop setting this flag on the IPC
3593         connection from the WebProcess to the UIProcess, it would lead to those
3594         IPC messages getting processed out of order with regards to the
3595         DecidePolicyForNavigationAsync asynchronous IPC. DidCreateMainFrame would
3596         sometimes get processed *after* the DecidePolicyForNavigationAsync IPC
3597         and we would not know about the frameID yet.
3598
3599         * WebProcess/WebProcess.cpp:
3600         (WebKit::WebProcess::initializeConnection):
3601
3602 2018-09-26  Antti Koivisto  <antti@apple.com>
3603
3604         REGRESSION (PSON): White or Black flash occurs when process swapping on navigation on iOS
3605         https://bugs.webkit.org/show_bug.cgi?id=189695
3606         <rdar://problem/44551146>
3607
3608         Reviewed by Simon Fraser.
3609
3610         Freeze the layers on UI process side during process swap.
3611
3612         * UIProcess/API/Cocoa/WKWebView.mm:
3613         (-[WKWebView _processWillChange]):
3614
3615         Shared work of _processWillSwap and _processDidExit.
3616
3617         (-[WKWebView _processWillSwap]):
3618         (-[WKWebView _processDidExit]):
3619
3620         Split into two functions. Don't reset scroll position and similar when doing navigation swap.
3621
3622         * UIProcess/API/Cocoa/WKWebViewInternal.h:
3623         * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.h:
3624         * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm:
3625         (WebKit::RemoteLayerTreeDrawingAreaProxy::RemoteLayerTreeDrawingAreaProxy):
3626         (WebKit::RemoteLayerTreeDrawingAreaProxy::detachRemoteLayerTreeHost):
3627
3628         Add to way to detach RemoteLayerTreeHost from the drawing area. Inert RemoteLayerTreeHost will host
3629         the frozen layers.
3630
3631         (WebKit::RemoteLayerTreeDrawingAreaProxy::commitLayerTree):
3632         (WebKit::RemoteLayerTreeDrawingAreaProxy::updateDebugIndicator):
3633         (WebKit::RemoteLayerTreeDrawingAreaProxy::hideContentUntilPendingUpdate):
3634         (WebKit::RemoteLayerTreeDrawingAreaProxy::hideContentUntilAnyUpdate):
3635         (WebKit::RemoteLayerTreeDrawingAreaProxy::prepareForAppSuspension):
3636         (WebKit::RemoteLayerTreeDrawingAreaProxy::hasVisibleContent const):
3637         (WebKit::RemoteLayerTreeDrawingAreaProxy::layerWithIDForTesting const):
3638         * UIProcess/RemoteLayerTree/RemoteLayerTreeHost.h:
3639         * UIProcess/RemoteLayerTree/RemoteLayerTreeHost.mm:
3640         (WebKit::RemoteLayerTreeHost::RemoteLayerTreeHost):
3641         (WebKit::RemoteLayerTreeHost::updateLayerTree):
3642         (WebKit::RemoteLayerTreeHost::animationDidStart):
3643         (WebKit::RemoteLayerTreeHost::animationDidEnd):
3644         (WebKit::RemoteLayerTreeHost::detachFromDrawingArea):
3645
3646         Clear the DrawingArea backpointer.
3647
3648         * UIProcess/WebPageProxy.cpp:
3649         (WebKit::WebPageProxy::continueNavigationInNewProcess):
3650         (WebKit::WebPageProxy::resetState):
3651
3652         Detach and save the current RemoteLayerTreeHost on navigation swap.
3653
3654         * UIProcess/WebPageProxy.h:
3655         * UIProcess/ios/PageClientImplIOS.mm:
3656         (WebKit::PageClientImpl::processWillSwap):
3657
3658         Avoid reseting the scroll position.
3659
3660         * UIProcess/ios/WebPageProxyIOS.mm:
3661         (WebKit::WebPageProxy::setAcceleratedCompositingRootLayer):
3662
3663         Drop the frozen layers after setting the new root layer.
3664
3665         * UIProcess/mac/WebPageProxyMac.mm:
3666         (WebKit::WebPageProxy::setAcceleratedCompositingRootLayer):
3667
3668         For completeness do this also on Mac (where remote layers are currently not used).
3669
3670 2018-09-25  Ryosuke Niwa  <rniwa@webkit.org>
3671
3672         Make frame flattening an internal debug feature
3673         https://bugs.webkit.org/show_bug.cgi?id=189984
3674
3675         Reviewed by Simon Fraser.
3676
3677         Made frame flattening a runtime switchable from internal debug menu.
3678
3679         To avoid having to enumerate three distinct values in the settings, made it a boolean flag in WKPreference.
3680         That's what's exposd as an API anyway.
3681
3682         * Shared/WebPreferences.yaml:
3683         * Shared/WebPreferencesDefaultValues.h:
3684         * UIProcess/API/C/WKPreferences.cpp:
3685         (WKPreferencesSetFrameFlatteningEnabled):
3686         (WKPreferencesGetFrameFlatteningEnabled):
3687         * UIProcess/API/glib/WebKitSettings.cpp:
3688         (webkit_settings_get_enable_frame_flattening):
3689         (webkit_settings_set_enable_frame_flattening):
3690         * WebProcess/WebPage/WebPage.cpp:
3691         (WebKit::WebPage::updatePreferences):
3692
3693 2018-09-25  Eric Carlson  <eric.carlson@apple.com>
3694
3695         [MediaStream] Add Mac window capture source
3696         https://bugs.webkit.org/show_bug.cgi?id=189958
3697         <rdar://problem/44767616>
3698
3699         Reviewed by Youenn Fablet.
3700
3701         * UIProcess/UserMediaPermissionRequestManagerProxy.h:
3702         * UIProcess/WebPageProxy.cpp:
3703         (WebKit::WebPageProxy::beginMonitoringCaptureDevices): Sync with webcore prefs before listening
3704         to device changes so we listen on the correct devices.
3705
3706 2018-09-25  Chris Dumez  <cdumez@apple.com>
3707
3708         Unreviewed, rolling out r236471 and r236480.
3709
3710         Seems to be causing some flaky crashes
3711
3712         Reverted changesets:
3713
3714         "UIProcess should process incoming sync IPC from WebProcess
3715         when waiting for a sync IPC reply from it"
3716         https://bugs.webkit.org/show_bug.cgi?id=189927
3717         https://trac.webkit.org/changeset/236471
3718
3719         "Revert some of the changes in r236471"
3720         https://bugs.webkit.org/show_bug.cgi?id=189973
3721         https://trac.webkit.org/changeset/236480
3722
3723 2018-09-25  Conrad Shultz  <conrad_shultz@apple.com>
3724
3725         Enable customization of the file upload panel
3726         https://bugs.webkit.org/show_bug.cgi?id=189970
3727
3728         Reviewed by Wenson Hsieh.
3729
3730         With this change, platform implementations can override, or implement in a category,
3731         +[WKContentView _fileUploadPanelClass] as needed.
3732
3733         * UIProcess/ios/WKContentViewInteraction.h:
3734         * UIProcess/ios/WKContentViewInteraction.mm:
3735         (-[WKContentView _showRunOpenPanel:resultListener:]):
3736
3737 2018-09-25  Chris Dumez  <cdumez@apple.com>
3738
3739         Unreviewed, rolling out r236420 and r236458.
3740
3741         This change is not fully correct
3742
3743         Reverted changesets:
3744
3745         "Do not do early processing of incoming sync IPC unless we're
3746         waiting for a sync IPC reply"
3747         https://bugs.webkit.org/show_bug.cgi?id=186941
3748         https://trac.webkit.org/changeset/236420
3749
3750         "Unreviewed, update bug number of http/tests/misc/blob-
3751         size.html crash on Windows"
3752         https://trac.webkit.org/changeset/236458
3753
3754 2018-09-25  Jiewen Tan  <jiewen_tan@apple.com>
3755
3756         Unreviewed, a quick fix after r236481.
3757
3758         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
3759         (WebKit::WebsiteDataStore::setMockWebAuthenticationConfiguration):
3760         Add an early return, so we don't end up with setting MockWebAuthenticationConfiguration twice.
3761
3762 2018-09-25  John Wilander  <wilander@apple.com>
3763
3764         Change from HAVE(CFNETWORK_STORAGE_PARTITIONING) to ENABLE(RESOURCE_LOAD_STATISTICS)
3765         https://bugs.webkit.org/show_bug.cgi?id=189959
3766         <rdar://problem/44767642>
3767
3768         Reviewed by Chris Dumez.
3769
3770         We no longer make use of CFNetwork's cookie partitioning so we should
3771         change the compile-time flag to something that makes sense. This should
3772         also make it easier/cleaner for other ports.
3773
3774         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
3775         (WebKit::NetworkConnectionToWebProcess::cookiesForDOM):
3776         (WebKit::NetworkConnectionToWebProcess::setCookiesFromDOM):
3777         (WebKit::NetworkConnectionToWebProcess::removeStorageAccessForFrame):
3778         (WebKit::NetworkConnectionToWebProcess::removeStorageAccessForAllFramesOnPage):
3779         * NetworkProcess/NetworkProcess.cpp:
3780         (WebKit::NetworkProcess::initializeNetworkProcess):
3781         * NetworkProcess/NetworkProcess.h:
3782         * NetworkProcess/NetworkProcess.messages.in:
3783         * NetworkProcess/NetworkProcessCreationParameters.cpp:
3784         (WebKit::NetworkProcessCreationParameters::encode const):
3785         (WebKit::NetworkProcessCreationParameters::decode):
3786         * NetworkProcess/NetworkProcessCreationParameters.h:
3787         * NetworkProcess/NetworkResourceLoader.cpp:
3788         (WebKit::NetworkResourceLoader::didFinishLoading):
3789         (WebKit::NetworkResourceLoader::sendResultForCacheEntry):
3790         * NetworkProcess/NetworkResourceLoader.h:
3791         * NetworkProcess/cache/NetworkCache.cpp:
3792         (WebKit::NetworkCache::Cache::retrieve):
3793         * NetworkProcess/cocoa/NetworkDataTaskCocoa.h:
3794         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
3795         (WebKit::NetworkDataTaskCocoa::applyCookieBlockingPolicy):
3796         (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa):
3797         (WebKit::NetworkDataTaskCocoa::willPerformHTTPRedirection):
3798         * Shared/WebProcessCreationParameters.cpp:
3799         (WebKit::WebProcessCreationParameters::encode const):
3800         (WebKit::WebProcessCreationParameters::decode):
3801         * Shared/WebProcessCreationParameters.h:
3802         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
3803         (WebKit::WebProcessPool::platformInitializeWebProcess):
3804         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
3805         * UIProcess/Network/NetworkProcessProxy.cpp:
3806         * UIProcess/Network/NetworkProcessProxy.h:
3807         * UIProcess/Network/NetworkProcessProxy.messages.in:
3808         * UIProcess/WebPageProxy.cpp:
3809         * UIProcess/WebPageProxy.h:
3810         * UIProcess/WebPageProxy.messages.in:
3811         * UIProcess/WebResourceLoadStatisticsStore.cpp:
3812         (WebKit::WebResourceLoadStatisticsStore::callHasStorageAccessForFrameHandler):
3813         (WebKit::WebResourceLoadStatisticsStore::callGrantStorageAccessHandler):
3814         (WebKit::WebResourceLoadStatisticsStore::removeAllStorageAccess):
3815         (WebKit::WebResourceLoadStatisticsStore::setCacheMaxAgeCap):
3816         (WebKit::WebResourceLoadStatisticsStore::callUpdatePrevalentDomainsToBlockCookiesForHandler):
3817         (WebKit::WebResourceLoadStatisticsStore::callRemoveDomainsHandler):
3818         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
3819         (WebKit::WebsiteDataStore::setCacheMaxAgeCapForPrevalentResources):
3820         (WebKit::WebsiteDataStore::resetCacheMaxAgeCapForPrevalentResources):
3821         (WebKit::WebsiteDataStore::networkProcessDidCrash):
3822         * UIProcess/WebsiteData/WebsiteDataStore.h:
3823         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
3824         * WebProcess/WebCoreSupport/WebChromeClient.h:
3825         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
3826         (WebKit::WebFrameLoaderClient::detachedFromParent2):
3827         (WebKit::WebFrameLoaderClient::dispatchWillChangeDocument):
3828         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
3829         * WebProcess/WebPage/WebPage.cpp:
3830         * WebProcess/WebPage/WebPage.h:
3831         * WebProcess/WebPage/WebPage.messages.in:
3832         * WebProcess/WebProcess.cpp:
3833         (WebKit::WebProcess::initializeWebProcess):
3834
3835 2018-09-25  Philippe Normand  <pnormand@igalia.com>
3836
3837         [WPE] Export jsc_ symbols
3838         https://bugs.webkit.org/show_bug.cgi?id=189964
3839
3840         Reviewed by Michael Catanzaro.
3841
3842         * webkitglib-symbols.map: Keep jsc_* symbols as visible so they
3843         can be used by applications depending on WPE.
3844
3845 2018-09-25  Jiewen Tan  <jiewen_tan@apple.com>
3846
3847         [WebAuthN] Make AuthenticatorManager
3848         https://bugs.webkit.org/show_bug.cgi?id=189279
3849         <rdar://problem/44116792>
3850
3851         Reviewed by Chris Dumez.
3852
3853         This patch introduces AuthenticatorManager which is the central of WebAuthentication that 1) handles
3854         web requests, 2) discovers authenticators, 3) manages authetnicators and 4) in the future interacts with UI.
3855         The lifetime of the AuthenticatorManager is managed by WebsiteDataStore such that it is almost a singleton
3856         per UI Process.
3857
3858         1) Requests come from WebAuthenticatorCoordinatorProxy and then cached in AuthenticatorManager which will
3859         then distribute requests whenever a new authenticator is discovered.
3860
3861         2) An ABC AuthenticatorTransportService is provided as an interface for AuthenticatorManager to invoke
3862         startDiscovery. Actual work will be done in corresponding derived classes, say, LocalService. LocalService
3863         is the one that discover attached platform authenticators, for example, TouchID or FaceID.
3864
3865         Eache service is unique per AuthetnicatorManager, which means we will have at most 4 services, Local, USB,
3866         NFC, and BLE. The latter three will be implemented soon. Also, AuthenticatorManager serves as an observer to
3867         *Service, so the latter can inform the former whenever an authenticator is added or removed.
3868
3869         When a new authenticator is discovered, the corresponding service will create an Authetnicator object that
3870         binds to the physical authenticator device through a *Connection object. There is no ABC for connection for
3871         now as I forsee every *Connection will be quite different. The *Connection object is the one that send/receive
3872         messages from the physicla device. So far, a LocalConnection is provided even though normally local authenticators
3873         are attached. This class is provided solely for separating UI and network traffic from LocalAuthenticator's
3874         request handling process. So we can override them in a mock test environment. I will talk about this in the
3875         next section.
3876
3877         3) An ABC Authenticator is provided as an interface for AuthenticatorManager to distribute requests on. Requests
3878         will then be handled by the derived classes, say, LocalAuthenticator. Each authenticator object is a FSM that
3879         works asynchronously.
3880
3881         For LocalAuthenticator, it has 4 states for MakeCredential: Init => RequestReceived => UserConsented => Attested => End,
3882         and 3 states for GetAssertion: Init => RequestReceived => UserConsented => End. In the transit from RequestReceived to
3883         UserConsented, it will invoke LocalConnection to talk to LocalAuthentication.framework that prompt users for TouchID
3884         or FaceID. And then the transit from UserConsented => Attested, it will invoke LocalConnection to talk to
3885         DeviceIdentity.framework that does Apple attestation. Most of the work are from the original LocalAuthenticator
3886         implementation, and this patch converts it to a FSM and simplify the callback and threading model.
3887
3888         When a respond is ready, each authenticator will notify their observer which is the AuthenticatorManager.
3889         AuthenticatorManager will only reply to Web Process whenever there is a valid respond or a terminating error. Otherwise,
3890         the request will time out. I will explore the time out mechanism in a more detailed manner in Bug 189642.
3891
3892         The above is a briefing of the AuthetnicatorManager architecture in functional. The asynchronous model is explained here:
3893         1) Since most discovery and request handling processes are asynchronous, I enforced them to be executed asyncrhonous in
3894         the interface of the ABC.
3895         2) There is no dedicated secondary threads here. However, underlying framework might decide to perform works on a dedicated
3896         thread and then execute the provided callback. Whenever such situation happens, the policy here is to wrap the actual callback
3897         into a callback that will post the actual callback back to the main thread and pass the wrapping callback to the APIs. Hence,
3898         weak pointers in the actual callback are guaranteed to work.
3899         3) Callbacks are used only if it is one way, and they are CompletionHandlers.
3900         4) Potential multi ways asynchronous operations are encapsulated in regarding Observer interfaces.
3901
3902         Finally, let me explain how the mock test works:
3903         1) Mock testing is done in WebKitTestRunner instead of Internals because a considerable large portion of work is in UIProcess
3904         instead of WebProcess, says, the AuthenticatorManager.
3905         2) The basic idea is to override functionality of *Connection classes and then make them thin such that we can get the best
3906         possible coverage in auto tests.
3907         3) In order to enable layout tests to configure the Mock*Connection classes, a MockWebAuthenticationConfiguration struct is
3908         provided. A corresponding JS dictionary will be created by each test and passed from the TestRunner to the connection object.
3909         4) To bridge the above tunnel, a MockAuthenticatorManager is constructed. It is instrumented to return every error.
3910         5) Also, Mock*Service classes are made to mock the discovery process as well.
3911         6) Noted, every mock overrided methods are made thin.
3912
3913         * CMakeLists.txt:
3914         * Configurations/WebKit.xcconfig:
3915         * Platform/spi/Cocoa/DeviceIdentitySPI.h: Copied from Source/WebCore/PAL/pal/spi/cocoa/DeviceIdentitySPI.h.
3916         * SourcesCocoa.txt:
3917         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
3918         (WKWebsiteDataStoreSetWebAuthenticationMockConfiguration):
3919         * UIProcess/API/C/WKWebsiteDataStoreRef.h:
3920         * UIProcess/WebAuthentication/Authenticator.cpp: Copied from Source/WebCore/platform/cocoa/LocalAuthenticationSoftLink.h.
3921         (WebKit::Authenticator::handleRequest):
3922         (WebKit::Authenticator::receiveRespond const):
3923         * UIProcess/WebAuthentication/Authenticator.h: Renamed from Source/WebCore/Modules/webauthn/cocoa/LocalAuthenticator.h.
3924         (WebKit::Authenticator::setObserver):
3925         (WebKit::Authenticator::observer const):
3926         (WebKit::Authenticator::requestData const):
3927         * UIProcess/WebAuthentication/AuthenticatorManager.cpp: Added.
3928         (WebKit::AuthenticatorManagerInternal::collectTransports):
3929         (WebKit::AuthenticatorManager::makeCredential):
3930         (WebKit::AuthenticatorManager::getAssertion):
3931         (WebKit::AuthenticatorManager::clearState):
3932         (WebKit::AuthenticatorManager::authenticatorAdded):
3933         (WebKit::AuthenticatorManager::respondReceived):
3934         (WebKit::AuthenticatorManager::createService const):
3935         (WebKit::AuthenticatorManager::respondReceivedInternal):
3936         (WebKit::AuthenticatorManager::startDiscovery):
3937         * UIProcess/WebAuthentication/AuthenticatorManager.h: Added.
3938         (WebKit::AuthenticatorManager::pendingCompletionHandler):
3939         * UIProcess/WebAuthentication/AuthenticatorTransportService.cpp: Copied from Source/WebCore/PAL/pal/spi/cocoa/DeviceIdentitySPI.h.
3940         (WebKit::AuthenticatorTransportService::create):
3941         (WebKit::AuthenticatorTransportService::createMock):
3942         (WebKit::AuthenticatorTransportService::AuthenticatorTransportService):
3943         (WebKit::AuthenticatorTransportService::startDiscovery const):
3944         * UIProcess/WebAuthentication/AuthenticatorTransportService.h: Copied from Source/WebCore/PAL/pal/spi/cocoa/DeviceIdentitySPI.h.
3945         (WebKit::AuthenticatorTransportService::observer const):
3946         * UIProcess/WebAuthentication/Cocoa/LocalAuthenticationSoftLink.h: Copied from Source/WebCore/platform/cocoa/LocalAuthenticationSoftLink.h.
3947         * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.h: Copied from Source/WebCore/PAL/pal/spi/cocoa/DeviceIdentitySPI.h.
3948         * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm: Added.
3949         (WebKit::LocalAuthenticatorInternal::buildAuthData):
3950         (WebKit::LocalAuthenticatorInternal::transportsContain):
3951         (WebKit::LocalAuthenticatorInternal::produceHashSet):
3952         (WebKit::LocalAuthenticatorInternal::toVector):
3953         (WebKit::LocalAuthenticator::LocalAuthenticator):
3954         (WebKit::LocalAuthenticator::makeCredential):
3955         (WebKit::LocalAuthenticator::continueMakeCredentialAfterUserConsented):
3956         (WebKit::LocalAuthenticator::continueMakeCredentialAfterAttested):
3957         (WebKit::LocalAuthenticator::getAssertion):
3958         (WebKit::LocalAuthenticator::continueGetAssertionAfterUserConsented):
3959         * UIProcess/WebAuthentication/Cocoa/LocalConnection.h: Copied from Source/WebCore/PAL/pal/spi/cocoa/DeviceIdentitySPI.h.
3960         * UIProcess/WebAuthentication/Cocoa/LocalConnection.mm: Added.
3961         (WebKit::LocalConnection::getUserConsent const):
3962         (WebKit::LocalConnection::getAttestation const):
3963         * UIProcess/WebAuthentication/Cocoa/LocalService.h: Copied from Source/WebCore/platform/cocoa/LocalAuthenticationSoftLink.h.
3964         * UIProcess/WebAuthentication/Cocoa/LocalService.mm: Renamed from Source/WebCore/PAL/pal/spi/cocoa/DeviceIdentitySPI.h.
3965         (WebKit::LocalService::LocalService):
3966         (WebKit::LocalService::isAvailable):
3967         (WebKit::LocalService::startDiscoveryInternal const):
3968         (WebKit::LocalService::platformStartDiscovery const):
3969         (WebKit::LocalService::createLocalConnection const):
3970         * UIProcess/WebAuthentication/Mock/MockAuthenticatorManager.cpp: Copied from Source/WebCore/platform/cocoa/LocalAuthenticationSoftLink.h.
3971         (WebKit::MockAuthenticatorManager::MockAuthenticatorManager):
3972         (WebKit::MockAuthenticatorManager::createService const):
3973         (WebKit::MockAuthenticatorManager::respondReceivedInternal):
3974         * UIProcess/WebAuthentication/Mock/MockAuthenticatorManager.h: Copied from Source/WebCore/platform/cocoa/LocalAuthenticationSoftLink.h.
3975         * UIProcess/WebAuthentication/Mock/MockLocalConnection.h: Copied from Source/WebCore/platform/cocoa/LocalAuthenticationSoftLink.h.
3976         * UIProcess/WebAuthentication/Mock/MockLocalConnection.mm: Added.
3977         (WebKit::MockLocalConnection::MockLocalConnection):
3978         (WebKit::MockLocalConnection::getUserConsent const):
3979         (WebKit::MockLocalConnection::getAttestation const):
3980         * UIProcess/WebAuthentication/Mock/MockLocalService.cpp: Copied from Source/WebCore/platform/cocoa/LocalAuthenticationSoftLink.h.
3981         (WebKit::MockLocalService::MockLocalService):
3982         (WebKit::MockLocalService::platformStartDiscovery const):
3983         (WebKit::MockLocalService::createLocalConnection const):
3984         * UIProcess/WebAuthentication/Mock/MockLocalService.h: Copied from Source/WebCore/platform/cocoa/LocalAuthenticationSoftLink.h.
3985         * UIProcess/WebAuthentication/Mock/MockWebAuthenticationConfiguration.h: Copied from Source/WebCore/platform/cocoa/LocalAuthenticationSoftLink.h.
3986         * UIProcess/WebAuthentication/WebAuthenticationRequestData.h: Renamed from Source/WebCore/platform/cocoa/LocalAuthenticationSoftLink.h.
3987         * UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.cpp:
3988         (WebKit::WebAuthenticatorCoordinatorProxy::WebAuthenticatorCoordinatorProxy):
3989         (WebKit::WebAuthenticatorCoordinatorProxy::makeCredential):
3990         (WebKit::WebAuthenticatorCoordinatorProxy::getAssertion):
3991         (WebKit::WebAuthenticatorCoordinatorProxy::isUserVerifyingPlatformAuthenticatorAvailable):
3992         (WebKit::WebAuthenticatorCoordinatorProxy::isUserVerifyingPlatformAuthenticatorAvailableReply): Deleted.
3993         * UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.h:
3994         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
3995         (WebKit::WebsiteDataStore::WebsiteDataStore):
3996         (WebKit::WebsiteDataStore::setMockWebAuthenticationConfiguration):
3997         * UIProcess/WebsiteData/WebsiteDataStore.h:
3998         (WebKit::WebsiteDataStore::authenticatorManager):
3999         * WebKit.xcodeproj/project.pbxproj:
4000
4001 2018-09-25  Chris Dumez  <cdumez@apple.com>
4002
4003         Revert some of the changes in r236471
4004         https://bugs.webkit.org/show_bug.cgi?id=189973
4005
4006         Reviewed by Alex Christensen.
4007
4008         Revert some of the changes in r236471 as they should not be needed. In particular,
4009         it should not be possible for the DecidePolicyForNavigationActionSync IPC to get
4010         processed *before* the DidCreateMainFrame / DidCreateSubframe ones because those
4011         use IPC::SendOption::DispatchMessageEvenWhenWaitingForSyncReply. They are thus
4012         processed early when necessary, the same way as synchronous IPC messages.
4013