bcd8222479fc571442069a20c500a60d911028d0
[WebKit-https.git] / Source / WebKit / ChangeLog
1 2018-10-26  Antti Koivisto  <antti@apple.com>
2
3         Use random() instead of begin() to limit cache sizes
4         https://bugs.webkit.org/show_bug.cgi?id=190957
5
6         Reviewed by Chris Dumez.
7
8         * UIProcess/WebProcessPool.cpp:
9         (WebKit::WebProcessPool::didCollectPrewarmInformation):
10
11 2018-10-26  Chris Dumez  <cdumez@apple.com>
12
13         Modernize / Simplify IPC::Connection::sendOutgoingMessage()
14         https://bugs.webkit.org/show_bug.cgi?id=190931
15
16         Reviewed by Alex Christensen.
17
18         * Platform/IPC/mac/ConnectionMac.mm:
19         (IPC::Connection::sendOutgoingMessage):
20
21 2018-10-26  Jer Noble  <jer.noble@apple.com>
22
23         Adopt -setOverrideRouteSharingPolicy:routingContextUID: SPI
24         https://bugs.webkit.org/show_bug.cgi?id=190951
25         <rdar://problem/45213065>
26
27         Reviewed by Alex Christensen.
28
29         Add an asyncronous reply request to VideoFullscreenManager.
30
31         Drive-by fix: messages.py generates "WTFMove(*arg1, *arg2)" instead of "WTFMove(*arg1), WTFMove(*arg2)"
32         in its reply handler generation.
33
34         * Platform/IPC/MessageSender.h:
35         (IPC::MessageSender::sendWithAsyncReply):
36         * Scripts/webkit/messages.py:
37         * UIProcess/Cocoa/VideoFullscreenManagerProxy.h:
38         * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm:
39         (WebKit::VideoFullscreenModelContext::requestRouteSharingPolicyAndContextUID):
40         * WebProcess/cocoa/VideoFullscreenManager.h:
41         * WebProcess/cocoa/VideoFullscreenManager.messages.in:
42         * WebProcess/cocoa/VideoFullscreenManager.mm:
43         (WebKit::VideoFullscreenManager::requestRouteSharingPolicyAndContextUID):
44
45 2018-10-25  Michael Catanzaro  <mcatanzaro@igalia.com>
46
47         Unreviewed, another try at fixing the GTK build with sandbox enabled
48
49         * UIProcess/Launcher/glib/BubblewrapLauncher.cpp:
50         (WebKit::memfd_create): Deleted.
51
52 2018-10-25  Antoine Quint  <graouts@apple.com>
53
54         [Web Animations] Turn Web Animations CSS Integration off by default
55         https://bugs.webkit.org/show_bug.cgi?id=190901
56
57         Reviewed by Dean Jackson.
58
59         * Shared/WebPreferences.yaml:
60
61 2018-10-25  Michael Catanzaro  <mcatanzaro@igalia.com>
62
63         Unreviewed, try to fix GTK build with sandbox enabled
64
65         * UIProcess/Launcher/glib/BubblewrapLauncher.cpp:
66
67 2018-10-25  Claudio Saavedra  <csaavedra@igalia.com>
68
69         [WPE][GTK] Follow-up fixes to the certificate coders
70         https://bugs.webkit.org/show_bug.cgi?id=190900
71
72         Reviewed by Michael Catanzaro.
73
74         Cleanup the GRefPtr mess I created earlier. Also we now bail out
75         if any certificate in the chain has no data instead of returning a
76         cropped chain.
77
78         * Shared/soup/WebCoreArgumentCodersSoup.cpp:
79         (IPC::ArgumentCoder<CertificateInfo>::encode):
80         (IPC::ArgumentCoder<CertificateInfo>::decode):
81
82 2018-10-25  Zan Dobersek  <zdobersek@igalia.com>
83
84         [GTK][AC] Resizing the window doesn't always update the visible rect
85         https://bugs.webkit.org/show_bug.cgi?id=189743
86
87         Reviewed by Michael Catanzaro.
88
89         Disassociate resizing that can be done on an AcceleratedSurface object
90         between "host resizes" and "client resizes".
91
92         The former is done from ThreadedCoordinatedLayerTreeHost directly, and
93         is currently used only for GTK on X11, where a new pixmap object is
94         created on each resize, which affects the context ID that is based on
95         that pixmap object's address.
96
97         The latter is done from the composition thread. It's used for GTK on
98         Wayland and WPE. In both cases, the underlying window object does not
99         change on each resize, but it's necessary to perform the actual resize
100         on the composition thread.
101
102         So far it hasn't been performed there, which ended up pushing sizes of
103         the WebKit view and the underlying window object out of sync during
104         resizing, leaving parts of window unrendered.
105
106         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
107         (WebKit::ThreadedCompositor::renderLayerTree):
108         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h:
109         * WebProcess/WebPage/AcceleratedSurface.cpp:
110         (WebKit::AcceleratedSurface::hostResize):
111         (WebKit::AcceleratedSurface::resize): Deleted.
112         * WebProcess/WebPage/AcceleratedSurface.h:
113         (WebKit::AcceleratedSurface::clientResize):
114         * WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.cpp:
115         (WebKit::ThreadedCoordinatedLayerTreeHost::deviceOrPageScaleFactorChanged):
116         (WebKit::ThreadedCoordinatedLayerTreeHost::sizeDidChange):
117         * WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.h:
118         * WebProcess/WebPage/gtk/AcceleratedSurfaceWayland.cpp:
119         (WebKit::AcceleratedSurfaceWayland::clientResize):
120         (WebKit::AcceleratedSurfaceWayland::resize): Deleted.
121         * WebProcess/WebPage/gtk/AcceleratedSurfaceWayland.h:
122         * WebProcess/WebPage/gtk/AcceleratedSurfaceX11.cpp:
123         (WebKit::AcceleratedSurfaceX11::hostResize):
124         (WebKit::AcceleratedSurfaceX11::resize): Deleted.
125         * WebProcess/WebPage/gtk/AcceleratedSurfaceX11.h:
126         * WebProcess/WebPage/wpe/AcceleratedSurfaceWPE.cpp:
127         (WebKit::AcceleratedSurfaceWPE::clientResize):
128         (WebKit::AcceleratedSurfaceWPE::resize): Deleted.
129         * WebProcess/WebPage/wpe/AcceleratedSurfaceWPE.h:
130
131 2018-10-24  Alexey Proskuryakov  <ap@apple.com>
132
133         Clean up some obsolete macOS version guards
134         https://bugs.webkit.org/show_bug.cgi?id=190887
135
136         Reviewed by Dan Bernstein.
137
138         * PluginProcess/mac/com.apple.WebKit.plugin-common.sb.in:
139         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
140         (WebKit::WebProcessPool::platformInitializeWebProcess):
141
142 2018-10-24  Megan Gardner  <megan_gardner@apple.com>
143
144         Turn on Conic Gradients
145         https://bugs.webkit.org/show_bug.cgi?id=190810
146
147         Reviewed by Tim Horton.
148
149         Remove conic gradients from experimental features and turn it on always.
150
151         * Configurations/FeatureDefines.xcconfig:
152         * Shared/WebPreferences.yaml:
153
154 2018-10-24  Said Abou-Hallawa  <sabouhallawa@apple.com>
155
156         Cleanup: MIMETypeRegistry functions
157         https://bugs.webkit.org/show_bug.cgi?id=190838
158
159         Reviewed by Simon Fraser.
160
161         * UIProcess/Cocoa/WKWebViewContentProviderRegistry.mm:
162         (-[WKWebViewContentProviderRegistry initWithConfiguration:]):
163
164 2018-10-24  Chris Dumez  <cdumez@apple.com>
165
166         REGRESSION (r237257): [iOS] Crashes in com.apple.WebKit: WebKit::RemoteScrollingCoordinator::scheduleTreeStateCommit
167         https://bugs.webkit.org/show_bug.cgi?id=190804
168
169         Reviewed by Alex Christensen.
170
171         Fix null-dereference of the drawing area in RemoteScrollingCoordinator::scheduleTreeStateCommit.
172         With process-swap-on-navigation enabled, suspended pages' drawing area gets torn down.
173
174         * WebProcess/WebPage/RemoteLayerTree/RemoteScrollingCoordinator.mm:
175         (WebKit::RemoteScrollingCoordinator::scheduleTreeStateCommit):
176
177 2018-10-24  Claudio Saavedra  <csaavedra@igalia.com>
178
179         [WPE][GTK] Cleanups to the certificate decoder
180         https://bugs.webkit.org/show_bug.cgi?id=190867
181
182         Reviewed by Žan Doberšek.
183
184         * Shared/soup/WebCoreArgumentCodersSoup.cpp:
185         (IPC::ArgumentCoder<CertificateInfo>::decode):
186
187 2018-10-24  Claudio Saavedra  <csaavedra@igalia.com>
188
189         [WPE][GTK] Cleanups to the certificate encoder
190         https://bugs.webkit.org/show_bug.cgi?id=190865
191
192         Reviewed by Žan Doberšek.
193
194         * Shared/soup/WebCoreArgumentCodersSoup.cpp:
195         (IPC::ArgumentCoder<CertificateInfo>::encode):
196
197 2018-10-23  Ryan Haddad  <ryanhaddad@apple.com>
198
199         Unreviewed, rolling out r237261.
200
201         The layout test for this change crashes under GuardMalloc.
202
203         Reverted changeset:
204
205         "Handle MDNS resolution of candidates through libwebrtc
206         directly"
207         https://bugs.webkit.org/show_bug.cgi?id=190681
208         https://trac.webkit.org/changeset/237261
209
210 2018-10-23  David Kilzer  <ddkilzer@apple.com>
211
212         Fix false positive leaks when using custom -init methods that don't start with -init
213         <https://webkit.org/b/190818>
214         <rdar://problem/45476042>
215
216         Reviewed by Dan Bernstein.
217
218         * UIProcess/Cocoa/WKWebViewContentProvider.h:
219         (-[WKWebViewContentProvider web_initWithFrame:webView:mimeType:]):
220         Add attribute to make this behave like an -init method.
221
222 2018-10-23  Chris Dumez  <cdumez@apple.com>
223
224         [PSON] Add support for cross-site client-side redirects
225         https://bugs.webkit.org/show_bug.cgi?id=190806
226         <rdar://problem/45047344>
227
228         Reviewed by Geoffrey Garen.
229
230         * Shared/LoadParameters.cpp:
231         (WebKit::LoadParameters::encode const):
232         (WebKit::LoadParameters::decode):
233         * Shared/LoadParameters.h:
234         * Shared/NavigationActionData.cpp:
235         (WebKit::NavigationActionData::encode const):
236         (WebKit::NavigationActionData::decode):
237         * Shared/NavigationActionData.h:
238         * Shared/WebBackForwardListItem.cpp:
239         (WebKit::WebBackForwardListItem::setSuspendedPage):
240         * UIProcess/API/APINavigation.h:
241         (API::Navigation::setLockHistory):
242         (API::Navigation::lockHistory const):
243         (API::Navigation::setLockBackForwardList):
244         (API::Navigation::lockBackForwardList const):
245         (API::Navigation::setClientRedirectSourceForHistory):
246         (API::Navigation::clientRedirectSourceForHistory const):
247         * UIProcess/API/APINavigationClient.h:
248         (API::NavigationClient::willPerformClientRedirect):
249         (API::NavigationClient::didPerformClientRedirect):
250         * UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h:
251         * UIProcess/Cocoa/NavigationState.h:
252         * UIProcess/Cocoa/NavigationState.mm:
253         (WebKit::NavigationState::setNavigationDelegate):
254         (WebKit::NavigationState::NavigationClient::didPerformClientRedirect):
255         * UIProcess/FrameLoadState.h:
256         (WebKit::FrameLoadState::setURL):
257         * UIProcess/WebPageProxy.cpp:
258         (WebKit::WebPageProxy::loadRequestWithNavigation):
259         (WebKit::WebPageProxy::continueNavigationInNewProcess):
260         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
261         (WebKit::WebPageProxy::didPerformClientRedirect):
262         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
263         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
264         * WebProcess/WebPage/WebPage.cpp:
265         (WebKit::WebPage::loadRequest):
266         (WebKit::WebPage::setCurrentHistoryItemForReattach):
267         * WebProcess/WebPage/WebPage.h:
268         * WebProcess/WebPage/WebPage.messages.in:
269
270 2018-10-23  Claudio Saavedra  <csaavedra@igalia.com>
271
272         [WPE][GTK] Pass full certificate chain in CertificateInfo coder
273         https://bugs.webkit.org/show_bug.cgi?id=190789
274
275         Reviewed by Michael Catanzaro.
276
277         When the network process serializes certificate data to other
278         processes through the argument coders, the certificate chain, if
279         present, is lost. In practice this means that applications using
280         the public API to process certificate info have no details on the
281         certificate chain, other than the very basics included in the
282         certificate. Serialize the entire chain if available in the
283         certificate.
284
285         * Shared/soup/WebCoreArgumentCodersSoup.cpp:
286         (IPC::ArgumentCoder<CertificateInfo>::encode): Encode the
287         certificate chain if present.
288         (IPC::ArgumentCoder<CertificateInfo>::decode): Decode the
289         entire certificate chain and rebuild it.
290
291 2018-10-22  Keith Rollin  <krollin@apple.com>
292
293         Use Location = "Relative to Build Products" rather than "Relative to Group"
294         https://bugs.webkit.org/show_bug.cgi?id=190781
295
296         Reviewed by Alexey Proskuryakov.
297
298         Almost all Derived Files are included in Xcode projects with the
299         Location attribute set to "Relative to Group". While this currently
300         works, the Derived Files can no longer be found when enabling XCBuild
301         (which has stricter requirements). Fix this by setting the Location
302         attribute to "Relative to Build Products".
303
304         * WebKit.xcodeproj/project.pbxproj:
305
306 2018-10-22  Tim Horton  <timothy_horton@apple.com>
307
308         Don't waste time under -setupInteraction under -initWithFrame for unparented WKWebViews
309         https://bugs.webkit.org/show_bug.cgi?id=190801
310         <rdar://problem/43674361>
311
312         Reviewed by Megan Gardner.
313
314         * UIProcess/ios/WKContentView.mm:
315         (-[WKContentView _commonInitializationWithProcessPool:configuration:]):
316         (-[WKContentView didMoveToWindow]):
317         Defer the first call to WKContentViewInteraction's -setupInteraction
318         until the view is parented. This avoids a few milliseconds of unnecessary
319         work for views that are never parented.
320
321         * UIProcess/ios/WKContentViewInteraction.h:
322         * UIProcess/ios/WKContentViewInteraction.mm:
323         (-[WKContentView setupInteraction]):
324         (-[WKContentView cleanupInteraction]):
325         Keep track of the current state of WKContentViewInteraction's gestures.
326         Use this to make it OK to call -setupInteraction multiple times.
327
328 2018-10-22  Chris Dumez  <cdumez@apple.com>
329
330         Deque's contains() and findIf() should be const
331         https://bugs.webkit.org/show_bug.cgi?id=190796
332
333         Reviewed by Antti Koivisto.
334
335         Mark method as const now that Deque's implementation allows it to be.
336
337         * UIProcess/WebProcessPool.cpp:
338         (WebKit::WebProcessPool::hasSuspendedPageProxyFor const):
339         (WebKit::WebProcessPool::hasSuspendedPageProxyFor): Deleted.
340         * UIProcess/WebProcessPool.h:
341
342 2018-10-19  Brent Fulgham  <bfulgham@apple.com>
343
344         Allow WebContent process to check some file system features
345         https://bugs.webkit.org/show_bug.cgi?id=190768
346         <rdar://problem/45377609>
347
348         Reviewed by Alexey Proskuryakov.
349
350         This patch unblocks some IOKit properties that are needed by lower level frameworks to make decisions
351         about how to efficiently use the file system.
352
353         * WebProcess/com.apple.WebProcess.sb.in:
354
355 2018-10-19  Stephan Szabo  <stephan.szabo@sony.com>
356
357         [WinCairo] Search terms are not saved for <input type="search">
358         https://bugs.webkit.org/show_bug.cgi?id=188174
359
360         Reviewed by Fujii Hironori.
361
362         Add support for saving the search terms for <input
363         type="search"> to a SQLite database, replacing the
364         CF-based implementation for Windows and adding support
365         for non-legacy WebKit.
366
367         * UIProcess/win/WebPageProxyWin.cpp:
368         (WebKit::WebPageProxy::saveRecentSearches): Use SQLite database
369         implementation in WebCore::SearchPopupMenuDB to save search
370         terms
371         (WebKit::WebPageProxy::loadRecentSearches): Use SQLite database
372         implementation in WebCore::SearchPopupMenuDB to load search
373         terms
374
375 2018-10-19  Alex Christensen  <achristensen@webkit.org>
376
377         WebDataListSuggestionsDropdown should use a WeakPtr
378         https://bugs.webkit.org/show_bug.cgi?id=190763
379         <rdar://problem/45417449>
380
381         Reviewed by Tim Horton.
382
383         Nothing suspicious here. It's just good practice to not keep raw pointers that aren't reset when the object they point to are destroyed.
384
385         * UIProcess/WebDataListSuggestionsDropdown.cpp:
386         (WebKit::WebDataListSuggestionsDropdown::WebDataListSuggestionsDropdown):
387         (WebKit::WebDataListSuggestionsDropdown::close):
388         * UIProcess/WebDataListSuggestionsDropdown.h:
389         (WebKit::WebDataListSuggestionsDropdown::Client::~Client): Deleted.
390         * UIProcess/WebPageProxy.h:
391         * UIProcess/ios/WebDataListSuggestionsDropdownIOS.h:
392         * UIProcess/ios/WebDataListSuggestionsDropdownIOS.mm:
393         (WebKit::WebDataListSuggestionsDropdownIOS::create):
394         (WebKit::WebDataListSuggestionsDropdownIOS::WebDataListSuggestionsDropdownIOS):
395         (WebKit::WebDataListSuggestionsDropdownIOS::close):
396         (WebKit::WebDataListSuggestionsDropdownIOS::didSelectOption):
397         * UIProcess/mac/WebDataListSuggestionsDropdownMac.h:
398         * UIProcess/mac/WebDataListSuggestionsDropdownMac.mm:
399         (WebKit::WebDataListSuggestionsDropdownMac::create):
400         (WebKit::WebDataListSuggestionsDropdownMac::WebDataListSuggestionsDropdownMac):
401         (WebKit::WebDataListSuggestionsDropdownMac::didSelectOption):
402         (WebKit::WebDataListSuggestionsDropdownMac::selectOption):
403
404 2018-10-19  Wenson Hsieh  <wenson_hsieh@apple.com>
405
406         [iOS] [Datalist] Can't pick datalist suggestions in a stock WKWebView
407         https://bugs.webkit.org/show_bug.cgi?id=190621
408         <rdar://problem/45310649>
409
410         Reviewed by Tim Horton.
411
412         Fixes the bug by refactoring datalist suggestion information on iOS; currently, we override text suggestions on
413         _WKFormInputSession. This only works for a few internal clients (including Safari) that set a _WKInputDelegate
414         and also implement either -_webView:willStartInputSession: or -_webView:didStartInputSession:, which is
415         necessary in order to ensure that WebKit creates and maintains a form input session.
416
417         The two pieces of information that datalist code needs to vend to WKContentView are a list of UITextSuggestions
418         and a custom input view, which are both currently properties of _WKFormInputSession. This patch lifts these out
419         of the input session and makes them properties of WKContentView, which are used in
420         WebDataListSuggestionsDropdownIOS.
421
422         Test: fast/forms/datalist/datalist-textinput-suggestions-order.html
423
424         * UIProcess/ios/WKContentViewInteraction.h:
425         * UIProcess/ios/WKContentViewInteraction.mm:
426
427         Add new properties to WKContentView: an input view for datalist suggestions, and a list of text suggestions.
428
429         (-[WKFormInputSession setSuggestions:]):
430         (-[WKContentView setupInteraction]):
431         (-[WKContentView cleanupInteraction]):
432         (-[WKContentView _endEditing]):
433
434         Pull out common logic when resigning first responder or tabbing to the next or previous text field into a new
435         helper. This helper notifies `_inputPeripheral`, `_formInputSession`, and `_dataListTextSuggestionsInputView`
436         when editing has ended; the input peripheral and suggestions input view use this chance to send the value of the
437         form control to the web process.
438
439         (-[WKContentView resignFirstResponderForWebView]):
440         (-[WKContentView inputView]):
441
442         If a custom input view is not set but we have an input view for a datalist's text suggestions, use the datalist
443         input view.
444
445         (-[WKContentView accessoryTab:]):
446         (-[WKContentView _stopAssistingNode]):
447
448         Clear datalist state on WKContentView.
449
450         (-[WKContentView dataListTextSuggestionsInputView]):
451         (-[WKContentView dataListTextSuggestions]):
452         (-[WKContentView setDataListTextSuggestionsInputView:]):
453         (-[WKContentView setDataListTextSuggestions:]):
454         (-[WKContentView updateTextSuggestionsForInputDelegate]):
455
456         Pull out logic for setting suggestions on UIKit's `inputDelegate` (i.e. UIKeyboardImpl). We now first consult
457         internally-vended text suggestions from _WKFormInputSession; if an internal client has not overridden our text
458         suggestions, then we simply use suggestions from the current datalist (if present).
459
460         * UIProcess/ios/WebDataListSuggestionsDropdownIOS.mm:
461         (-[WKDataListSuggestionsPicker updateWithInformation:]):
462         (-[WKDataListSuggestionsPicker showSuggestionsDropdown:activationType:]):
463         (-[WKDataListSuggestionsPicker invalidate]):
464         (-[WKDataListSuggestionsPopover updateWithInformation:]):
465         (-[WKDataListSuggestionsPopover showSuggestionsDropdown:activationType:]):
466         (-[WKDataListSuggestionsPopover didSelectOptionAtIndex:]):
467
468         Change all the places that currently manipulate WKContentView's form input session to directly set text
469         suggestions and the text suggestion input view on the content view instead.
470
471 2018-10-19  John Wilander  <wilander@apple.com>
472
473         Only cap lifetime of persistent cookies created client-side through document.cookie when resource load statistics is enabled
474         https://bugs.webkit.org/show_bug.cgi?id=190687
475         <rdar://problem/45349024>
476
477         Reviewed by Alex Christensen.
478
479         This patch adds the following:
480         - The WebProcessPool now tells the WebsiteDataStore when a network process has
481             been created.
482         - The WebsiteDataStore in turn tells the WebResourceLoadStatisticsStore when
483             a network process has been created.
484         - The WebResourceLoadStatisticsStore makes sure to update the network processes
485             with its cookie policy when it's notified that a network process has been
486             created.
487
488         In addition, this patch changes the following:
489         - The ResourceLoadStatisticsMemoryStore no longer keeps track of which domains
490             it has told the network process to block cookies for. The reason is that
491             we cannot assume that there is only one network process so we should
492             always send complete blocking data.
493         - The ResourceLoadStatisticsMemoryStore's functions for communicating cookie
494             blocking state to the network process no longer take and forward the
495             "clear first" parameter. This is because complete data is sent every time
496             and thus the network process' set is always cleared on an update.
497         - Removes WebsiteDataStore::networkProcessDidCrash() and
498             WebResourceLoadStatisticsStore::scheduleCookieBlockingStateReset() since
499             the call site---WebProcessPool::ensureNetworkProcess()---now calls
500             WebsiteDataStore::didCreateNetworkProcess() after a network process
501             crash and the state sync for cookie blocking is triggered.
502
503         * NetworkProcess/NetworkProcess.cpp:
504         (WebKit::NetworkProcess::updatePrevalentDomainsToBlockCookiesFor):
505         (WebKit::NetworkProcess::setShouldCapLifetimeForClientSideCookies):
506         * NetworkProcess/NetworkProcess.h:
507         * NetworkProcess/NetworkProcess.messages.in:
508         * UIProcess/Network/NetworkProcessProxy.cpp:
509         (WebKit::NetworkProcessProxy::updatePrevalentDomainsToBlockCookiesFor):
510         (WebKit::NetworkProcessProxy::setShouldCapLifetimeForClientSideCookies):
511         (WebKit::NetworkProcessProxy::didSetShouldCapLifetimeForClientSideCookies):
512         * UIProcess/Network/NetworkProcessProxy.h:
513         * UIProcess/Network/NetworkProcessProxy.messages.in:
514         * UIProcess/ResourceLoadStatisticsMemoryStore.cpp:
515         (WebKit::ResourceLoadStatisticsMemoryStore::clear):
516         (WebKit::ResourceLoadStatisticsMemoryStore::updateCookieBlocking):
517         (WebKit::ResourceLoadStatisticsMemoryStore::updateCookieBlockingForDomains):
518         (WebKit::ResourceLoadStatisticsMemoryStore::clearBlockingStateForDomains):
519         (WebKit::ResourceLoadStatisticsMemoryStore::resetCookieBlockingState): Deleted.
520         * UIProcess/ResourceLoadStatisticsMemoryStore.h:
521         * UIProcess/WebProcessPool.cpp:
522         (WebKit::WebProcessPool::ensureNetworkProcess):
523         * UIProcess/WebResourceLoadStatisticsStore.cpp:
524         (WebKit::WebResourceLoadStatisticsStore::didCreateNetworkProcess):
525         (WebKit::WebResourceLoadStatisticsStore::scheduleCookieBlockingUpdateForDomains):
526         (WebKit::WebResourceLoadStatisticsStore::scheduleClearInMemoryAndPersistent):
527         (WebKit::WebResourceLoadStatisticsStore::callUpdatePrevalentDomainsToBlockCookiesForHandler):
528         (WebKit::WebResourceLoadStatisticsStore::scheduleCookieBlockingStateReset): Deleted.
529         * UIProcess/WebResourceLoadStatisticsStore.h:
530         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
531         (WebKit::WebsiteDataStore::updatePrevalentDomainsToBlockCookiesFor):
532         (WebKit::WebsiteDataStore::setShouldCapLifetimeForClientSideCookies):
533         (WebKit::WebsiteDataStore::didCreateNetworkProcess):
534         (WebKit::WebsiteDataStore::networkProcessDidCrash): Deleted.
535         * UIProcess/WebsiteData/WebsiteDataStore.h:
536
537 2018-10-19  Alex Christensen  <achristensen@webkit.org>
538
539         Rebase python tests.
540
541         * Scripts/webkit/messages_unittest.py:
542
543 2018-10-19  Alex Christensen  <achristensen@webkit.org>
544
545         Rebase python tests.
546
547         * Scripts/Makefile:
548         * Scripts/webkit/MessageReceiver-expected.cpp:
549         * Scripts/webkit/Messages-expected.h:
550
551 2018-10-19  Alex Christensen  <achristensen@webkit.org>
552
553         Mark LegacySync IPC messages
554         https://bugs.webkit.org/show_bug.cgi?id=190759
555
556         Reviewed by Tim Horton.
557
558         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
559         * NetworkProcess/NetworkProcess.messages.in:
560         * NetworkProcess/ServiceWorker/WebSWServerConnection.messages.in:
561         * Platform/IPC/HandleMessage.h:
562         (IPC::handleMessageLegacySync):
563         * PluginProcess/PluginControllerProxy.messages.in:
564         * Scripts/webkit/messages.py:
565         * Shared/Plugins/NPObjectMessageReceiver.messages.in:
566         * UIProcess/ApplePay/WebPaymentCoordinatorProxy.messages.in:
567         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.messages.in:
568         * UIProcess/Plugins/PluginProcessProxy.messages.in:
569         * UIProcess/WebFullScreenManagerProxy.messages.in:
570         * UIProcess/WebPageProxy.messages.in:
571         * UIProcess/WebPasteboardProxy.messages.in:
572         * UIProcess/WebProcessPool.messages.in:
573         * UIProcess/WebProcessProxy.messages.in:
574         * UIProcess/WebStorage/StorageManager.messages.in:
575         * UIProcess/mac/SecItemShimProxy.messages.in:
576         * WebProcess/Plugins/PluginProcessConnection.messages.in:
577         * WebProcess/Plugins/PluginProxy.messages.in:
578         * WebProcess/WebPage/WebPage.messages.in:
579         * WebProcess/WebProcess.messages.in:
580
581 2018-10-19  Alex Christensen  <achristensen@webkit.org>
582
583         Update and add python tests after r237294
584         https://bugs.webkit.org/show_bug.cgi?id=190746
585
586         * Scripts/Makefile: Added to help updating expectations.
587         * Scripts/webkit/LegacyMessageReceiver-expected.cpp:
588         * Scripts/webkit/MessageReceiverSuperclass-expected.cpp:
589         (Messages::WebPage::TestAsyncMessage::callReply):
590         (Messages::WebPage::TestAsyncMessage::cancelReply):
591         (Messages::WebPage::TestAsyncMessage::send):
592         (WebKit::WebPage::didReceiveMessage):
593         * Scripts/webkit/MessagesSuperclass-expected.h:
594         (Messages::WebPage::TestAsyncMessage::receiverName):
595         (Messages::WebPage::TestAsyncMessage::name):
596         (Messages::WebPage::TestAsyncMessage::asyncMessageReplyName):
597         (Messages::WebPage::TestAsyncMessage::TestAsyncMessage):
598         (Messages::WebPage::TestAsyncMessage::arguments const):
599         * Scripts/webkit/test-superclass-messages.in:
600         Adding the extra newline made python tests fail.
601         I also added more tests for the new functionality introduced in r237924.
602
603 2018-10-19  Alex Christensen  <achristensen@webkit.org>
604
605         Introduce CompletionHandler-based Async IPC messages with replies
606         https://bugs.webkit.org/show_bug.cgi?id=190746
607
608         Reviewed by Tim Horton.
609
610         Before this patch, to make an asynchronous IPC message with a reply you had to find two objects that
611         can talk to each other, make two new message types, send a generated identifier, keep track of that
612         identifier, make a HashMap somewhere to store the object waiting for the response, and hook it all up.
613         What a mess.  No wonder people take shortcuts and make strange design decisions.
614
615         Now, you can just use a CompletionHandler and mark the reply as Async in *.messages.in.
616         I've adopted this with a message whose behavior is covered by the storage/indexeddb/modern/blob-cursor.html
617         layout test and many others.  I intent to refine and further adopt this incrementally.
618
619         * NetworkProcess/NetworkProcess.cpp:
620         (WebKit::NetworkProcess::getSandboxExtensionsForBlobFiles):
621         (WebKit::NetworkProcess::didGetSandboxExtensionsForBlobFiles): Deleted.
622         * NetworkProcess/NetworkProcess.h:
623         * NetworkProcess/NetworkProcess.messages.in:
624         This is representative of how code will be simplified with greater adoption. 
625         * NetworkProcess/NetworkResourceLoadParameters.cpp:
626         (WebKit::NetworkResourceLoadParameters::decode):
627         Modernize HandleArray decoding.
628         * Platform/IPC/Connection.cpp:
629         (IPC::Connection::dispatchMessage):
630         (IPC::nextAsyncReplyHandlerID):
631         (IPC::asyncReplyHandlerMap):
632         Handle async replies when looking at incoming messages from the sending process.
633         * Platform/IPC/Connection.h:
634         (IPC::Connection::sendWithAsyncReply):
635         Send a message with an async reply and prepare the reply receiver.
636         * Platform/IPC/Encoder.h:
637         Make the uint64_t encoder public so we can use it when encoding the listenerID.
638         * Platform/IPC/HandleMessage.h:
639         (IPC::handleMessageAsync):
640         Handle an asynchronous message with a reply from the receiving process.
641         This is similar to how DelayedReply messages are handled, but the listenerID is automatically captured and sent back.
642         * Scripts/webkit/messages.py:
643         Generate code for async message replies.
644         * Shared/Databases/IndexedDB/WebIDBResult.cpp:
645         (WebKit::WebIDBResult::decode):
646         * Shared/SandboxExtension.h:
647         (WebKit::SandboxExtension::HandleArray::at):
648         (WebKit::SandboxExtension::HandleArray::decode):
649         * Shared/WebProcessCreationParameters.cpp:
650         (WebKit::WebProcessCreationParameters::decode):
651         * Shared/mac/SandboxExtensionMac.mm:
652         (WebKit::SandboxExtension::HandleArray::decode):
653         Modernize the decoding of HandleArray to work with generated decoding.
654         * UIProcess/Network/NetworkProcessProxy.cpp:
655         (WebKit::NetworkProcessProxy::getSandboxExtensionsForBlobFiles):
656         * UIProcess/Network/NetworkProcessProxy.h:
657         * UIProcess/Network/NetworkProcessProxy.messages.in:
658         This is also representative of how code will be simplified with greater adoption.
659         * WebProcess/MediaStream/MediaDeviceSandboxExtensions.cpp:
660         (WebKit::MediaDeviceSandboxExtensions::decode):
661         Modernize HandleArray decoding.
662
663 2018-10-19  Chris Dumez  <cdumez@apple.com>
664
665         [PSON] WebPageProxy::didCompletePageTransition() may interact with a SuspendedPageProxy from a previous navigation
666         https://bugs.webkit.org/show_bug.cgi?id=190717
667
668         Reviewed by Antti Koivisto.
669
670         WebPageProxy::didCompletePageTransition() may interact with a SuspendedPageProxy from a previous navigation. We need
671         to reset m_lastSuspendedPage whenever the page starts a new navigation as m_lastSuspendedPage is only updated when
672         we process-swap otherwise.
673
674         Also rename the data member to m_pageSuspendedDueToCurrentNavigation for clarity.
675
676         In a follow-up, I will see if I can get rid of this data member entirely or maybe move it to the Navigation
677         object.
678
679         * UIProcess/WebPageProxy.cpp:
680         (WebKit::WebPageProxy::suspendCurrentPageIfPossible):
681         (WebKit::WebPageProxy::receivedNavigationPolicyDecision):
682         (WebKit::WebPageProxy::didCompletePageTransition):
683         (WebKit::WebPageProxy::enterAcceleratedCompositingMode):
684
685 2018-10-18  Eric Carlson  <eric.carlson@apple.com>
686
687         [MediaStream] Allow ports to optionally do screen capture in the UI process
688         https://bugs.webkit.org/show_bug.cgi?id=190728
689         <rdar://problem/45376824>
690
691         Reviewed by Jer Noble and Tim Horton.
692
693         * Shared/WebProcessCreationParameters.cpp:
694         (WebKit::WebProcessCreationParameters::encode const): Encode shouldCaptureDisplayInUIProcess.
695         (WebKit::WebProcessCreationParameters::decode): Decode shouldCaptureDisplayInUIProcess.
696         * Shared/WebProcessCreationParameters.h:
697
698         * UIProcess/API/APIProcessPoolConfiguration.cpp:
699         (API::ProcessPoolConfiguration::copy): Copy shouldCaptureDisplayInUIProcess.
700         * UIProcess/API/APIProcessPoolConfiguration.h:
701
702         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp:
703         (WebKit::UserMediaCaptureManagerProxy::SourceProxy::remoteVideoSampleAvailable):
704         (WebKit::UserMediaCaptureManagerProxy::createMediaSourceForCaptureDeviceWithConstraints): Remove
705         RealtimeMediaSource::Type parameter, CaptureDevice has the same information. Deal with display
706         capture "devices".
707         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.h:
708         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.messages.in:
709
710         * UIProcess/WebProcessPool.cpp:
711         (WebKit::WebProcessPool::initializeNewWebProcess): Copy shouldCaptureDisplayInUIProcess.
712
713         * WebProcess/cocoa/UserMediaCaptureManager.cpp:
714         (WebKit::UserMediaCaptureManager::Source::Source): Only allocate a ring buffer for Audio sources.
715         (WebKit::UserMediaCaptureManager::Source::~Source): Same for deallocate.
716         (WebKit::UserMediaCaptureManager::Source::storage): m_ringBuffer is a pointer.
717         (WebKit::UserMediaCaptureManager::Source::setStorage): Ditto.
718         (WebKit::UserMediaCaptureManager::Source::setRingBufferFrameBounds): Ditto.
719         (WebKit::UserMediaCaptureManager::Source::audioSamplesAvailable): Ditto.
720         (WebKit::UserMediaCaptureManager::Source::remoteVideoSampleAvailable): Create a 
721         PixelBuffer-backed media sample and call videoSampleAvailable.
722         (WebKit::UserMediaCaptureManager::~UserMediaCaptureManager): Clear the audio and display capture
723         factory overrides.
724         (WebKit::UserMediaCaptureManager::initialize): Set the audio and display capture factory overrides.
725         (WebKit::UserMediaCaptureManager::createCaptureSource):
726         (WebKit::UserMediaCaptureManager::remoteVideoSampleAvailable):
727         * WebProcess/cocoa/UserMediaCaptureManager.h:
728         * WebProcess/cocoa/UserMediaCaptureManager.messages.in:
729
730 2018-10-18  Truitt Savell  <tsavell@apple.com>
731
732         Unreviewed, rolling out r237272.
733
734         Broke on device iOS builds and Windows builds
735
736         Reverted changeset:
737
738         "[MediaStream] Allow ports to optionally do screen capture in
739         the UI process"
740         https://bugs.webkit.org/show_bug.cgi?id=190728
741         https://trac.webkit.org/changeset/237272
742
743 2018-10-18  Jer Noble  <jer.noble@apple.com>
744
745         Enable WKPreferences._lowPowerVideoAudioBufferSizeEnabled by default
746         https://bugs.webkit.org/show_bug.cgi?id=190315
747
748         Reviewed by Eric Carlson.
749
750         This preference is disabled for WebKitLegacy because it can interact poorly with clients' own use of audio.
751         It can be enabled for WebKit since it will only affect the WebProcess and not the client process.
752
753         * Shared/WebPreferences.yaml:
754
755 2018-10-18  Eric Carlson  <eric.carlson@apple.com>
756
757         [MediaStream] Allow ports to optionally do screen capture in the UI process
758         https://bugs.webkit.org/show_bug.cgi?id=190728
759         <rdar://problem/45376824>
760
761         Reviewed by Jer Noble and Tim Horton.
762
763         * Shared/WebProcessCreationParameters.cpp:
764         (WebKit::WebProcessCreationParameters::encode const): Encode shouldCaptureDisplayInUIProcess.
765         (WebKit::WebProcessCreationParameters::decode): Decode shouldCaptureDisplayInUIProcess.
766         * Shared/WebProcessCreationParameters.h:
767
768         * UIProcess/API/APIProcessPoolConfiguration.cpp:
769         (API::ProcessPoolConfiguration::copy): Copy shouldCaptureDisplayInUIProcess.
770         * UIProcess/API/APIProcessPoolConfiguration.h:
771
772         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp:
773         (WebKit::UserMediaCaptureManagerProxy::SourceProxy::remoteVideoSampleAvailable):
774         (WebKit::UserMediaCaptureManagerProxy::createMediaSourceForCaptureDeviceWithConstraints): Remove
775         RealtimeMediaSource::Type parameter, CaptureDevice has the same information. Deal with display
776         capture "devices".
777         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.h:
778         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.messages.in:
779
780         * UIProcess/WebProcessPool.cpp:
781         (WebKit::WebProcessPool::initializeNewWebProcess): Copy shouldCaptureDisplayInUIProcess.
782
783         * WebProcess/cocoa/UserMediaCaptureManager.cpp:
784         (WebKit::UserMediaCaptureManager::Source::Source): Only allocate a ring buffer for Audio sources.
785         (WebKit::UserMediaCaptureManager::Source::~Source): Same for deallocate.
786         (WebKit::UserMediaCaptureManager::Source::storage): m_ringBuffer is a pointer.
787         (WebKit::UserMediaCaptureManager::Source::setStorage): Ditto.
788         (WebKit::UserMediaCaptureManager::Source::setRingBufferFrameBounds): Ditto.
789         (WebKit::UserMediaCaptureManager::Source::audioSamplesAvailable): Ditto.
790         (WebKit::UserMediaCaptureManager::Source::remoteVideoSampleAvailable): Create a 
791         PixelBuffer-backed media sample and call videoSampleAvailable.
792         (WebKit::UserMediaCaptureManager::~UserMediaCaptureManager): Clear the audio and display capture
793         factory overrides.
794         (WebKit::UserMediaCaptureManager::initialize): Set the audio and display capture factory overrides.
795         (WebKit::UserMediaCaptureManager::createCaptureSource):
796         (WebKit::UserMediaCaptureManager::remoteVideoSampleAvailable):
797         * WebProcess/cocoa/UserMediaCaptureManager.h:
798         * WebProcess/cocoa/UserMediaCaptureManager.messages.in:
799
800 2018-10-18  Chris Dumez  <cdumez@apple.com>
801
802         [PSON] SuspendedPages do not report meaningful domains in Activity Monitor
803         https://bugs.webkit.org/show_bug.cgi?id=190721
804         <rdar://problem/45059699>
805
806         Reviewed by Alex Christensen.
807
808         SuspendedPages do not report meaningful domains in Activity Monitor, which makes
809         debugging harder.
810
811         * WebProcess/cocoa/WebProcessCocoa.mm:
812         (WebKit::origin):
813         (WebKit::WebProcess::updateActivePages):
814
815 2018-10-18  Alexey Proskuryakov  <ap@apple.com>
816
817         Switch from PLATFORM(IOS) to PLATFORM(IOS_FAMILY)
818         https://bugs.webkit.org/show_bug.cgi?id=190729
819
820         Reviewed by Tim Horton.
821
822         * DerivedSources.make:
823         * NetworkProcess/Downloads/cocoa/DownloadCocoa.mm:
824         (WebKit::Download::resume):
825         * NetworkProcess/NetworkActivityTracker.h:
826         * NetworkProcess/NetworkProcess.h:
827         * NetworkProcess/NetworkProcessCreationParameters.cpp:
828         (WebKit::NetworkProcessCreationParameters::encode const):
829         (WebKit::NetworkProcessCreationParameters::decode):
830         * NetworkProcess/NetworkProcessCreationParameters.h:
831         * NetworkProcess/cache/NetworkCacheFileSystem.cpp:
832         (WebKit::NetworkCache::isSafeToUseMemoryMapForPath):
833         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
834         (WebKit::updateTaskWithFirstPartyForSameSiteCookies):
835         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
836         (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa):
837         (WebKit::NetworkProcess::sourceApplicationAuditData const):
838         (WebKit::NetworkProcess::platformSyncAllCookies):
839         * NetworkProcess/cocoa/NetworkSessionCocoa.h:
840         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
841         (-[WKNetworkSessionDelegate URLSession:task:didFinishCollectingMetrics:]):
842         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
843         * NetworkProcess/ios/NetworkProcessIOS.mm:
844         * Platform/IPC/mac/ConnectionMac.mm:
845         (IPC::ConnectionTerminationWatchdog::ConnectionTerminationWatchdog):
846         (IPC::Connection::receiveSourceEventHandler):
847         (IPC::AccessibilityProcessSuspendedNotification):
848         * Platform/ios/AccessibilityIOS.mm:
849         * Platform/mac/LayerHostingContext.mm:
850         (WebKit::LayerHostingContext::createForExternalHostingProcess):
851         * Platform/spi/Cocoa/DeviceIdentitySPI.h:
852         * Platform/spi/ios/CelestialSPI.h:
853         * Platform/spi/ios/FrontBoardServicesSPI.h:
854         * PluginProcess/mac/PluginProcessShim.mm:
855         * Shared/API/Cocoa/WKDataDetectorTypesInternal.h:
856         * Shared/API/Cocoa/WebKit.m:
857         * Shared/AssistedNodeInformation.cpp:
858         * Shared/AssistedNodeInformation.h:
859         * Shared/CacheModel.cpp:
860         (WebKit::calculateURLCacheSizes):
861         * Shared/ChildProcess.cpp:
862         * Shared/Cocoa/APIObject.mm:
863         (API::Object::newObject):
864         * Shared/Cocoa/WebKit2InitializeCocoa.mm:
865         (WebKit::runInitializationCode):
866         * Shared/DrawingAreaInfo.h:
867         * Shared/EditorState.cpp:
868         (WebKit::EditorState::encode const):
869         (WebKit::EditorState::decode):
870         (WebKit::EditorState::PostLayoutData::encode const):
871         (WebKit::EditorState::PostLayoutData::decode):
872         (WebKit::operator<<):
873         * Shared/EditorState.h:
874         * Shared/EntryPointUtilities/mac/XPCService/XPCServiceEntryPoint.mm:
875         (WebKit::XPCServiceInitializerDelegate::checkEntitlements):
876         * Shared/EntryPointUtilities/mac/XPCService/XPCServiceMain.mm:
877         (WebKit::XPCServiceMain):
878         * Shared/NativeWebKeyboardEvent.h:
879         * Shared/NativeWebMouseEvent.h:
880         * Shared/NativeWebTouchEvent.h:
881         * Shared/PrintInfo.cpp:
882         (WebKit::PrintInfo::encode const):
883         (WebKit::PrintInfo::decode):
884         * Shared/PrintInfo.h:
885         * Shared/RemoteLayerTree/RemoteLayerTreePropertyApplier.h:
886         * Shared/RemoteLayerTree/RemoteLayerTreePropertyApplier.mm:
887         (WebKit::RemoteLayerTreePropertyApplier::applyProperties):
888         * Shared/SessionState.cpp:
889         (WebKit::FrameState::encode const):
890         (WebKit::FrameState::decode):
891         * Shared/SessionState.h:
892         * Shared/WebCoreArgumentCoders.cpp:
893         * Shared/WebCoreArgumentCoders.h:
894         * Shared/WebEvent.h:
895         * Shared/WebEventConversion.cpp:
896         (WebKit::WebKit2PlatformTouchEvent::WebKit2PlatformTouchEvent):
897         * Shared/WebKeyboardEvent.cpp:
898         * Shared/WebPageCreationParameters.cpp:
899         (WebKit::WebPageCreationParameters::encode const):
900         (WebKit::WebPageCreationParameters::decode):
901         * Shared/WebPageCreationParameters.h:
902         * Shared/WebPlatformTouchPoint.cpp:
903         * Shared/WebPreferences.yaml:
904         * Shared/WebPreferencesDefaultValues.cpp:
905         (defaultPassiveTouchListenersAsDefaultOnDocument):
906         (defaultCustomPasteboardDataEnabled):
907         * Shared/WebPreferencesDefaultValues.h:
908         * Shared/WebProcessCreationParameters.cpp:
909         (WebKit::WebProcessCreationParameters::encode const):
910         (WebKit::WebProcessCreationParameters::decode):
911         * Shared/WebProcessCreationParameters.h:
912         * Shared/WebTouchEvent.cpp:
913         * Shared/cf/ArgumentCodersCF.cpp:
914         (IPC::encode):
915         (IPC::decode):
916         * Shared/cf/ArgumentCodersCF.h:
917         * Shared/ios/ChildProcessIOS.mm:
918         * Shared/ios/InteractionInformationAtPosition.h:
919         * Shared/ios/InteractionInformationAtPosition.mm:
920         * Shared/ios/InteractionInformationRequest.cpp:
921         * Shared/ios/InteractionInformationRequest.h:
922         * Shared/ios/NativeWebKeyboardEventIOS.mm:
923         * Shared/ios/NativeWebMouseEventIOS.mm:
924         * Shared/ios/NativeWebTouchEventIOS.mm:
925         * Shared/ios/WebIOSEventFactory.h:
926         * Shared/ios/WebIOSEventFactory.mm:
927         * Shared/ios/WebIconUtilities.h:
928         * Shared/ios/WebIconUtilities.mm:
929         * Shared/mac/ArgumentCodersMac.h:
930         * Shared/mac/ArgumentCodersMac.mm:
931         * Shared/mac/SandboxExtensionMac.mm:
932         * Shared/mac/SecItemShim.cpp:
933         (WebKit::initializeSecItemShim):
934         * UIProcess/API/APIPageConfiguration.cpp:
935         (API::PageConfiguration::copy const):
936         * UIProcess/API/APIPageConfiguration.h:
937         * UIProcess/API/APIProcessPoolConfiguration.cpp:
938         (API::ProcessPoolConfiguration::copy):
939         * UIProcess/API/APIProcessPoolConfiguration.h:
940         * UIProcess/API/APIUIClient.h:
941         * UIProcess/API/C/WKInspector.cpp:
942         * UIProcess/API/C/WKPage.cpp:
943         (WKPageSetIgnoresViewportScaleLimits):
944         * UIProcess/API/C/mac/WKContextPrivateMac.mm:
945         (WKContextIsPlugInUpdateAvailable):
946         * UIProcess/API/Cocoa/APIAttachmentCocoa.mm:
947         * UIProcess/API/Cocoa/APIWebsiteDataStoreCocoa.mm:
948         (API::WebsiteDataStore::defaultApplicationCacheDirectory):
949         (API::WebsiteDataStore::legacyDefaultApplicationCacheDirectory):
950         (API::WebsiteDataStore::legacyDefaultJavaScriptConfigurationDirectory):
951         * UIProcess/API/Cocoa/WKNavigationAction.mm:
952         (-[WKNavigationAction description]):
953         * UIProcess/API/Cocoa/WKPreviewActionItemIdentifiers.mm:
954         * UIProcess/API/Cocoa/WKPreviewElementInfo.mm:
955         * UIProcess/API/Cocoa/WKProcessGroup.mm:
956         (IGNORE_WARNINGS_BEGIN):
957         * UIProcess/API/Cocoa/WKProcessPool.mm:
958         (-[WKProcessPool _pluginProcessCount]):
959         * UIProcess/API/Cocoa/WKWebView.mm:
960         (shouldRequireUserGestureToLoadVideo):
961         (validate):
962         (-[WKWebView _initializeWithConfiguration:]):
963         (-[WKWebView _setUpSQLiteDatabaseTrackerClient]):
964         (-[WKWebView dealloc]):
965         (-[WKWebView allowsLinkPreview]):
966         (-[WKWebView setAllowsLinkPreview:]):
967         (-[WKWebView _countStringMatches:options:maxCount:]):
968         (-[WKWebView _findString:options:maxCount:]):
969         (-[WKWebView _hideFindUI]):
970         (-[WKWebView _scrollPerformanceData]):
971         (-[WKWebView _allowsMediaDocumentInlinePlayback]):
972         (-[WKWebView _setAllowsMediaDocumentInlinePlayback:]):
973         (-[WKWebView _contentsOfUserInterfaceItem:]):
974         (-[WKWebView _internalDoAfterNextPresentationUpdate:withoutWaitingForPainting:withoutWaitingForAnimatedResize:]):
975         (-[WKWebView _doAfterNextVisibleContentRectUpdate:]):
976         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
977         (-[WKWebViewConfiguration init]):
978         (-[WKWebViewConfiguration encodeWithCoder:]):
979         (-[WKWebViewConfiguration initWithCoder:]):
980         (-[WKWebViewConfiguration copyWithZone:]):
981         (defaultApplicationNameForUserAgent):
982         * UIProcess/API/Cocoa/WKWebViewConfigurationInternal.h:
983         * UIProcess/API/Cocoa/WKWebViewInternal.h:
984         * UIProcess/API/Cocoa/_WKActivatedElementInfo.mm:
985         (-[_WKActivatedElementInfo _initWithType:URL:location:title:ID:rect:image:userInfo:]):
986         * UIProcess/API/Cocoa/_WKActivatedElementInfoInternal.h:
987         * UIProcess/API/Cocoa/_WKAttachment.mm:
988         * UIProcess/API/Cocoa/_WKContextMenuElementInfo.mm:
989         * UIProcess/API/Cocoa/_WKElementAction.mm:
990         * UIProcess/API/Cocoa/_WKElementActionInternal.h:
991         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
992         * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.h:
993         * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
994         (-[WKPaymentAuthorizationViewControllerDelegate invalidate]):
995         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didAuthorizePayment:handler:]):
996         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didSelectPaymentMethod:handler:]):
997         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didSelectShippingMethod:handler:]):
998         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didSelectShippingContact:handler:]):
999         (WebKit::WebPaymentCoordinatorProxy::platformCanMakePaymentsWithActiveCard):
1000         (WebKit::toPKPaymentRequest):
1001         (WebKit::WebPaymentCoordinatorProxy::platformCompletePaymentSession):
1002         (WebKit::WebPaymentCoordinatorProxy::platformCompleteShippingMethodSelection):
1003         (WebKit::WebPaymentCoordinatorProxy::platformCompleteShippingContactSelection):
1004         (WebKit::WebPaymentCoordinatorProxy::platformCompletePaymentMethodSelection):
1005         * UIProcess/ApplePay/ios/WebPaymentCoordinatorProxyIOS.mm:
1006         * UIProcess/ApplicationStateTracker.h:
1007         * UIProcess/ApplicationStateTracker.mm:
1008         * UIProcess/Automation/cocoa/WebAutomationSessionCocoa.mm:
1009         * UIProcess/Automation/ios/WebAutomationSessionIOS.mm:
1010         * UIProcess/BackgroundProcessResponsivenessTimer.cpp:
1011         (WebKit::BackgroundProcessResponsivenessTimer::shouldBeActive const):
1012         * UIProcess/ChildProcessProxy.cpp:
1013         (WebKit::ChildProcessProxy::shutDownProcess):
1014         * UIProcess/Cocoa/DownloadClient.h:
1015         * UIProcess/Cocoa/DownloadClient.mm:
1016         (WebKit::DownloadClient::takeActivityToken):
1017         (WebKit::DownloadClient::releaseActivityTokenIfNecessary):
1018         * UIProcess/Cocoa/LayerRepresentation.h:
1019         * UIProcess/Cocoa/NavigationState.h:
1020         * UIProcess/Cocoa/NavigationState.mm:
1021         (WebKit::NavigationState::NavigationState):
1022         (WebKit::NavigationState::didChangeIsLoading):
1023         * UIProcess/Cocoa/PlaybackSessionManagerProxy.h:
1024         * UIProcess/Cocoa/PlaybackSessionManagerProxy.messages.in:
1025         * UIProcess/Cocoa/PlaybackSessionManagerProxy.mm:
1026         * UIProcess/Cocoa/UIDelegate.h:
1027         * UIProcess/Cocoa/UIDelegate.mm:
1028         (WebKit::UIDelegate::setDelegate):
1029         (WebKit::UIDelegate::UIClient::decidePolicyForUserMediaPermissionRequest):
1030         * UIProcess/Cocoa/VersionChecks.h:
1031         * UIProcess/Cocoa/VersionChecks.mm:
1032         (WebKit::linkedOnOrAfter):
1033         * UIProcess/Cocoa/VideoFullscreenManagerProxy.h:
1034         * UIProcess/Cocoa/VideoFullscreenManagerProxy.messages.in:
1035         * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm:
1036         (WebKit::VideoFullscreenManagerProxy::setupFullscreenWithID):
1037         (WebKit::VideoFullscreenManagerProxy::exitFullscreen):
1038         (WebKit::VideoFullscreenManagerProxy::preparedToReturnToInline):
1039         (WebKit::VideoFullscreenManagerProxy::setVideoLayerFrame):
1040         * UIProcess/Cocoa/ViewGestureController.h:
1041         * UIProcess/Cocoa/WKShareSheet.mm:
1042         (-[WKShareSheet presentWithParameters:completionHandler:]):
1043         * UIProcess/Cocoa/WKWebViewContentProvider.h:
1044         * UIProcess/Cocoa/WKWebViewContentProviderRegistry.h:
1045         * UIProcess/Cocoa/WKWebViewContentProviderRegistry.mm:
1046         * UIProcess/Cocoa/WebPageProxyCocoa.mm:
1047         * UIProcess/Cocoa/WebPasteboardProxyCocoa.mm:
1048         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
1049         (WebKit::WebProcessPool::platformResolvePathsForSandboxExtensions):
1050         (WebKit::WebProcessPool::platformInitializeWebProcess):
1051         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
1052         (WebKit::WebProcessPool::registerNotificationObservers):
1053         (WebKit::WebProcessPool::unregisterNotificationObservers):
1054         * UIProcess/Gamepad/cocoa/UIGamepadProviderCocoa.mm:
1055         (WebKit::UIGamepadProvider::platformSetDefaultGamepadProvider):
1056         * UIProcess/Gamepad/ios/UIGamepadProviderIOS.mm:
1057         * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
1058         (WebKit::shouldLeakBoost):
1059         (WebKit::systemDirectoryPath):
1060         (WebKit::ProcessLauncher::launchProcess):
1061         * UIProcess/Network/NetworkProcessProxy.cpp:
1062         (WebKit::NetworkProcessProxy::didFinishLaunching):
1063         * UIProcess/PageClient.h:
1064         * UIProcess/ProcessAssertion.cpp:
1065         * UIProcess/ProcessAssertion.h:
1066         * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.h:
1067         * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm:
1068         (WebKit::RemoteLayerTreeDrawingAreaProxy::~RemoteLayerTreeDrawingAreaProxy):
1069         (WebKit::RemoteLayerTreeDrawingAreaProxy::commitLayerTree):
1070         (WebKit::RemoteLayerTreeDrawingAreaProxy::indicatorLocation const):
1071         (WebKit::RemoteLayerTreeDrawingAreaProxy::updateDebugIndicator):
1072         (WebKit::RemoteLayerTreeDrawingAreaProxy::didRefreshDisplay):
1073         (WebKit::RemoteLayerTreeDrawingAreaProxy::waitForDidUpdateActivityState):
1074         * UIProcess/RemoteLayerTree/RemoteLayerTreeHost.mm:
1075         (WebKit::RemoteLayerTreeHost::clearLayers):
1076         (WebKit::RemoteLayerTreeHost::detachRootLayer):
1077         * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp:
1078         (WebKit::RemoteScrollingCoordinatorProxy::scrollingTreeNodeDidScroll):
1079         * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h:
1080         * UIProcess/RemoteLayerTree/RemoteScrollingTree.cpp:
1081         (WebKit::RemoteScrollingTree::createScrollingTreeNode):
1082         * UIProcess/RemoteLayerTree/RemoteScrollingTree.h:
1083         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeHostIOS.mm:
1084         * UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm:
1085         * UIProcess/RemoteLayerTree/ios/ScrollingTreeOverflowScrollingNodeIOS.h:
1086         * UIProcess/RemoteLayerTree/ios/ScrollingTreeOverflowScrollingNodeIOS.mm:
1087         * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.h:
1088         * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm:
1089         * UIProcess/ResourceLoadStatisticsPersistentStorage.cpp:
1090         * UIProcess/WKImagePreviewViewController.h:
1091         * UIProcess/WKImagePreviewViewController.mm:
1092         * UIProcess/WKInspectorHighlightView.h:
1093         * UIProcess/WKInspectorHighlightView.mm:
1094         * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm:
1095         (WebKit::LocalAuthenticatorInternal::buildAuthData):
1096         (WebKit::LocalAuthenticator::makeCredential):
1097         (WebKit::LocalAuthenticator::continueMakeCredentialAfterUserConsented):
1098         (WebKit::LocalAuthenticator::continueMakeCredentialAfterAttested):
1099         (WebKit::LocalAuthenticator::getAssertion):
1100         (WebKit::LocalAuthenticator::continueGetAssertionAfterUserConsented):
1101         * UIProcess/WebAuthentication/Cocoa/LocalConnection.mm:
1102         (WebKit::LocalConnection::getUserConsent const):
1103         (WebKit::LocalConnection::getAttestation const):
1104         * UIProcess/WebAuthentication/Cocoa/LocalService.mm:
1105         (WebKit::LocalService::isAvailable):
1106         * UIProcess/WebFullScreenManagerProxy.cpp:
1107         (WebKit::WebFullScreenManagerProxy::supportsFullScreen):
1108         * UIProcess/WebGeolocationManagerProxy.cpp:
1109         * UIProcess/WebGeolocationManagerProxy.h:
1110         * UIProcess/WebInspectorProxy.cpp:
1111         * UIProcess/WebOpenPanelResultListenerProxy.cpp:
1112         * UIProcess/WebOpenPanelResultListenerProxy.h:
1113         * UIProcess/WebPageProxy.cpp:
1114         (WebKit::m_resetRecentCrashCountTimer):
1115         (WebKit::WebPageProxy::finishAttachingToWebProcess):
1116         (WebKit::WebPageProxy::initializeWebPage):
1117         (WebKit::WebPageProxy::close):
1118         (WebKit::WebPageProxy::viewDidLeaveWindow):
1119         (WebKit::WebPageProxy::updateThrottleState):
1120         (WebKit::WebPageProxy::waitForDidUpdateActivityState):
1121         (WebKit::WebPageProxy::didCommitLoadForFrame):
1122         (WebKit::WebPageProxy::exitFullscreenImmediately):
1123         (WebKit::WebPageProxy::runJavaScriptAlert):
1124         (WebKit::WebPageProxy::runJavaScriptConfirm):
1125         (WebKit::WebPageProxy::runJavaScriptPrompt):
1126         (WebKit::WebPageProxy::pageDidScroll):
1127         (WebKit::WebPageProxy::processDidTerminate):
1128         (WebKit::WebPageProxy::resetState):
1129         (WebKit::WebPageProxy::resetStateAfterProcessExited):
1130         (WebKit::WebPageProxy::creationParameters):
1131         (WebKit::WebPageProxy::requestGeolocationPermissionForFrame):
1132         (WebKit::WebPageProxy::hasActiveVideoForControlsManager const):
1133         (WebKit::WebPageProxy::requestControlledElementID const):
1134         (WebKit::WebPageProxy::isPlayingVideoInEnhancedFullscreen const):
1135         * UIProcess/WebPageProxy.h:
1136         * UIProcess/WebPageProxy.messages.in:
1137         * UIProcess/WebPasteboardProxy.h:
1138         * UIProcess/WebPasteboardProxy.messages.in:
1139         * UIProcess/WebProcessPool.cpp:
1140         (WebKit::WebProcessPool::ensureNetworkProcess):
1141         (WebKit::WebProcessPool::initializeNewWebProcess):
1142         (WebKit::WebProcessPool::updateProcessAssertions):
1143         (WebKit::WebProcessPool::reinstateNetworkProcessAssertionState):
1144         * UIProcess/WebProcessPool.h:
1145         * UIProcess/WebProcessProxy.cpp:
1146         (WebKit::isMainThreadOrCheckDisabled):
1147         (WebKit::WebProcessProxy::didFinishLaunching):
1148         (WebKit::WebProcessProxy::didSetAssertionState):
1149         * UIProcess/WebProcessProxy.h:
1150         * UIProcess/WebStorage/LocalStorageDatabaseTracker.cpp:
1151         (WebKit::LocalStorageDatabaseTracker::databasePath const):
1152         * UIProcess/WebStorage/LocalStorageDatabaseTracker.h:
1153         * UIProcess/WebStorage/ios/LocalStorageDatabaseTrackerIOS.mm:
1154         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
1155         * UIProcess/_WKWebViewPrintFormatter.mm:
1156         * UIProcess/_WKWebViewPrintFormatterInternal.h:
1157         * UIProcess/ios/DragDropInteractionState.h:
1158         * UIProcess/ios/DragDropInteractionState.mm:
1159         * UIProcess/ios/InputViewUpdateDeferrer.h:
1160         * UIProcess/ios/InputViewUpdateDeferrer.mm:
1161         * UIProcess/ios/LayerRepresentation.mm:
1162         * UIProcess/ios/PageClientImplIOS.h:
1163         * UIProcess/ios/PageClientImplIOS.mm:
1164         * UIProcess/ios/ProcessAssertionIOS.mm:
1165         * UIProcess/ios/ResourceLoadStatisticsPersistentStorageIOS.mm:
1166         * UIProcess/ios/SmartMagnificationController.h:
1167         * UIProcess/ios/SmartMagnificationController.messages.in:
1168         * UIProcess/ios/SmartMagnificationController.mm:
1169         * UIProcess/ios/TextCheckerIOS.mm:
1170         * UIProcess/ios/ViewGestureControllerIOS.mm:
1171         * UIProcess/ios/WKActionSheet.h:
1172         * UIProcess/ios/WKActionSheet.mm:
1173         * UIProcess/ios/WKActionSheetAssistant.h:
1174         * UIProcess/ios/WKActionSheetAssistant.mm:
1175         * UIProcess/ios/WKApplicationStateTrackingView.h:
1176         * UIProcess/ios/WKApplicationStateTrackingView.mm:
1177         * UIProcess/ios/WKContentView.mm:
1178         * UIProcess/ios/WKContentViewInteraction.h:
1179         * UIProcess/ios/WKContentViewInteraction.mm:
1180         * UIProcess/ios/WKGeolocationProviderIOS.h:
1181         * UIProcess/ios/WKGeolocationProviderIOS.mm:
1182         * UIProcess/ios/WKGeolocationProviderIOSObjCSecurityOrigin.mm:
1183         * UIProcess/ios/WKInspectorNodeSearchGestureRecognizer.h:
1184         * UIProcess/ios/WKInspectorNodeSearchGestureRecognizer.mm:
1185         * UIProcess/ios/WKKeyboardScrollingAnimator.h:
1186         * UIProcess/ios/WKKeyboardScrollingAnimator.mm:
1187         * UIProcess/ios/WKPDFPageNumberIndicator.h:
1188         * UIProcess/ios/WKPDFPageNumberIndicator.mm:
1189         * UIProcess/ios/WKPasswordView.h:
1190         * UIProcess/ios/WKPasswordView.mm:
1191         * UIProcess/ios/WKScrollView.h:
1192         * UIProcess/ios/WKScrollView.mm:
1193         * UIProcess/ios/WKSyntheticClickTapGestureRecognizer.h:
1194         * UIProcess/ios/WKSyntheticClickTapGestureRecognizer.m:
1195         * UIProcess/ios/WKWebEvent.h:
1196         * UIProcess/ios/WKWebEvent.mm:
1197         * UIProcess/ios/WebDataListSuggestionsDropdownIOS.h:
1198         * UIProcess/ios/WebDataListSuggestionsDropdownIOS.mm:
1199         * UIProcess/ios/WebPageProxyIOS.mm:
1200         * UIProcess/ios/WebProcessProxyIOS.mm:
1201         * UIProcess/ios/forms/WKAirPlayRoutePicker.h:
1202         * UIProcess/ios/forms/WKAirPlayRoutePicker.mm:
1203         * UIProcess/ios/forms/WKFileUploadPanel.h:
1204         * UIProcess/ios/forms/WKFileUploadPanel.mm:
1205         * UIProcess/ios/forms/WKFormColorControl.h:
1206         * UIProcess/ios/forms/WKFormColorControl.mm:
1207         * UIProcess/ios/forms/WKFormColorPicker.h:
1208         * UIProcess/ios/forms/WKFormColorPicker.mm:
1209         * UIProcess/ios/forms/WKFormInputControl.h:
1210         * UIProcess/ios/forms/WKFormInputControl.mm:
1211         * UIProcess/ios/forms/WKFormPopover.h:
1212         * UIProcess/ios/forms/WKFormPopover.mm:
1213         * UIProcess/ios/forms/WKFormSelectControl.h:
1214         * UIProcess/ios/forms/WKFormSelectControl.mm:
1215         * UIProcess/ios/forms/WKFormSelectPicker.h:
1216         * UIProcess/ios/forms/WKFormSelectPicker.mm:
1217         * UIProcess/ios/forms/WKFormSelectPopover.h:
1218         * UIProcess/ios/forms/WKFormSelectPopover.mm:
1219         * UIProcess/ios/fullscreen/FullscreenTouchSecheuristic.cpp:
1220         * UIProcess/ios/fullscreen/FullscreenTouchSecheuristic.h:
1221         * UIProcess/ios/fullscreen/WKFullScreenViewController.h:
1222         * UIProcess/ios/fullscreen/WKFullScreenViewController.mm:
1223         * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.h:
1224         * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm:
1225         * UIProcess/ios/fullscreen/WKFullscreenStackView.h:
1226         * UIProcess/ios/fullscreen/WKFullscreenStackView.mm:
1227         * UIProcess/mac/LegacySessionStateCoding.cpp:
1228         (WebKit::encodeFrameStateNode):
1229         (WebKit::decodeBackForwardTreeNode):
1230         * UIProcess/mac/PageClientImplMac.h:
1231         * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.h:
1232         * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm:
1233         * UIProcess/mac/ViewSnapshotStore.mm:
1234         * UIProcess/mac/WKFullScreenWindowController.mm:
1235         * WebProcess/EntryPoint/mac/XPCService/WebContentServiceEntryPoint.mm:
1236         (WebContentServiceInitializer):
1237         * WebProcess/FullScreen/WebFullScreenManager.cpp:
1238         (WebKit::WebFullScreenManager::videoControlsManagerDidChange):
1239         (WebKit::WebFullScreenManager::willEnterFullScreen):
1240         (WebKit::WebFullScreenManager::didEnterFullScreen):
1241         (WebKit::WebFullScreenManager::willExitFullScreen):
1242         * WebProcess/Geolocation/WebGeolocationManager.cpp:
1243         * WebProcess/Geolocation/WebGeolocationManager.h:
1244         * WebProcess/Geolocation/WebGeolocationManager.messages.in:
1245         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandle.mm:
1246         * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
1247         * WebProcess/InjectedBundle/API/c/mac/WKBundlePageBannerMac.mm:
1248         * WebProcess/InjectedBundle/API/mac/WKDOMInternals.mm:
1249         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:
1250         (-[WKWebProcessPlugInBrowserContextController _setEditingDelegate:]):
1251         * WebProcess/WebCoreSupport/SessionStateConversion.cpp:
1252         (WebKit::toFrameState):
1253         (WebKit::applyFrameState):
1254         * WebProcess/WebCoreSupport/WebAlternativeTextClient.h:
1255         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
1256         (WebKit::WebChromeClient::windowRect):
1257         (WebKit::WebChromeClient::enterVideoFullscreenForVideoElement):
1258         * WebProcess/WebCoreSupport/WebChromeClient.h:
1259         * WebProcess/WebCoreSupport/WebEditorClient.cpp:
1260         * WebProcess/WebCoreSupport/WebEditorClient.h:
1261         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1262         (WebKit::WebFrameLoaderClient::dispatchDidLayout):
1263         (WebKit::WebFrameLoaderClient::saveViewStateToItem):
1264         (WebKit::WebFrameLoaderClient::restoreViewState):
1265         (WebKit::WebFrameLoaderClient::transitionToCommittedForNewPage):
1266         (WebKit::WebFrameLoaderClient::objectContentType):
1267         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
1268         * WebProcess/WebCoreSupport/WebInspectorClient.cpp:
1269         (WebKit::WebInspectorClient::highlight):
1270         (WebKit::WebInspectorClient::hideHighlight):
1271         * WebProcess/WebCoreSupport/WebInspectorClient.h:
1272         * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
1273         * WebProcess/WebCoreSupport/WebPlatformStrategies.h:
1274         * WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm:
1275         * WebProcess/WebCoreSupport/ios/WebEditorClientIOS.mm:
1276         * WebProcess/WebCoreSupport/ios/WebFrameLoaderClientIOS.mm:
1277         * WebProcess/WebCoreSupport/mac/WebDragClientMac.mm:
1278         * WebProcess/WebPage/DrawingArea.cpp:
1279         (WebKit::DrawingArea::create):
1280         * WebProcess/WebPage/DrawingArea.h:
1281         * WebProcess/WebPage/FindController.cpp:
1282         (WebKit::FindController::findString):
1283         * WebProcess/WebPage/FindController.h:
1284         * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemoteCustom.mm:
1285         (WebKit::PlatformCALayerRemoteCustom::PlatformCALayerRemoteCustom):
1286         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.h:
1287         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
1288         (WebKit::RemoteLayerTreeDrawingArea::RemoteLayerTreeDrawingArea):
1289         (WebKit::RemoteLayerTreeDrawingArea::updateScrolledExposedRect):
1290         * WebProcess/WebPage/ViewGestureGeometryCollector.cpp:
1291         (WebKit::ViewGestureGeometryCollector::dispatchDidCollectGeometryForSmartMagnificationGesture):
1292         (WebKit::ViewGestureGeometryCollector::collectGeometryForSmartMagnificationGesture):
1293         (WebKit::ViewGestureGeometryCollector::mainFrameDidLayout):
1294         * WebProcess/WebPage/ViewGestureGeometryCollector.h:
1295         * WebProcess/WebPage/ViewGestureGeometryCollector.messages.in:
1296         * WebProcess/WebPage/ViewUpdateDispatcher.cpp:
1297         * WebProcess/WebPage/WKAccessibilityWebPageObjectIOS.h:
1298         * WebProcess/WebPage/WKAccessibilityWebPageObjectIOS.mm:
1299         * WebProcess/WebPage/WebFrame.h:
1300         * WebProcess/WebPage/WebOpenPanelResultListener.cpp:
1301         * WebProcess/WebPage/WebOpenPanelResultListener.h:
1302         * WebProcess/WebPage/WebPage.cpp:
1303         (WebKit::m_cpuLimit):
1304         (WebKit::WebPage::~WebPage):
1305         (WebKit::WebPage::scalePage):
1306         (WebKit::WebPage::setUseFixedLayout):
1307         (WebKit::WebPage::disabledAdaptationsDidChange):
1308         (WebKit::WebPage::viewportPropertiesDidChange):
1309         (WebKit::WebPage::pageDidScroll):
1310         (WebKit::WebPage::mouseEvent):
1311         (WebKit::WebPage::updatePreferences):
1312         (WebKit::WebPage::willCommitLayerTree):
1313         (WebKit::WebPage::didFlushLayerTreeAtTime):
1314         (WebKit::WebPage::mainFrameDidLayout):
1315         (WebKit::WebPage::resetAssistedNodeForFrame):
1316         (WebKit::WebPage::elementDidFocus):
1317         (WebKit::WebPage::elementDidBlur):
1318         (WebKit::WebPage::willReplaceMultipartContent):
1319         (WebKit::WebPage::didReplaceMultipartContent):
1320         (WebKit::WebPage::didCommitLoad):
1321         * WebProcess/WebPage/WebPage.h:
1322         * WebProcess/WebPage/WebPage.messages.in:
1323         * WebProcess/WebPage/ios/FindControllerIOS.mm:
1324         * WebProcess/WebPage/ios/WebPageIOS.mm:
1325         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
1326         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
1327         (WebKit::TiledCoreAnimationDrawingArea::updateScrolledExposedRect):
1328         * WebProcess/WebPage/mac/WebPageMac.mm:
1329         * WebProcess/WebProcess.cpp:
1330         (WebKit::WebProcess::WebProcess):
1331         (WebKit::WebProcess::initializeConnection):
1332         (WebKit::WebProcess::initializeWebProcess):
1333         (WebKit::WebProcess::actualPrepareToSuspend):
1334         (WebKit::WebProcess::cancelPrepareToSuspend):
1335         (WebKit::WebProcess::processDidResume):
1336         * WebProcess/WebProcess.h:
1337         * WebProcess/cocoa/PlaybackSessionManager.h:
1338         * WebProcess/cocoa/PlaybackSessionManager.messages.in:
1339         * WebProcess/cocoa/PlaybackSessionManager.mm:
1340         * WebProcess/cocoa/VideoFullscreenManager.h:
1341         * WebProcess/cocoa/VideoFullscreenManager.messages.in:
1342         * WebProcess/cocoa/VideoFullscreenManager.mm:
1343         (WebKit::VideoFullscreenManager::supportsVideoFullscreen const):
1344         (WebKit::VideoFullscreenManager::supportsVideoFullscreenStandby const):
1345         (WebKit::VideoFullscreenManager::didSetupFullscreen):
1346         (WebKit::VideoFullscreenManager::didExitFullscreen):
1347         * WebProcess/cocoa/WebProcessCocoa.mm:
1348         (WebKit::WebProcess::platformInitializeWebProcess):
1349         (WebKit::WebProcess::initializeProcessName):
1350         (WebKit::registerWithAccessibility):
1351         (WebKit::WebProcess::sourceApplicationAuditData const):
1352         (WebKit::WebProcess::initializeSandbox):
1353         * WebProcess/mac/SecItemShimLibrary.mm:
1354         * config.h:
1355
1356 2018-10-18  Alex Christensen  <achristensen@webkit.org>
1357
1358         Clean up FrameLoader two-state enums
1359         https://bugs.webkit.org/show_bug.cgi?id=190731
1360
1361         Reviewed by Chris Dumez.
1362
1363         * NetworkProcess/NetworkProcess.h:
1364         * NetworkProcess/NetworkProcess.messages.in:
1365         * Shared/WebCoreArgumentCoders.h:
1366         * UIProcess/WebPageProxy.cpp:
1367         (WebKit::WebPageProxy::willPerformClientRedirectForFrame):
1368         * UIProcess/WebPageProxy.h:
1369         * UIProcess/WebPageProxy.messages.in:
1370         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1371         (WebKit::WebFrameLoaderClient::dispatchWillPerformClientRedirect):
1372         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
1373
1374 2018-10-18  Youenn Fablet  <youenn@apple.com>
1375
1376         Handle MDNS resolution of candidates through libwebrtc directly
1377         https://bugs.webkit.org/show_bug.cgi?id=190681
1378
1379         Reviewed by Eric Carlson.
1380
1381         Add support for AsyncResolver to resolve MDNS.
1382         This basically reuse the code path used to resolve STUN server addresses.
1383         Removed MDNS specific resolution.
1384         Use existing CFHost resolution mechanism to do the actual resolution.
1385
1386         * NetworkProcess/webrtc/NetworkMDNSRegister.cpp:
1387         (WebKit::NetworkMDNSRegister::registerMDNSName):
1388         * NetworkProcess/webrtc/NetworkMDNSRegister.messages.in:
1389         * WebProcess/Network/webrtc/LibWebRTCProvider.cpp:
1390         (WebKit::LibWebRTCProvider::createPeerConnection):
1391         * WebProcess/Network/webrtc/LibWebRTCProvider.h:
1392         * WebProcess/Network/webrtc/LibWebRTCSocketFactory.h:
1393         * WebProcess/Network/webrtc/WebMDNSRegister.cpp:
1394         * WebProcess/Network/webrtc/WebMDNSRegister.h:
1395         * WebProcess/Network/webrtc/WebMDNSRegister.messages.in:
1396
1397 2018-10-18  Chris Dumez  <cdumez@apple.com>
1398
1399         [PSON] Cap number of SuspendedPageProxy objects and allow a WebPageProxy to have more than one
1400         https://bugs.webkit.org/show_bug.cgi?id=190688
1401         <rdar://problem/45354095>
1402
1403         Reviewed by Antti Koivisto.
1404
1405         Cap number of SuspendedPageProxy objects to 3 to avoid accumulating too many "suspended" processes.
1406
1407         Also allow a WebPageProxy to have more than one SuspendedPageProxy so that PageCache now works for
1408         more than 1 history navigation (up to 3 with the suspended page limit in this patch).
1409
1410         The following cleanup / refactoring was made to support this:
1411         - The SuspendedPageProxy objects are now owned by the WebProcessPool instead of the WebPageProxy.
1412           The WebProcessPool is in charge of limiting the number of SuspendedPageProxy objects by dropping
1413           the oldest one whenever a WebPageProxy tries to add a new one and we've already reached the limit.
1414         - WebProcessProxy no longer needs to know anything about suspended pages, which simplifies the
1415           code quite a bit. Instead, the SuspendedPageProxy objects now register themselves as
1416           IPC::MessageReceivers with their WebProcessProxy. The SuspendedPageProxy also take care of
1417           calling maybeShutdown() on their WebProcessProxy when they get destroyed.
1418
1419         * UIProcess/SuspendedPageProxy.cpp:
1420         (WebKit::SuspendedPageProxy::~SuspendedPageProxy):
1421         (WebKit::SuspendedPageProxy::tearDownDrawingAreaInWebProcess):
1422         (WebKit::SuspendedPageProxy::unsuspend):
1423         (WebKit::SuspendedPageProxy::didFinishLoad):
1424         (WebKit::SuspendedPageProxy::didReceiveSyncMessage):
1425         * UIProcess/SuspendedPageProxy.h:
1426         * UIProcess/WebPageProxy.cpp:
1427         (WebKit::WebPageProxy::suspendCurrentPageIfPossible):
1428         (WebKit::WebPageProxy::swapToWebProcess):
1429         (WebKit::WebPageProxy::close):
1430         (WebKit::WebPageProxy::continueNavigationInNewProcess):
1431         (WebKit::WebPageProxy::didCompletePageTransition):
1432         (WebKit::WebPageProxy::enterAcceleratedCompositingMode):
1433         * UIProcess/WebPageProxy.h:
1434         * UIProcess/WebProcessPool.cpp:
1435         (WebKit::WebProcessPool::disconnectProcess):
1436         (WebKit::WebProcessPool::processForNavigationInternal):
1437         (WebKit::WebProcessPool::addSuspendedPageProxy):
1438         (WebKit::WebProcessPool::removeAllSuspendedPageProxiesForPage):
1439         (WebKit::WebProcessPool::takeSuspendedPageProxy):
1440         (WebKit::WebProcessPool::hasSuspendedPageProxyFor):
1441         * UIProcess/WebProcessPool.h:
1442         * UIProcess/WebProcessProxy.cpp:
1443         (WebKit::WebProcessProxy::didReceiveMessage):
1444         (WebKit::WebProcessProxy::processDidTerminateOrFailedToLaunch):
1445         (WebKit::WebProcessProxy::canTerminateChildProcess):
1446         (WebKit::WebProcessProxy::requestTermination):
1447         * UIProcess/WebProcessProxy.h:
1448
1449 2018-10-17  Wenson Hsieh  <wenson_hsieh@apple.com>
1450
1451         Enable the datalist element by default on iOS and macOS
1452         https://bugs.webkit.org/show_bug.cgi?id=190594
1453         <rdar://problem/45281159>
1454
1455         Reviewed by Ryosuke Niwa and Tim Horton.
1456
1457         * Configurations/FeatureDefines.xcconfig:
1458         * Platform/spi/ios/UIKitSPI.h:
1459
1460         Add SPI to UITextSuggestion.
1461
1462         * Shared/WebPreferences.yaml:
1463         * Shared/WebPreferencesDefaultValues.h:
1464         * UIProcess/mac/WebDataListSuggestionsDropdownMac.mm:
1465         (-[WKDataListSuggestionCell setText:]):
1466         (-[WKDataListSuggestionTable initWithElementRect:]):
1467
1468         Fix the 32-bit macOS build with ENABLE(DATALIST_ELEMENT).
1469
1470 2018-10-17  Andy Estes  <aestes@apple.com>
1471
1472         [Apple Pay] Increment the API version to 5
1473         https://bugs.webkit.org/show_bug.cgi?id=190686
1474         <rdar://problem/45348523>
1475
1476         Reviewed by Simon Fraser.
1477
1478         * WebProcess/ApplePay/WebPaymentCoordinator.cpp:
1479         (WebKit::WebPaymentCoordinator::supportsVersion):
1480
1481 2018-10-17  Alex Christensen  <achristensen@webkit.org>
1482
1483         BackForwardClient needs to be able to support UIProcess-only back/forward lists
1484         https://bugs.webkit.org/show_bug.cgi?id=190675
1485
1486         Reviewed by Chris Dumez.
1487
1488         * UIProcess/WebBackForwardList.cpp:
1489         (WebKit::WebBackForwardList::itemAtIndex const):
1490         (WebKit::WebBackForwardList::backListCount const):
1491         (WebKit::WebBackForwardList::forwardListCount const):
1492         * UIProcess/WebBackForwardList.h:
1493         * UIProcess/WebPageProxy.cpp:
1494         (WebKit::WebPageProxy::backForwardBackListCount):
1495         (WebKit::WebPageProxy::backForwardForwardListCount):
1496         * UIProcess/WebPageProxy.h:
1497         * UIProcess/WebPageProxy.messages.in:
1498         * WebProcess/WebPage/WebBackForwardListProxy.cpp:
1499         (WebKit::WebBackForwardListProxy::itemAtIndex):
1500         (WebKit::WebBackForwardListProxy::backListCount const):
1501         (WebKit::WebBackForwardListProxy::forwardListCount const):
1502         * WebProcess/WebPage/WebBackForwardListProxy.h:
1503         * WebProcess/WebPage/WebPage.cpp:
1504         (WebKit::WebPage::dumpHistoryForTesting):
1505
1506 2018-10-17  Ali Juma  <ajuma@chromium.org>
1507
1508         Flaky IntersectionObserver web platform tests involving style updates
1509         https://bugs.webkit.org/show_bug.cgi?id=189091
1510
1511         Reviewed by Simon Fraser.
1512
1513         Add a WebPage::willDisplayPage bottleneck that gets called when flushing layers
1514         or, in the non-composited case, when rendering the page into a bitmap.
1515
1516         * WebProcess/WebPage/AcceleratedDrawingArea.cpp:
1517         (WebKit::AcceleratedDrawingArea::updateBackingStoreState):
1518         * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp:
1519         (WebKit::CoordinatedLayerTreeHost::layerFlushTimerFired):
1520         * WebProcess/WebPage/DrawingAreaImpl.cpp:
1521         (WebKit::DrawingAreaImpl::display):
1522         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
1523         (WebKit::RemoteLayerTreeDrawingArea::flushLayers):
1524         * WebProcess/WebPage/WebPage.cpp:
1525         (WebKit::WebPage::willDisplayPage):
1526         * WebProcess/WebPage/WebPage.h:
1527         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
1528         (WebKit::TiledCoreAnimationDrawingArea::flushLayers):
1529
1530 2018-10-16  Patrick Griffis  <pgriffis@igalia.com>
1531
1532         [GTK][WPE] Fix xdg-desktop-portal permissions from a sandbox
1533         https://bugs.webkit.org/show_bug.cgi?id=190619
1534
1535         Reviewed by Michael Catanzaro.
1536
1537         We have to generate a /.flatpak-info file for xdg-desktop-portal
1538         to properly treat us as a sandboxed application.
1539
1540         * UIProcess/Launcher/glib/BubblewrapLauncher.cpp:
1541         (WebKit::createSealedMemFdWithData):
1542         (WebKit::argsToFd):
1543         (WebKit::XDGDBusProxyLauncher::setPermissions):
1544         (WebKit::createFlatpakInfo):
1545         (WebKit::bubblewrapSpawn):
1546
1547 2018-10-16  Sihui Liu  <sihui_liu@apple.com>
1548
1549         Add a switch for Web SQL
1550         https://bugs.webkit.org/show_bug.cgi?id=190271
1551
1552         Reviewed by Ryosuke Niwa.
1553
1554         * Shared/WebPreferences.yaml:
1555         * UIProcess/API/C/WKPreferences.cpp:
1556         (WKPreferencesSetWebSQLDisabled):
1557         (WKPreferencesGetWebSQLDisabled):
1558         * UIProcess/API/C/WKPreferencesRef.h:
1559
1560 2018-10-16  Alex Christensen  <achristensen@webkit.org>
1561
1562         Remove InjectedBundleBackForwardList
1563         https://bugs.webkit.org/show_bug.cgi?id=190640
1564
1565         Reviewed by Chris Dumez.
1566
1567         These objects are only used in testing now, so I made a replacement to be used for testing,
1568         WKBundlePageDumpHistoryForTesting and WKBundleClearHistoryForTesting.
1569         The existence of these objects is problematic with process swapping and the true back/forward list being in the UIProcess.
1570
1571         * Sources.txt:
1572         * WebProcess/InjectedBundle/API/c/WKBundleBackForwardList.cpp:
1573         (WKBundleBackForwardListGetTypeID):
1574         (WKBundleBackForwardListCopyItemAtIndex):
1575         (WKBundleBackForwardListGetBackListCount):
1576         (WKBundleBackForwardListGetForwardListCount):
1577         (WKBundleBackForwardListClear):
1578         * WebProcess/InjectedBundle/API/c/WKBundleBackForwardList.h:
1579         * WebProcess/InjectedBundle/API/c/WKBundleBackForwardListItem.cpp:
1580         (WKBundleBackForwardListItemGetTypeID):
1581         (WKBundleBackForwardListItemIsSame):
1582         (WKBundleBackForwardListItemCopyURL):
1583         (WKBundleBackForwardListItemCopyTarget):
1584         (WKBundleBackForwardListItemIsTargetItem):
1585         (WKBundleBackForwardListItemCopyChildren):
1586         * WebProcess/InjectedBundle/API/c/WKBundleBackForwardListItem.h:
1587         * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
1588         (WKBundlePageDumpHistoryForTesting):
1589         (WKBundleClearHistoryForTesting):
1590         (WKBundlePageGetBackForwardList):
1591         * WebProcess/InjectedBundle/API/c/WKBundlePage.h:
1592         * WebProcess/InjectedBundle/InjectedBundleBackForwardList.cpp: Removed.
1593         * WebProcess/InjectedBundle/InjectedBundleBackForwardList.h: Removed.
1594         * WebProcess/InjectedBundle/InjectedBundleBackForwardListItem.cpp: Removed.
1595         * WebProcess/InjectedBundle/InjectedBundleBackForwardListItem.h: Removed.
1596         * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp:
1597         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1598         * WebProcess/WebPage/WebPage.cpp:
1599         (WebKit::WebPage::~WebPage):
1600         (WebKit::dumpHistoryItem):
1601         (WebKit::WebPage::dumpHistoryForTesting):
1602         (WebKit::WebPage::clearHistory):
1603         (WebKit::WebPage::didReceiveSyncMessage):
1604         (WebKit::WebPage::backForwardList): Deleted.
1605         * WebProcess/WebPage/WebPage.h:
1606
1607 2018-10-16  Timothy Hatcher  <timothy@apple.com>
1608
1609         Add <meta name="supported-color-schemes"> to control what color schemes the page supports
1610         https://bugs.webkit.org/show_bug.cgi?id=190526
1611         rdar://problem/45230140
1612
1613         Reviewed by Dean Jackson.
1614
1615         * UIProcess/mac/WKPrintingView.mm:
1616         (-[WKPrintingView drawRect:]): Update use of LocalDefaultSystemAppearance.
1617         * WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.cpp:
1618         (WebKit::InjectedBundleRangeHandle::renderedImage): Ditto.
1619         * WebProcess/Plugins/PDF/PDFPlugin.mm:
1620         (WebKit::PDFPlugin::paintControlForLayerInContext): Ditto.
1621         * WebProcess/WebPage/WebPage.cpp:
1622         (WebKit::WebPage::drawRect): Ditto.
1623
1624 2018-10-16  Justin Michaud  <justin_michaud@apple.com>
1625
1626         Implement feature flag and bindings for CSS Painting API
1627         https://bugs.webkit.org/show_bug.cgi?id=190237
1628
1629         Reviewed by Ryosuke Niwa.
1630
1631         * Configurations/FeatureDefines.xcconfig:
1632         * Shared/WebPreferences.yaml:
1633         * WebProcess/InjectedBundle/InjectedBundle.cpp:
1634         (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner):
1635
1636 2018-10-16  Philippe Normand  <pnormand@igalia.com>
1637
1638         [GLib] Build error with RemoteInspector disabled
1639         https://bugs.webkit.org/show_bug.cgi?id=190623
1640
1641         Reviewed by Michael Catanzaro.
1642
1643         Compilation guards added to ensure the build still works when the
1644         Remote WebInspector has been disabled.
1645
1646         * UIProcess/API/glib/WebKitAutomationSession.cpp:
1647         * UIProcess/API/glib/WebKitAutomationSessionPrivate.h:
1648         * UIProcess/RemoteWebInspectorProxy.cpp:
1649
1650 2018-10-16  Patrick Griffis  <pgriffis@igalia.com>
1651
1652         [GTK][WPE] Fix sandbox on distros with suid bubblewrap
1653         https://bugs.webkit.org/show_bug.cgi?id=190616
1654
1655         Reviewed by Michael Catanzaro.
1656
1657         * UIProcess/Launcher/glib/BubblewrapLauncher.cpp:
1658         (WebKit::bubblewrapSpawn):
1659
1660 2018-10-16  Alex Christensen  <achristensen@webkit.org>
1661
1662         Replace HistoryItem* with HistoryItem& where possible
1663         https://bugs.webkit.org/show_bug.cgi?id=190617
1664
1665         Reviewed by Chris Dumez.
1666
1667         * WebProcess/WebCoreSupport/SessionStateConversion.h:
1668         * WebProcess/WebPage/WebBackForwardListProxy.cpp:
1669         (WebKit::WK2NotifyHistoryItemChanged):
1670         (WebKit::WebBackForwardListProxy::goToItem):
1671         * WebProcess/WebPage/WebBackForwardListProxy.h:
1672
1673 2018-10-16  Philippe Normand  <pnormand@igalia.com>
1674
1675         Unreviewed, another GTK build fix after r237146
1676
1677         * UIProcess/gtk/RemoteWebInspectorProxyGtk.cpp:
1678         (WebKit::RemoteWebInspectorProxy::platformCreateFrontendPageAndWindow):
1679
1680 2018-10-15  Justin Fan  <justin_fan@apple.com>
1681
1682         Add WebGPU 2018 feature flag and experimental feature flag
1683         https://bugs.webkit.org/show_bug.cgi?id=190509
1684
1685         Reviewed by Dean Jackson.
1686
1687         Re-add ENABLE_WEBGPU, an experimental feature flag, and a RuntimeEnabledFeature
1688         for the 2018 WebGPU prototype.
1689
1690         * Configurations/FeatureDefines.xcconfig:
1691         * Shared/WebPreferences.yaml:
1692         * WebProcess/InjectedBundle/InjectedBundle.cpp:
1693         (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner):
1694
1695 2018-10-15  Alex Christensen  <achristensen@webkit.org>
1696
1697         Fix API tests after r237146
1698
1699         * Shared/WebPageGroupData.cpp:
1700         (WebKit::WebPageGroupData::decode):
1701         I accidentally changed the decoder.
1702
1703 2018-10-15  Sihui Liu  <sihui_liu@apple.com>
1704
1705         HSTS cache entries cannot be removed by origin
1706         https://bugs.webkit.org/show_bug.cgi?id=190455
1707         <rdar://problem/45181322>
1708
1709         Reviewed by Chris Dumez.
1710
1711         The SPI _CFNetworkResetHSTS does not recognize url without protocol, so we need to add protocol manually.
1712
1713         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
1714         (WebKit::NetworkProcess::deleteHSTSCacheForHostNames):
1715
1716 2018-10-15  Alex Christensen  <achristensen@webkit.org>
1717
1718         Fix GTK build, even though bots are not working right now.
1719
1720         * UIProcess/gtk/WebInspectorProxyGtk.cpp:
1721         (WebKit::WebInspectorProxy::platformCreateFrontendPage):
1722
1723 2018-10-15  Alex Christensen  <achristensen@webkit.org>
1724
1725         Fix WinCairo build after r237146
1726
1727         * UIProcess/win/WebInspectorProxyWin.cpp:
1728         (WebKit::WebInspectorProxy::platformCreateFrontendPage):
1729
1730 2018-10-15  Chris Dumez  <cdumez@apple.com>
1731
1732         REGRESSION (r236512): [ Mac WK2 ] Layout Test editing/undo/undo-smart-delete-word.html is flaky
1733         https://bugs.webkit.org/show_bug.cgi?id=190375
1734         <rdar://problem/45177807>
1735
1736         Reviewed by Ryosuke Niwa.
1737
1738         The test is doing the following:
1739         > document.execCommand("Delete"); document.execCommand("Undo");
1740
1741         Both operation are synchronous and rely on synchronous IPC from the WebProcess to the UIProcess.
1742         However, for the undo operation to succeed, the first command need to have been registered with
1743         with the UIProcess via the WebPageProxy::RegisterEditCommandForUndo IPC to the UIProcess, which
1744         is asynchronous.
1745
1746         After r236512, the UIProcess no longer processes incoming sync / async IPC in order and thus,
1747         it is possible for the WebPageProxy::ExecuteUndoRedo synchronous IPC to get processed by the
1748         UIProcess *before* the WebPageProxy::RegisterEditCommandForUndo asynchronous IPC for the
1749         previous "Delete" command. As a result, canUndo would return false and we would fail to undo.
1750
1751         To address the issue, use SendOption::DispatchMessageEvenWhenWaitingForSyncReply flag when sending
1752         the WebPageProxy::RegisterEditCommandForUndo IPC, so that it gets processed in order with regards
1753         to surrounding synchronous IPC.
1754
1755         * WebProcess/WebCoreSupport/WebEditorClient.cpp:
1756         (WebKit::WebEditorClient::registerUndoStep):
1757
1758 2018-10-15  Alex Christensen  <achristensen@webkit.org>
1759
1760         Modernize BackForwardClient.h
1761         https://bugs.webkit.org/show_bug.cgi?id=190610
1762
1763         Reviewed by Chris Dumez.
1764
1765         * WebProcess/InjectedBundle/InjectedBundleBackForwardList.cpp:
1766         (WebKit::InjectedBundleBackForwardList::clear):
1767         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
1768         (WebKit::WebSWContextManagerConnection::installServiceWorker):
1769         * WebProcess/WebPage/WebBackForwardListProxy.cpp:
1770         (WebKit::WebBackForwardListProxy::WebBackForwardListProxy):
1771         (WebKit::WebBackForwardListProxy::backListCount const):
1772         (WebKit::WebBackForwardListProxy::forwardListCount const):
1773         (WebKit::WebBackForwardListProxy::backListCount): Deleted.
1774         (WebKit::WebBackForwardListProxy::forwardListCount): Deleted.
1775         * WebProcess/WebPage/WebBackForwardListProxy.h:
1776         (WebKit::WebBackForwardListProxy::create):
1777         * WebProcess/WebPage/WebPage.cpp:
1778         (WebKit::m_cpuLimit):
1779         (WebKit::WebPage::restoreSessionInternal):
1780
1781 2018-10-15  Timothy Hatcher  <timothy@apple.com>
1782
1783         Add support for prefers-color-scheme media query
1784         https://bugs.webkit.org/show_bug.cgi?id=190499
1785         rdar://problem/45212025
1786
1787         Reviewed by Dean Jackson.
1788
1789         * Configurations/FeatureDefines.xcconfig: Added ENABLE_DARK_MODE_CSS.
1790         * Shared/WebPreferences.yaml: Added DarkModeCSSEnabled as experimental.
1791
1792 2018-10-15  Patrick Griffis  <pgriffis@igalia.com>
1793
1794         Remove StorageProcess leftover
1795         https://bugs.webkit.org/show_bug.cgi?id=190591
1796
1797         Reviewed by Michael Catanzaro.
1798
1799         The process was deleted.
1800
1801         * Shared/ChildProcess.h:
1802         * Shared/mac/ChildProcessMac.mm:
1803         (WebKit::processStorageClass):
1804         (WebKit::sandboxDirectory):
1805         * UIProcess/ChildProcessProxy.cpp:
1806         (WebKit::ChildProcessProxy::getLaunchOptions):
1807         * UIProcess/Launcher/ProcessLauncher.h:
1808         * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
1809         (WebKit::serviceName):
1810
1811 2018-10-15  Alex Christensen  <achristensen@webkit.org>
1812
1813         Remove unused parameters of WebPageGroupData
1814         https://bugs.webkit.org/show_bug.cgi?id=190600
1815
1816         Reviewed by Chris Dumez.
1817
1818         visibleToInjectedBundle and visibleToHistoryClient are both always true.
1819         This removes a mysterious check in the history code.
1820
1821         * Shared/WebPageGroupData.cpp:
1822         (WebKit::WebPageGroupData::encode const):
1823         (WebKit::WebPageGroupData::decode):
1824         * Shared/WebPageGroupData.h:
1825         * UIProcess/WebPageGroup.cpp:
1826         (WebKit::WebPageGroup::create):
1827         (WebKit::pageGroupData):
1828         (WebKit::WebPageGroup::WebPageGroup):
1829         * UIProcess/WebPageGroup.h:
1830         (WebKit::WebPageGroup::WebPageGroup):
1831         (WebKit::WebPageGroup::create):
1832         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1833         (WebKit::WebFrameLoaderClient::updateGlobalHistory):
1834         (WebKit::WebFrameLoaderClient::updateGlobalHistoryRedirectLinks):
1835         (WebKit::WebFrameLoaderClient::setTitle):
1836         * WebProcess/WebPage/WebPage.cpp:
1837         (WebKit::WebPage::create):
1838         (WebKit::WebPage::close):
1839         * WebProcess/WebPage/WebPageGroupProxy.cpp:
1840         (WebKit::WebPageGroupProxy::create):
1841         * WebProcess/WebPage/WebPageGroupProxy.h:
1842         (WebKit::WebPageGroupProxy::pageGroupID const):
1843         (WebKit::WebPageGroupProxy::isVisibleToInjectedBundle const): Deleted.
1844         (WebKit::WebPageGroupProxy::isVisibleToHistoryClient const): Deleted.
1845
1846 2018-10-15  Chris Dumez  <cdumez@apple.com>
1847
1848         Experiment: target=_blank on anchors should imply rel=noopener
1849         https://bugs.webkit.org/show_bug.cgi?id=190481
1850
1851         Reviewed by Alex Christensen.
1852
1853         * Shared/WebPreferences.yaml:
1854
1855 2018-10-15  Alex Christensen  <achristensen@webkit.org>
1856
1857         Remove unused parameters from FrameLoaderClient::createFrame
1858         https://bugs.webkit.org/show_bug.cgi?id=190587
1859
1860         Reviewed by Chris Dumez.
1861
1862         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1863         (WebKit::WebFrameLoaderClient::createFrame):
1864         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
1865
1866 2018-10-15  Wenson Hsieh  <wenson_hsieh@apple.com>
1867
1868         [iOS] Can't select text after dismissing the keyboard when changing focus
1869         https://bugs.webkit.org/show_bug.cgi?id=190563
1870         <rdar://problem/44613559>
1871
1872         Reviewed by Tim Horton.
1873
1874         In r230686, we switched from using UIWKSelectionAssistant to UIWKTextInteractionAssistant for handling selection
1875         in non-editable content on iOS; as such, when an editable element loses focus, instead of switching from the
1876         text interaction assistant to the web selection assistant as we've previously done, we now reset our text
1877         interaction assistant by calling `-[UIWKTextInteractionAssistant setGestureRecognizers]`, which removes all of
1878         the current text selection gesture recognizers from WKContentView and regenerates them by building up a tree of
1879         `UITextInteraction`s and adding them to the assistant (see `-[UITextInteractionAssistant
1880         addGestureRecognizersToView:]`). In particular, `_UITextSelectionForceGesture` is the gesture recognizer used to
1881         trigger text selection when long pressing.
1882
1883         After dismissing the keyboard by tapping the "Done" button, the UITextInteractions and gesture recognizers on
1884         the interaction assistant include:
1885
1886             <UITextInteraction>
1887                 …
1888                 <UITextIndirectNonEditableInteraction>
1889                     <_UIKeyboardBasedNonEditableTextSelectionInteraction>
1890                       ↳ "_UIKeyboardTextSelectionGestureForcePress" → <_UITextSelectionForceGesture>
1891
1892         However, after the keyboard dismisses due to an editable element losing focus, the UITextInteractions on the
1893         interaction assistant look like this:
1894
1895             <UITextInteraction>
1896                 …
1897                 <UITextIndirectNonEditableInteraction>
1898
1899         Subsequently, the lack of a `_UIKeyboardBasedNonEditableTextSelectionInteraction` makes text selection by long
1900         pressing impossible, since the `_UITextSelectionForceGesture` is never introduced to `WKContentView`. In UIKit,
1901         `UITextIndirectNonEditableInteraction` only adds `_UIKeyboardBasedNonEditableTextSelectionInteraction` as a
1902         child if the text input view — in our case, WKContentView — is missing an input delegate (see `-initWithView:`).
1903         In the case where the Done button is used to dismiss the keyboard, WKContentView loses first responder, and the
1904         input delegate of WKContentView is cleared out early on, before we call `-stopAssistingKeyboard`:
1905
1906             -[WKContentView(WKInteraction) setInputDelegate:]
1907             -[UIKeyboardImpl setDelegate:force:]
1908             -[UIPeripheralHost(UIKitInternal) _reloadInputViewsForResponder:]
1909             -[UIResponder _finishResignFirstResponder]
1910             -[UIResponder resignFirstResponder]
1911             -[WKContentView(WKInteraction) resignFirstResponderForWebView]
1912             -[UIKeyboardImpl dismissKeyboard]
1913
1914         However, in the case where the focused element is blurred, we end up clearing out the delegate in
1915         `-_stopAssistingNode`, *after* we've already called `-setGestureRecognizers` on the interaction assistant. This
1916         means UIKit will skip adding `_UIKeyboardBasedNonEditableTextSelectionInteraction` to the text interaction
1917         assistant.
1918
1919             -[WKContentView(WKInteraction) setInputDelegate:]
1920             -[UIKeyboardImpl setDelegate:force:]
1921             -[UIPeripheralHost(UIKitInternal) _reloadInputViewsForResponder:]
1922             -[UIResponder(UIResponderInputViewAdditions) reloadInputViews]
1923             -[WKContentView(WKInteraction) _stopAssistingNode]
1924
1925         To fix this, we simply reset our `inputDelegate` earlier in `_stopAssistingKeyboard` instead of waiting until
1926         we reload input views. This ensures that UIKit sets up the text interaction assistant's gestures when changing
1927         focus in the same way as we would when the keyboard is dismissed via `-resignFirstResponder` (e.g. when pressing
1928         the Done button).
1929
1930         Test: editing/selection/ios/select-text-after-changing-focus.html
1931
1932         * UIProcess/ios/WKContentViewInteraction.mm:
1933         (-[WKContentView setupInteraction]):
1934         (-[WKContentView setUpTextSelectionAssistant]):
1935         (-[WKContentView _startAssistingKeyboard]):
1936         (-[WKContentView _stopAssistingKeyboard]):
1937         (-[WKContentView useSelectionAssistantWithGranularity:]): Deleted.
1938
1939         Additionally rename this to -setUpTextSelectionAssistant and remove the selection granularity argument. This was
1940         previously used to switch between web and text interaction assistants.
1941
1942 2018-10-15  Remy Demarest  <rdemarest@apple.com>
1943
1944         Web Inspector: RDM: Toolbar hidden in when Inspector is docked to side.
1945         https://bugs.webkit.org/show_bug.cgi?id=190545
1946         rdar://problem/44674500
1947
1948         Reviewed by Brian Burg.
1949
1950         When the inspector is placed next to the web view it uses its _topContentInset and _totalHeightOfBanners
1951         to lay out the inspector so it does not underlap the window toolbar, but this technique does not work when
1952         in responsive design mode because of the different attachment view. This patch fixes the issue by using
1953         -[NSWindow contentLayoutRect] to figure out the height of the inspector instead of relying on the content
1954         insets of the web view. This requires observing -contentLayoutRect and ensure we only observe its changes
1955         when the view is actually on the screen.
1956
1957         * UIProcess/WebInspectorProxy.h:
1958         Declare helpers to add/remove observer on the attached inspector window.
1959
1960         * UIProcess/mac/WKInspectorViewController.h:
1961         * UIProcess/mac/WKInspectorViewController.mm:
1962         (-[WKInspectorViewController inspectorWKWebView:willMoveToWindow:]):
1963         (-[WKInspectorViewController inspectorWKWebViewDidMoveToWindow:]):
1964
1965         * UIProcess/mac/WKInspectorWKWebView.h:
1966         * UIProcess/mac/WKInspectorWKWebView.mm:
1967         (-[WKInspectorWKWebView viewWillMoveToWindow:]):
1968         (-[WKInspectorWKWebView viewDidMoveToWindow]):
1969
1970         * UIProcess/mac/WebInspectorProxyMac.mm:
1971         (-[WKWebInspectorProxyObjCAdapter observeValueForKeyPath:ofObject:change:context:]): Update inspector layout
1972         whenever the contentLayoutRect changes. Except when live resizing since the attachment view also sends
1973         notifications at the same time.
1974         (-[WKWebInspectorProxyObjCAdapter inspectorViewController:willMoveToWindow:]):
1975         (-[WKWebInspectorProxyObjCAdapter inspectorViewControllerDidMoveToWindow:]):
1976         (WebKit::WebInspectorProxy::attachmentWillMoveFromWindow): Remove the observer only if we set it up before.
1977         (WebKit::WebInspectorProxy::attachmentDidMoveToWindow): Set up the observer and immediately update the frame
1978         of the inspector since it just moved to its final destination.
1979         (WebKit::WebInspectorProxy::inspectedViewFrameDidChange): Adjust the frame of the attached inspector based
1980         on the contentLayoutRect of the window rather than the topContentInset of the web view.
1981
1982 2018-10-15  Wenson Hsieh  <wenson_hsieh@apple.com>
1983
1984         Changing view scale should zoom to initial scale if the page is already at initial scale
1985         https://bugs.webkit.org/show_bug.cgi?id=190570
1986         <rdar://problem/45261877>
1987
1988         Reviewed by Tim Horton.
1989
1990         r237087 added support for changing the view scale on iOS, by making it possible to let the minimum layout size
1991         be a factor of the view size; this allows internal clients to change page zoom levels on iOS. Currently,
1992         changing the page zoom level automatically zooms to the new initial scale only if the user has not manually
1993         scaled the page before, even if the page is already at initial scale (e.g. after the user double taps to zoom on
1994         a small element, and double taps again to zoom back out to initial scale).
1995
1996         This patch makes some minor adjustments to automatically zoom to the new initial scale after changing the view
1997         scale, as long as the page was at initial scale when changing zoom levels.
1998
1999         Test: fast/viewport/ios/initial-scale-after-changing-view-scale.html
2000
2001         * WebProcess/WebPage/WebPage.h:
2002         * WebProcess/WebPage/ios/WebPageIOS.mm:
2003         (WebKit::areEssentiallyEqualAsFloat):
2004
2005         Move this function further up in the file, so that we can use it in `setViewportConfigurationViewLayoutSize`.
2006
2007         (WebKit::WebPage::setViewportConfigurationViewLayoutSize):
2008
2009         If the page is near initial scale and the zoom level changes, zoom to the new initial scale.
2010
2011         (WebKit::WebPage::viewportConfigurationChanged):
2012
2013         Make this take a new enum argument that determines whether we want to zoom to initial scale as a result of the
2014         viewport configuration change (`No` by default).
2015
2016 2018-10-15  Chris Dumez  <cdumez@apple.com>
2017
2018         Restrict browsing context lookup by name to frames that are related to one another
2019         https://bugs.webkit.org/show_bug.cgi?id=190475
2020
2021         Reviewed by Alex Christensen.
2022
2023         * WebProcess/Plugins/PluginView.cpp:
2024         (WebKit::PluginView::performJavaScriptURLRequest):
2025
2026 2018-10-15  Alex Christensen  <achristensen@webkit.org>
2027
2028         Fix assertion after r237102
2029         https://bugs.webkit.org/show_bug.cgi?id=190459
2030
2031         * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp:
2032         (WebKit::InjectedBundlePageLoaderClient::InjectedBundlePageLoaderClient):
2033         Shipping Safari still uses shouldGoToBackForwardListItem, so only assert on
2034         newer platforms like we do in WKPageSetPageLoaderClient.
2035
2036 2018-10-15  Alex Christensen  <achristensen@webkit.org>
2037
2038         Shrink more enum classes
2039         https://bugs.webkit.org/show_bug.cgi?id=190540
2040
2041         Reviewed by Chris Dumez.
2042
2043         * NetworkProcess/NetworkConnectionToWebProcess.h:
2044         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
2045         * NetworkProcess/NetworkDataTask.h:
2046         * NetworkProcess/NetworkProcess.h:
2047         * NetworkProcess/NetworkProcess.messages.in:
2048         * Shared/Authentication/AuthenticationChallengeDisposition.h:
2049         * Shared/Authentication/AuthenticationManager.h:
2050         * Shared/Authentication/AuthenticationManager.messages.in:
2051         * Shared/DragControllerAction.h:
2052         * Shared/LayerTreeContext.h:
2053         * Shared/UndoOrRedo.h:
2054         * UIProcess/Authentication/AuthenticationDecisionListener.h:
2055         * UIProcess/Cocoa/WebViewImpl.h:
2056         * UIProcess/Network/NetworkProcessProxy.h:
2057         * UIProcess/Network/NetworkProcessProxy.messages.in:
2058         * UIProcess/Notifications/WebNotification.h:
2059         * UIProcess/Notifications/WebNotificationManagerProxy.h:
2060         * UIProcess/PageClient.h:
2061         * UIProcess/UserContent/WebUserContentControllerProxy.h:
2062         * UIProcess/WebPageProxy.h:
2063         * UIProcess/WebPageProxy.messages.in:
2064         * UIProcess/ios/PageClientImplIOS.h:
2065         * UIProcess/ios/WKContentViewInteraction.h:
2066         * UIProcess/ios/forms/WKAirPlayRoutePicker.h:
2067         * WebProcess/Automation/WebAutomationSessionProxy.messages.in:
2068         * WebProcess/MediaStream/UserMediaPermissionRequestManager.h:
2069         * WebProcess/Storage/WebSWClientConnection.messages.in:
2070         * WebProcess/UserContent/InjectUserScriptImmediately.h:
2071         * WebProcess/UserContent/WebUserContentController.h:
2072         * WebProcess/UserContent/WebUserContentController.messages.in:
2073         * WebProcess/WebPage/WebPage.h:
2074         * WebProcess/WebPage/WebPage.messages.in:
2075
2076 2018-10-15  Michael Catanzaro  <mcatanzaro@igalia.com>
2077
2078         Add new files missing from previous commit.
2079
2080         * Source/cmake/FindLibseccomp.cmake: Added.
2081
2082 2018-10-15  Patrick Griffis  <pgriffis@igalia.com>
2083
2084         [GTK][WPE] Implement subprocess sandboxing
2085         https://bugs.webkit.org/show_bug.cgi?id=188568
2086
2087         Reviewed by Michael Catanzaro.
2088
2089         This implements sandboxing of WebKitWebProcesses.
2090
2091         The sandbox is opt-in at runtime as it is a behavior change.
2092         See webkit_web_context_set_sandbox_enabled() and the
2093         WEBKIT_FORCE_SANDBOX env var for developers.
2094
2095         This is Linux specific using Namespaces, Seccomp, and a DBus proxy service.
2096         This introduces three new dependencies:
2097
2098         - bwrap executable
2099         - libseccomp library
2100         - xdg-dbus-proxy executable
2101
2102         The use of xdg-dbus-proxy will ideally be replaced once upstream DBus
2103         gains the same filtering abilities which is a work in progress.
2104
2105         Currently the sandbox is not completed and there are a few large holes:
2106
2107         - Pulseaudio: The Pipewire project will solve this.
2108         - DRI device access: No immediate solutions planned.
2109         - Webcam device access: Pipewire will also solve this.
2110         - Webprocess network access: Will require GStreamer changes.
2111         - DConf access: Custom proxy planned.
2112         - X11 access: Wayland solves this.
2113
2114         That is not an exhaustive list but are the noteworthy ones. Filesystem access
2115         is still an evolving list as problems are found as is specific DBus name access.
2116
2117         * PlatformGTK.cmake:
2118         * PlatformWPE.cmake:
2119         * SourcesGTK.txt:
2120         * SourcesWPE.txt:
2121         * UIProcess/API/glib/WebKitWebContext.cpp:
2122         (webkit_web_context_set_sandbox_enabled):
2123         (webkit_web_context_get_sandbox_enabled):
2124         * UIProcess/API/gtk/WebKitWebContext.h:
2125         * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt:
2126         * UIProcess/API/wpe/WebKitWebContext.h:
2127         * UIProcess/ChildProcessProxy.cpp:
2128         (WebKit::ChildProcessProxy::getLaunchOptions):
2129         * UIProcess/ChildProcessProxy.h:
2130         (WebKit::ChildProcessProxy::platformGetLaunchOptions):
2131         * UIProcess/Launcher/ProcessLauncher.h:
2132         * UIProcess/Launcher/glib/BubblewrapLauncher.cpp: Added.
2133         (WebKit::memfd_create):
2134         (WebKit::argsToFd):
2135         (WebKit::XDGDBusProxyLauncher::setAddress):
2136         (WebKit::XDGDBusProxyLauncher::isRunning const):
2137         (WebKit::XDGDBusProxyLauncher::path const):
2138         (WebKit::XDGDBusProxyLauncher::proxyPath const):
2139         (WebKit::XDGDBusProxyLauncher::setPermissions):
2140         (WebKit::XDGDBusProxyLauncher::launch):
2141         (WebKit::XDGDBusProxyLauncher::childSetupFunc):
2142         (WebKit::XDGDBusProxyLauncher::makeProxyPath):
2143         (WebKit::XDGDBusProxyLauncher::dbusAddressToPath):
2144         (WebKit::bindIfExists):
2145         (WebKit::bindDBusSession):
2146         (WebKit::bindX11):
2147         (WebKit::bindDconf):
2148         (WebKit::bindWayland):
2149         (WebKit::bindPulse):
2150         (WebKit::bindFonts):
2151         (WebKit::bindGtkData):
2152         (WebKit::bindA11y):
2153         (WebKit::bindPathVar):
2154         (WebKit::bindGStreamerData):
2155         (WebKit::bindOpenGL):
2156         (WebKit::bindV4l):
2157         (WebKit::bindSymlinksRealPath):
2158         (WebKit::setupSeccomp):
2159         (WebKit::bubblewrapSpawn):
2160         * UIProcess/Launcher/glib/BubblewrapLauncher.h: Added.
2161         * UIProcess/Launcher/glib/FlatpakLauncher.cpp: Added.
2162         (WebKit::flatpakSpawn):
2163         * UIProcess/Launcher/glib/FlatpakLauncher.h: Added.
2164         * UIProcess/Launcher/glib/ProcessLauncherGLib.cpp:
2165         (WebKit::isInsideFlatpak):
2166         (WebKit::ProcessLauncher::launchProcess):
2167         * UIProcess/Plugins/PluginProcessProxy.cpp:
2168         (WebKit::PluginProcessProxy::getLaunchOptions):
2169         * UIProcess/Plugins/PluginProcessProxy.h:
2170         * UIProcess/Plugins/mac/PluginProcessProxyMac.mm:
2171         (WebKit::PluginProcessProxy::platformGetLaunchOptionsWithAttributes):
2172         * UIProcess/Plugins/unix/PluginProcessProxyUnix.cpp:
2173         (WebKit::PluginProcessProxy::platformGetLaunchOptionsWithAttributes):
2174         * UIProcess/WebProcessPool.h:
2175         * UIProcess/WebProcessProxy.cpp:
2176         (WebKit::WebProcessProxy::platformGetLaunchOptions):
2177         * UIProcess/WebProcessProxy.h:
2178         * UIProcess/glib/WebProcessProxyGLib.cpp: Added.
2179         (WebKit::WebProcessProxy::platformGetLaunchOptions):
2180
2181 2018-10-15  Alex Christensen  <achristensen@webkit.org>
2182
2183         Add a temporarily off by default preference for doing safe browsing checks
2184         https://bugs.webkit.org/show_bug.cgi?id=190522
2185
2186         Reviewed by Chris Dumez.
2187
2188         Safe browsing development has taken longer than anticipated.
2189         To prevent the unused possible contacting the safe browsing provider for no benefit, make this off by default for now.
2190         I'll make it on by default when it's actually used.
2191
2192         * Shared/WebPreferences.yaml:
2193         * UIProcess/API/Cocoa/WKPreferences.mm:
2194         (-[WKPreferences _setSafeBrowsingEnabled:]):
2195         (-[WKPreferences _safeBrowsingEnabled]):
2196         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
2197         * UIProcess/WebPageProxy.cpp:
2198         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
2199
2200 2018-10-15  Alex Christensen  <achristensen@webkit.org>
2201
2202         Include EnumTraits.h less
2203         https://bugs.webkit.org/show_bug.cgi?id=190535
2204
2205         Reviewed by Chris Dumez.
2206
2207         * NetworkProcess/NetworkSessionCreationParameters.h:
2208         * Shared/Authentication/AuthenticationChallengeDisposition.h:
2209         * Shared/CoordinateSystem.h:
2210         * Shared/LayerTreeContext.h:
2211         * Shared/UndoOrRedo.h:
2212         * Shared/WebsiteAutoplayPolicy.h:
2213         * Shared/WebsitePopUpPolicy.h:
2214         * UIProcess/API/APIWebsitePolicies.h:
2215         * WebProcess/UserContent/InjectUserScriptImmediately.h:
2216
2217 2018-10-15  Alex Christensen  <achristensen@webkit.org>
2218
2219         Remove InjectedBundle processing of back/forward lists
2220         https://bugs.webkit.org/show_bug.cgi?id=190459
2221
2222         Reviewed by Chris Dumez.
2223
2224         * Shared/API/c/WKDeprecated.h:
2225         * UIProcess/API/APINavigationClient.h:
2226         (API::NavigationClient::willGoToBackForwardListItem):
2227         * UIProcess/Cocoa/NavigationState.h:
2228         * UIProcess/Cocoa/NavigationState.mm:
2229         (WebKit::NavigationState::NavigationClient::willGoToBackForwardListItem):
2230         * UIProcess/WebPageProxy.cpp:
2231         (WebKit::WebPageProxy::willGoToBackForwardListItem):
2232         * UIProcess/WebPageProxy.h:
2233         * UIProcess/WebPageProxy.messages.in:
2234         * WebProcess/InjectedBundle/API/APIInjectedBundlePageLoaderClient.h:
2235         (API::InjectedBundle::PageLoaderClient::shouldGoToBackForwardListItem): Deleted.
2236         * WebProcess/InjectedBundle/API/c/WKBundleBackForwardListItem.cpp:
2237         (WKBundleBackForwardListItemCopyOriginalURL):
2238         (WKBundleBackForwardListItemCopyTitle):
2239         (WKBundleBackForwardListItemIsTargetItem):
2240         (WKBundleBackForwardListItemIsInPageCache):
2241         (WKBundleBackForwardListItemHasCachedPageExpired):
2242         * WebProcess/InjectedBundle/API/c/WKBundleBackForwardListItem.h:
2243         * WebProcess/InjectedBundle/API/c/WKBundleFileHandleRef.h:
2244         * WebProcess/InjectedBundle/API/c/WKBundleFrame.h:
2245         * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp:
2246         (WebKit::InjectedBundlePageLoaderClient::InjectedBundlePageLoaderClient):
2247         (WebKit::InjectedBundlePageLoaderClient::shouldGoToBackForwardListItem): Deleted.
2248         * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h:
2249         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
2250         (WebKit::WebFrameLoaderClient::shouldGoToHistoryItem const):
2251         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
2252
2253 2018-10-15  Alex Christensen  <achristensen@webkit.org>
2254
2255         WebPageProxy should always have a HistoryClient
2256         https://bugs.webkit.org/show_bug.cgi?id=190450
2257
2258         Reviewed by Chris Dumez.
2259
2260         This will make it so we don't forget to null check it.
2261         No change in behavior because the default HistoryClient does nothing.
2262
2263         * UIProcess/API/APIHistoryClient.h:
2264         * UIProcess/Cocoa/NavigationState.h:
2265         * UIProcess/Cocoa/NavigationState.mm:
2266         (WebKit::NavigationState::createHistoryClient):
2267         * UIProcess/WebPageProxy.cpp:
2268         (WebKit::WebPageProxy::WebPageProxy):
2269         (WebKit::WebPageProxy::setHistoryClient):
2270         (WebKit::WebPageProxy::didNavigateWithNavigationData):
2271         (WebKit::WebPageProxy::didPerformClientRedirect):
2272         (WebKit::WebPageProxy::didPerformServerRedirect):
2273         (WebKit::WebPageProxy::didUpdateHistoryTitle):
2274         * UIProcess/WebPageProxy.h:
2275
2276 2018-10-15  Alex Christensen  <achristensen@webkit.org>
2277
2278         Use std::optional<size_t> for a WebBackForwardList's current index
2279         https://bugs.webkit.org/show_bug.cgi?id=190448
2280
2281         Reviewed by Chris Dumez.
2282
2283         Also remove m_capacity, which was immutable.
2284
2285         * UIProcess/WebBackForwardList.cpp:
2286         (WebKit::WebBackForwardList::WebBackForwardList):
2287         (WebKit::WebBackForwardList::~WebBackForwardList):
2288         (WebKit::WebBackForwardList::pageClosed):
2289         (WebKit::WebBackForwardList::addItem):
2290         (WebKit::WebBackForwardList::goToItem):
2291         (WebKit::WebBackForwardList::currentItem const):
2292         (WebKit::WebBackForwardList::backItem const):
2293         (WebKit::WebBackForwardList::forwardItem const):
2294         (WebKit::WebBackForwardList::itemAtIndex const):
2295         (WebKit::WebBackForwardList::backListCount const):
2296         (WebKit::WebBackForwardList::forwardListCount const):
2297         (WebKit::WebBackForwardList::backListAsAPIArrayWithLimit const):
2298         (WebKit::WebBackForwardList::forwardListAsAPIArrayWithLimit const):
2299         (WebKit::WebBackForwardList::removeAllItems):
2300         (WebKit::WebBackForwardList::clear):
2301         (WebKit::WebBackForwardList::backForwardListState const):
2302         (WebKit::WebBackForwardList::restoreFromState):
2303         (WebKit::WebBackForwardList::loggingString):
2304         * UIProcess/WebBackForwardList.h:
2305         (WebKit::WebBackForwardList::currentIndex const): Deleted.
2306
2307 2018-10-14  Yusuke Suzuki  <yusukesuzuki@slowstart.org>
2308
2309         [JSC] Remove Option::useAsyncIterator
2310         https://bugs.webkit.org/show_bug.cgi?id=190567
2311
2312         Reviewed by Saam Barati.
2313
2314         * Configurations/FeatureDefines.xcconfig:
2315
2316 2018-10-12  Wenson Hsieh  <wenson_hsieh@apple.com>
2317
2318         [iOS] Allow SPI clients to lay out at arbitrarily scaled sizes and scale to fit the view
2319         https://bugs.webkit.org/show_bug.cgi?id=190504
2320         <rdar://problem/45117760>
2321
2322         Reviewed by Tim Horton.
2323
2324         Add support for _setViewScale: and _viewScale on iOS. While similar in concept to macOS, changing this property
2325         on iOS uses viewport configurations to change the minimum layout size of the document and apply view scaling.
2326         Setting the view scale on iOS to a value `s` multiplies the minimium layout size by a factor `1 / s`, but also
2327         multiplies the initial, minimum and maximum scales by a factor of `s`. The net effect of applying this scale
2328         causes the page to lay out at a larger width and shrink (or a smaller width and expand) to fit the viewport.
2329
2330         * Shared/WebPageCreationParameters.cpp:
2331         (WebKit::WebPageCreationParameters::encode const):
2332         (WebKit::WebPageCreationParameters::decode):
2333         * Shared/WebPageCreationParameters.h:
2334
2335         Send `viewportConfigurationLayoutSizeScaleFactor` alongside `viewportConfigurationViewLayoutSize`.
2336
2337         (-[WKWebView _dispatchSetViewLayoutSize:]):
2338         (-[WKWebView _viewScale]):
2339         (-[WKWebView _setViewScale:]):
2340
2341         Provide a different implementation of `_setViewScale:` on iOS, by scaling the effective minimum layout size.
2342         (See above for more detail).
2343
2344         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
2345
2346         Add missing API availability annotations for the _viewScale property.
2347
2348         * UIProcess/API/mac/WKView.mm:
2349         (-[WKView _setViewScale:]):
2350         * UIProcess/Cocoa/WebViewImpl.mm:
2351
2352         Both -[WKView _setViewScale:] and -[WKWebView _setViewScale:] throw Objective C exceptions upon receiving a bad
2353         argument (e.g. scale <= 0). However, logic for throwing this exception is specific to iOS in WKWebView, and
2354         handled in WebViewImpl on macOS. To make this less confusing, move the exception throwing code out of
2355         !PLATFORM(MAC) in WKWebView, and move the path for raising this exception in WKView on macOS from WebViewImpl to
2356         WKView.
2357
2358         * UIProcess/WebPageProxy.cpp:
2359         (WebKit::WebPageProxy::creationParameters):
2360         * UIProcess/WebPageProxy.h:
2361         (WebKit::WebPageProxy::layoutSizeScaleFactor const):
2362
2363         Tie the notion of "view scale" on iOS to `layoutSizeScaleFactor`. As its name suggests, this is a scale factor
2364         by which we transform the layout size.
2365
2366         * UIProcess/ios/WebPageProxyIOS.mm:
2367         (WebKit::WebPageProxy::setViewportConfigurationViewLayoutSize):
2368         * WebProcess/WebPage/WebPage.cpp:
2369         * WebProcess/WebPage/WebPage.h:
2370         * WebProcess/WebPage/WebPage.messages.in:
2371
2372         Plumb the layout size scale factor over to the web process, along with the layout size.
2373
2374         * WebProcess/WebPage/ios/WebPageIOS.mm:
2375         (WebKit::WebPage::setViewportConfigurationViewLayoutSize):
2376
2377 2018-10-12  Alex Christensen  <achristensen@webkit.org>
2378
2379         Allow encoding of small enum classes
2380         https://bugs.webkit.org/show_bug.cgi?id=190531
2381
2382         Reviewed by Tim Horton.
2383
2384         * NetworkProcess/NetworkLoadClient.h:
2385         * Scripts/webkit/messages.py:
2386         * Scripts/webkit/parser.py:
2387         (parse_parameters_string):
2388         * UIProcess/API/APINavigation.h:
2389         * UIProcess/WebFramePolicyListenerProxy.h:
2390         * UIProcess/WebNavigationState.h:
2391         * UIProcess/WebPageProxy.h:
2392         * UIProcess/WebPageProxy.messages.in:
2393         * WebProcess/WebPage/WebPage.messages.in:
2394
2395 2018-10-12  Rob Buis  <rbuis@igalia.com>
2396
2397         Solve the confusion around blankURL() and isBlankURL() in URL
2398         https://bugs.webkit.org/show_bug.cgi?id=158988
2399
2400         Reviewed by Alex Christensen.
2401
2402         * NetworkProcess/NetworkResourceLoader.cpp:
2403         (WebKit::NetworkResourceLoader::continueWillSendRequest):
2404         * UIProcess/WebProcessPool.cpp:
2405         (WebKit::WebProcessPool::processForNavigationInternal):
2406         * UIProcess/WebResourceLoadStatisticsStore.cpp:
2407         (WebKit::WebResourceLoadStatisticsStore::logUserInteraction):
2408         (WebKit::WebResourceLoadStatisticsStore::clearUserInteraction):
2409         (WebKit::WebResourceLoadStatisticsStore::hasHadUserInteraction):
2410         (WebKit::WebResourceLoadStatisticsStore::setLastSeen):
2411         (WebKit::WebResourceLoadStatisticsStore::setPrevalentResource):
2412         (WebKit::WebResourceLoadStatisticsStore::setVeryPrevalentResource):
2413         (WebKit::WebResourceLoadStatisticsStore::isPrevalentResource):
2414         (WebKit::WebResourceLoadStatisticsStore::isVeryPrevalentResource):
2415         (WebKit::WebResourceLoadStatisticsStore::clearPrevalentResource):
2416         (WebKit::WebResourceLoadStatisticsStore::setGrandfathered):
2417         (WebKit::WebResourceLoadStatisticsStore::isGrandfathered):
2418         (WebKit::WebResourceLoadStatisticsStore::setSubframeUnderTopFrameOrigin):
2419         (WebKit::WebResourceLoadStatisticsStore::setSubresourceUnderTopFrameOrigin):
2420         (WebKit::WebResourceLoadStatisticsStore::setSubresourceUniqueRedirectTo):
2421         (WebKit::WebResourceLoadStatisticsStore::setSubresourceUniqueRedirectFrom):
2422         (WebKit::WebResourceLoadStatisticsStore::setTopFrameUniqueRedirectTo):
2423         (WebKit::WebResourceLoadStatisticsStore::setTopFrameUniqueRedirectFrom):
2424
2425 2018-10-12  Youenn Fablet  <youenn@apple.com>
2426
2427         Cache API tests are flaky due to file writing failing from time to time
2428         https://bugs.webkit.org/show_bug.cgi?id=190321
2429
2430         Reviewed by Chris Dumez.
2431
2432         Make NetworkCache::Storage::store callback return an error in case of writing failure.
2433         Use this to surface this error at Cache API level.
2434
2435         Minor clean-up to make Storage::clear take a completion handler.
2436
2437         Make also sure to create the folder before writing the file in CacheStorageEngine.
2438         As can be seen from some logging, it does happen that writing the 'origin' file sometimes fail with Posix error 9,
2439         which might mean the folder is not present.
2440
2441         Changes are covered by current tests, flaky tests like http/wpt/cache-storage/cache-put-keys.https.any.worker.html
2442         will show a "failed writing data to the file system" error message.
2443
2444         * NetworkProcess/cache/CacheStorageEngine.cpp:
2445         (WebKit::CacheStorage::Engine::writeFile):
2446         * NetworkProcess/cache/CacheStorageEngine.h:
2447         * NetworkProcess/cache/CacheStorageEngineCaches.cpp:
2448         (WebKit::CacheStorage::Caches::storeOrigin):
2449         (WebKit::CacheStorage::Caches::writeCachesToDisk):
2450         (WebKit::CacheStorage::Caches::writeRecord):
2451         * NetworkProcess/cache/NetworkCacheStorage.cpp:
2452         (WebKit::NetworkCache::Storage::WriteOperation::WriteOperation):
2453         (WebKit::NetworkCache::Storage::dispatchWriteOperation):
2454         (WebKit::NetworkCache::Storage::finishWriteOperation):
2455         (WebKit::NetworkCache::Storage::store):
2456         (WebKit::NetworkCache::Storage::clear):
2457         * NetworkProcess/cache/NetworkCacheStorage.h:
2458         (WebKit::NetworkCache::Storage::store):
2459
2460 2018-10-11  Youenn Fablet  <youenn@apple.com>
2461
2462         IOS 12 - Service worker cache not shared when added to homescreen
2463         https://bugs.webkit.org/show_bug.cgi?id=190269
2464         <rdar://problem/45009961>
2465
2466         Reviewed by Alex Christensen.
2467
2468         NetworkProcessProxy does not always have all its stores in its hash map.
2469         Make sure to check for the default web process pool store when grabbing cache storage parameters from a given session ID.
2470
2471         Add a way to remove the default website data for testing.
2472         This is used in the new API test.
2473
2474         * UIProcess/API/APIWebsiteDataStore.cpp:
2475         (API::WebsiteDataStore::deleteDefaultDataStoreForTesting):
2476         * UIProcess/API/APIWebsiteDataStore.h:
2477         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
2478         (+[WKWebsiteDataStore _deleteDefaultDataStoreForTesting]):
2479         * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
2480         * UIProcess/Network/NetworkProcessProxy.cpp:
2481         (WebKit::NetworkProcessProxy::retrieveCacheStorageParameters):
2482
2483 2018-10-10  Simon Fraser  <simon.fraser@apple.com>
2484
2485         Hide RenderLayer z-order and normal flow lists behind iterators
2486         https://bugs.webkit.org/show_bug.cgi?id=190457
2487
2488         Reviewed by Zalan Bujtas.
2489
2490         Expose the positive z-order, negative z-order and normal flow lists
2491         from RenderLayer as iterators rather than vectors of raw pointers.
2492         
2493         Use a lambda function to get access to the private constructor, while not having
2494         to refer to the nested RenderLayer::LayerIterator class in the header.
2495
2496         * Shared/WebRenderLayer.cpp:
2497         (WebKit::WebRenderLayer::WebRenderLayer):
2498         (WebKit::WebRenderLayer::createArrayFromLayerList): Deleted.
2499         * Shared/WebRenderLayer.h:
2500
2501 2018-10-11  Tim Horton  <timothy_horton@apple.com>
2502
2503         iOS: Scrolling using the arrow keys doesn't show the scroll indicator like it does on macOS
2504         https://bugs.webkit.org/show_bug.cgi?id=190478
2505         <rdar://problem/22194031>
2506
2507         Reviewed by Megan Gardner.
2508
2509         * Platform/spi/ios/UIKitSPI.h:
2510         Add some SPI.
2511
2512         * UIProcess/ios/WKKeyboardScrollingAnimator.mm:
2513         (-[WKKeyboardScrollViewAnimator scrollToContentOffset:animated:]):
2514         Do a persistent flash when scrolling continuously.
2515
2516         (-[WKKeyboardScrollViewAnimator scrollWithScrollToExtentAnimationTo:]):
2517         Do a single flash when doing a scroll-to-top/bottom.
2518
2519 2018-10-11  Tim Horton  <timothy_horton@apple.com>
2520
2521         Clicking on bookmarklet crashes at NavigationState::willRecordNavigationSnapshot
2522         https://bugs.webkit.org/show_bug.cgi?id=190476
2523         <rdar://problem/32757191>
2524
2525         Reviewed by Megan Gardner.
2526
2527         * UIProcess/API/Cocoa/WKWebView.mm:
2528         (-[WKWebView _saveBackForwardSnapshotForItem:]):
2529         The WKBackForwardListItem can be nil. Then we retrieve a reference from it.
2530         An Objective-C method that returns a reference is a great way to get
2531         a null reference. Other code then assumes it's not null and crashes.
2532         Add a nil check.
2533
2534 2018-10-11  Tim Horton  <timothy_horton@apple.com>
2535
2536         Hardware keyboard arrow keys/spacebar don't scroll PDFs (works for web content)
2537         https://bugs.webkit.org/show_bug.cgi?id=190495
2538         <rdar://problem/22734616>
2539
2540         Reviewed by Andy Estes.
2541
2542         Hook up WKKeyboardScrollViewAnimator to the scroll view when
2543         WKPDFView is installed.
2544
2545         * Platform/spi/ios/UIKitSPI.h:
2546         Move _inputFlags to the IPI section so we can remove it
2547         from WKContentViewInteraction.
2548
2549         * SourcesCocoa.txt:
2550         * UIProcess/ios/WKWebEvent.h:
2551         * UIProcess/ios/WKWebEvent.mm:
2552         * UIProcess/ios/WKContentViewInteraction.mm:
2553         (-[WKContentView handleKeyEvent:]):
2554         (-[WKWebEvent dealloc]): Deleted.
2555         * WebKit.xcodeproj/project.pbxproj:
2556         Move WKWebEvent out of WKContentViewInteraction.
2557         We tend to prefer one file per class.
2558         Also, move the code to make a WKWebEvent from a UIEvent into
2559         -initWithEvent:, instead of being ad-hoc in WKContentViewInteraction.
2560         Adopt RetainPtr for the WKWebEvent's uiEvent property.
2561
2562         * UIProcess/API/Cocoa/WKWebView.mm:
2563         (-[WKWebView _handleKeyUIEvent:]):
2564         * UIProcess/Cocoa/WKWebViewContentProvider.h:
2565         Plumb hardware keyboard events to custom content views, if they want them.
2566
2567         * UIProcess/ios/WKPDFView.mm:
2568         (-[WKPDFView dealloc]):
2569         (-[WKPDFView web_handleKeyEvent:]):
2570         (-[WKPDFView web_initWithFrame:webView:mimeType:]):
2571         Install a WKKeyboardScrollViewAnimator and plumb key events to it.
2572
2573 2018-10-11  Antoine Quint  <graouts@apple.com>
2574
2575         [Web Animations] Allow iOS to also control toggling Web Animations CSS Integration
2576         https://bugs.webkit.org/show_bug.cgi?id=190489
2577
2578         Reviewed by Tim Horton.
2579
2580         * UIProcess/API/Cocoa/WKPreferences.mm:
2581         (-[WKPreferences _setWebAnimationsCSSIntegrationEnabled:]):
2582         (-[WKPreferences _webAnimationsCSSIntegrationEnabled]):
2583         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
2584
2585 2018-10-11  Keith Rollin  <krollin@apple.com>
2586
2587         CURRENT_ARCH should not be used in Run Script phase.
2588         https://bugs.webkit.org/show_bug.cgi?id=190407
2589         <rdar://problem/45133556>
2590
2591         Reviewed by Alexey Proskuryakov.
2592
2593         CURRENT_ARCH is used in a number of Xcode Run Script phases. However,
2594         CURRENT_ARCH is not well-defined during this phase (and may even have
2595         the value "undefined") since this phase is run just once per build
2596         rather than once per supported architecture. Migrate away from
2597         CURRENT_ARCH in favor of ARCHS, either by iterating over ARCHS and
2598         performing an operation for each value, or by picking the first entry
2599         in ARCHS and using that as a representative value.
2600
2601         * DerivedSources.make: When forming TARGET_TRIPLE_FLAGS, grab the
2602         first entry in ARCHS rather than use CURRENT_ARCH.
2603
2604 2018-10-11  Chris Dumez  <cdumez@apple.com>
2605
2606         Regression(PSON): Deal with the drawing area potentially being null under WebChromeClient::contentsSizeChanged()
2607         https://bugs.webkit.org/show_bug.cgi?id=190474
2608
2609         Reviewed by Geoffrey Garen.
2610
2611         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
2612         (WebKit::WebChromeClient::contentsSizeChanged const):
2613
2614 2018-10-11  Alejandro G. Castro  <alex@igalia.com>
2615
2616         [GTK][WPE] Add mediaDevices.enumerateDevices support
2617         https://bugs.webkit.org/show_bug.cgi?id=185761
2618
2619         Reviewed by Youenn Fablet.
2620
2621         Implemented the enumerateDevices API using a new WebKit class
2622         (DeviceIdHashSaltStorage) that generates and stores the device ids
2623         hash salts per origin, used to avoid fingerprinting in the
2624         webpages.
2625
2626         The patch also adds a new type of data for the WebsiteDataStore.
2627         That way the users can call the WebsiteDataStore to show what
2628         origins have hash salt generated and remove them at some point.
2629
2630         For the moment just GTK+ and WPE ports are using this class to
2631         generate the hash salts. The patch adds code to the
2632         checkUserMediaPermissionForOrigin API implementation, it was empty
2633         until now for these ports. In this function we create an instance
2634         of a new class WebKitDeviceInfoPermissionRequest that implements
2635         the WebKitPermissionRequestIface interface, that allows the ports
2636         to use the current permission managers implemented in the
2637         embedders to handle this new kind of request the way they like
2638         it. The default implementation is deny.
2639
2640         The class WebKitDeviceInfoPermissionRequest takes care of
2641         contacting the DeviceIdHashSaltStorage and request/regenerate the
2642         hash salts accordingly.
2643
2644         Persistency is still not implemented, we will add it in a
2645         future patch.
2646
2647         * Shared/WebsiteData/WebsiteDataType.h: Added the new type of
2648         webside data: DeviceIdHashSalt.
2649         * Sources.txt: Added new files to compilation.
2650         * SourcesGTK.txt: Ditto.
2651         * SourcesWPE.txt: Ditto.
2652         * UIProcess/API/glib/WebKitDeviceInfoPermissionRequest.cpp: Added
2653         this class to represent a request of permission to access the
2654         devices information. This is specific for glib ports and implements
2655         the policies regarding the hash salts when the embedder allows or
2656         denies the access using the DeviceIdHashSaltStorage class.
2657         (webkitDeviceInfoPermissionRequestAllow): Get the device hash salt
2658         when the origin is allowed and set it in the original request.
2659         (webkitDeviceInfoPermissionRequestDeny): Regenerate the device id
2660         hash salt when the user does not allow to access the device information.
2661         (webkit_permission_request_interface_init):
2662         (webkitDeviceInfoPermissionRequestDispose):
2663         (webkit_device_info_permission_request_class_init):
2664         (webkitDeviceInfoPermissionRequestCreate): Create the class using
2665         the proxy request from the webprocess and a reference to the
2666         DeviceIdHashSaltStorage.
2667         * UIProcess/API/glib/WebKitDeviceInfoPermissionRequestPrivate.h:
2668         Ditto.
2669         * UIProcess/API/glib/WebKitUIClient.cpp: Added the implementation
2670         for the checkUserMediaPermissionForOrigin API for the glib ports,
2671         it creates the device info request and calls the permission
2672         request API.
2673         * UIProcess/API/glib/WebKitWebsiteData.cpp:
2674         (recordContainsSupportedDataTypes): Added the DeviceIdHashSalt
2675         type.
2676         (toWebKitWebsiteDataTypes): Added the conversion from the WebKit
2677         types to the glib types for the WebsiteDataType::DeviceIdHashSalt.
2678         * UIProcess/API/glib/WebKitWebsiteDataManager.cpp:
2679         (toWebsiteDataTypes): Added the conversion from the glib type
2680         WEBKIT_WEBSITE_DATA_DEVICE_ID_HASH_SALT to the WebKit type.
2681         (webkit_website_data_manager_remove): Make sure we remote the
2682         DeviceIdHashSalt if the Cookies are selected.
2683         * UIProcess/API/gtk/WebKitDeviceInfoPermissionRequest.h: Added
2684         this new class that represents a permission request for the device
2685         information in the GTK+ port.
2686         * UIProcess/API/gtk/WebKitWebsiteData.h: Added the new type of
2687         website that in the GTK+ port:
2688         WEBKIT_WEBSITE_DATA_DEVICE_ID_HASH_SALT.
2689         * UIProcess/API/wpe/WebKitDeviceInfoPermissionRequest.h: Added
2690         this new class that represents a permission request for the device
2691         information in the WPE port.
2692         * UIProcess/API/wpe/WebKitWebsiteData.h: Added the new type of
2693         website that in the WPE port:
2694         WEBKIT_WEBSITE_DATA_DEVICE_ID_HASH_SALT.
2695         * UIProcess/DeviceIdHashSaltStorage.cpp: Added this new class that
2696         handles how to generate and store the hash salts inside
2697         WebKit. Persistency is still not implemented, we will add it in a
2698         future patch.
2699         (WebKit::DeviceIdHashSaltStorage::create):
2700         (WebKit::DeviceIdHashSaltStorage::deviceIdentifierHashSaltForOrigin):
2701         Check the map to get the hash salt for an origin, if there is none
2702         create a new random one.
2703         (WebKit::DeviceIdHashSaltStorage::regenerateDeviceIdentifierHashSaltForOrigin):
2704         Delete the hash salt of an origin if it already exists and create a new one.
2705         (WebKit::DeviceIdHashSaltStorage::getDeviceIdHashSaltOrigins):
2706         Returns the list of origins that have a hash salt generated for
2707         them. It is used in the WebsiteDataStore.
2708         (WebKit::DeviceIdHashSaltStorage::deleteDeviceIdHashSaltForOrigins):
2709         Deletes the hash salts in the map for an origin.
2710         (WebKit::DeviceIdHashSaltStorage::deleteDeviceIdHashSaltOriginsModifiedSince):
2711         Delete the origins that have not been modified since a time.
2712         * UIProcess/DeviceIdHashSaltStorage.h: Ditto.
2713         * UIProcess/UserMediaPermissionCheckProxy.h: Remove uneeded class
2714         definition.
2715         * UIProcess/WebsiteData/WebsiteDataStore.cpp: Added support to
2716         return and remove the origins with a generate hash salt used to
2717         generate the device ids.
2718         (WebKit::WebsiteDataStore::WebsiteDataStore): Added the new
2719         reference to the DeviceIdHashSaltStorage class, used to handle the
2720         hash salts.
2721         (WebKit::WebsiteDataStore::fetchDataAndApply): Get the list of
2722         origins with a hash salts in the DeviceIdHashSaltStorage.
2723         (WebKit::WebsiteDataStore::removeData): Remove the hash salts in
2724         DeviceIdHashSaltStorage for an origin.
2725         * UIProcess/WebsiteData/WebsiteDataStore.h: Ditto.
2726         (WebKit::WebsiteDataStore::deviceIdHashSaltStorage):
2727         * WebKit.xcodeproj/project.pbxproj: Added the
2728         DeviceIdHashSaltStorage to the compilation.
2729
2730 2018-10-10  Tim Horton  <timothy_horton@apple.com>
2731
2732         Safari crashes when attempting to share a YouTube video while in full-screen
2733         https://bugs.webkit.org/show_bug.cgi?id=190456
2734         <rdar://problem/45130748>
2735
2736         Reviewed by Wenson Hsieh.
2737
2738         * Platform/spi/ios/UIKitSPI.h:
2739         * UIProcess/Cocoa/WKShareSheet.mm:
2740         (-[WKShareSheet presentWithParameters:completionHandler:]):
2741         Allow the share sheet to present centered, since we don't have enough
2742         context to put it in a more sensible place.
2743
2744 2018-10-10  Tim Horton  <timothy_horton@apple.com>
2745
2746         REGRESSION (r236935): Layout test fast/events/ios/keyboard-scrolling-distance.html is timing out
2747         https://bugs.webkit.org/show_bug.cgi?id=190444
2748         <rdar://problem/45110698>
2749
2750         Reviewed by Simon Fraser.
2751
2752         There's a race in WKKeyboardScrollingAnimator that's exacerbated by HIDEventGenerator
2753         being much faster than a human finger. We get our "begin" events from interpretKeyEvent,
2754         after the Web Content process has had its way with it, but currently the
2755         back-channel "handle" events (e.g. for key up, which doesn't go to interpretKeyEvent)
2756         are retrieved from handleKeyWebEvent in the UI process, which is *before*
2757         the Web Content process has had a swing at it.
2758
2759         If you lose the race (an insanely short tap like you get from HIDEventGenerator,
2760         or with a very busy Web Content process), we see handle(keyDown), handle(keyUp), begin(keyDown),
2761         and get stuck scrolling!
2762
2763         Instead, retrieve the out-of-band "handle" events from _didHandleKeyEvent,
2764         so that they're sensibly and strictly ordered with respect to the timing of interpretKeyEvent/"begin".
2765
2766         Also, hook up didFinishScrolling, so that UIScriptController's callbacks work correctly.
2767
2768         * UIProcess/API/Cocoa/WKWebViewInternal.h:
2769         * UIProcess/ios/WKContentViewInteraction.mm:
2770         (-[WKContentView handleKeyWebEvent:]):
2771         (-[WKContentView _didHandleKeyEvent:eventWasHandled:]):
2772         (-[WKContentView keyboardScrollViewAnimatorDidFinishScrolling:]):
2773         * UIProcess/ios/WKKeyboardScrollingAnimator.h:
2774         * UIProcess/ios/WKKeyboardScrollingAnimator.mm:
2775         (-[WKKeyboardScrollingAnimator handleKeyEvent:]):
2776         (-[WKKeyboardScrollingAnimator displayLinkFired:]):
2777         (-[WKKeyboardScrollViewAnimator setDelegate:]):
2778         (-[WKKeyboardScrollViewAnimator handleKeyEvent:]):
2779         (-[WKKeyboardScrollViewAnimator didFinishScrolling]):
2780
2781 2018-10-10  Tim Horton  <timothy_horton@apple.com>
2782
2783         Share more WKShareSheet code between macOS and iOS, and fix a few bugs
2784         https://bugs.webkit.org/show_bug.cgi?id=190420
2785
2786         Reviewed by Simon Fraser.
2787
2788         * UIProcess/API/Cocoa/WKWebView.mm:
2789         (-[WKWebView _resolutionForShareSheetImmediateCompletionForTesting]):
2790         (-[WKWebView _setShareSheetCompletesImmediatelyWithResolutionForTesting:]):
2791         (-[WKWebView _invokeShareSheetWithResolution:]): Deleted.
2792         Add a new mechanism to tell the share sheet up-front that it should
2793         immediately dismiss with a particular resolution, for testing.
2794         See the Tools ChangeLog for justification.
2795         We keep the bit on WKWebView instead of WKShareSheet so that it can be
2796         called prior to invoking the share sheet.
2797
2798         * UIProcess/API/Cocoa/WKWebViewInternal.h:
2799         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
2800         * UIProcess/Cocoa/WKShareSheet.h:
2801         * UIProcess/Cocoa/WKShareSheet.mm:
2802         (-[WKShareSheet initWithView:]):
2803         (-[WKShareSheet presentWithParameters:completionHandler:]):
2804         (-[WKShareSheet sharingServicePicker:didChooseSharingService:]):
2805         (-[WKShareSheet _didCompleteWithSuccess:]):
2806         (-[WKShareSheet dismiss]):
2807         (-[WKShareSheet dispatchDidDismiss]):
2808         (-[WKShareSheet initWithView:initWithView:]): Deleted.
2809         (-[WKShareSheet _dispatchDidDismiss]): Deleted.
2810         (-[WKShareSheet _cancel]): Deleted.
2811         (-[WKShareSheet _dismissDisplayAnimated:]): Deleted.
2812         (-[WKShareSheet _presentFullscreenViewController:animated:]): Deleted.
2813         (-[WKShareSheet invokeShareSheetWithResolution:]): Deleted.
2814         Reduce the number of extraneous members, methods, and #ifdefs.
2815         Try to share as much of WKShareSheet between the platforms as makes sense.
2816         The interface is now totally identical on the two platforms.
2817
2818         * UIProcess/Cocoa/WebViewImpl.mm:
2819         (WebKit::WebViewImpl::showShareSheet):
2820         * UIProcess/ios/WKContentViewInteraction.h:
2821         * UIProcess/ios/WKContentViewInteraction.mm:
2822         (-[WKContentView _showShareSheet:completionHandler:]):
2823         (-[WKContentView invokeShareSheetWithResolution:]): Deleted.
2824         Instead of silently failing (without even calling the completion handler!)
2825         if we try to present one share sheet on top of another, dismiss the first
2826         and present the new one. This is important because there are (separately
2827         filed) bugs on both platforms where the completion handler is not called;
2828         now, instead of a tab getting stuck forever, we'll reject the promise
2829         when another share takes place.
2830
2831 2018-10-10  Tim Horton  <timothy_horton@apple.com>
2832
2833         REGRESSION (r236678): Keyboard scrolling with arrow keys doesn't work on iOS
2834         https://bugs.webkit.org/show_bug.cgi?id=190433
2835         <rdar://problem/45111986>
2836
2837         Reviewed by Simon Fraser.
2838
2839         * UIProcess/ios/WKKeyboardScrollingAnimator.mm:
2840         (-[WKKeyboardScrollingAnimator keyboardScrollForEvent:]):
2841         (-[WKKeyboardScrollingAnimator beginWithEvent:]): Deleted.
2842         (-[WKKeyboardScrollViewAnimator beginWithEvent:]): Deleted.
2843         r236678 changes the characters in charactersIgnoringModifiers to match AppKit.
2844         We similarly need to update WKKeyboardScrollingAnimator's comparison.
2845
2846 2018-10-10  Yusuke Suzuki  <yusukesuzuki@slowstart.org>
2847
2848         [JSC] Rename createXXX to tryCreateXXX if it can return RefPtr
2849         https://bugs.webkit.org/show_bug.cgi?id=190429
2850
2851         Reviewed by Saam Barati.
2852
2853         Use `tryCreate` or new `create`. If we use new `create`, we can use Ref<> and remove null check.
2854
2855         * Shared/API/c/WKString.cpp:
2856         (WKStringCopyJSString):
2857         * WebProcess/Automation/WebAutomationSessionProxy.cpp:
2858         (WebKit::toJSValue):
2859         (WebKit::callPropertyFunction):
2860         (WebKit::WebAutomationSessionProxy::scriptObjectForFrame):
2861         (WebKit::WebAutomationSessionProxy::evaluateJavaScriptFunction):
2862         * WebProcess/Plugins/PDF/PDFPlugin.mm:
2863         (WebKit::PDFPlugin::runScriptsInPDFDocument):
2864
2865 2018-10-10  Chris Dumez  <cdumez@apple.com>
2866
2867         Regression(PSON): Assertion hit under WebPageProxy::didNavigateWithNavigationData()
2868         https://bugs.webkit.org/show_bug.cgi?id=190418
2869         <rdar://problem/45059769>
2870
2871         Reviewed by Geoffrey Garen.
2872
2873         When process swapping and "suspending" the previous WebProcess in a SuspendedPageProxy,
2874         we need to keep around the main frame's ID that still exists on in this process. This
2875         is needed so that we can re-create a UI-side WebFrameProxy for the WebFrame that exists
2876         in the WebProcess, if we ever swap back to this suspended process (see login in
2877         WebPageProxy::swapToWebProcess()).
2878
2879         The bug was that the main frame ID was stored on the WebPageProxy via m_mainFrameID instead of the
2880         SuspendedPageProxy. This means that m_mainFrameID would get overriden when navigating in the new
2881         WebProcess with the value 1 (because WebFrame identifiers start at 1 and are per-WebProcess).
2882         This would lead to us constructing a WebFrameProxy with the wrong frame identifier in
2883         WebPageProxy::swapToWebProcess(), which would override an existing unrelated WebFrame in the
2884         WebProcessProxy's HashMap of frames. This would lead to crashes later on as the WebFrame
2885         would not be associated to the WebPageProxy we expect.
2886
2887         * UIProcess/SuspendedPageProxy.cpp:
2888         (WebKit::SuspendedPageProxy::SuspendedPageProxy):
2889         * UIProcess/SuspendedPageProxy.h:
2890         (WebKit::SuspendedPageProxy::mainFrameID const):
2891         * UIProcess/WebPageProxy.cpp:
2892         (WebKit::WebPageProxy::maybeCreateSuspendedPage):
2893         (WebKit::WebPageProxy::swapToWebProcess):
2894         (WebKit::WebPageProxy::continueNavigationInNewProcess):
2895         (WebKit::WebPageProxy::didCreateMainFrame):
2896         * UIProcess/WebPageProxy.h:
2897         * UIProcess/WebProcessProxy.cpp:
2898         (WebKit::WebProcessProxy::suspendWebPageProxy):
2899         * UIProcess/WebProcessProxy.h:
2900
2901 2018-10-10  Antti Koivisto  <antti@apple.com>
2902
2903         Do domain prewarming for processes for new tabs
2904         https://bugs.webkit.org/show_bug.cgi?id=190425
2905
2906         Reviewed by Chris Dumez.
2907
2908         We currently only do domain prewarming for navigation process swaps.
2909
2910         * UIProcess/WebProcessPool.cpp:
2911         (WebKit::WebProcessPool::processForNavigationInternal):
2912
2913         Do domain prewarming when using an existing but so far unused process.
2914
2915         (WebKit::WebProcessPool::tryPrewarmWithDomainInformation):
2916
2917         Factor into a function.
2918
2919         * UIProcess/WebProcessPool.h:
2920         * WebProcess/WebPage/WebPage.cpp:
2921         (WebKit::WebPage::close):
2922
2923         This didn't usually get invoked.
2924
2925         (WebKit::WebPage::didReceivePolicyDecision):
2926         (WebKit::WebPage::didFinishLoad):
2927
2928         Update prewarm information when a top level load finishes.
2929
2930         * WebProcess/WebProcess.cpp:
2931         (WebKit::WebProcess::sendPrewarmInformation):
2932         * WebProcess/WebProcess.h:
2933
2934 2018-10-09  Antoine Quint  <graouts@apple.com>
2935
2936         Remove the frames() timing function
2937         https://bugs.webkit.org/show_bug.cgi?id=190034
2938         <rdar://problem/44827544>
2939
2940         Reviewed by Dean Jackson.
2941
2942         * Shared/WebCoreArgumentCoders.cpp:
2943         (IPC::ArgumentCoder<FramesTimingFunction>::encode): Deleted.
2944         (IPC::ArgumentCoder<FramesTimingFunction>::decode): Deleted.
2945         * Shared/WebCoreArgumentCoders.h:
2946         * WebProcess/WebPage/RemoteLayerTree/PlatformCAAnimationRemote.mm:
2947         (WebKit::PlatformCAAnimationRemote::Properties::encode const):
2948         (WebKit::PlatformCAAnimationRemote::Properties::decode):
2949
2950 2018-10-09  Youenn Fablet  <youenn@apple.com>
2951
2952         ASSERTION FAILED: m_cachesLocks.contains(sessionID) in WebKit::CacheStorageEngineConnection::dereference(PAL::SessionID, unsigned long long)
2953         https://bugs.webkit.org/show_bug.cgi?id=190373
2954         <rdar://problem/45106402>
2955
2956         Reviewed by Alex Christensen.
2957
2958         This assertion can be hit if:
2959         - WebProcess has a DOMCache
2960         - NetworkProcess crashes
2961         - WebProcess navigates and dereference DOMCache.
2962         Remove this assertion as it is hit when a test is using testRunner.terminateNetworkProcess().
2963
2964         * NetworkProcess/cache/CacheStorageEngineConnection.cpp:
2965         (WebKit::CacheStorageEngineConnection::dereference):
2966
2967 2018-10-09  Jer Noble  <jer.noble@apple.com>
2968
2969         Crash when closing WKWebView during enter fullscreen animation
2970         https://bugs.webkit.org/show_bug.cgi?id=190412
2971
2972         Reviewed by Brian Burg.
2973
2974         We need a valid _webView if, during -[NSWindow close], we catch a notification saying we failed to enter
2975         fullscreen and try to replace the placeholder with the actual _webView.
2976
2977         * UIProcess/mac/WKFullScreenWindowController.mm:
2978         (-[WKFullScreenWindowController close]):
2979
2980 2018-10-09  Alex Christensen  <achristensen@webkit.org>
2981
2982         REGRESSION(r231663) loading in hidden WKWebViews stalls because WebProcess is suspended
2983         https://bugs.webkit.org/show_bug.cgi?id=190417
2984         <rdar://problem/43391014>
2985
2986         Reviewed by Chris Dumez.
2987
2988         * UIProcess/Cocoa/NavigationState.mm:
2989         (WebKit::NavigationState::didChangeIsLoading):
2990         Revert r321663, but keep the change to TestWKWebView.mm because that made the tests more reliable.
2991
2992 2018-10-09  Chris Dumez  <cdumez@apple.com>
2993
2994         Allow behavior when the parent process IPC::Connection closes to be overridden by ChildProcess subclasses
2995         https://bugs.webkit.org/show_bug.cgi?id=190294
2996
2997         Reviewed by Geoffrey Garen.
2998
2999         Allow behavior when the parent process IPC::Connection closes to be overridden by ChildProcess subclasses.
3000         This will be useful to allow the NetworkProcess to not exit if it still has pending downloads.
3001
3002         * NetworkProcess/NetworkProcess.cpp:
3003         (WebKit::callExitSoon):
3004         (WebKit::NetworkProcess::initializeConnection):
3005         * NetworkProcess/NetworkProcess.h:
3006         * PluginProcess/PluginProcess.cpp:
3007         (WebKit::callExit):
3008         (WebKit::PluginProcess::initializeConnection):
3009         * PluginProcess/PluginProcess.h:
3010         * Shared/ChildProcess.cpp:
3011         (WebKit::ChildProcess::didClose):
3012         (WebKit::ChildProcess::initialize):
3013         (WebKit::callExitNow): Deleted.
3014         (WebKit::callExitSoon): Deleted.
3015         * Shared/ChildProcess.h:
3016         (WebKit::ChildProcess::shouldCallExitWhenConnectionIsClosed const): Deleted.
3017         * WebProcess/WebProcess.cpp:
3018         (WebKit::callExit):
3019         (WebKit::WebProcess::initializeConnection):
3020
3021 2018-10-09  Jer Noble  <jer.noble@apple.com>
3022
3023         WebDriver: thrown ObjC exception under -[WKFullScreenWindowController windowDidFailToEnterFullScreen:] when session is terminated
3024         https://bugs.webkit.org/show_bug.cgi?id=190098
3025         <rdar://problem/42822671>
3026
3027         Reviewed by Brian Burg.
3028
3029         Forcibly exit fullscreen in resetState(), while the VideoFullscreenManagerProxy is still valid.
3030
3031         * UIProcess/WebPageProxy.cpp:
3032         (WebKit::WebPageProxy::resetState):
3033
3034 2018-10-09  Daniel Bates  <dabates@apple.com>
3035
3036         [iOS] Ignore some deprecated declarations
3037         https://bugs.webkit.org/show_bug.cgi?id=190371
3038
3039         Reviewed by Dan Bernstein.
3040
3041         * UIProcess/ios/WKActionSheet.mm:
3042         (-[WKActionSheet init]):
3043         (-[WKActionSheet presentSheet:]):
3044         * UIProcess/ios/WKActionSheetAssistant.mm:
3045         (-[WKActionSheetAssistant presentSheet]):
3046         * UIProcess/ios/WKContentViewInteraction.mm:
3047         * UIProcess/ios/forms/WKFormSelectPicker.mm:
3048         (-[WKMultipleSelectPicker initWithView:]):
3049         * UIProcess/ios/forms/WKFormSelectPopover.mm:
3050         (-[WKSelectTableViewController initWithView:hasGroups:]):
3051
3052 2018-10-09  Claudio Saavedra  <csaavedra@igalia.com>
3053
3054         [WPE] Explicitly link against gmodule where used
3055         https://bugs.webkit.org/show_bug.cgi?id=190398
3056
3057         Reviewed by Michael Catanzaro.
3058
3059         * PlatformWPE.cmake:
3060
3061 2018-10-09  Chris Dumez  <cdumez@apple.com>
3062
3063         PSON: Doing a cross-site navigation via the URL bar does not swap process on iOS
3064         https://bugs.webkit.org/show_bug.cgi?id=190378
3065         <rdar://problem/45059466>
3066
3067         Reviewed by Geoffrey Garen.
3068
3069         Process swapping was sometimes not happening via URL bar navigation on iOS due to top-hit preloading,
3070         which would use a new WKWebView for the speculative load and rely on the _relatedWebView SPI to use
3071         the same WebContent process as the view currently on screen.
3072
3073         To address the issue, if the source URL is empty and the page has a related page, use the related
3074         page's URL as source URL when doing the process-swap decision.
3075
3076         * UIProcess/API/APIPageConfiguration.cpp:
3077         (API::PageConfiguration::relatedPage const):
3078         (API::PageConfiguration::relatedPage): Deleted.
3079         * UIProcess/API/APIPageConfiguration.h:
3080         * UIProcess/WebProcessPool.cpp:
3081         (WebKit::WebProcessPool::processForNavigationInternal):
3082
3083 2018-10-09  Andy Estes  <aestes@apple.com>
3084
3085         [iOS] Replace @"UIPreviewDataAttachmentListIsContentManaged" with a UIKit constant
3086         https://bugs.webkit.org/show_bug.cgi?id=190400
3087         <rdar://problem/35442879>
3088
3089         Reviewed by Wenson Hsieh.
3090
3091         Also fixed the iOS version check in WKContentViewInteraction.mm.
3092
3093         * Platform/spi/ios/UIKitSPI.h:
3094         * UIProcess/ios/WKContentViewInteraction.mm:
3095         (-[WKContentView _dataForPreviewItemController:atPosition:type:]):
3096
3097 2018-10-09  Tim Horton  <timothy_horton@apple.com>
3098
3099         REGRESSION (r232416): Can not scroll after swiping back on quoteunquoteapps.com
3100         https://bugs.webkit.org/show_bug.cgi?id=190377
3101         <rdar://problem/45108222>
3102
3103         Reviewed by Andy Estes.
3104
3105         Introduce the notion of 'pausing' to SnapshotRemovalTracker.
3106         Reimplement r232416 in terms of this: the SnapshotRemovalTracker
3107         starts out paused (not accepting events), and un-pauses when
3108         we get a provisional load or same-document navigation.
3109         This way, we don't lose the watchdog timer in cases where we get
3110         no provisional load, same-document navigation, or main frame load
3111         (which is the separate root cause for this bug -- this just papers
3112         over it with a timeout).
3113
3114         * UIProcess/Cocoa/ViewGestureController.cpp:
3115         (WebKit::ViewGestureController::didStartProvisionalLoadForMainFrame):
3116         (WebKit::ViewGestureController::didSameDocumentNavigationForMainFrame):
3117         Resume the snapshot removal tracker.
3118
3119         (WebKit::ViewGestureController::didReachMainFrameLoadTerminalState):
3120         If we didn't see a provisional load or same document navigation,
3121         but somehow got to the terminal load state, immediately remove the snapshot.
3122         
3123         (WebKit::ViewGestureController::SnapshotRemovalTracker::resume):
3124         (WebKit::ViewGestureController::SnapshotRemovalTracker::start):
3125         Start the SnapshotRemovalTracker out in the paused state; it will be
3126         resumed in the same places we previously would call the
3127         provisionalOrSameDocumentLoadCallback.
3128
3129         (WebKit::ViewGestureController::SnapshotRemovalTracker::stopWaitingForEvent):
3130         Ignore (but debug log) incoming events while paused.
3131
3132         * UIProcess/Cocoa/ViewGestureController.h:
3133         (WebKit::ViewGestureController::SnapshotRemovalTracker::pause):
3134         (WebKit::ViewGestureController::SnapshotRemovalTracker::isPaused const):
3135         Add the pausing bit.
3136
3137         * UIProcess/ios/ViewGestureControllerIOS.mm:
3138         (WebKit::ViewGestureController::endSwipeGesture):
3139         * UIProcess/mac/ViewGestureControllerMac.mm:
3140         (WebKit::ViewGestureController::endSwipeGesture):
3141         Remove m_provisionalOrSameDocumentLoadCallback.
3142
3143 2018-10-09  Antti Koivisto  <antti@apple.com>
3144
3145         Prewarm FontDatabase on process swap
3146         https://bugs.webkit.org/show_bug.cgi?id=190312
3147
3148         Reviewed by Chris Dumez.
3149
3150         Add mechanism for caching prewarm information per domain on UI process side. This information
3151         is then passed to newly initialized web processes that are being used for the same domain.
3152
3153         * UIProcess/WebPageProxy.h:
3154         * UIProcess/WebProcessPool.cpp:
3155         (WebKit::WebProcessPool::processForNavigationInternal):
3156
3157         Pass prewarm information on process swap to the new process.
3158
3159         (WebKit::WebProcessPool::didCollectPrewarmInformation):
3160
3161         UI process side cache.
3162
3163         * UIProcess/WebProcessPool.h:
3164         * UIProcess/WebProcessProxy.cpp:
3165         (WebKit::WebProcessProxy::didCollectPrewarmInformation):
3166         * UIProcess/WebProcessProxy.h:
3167         * UIProcess/WebProcessProxy.messages.in:
3168         * WebProcess/WebPage/WebPage.cpp:
3169         (WebKit::WebPage::close):
3170         (WebKit::WebPage::didReceivePolicyDecision):
3171
3172         Collect and cache prewarm information for the previous process on process swap.
3173
3174         * WebProcess/WebProcess.cpp:
3175         (WebKit::WebProcess::prewarmGlobally):
3176
3177         Renamed for clarity.
3178
3179         (WebKit::WebProcess::prewarmWithDomainInformation):
3180         (WebKit::WebProcess::sendPrewarmInformation):
3181         * WebProcess/WebProcess.h:
3182         * WebProcess/WebProcess.messages.in:
3183
3184 2018-10-08  Wenson Hsieh  <wenson_hsieh@apple.com>
3185
3186         [Cocoa] [WK2] Add support for text alignment and text lists in font attributes
3187         https://bugs.webkit.org/show_bug.cgi?id=190342
3188         <rdar://problem/44767118>
3189
3190         Reviewed by Tim Horton.
3191
3192         Add encoding and decoding for text alignment and text lists in FontAttributes.
3193
3194         * Shared/WebCoreArgumentCoders.cpp:
3195         (IPC::ArgumentCoder<FontAttributes>::encode):
3196         (IPC::ArgumentCoder<FontAttributes>::decode):
3197
3198 2018-10-08  Justin Fan  <justin_fan@apple.com>
3199
3200         WebGPU: Rename old WebGPU prototype to WebMetal
3201         https://bugs.webkit.org/show_bug.cgi?id=190325
3202         <rdar://problem/44990443>
3203
3204         Reviewed by Dean Jackson.
3205
3206         Rename WebGPU prototype files to WebMetal in preparation for implementing the new (Oct 2018) WebGPU interface.
3207
3208         * Configurations/FeatureDefines.xcconfig:
3209         * Shared/WebPreferences.yaml:
3210         * WebProcess/InjectedBundle/InjectedBundle.cpp:
3211         (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner):
3212
3213 2018-10-08  Wenson Hsieh  <wenson_hsieh@apple.com>
3214
3215         Followup to r236942: Make input type=color an internal feature
3216         https://bugs.webkit.org/show_bug.cgi?id=189162
3217
3218         Rubber-stamped by Dean Jackson.
3219
3220         I've learned from Dean that an internal feature is more suitable than an experimental feature in this scenario.
3221
3222         * Shared/WebPreferences.yaml:
3223
3224 2018-10-08  Aditya Keerthi  <akeerthi@apple.com>
3225
3226         Make <input type=color> a runtime enabled (on-by-default) feature
3227         https://bugs.webkit.org/show_bug.cgi?id=189162
3228
3229         Reviewed by Wenson Hsieh and Tim Horton.
3230
3231         * Configurations/FeatureDefines.xcconfig:
3232         * Shared/WebPreferences.yaml:
3233
3234         Add an experimental feature flag for input type=color.
3235
3236         * UIProcess/mac/WebColorPickerMac.mm:
3237         (-[WKPopoverColorWell webDelegate]):
3238         (-[WKPopoverColorWell setWebDelegate:]):
3239
3240 2018-10-08  Tim Horton  <timothy_horton@apple.com>
3241
3242         Try to fix the build
3243
3244         * UIProcess/ios/WKKeyboardScrollingAnimator.mm:
3245
3246 2018-10-08  Brian Burg  <bburg@apple.com>
3247
3248         [Mac] Web Automation: some keyboard interactions don't generate events, causing event simulation to stall
3249         https://bugs.webkit.org/show_bug.cgi?id=190316
3250         <rdar://problem/42833290>
3251
3252         Reviewed by Tim Horton.
3253
3254         Some users have reported that Cmd-A for Select All no longer works in safaridriver.
3255         Instead, this hangs the session. This happens because the WebAutomationSession class
3256         assumes that each call to simulateKeyboardInteraction causes keyboard events to be processed,
3257         but in corner cases like Cmd-A, some events that we simulate are swallowed by AppKit and
3258         never make it back to WebKit. Because the session never gets the "keyboard events flushed"
3259         callback, it assumes the interaction is still ongoing, and never returns, causing a hang.
3260
3261         This patch consists of two parts:
3262          - Add logging of important state changes and events when simulating user input.
3263          - Make code more robust when simulating key actions that generate no events on macOS.
3264
3265         This change progresses WPT test key_shortcuts.py::test_mod_a_and_backspace_deletes_all_text on Mac.
3266
3267         * Platform/Logging.h: Add a logging channel.
3268         * UIProcess/Automation/SimulatedInputDispatcher.cpp:
3269         (WebKit::SimulatedInputDispatcher::keyFrameTransitionDurationTimerFired):
3270         (WebKit::SimulatedInputDispatcher::transitionBetweenKeyFrames):
3271         (WebKit::SimulatedInputDispatcher::transitionInputSourceToState):
3272         (WebKit::SimulatedInputDispatcher::run):
3273         (WebKit::SimulatedInputDispatcher::finishDispatching):
3274         Add a bunch of logging so its easier to figure out where things get stuck.
3275
3276         * UIProcess/Automation/WebAutomationSession.cpp:
3277         (WebKit::WebAutomationSession::simulateKeyboardInteraction):
3278         In some cases, no keyboard events need to be processed for the simulated interaction.
3279         When that happens, early exit rather than waiting for keyboard events to be flushed.
3280
3281         * UIProcess/Automation/mac/WebAutomationSessionMac.mm:
3282         (WebKit::WebAutomationSession::sendSynthesizedEventsToPage): Logging.
3283         (WebKit::WebAutomationSession::platformSimulateKeyboardInteraction):
3284         On Mac, if you tap a character key while Command is held down, only a KeyDown event
3285         is forwarded to the first responder by AppKit, even if you send a KeyUp event too.
3286         In this case don't send an NSEvent since it won't ever be delivered back to WebKit.
3287
3288         * UIProcess/WebPageProxy.h:
3289         * UIProcess/WebPageProxy.cpp:
3290         (WebKit::WebPageProxy::isProcessingKeyboardEvents const): Expose this state for keyboard
3291         events too.
3292
3293 2018-10-08  Youenn Fablet  <youenn@apple.com>
3294
3295         NetworkCache::Storage should be WTF::DestructionThread::Main
3296         https://bugs.webkit.org/show_bug.cgi?id=190324
3297
3298         Reviewed by Alex Christensen.
3299
3300         Use WTF::DestructionThread::Main to make sure that Storage is destroyed in the main thread.
3301         Remove the code that was making sure that any ref was destroyed in the main thread.
3302
3303         * NetworkProcess/cache/CacheStorageEngineCaches.cpp: Make sure the completion handler is not null.
3304         * NetworkProcess/cache/NetworkCacheStorage.cpp:
3305         (WebKit::NetworkCache::Storage::TraverseOperation::TraverseOperation): Make it clear that a ref is taken.
3306         (WebKit::NetworkCache::Storage::Storage):
3307         (WebKit::NetworkCache::Storage::synchronize): Protect 'this' when dispatching back to the main thread.
3308         Move the code that was after dispatch before dispatch to allow moving protectedThis in the dispatch lambda.
3309         (WebKit::NetworkCache::Storage::remove):
3310         (WebKit::NetworkCache::Storage::traverse):
3311         (WebKit::NetworkCache::Storage::clear):
3312         (WebKit::NetworkCache::Storage::deleteOldVersions):
3313         * NetworkProcess/cache/NetworkCacheStorage.h:
3314
3315 2018-10-08  Tim Horton  <timothy_horton@apple.com>
3316
3317         Adjust keyboard scrolling animator to springy and semiphysical
3318         https://bugs.webkit.org/show_bug.cgi?id=190345
3319         <rdar://problem/43494393>
3320
3321         Reviewed by Simon Fraser.
3322
3323         Introduce WKKeyboardScrollViewAnimator, which wraps WKKeyboardScrollingAnimator
3324         and provides a reasonable set of default behaviors for UIScrollView.
3325         This is the first step on the way to WKKeyboardScrollingAnimator
3326         being platform- and toolkit-agnostic, and helps avoid adding a whole
3327         bunch of code to WKContentView.
3328
3329         Adopt UIKit's scroll-to-top animation curve for whole-document scrolls.
3330
3331         Adjust WKKeyboardScrollingAnimator's physics; it now simulates a spring
3332         attached to the page when decelerating. When a key is pressed, it applies
3333         a constant force to the page (up to some maximum velocity). When released,
3334         the spring causes the page to decelerate smoothly.
3335
3336         Add rubber-banding to keyboard scrolling, based on the same spring that
3337         decelerates the page.
3338
3339         Remove the initial bounce on keydown before starting the smooth scroll.
3340
3341         Remove arrow key commands from WKContentView; this avoids double-processing
3342         incoming arrow key events, makes the event stream make more sense, and was
3343         entirely unnecessary.
3344
3345         * Platform/spi/ios/UIKitSPI.h:
3346         Add a wide variety of useful SPI.
3347
3348         * UIProcess/API/Cocoa/WKWebView.mm:
3349         * UIProcess/API/Cocoa/WKWebViewInternal.h:
3350         Remove _scrollByContentOffset:animated: because it's only used by
3351         the keyboard scrolling mechanism.
3352
3353         Remove _arrowKey because we're removing the arrow key commands.
3354
3355         * UIProcess/ios/WKContentViewInteraction.h:
3356         * UIProcess/ios/WKContentViewInteraction.mm:
3357         (-[WKContentView setupInteraction]):
3358         Create a WKKeyboardScrollViewAnimator (which knows how to directly
3359         manipulate a UIScrollView) instead of a WKKeyboardScrollingAnimator
3360         (which requires its clients to implement everything in terms of an
3361         abstract interface.
3362
3363         (-[WKContentView scrollViewWillStartPanOrPinchGesture]):
3364         Inform the keyboard scrolling animator that the user is going to start
3365         an interactive gesture that needs control of the scroll view, so it
3366         can stop its current animated scroll.
3367
3368         (-[WKContentView canPerformActionForWebView:withSender:]):
3369         (-[WKContentView keyCommands]):
3370         (-[WKContentView _arrowKeyForWebView:]): Deleted.
3371         Remove arrow key commands.
3372
3373         (-[WKContentView keyboardScrollViewAnimator:distanceForIncrement:]):
3374         Scale from content to WKWebView coordinate space; the keyboard scrolling
3375         animator operates in WKWebView coordinates. This was broken before.
3376
3377         (-[WKContentView keyboardScrollViewAnimatorWillScroll:]):
3378         (-[WKContentView isScrollableForKeyboardScrollViewAnimator:]):
3379         (-[WKContentView isKeyboardScrollable]): Deleted.
3380         (-[WKContentView distanceForScrollingIncrement:]): Deleted.
3381         (-[WKContentView scrollByContentOffset:animated:]): Deleted.
3382         Reimplement these as keyboardScrollViewAnimator delegate methods.
3383
3384         * UIProcess/ios/WKKeyboardScrollingAnimator.h:
3385         Add WKKeyboardScrollViewAnimator, hide the interface for
3386         WKKeyboardScrollingAnimator itself in the implementation file.
3387
3388         * UIProcess/ios/WKKeyboardScrollingAnimator.mm:
3389         (-[WKKeyboardScrollingAnimator initWithScrollable:]):
3390         (-[WKKeyboardScrollingAnimator parameters]):
3391         (-[WKKeyboardScrollingAnimator invalidate]):
3392         (unitVector):
3393         Return a unit vector in the given direction.
3394
3395         (perpendicularAbsoluteUnitVector):
3396         Return a positive unit vector perpendicular to the axis of the given direction.
3397         Useful for multiplying with another vector to remove the component in the
3398         axis of the given direction.
3399
3400         (boxSide):
3401         Convert ScrollingDirection to WebCore::PhysicalBoxSide, for use with RectEdges.
3402
3403         (-[WKKeyboardScrollingAnimator keyboardScrollForEvent:]):
3404         Instead of just returning the desired increment, compute everything we'll need
3405         for the lifetime of the scroll (including the force applied, maximum
3406         velocity, etc.) and return them together.
3407
3408         (-[WKKeyboardScrollingAnimator beginWithEvent:]):
3409         Use the scrollable's native scroll-to-extent animation (e.g. UIScrollView's
3410         scroll-to-top curve) for whole-document scrolls.
3411
3412         Remove the first discrete scroll; start the smooth scroll immediately.
3413
3414         (-[WKKeyboardScrollingAnimator handleKeyEvent:]):
3415         (farthestPointInDirection):
3416         (-[WKKeyboardScrollingAnimator stopAnimatedScroll]):
3417         Stop the current scroll. Let the spring coast to its natural stopping
3418         point given the system's current energy, unless that stopping point is
3419         less than one increment from the starting point. In that case, we attach
3420         the spring to /that/ point and let it run.
3421
3422         (-[WKKeyboardScrollingAnimator startDisplayLinkIfNeeded]):
3423         (-[WKKeyboardScrollingAnimator stopDisplayLink]):
3424         (-[WKKeyboardScrollingAnimator willStartInteractiveScroll]):
3425         Immediately stop all motion if the user touches the screen to scroll
3426         or zoom with fingers.
3427
3428         (-[WKKeyboardScrollingAnimator displayLinkFired:]):
3429         Update the position of the scrollable based on the applied force and spring.
3430         See the comments in this function for more details.
3431
3432         (-[WKKeyboardScrollViewAnimator init]):
3433         (-[WKKeyboardScrollViewAnimator initWithScrollView:]):
3434         (-[WKKeyboardScrollViewAnimator dealloc]):
3435         (-[WKKeyboardScrollViewAnimator invalidate]):
3436         (-[WKKeyboardScrollViewAnimator setDelegate:]):
3437         (-[WKKeyboardScrollViewAnimator willStartInteractiveScroll]):
3438         (-[WKKeyboardScrollViewAnimator beginWithEvent:]):
3439         (-[WKKeyboardScrollViewAnimator handleKeyEvent:]):
3440         (-[WKKeyboardScrollViewAnimator isKeyboardScrollable]):
3441         (-[WKKeyboardScrollViewAnimator distanceForIncrement:]):
3442         (-[WKKeyboardScrollViewAnimator scrollToContentOffset:animated:]):
3443         (-[WKKeyboardScrollViewAnimator scrollWithScrollToExtentAnimationTo:]):
3444         (-[WKKeyboardScrollViewAnimator contentOffset]):
3445         (-[WKKeyboardScrollViewAnimator boundedContentOffset:]):
3446         (-[WKKeyboardScrollViewAnimator interactiveScrollVelocity]):
3447         (-[WKKeyboardScrollViewAnimator scrollableDirectionsFromOffset:]):
3448         (-[WKKeyboardScrollViewAnimator rubberbandableDirections]):
3449         Add WKKeyboardScrollViewAnimator, which wraps WKKeyboardScrollingAnimator
3450         and provides animated keyboard scrolling for a UIScrollView without much
3451         additional plumbing work. It contains reasonable default behaviors,
3452         with a few optional delegate methods for customization.
3453
3454         (-[WKKeyboardScrollingAnimator _scrollOffsetForEvent:]): Deleted.
3455         (-[WKKeyboardScrollingAnimator startAnimatedScroll]): Deleted.
3456
3457 2018-10-08  Jeremy Jones  <jeremyj@apple.com>
3458
3459         Remove dead code: VideoFullscreenModel::isVisible()
3460         https://bugs.webkit.org/show_bug.cgi?id=190356
3461
3462         Reviewed by Jon Lee.
3463
3464         Remove isVisible since it is no longer used.
3465
3466         * UIProcess/Cocoa/VideoFullscreenManagerProxy.h:
3467         * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm:
3468         (WebKit::VideoFullscreenModelContext::isVisible const): Deleted.
3469         (WebKit::VideoFullscreenManagerProxy::isVisible const): Deleted.
3470
3471 2018-10-08  Jeremy Jones  <jeremyj@apple.com>
3472
3473         Remove dead code: resetMediaState.
3474         https://bugs.webkit.org/show_bug.cgi?id=190355
3475
3476         Reviewed by Jon Lee.
3477
3478         Remove resetMediaState since it is no longer used.
3479
3480         * UIProcess/Cocoa/PlaybackSessionManagerProxy.h:
3481         * UIProcess/Cocoa/PlaybackSessionManagerProxy.messages.in:
3482         * UIProcess/Cocoa/PlaybackSessionManagerProxy.mm:
3483         (WebKit::PlaybackSessionManagerProxy::resetMediaState): Deleted.
3484         * WebProcess/cocoa/PlaybackSessionManager.h:
3485         * WebProcess/cocoa/PlaybackSessionManager.mm:
3486         (WebKit::PlaybackSessionInterfaceContext::resetMediaState): Deleted.
3487
3488 2018-10-08  Jeremy Jones  <jeremyj@apple.com>
3489
3490         Use MediaPlayerEnums::VideoGravity in VideoFullscreenModel.
3491         https://bugs.webkit.org/show_bug.cgi?id=190357
3492
3493         Reviewed by Jon Lee.
3494
3495         Use MediaPlayerEnums::VideoGravity instead of creating another identical enum in VideoFullscreenModel.
3496
3497         * UIProcess/Cocoa/VideoFullscreenManagerProxy.h:
3498         * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm:
3499         (WebKit::VideoFullscreenModelContext::setVideoLayerGravity):
3500         (WebKit::VideoFullscreenManagerProxy::setVideoLayerGravity):
3501         * WebProcess/cocoa/VideoFullscreenManager.mm:
3502         (WebKit::VideoFullscreenManager::setVideoLayerGravityEnum):
3503
3504 2018-10-08  Alex Christensen  <achristensen@webkit.org>
3505
3506         Remove WKBundleFileHandleRef
3507         https://bugs.webkit.org/show_bug.cgi?id=190360
3508
3509         Reviewed by Tim Horton.
3510
3511         WKBundleFrameGetJavaScriptWrapperForFileForWorld and WKBundleFileHandleCreateWithPath were only used in Mail
3512         and were removed in rdar://problem/44955158
3513         I need to remove them for rdar://problem/24576194
3514
3515         * Shared/API/APIObject.h:
3516         * Shared/API/c/WKDeprecated.h:
3517         * Shared/API/c/WKDeprecatedFunctions.cpp:
3518         (WKBundleFrameGetJavaScriptWrapperForFileForWorld):
3519         (WKBundleFileHandleCreateWithPath):
3520         * Sources.txt:
3521         * SourcesCocoa.txt:
3522         * WebKit.xcodeproj/project.pbxproj:
3523         * WebProcess/InjectedBundle/API/c/WKBundleAPICast.h:
3524         * WebProcess/InjectedBundle/API/c/WKBundleFileHandleRef.cpp: Removed.
3525         * WebProcess/InjectedBundle/API/c/WKBundleFileHandleRef.h:
3526         * WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp:
3527         (WKBundleFrameGetJavaScriptWrapperForFileForWorld): Deleted.
3528         * WebProcess/InjectedBundle/API/c/WKBundleFrame.h:
3529         * WebProcess/InjectedBundle/DOM/InjectedBundleFileHandle.cpp: Removed.
3530         * WebProcess/InjectedBundle/DOM/InjectedBundleFileHandle.h: Removed.
3531         * WebProcess/WebPage/WebFrame.cpp:
3532         * WebProcess/WebPage/WebFrame.h:
3533
3534 2018-10-08  Konstantin Tokarev  <annulen@yandex.ru>
3535
3536         Validation in Connection::readBytesFromSocket() is too aggressive
3537         https://bugs.webkit.org/show_bug.cgi?id=190281
3538
3539         Reviewed by Michael Catanzaro.
3540
3541         Since r217206 Connection::readBytesFromSocket() validates size of
3542         control message. However, it compares cmsg_len with attachmentMaxAmount,
3543         while Connection::sendOutgoingMessage() computes it as
3544         CMSG_LEN(sizeof(int) * attachmentFDBufferLength) where
3545         attachmentFDBufferLength <= attachmentMaxAmount. This mismatch between
3546         sender and receiver leads to possibility of assertion failure with large
3547         number of attachments, e.g. here 62 attachments have cmsg_length == 264.
3548
3549         * Platform/IPC/unix/ConnectionUnix.cpp:
3550         (IPC::readBytesFromSocket):
3551
3552 2018-10-08  Chris Dumez  <cdumez@apple.com>
3553
3554         Have DOMWindowProperty get is frame from its associated DOMWindow
3555         https://bugs.webkit.org/show_bug.cgi?id=190341
3556
3557         Reviewed by Alex Christensen.
3558
3559         * WebProcess/InjectedBundle/InjectedBundleDOMWindowExtension.cpp:
3560         (WebKit::InjectedBundleDOMWindowExtension::InjectedBundleDOMWindowExtension):
3561
3562 2018-10-07  Dan Bernstein  <mitz@apple.com>
3563
3564         Tried to fix HAVE(LINK_PREVIEW) iOS builds.
3565
3566         * UIProcess/WKImagePreviewViewController.mm:
3567         (-[WKImagePreviewViewController previewActions]):
3568
3569 2018-10-06  Dan Bernstein  <mitz@apple.com>
3570
3571         Tried to fix the macOS Mojave build.
3572
3573         * UIProcess/API/Cocoa/LegacyBundleForClass.mm:
3574
3575 2018-10-06  Dan Bernstein  <mitz@apple.com>
3576
3577         WebKit part of [Xcode] Update some build settings as recommended by Xcode 10
3578         https://bugs.webkit.org/show_bug.cgi?id=190250
3579
3580         Reviewed by Andy Estes.
3581
3582         * Configurations/Base.xcconfig: Enabled CLANG_WARN_COMMA,
3583           CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS, CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF, and
3584           CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED.
3585
3586         * WebKit.xcodeproj/project.pbxproj: Let Xcode update LastUpgradeCheck.
3587
3588         * UIProcess/API/Cocoa/WKBrowsingContextController.mm:
3589         * UIProcess/API/Cocoa/WKBrowsingContextGroup.mm:
3590         * UIProcess/API/Cocoa/WKConnection.mm:
3591         * UIProcess/API/Cocoa/WKNavigationData.mm:
3592         * UIProcess/API/Cocoa/WKProcessGroup.mm:
3593         * UIProcess/API/Cocoa/WKTypeRefWrapper.mm:
3594         * UIProcess/API/Cocoa/WKWebView.mm:
3595         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
3596         * UIProcess/API/Cocoa/_WKWebsiteDataStore.mm:
3597         * UIProcess/API/mac/WKView.mm:
3598         * WebProcess/Plugins/PDF/PDFPlugin.mm:
3599         * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectMac.mm:
3600
3601           Suppressed -Wdeprecated-implementations around some class, category and method
3602           implementations the above files.
3603
3604 2018-10-05  Alex Christensen  <achristensen@webkit.org>
3605
3606         REGRESSION(r236154) Page loads are not drawn when loaded in shipped Safari11/12
3607         https://bugs.webkit.org/show_bug.cgi?id=190202
3608
3609         Reviewed by Youenn Fablet.
3610
3611         Safari11/12 had a WKPageLoaderClient and a WKPageNavigationClient.
3612         It did not actually draw the page until its WKPageNavigationClient.renderingProgressDidChange was called.
3613         r236154 made it so we only call WKPageLoaderClient.didLayout if an application has both clients.
3614         This fixes open source WebKit running with shipped Safari.
3615
3616         * UIProcess/WebPageProxy.cpp:
3617         (WebKit::WebPageProxy::didReachLayoutMilestone):
3618
3619 2018-10-05  Chris Dumez  <cdumez@apple.com>
3620
3621         [PSON] Drop snapshotting workaround introduced in r235898
3622         https://bugs.webkit.org/show_bug.cgi?id=190314
3623
3624         Reviewed by Geoffrey Garen.
3625
3626         Drop snapshotting workaround introduced in r235898 as it is no longer needed now
3627         that the flashing bug has been fixed.
3628
3629         * UIProcess/WebPageProxy.cpp:
3630         (WebKit::WebPageProxy::continueNavigationInNewProcess):
3631
3632 2018-10-05  Eric Carlson  <eric.carlson@apple.com>
3633
3634         [MediaStream] RealtimeMediaSource should be able to vend hashed IDs
3635         https://bugs.webkit.org/show_bug.cgi?id=190142
3636         <rdar://problem/44911109>
3637
3638         Reviewed by Youenn Fablet.
3639
3640         * Shared/WebCoreArgumentCoders.cpp:
3641         (IPC::ArgumentCoder<MediaConstraints>::encode):
3642         (IPC::ArgumentCoder<MediaConstraints>::decode):
3643         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp:
3644         (WebKit::UserMediaCaptureManagerProxy::createMediaSourceForCaptureDeviceWithConstraints):
3645         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.h:
3646         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.messages.in:
3647         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
3648         (WebKit::UserMediaPermissionRequestManagerProxy::requestUserMediaPermissionForFrame):
3649         * WebProcess/cocoa/UserMediaCaptureManager.cpp:
3650         (WebKit::UserMediaCaptureManager::Source::Source):
3651         (WebKit::UserMediaCaptureManager::createCaptureSource):
3652         * WebProcess/cocoa/UserMediaCaptureManager.h:
3653
3654 2018-10-03  Jer Noble  <jer.noble@apple.com>
3655
3656         Add support for reporting "display composited video frames" through the VideoPlaybackQuality object.
3657         https://bugs.webkit.org/show_bug.cgi?id=190266
3658
3659         Reviewed by Eric Carlson.
3660
3661         Add a new preference to control the visibility of displayCompositedVideoFrames in the VideoPlaybackQualityObject.
3662
3663         * Shared/WebPreferences.yaml:
3664         * UIProcess/API/Cocoa/WKPreferences.mm:
3665         (-[WKPreferences _setVideoQualityIncludesDisplayCompositingEnabled:]):
3666         (-[WKPreferences _videoQualityIncludesDisplayCompositingEnabled]):
3667         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
3668
3669 2018-10-05  Ryan Haddad  <ryanhaddad@apple.com>
3670
3671         Unreviewed, rolling out r236866.
3672
3673         Breaks internal builds.
3674
3675         Reverted changeset:
3676
3677         "Add support for reporting "display composited video frames"
3678         through the VideoPlaybackQuality object."
3679         https://bugs.webkit.org/show_bug.cgi?id=190266
3680         https://trac.webkit.org/changeset/236866
3681
3682 2018-10-05  Zach Li  <zachli@apple.com>
3683
3684         Expose whether WKWebProcessPlugInNodeHandle is a select element to clients
3685         https://bugs.webkit.org/show_bug.cgi?id=190302
3686         <rdar://problem/45031469>
3687
3688         Reviewed by Tim Horton.
3689
3690         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandle.h:
3691         Introduce a new property `isSelectElement`.
3692         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandle.mm:
3693         (-[WKWebProcessPlugInNodeHandle isSelectElement]):
3694         * WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp:
3695         (WebKit::InjectedBundleNodeHandle::isSelectElement const):
3696         Check whether the node is a select element.
3697         * WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.h:
3698
3699 2018-10-04  Wenson Hsieh  <wenson_hsieh@apple.com>
3700
3701         [iOS] [WK2] Expose some more editing SPI on WKWebView
3702         https://bugs.webkit.org/show_bug.cgi?id=190232
3703         <rdar://problem/44963368>
3704
3705         Reviewed by Tim Horton.
3706
3707         Exposes a few additional editing commands as SPI on WKWebView, by defining a new extension on WKWebView that
3708         also conforms to <UIResponderStandardEditActions>. This patch implements nearly all of the remaining
3709         unimplemented methods on UIResponderStandardEditActions, and the new extension augments this set of editing
3710         methods by adding additional editing helpers that don't currently exist on iOS (e.g. toggleStrikeThrough and
3711         insertUnorderedList). The names of these new methods have been largely been borrowed from their counterparts on
3712         macOS (see: `NSResponder.h`).
3713
3714         The new edit actions are added in this patch on iOS are:
3715
3716         ```
3717         - (void)alignCenter:(id)sender;
3718         - (void)alignJustified:(id)sender;
3719         - (void)alignLeft:(id)sender;
3720         - (void)alignRight:(id)sender;
3721         - (void)indent:(id)sender;
3722         - (void)insertOrderedList:(id)sender;
3723         - (void)insertUnorderedList:(id)sender;
3724         - (void)outdent:(id)sender;
3725         - (void)toggleStrikeThrough:(id)sender;
3726         - (void)setFont:(UIFont *)font sender:(id)sender;
3727         - (void)setFontSize:(CGFloat)fontSize sender:(id)sender;
3728         - (void)setTextColor:(UIColor *)color sender:(id)sender;
3729         ```
3730
3731         Tests:  WKWebViewEditActions.ListInsertion
3732                 WKWebViewEditActions.ChangeIndentation
3733                 WKWebViewEditActions.SetAlignment
3734                 WKWebViewEditActions.ToggleStrikeThrough
3735                 WKWebViewEditActions.ChangeFontSize
3736                 WKWebViewEditActions.SetTextColor
3737                 WKWebViewEditActions.SetFontFamily
3738
3739         * Platform/spi/ios/UIKitSPI.h:
3740         * UIProcess/API/Cocoa/WKWebView.mm:
3741         (-[WKWebView canPerformAction:withSender:]):
3742
3743         Update this to handle the new editing actions. For now, we simply treat all of the new edit actions in the same
3744         way as we currently treat bold, italic and underline: that is, they are enabled only when the user is in a
3745         richly contenteditable element.
3746
3747         (-[WKWebView setFont:sender:]):
3748         (-[WKWebView setFontSize:sender:]):
3749
3750         Construct and send a set of FontChanges.
3751
3752         (-[WKWebView setTextColor:sender:]):
3753
3754         Invoke "ForeColor" with the serialized color representation. This allows us to handle `rgba()` color values,
3755         which hex format would not permit.
3756
3757         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
3758
3759         Add the new SPI.
3760
3761         * UIProcess/WebPageProxy.cpp:
3762         (WebKit::WebPageProxy::changeFontAttributes):
3763         (WebKit::WebPageProxy::changeFont):
3764
3765         Pull logic for applying font and font attribute style changes out of macOS-specific code, and into
3766         platform-agnostic code in WebPage and WebPageProxy.
3767
3768         * UIProcess/WebPageProxy.h:
3769         * UIProcess/ios/WKContentViewInteraction.h:
3770
3771         Add the new supported editing commands as supported actions in WKWebView. The only new editing commands that
3772         aren't present in this list are -setFont:sender:, -setColor:sender:, and -setFontSize:sender: which are manually
3773         handled in places where the `FOR_EACH_WKCONTENTVIEW_ACTION` macro is otherwise used. In a followup, we could
3774         consider augmenting `FOR_EACH_WKCONTENTVIEW_ACTION` to handle actions with multiple arguments.
3775
3776         * UIProcess/ios/WKContentViewInteraction.mm:
3777
3778         Define a new helper macro here to define boilerplate implementations of the -…ForWebView edit command
3779         implementations that turn around and invoke `_page->executeEditCommand` with no additional arguments, and an
3780         edit command name matching that of the WebCore edit command.
3781
3782         (-[WKContentView toggleStrikeThroughForWebView:]):
3783         (-[WKContentView increaseSizeForWebView:]):
3784         (-[WKContentView decreaseSizeForWebView:]):
3785         (-[WKContentView setFontForWebView:sender:]):
3786         (-[WKContentView setFontSizeForWebView:sender:]):
3787         (-[WKContentView setTextColorForWebView:sender:]):
3788         (-[WKContentView canPerformActionForWebView:sender:]):
3789
3790         Add …ForWebView plumbing for the new editing actions, so they turn around and call into WKContentView by
3791         default, but behavior may be overridden in WKWebView.
3792
3793         * UIProcess/mac/WebPageProxyMac.mm:
3794         (WebKit::WebPageProxy::changeFontAttributes): Deleted.
3795         (WebKit::WebPageProxy::changeFont): Deleted.
3796         * WebProcess/WebPage/WebPage.cpp:
3797         (WebKit::WebPage::changeFontAttributes):
3798         (WebKit::WebPage::changeFont):
3799         * WebProcess/WebPage/WebPage.h:
3800         * WebProcess/WebPage/WebPage.messages.in:
3801         * WebProcess/WebPage/mac/WebPageMac.mm:
3802         (WebKit::WebPage::changeFontAttributes): Deleted.
3803         (WebKit::WebPage::changeFont): Deleted.
3804
3805 2018-10-04  Jer Noble  <jer.noble@apple.com>
3806
3807         Add support for reporting "display composited video frames" through the VideoPlaybackQuality object.
3808         https://bugs.webkit.org/show_bug.cgi?id=190266
3809
3810         Reviewed by Eric Carlson.
3811
3812         Add a new preference to control the visibility of displayCompositedVideoFrames in the VideoPlaybackQualityObject.
3813
3814         * Shared/WebPreferences.yaml:
3815         * UIProcess/API/Cocoa/WKPreferences.mm:
3816         (-[WKPreferences _setVideoQualityIncludesDisplayCompositingEnabled:]):
3817         (-[WKPreferences _videoQualityIncludesDisplayCompositingEnabled]):
3818         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
3819
3820 2018-10-04  Wenson Hsieh  <wenson_hsieh@apple.com>
3821
3822         [Cocoa] Add SPI to expose typing attributes at the current selection on WKWebView
3823         https://bugs.webkit.org/show_bug.cgi?id=190119
3824         <rdar://problem/44767062>
3825
3826         Reviewed by Tim Horton.
3827
3828         Add support for new WebKit2 SPI to notify the UI delegate about font attributes when the editor state changes
3829         (e.g. due to selection changes, or executing an edit command). See below for more detail.
3830
3831         Test: FontAttributes.FontAttributesAfterChangingSelection
3832
3833         * Shared/EditorState.cpp:
3834         (WebKit::EditorState::PostLayoutData::encode const):
3835         (WebKit::EditorState::PostLayoutData::decode):
3836         * Shared/EditorState.h:
3837
3838         Add a new optional `FontAttributes` member to EditorState's post-layout data. FontAttributes are computed and
3839         sent over IPC only if the UI delegate implements the new delegate hook which requires information about font
3840         attributes.
3841
3842         * Shared/WebPageCreationParameters.cpp:
3843         (WebKit::WebPageCreationParameters::encode const):
3844         (WebKit::WebPageCreationParameters::decode):
3845         * Shared/WebPageCreationParameters.h:
3846
3847         Add a new flag for the UI process to let a new web page know whether it should additionally compute font
3848         attributes when computing editor state.
3849
3850         * UIProcess/API/APIUIClient.h:
3851         (API::UIClient::needsFontAttributes const):
3852         (API::UIClient::didChangeFontAttributes):
3853         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
3854         * UIProcess/API/Cocoa/WKWebView.mm:
3855         (-[WKWebView _didChangeEditorState]):
3856         * UIProcess/Cocoa/UIDelegate.h:
3857         * UIProcess/Cocoa/UIDelegate.mm:
3858         (WebKit::UIDelegate::setDelegate):
3859         (WebKit::UIDelegate::UIClient::didChangeFontAttributes):
3860
3861         Call out to the UI delegate with a font attribute dictionary, created via FontAttributes on EditorState's
3862         post-layout data.
3863
3864         * UIProcess/WebPageProxy.cpp:
3865         (WebKit::WebPageProxy::setUIClient):
3866
3867         Update whether or not the UI process needs to know about font attributes. The UI process only requires font
3868         attribute information if the UI delegate implements `-_webView:didChangeFontAttributes:`.
3869
3870         (WebKit::WebPageProxy::setNeedsFontAttributes):
3871         (WebKit::WebPageProxy::creationParameters):
3872         * UIProcess/WebPageProxy.h:
3873         * UIProcess/ios/WebPageProxyIOS.mm:
3874         (WebKit::WebPageProxy::editorStateChanged):
3875         * UIProcess/mac/WebPageProxyMac.mm:
3876         (WebKit::WebPageProxy::editorStateChanged):
3877
3878         Update the cached font attributes in the UI process when receiving a new editor state update.
3879
3880         * WebProcess/WebPage/WebPage.cpp:
3881         (WebKit::m_cpuLimit):
3882         (WebKit::WebPage::editorState const):
3883         (WebKit::WebPage::setNeedsFontAttributes):
3884
3885         Add a new IPC hook to update whether or not the page should additionally compute font attributes. In the case
3886         where the UI delegate changes from something that does not require font attributes to one that does, we
3887         additionally schedule an editor state update.
3888
3889         (WebKit::WebPage::updateFontAttributesAfterEditorStateChange):
3890
3891         Private helper function to plumb FontAttributes to the UI client after an editor state change.
3892
3893         * WebProcess/WebPage/WebPage.h:
3894         * WebProcess/WebPage/WebPage.messages.in:
3895
3896 2018-10-04  Jeremy Jones  <jeremyj@apple.com>
3897
3898         Unify implementation in VideoFullscreenInterfaceAVKit
3899         https://bugs.webkit.org/show_bug.cgi?id=190091
3900         rdar://problem/44734523
3901
3902         Reviewed by Jer Noble.
3903
3904         Unified code in VideoFullscreenInterfaceAVKit now that new code path is proven and include
3905         any changes that had been made in the old path.
3906
3907         * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm:
3908         * WebProcess/cocoa/VideoFullscreenManager.mm:
3909         (WebKit::VideoFullscreenManager::supportsVideoFullscreenStandby const):
3910         (WebKit::VideoFullscreenManager::didSetupFullscreen):
3911         (WebKit::VideoFullscreenManager::didExitFullscreen):
3912
3913 2018-10-04  Matt Lewis  <jlewis3@apple.com>
3914
3915         Unreviewed, rolling out r236730.
3916
3917         This caused a consistent crash in test http/tests/media/media-
3918         stream/get-display-media-prompt.html.
3919
3920         Reverted changeset:
3921
3922         "[MediaStream] RealtimeMediaSource should be able to vend
3923         hashed IDs"
3924         https://bugs.webkit.org/show_bug.cgi?id=190142
3925         https://trac.webkit.org/changeset/236730
3926
3927 2018-10-04  Brian Burg  <bburg@apple.com>
3928
3929         Web Automation: clear pending callbacks when the session terminates
3930         https://bugs.webkit.org/show_bug.cgi?id=190259
3931         <rdar://problem/44958352>
3932
3933         Reviewed by Joseph Pecoraro.
3934
3935         WebAutomationSession::terminate() can be called at any time to nuke the session.
3936         However, it's possible that the session is in the midst of simulating keyboard/mouse
3937         events. While in that state, there are some CompletionHandler objects waiting
3938         for key/mouse events to be flushed. We need to empty out callback maps with
3939         CompletionHandler instances so that they do not assert because they were never called.
3940
3941         I was able to test this manually by running a test that erroneously hangs
3942         while waiting for keyboard input. While the test was hung, I killed the NetworkProcess
3943         manually to trigger WebAutomationSession::terminate(). From there, I saw that the
3944         Perform Actions REST API call gets cancelled with the appropriate error code.
3945
3946         * UIProcess/Automation/WebAutomationSession.cpp:
3947         (WebKit::WebAutomationSession::terminate):
3948
3949 2018-10-04  Jiewen Tan  <jiewen_tan@apple.com>
3950
3951         [WebAuthN] Move time out control from WebProcess to UIProcess
3952         https://bugs.webkit.org/show_bug.cgi?id=189642
3953         <rdar://problem/44476765>
3954
3955         Reviewed by Chris Dumez.
3956
3957         Besides adding a time out timer in the AuthenticatorManager, this patch also adds a new
3958         option in MockWebAuthenticationConfiguration to turn on silent failure which is the
3959         default policy of treating authenticators' error as suggested by spec.
3960
3961         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
3962         (WKWebsiteDataStoreSetWebAuthenticationMockConfiguration):
3963         * UIProcess/WebAuthentication/AuthenticatorManager.cpp:
3964         (WebKit::AuthenticatorManagerInternal::collectTransports):
3965         (WebKit::AuthenticatorManager::makeCredential):
3966         (WebKit::AuthenticatorManager::getAssertion):
3967         (WebKit::AuthenticatorManager::respondReceived):
3968         (WebKit::AuthenticatorManager::initTimeOutTimer):
3969         * UIProcess/WebAuthentication/AuthenticatorManager.h:
3970         (WebKit::AuthenticatorManager::requestTimeOutTimer):
3971         * UIProcess/WebAuthentication/Mock/MockAuthenticatorManager.cpp:
3972         (WebKit::MockAuthenticatorManager::respondReceivedInternal):
3973         * UIProcess/WebAuthentication/Mock/MockWebAuthenticationConfiguration.h:
3974
3975 2018-10-04  Yuhan Wu  <yuhan_wu@apple.com>
3976
3977         runtime flag and IDL for MediaRecorder
3978         https://bugs.webkit.org/show_bug.cgi?id=190018
3979
3980         Reviewed by Youenn Fablet and Chris Dumez.
3981
3982         * Shared/WebPreferences.yaml:
3983
3984 2018-10-03  Dan Bernstein  <mitz@apple.com>
3985
3986         Tried to fix non-Cocoa, ENABLE(ATTACHMENT_ELEMENT) builds after r236822.
3987
3988         * UIProcess/PageClient.h:
3989
3990 2018-10-03  Dan Bernstein  <mitz@apple.com>
3991
3992         [Cocoa] Let clients specify an NSFileWrapper subclassed to be used for _WKAttachment
3993         https://bugs.webkit.org/show_bug.cgi?id=190270
3994
3995         Reviewed by Wenson Hsieh.
3996
3997         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
3998         (-[WKWebViewConfiguration copyWithZone:]): Copy new _attachmentFileWrapperClass ivar.
3999         (-[WKWebViewConfiguration _attachmentFileWrapperClass]): Added this getter.
4000         (-[WKWebViewConfiguration _setAttachmentFileWrapperClass:]): Added this setter, which raises
4001           an exception if the argument is not an NSFileWrapper subclass.
4002
4003         * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h: Declared new property.
4004
4005         * UIProcess/Cocoa/PageClientImplCocoa.h:
4006         * UIProcess/Cocoa/PageClientImplCocoa.mm:
4007         (WebKit::PageClientImplCocoa::allocFileWrapperInstance): Added. Allocates an instance of
4008           the class specified in the configuration, or NSFileWrapper if no custom class is specified.
4009
4010         * UIProcess/Cocoa/WebPagePr