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