Add SPI version of WKPreferences.safeBrowsingEnabled
[WebKit-https.git] / Source / WebKit / ChangeLog
1 2019-02-15  Alex Christensen  <achristensen@webkit.org>
2
3         Add SPI version of WKPreferences.safeBrowsingEnabled
4         https://bugs.webkit.org/show_bug.cgi?id=194718
5         <rdar://problem/48122993>
6
7         Rubber-stamped by Brady Eidson.
8
9         * UIProcess/API/Cocoa/WKPreferences.mm:
10         (-[WKPreferences _isSafeBrowsingEnabled]):
11         (-[WKPreferences _setSafeBrowsingEnabled:]):
12         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
13
14 2019-02-15  Wenson Hsieh  <wenson_hsieh@apple.com>
15
16         [iOS] WKWebView callout bar is missing Change Writing Direction item
17         https://bugs.webkit.org/show_bug.cgi?id=190015
18         <rdar://problem/44810366>
19
20         Reviewed by Tim Horton.
21
22         Support -makeTextWritingDirectionLeftToRight: and -makeTextWritingDirectionRightToLeft: in WKWebView on iOS.
23         To match behavior in native UITextViews on iOS, we implement these methods by changing the *base* writing
24         direction, rather than the text writing direction (this is in contrast to macOS, which has different
25         NSResponder methods for changing the base writing direction as opposed to the text writing direction).
26
27         Additionally fixes the implementation of -makeTextWritingDirectionNatural:, which currently attempts to change
28         the text writing direction instead of the base writing direction.
29
30         * Platform/spi/ios/UIKitSPI.h:
31
32         Add a forward declaration for keyboards SPI to determine whether the user has an active RTL keyboard.
33
34         * Shared/EditorState.cpp:
35         (WebKit::EditorState::PostLayoutData::encode const):
36         (WebKit::EditorState::PostLayoutData::decode):
37         (WebKit::operator<<):
38         * Shared/EditorState.h:
39
40         Plumb the base writing direction to the UI process through EditorState.
41
42         * UIProcess/ios/WKContentViewInteraction.h:
43         * UIProcess/ios/WKContentViewInteraction.mm:
44         (-[WKContentView makeTextWritingDirectionNaturalForWebView:]):
45         (-[WKContentView makeTextWritingDirectionLeftToRightForWebView:]):
46         (-[WKContentView makeTextWritingDirectionRightToLeftForWebView:]):
47
48         Implement the new SPI (see above for more details).
49
50         (-[WKContentView canPerformActionForWebView:withSender:]):
51
52         Implement -canPerformAction: for LTR and RTL actions. To match existing UIWebView behavior, we only enable
53         these actions if either the base writing direction is RTL, or the user has an active RTL keyboard. This means,
54         for instance, that in the case where a user with only an English keyboard is editing LTR content, we would never
55         show an option to convert to RTL.
56
57         * WebProcess/WebPage/WebPage.cpp:
58         (WebKit::WebPage::editorState const):
59
60 2019-02-15  Alex Christensen  <achristensen@webkit.org>
61
62         Make WebPaymentCoordinatorProxy more robust and modern
63         https://bugs.webkit.org/show_bug.cgi?id=194678
64
65         Reviewed by Andy Estes.
66
67         Use WeakPtr instead of storing raw pointers in lambdas or the global activePaymentCoordinatorProxy to avoid UAF problems.
68         Call CompletionHandlers in all code paths to avoid hangs.
69         Use Delayed instead of LegacySync for synchronous messaging to progress towards removing LegacySync messages.
70
71         * Scripts/webkit/messages.py:
72         * UIProcess/ApplePay/WebPaymentCoordinatorProxy.cpp:
73         (WebKit::activePaymentCoordinatorProxy):
74         (WebKit::WebPaymentCoordinatorProxy::~WebPaymentCoordinatorProxy):
75         (WebKit::WebPaymentCoordinatorProxy::availablePaymentNetworks):
76         (WebKit::WebPaymentCoordinatorProxy::canMakePayments):
77         (WebKit::WebPaymentCoordinatorProxy::showPaymentUI):
78         (WebKit::WebPaymentCoordinatorProxy::didReachFinalState):
79         * UIProcess/ApplePay/WebPaymentCoordinatorProxy.h:
80         * UIProcess/ApplePay/WebPaymentCoordinatorProxy.messages.in:
81         * UIProcess/ApplePay/ios/WebPaymentCoordinatorProxyIOS.mm:
82         (WebKit::WebPaymentCoordinatorProxy::platformShowPaymentUI):
83         * UIProcess/ApplePay/mac/WebPaymentCoordinatorProxyMac.mm:
84         (WebKit::WebPaymentCoordinatorProxy::platformShowPaymentUI):
85
86 2019-02-15  Youenn Fablet  <youenn@apple.com>
87
88         Make ServiceWorkerClientFetch closer to WebResourceLoader
89         https://bugs.webkit.org/show_bug.cgi?id=194651
90
91         Unreviewed, build fix for WPE.
92
93         * WebProcess/Storage/WebServiceWorkerFetchTaskClient.h:
94
95 2019-02-15  Chris Dumez  <cdumez@apple.com>
96
97         Regression(PSON) Navigating quickly back and forth can lead to getting 'about:blank' in the backforward list
98         https://bugs.webkit.org/show_bug.cgi?id=194717
99         <rdar://problem/47884404>
100
101         Reviewed by Brady Eidson.
102
103         When the client does a history navigation, the UIProcess sends a WebPage::GoToBackForwardItem IPC to the
104         WebProcess and the WebProcess sends a WebPageProxy::BackForwardGoToItem IPC back to the UIProcess to
105         update the current item in the BackForwardList. This means that there is a slight delay between the
106         point a client requests a history navigation and the point where the BackForwardList's current item gets
107         update. This delay is pre-existing behavior and not new to PSON.
108
109         However, with PSON enabled, if we decide to process-swap for the history navigation, we'll tell the
110         previous (committed) process to ignore the load and we ask a new (provisional) process to do the history
111         navigation. When the previous process receives the request to ignore the history navigation, it restores
112         the History's current item to the one previous the navigation, which sends a WebPageProxy::GoToBackForwardItem
113         IPC to the UIProcess to update the BackForwardList as well. In parallel, the new process starts the
114         history navigation and also sends a WebPageProxy::GoToBackForwardItem to update the BackForwardList's
115         current item as well. We end up with a race between the 2 GoToBackForwardItem IPC messages coming from
116         the old and new process. If the old process's message loses the race, we end up with the wrong current
117         history item getting set in the UIProcess. Later, when we commit the provisional load and try to suspend
118         the previous page, we would save the SuspendedPage on the *wrong* BackForwardList item. If one tries to
119         load this BackForwardList item later, we'll use its SuspendedPage and try to unsuspend it. However,
120         because the PageCache entry is saved on another HistoryItem than the one getting loaded in the WebProcess
121         side, we attempt to do a regular load instead of a PageCache restore. We end up failing the load because
122         pages cannot trigger new loads while in page cache. Because the load fails, we end up loading the
123         initial empty document and this is how we end up with 'about:blank' in the back forward list.
124
125         To address the issue, update WebPageProxy::backForwardGoToItem() to ignore messages from the old/committed
126         WebProcess when there is a pending provisional load. If the committed processes starts a legit new
127         load, it would clear any existing pending provisional load before attempting the call backForwardGoToItem().
128         As a result, ignoring such messages from the old processes when there is a pending provisional load is
129         safe.
130
131         In the future, we should probably move more of the history / backForwardList management to the UIProcess
132         to avoid this sort of issues. This would be a much larger refactoring though so I am going with this
133         simpler fix that is easily cherry-pickable for now.
134
135         * UIProcess/WebPageProxy.cpp:
136         (WebKit::WebPageProxy::suspendCurrentPageIfPossible):
137         (WebKit::WebPageProxy::continueNavigationInNewProcess):
138         (WebKit::WebPageProxy::backForwardGoToItem):
139
140 2019-02-15  Alex Christensen  <achristensen@webkit.org>
141
142         Update IPC code generator unit test expectations after r241595
143         https://bugs.webkit.org/show_bug.cgi?id=194679
144
145         * Scripts/webkit/LegacyMessageReceiver-expected.cpp:
146         (WebKit::WebPage::didReceiveSyncWebPageMessage):
147         * Scripts/webkit/MessageReceiver-expected.cpp:
148         (WebKit::WebPage::didReceiveSyncMessage):
149
150 2019-02-15  Youenn Fablet  <youenn@apple.com>
151
152         Make ServiceWorkerClientFetch closer to WebResourceLoader
153         https://bugs.webkit.org/show_bug.cgi?id=194651
154
155         Reviewed by Alex Christensen.
156
157         The goal of this refactoring is to, at some point use the regular network process load path for service worker loads.
158         This should simplify things and allow less IPC exchanges, for instance in the case of fetch not handled by service worker.
159
160         Introduce two IPC messages for supporting redirect responses and allow the didReceiveResponse/continueDidReceiveResponse
161         handshake for navigation loads.
162
163         This makes ServiceWorker having to buffer load information for this particular case.
164
165         * NetworkProcess/NetworkProcess.cpp:
166         (WebKit::NetworkProcess::didReceiveFetchRedirectResponse):
167         (WebKit::NetworkProcess::didReceiveFetchResponse):
168         * NetworkProcess/NetworkProcess.h:
169         * NetworkProcess/NetworkProcess.messages.in:
170         * NetworkProcess/ServiceWorker/WebSWServerConnection.cpp:
171         (WebKit::WebSWServerConnection::continueDidReceiveFetchResponse):
172         (WebKit::WebSWServerConnection::didReceiveFetchRedirectResponse):
173         (WebKit::WebSWServerConnection::didReceiveFetchResponse):
174         * NetworkProcess/ServiceWorker/WebSWServerConnection.h:
175         * NetworkProcess/ServiceWorker/WebSWServerConnection.messages.in:
176         * WebProcess/Storage/ServiceWorkerClientFetch.cpp:
177         (WebKit::ServiceWorkerClientFetch::start):
178         (WebKit::ServiceWorkerClientFetch::didReceiveRedirectResponse):
179         (WebKit::ServiceWorkerClientFetch::didReceiveResponse):
180         (WebKit::ServiceWorkerClientFetch::didReceiveData):
181         (WebKit::ServiceWorkerClientFetch::didFinish):
182         (WebKit::ServiceWorkerClientFetch::didFail):
183         (WebKit::ServiceWorkerClientFetch::didNotHandle):
184         (WebKit::ServiceWorkerClientFetch::cancel):
185         * WebProcess/Storage/ServiceWorkerClientFetch.h:
186         * WebProcess/Storage/ServiceWorkerClientFetch.messages.in:
187         * WebProcess/Storage/WebSWClientConnection.cpp:
188         (WebKit::WebSWClientConnection::startFetch):
189         (WebKit::WebSWClientConnection::cancelFetch):
190         (WebKit::WebSWClientConnection::continueDidReceiveFetchResponse):
191         * WebProcess/Storage/WebSWClientConnection.h:
192         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
193         (WebKit::WebSWContextManagerConnection::continueDidReceiveFetchResponse):
194         (WebKit::WebSWContextManagerConnection::startFetch):
195         * WebProcess/Storage/WebSWContextManagerConnection.h:
196         * WebProcess/Storage/WebSWContextManagerConnection.messages.in:
197         * WebProcess/Storage/WebServiceWorkerFetchTaskClient.cpp:
198         (WebKit::WebServiceWorkerFetchTaskClient::WebServiceWorkerFetchTaskClient):
199         (WebKit::WebServiceWorkerFetchTaskClient::didReceiveRedirection):
200         (WebKit::WebServiceWorkerFetchTaskClient::didReceiveResponse):
201         (WebKit::WebServiceWorkerFetchTaskClient::didReceiveData):
202         (WebKit::WebServiceWorkerFetchTaskClient::didReceiveFormDataAndFinish):
203         (WebKit::WebServiceWorkerFetchTaskClient::didFail):
204         (WebKit::WebServiceWorkerFetchTaskClient::didFinish):
205         (WebKit::WebServiceWorkerFetchTaskClient::continueDidReceiveResponse):
206         * WebProcess/Storage/WebServiceWorkerFetchTaskClient.h:
207
208 2019-02-15  Brian Burg  <bburg@apple.com>
209
210         [Mac] WebInspectorUI.framework does not need to be soft-linked anymore
211         https://bugs.webkit.org/show_bug.cgi?id=194411
212         <rdar://problem/47787614>
213
214         Reviewed by Joseph Pecoraro.
215
216         * Configurations/WebKit.xcconfig:
217         Conditionalize weak linking to WebInspectorUI.framework for Mac only.
218
219         * UIProcess/mac/WebInspectorProxyMac.mm:
220         (WebKit::WebInspectorProxy::inspectorPageURL):
221         (WebKit::WebInspectorProxy::inspectorTestPageURL):
222         (WebKit::WebInspectorProxy::inspectorBaseURL):
223         * WebProcess/WebPage/mac/WebInspectorUIMac.mm:
224         (WebKit::webInspectorUILocalizedStringsURL):
225         Rewrite uses of the bundle to exit early if bundle couldn't be loaded.
226
227 2019-02-15  Alex Christensen  <achristensen@webkit.org>
228
229         IPC code should support messages with both Delayed and WantsConnection attributes
230         https://bugs.webkit.org/show_bug.cgi?id=194679
231
232         Reviewed by Geoffrey Garen.
233
234         * Platform/IPC/HandleMessage.h:
235         (IPC::callMemberFunctionImpl):
236         (IPC::callMemberFunction):
237         (IPC::handleMessageDelayedWantsConnection):
238         * Scripts/webkit/messages.py:
239         * UIProcess/WebStorage/StorageManager.cpp:
240         (WebKit::StorageManager::getValues):
241         * UIProcess/WebStorage/StorageManager.h:
242         * UIProcess/WebStorage/StorageManager.messages.in:
243
244 2019-02-15  Commit Queue  <commit-queue@webkit.org>
245
246         Unreviewed, rolling out r241559 and r241566.
247         https://bugs.webkit.org/show_bug.cgi?id=194710
248
249         Causes layout test crashes under GuardMalloc (Requested by
250         ryanhaddad on #webkit).
251
252         Reverted changesets:
253
254         "[WTF] Add environment variable helpers"
255         https://bugs.webkit.org/show_bug.cgi?id=192405
256         https://trac.webkit.org/changeset/241559
257
258         "Unreviewed build fix for WinCairo Debug after r241559."
259         https://trac.webkit.org/changeset/241566
260
261 2019-02-15  Michael Catanzaro  <mcatanzaro@igalia.com>
262
263         [WPE][GTK] Defer sandboxing APIs to 2.26
264         https://bugs.webkit.org/show_bug.cgi?id=194274
265
266         Reviewed by Carlos Garcia Campos.
267
268         The web process sandbox has not been widely-tested yet, so we should defer the new APIs to
269         2.26.
270
271         * UIProcess/API/glib/WebKitWebContext.cpp:
272
273 2019-02-10  Darin Adler  <darin@apple.com>
274
275         Replace more uses of String::format with StringConcatenate (mostly non-Apple platform-specific cases)
276         https://bugs.webkit.org/show_bug.cgi?id=194487
277
278         Reviewed by Daniel Bates.
279
280         * NetworkProcess/NetworkProcess.cpp:
281         (WebKit::NetworkProcess::switchToNewTestingSession): Use makeString instead of String::format.
282         * NetworkProcess/soup/NetworkProcessSoup.cpp:
283         (WebKit::buildAcceptLanguages): Ditto.
284         * UIProcess/API/glib/IconDatabase.cpp:
285         (WebKit::IconDatabase::performURLImport): Ditto.
286         * UIProcess/gtk/InputMethodFilter.cpp:
287         (WebKit::InputMethodFilter::logConfirmCompositionForTesting): Ditto.
288         (WebKit::InputMethodFilter::logSetPreeditForTesting): Ditto.
289
290 2019-02-15  Truitt Savell  <tsavell@apple.com>
291
292         Unreviewed, rolling out r241564.
293
294         Caused 50+ Timeouts on Mac WK2, mostly in the http/ directory
295
296         Reverted changeset:
297
298         "[Mac] WebInspectorUI.framework does not need to be soft-
299         linked anymore"
300         https://bugs.webkit.org/show_bug.cgi?id=194411
301         https://trac.webkit.org/changeset/241564
302
303 2019-02-15  Carlos Garcia Campos  <cgarcia@igalia.com>
304
305         Unreviewed. Fix GTK+ build after r241556
306
307         I guess this is due to unified builds after a new file being added in r241556.
308
309         * UIProcess/API/C/WKAuthenticationDecisionListener.cpp:
310         * UIProcess/API/C/WKPage.cpp:
311
312 2019-02-14  Brent Fulgham  <bfulgham@apple.com>
313
314         REGRESSION (r240446): Storage Access API does not handle domains consistently
315         https://bugs.webkit.org/show_bug.cgi?id=194664
316
317         Reviewed by Alex Christensen.
318         
319         During my refactoring of the ResourceLoadStatistics code, I introduced two bugs:
320         (1) I neglected to be consistent in my use of 'primaryDomain', causing some Storage
321         Access API code paths to store approves under one domain (e.g., 'www.example.com'),
322         while checking status under the eTLD+1 (e.g., 'example.com'). The exact string matching
323         requirement caused these to get missed.
324
325         (2) I used a move operator before a final set of copies of domain names, leading to
326         some empty strings being passed to Storage Access API calls.
327
328         Both issues are corrected in this patch.
329
330         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
331         (WebKit::WebResourceLoadStatisticsStore::setPrevalentResourceForDebugMode): Always make the
332         domain comply with our 'primaryDomain' logic.
333         (WebKit::WebResourceLoadStatisticsStore::hasStorageAccess): Ditto.
334         (WebKit::WebResourceLoadStatisticsStore::requestStorageAccessGranted): Ditto.
335         (WebKit::WebResourceLoadStatisticsStore::logFrameNavigation): Ditto.
336         (WebKit::WebResourceLoadStatisticsStore::logWebSocketLoading): Ditto.
337         (WebKit::WebResourceLoadStatisticsStore::logSubresourceLoading): Ditto.
338         (WebKit::WebResourceLoadStatisticsStore::logSubresourceRedirect): Ditto.
339         (WebKit::WebResourceLoadStatisticsStore::logUserInteraction): Ditto.
340         (WebKit::WebResourceLoadStatisticsStore::clearUserInteraction): Ditto.
341         (WebKit::WebResourceLoadStatisticsStore::hasHadUserInteraction): Ditto.
342         (WebKit::WebResourceLoadStatisticsStore::setLastSeen): Ditto.
343         (WebKit::WebResourceLoadStatisticsStore::setPrevalentResource): Ditto.
344         (WebKit::WebResourceLoadStatisticsStore::setVeryPrevalentResource): Ditto.
345         (WebKit::WebResourceLoadStatisticsStore::isPrevalentResource): Ditto.
346         (WebKit::WebResourceLoadStatisticsStore::isVeryPrevalentResource): Ditto.
347         (WebKit::WebResourceLoadStatisticsStore::isRegisteredAsSubresourceUnder): Ditto.
348         (WebKit::WebResourceLoadStatisticsStore::isRegisteredAsSubFrameUnder): Ditto.
349         (WebKit::WebResourceLoadStatisticsStore::isRegisteredAsRedirectingTo): Ditto.
350         (WebKit::WebResourceLoadStatisticsStore::clearPrevalentResource): Ditto.
351         (WebKit::WebResourceLoadStatisticsStore::setGrandfathered): Ditto.
352         (WebKit::WebResourceLoadStatisticsStore::isGrandfathered): Ditto.
353         (WebKit::WebResourceLoadStatisticsStore::setSubframeUnderTopFrameOrigin): Ditto.
354         (WebKit::WebResourceLoadStatisticsStore::setSubresourceUnderTopFrameOrigin): Ditto.
355         (WebKit::WebResourceLoadStatisticsStore::setSubresourceUniqueRedirectTo): Ditto.
356         (WebKit::WebResourceLoadStatisticsStore::setSubresourceUniqueRedirectFrom): Ditto.
357         (WebKit::WebResourceLoadStatisticsStore::setTopFrameUniqueRedirectTo): Ditto.
358         (WebKit::WebResourceLoadStatisticsStore::setTopFrameUniqueRedirectFrom): Ditto.
359         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
360         (WebKit::WebsiteDataStore::hasStorageAccess): Always make the
361         domain comply with our 'primaryDomain' logic.
362         (WebKit::WebsiteDataStore::requestStorageAccess): Ditto. Also make copy of domain
363         names before moving them to the completion handler.
364         (WebKit::WebsiteDataStore::grantStorageAccess): Ditto.
365         * WebProcess/WebPage/WebPage.cpp:
366         (WebKit::WebPage::hasStorageAccess):  Always make the domain comply with our
367         'primaryDomain' logic.
368         (WebKit::WebPage::requestStorageAccess): Ditto.
369
370 2019-02-14  Tim Horton  <timothy_horton@apple.com>
371
372         Fix the build.
373
374         * UIProcess/ios/WKDrawingView.mm:
375         (-[WKDrawingView renderedDrawing]):
376
377 2019-02-14  Youenn Fablet  <youenn@apple.com>
378
379         ASSERTION FAILED: m_caches.isEmpty() || !m_pendingInitializationCallbacks.isEmpty() in WebKit::CacheStorage::Caches::clearMemoryRepresentation()
380         https://bugs.webkit.org/show_bug.cgi?id=188393
381         <rdar://problem/43025665>
382
383         Reviewed by Alex Christensen.
384
385         In case Caches::dispose is called, clearMemoryRepresentation might be called if there is no active cache.
386         We also ensure to not clear the memory representation if there is any remaining removed cache.
387         Update the clearMemoryRepresentation assertion to take that into account.
388
389         In case a Caches is cleared twice, the clearMemoryRepresentation assertion will assert while it should not.
390         In that case m_storage is null the second time. Update the assertion accordingly.
391
392         * NetworkProcess/cache/CacheStorageEngineCaches.cpp:
393         (WebKit::CacheStorage::Caches::hasActiveCache const):
394         (WebKit::CacheStorage::Caches::dispose):
395         (WebKit::CacheStorage::Caches::clearMemoryRepresentation):
396         * NetworkProcess/cache/CacheStorageEngineCaches.h:
397
398 2019-02-14  Brian Burg  <bburg@apple.com>
399
400         [Mac] WebInspectorUI.framework does not need to be soft-linked anymore
401         https://bugs.webkit.org/show_bug.cgi?id=194411
402         <rdar://problem/47787614>
403
404         Reviewed by Joseph Pecoraro.
405
406         * Configurations/WebKit.xcconfig:
407         Conditionalize weak linking to WebInspectorUI.framework for Mac only.
408
409         * UIProcess/mac/WebInspectorProxyMac.mm:
410         (WebKit::WebInspectorProxy::inspectorPageURL):
411         (WebKit::WebInspectorProxy::inspectorTestPageURL):
412         (WebKit::WebInspectorProxy::inspectorBaseURL):
413         * WebProcess/WebPage/mac/WebInspectorUIMac.mm:
414         (WebKit::webInspectorUILocalizedStringsURL):
415         Rewrite uses of the bundle to exit early if bundle couldn't be loaded.
416
417 2019-02-14  Michael Catanzaro  <mcatanzaro@igalia.com>
418
419         [GTK] WebKitGTK+ -> WebKitGTK
420         https://bugs.webkit.org/show_bug.cgi?id=194658
421
422         Reviewed by Alex Christensen.
423
424         This renames WebKitGTK+ to WebKitGTK in a few user-visible places: the API documentation,
425         the pkg-config, and an error message.
426
427         In a couple places where it's exposed in WPE documentation, WPE is now mentioned, or the
428         reference to "WebKitGTK+" is changed to just "WebKit."
429
430         * UIProcess/API/glib/WebKitSettings.cpp:
431         (webkit_settings_class_init):
432         * UIProcess/API/glib/WebKitWebView.cpp:
433         * UIProcess/API/gtk/docs/webkit2gtk-docs.sgml:
434         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMPrivateGtk.h:
435         * gtk/webkit2gtk-web-extension.pc.in:
436         * gtk/webkit2gtk.pc.in:
437
438 2019-02-14  Ross Kirsling  <ross.kirsling@sony.com>
439
440         [WTF] Add environment variable helpers
441         https://bugs.webkit.org/show_bug.cgi?id=192405
442
443         Reviewed by Michael Catanzaro.
444
445         * NetworkProcess/EntryPoint/unix/NetworkProcessMain.cpp:
446         (main):
447         * Platform/unix/EnvironmentUtilities.cpp:
448         (WebKit::EnvironmentUtilities::stripValuesEndingWithString):
449         * Platform/unix/LoggingUnix.cpp:
450         (WebKit::logLevelString):
451         * Platform/win/LoggingWin.cpp:
452         (WebKit::logLevelString):
453         * PluginProcess/mac/PluginProcessMac.mm:
454         (WebKit::shouldCallRealDebugger):
455         * Shared/Plugins/unix/PluginSearchPath.cpp:
456         (WebKit::pluginsDirectories):
457         * Shared/glib/ProcessExecutablePathGLib.cpp:
458         (WebKit::findWebKitProcess):
459         * UIProcess/API/glib/WebKitSettings.cpp:
460         (webKitSettingsConstructed):
461         (webKitSettingsSetProperty):
462         * UIProcess/API/glib/WebKitWebContext.cpp:
463         (injectedBundleDirectory):
464         (webkitWebContextConstructed):
465         * UIProcess/API/gtk/WebKitWebViewGtk.cpp:
466         (webkitWebViewMaximizeWindow):
467         (webkitWebViewRestoreWindow):
468         * UIProcess/API/wpe/WPEView.cpp:
469         (WKWPE::m_backend):
470         * UIProcess/AuxiliaryProcessProxy.cpp:
471         (WebKit::AuxiliaryProcessProxy::getLaunchOptions):
472         * UIProcess/Launcher/glib/BubblewrapLauncher.cpp:
473         (WebKit::XDGDBusProxyLauncher::launch):
474         (WebKit::bindDBusSession):
475         (WebKit::bindX11):
476         (WebKit::bindWayland):
477         (WebKit::bindPulse):
478         (WebKit::bindPathVar):
479         (WebKit::bindGStreamerData):
480         (WebKit::bubblewrapSpawn):
481         * UIProcess/Launcher/glib/ProcessLauncherGLib.cpp:
482         (WebKit::ProcessLauncher::launchProcess):
483         * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
484         (WebKit::systemDirectoryPath):
485         (WebKit::ProcessLauncher::launchProcess):
486         * UIProcess/glib/WebProcessPoolGLib.cpp:
487         (WebKit::memoryPressureMonitorDisabled):
488         (WebKit::WebProcessPool::platformInitialize):
489         (WebKit::WebProcessPool::platformInitializeWebProcess):
490         * UIProcess/gtk/HardwareAccelerationManager.cpp:
491         (WebKit::HardwareAccelerationManager::HardwareAccelerationManager):
492         * WebProcess/EntryPoint/unix/WebProcessMain.cpp:
493         (main):
494         * WebProcess/gtk/WebProcessMainGtk.cpp:
495         * WebProcess/wpe/WebProcessMainWPE.cpp:
496         Utilize WTF::Environment where possible.
497
498 2019-02-14  Jiewen Tan  <jiewen_tan@apple.com>
499
500         Handle _WKNavigationActionPolicyAllowWithoutTryingAppLink for LoadOptimizer
501         https://bugs.webkit.org/show_bug.cgi?id=194640
502         <rdar://problem/48064140>
503
504         Reviewed by Brent Fulgham.
505
506         * UIProcess/Cocoa/NavigationState.mm:
507         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
508
509 2019-02-14  Chris Dumez  <cdumez@apple.com>
510
511         [PSON] Introduce a WebContent Process cache
512         https://bugs.webkit.org/show_bug.cgi?id=194594
513         <rdar://problem/46793397>
514
515         Reviewed by Geoff Garen.
516
517         Introduce a WebContent Process cache to reduce the number of process launches when
518         process swap on navigation is enabled, and to reduce the power cost of the feature.
519
520         If a WebProcess loaded pages from a single registrable domain then it is eligible
521         for the cache. When process-swapping on navigation to a new registrable domain, we
522         now attempt to retrieve a process from the cache for the domain in question instead
523         of always launching a new one.
524
525         The WebProcess cache currently has the following attributes:
526         - It may contains 4 processes per GB of RAM the machine has, up to 30 processes.
527         - WebProcesses automatically get evicted from the cache after 30 minutes.
528         - If the application is no longer the active app, then the cache will get cleared
529           after 5 minutes.
530         - WebProcesses that are in the cache are reported as "(Cached)" in Activity Monitor.
531
532         The WebProcess cache is currently disabled by default and can by enabled by the
533         client via SPI.
534
535         * Shared/WebBackForwardListItem.cpp:
536         (WebKit::WebBackForwardListItem::WebBackForwardListItem):
537         * Shared/WebBackForwardListItem.h:
538         (WebKit::WebBackForwardListItem::lastProcessIdentifier const):
539         (WebKit::WebBackForwardListItem::setLastProcessIdentifier):
540         Add new lastProcessIdentifier data member that reflects which process this item
541         was last loaded in. It is normally identical to the identifier of the process
542         that created the item but it gets overriden in case of cross-site client-side
543         redirect, since a new process takes over the item in this case.
544
545         * Sources.txt:
546         Add new source file.
547
548         * UIProcess/API/APIProcessPoolConfiguration.cpp:
549         (API::ProcessPoolConfiguration::copy):
550         * UIProcess/API/APIProcessPoolConfiguration.h:
551         * UIProcess/API/C/WKContextConfigurationRef.cpp:
552         (WKContextConfigurationUsesWebProcessCache):
553         (WKContextConfigurationSetUsesWebProcessCache):
554         * UIProcess/API/C/WKContextConfigurationRef.h:
555         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
556         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
557         (-[_WKProcessPoolConfiguration setUsesWebProcessCache:]):
558         (-[_WKProcessPoolConfiguration usesWebProcessCache]):
559         Add new SPI to enable the WebProcess cache.
560
561         * UIProcess/API/Cocoa/WKProcessPool.mm:
562         (-[WKProcessPool _webProcessCountIgnoringPrewarmedAndCached]):
563         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
564         Add new SPI for testing which returns the number of WebProcesses ignoring
565         both prewarmed and cached ones.
566
567         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
568         (WebKit::WebProcessPool::registerNotificationObservers):
569         (WebKit::WebProcessPool::unregisterNotificationObservers):
570         Add application active state observers as the WebProcess cache gets cleared
571         when the application resigns active state for more than 5 minutes.
572
573         * UIProcess/ProvisionalPageProxy.cpp:
574         (WebKit::ProvisionalPageProxy::loadRequest):
575         When doing a load in a new process with the BackForwardList locked (i.e. client-side
576         redirect), make sure we update the last process identifier for the BackForwardListItem.
577         This is important because the logic in WebProcessPool::processForNavigation() relies on
578         this identifier to select which process to do the history navigation into, and we want
579         to do the load in the post-redirect process, not the pre-redirect one.
580
581         * UIProcess/WebPageProxy.cpp:
582         (WebKit::WebPageProxy::didStartProvisionalLoadForFrameShared):
583         Tell the WebProcess whenever a main frame provisional load is started, providing the URL.
584
585         * UIProcess/WebProcessCache.cpp: Added.
586         (WebKit::WebProcessCache::WebProcessCache):
587         (WebKit::WebProcessCache::addProcess):
588         (WebKit::WebProcessCache::takeProcess):
589         (WebKit::WebProcessCache::updateMaximumSize):
590         (WebKit::WebProcessCache::clear):
591         (WebKit::WebProcessCache::setApplicationIsActive):
592         (WebKit::WebProcessCache::evictProcess):
593         (WebKit::WebProcessCache::CachedProcess::CachedProcess):
594         (WebKit::WebProcessCache::CachedProcess::~CachedProcess):
595         (WebKit::WebProcessCache::CachedProcess::takeProcess):
596         (WebKit::WebProcessCache::CachedProcess::evictionTimerFired):
597         * UIProcess/WebProcessCache.h: Added.
598         (WebKit::WebProcessCache::maximumSize):
599         (WebKit::WebProcessCache::size const):
600         (WebKit::WebProcessCache::CachedProcess::process):
601         Add process cache implementation.
602
603         * UIProcess/WebProcessPool.cpp:
604         (WebKit::m_webProcessCache):
605         WebProcessCache is stored on the WebProcessPool via m_webProcessCache data member.
606
607         (WebKit::WebProcessPool::~WebProcessPool):
608         Clear the WebProcess cache in the destructor.
609
610         (WebKit::WebProcessPool::setApplicationIsActive):
611         Notify the WebProcessCache whenever the application's active state changes.
612
613         (WebKit::WebProcessPool::createWebPage):
614         If the state of PSON changes via the experimental features menu, dynamically
615         update the WebProcessCache's size. This is needed because the cache is disabled
616         when PSON is disabled.
617
618         (WebKit::WebProcessPool::handleMemoryPressureWarning):
619         Clear the WebProcess cache on memory pressure.
620
621         (WebKit::WebProcessPool::processForNavigationInternal):
622         Query the WebProcessCache before attempting to create a new WebProcess for a cross-site
623         navigation.
624
625         (WebKit::WebProcessPool::findReusableSuspendedPageProcess):
626         This logic was split out of processForNavigationInternal() to reduce the size
627         of the method.
628
629         * UIProcess/WebProcessPool.h:
630         * UIProcess/WebProcessProxy.cpp:
631         (WebKit::WebProcessProxy::setIsInProcessCache):
632         Update the isInProcessCache flag on the WebProcessProxy and send an IPC to the WebContent
633         process so that it can update its name in Activity Monitor.
634         We also need to stop holding a strong reference to the WebProcessPool whenever the process
635         is in the cache, similarly to what we do for pre-warmed processes, given that such processes
636         should not keep the process pool alive.
637
638         (WebKit::WebProcessProxy::addExistingWebPage):
639         Assert that we never try to add a page to a cached process, it should be taken out of the
640         cache before use.
641
642         (WebKit::WebProcessProxy::hasProvisionalPageWithID const):
643         (WebKit::WebProcessProxy::isAllowedToUpdateBackForwardItem const):
644         (WebKit::WebProcessProxy::updateBackForwardItem):
645         In case of client-side redirects, the previous process would sometimes send an IPC causing
646         the UIProcess' backforward list item to get updated with the pre-redirect URL after we've
647         already redirected. This previously would be unlikely to occur because we do not suspend
648         client-redirect pages and their process would normally exit before getting a chance to send
649         the IPC. However, with the process cache, the bug became obvious as the process would stay
650         alive and send up the "bad" IPC. To address the issue, we now only let the IPC update the
651         item if the item's page is (still) associated with the process. In the future, we may want
652         to update the IPC so that it gets sent to the WebPageProxy instead of the WebProcessProxy.
653
654         (WebKit::WebProcessProxy::processDidTerminateOrFailedToLaunch):
655         If a cached WebProcess crashes, remove it from the cache so that we do not attempt to use
656         it for a load later.
657
658         (WebKit::WebProcessProxy::canBeAddedToWebProcessCache const):
659         Only cache WebProcesses that have loaded a single registrable domain. Also prevent caching
660         for service worker and inspector processes.
661
662         (WebKit::WebProcessProxy::maybeShutDown):
663         If the process is cacheable, add it to the cache instead of shutting it down right away.
664
665         (WebKit::WebProcessProxy::canTerminateAuxiliaryProcess):
666         Make sure we do not attempt to terminate a processes that is in the cache.
667
668         (WebKit::WebProcessProxy::didStartProvisionalLoadForMainFrame):
669         Whenever a main frame provisional load starts, make sure we update the process's associated
670         registrable domain. nullopt indicates that there is no associated domain yet. Null string
671         indicates that the process is associated with several registrable domain and is therefore
672         not eligible for caching.
673
674         * UIProcess/WebProcessProxy.h:
675         (WebKit::WebProcessProxy::registrableDomain const):
676         (WebKit::WebProcessProxy::isInProcessCache const):
677         (WebKit::WebProcessProxy::provisionalPageCount const):
678         Add convenience getters.
679
680         * WebKit.xcodeproj/project.pbxproj:
681         Add new files to project.
682
683         * WebProcess/WebProcess.cpp:
684         (WebKit::WebProcess::setIsInProcessCache):
685         * WebProcess/WebProcess.h:
686         * WebProcess/WebProcess.messages.in:
687         * WebProcess/cocoa/WebProcessCocoa.mm:
688         (WebKit::WebProcess::updateProcessName):
689         Update the WebProcess' name in Activity Monitor whenever it goes into or out of the WebProcess
690         cache.
691
692 2019-02-14  Per Arne Vollan  <pvollan@apple.com>
693
694         [iOS] Open sandbox for certain calls.
695         https://bugs.webkit.org/show_bug.cgi?id=194626
696
697         Reviewed by Brent Fulgham.
698
699         Reporting shows that certain calls needs to be allowed in the sandbox.
700
701         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
702
703 2019-02-14  Chris Fleizach  <cfleizach@apple.com>
704
705         AX: ARIA Reflection was disabled in error
706         https://bugs.webkit.org/show_bug.cgi?id=194647
707         <rdar://problem/48068336>
708
709         Reviewed by Ryosuke Niwa.
710
711         * Shared/WebPreferences.yaml:
712
713 2019-02-14  Commit Queue  <commit-queue@webkit.org>
714
715         Unreviewed, rolling out r241486.
716         https://bugs.webkit.org/show_bug.cgi?id=194655
717
718         causing API failures in builds (Requested by ShawnRoberts on
719         #webkit).
720
721         Reverted changeset:
722
723         "[Cocoa] Media elements will restart network buffering just
724         before suspending"
725         https://bugs.webkit.org/show_bug.cgi?id=193691
726         https://trac.webkit.org/changeset/241486
727
728 2019-02-14  Youenn Fablet  <youenn@apple.com>
729
730         Do not add a caches to its engine if the salt cannot be initialized
731         https://bugs.webkit.org/show_bug.cgi?id=194604
732
733         Reviewed by Antti Koivisto.
734
735         This is a follow-up to https://bugs.webkit.org/show_bug.cgi?id=194588.
736         We should return early if initialize fails.
737
738         * NetworkProcess/cache/CacheStorageEngine.cpp:
739         (WebKit::CacheStorage::Engine::readCachesFromDisk):
740
741 2019-02-13  Carlos Garcia Campos  <cgarcia@igalia.com>
742
743         [GTK] Use a scrolled window for script alerts text
744         https://bugs.webkit.org/show_bug.cgi?id=184875
745
746         Reviewed by Michael Catanzaro.
747
748         To ensure long text doesn't make the dialog bigger.
749
750         * UIProcess/API/gtk/WebKitScriptDialogImpl.cpp:
751         (webkitScriptDialogImplConstructed): Use PANGO_ELLIPSIZE_END for the title and add a scrolled window for the body.
752         (webkitScriptDialogImplSetText): Helper function to set the dialog body, ensuring the scrolled window fills the
753         dialog available size.
754         (webkitScriptDialogImplNew): It now receives the maximum size and uses webkitScriptDialogImplSetText().
755         * UIProcess/API/gtk/WebKitScriptDialogImpl.h:
756         * UIProcess/API/gtk/WebKitWebViewGtk.cpp:
757         (webkitWebViewScriptDialog): Pass the 80% of the web view size as the maximum size of script dialogs.
758
759 2019-02-13  Ryosuke Niwa  <rniwa@webkit.org>
760
761         Crash in WKBundleFrameGetParentFrame when called inside didRemoveFrameFromHierarchy
762         https://bugs.webkit.org/show_bug.cgi?id=194641
763
764         Reviewed by Geoffrey Garen.
765
766         Fixed the bug by adding a null check to WebFrame::parentFrame.
767
768         * WebProcess/WebPage/WebFrame.cpp:
769         (WebKit::WebFrame::parentFrame const):
770
771 2019-02-13  Timothy Hatcher  <timothy@apple.com>
772
773         Allow some deprecations in WKDrawingView.
774         https://bugs.webkit.org/show_bug.cgi?id=194636
775
776         Reviewed by Wenson Hsieh.
777
778         * UIProcess/ios/WKDrawingView.mm:
779         (-[WKDrawingView PNGRepresentation]):
780         (-[WKDrawingView loadDrawingFromPNGRepresentation:]):
781         (-[WKDrawingView _canvasViewWillBeginDrawing:]):
782         (-[WKDrawingView didChangeInk:]):
783
784 2019-02-13  Jer Noble  <jer.noble@apple.com>
785
786         [Cocoa] Media elements will restart network buffering just before suspending
787         https://bugs.webkit.org/show_bug.cgi?id=193691
788
789         Reviewed by Eric Carlson.
790
791         When the WebProcess receives a notification that the process is about to become
792         suspended, it tells the MemoryPressureHandler to release all critical memory. This
793         has the side effect of causing AVFoundation-backed media elements to dump their
794         in-memory caches and start downloading media data again. Instead, media elements
795         should all stop buffering media data during suspension. Add new testing SPI to
796         simulate suspension and resume messages.
797
798         * UIProcess/API/Cocoa/WKWebView.mm:
799         (-[WKWebView _processWillSuspendImminentlyForTesting]):
800         (-[WKWebView _processDidResumeForTesting]):
801         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
802         * UIProcess/WebProcessProxy.h:
803         * UIProcess/ios/WKInkPickerView.mm:
804         * WebProcess/WebPage/WebPage.cpp:
805         (WebKit::WebPage::suspendAllMediaBuffering):
806         (WebKit::WebPage::resumeAllMediaBuffering):
807         * WebProcess/WebPage/WebPage.h:
808         * WebProcess/WebProcess.cpp:
809         (WebKit::WebProcess::actualPrepareToSuspend):
810         (WebKit::WebProcess::cancelPrepareToSuspend):
811         (WebKit::WebProcess::processDidResume):
812         (WebKit::WebProcess::suspendAllMediaBuffering):
813         (WebKit::WebProcess::resumeAllMediaBuffering):
814         * WebProcess/WebProcess.h:
815
816 2019-02-13  Per Arne Vollan  <pvollan@apple.com>
817
818         [iOS] Fix sandbox violation during media playback
819         https://bugs.webkit.org/show_bug.cgi?id=194616
820         <rdar://problem/48049264>
821
822         Reviewed by Brent Fulgham.
823
824         Mach lookup to "com.apple.coremedia.figcontentkeysession.xpc" should be allowed.
825
826         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
827
828 2019-02-13  Tim Horton  <timothy_horton@apple.com>
829
830         Encrypted PDFs inside <embed> or <object> crash the Web Content process
831         https://bugs.webkit.org/show_bug.cgi?id=194605
832         <rdar://problem/19894818>
833
834         Reviewed by Andy Estes.
835
836         * WebProcess/Plugins/PDF/PDFPlugin.mm:
837         (WebKit::PDFPlugin::createPasswordEntryForm):
838         Don't try to create a password form field if we can't make form fields.
839
840         This means you will be left with a useless embedded PDF, but at least
841         the Web Content process won't crash.
842
843         We'll need to find an alternative implementation of PDF embedded form
844         fields that is compatible with <embed> and <object> if we want to support
845         this. Currently we piggy-back off the fact that we can just insert
846         <input>s into the PluginDocument's DOM, but we can't do that if there
847         is no PluginDocument, just a main document, like in the <embed> case.
848
849 2019-02-12  Jiewen Tan  <jiewen_tan@apple.com>
850
851         Further restricting webarchive loads
852         https://bugs.webkit.org/show_bug.cgi?id=194567
853         <rdar://problem/47610130>
854
855         Reviewed by Youenn Fablet.
856
857         * WebProcess/WebPage/WebPage.cpp:
858         (WebKit::WebPage::loadRequest):
859         Set a flag to indicate a load is started from clients.
860
861 2019-02-13  Michael Catanzaro  <mcatanzaro@igalia.com>
862
863         [WPE][GTK] Merge WebProcessPoolWPE.cpp and WebProcessPoolGtk.cpp
864         https://bugs.webkit.org/show_bug.cgi?id=194551
865
866         Reviewed by Carlos Garcia Campos.
867
868         * SourcesGTK.txt:
869         * SourcesWPE.txt:
870         * UIProcess/glib/WebProcessPoolGLib.cpp: Renamed from Source/WebKit/UIProcess/gtk/WebProcessPoolGtk.cpp.
871         (WebKit::initializeRemoteInspectorServer):
872         (WebKit::memoryPressureMonitorDisabled):
873         (WebKit::WebProcessPool::platformInitialize):
874         (WebKit::WebProcessPool::platformInitializeWebProcess):
875         (WebKit::WebProcessPool::platformInvalidateContext):
876         (WebKit::WebProcessPool::platformResolvePathsForSandboxExtensions):
877         * UIProcess/wpe/WebProcessPoolWPE.cpp: Removed.
878
879 2019-02-13  Michael Catanzaro  <mcatanzaro@igalia.com>
880
881         Fix -Wformat warning from r241401
882         https://bugs.webkit.org/show_bug.cgi?id=194584
883         <rdar://problem/47761293>
884
885         * WebProcess/WebPage/WebPage.cpp:
886         (WebKit::WebPage::setActivityState):
887
888 2019-02-13  Youenn Fablet  <youenn@apple.com>
889
890         Make WebRTCUnifiedPlanEnabled true by default
891         https://bugs.webkit.org/show_bug.cgi?id=194595
892
893         Reviewed by Eric Carlson.
894
895         * Shared/WebPreferences.yaml:
896
897 2019-02-13  John Wilander  <wilander@apple.com>
898
899         Store Ad Click Attribution requests in the network process
900         https://bugs.webkit.org/show_bug.cgi?id=194510
901         <rdar://problem/47650118>
902
903         Reviewed by Alex Christensen and Daniel Bates.
904
905         With this patch, WebPageProxy::didCommitLoadForFrame() now looks for
906         an AdClickAttribution object in its navigation state. If there is an
907         attribution, it sends it to the network process where the 
908         WebKit::NetworkSession stores it in an object of a new class,
909         WebKit::NetworkAdClickAttribution.
910
911         This patch also covers test infrastructure to support two new
912         TestRunner functions:
913         - dumpAdClickAttribution()
914         - clearAdClickAttribution()
915
916         * NetworkProcess/Cookies/WebCookieManager.cpp:
917             Added missing header include.
918         * NetworkProcess/Downloads/DownloadManager.cpp:
919             Added missing header include.
920         * NetworkProcess/NetworkAdClickAttribution.cpp: Added.
921         (WebKit::NetworkAdClickAttribution::ensureDestinationMapForSource):
922         (WebKit::NetworkAdClickAttribution::store):
923         (WebKit::NetworkAdClickAttribution::clear):
924         (WebKit::NetworkAdClickAttribution::toString const):
925         * NetworkProcess/NetworkAdClickAttribution.h: Added.
926             Stores WebCore::AdClickAttribution objects in a map structure.
927         * NetworkProcess/NetworkLoad.cpp:
928             Added missing header includes.
929         * NetworkProcess/NetworkProcess.cpp:
930         (WebKit::NetworkProcess::storeAdClickAttribution):
931         (WebKit::NetworkProcess::dumpAdClickAttribution):
932         (WebKit::NetworkProcess::clearAdClickAttribution):
933         * NetworkProcess/NetworkProcess.h:
934         * NetworkProcess/NetworkProcess.messages.in:
935         * NetworkProcess/NetworkSession.cpp:
936         (WebKit::NetworkSession::NetworkSession):
937         (WebKit::NetworkSession::storeAdClickAttribution):
938         (WebKit::NetworkSession::dumpAdClickAttribution):
939         (WebKit::NetworkSession::clearAdClickAttribution):
940         * NetworkProcess/NetworkSession.h:
941         * NetworkProcess/soup/RemoteNetworkingContextSoup.cpp:
942             Added missing header include.
943         * Sources.txt:
944             Added NetworkProcess/NetworkAdClickAttribution.cpp.
945         * UIProcess/API/APINavigation.h:
946         (API::Navigation::adClickAttribution const):
947         * UIProcess/API/C/WKPage.cpp:
948         (WKPageDumpAdClickAttribution):
949         (WKPageClearAdClickAttribution):
950             Test infrastructure.
951         * UIProcess/API/C/WKPagePrivate.h:
952         * UIProcess/Network/NetworkProcessProxy.cpp:
953         (WebKit::NetworkProcessProxy::dumpAdClickAttribution):
954         (WebKit::NetworkProcessProxy::clearAdClickAttribution):
955             Test infrastructure.
956         * UIProcess/Network/NetworkProcessProxy.h:
957         * UIProcess/WebPageProxy.cpp:
958         (WebKit::WebPageProxy::didFinishDocumentLoadForFrame):
959             This is where pending Ad Click Attributions are forwarded to the
960             network process.
961         (WebKit::WebPageProxy::dumpAdClickAttribution):
962         (WebKit::WebPageProxy::clearAdClickAttribution):
963             Test infrastructure.
964         * UIProcess/WebPageProxy.h:
965         * UIProcess/WebProcessPool.cpp:
966         (WebKit::WebProcessPool::dumpAdClickAttribution):
967         (WebKit::WebProcessPool::clearAdClickAttribution):
968             Test infrastructure.
969         * UIProcess/WebProcessPool.h:
970         * WebKit.xcodeproj/project.pbxproj:
971         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
972         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
973             Added missing data copying from navigationAction to navigationActionData.
974
975 2019-02-13  Antti Koivisto  <antti@apple.com>
976
977         Crash in WebKit::CacheStorage::Engine::cachesRootPath
978         https://bugs.webkit.org/show_bug.cgi?id=194588
979         <rdar://problem/46363997>
980
981         Reviewed by Youenn Fablet.
982
983         * NetworkProcess/cache/CacheStorageEngine.cpp:
984         (WebKit::CacheStorage::Engine::cachesRootPath):
985
986         Salt may have not been initialized yet when the Engine is destroyed.
987
988 2019-02-13  Alex Christensen  <achristensen@webkit.org>
989
990         Remove legacy sync messaging in some IPC code
991         https://bugs.webkit.org/show_bug.cgi?id=194561
992
993         Reviewed by Geoffrey Garen.
994
995         Changing some LegacySync messages to Delayed messages.  We should probably rename Delayed to Sync.
996         There are too many ways to send messages.  Let's work to get rid of the old one.
997
998         * NetworkProcess/NetworkProcess.cpp:
999         (WebKit::NetworkProcess::setAllowsAnySSLCertificateForWebSocket):
1000         (WebKit::NetworkProcess::processWillSuspendImminently):
1001         * NetworkProcess/NetworkProcess.h:
1002         * NetworkProcess/NetworkProcess.messages.in:
1003         * PluginProcess/PluginControllerProxy.cpp:
1004         (WebKit::PluginControllerProxy::handleWheelEvent):
1005         (WebKit::PluginControllerProxy::handleMouseEnterEvent):
1006         (WebKit::PluginControllerProxy::handleMouseLeaveEvent):
1007         (WebKit::PluginControllerProxy::handleKeyboardEvent):
1008         (WebKit::PluginControllerProxy::handleEditingCommand):
1009         (WebKit::PluginControllerProxy::isEditingCommandEnabled):
1010         (WebKit::PluginControllerProxy::handlesPageScaleFactor):
1011         (WebKit::PluginControllerProxy::requiresUnifiedScaleFactor):
1012         (WebKit::PluginControllerProxy::paintEntirePlugin):
1013         (WebKit::PluginControllerProxy::supportsSnapshotting):
1014         (WebKit::PluginControllerProxy::snapshot):
1015         (WebKit::PluginControllerProxy::getPluginScriptableNPObject):
1016         (WebKit::PluginControllerProxy::getFormValue):
1017         * PluginProcess/PluginControllerProxy.h:
1018         * PluginProcess/PluginControllerProxy.messages.in:
1019         * Shared/Plugins/NPObjectMessageReceiver.cpp:
1020         (WebKit::NPObjectMessageReceiver::deallocate):
1021         (WebKit::NPObjectMessageReceiver::hasMethod):
1022         (WebKit::NPObjectMessageReceiver::invoke):
1023         (WebKit::NPObjectMessageReceiver::invokeDefault):
1024         (WebKit::NPObjectMessageReceiver::hasProperty):
1025         (WebKit::NPObjectMessageReceiver::getProperty):
1026         (WebKit::NPObjectMessageReceiver::setProperty):
1027         (WebKit::NPObjectMessageReceiver::removeProperty):
1028         (WebKit::NPObjectMessageReceiver::enumerate):
1029         (WebKit::NPObjectMessageReceiver::construct):
1030         * Shared/Plugins/NPObjectMessageReceiver.h:
1031         * Shared/Plugins/NPObjectMessageReceiver.messages.in:
1032         * UIProcess/mac/SecItemShimProxy.cpp:
1033         (WebKit::SecItemShimProxy::secItemRequest):
1034         * UIProcess/mac/SecItemShimProxy.h:
1035         * UIProcess/mac/SecItemShimProxy.messages.in:
1036
1037 2019-02-13  Truitt Savell  <tsavell@apple.com>
1038
1039         Unreviewed, rolling out r241433.
1040
1041         Broke internal builds.
1042
1043         Reverted changeset:
1044
1045         "Move
1046         UIWebTouchEventsGestureRecognizer.activeTouchesByIdentifier to
1047         SPI"
1048         https://bugs.webkit.org/show_bug.cgi?id=194531
1049         https://trac.webkit.org/changeset/241433
1050
1051 2019-02-12  Antoine Quint  <graouts@apple.com>
1052
1053         Move UIWebTouchEventsGestureRecognizer.activeTouchesByIdentifier to SPI
1054         https://bugs.webkit.org/show_bug.cgi?id=194531
1055         <rdar://problem/47714562>
1056
1057         Reviewed by Dean Jackson.
1058
1059         * Platform/spi/ios/UIKitSPI.h:
1060         * UIProcess/ios/WKContentViewInteraction.mm:
1061         (-[WKContentView cancelPointersForGestureRecognizer:]): We update the referenced Radar since we need to keep the call
1062         to respondsToSelector until the SPI has shipped for OpenSource builds to work.
1063
1064 2019-02-13  Antoine Quint  <graouts@apple.com>
1065
1066         Support simulated mouse events on iOS based on a PlatformTouchEvent
1067         https://bugs.webkit.org/show_bug.cgi?id=194501
1068         <rdar://problem/46910790>
1069
1070         Reviewed by Dean Jackson.
1071
1072         Add two new internal runtime flags to control whether simulated mouse events should be dipatched along with touch events and whether
1073         simulated mousemove events dispatched should automatically trigger the behavior preventDefault() would also trigger. We also ensure
1074         that we correctly create touch tracking regions for mouse events.
1075
1076         * Shared/WebPreferences.yaml:
1077         * UIProcess/WebPageProxy.cpp:
1078         (WebKit::WebPageProxy::updateTouchEventTracking):
1079
1080 2019-02-13  Ryosuke Niwa  <rniwa@webkit.org>
1081
1082         Crash in Page::setActivityState because m_page is null
1083         https://bugs.webkit.org/show_bug.cgi?id=194584
1084
1085         Reviewed by Antti Koivisto.
1086
1087         Add a null check to avoid the crash. Also add a debug assertion to help diagnose this in the future.
1088
1089         * WebProcess/WebPage/WebPage.cpp:
1090         (WebKit::WebPage::setActivityState):
1091
1092 2019-02-13  Ryosuke Niwa  <rniwa@webkit.org>
1093
1094         Release assert in PolicyCheckIdentifier::isValidFor via WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction
1095         https://bugs.webkit.org/show_bug.cgi?id=194582
1096
1097         Reviewed by Antti Koivisto.
1098
1099         The bug was caused by WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction invoking the callback
1100         with responseIdentifier even when we had failed to send the policy check IPC. Clearly, responseIdentifier
1101         is invalid in that case, and we should be using requestIdentifier instead.
1102
1103         Unfortunately no new tests since I'm not aware of a way to make sendSync fail in this case.
1104
1105         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1106         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
1107
1108 2019-02-13  Benjamin Poulain  <benjamin@webkit.org>
1109
1110         Responsiveness timers are too expensive for frequent events
1111         https://bugs.webkit.org/show_bug.cgi?id=194003
1112
1113         Reviewed by Geoffrey Garen.
1114
1115         With each event, we set a responsivness timer to check if the WebProcess
1116         is responsive, and reset the timer when the WebProcess sends an answer.
1117
1118         For frequent events (e.g. wheel events, mouse force events, etc),
1119         we are spamming the kernel with hundreds of timers per second.
1120         That is a bit inefficient.
1121
1122         Another source of inefficiency comes from the timer implementation
1123         itself. Stopping a RunLoop::Timer removes the timer from every mode
1124         and invalidate the timer. It becomes costly since we do it a lot.
1125
1126         With this patch, I tweak ResponsivenessTimer and its use to minimize
1127         how often we schedule system timers.
1128
1129         The first change is to not stop the timer when we get the stop()
1130         calls if we expect more events to come in. Instead, we keep track
1131         if we care about the timeout or not in the attribute "m_waitingForTimer".
1132         When the next event starts, we can reschedule the timer without ever
1133         having told the kernel about the stop.
1134         If there are no next events, the timeout fires but m_waitingForTimer
1135         is false. To avoid idle wake up, the lazy stop is only used when having
1136         following events is common.
1137
1138         The second improvements comes from not even rescheduling the timer
1139         when restarted. Instead of changing the timer, we let the original timer
1140         fire and re-shedule a new one with the missing time.
1141
1142         For more context, also see patches r240759 and r240944.
1143
1144         * UIProcess/ResponsivenessTimer.cpp:
1145         (WebKit::ResponsivenessTimer::ResponsivenessTimer):
1146         (WebKit::ResponsivenessTimer::invalidate):
1147         (WebKit::ResponsivenessTimer::timerFired):
1148         (WebKit::ResponsivenessTimer::start):
1149         (WebKit::ResponsivenessTimer::startWithLazyStop):
1150         (WebKit::ResponsivenessTimer::stop):
1151         (WebKit::ResponsivenessTimer::processTerminated):
1152         (WebKit::ResponsivenessTimer::~ResponsivenessTimer): Deleted.
1153         * UIProcess/ResponsivenessTimer.h:
1154         (WebKit::ResponsivenessTimer::hasActiveTimer const):
1155         * UIProcess/WebPageProxy.cpp:
1156         (WebKit::WebPageProxy::processNextQueuedMouseEvent):
1157         (WebKit::WebPageProxy::sendWheelEvent):
1158         (WebKit::WebPageProxy::handleKeyboardEvent):
1159         (WebKit::WebPageProxy::handleGestureEvent):
1160         * UIProcess/WebProcessProxy.cpp:
1161         (WebKit::WebProcessProxy::isResponsiveWithLazyStop):
1162         * UIProcess/WebProcessProxy.h:
1163
1164 2019-02-12  Tim Horton  <timothy_horton@apple.com>
1165
1166         Null deref in userInterfaceLayoutDirection under ViewGestureController::handleSwipeGesture
1167         https://bugs.webkit.org/show_bug.cgi?id=194569
1168         <rdar://problem/46711049>
1169
1170         Reviewed by Wenson Hsieh.
1171
1172         * UIProcess/mac/ViewGestureControllerMac.mm:
1173         (WebKit::ViewGestureController::handleSwipeGesture):
1174         It is conceivable that we could get here if the client closes the page
1175         e.g. in the callback from willEndSwipeGesture. We already guarded against
1176         this ... one line too late! Rearrange the lines so we don't call into
1177         WebPageProxy at all if we don't have a drawing area (which is a strict subset
1178         of the time that isValid would return true). This is a speculative fix,
1179         since I can no longer reproduce the crash on demand.
1180
1181 2019-02-12  Youenn Fablet  <youenn@apple.com>
1182
1183         WebServiceWorkerProvider::handleFetch no longer needs a CachedResource parameter
1184         https://bugs.webkit.org/show_bug.cgi?id=194548
1185
1186         Reviewed by Alex Christensen.
1187
1188         * WebProcess/Network/WebLoaderStrategy.cpp:
1189         (WebKit::WebLoaderStrategy::scheduleLoad):
1190         * WebProcess/Storage/WebServiceWorkerProvider.cpp:
1191         (WebKit::WebServiceWorkerProvider::handleFetch):
1192         * WebProcess/Storage/WebServiceWorkerProvider.h:
1193
1194 2019-02-12  Tim Horton  <timothy_horton@apple.com>
1195
1196         Remove WKLegacyPDFView
1197         https://bugs.webkit.org/show_bug.cgi?id=194559
1198
1199         Reviewed by Andy Estes.
1200
1201         * Platform/spi/ios/CorePDFSPI.h: Removed.
1202         * SourcesCocoa.txt:
1203         * UIProcess/Cocoa/WKWebViewContentProviderRegistry.mm:
1204         (-[WKWebViewContentProviderRegistry initWithConfiguration:]):
1205         * UIProcess/ios/WKLegacyPDFView.h: Removed.
1206         * UIProcess/ios/WKLegacyPDFView.mm: Removed.
1207         * WebKit.xcodeproj/project.pbxproj:
1208
1209 2019-02-12  Chris Dumez  <cdumez@apple.com>
1210
1211         Regression(PSON) MESSAGE_CHECK() hit under WebPageProxy::didFailProvisionalLoadForFrameShared()
1212         https://bugs.webkit.org/show_bug.cgi?id=194568
1213         <rdar://problem/47944490>
1214
1215         Reviewed by Ryosuke Niwa.
1216
1217         When the provisional process crashes, it is unsafe to call ProvisionalPageProxy::cancel() because
1218         the WebProcessProxy clears its frame map as soon as the process crashes. Calling cancel() after
1219         that would call WebPageProxy::didFailProvisionalLoadForFrameShared(), which would try to look up
1220         the frame by ID and MESSAGE_CHECK() that the frame is not null. We would fail this check since
1221         the frame has been removed from the WebProcessProxy at this point.
1222
1223         * UIProcess/API/Cocoa/WKWebView.mm:
1224         (-[WKWebView _provisionalWebProcessIdentifier]):
1225         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1226         * UIProcess/WebPageProxy.cpp:
1227         (WebKit::WebPageProxy::didFailProvisionalLoadForFrameShared):
1228         (WebKit::WebPageProxy::provisionalProcessDidTerminate):
1229
1230 2019-02-12  Per Arne Vollan  <pvollan@apple.com>
1231
1232         [iOS] Youtube fails to play.
1233         https://bugs.webkit.org/show_bug.cgi?id=194565
1234         <rdar://problem/47974770>
1235
1236         Reviewed by Geoffrey Garen.
1237
1238         This is caused by sandbox violations and was introduced in r240500.
1239
1240         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
1241
1242 2019-02-12  Alex Christensen  <achristensen@webkit.org>
1243
1244         Remove firing assertion after r241317
1245         https://bugs.webkit.org/show_bug.cgi?id=194506
1246
1247         * WebProcess/Network/WebLoaderStrategy.cpp:
1248         (WebKit::WebLoaderStrategy::setDefersLoading):
1249         The creation of a PageGroupLoadDeferrer in Chrome.cpp tries to defer loading.
1250         See comments in Chrome::runJavaScriptAlert et al.
1251         This was necessary with WebKitLegacy, so keep it, but it doesn't need to do anything in modern WebKit.
1252
1253 2019-02-12  Tim Horton  <timothy_horton@apple.com>
1254
1255         Find on Page shouldn't zoom in on matches
1256         https://bugs.webkit.org/show_bug.cgi?id=194557
1257         <rdar://problem/42087017>
1258
1259         Reviewed by Wenson Hsieh.
1260
1261         * UIProcess/ios/SmartMagnificationController.h:
1262         * UIProcess/ios/SmartMagnificationController.messages.in:
1263         * UIProcess/ios/SmartMagnificationController.mm:
1264         (WebKit::SmartMagnificationController::scrollToRect):
1265         * WebProcess/WebPage/ios/FindControllerIOS.mm:
1266         (WebKit::FindController::updateFindIndicator):
1267         Only scroll to reveal the find result, do not zoom in.
1268
1269 2019-02-12  Wenson Hsieh  <wenson_hsieh@apple.com>
1270
1271         Allow pages to trigger programmatic paste from script on iOS
1272         https://bugs.webkit.org/show_bug.cgi?id=194271
1273         <rdar://problem/47808810>
1274
1275         Reviewed by Tim Horton.
1276
1277         Cancel the pending DOM paste access handler when the menu is about to hide, rather than when the hiding
1278         animation has completed. This ensures that if the page (on behalf of the user) requests DOM paste again during
1279         user interaction before the callout bar has finished fading after the previous DOM paste, we won't automatically
1280         cancel the incoming DOM paste access request because the callout bar animation finished.
1281
1282         This scenario is exercised in the layout test editing/pasteboard/ios/dom-paste-consecutive-confirmations.html.
1283
1284         * Platform/spi/ios/UIKitSPI.h:
1285         * UIProcess/ios/WKContentViewInteraction.mm:
1286         (-[WKContentView setupInteraction]):
1287         (-[WKContentView _willHideMenu:]):
1288         (-[WKContentView _didHideMenu:]):
1289
1290 2019-02-12  Chris Fleizach  <cfleizach@apple.com>
1291
1292         AX: IsolatedTree: Implement more attributes
1293         https://bugs.webkit.org/show_bug.cgi?id=193911
1294         <rdar://problem/47599217>
1295
1296         Reviewed by Daniel Bates.
1297
1298         * Platform/spi/mac/AccessibilityPrivSPI.h: Added.
1299         * WebKit.xcodeproj/project.pbxproj:
1300         * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectBase.h:
1301         * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectBase.mm:
1302         (-[WKAccessibilityWebPageObjectBase clientSupportsIsolatedTree]):
1303         (-[WKAccessibilityWebPageObjectBase isolatedTreeRootObject]):
1304         (-[WKAccessibilityWebPageObjectBase accessibilityRootObjectWrapper]):
1305         * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectMac.mm:
1306         (-[WKAccessibilityWebPageObject IGNORE_WARNINGS_END]):
1307         (-[WKAccessibilityWebPageObject convertScreenPointToRootView:]):
1308         (-[WKAccessibilityWebPageObject accessibilityAttributeValue:]):
1309         (-[WKAccessibilityWebPageObject accessibilityAttributeSizeValue]):
1310         (-[WKAccessibilityWebPageObject accessibilityAttributePositionValue]):
1311         (-[WKAccessibilityWebPageObject accessibilityDataDetectorValue:point:]):
1312         (-[WKAccessibilityWebPageObject accessibilityAttributeValue:forParameter:]):
1313         (-[WKAccessibilityWebPageObject accessibilityHitTest:]):
1314
1315 2019-02-12  Wenson Hsieh  <wenson_hsieh@apple.com>
1316
1317         Allow pages to trigger programmatic paste from script on iOS
1318         https://bugs.webkit.org/show_bug.cgi?id=194271
1319         <rdar://problem/47808810>
1320
1321         Reviewed by Ryosuke Niwa.
1322
1323         * Shared/WebPreferences.yaml:
1324         * Shared/WebPreferencesDefaultValues.h:
1325
1326         Add an internal setting to enable or disable DOM paste access requests. This is on by default in iOS only
1327         (excluding watchOS and Apple TV), and is additionally disabled on macOS.
1328
1329         * UIProcess/API/gtk/PageClientImpl.cpp:
1330         (WebKit::PageClientImpl::requestDOMPasteAccess):
1331         * UIProcess/API/gtk/PageClientImpl.h:
1332         * UIProcess/API/wpe/PageClientImpl.cpp:
1333         (WebKit::PageClientImpl::requestDOMPasteAccess):
1334
1335         Plumb DOM paste access requests from the web process (WebEditorClient) to the view (WKContentView). As per the
1336         usual, this involves WebEditorClient, WebPage, WebPageProxy, PageClient and finally WKContentView.
1337
1338         * UIProcess/API/wpe/PageClientImpl.h:
1339         * UIProcess/PageClient.h:
1340         * UIProcess/WebPageProxy.cpp:
1341         (WebKit::WebPageProxy::requestDOMPasteAccess):
1342         * UIProcess/WebPageProxy.h:
1343         * UIProcess/WebPageProxy.messages.in:
1344         * UIProcess/ios/PageClientImplIOS.h:
1345         * UIProcess/ios/PageClientImplIOS.mm:
1346         (WebKit::PageClientImpl::requestDOMPasteAccess):
1347         * UIProcess/ios/WKContentViewInteraction.h:
1348         * UIProcess/ios/WKContentViewInteraction.mm:
1349         (-[WKContentView setupInteraction]):
1350         (-[WKContentView cleanupInteraction]):
1351         (-[WKContentView resignFirstResponderForWebView]):
1352         (-[WKContentView _webTouchEventsRecognized:]):
1353
1354         Bail from any pending DOM paste access handler the moment we start handling touches on the web view, or if the
1355         web view resigns first responder, or if the web process crashes.
1356
1357         (-[WKContentView textInteractionGesture:shouldBeginAtPoint:]):
1358
1359         Reject text selection gestures while waiting for DOM paste access.
1360
1361         (-[WKContentView canPerformAction:withSender:]):
1362         (-[WKContentView canPerformActionForWebView:withSender:]):
1363
1364         If we're handling a DOM paste, always return YES to allow the callout bar to show the "Paste" option.
1365
1366         (-[WKContentView _didHideMenu:]):
1367
1368         If the menu is programmatically hidden by the app while handling a DOM paste request, immediately reject the DOM
1369         paste request.
1370
1371         (-[WKContentView pasteForWebView:]):
1372
1373         Adjust -pasteForWebView: on WKContentView to first check whether there's an outstanding DOM paste completion
1374         handler to invoke, instead of telling the page to execute a paste command.
1375
1376         (-[WKContentView _handleDOMPasteRequestWithResult:]):
1377
1378         Add a helper to take and invoke the current DOM paste completion handler (if it exists) with the given result,
1379         and then dismiss the shared callout bar. Returns whether or not the paste completion handler exists. Invoked
1380         from various sources of user interaction or significant state changes (e.g. following a web process crash in
1381         -cleanupInteraction).
1382
1383         (-[WKContentView _willPerformAction:sender:]):
1384         (-[WKContentView _didPerformAction:sender:]):
1385
1386         Add hooks to detect when WKContentView is executing an editing action. This is to ensure that the page doesn't
1387         get stuck in a bad state in the case where WKWebView has been subclassed, overrides `-paste:`, and does not
1388         invoke the superclass method (which calls back into `-[WKContentView pasteForWebView:]`). There are a few
1389         possibilities here:
1390         1. WKWebView's `-paste:` action is not overridden. In this case, we will call back into `-pasteForWebView:`,
1391            which will notice that we have a pending paste completion handler and invoke it.
1392         2. WKWebView's `-paste:` action is overridden and does not call back into the content view. In this case, we
1393            will invoke the paste completion handler in `-_didPerformAction:sender:`.
1394         3. WKWebView's `-canPerformAction:withSender:` is overridden to include additional actions. In this case, we may
1395            get a call to invoke a different action selector while waiting for a potential paste action. If this happens,
1396            prevent the DOM paste in `-_willPerformAction:sender:` prior to handling the other action.
1397
1398         (-[WKContentView handleKeyWebEvent:withCompletionHandler:]):
1399
1400         Dismiss DOM paste UI upon handling any key event.
1401
1402         (-[WKContentView showGlobalMenuControllerInRect:]):
1403         (-[WKContentView hideGlobalMenuController]):
1404
1405         Helper methods to present and dismiss the global UIMenuController, that accounts for available platform APIs for
1406         presenting or dismissing the menu controller on iOS.
1407
1408         (-[WKContentView _requestDOMPasteAccessWithElementRect:completionHandler:]):
1409
1410         Attempt to find a good target presentation rect when showing the callout menu. First, we will try to use the
1411         rect of the element the user has interacted with when triggering the paste. If such an element is too large or
1412         does not exist, we fall back to presenting the callout menu near the user's last touch location (with a small
1413         amount of margin, such that the action doesn't overlap with the user's finger, stylus, etc.).
1414
1415         (-[WKContentView _resetShowingTextStyle:]): Deleted.
1416
1417         Rename this to `-_didHideMenu:`.
1418
1419         * UIProcess/mac/PageClientImplMac.h:
1420         * UIProcess/win/PageClientImpl.cpp:
1421         (WebKit::PageClientImpl::requestDOMPasteAccess):
1422         * UIProcess/win/PageClientImpl.h:
1423         * WebProcess/WebCoreSupport/WebEditorClient.cpp:
1424         (WebKit::WebEditorClient::requestDOMPasteAccess):
1425         * WebProcess/WebCoreSupport/WebEditorClient.h:
1426         * WebProcess/WebPage/WebPage.cpp:
1427         (WebKit::WebPage::requestDOMPasteAccess):
1428
1429         Add more plumbing and method stubs.
1430
1431         (WebKit::WebPage::updateCurrentModifierState):
1432         (WebKit::WebPage::rectForElementAtInteractionLocation const):
1433         * WebProcess/WebPage/WebPage.h:
1434         * WebProcess/WebPage/ios/WebPageIOS.mm:
1435         (WebKit::WebPage::rectForElementAtInteractionLocation const):
1436         (WebKit::WebPage::rectForElementAtInteractionLocation): Deleted.
1437
1438         Mark this method as const, add a platform-agnostic stub, and adopt it for the purposes of determining where to
1439         position the callout bar when pasting.
1440
1441 2019-02-12  Alex Christensen  <achristensen@webkit.org>
1442
1443         Remove setDefersLoading infrastructure from WebKit2
1444         https://bugs.webkit.org/show_bug.cgi?id=194506
1445
1446         Reviewed by Brady Eidson.
1447
1448         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
1449         (WebKit::NetworkConnectionToWebProcess::setDefersLoading): Deleted.
1450         * NetworkProcess/NetworkConnectionToWebProcess.h:
1451         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
1452         * NetworkProcess/NetworkDataTask.h:
1453         * NetworkProcess/NetworkDataTaskBlob.cpp:
1454         (WebKit::NetworkDataTaskBlob::suspend): Deleted.
1455         * NetworkProcess/NetworkDataTaskBlob.h:
1456         * NetworkProcess/NetworkLoad.cpp:
1457         (WebKit::NetworkLoad::initialize):
1458         (WebKit::NetworkLoad::setDefersLoading): Deleted.
1459         * NetworkProcess/NetworkLoad.h:
1460         * NetworkProcess/NetworkLoadParameters.h:
1461         * NetworkProcess/NetworkResourceLoadParameters.cpp:
1462         (WebKit::NetworkResourceLoadParameters::encode const):
1463         (WebKit::NetworkResourceLoadParameters::decode):
1464         * NetworkProcess/NetworkResourceLoader.cpp:
1465         (WebKit::NetworkResourceLoader::start):
1466         (WebKit::NetworkResourceLoader::startNetworkLoad):
1467         (WebKit::NetworkResourceLoader::setDefersLoading): Deleted.
1468         * NetworkProcess/NetworkResourceLoader.h:
1469         * NetworkProcess/cocoa/NetworkDataTaskCocoa.h:
1470         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
1471         (WebKit::NetworkDataTaskCocoa::suspend): Deleted.
1472         * NetworkProcess/curl/NetworkDataTaskCurl.cpp:
1473         (WebKit::NetworkDataTaskCurl::suspend): Deleted.
1474         * NetworkProcess/curl/NetworkDataTaskCurl.h:
1475         * NetworkProcess/soup/NetworkDataTaskSoup.cpp:
1476         (WebKit::NetworkDataTaskSoup::suspend): Deleted.
1477         * NetworkProcess/soup/NetworkDataTaskSoup.h:
1478         * WebProcess/Network/WebLoaderStrategy.cpp:
1479         (WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess):
1480         (WebKit::WebLoaderStrategy::setDefersLoading):
1481
1482 2019-02-12  Michael Catanzaro  <mcatanzaro@igalia.com>
1483
1484         Unreviewed, fix build warnings after content extensions enablement
1485         https://bugs.webkit.org/show_bug.cgi?id=193622
1486         <rdar://problem/47982850>
1487
1488         * UIProcess/API/C/WKUserContentExtensionStoreRef.cpp:
1489         (toResult):
1490
1491 2019-02-12  Tim Horton  <timothy_horton@apple.com>
1492
1493         Switching focus from a UITextField to an editable WKWebView causes the keyboard to dance
1494         https://bugs.webkit.org/show_bug.cgi?id=194524
1495         <rdar://problem/35481797>
1496
1497         Reviewed by Wenson Hsieh.
1498
1499         * Platform/spi/ios/UIKitSPI.h:
1500         * UIProcess/ios/InputViewUpdateDeferrer.h:
1501         * UIProcess/ios/InputViewUpdateDeferrer.mm:
1502         (WebKit::InputViewUpdateDeferrer::InputViewUpdateDeferrer):
1503         (WebKit::InputViewUpdateDeferrer::~InputViewUpdateDeferrer):
1504         Make use of the per-responder and much safer input view pinning mechanism.
1505
1506         * UIProcess/ios/WKContentViewInteraction.mm:
1507         (-[WKContentView becomeFirstResponderForWebView]):
1508         (-[WKContentView _singleTapCommited:]):
1509         (-[WKContentView _attemptClickAtLocation:modifierFlags:]):
1510         Always temporarily pin input views when becoming first responder; there are
1511         many paths (such as through the text interaction assistant) that can
1512         focus us on tap, trying to cover them all is a fool's errand. We'll
1513         just get out the big hammer and call it in becomeFirstResponder.
1514         This also means we can remove it from _singleTapCommitted and _attemptClick...
1515
1516         (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
1517         Don't release the input view pinning until we return from _elementDidFocus;
1518         it does the rebuilding synchronously, so we need to have actually updated
1519         all of the prerequisites of -inputView before depinning.
1520
1521 2019-02-12  Youenn Fablet  <youenn@apple.com>
1522
1523         Make use of is<SubresourceLoader>
1524         https://bugs.webkit.org/show_bug.cgi?id=194541
1525
1526         Reviewed by Alex Christensen.
1527
1528         * WebProcess/Network/WebLoaderStrategy.cpp:
1529         (WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess):
1530
1531 2019-02-12  Alex Christensen  <achristensen@webkit.org>
1532
1533         WebPage::close needs to remove all message receivers associated with that WebPage, not WebPage::~WebPage
1534         https://bugs.webkit.org/show_bug.cgi?id=194522
1535         <rdar://problem/47789393>
1536
1537         Reviewed by Chris Dumez.
1538
1539         The InjectedBundle SPI can retain the WebPage or wrapping objects (WKWebProcessPlugInBrowserContextController/WKBundlePageRef).
1540         This can make it so WebPage::close is called before WebPage::~WebPage, and if the SuspendedPageProxy is reused for a subsequent
1541         navigation to the same domain, the WebProcess is reused with a different WebPage instance with the same PageID, which causes problems
1542         when another WebPage registers message handlers and then the previous WebPage is destroyed, which removes both message handlers.
1543
1544         * WebProcess/WebPage/WebPage.cpp:
1545         (WebKit::WebPage::~WebPage):
1546         (WebKit::WebPage::close):
1547         (WebKit::WebPage::mainFrameDidLayout):
1548         * WebProcess/WebPage/WebPage.h:
1549         * WebProcess/WebProcess.h:
1550         (WebKit::WebProcess::eventDispatcher):
1551
1552 2019-02-12  Michael Catanzaro  <mcatanzaro@igalia.com>
1553
1554         [WPE][GTK] Unsafe g_unsetenv() use in WebProcessPool::platformInitialize
1555         https://bugs.webkit.org/show_bug.cgi?id=194370
1556
1557         Reviewed by Darin Adler.
1558
1559         It is incorrect to use g_unsetenv() here because it is MT-Unsafe. We know that it is
1560         impossible and unreasonable to expect the application has not started other threads at this
1561         point, and threads will be calling getenv(). WebKit itself has probably already started
1562         threads of its own.
1563
1564         Fortunately, the remote inspector in the web process is already prepared to deal with
1565         failure to connect to the inspector server, so we don't need to do anything except stop
1566         messing with the environment.
1567
1568         Note these files are copies of each other. I'll merge them together in a follow-up patch.
1569
1570         * UIProcess/gtk/WebProcessPoolGtk.cpp:
1571         (WebKit::initializeRemoteInspectorServer):
1572         (WebKit::WebProcessPool::platformInitialize):
1573         * UIProcess/wpe/WebProcessPoolWPE.cpp:
1574         (WebKit::initializeRemoteInspectorServer):
1575         (WebKit::WebProcessPool::platformInitialize):
1576
1577 2019-02-08  Beth Dakin  <bdakin@apple.com>
1578
1579         Ensure old binaries have old snapshotting behaviors
1580         https://bugs.webkit.org/show_bug.cgi?id=194449
1581         -and corresponding-
1582         rdar://problem/47931954
1583
1584         Reviewed by Darin Adler.
1585
1586         Make sure that a nil configuration behaves the same way that it used to on apps 
1587         that were linked before FirstWithSnapshotAfterScreenUpdates
1588
1589         * UIProcess/API/Cocoa/WKWebView.mm:
1590         (-[WKWebView takeSnapshotWithConfiguration:completionHandler:]):
1591         * UIProcess/Cocoa/VersionChecks.h:
1592
1593 2019-02-12  Andy Estes  <aestes@apple.com>
1594
1595         [iOSMac] Enable Parental Controls Content Filtering
1596         https://bugs.webkit.org/show_bug.cgi?id=194521
1597         <rdar://39732376>
1598
1599         Reviewed by Tim Horton.
1600
1601         * Configurations/FeatureDefines.xcconfig:
1602
1603 2019-02-11  Alex Christensen  <achristensen@webkit.org>
1604
1605         Remove noisy and unnecessary logs added in r241223
1606         https://bugs.webkit.org/show_bug.cgi?id=194427
1607
1608         * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
1609         (WebKit::ProcessLauncher::launchProcess):
1610         Errors occur all the time in the XPC connection's event handler, like when a process terminates.
1611         We don't need to print an "error" every time any process terminates.
1612
1613 2019-02-11  Brian Burg  <bburg@apple.com>
1614
1615         [Cocoa] Web Automation: client callbacks are not called if delegate does not override
1616         https://bugs.webkit.org/show_bug.cgi?id=194519
1617         <rdar://problem/47981961>
1618
1619         Reviewed by Joseph Pecoraro.
1620
1621         Call the completion handler directly if the delegate does not implement the relevant method.
1622
1623         * UIProcess/Cocoa/AutomationSessionClient.mm:
1624         (WebKit::AutomationSessionClient::requestNewPageWithOptions):
1625         (WebKit::AutomationSessionClient::requestSwitchToPage):
1626         (WebKit::AutomationSessionClient::requestHideWindowOfPage):
1627         (WebKit::AutomationSessionClient::requestRestoreWindowOfPage):
1628         (WebKit::AutomationSessionClient::requestMaximizeWindowOfPage):
1629
1630 2019-02-11  Daniel Bates  <dabates@apple.com>
1631
1632         [iOS] Adopt SPI to support Emacs bindings: transpose and delete to end of paragraph
1633         https://bugs.webkit.org/show_bug.cgi?id=194505
1634         <rdar://problem/47743533>
1635
1636         Reviewed by Tim Horton.
1637
1638         * UIProcess/ios/WKContentViewInteraction.mm:
1639         (-[WKContentView _deleteToEndOfParagraph]): Added.
1640         (-[WKContentView _transpose]): Added.
1641
1642 2019-02-11  Adrian Perez de Castro  <aperez@igalia.com>
1643
1644         [GTK][WPE] Add content extensions support in WKTR and unskip layout tests
1645         https://bugs.webkit.org/show_bug.cgi?id=193622
1646
1647         Reviewed by Michael Catanzaro.
1648
1649         * NetworkProcess/cache/NetworkCacheData.h: Define an adoptAndMapFile() implementation
1650         for GFileIOStream objects.
1651         * NetworkProcess/cache/NetworkCacheDataSoup.cpp:
1652         (WebKit::NetworkCache::adoptAndMapFile): Added implementation, which extracts the file
1653         descriptor from a GFileIOStream, as it inherits from GFileDescriptorBased, and then
1654         reuses the version of adoptAndMapFile() which takes a file descritor for the actual work.
1655         * NetworkProcess/NetworkLoadChecker.cpp:
1656         (Webkit::NetworkLoadChecker::checkRequest): Use "this" when referring to
1657         processContentExtensionRulesForLoad() in order to avoid ambiguity.
1658         * Sources.txt: Add WKUserContentExtensionStoreRef.cpp, all ports use it now.
1659         * SourcesCocoa.txt: Remove WKUserContentExtensionStoreRef.cpp, because it is not
1660         Cocoa-specific anymore.
1661         * SourcesGTK.txt: Add APIContentRuleListStoreGLib.cpp.
1662         * SourcesWPE.txt: Ditto.
1663         * UIProcess/API/C/WKUserContentExtensionStoreRef.cpp:
1664         (WKUserContentExtensionStoreCreate): Added.
1665         (toResult): Added.
1666         (WKUserContentExtensionStoreCompile): Added.
1667         (WKUserContentExtensionStoreLookup): Added.
1668         (WKUserContentExtensionStoreRemove): Added.
1669         * UIProcess/API/C/WKUserContentExtensionStoreRef.h: Add declarations for the new C API
1670         functions and for the WKUserContentExtensionStoreResult status enum.
1671         * UIProcess/API/glib/APIContentRuleListStoreGLib.cpp: Added.
1672         (API::ContentRuleListStore::defaultStorePath): Add a dummy implementation. The public API
1673         for the GLib based ports (GTK+ and WPE) will not allow using the default store and will
1674         always indicating a path.
1675
1676 2019-02-11  Daniel Bates  <dabates@apple.com>
1677
1678         [iOS] Mouse/Touch/Pointer events are missing modifier keys
1679         https://bugs.webkit.org/show_bug.cgi?id=191446
1680         <rdar://problem/45929460>
1681
1682         Reviewed by Tim Horton.
1683
1684         Make use of UIKit SPI to retreive the modifier flags when dispatching mouse and touch events.
1685         Add new WebKit SPI for iOS, -[WKNavigationAction modifierFlags], to retrieve the the modifier
1686         flags held when a navigation action was initiated.
1687
1688         * Platform/spi/ios/UIKitSPI.h: Expose SPI.
1689         * Shared/NativeWebTouchEvent.h: Re-arrange macro guards so that we can expose the helper function
1690         WebKit::webEventModifierFlags(). This is a bit more involved that usual since this header is included
1691         from both C++ and Objective-C source files. It only makes sense to expose this function when
1692         compiling as part of an Objective-C source file.
1693         * Shared/ios/NativeWebTouchEventIOS.mm:
1694         (WebKit::NativeWebTouchEvent::NativeWebTouchEvent): Modified to take the modifier flags held down
1695         when the platform touch event was received and pass them through to the base constructor.
1696         (WebKit::webEventModifierFlags): Added. Converts from the platform-speciifc UIKeyModifierFlags to
1697         OptionSet<WebKit::WebEvent::Modifier>.
1698         * Shared/ios/WebIOSEventFactory.h:
1699         * Shared/ios/WebIOSEventFactory.mm:
1700         (WebIOSEventFactory::toUIKeyModifierFlags): Added. Converts from OptionSet<WebKit::WebEvent::Modifier>
1701         to the platform-specific UIKeyModifierFlags.
1702         * UIProcess/API/Cocoa/WKNavigationAction.mm:
1703         (-[WKNavigationAction modifierFlags]): Added.
1704         * UIProcess/API/Cocoa/WKNavigationActionPrivate.h:
1705         * UIProcess/WebPageProxy.h:
1706         * UIProcess/ios/WKContentViewInteraction.h:
1707         * UIProcess/ios/WKContentViewInteraction.mm:
1708         (gestureRecognizerModifierFlags): Added.
1709
1710         (-[WKContentView _webTouchEventsRecognized:]):
1711         (-[WKContentView _highlightLongPressRecognized:]):
1712         (-[WKContentView _twoFingerSingleTapGestureRecognized:]):
1713         (-[WKContentView _singleTapCommited:]):
1714         Pass modifier flags through.
1715
1716         (-[WKContentView _attemptClickAtLocation:modifierFlags:]): Added.
1717         (-[WKContentView actionSheetAssistant:openElementAtLocation:]): This is invoked when a person opens a link
1718         via the action sheet. We don't have access to the modifier flags to pass. It also seems like an implementation
1719         detail that this action is implemented via mouse click and we should re-evaluate this decision in light of
1720         the fact tht the action sheet is browser UI and we tend to be very reserved on what UI actions are visible
1721         to the page. On Mac, opening a link via the context menu is not visible to the page, at least from a mouse
1722         event perspective.
1723         (webEventFlagsForUIKeyModifierFlags): Added.
1724         (-[WKContentView _hoverGestureRecognizerChanged:]): Pass modifier flags through.
1725         (-[WKContentView _attemptClickAtLocation:]): Deleted.
1726         * UIProcess/ios/WebPageProxyIOS.mm:
1727         (WebKit::WebPageProxy::handleTwoFingerTapAtPoint):
1728         (WebKit::WebPageProxy::commitPotentialTap):
1729         (WebKit::WebPageProxy::handleTap):
1730         * WebProcess/WebPage/WebPage.h:
1731         * WebProcess/WebPage/WebPage.messages.in:
1732         * WebProcess/WebPage/ios/WebPageIOS.mm:
1733         (WebKit::WebPage::handleSyntheticClick):
1734         (WebKit::WebPage::completePendingSyntheticClickForContentChangeObserver):
1735         (WebKit::WebPage::completeSyntheticClick):
1736         (WebKit::WebPage::handleTap):
1737         (WebKit::WebPage::handleTwoFingerTapAtPoint):
1738         (WebKit::WebPage::commitPotentialTap):
1739         Pass modifier flags through.
1740
1741 2019-02-11  Jer Noble  <jer.noble@apple.com>
1742
1743         [Cocoa] Notify AVSystemController of our presenting PID before registering as a Now Playing app.
1744         https://bugs.webkit.org/show_bug.cgi?id=194504
1745
1746         Reviewed by Eric Carlson.
1747
1748         * WebKit.xcodeproj/project.pbxproj:
1749         * WebProcess/WebCoreSupport/WebUserMediaClient.cpp:
1750         (WebKit::WebUserMediaClient::requestUserMediaAccess):
1751         * WebProcess/WebPage/WebPage.cpp:
1752         (WebKit::WebPage::prepareToSendUserMediaPermissionRequest): Deleted.
1753         * WebProcess/WebPage/WebPage.h:
1754         (WebKit::WebPage::userMediaPermissionRequestManager):
1755         * WebProcess/WebPage/ios/WebPageIOS.mm:
1756         (WebKit::WebPage::prepareToSendUserMediaPermissionRequest): Deleted.
1757
1758 2019-02-11  Commit Queue  <commit-queue@webkit.org>
1759
1760         Unreviewed, rolling out r241272 and r241276.
1761         https://bugs.webkit.org/show_bug.cgi?id=194514
1762
1763         Broke the Apple Internal build and the fix requires human
1764         intervention :( (Requested by dydz on #webkit).
1765
1766         Reverted changesets:
1767
1768         "[iOS] Mouse/Touch/Pointer events are missing modifier keys"
1769         https://bugs.webkit.org/show_bug.cgi?id=191446
1770         https://trac.webkit.org/changeset/241272
1771
1772         "Fix internal iOS build after r241272"
1773         https://bugs.webkit.org/show_bug.cgi?id=191446
1774         https://trac.webkit.org/changeset/241276
1775
1776 2019-02-11  Alex Christensen  <achristensen@webkit.org>
1777
1778         Fix internal iOS build after r241272
1779         https://bugs.webkit.org/show_bug.cgi?id=191446
1780
1781         * Platform/spi/ios/UIKitSPI.h:
1782         Declare the _modifierFlags when using the internal SDK also.
1783
1784 2019-02-11  Wenson Hsieh  <wenson_hsieh@apple.com>
1785
1786         fast/forms/ios/force-gregorian-calendar-for-credit-card-expiry.html does not work on iPad
1787         https://bugs.webkit.org/show_bug.cgi?id=194313
1788
1789         Reviewed by Tim Horton.
1790
1791         Make `-dateTimePickerCalendarType` work on iPad by handling the case where the date picker control is a
1792         WKDateTimePopover. This fixes UIScriptController::calendarType() returning null on iPad.
1793
1794         * UIProcess/ios/forms/WKFormInputControl.mm:
1795         (-[WKFormInputControl dateTimePickerCalendarType]):
1796         (-[WKDateTimePopover calendarType]):
1797
1798 2019-02-11  Daniel Bates  <dabates@apple.com>
1799
1800         [iOS] Mouse/Touch/Pointer events are missing modifier keys
1801         https://bugs.webkit.org/show_bug.cgi?id=191446
1802         <rdar://problem/45929460>
1803
1804         Reviewed by Tim Horton.
1805
1806         Make use of UIKit SPI to retreive the modifier flags when dispatching mouse and touch events.
1807         Add new WebKit SPI for iOS, -[WKNavigationAction modifierFlags], to retrieve the the modifier
1808         flags held when a navigation action was initiated.
1809
1810         * Platform/spi/ios/UIKitSPI.h: Expose SPI.
1811         * Shared/NativeWebTouchEvent.h: Re-arrange macro guards so that we can expose the helper function
1812         WebKit::webEventModifierFlags(). This is a bit more involved that usual since this header is included
1813         from both C++ and Objective-C source files. It only makes sense to expose this function when
1814         compiling as part of an Objective-C source file.
1815         * Shared/ios/NativeWebTouchEventIOS.mm:
1816         (WebKit::NativeWebTouchEvent::NativeWebTouchEvent): Modified to take the modifier flags held down
1817         when the platform touch event was received and pass them through to the base constructor.
1818         (WebKit::webEventModifierFlags): Added. Converts from the platform-speciifc UIKeyModifierFlags to
1819         OptionSet<WebKit::WebEvent::Modifier>.
1820         * Shared/ios/WebIOSEventFactory.h:
1821         * Shared/ios/WebIOSEventFactory.mm:
1822         (WebIOSEventFactory::toUIKeyModifierFlags): Added. Converts from OptionSet<WebKit::WebEvent::Modifier>
1823         to the platform-specific UIKeyModifierFlags.
1824         * UIProcess/API/Cocoa/WKNavigationAction.mm:
1825         (-[WKNavigationAction modifierFlags]): Added.
1826         * UIProcess/API/Cocoa/WKNavigationActionPrivate.h:
1827         * UIProcess/WebPageProxy.h:
1828         * UIProcess/ios/WKContentViewInteraction.h:
1829         * UIProcess/ios/WKContentViewInteraction.mm:
1830         (gestureRecognizerModifierFlags): Added.
1831
1832         (-[WKContentView _webTouchEventsRecognized:]):
1833         (-[WKContentView _highlightLongPressRecognized:]):
1834         (-[WKContentView _twoFingerSingleTapGestureRecognized:]):
1835         (-[WKContentView _singleTapCommited:]):
1836         Pass modifier flags through.
1837
1838         (-[WKContentView _attemptClickAtLocation:modifierFlags:]): Added.
1839         (-[WKContentView actionSheetAssistant:openElementAtLocation:]): This is invoked when a person opens a link
1840         via the action sheet. We don't have access to the modifier flags to pass. It also seems like an implementation
1841         detail that this action is implemented via mouse click and we should re-evaluate this decision in light of
1842         the fact tht the action sheet is browser UI and we tend to be very reserved on what UI actions are visible
1843         to the page. On Mac, opening a link via the context menu is not visible to the page, at least from a mouse
1844         event perspective.
1845         (webEventFlagsForUIKeyModifierFlags): Added.
1846         (-[WKContentView _hoverGestureRecognizerChanged:]): Pass modifier flags through.
1847         (-[WKContentView _attemptClickAtLocation:]): Deleted.
1848         * UIProcess/ios/WebPageProxyIOS.mm:
1849         (WebKit::WebPageProxy::handleTwoFingerTapAtPoint):
1850         (WebKit::WebPageProxy::commitPotentialTap):
1851         (WebKit::WebPageProxy::handleTap):
1852         * WebProcess/WebPage/WebPage.h:
1853         * WebProcess/WebPage/WebPage.messages.in:
1854         * WebProcess/WebPage/ios/WebPageIOS.mm:
1855         (WebKit::WebPage::handleSyntheticClick):
1856         (WebKit::WebPage::completePendingSyntheticClickForContentChangeObserver):
1857         (WebKit::WebPage::completeSyntheticClick):
1858         (WebKit::WebPage::handleTap):
1859         (WebKit::WebPage::handleTwoFingerTapAtPoint):
1860         (WebKit::WebPage::commitPotentialTap):
1861         Pass modifier flags through.
1862
1863 2019-02-11  Youenn Fablet  <youenn@apple.com>
1864
1865         Filter out Overconstrainederror.constraint when getUserMedia is not granted
1866         https://bugs.webkit.org/show_bug.cgi?id=194240
1867
1868         Reviewed by Eric Carlson.
1869
1870         Make sure in UIProcess to filter out constraint if either the page was not granted gum access or it has no persistent access.
1871
1872         Refactor UserMediaPermissionRequestManagerProxy to make the implementation easier to understand.
1873
1874         Covered by added test.
1875
1876         * UIProcess/UserMediaPermissionCheckProxy.cpp:
1877         (WebKit::UserMediaPermissionCheckProxy::setUserMediaAccessInfo):
1878         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
1879         (WebKit::UserMediaPermissionRequestManagerProxy::captureDevicesChanged):
1880         (WebKit::UserMediaPermissionRequestManagerProxy::userMediaAccessWasGranted):
1881         (WebKit::UserMediaPermissionRequestManagerProxy::grantAccess):
1882         (WebKit::UserMediaPermissionRequestManagerProxy::getRequestAction):
1883         (WebKit::UserMediaPermissionRequestManagerProxy::requestUserMediaPermissionForFrame):
1884         (WebKit::UserMediaPermissionRequestManagerProxy::processUserMediaPermissionRequest):
1885         (WebKit::UserMediaPermissionRequestManagerProxy::processUserMediaPermissionInvalidRequest):
1886         (WebKit::UserMediaPermissionRequestManagerProxy::processUserMediaPermissionValidRequest):
1887         (WebKit::UserMediaPermissionRequestManagerProxy::getUserMediaPermissionInfo):
1888         (WebKit::UserMediaPermissionRequestManagerProxy::wasGrantedVideoOrAudioAccess):
1889         (WebKit::UserMediaPermissionRequestManagerProxy::computeFilteredDeviceList):
1890         (WebKit::UserMediaPermissionRequestManagerProxy::enumerateMediaDevicesForFrame):
1891         (WebKit::UserMediaPermissionRequestManagerProxy::createPermissionRequest): Deleted.
1892         * UIProcess/UserMediaPermissionRequestManagerProxy.h:
1893         * UIProcess/UserMediaPermissionRequestProxy.h:
1894         (WebKit::UserMediaPermissionRequestProxy::isPending const):
1895         (WebKit::UserMediaPermissionRequestProxy::setEligibleVideoDeviceUIDs):
1896         (WebKit::UserMediaPermissionRequestProxy::setEligibleAudioDeviceUIDs):
1897         (WebKit::UserMediaPermissionRequestProxy::hasAudioDevice const):
1898         (WebKit::UserMediaPermissionRequestProxy::hasVideoDevice const):
1899         (WebKit::UserMediaPermissionRequestProxy::hasPersistentAccess const):
1900         (WebKit::UserMediaPermissionRequestProxy::setHasPersistentAccess):
1901         (WebKit::UserMediaPermissionRequestProxy::userMediaID const):
1902         (WebKit::UserMediaPermissionRequestProxy::topLevelDocumentSecurityOrigin const):
1903         (WebKit::UserMediaPermissionRequestProxy::userMediaDocumentSecurityOrigin const):
1904         (WebKit::UserMediaPermissionRequestProxy::userRequest const):
1905         (WebKit::UserMediaPermissionRequestProxy::setDeviceIdentifierHashSalt):
1906         (WebKit::UserMediaPermissionRequestProxy::deviceIdentifierHashSalt const):
1907         (WebKit::UserMediaPermissionRequestProxy::audioDevice const):
1908         (WebKit::UserMediaPermissionRequestProxy::videoDevice const):
1909         * UIProcess/WebPageProxy.cpp:
1910         (WebKit::WebPageProxy::requestUserMediaPermissionForFrame):
1911         * UIProcess/WebPageProxy.h:
1912
1913 2019-02-11  Carlos Garcia Campos  <cgarcia@igalia.com>
1914
1915         [WPE] Do not try to create empty egl windows
1916         https://bugs.webkit.org/show_bug.cgi?id=194497
1917
1918         Reviewed by Žan Doberšek.
1919
1920         In AcceleratedSurfaceWPE we ensure the size we pass to wpe is at least 0x0, but wl_egl_window_create() returns
1921         nullptr if 0 is passed as width or height. We should use at least 1x1 instead.
1922
1923         * WebProcess/WebPage/wpe/AcceleratedSurfaceWPE.cpp:
1924         (WebKit::AcceleratedSurfaceWPE::initialize):
1925         (WebKit::AcceleratedSurfaceWPE::clientResize):
1926
1927 2019-02-10  Carlos Garcia Campos  <cgarcia@igalia.com>
1928
1929         [WPE] Do not use a sync IPC message to send the host FD to the web process
1930         https://bugs.webkit.org/show_bug.cgi?id=194216
1931
1932         Reviewed by Darin Adler.
1933
1934         It can be sent as a web page creation parameter instead.
1935
1936         * PlatformWPE.cmake:
1937         * Shared/WebPageCreationParameters.cpp:
1938         (WebKit::WebPageCreationParameters::encode const):
1939         (WebKit::WebPageCreationParameters::decode):
1940         * Shared/WebPageCreationParameters.h:
1941         * SourcesWPE.txt:
1942         * UIProcess/API/wpe/CompositingManagerProxy.cpp: Removed.
1943         * UIProcess/API/wpe/CompositingManagerProxy.h: Removed.
1944         * UIProcess/API/wpe/CompositingManagerProxy.messages.in: Removed.
1945         * UIProcess/API/wpe/PageClientImpl.cpp:
1946         (WebKit::PageClientImpl::hostFileDescriptor):
1947         * UIProcess/API/wpe/PageClientImpl.h:
1948         * UIProcess/API/wpe/WPEView.cpp:
1949         (WKWPE::m_backend):
1950         * UIProcess/API/wpe/WPEView.h:
1951         (WKWPE::View::create):
1952         * UIProcess/PageClient.h:
1953         * UIProcess/WebPageProxy.cpp:
1954         (WebKit::WebPageProxy::creationParameters):
1955         * WebProcess/WebPage/WebPage.cpp:
1956         (WebKit::m_hostFileDescriptor):
1957         * WebProcess/WebPage/WebPage.h:
1958         (WebKit::WebPage::releaseHostFileDescriptor):
1959         * WebProcess/WebPage/wpe/AcceleratedSurfaceWPE.cpp:
1960         (WebKit::AcceleratedSurfaceWPE::AcceleratedSurfaceWPE):
1961         (WebKit::AcceleratedSurfaceWPE::initialize):
1962         * WebProcess/WebPage/wpe/AcceleratedSurfaceWPE.h:
1963         * WebProcess/WebPage/wpe/CompositingManager.cpp: Removed.
1964         * WebProcess/WebPage/wpe/CompositingManager.h: Removed.
1965
1966 2019-02-04  Carlos Garcia Campos  <cgarcia@igalia.com>
1967
1968         [GTK][WPE] Add enable-javascript-markup setting
1969         https://bugs.webkit.org/show_bug.cgi?id=193439
1970
1971         Reviewed by Michael Catanzaro.
1972
1973         Expose JavaScriptMarkupEnabled setting in the GLib API.
1974
1975         * UIProcess/API/glib/WebKitSettings.cpp:
1976         (webKitSettingsSetProperty):
1977         (webKitSettingsGetProperty):
1978         (webkit_settings_class_init):
1979         (webkit_settings_get_enable_javascript_markup):
1980         (webkit_settings_set_enable_javascript_markup):
1981         * UIProcess/API/gtk/WebKitSettings.h:
1982         * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt:
1983         * UIProcess/API/wpe/WebKitSettings.h:
1984         * UIProcess/API/wpe/docs/wpe-0.1-sections.txt:
1985
1986 2019-02-10  Darin Adler  <darin@apple.com>
1987
1988         Switch uses of StringBuilder with String::format for hex numbers to use HexNumber.h instead
1989         https://bugs.webkit.org/show_bug.cgi?id=194485
1990
1991         Reviewed by Daniel Bates.
1992
1993         * UIProcess/DeviceIdHashSaltStorage.cpp:
1994         (WebKit::DeviceIdHashSaltStorage::completeDeviceIdHashSaltForOriginCall): Use
1995         appendUnsignedAsHex instead of appendUnsigned64AsHex.
1996
1997         * UIProcess/WebBackForwardList.cpp:
1998         (WebKit::WebBackForwardList::loggingString): Use appendUnsignedAsHex and
1999         reinterpret_cast<uintptr_t> instead of String::format and "%p".
2000
2001 2019-02-10  Commit Queue  <commit-queue@webkit.org>
2002
2003         Unreviewed, rolling out r241167.
2004         https://bugs.webkit.org/show_bug.cgi?id=194482
2005
2006         Broke the GTK mediastream tests (Requested by philn on
2007         #webkit).
2008
2009         Reverted changeset:
2010
2011         "Filter out Overconstrainederror.constraint when getUserMedia
2012         is not granted"
2013         https://bugs.webkit.org/show_bug.cgi?id=194240
2014         https://trac.webkit.org/changeset/241167
2015
2016 2019-02-09  Darin Adler  <darin@apple.com>
2017
2018         Eliminate unnecessary String temporaries by using StringConcatenateNumbers
2019         https://bugs.webkit.org/show_bug.cgi?id=194021
2020
2021         Reviewed by Geoffrey Garen.
2022
2023         * NetworkProcess/NetworkResourceLoader.cpp:
2024         (WebKit::escapeIDForJSON): Use an ASCIILiteral to create a String.
2025
2026         * NetworkProcess/cache/NetworkCacheStorage.cpp:
2027         (WebKit::NetworkCache::makeVersionedDirectoryPath): Remove String::number and let
2028         makeString do the conversion without allocating/destroying a String.
2029
2030         * NetworkProcess/mac/RemoteNetworkingContext.mm: Removed "using namespace WebCore".
2031         (WebKit::RemoteNetworkingContext::ensureWebsiteDataStoreSession): Remove String::number
2032         and let makeString do the conversion without allocating/destroying a String.
2033
2034         * NetworkProcess/webrtc/NetworkMDNSRegister.cpp: Removed "using namespace WebCore".
2035         (WebKit::registerMDNSNameCallback): Added explicit WebCore prefix as needed.
2036         (WebKit::NetworkMDNSRegister::registerMDNSName): Ditto. Also remove String::number
2037         and let makeString do the conversion without allocating/destroying a String.
2038
2039         * UIProcess/WebPageGroup.cpp:
2040         (WebKit::pageGroupData): Remove String::number and let makeString do the conversion
2041         without allocating/destroying a String.
2042         * UIProcess/WebPageProxy.cpp:
2043         (WebKit::WebPageProxy::createInspectorTargets): Ditto.
2044         * UIProcess/ios/WKLegacyPDFView.mm:
2045         (-[WKLegacyPDFView _URLForLinkAnnotation:]): Ditto.
2046         * WebProcess/InjectedBundle/InjectedBundleScriptWorld.cpp:
2047         (WebKit::uniqueWorldName): Ditto.
2048         * WebProcess/WebPage/WebPageInspectorTarget.cpp:
2049         (WebKit::WebPageInspectorTarget::identifier const): Ditto.
2050
2051 2019-02-09  Alexander Mikhaylenko  <exalm7659@gmail.com>
2052
2053         [GTK] Fix typo in the newly added API
2054         https://bugs.webkit.org/show_bug.cgi?id=194472
2055
2056         Reviewed by Michael Catanzaro.
2057
2058         Fix a typo: enableed -> enabled.
2059
2060         * UIProcess/API/glib/WebKitSettings.cpp:
2061         (webkit_settings_set_enable_back_forward_navigation_gestures):
2062         * UIProcess/API/gtk/WebKitSettings.h:
2063
2064 2019-02-08  Alex Christensen  <achristensen@webkit.org>
2065
2066         Speculative fix for Mojave API test after r241223
2067         https://bugs.webkit.org/show_bug.cgi?id=194427
2068
2069         * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm:
2070         (WebKit::XPCInitializationHandler):
2071         (WebKit::XPCServiceMain):
2072         Set the __APPLEEVENTSSERVICENAME environment variable before handling any xpc messages like we used to.
2073         I'll worry about making things right in the daemon later.
2074
2075 2019-02-08  Chris Dumez  <cdumez@apple.com>
2076
2077         [WK2][macOS] Avoid creating new CVDisplayLink objects for each WebProcess
2078         https://bugs.webkit.org/show_bug.cgi?id=194463
2079
2080         Reviewed by Tim Horton.
2081
2082         Avoid creating new CVDisplayLink objects for each WebProcess. We really only need one per
2083         display, creating such object is expensive and it is even worse in a PSON world where we
2084         swap process on navigation.
2085
2086         This patch moves the DisplayLink storing from WebProcessProxy to WebProcessPool. Also,
2087         a DisplayLink can now be associated to several IPC connections instead of having a 1:1
2088         mapping. When a DisplayLink no longer has any observers, we now merely stop it instead
2089         of destroying it.
2090
2091         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
2092         (WebKit::WebProcessPool::startDisplayLink):
2093         (WebKit::WebProcessPool::stopDisplayLink):
2094         (WebKit::WebProcessPool::stopDisplayLinks):
2095         * UIProcess/WebProcessPool.h:
2096         * UIProcess/WebProcessProxy.cpp:
2097         (WebKit::WebProcessProxy::~WebProcessProxy):
2098         (WebKit::WebProcessProxy::processWillShutDown):
2099         (WebKit::WebProcessProxy::shutDown):
2100         * UIProcess/WebProcessProxy.h:
2101         * UIProcess/mac/DisplayLink.cpp:
2102         (WebKit::DisplayLink::DisplayLink):
2103         (WebKit::DisplayLink::addObserver):
2104         (WebKit::DisplayLink::removeObserver):
2105         (WebKit::DisplayLink::removeObservers):
2106         (WebKit::DisplayLink::hasObservers const):
2107         (WebKit::DisplayLink::displayLinkCallback):
2108         * UIProcess/mac/DisplayLink.h:
2109         * UIProcess/mac/WebProcessProxyMac.mm:
2110         (WebKit::WebProcessProxy::startDisplayLink):
2111         (WebKit::WebProcessProxy::stopDisplayLink):
2112
2113 2019-02-08  Alexander Mikhaylenko  <exalm7659@gmail.com>
2114
2115         [GTK] Implement back/forward touchpad gesture
2116         https://bugs.webkit.org/show_bug.cgi?id=193919
2117
2118         Reviewed by Michael Catanzaro.
2119
2120         Move ViewSnapshotStore and ViewGestureController from Cocoa/Mac directory
2121         to UIProcess/, also move some parts of mac/ViewGestreControllerMac.mm to
2122         ViewGestureController.cpp, split up Mac- and iOS-specific parts of
2123         ViewSnapshotStore.cpp into mac/ViewSnapshotMac.mm, then implement 2-finger
2124         touchpad swipe back-forward gesture for GTK based on that.
2125
2126         To avoid name conflict, rename existing ViewGestureController class inside
2127         UIProcess/API/gtk/WebKitWebViewBase.cpp into TouchGestureController.
2128
2129         Since GTK gestures can only work with 3 or 4 fingers, treat horizontal
2130         scrolling events as a swipe as long as there's nowhere to scroll in that
2131         direction and web page doesn't handle the scrolling.
2132
2133         This is only allowed for touchpads, even though it can theoretically work
2134         with touch mice and trackpoints.
2135
2136         The gesture requires every item in back-forward list to have a snapshot.
2137         There's already an existing infrastructure for that, so the patch changes
2138         a bunch of #if PLATFORM(COCOA) statements to also check for GTK platform.
2139         The snapshots have to be taken in sync, so the implementation draws webview
2140         widget into a Cairo image surface.
2141
2142         The gesture is disabled by default, and can be enabled by setting the newly
2143         added 'enable-back-forward-navigation-gestures' property in WebKitSettings to
2144         true.
2145
2146         Gesture drawing is implemented via Cairo. When the gesture is active, the
2147         actual page is drawn into a Cairo group, which is then drawn together with
2148         a given snapshot, as well as dimming and a drop shadow over the "lower" layer.
2149
2150         Also add a memory pressure handler that clears snapshot store when low on memory.
2151
2152         * DerivedSources-input.xcfilelist:
2153         * PlatformGTK.cmake:
2154         * PlatformMac.cmake:
2155         * Shared/SessionState.h: Add snapshot to back-forward items for GTK.
2156         * Shared/WebBackForwardListItem.h: Add snapshot to back-forward items for GTK.
2157         * SourcesCocoa.txt:
2158         * SourcesGTK.txt:
2159         * UIProcess/API/glib/WebKitSettings.cpp:
2160         Added 'enable-back-forward-navigation-gestures' property for enabling the gesture.
2161         (webKitSettingsSetProperty):
2162         (webKitSettingsGetProperty):
2163         (webkit_settings_class_init):
2164         (webkit_settings_get_enable_back_forward_navigation_gestures): Added, GTK only.
2165         (webkit_settings_set_enable_back_forward_navigation_gestures): Added, GTK only.
2166         * UIProcess/API/glib/WebKitWebView.cpp:
2167         (enableBackForwardNavigationGesturesChanged): Added, GTK only.
2168         (webkitWebViewUpdateSettings):
2169         (webkitWebViewDisconnectSettingsSignalHandlers):
2170         * UIProcess/API/gtk/PageClientImpl.cpp:
2171         (WebKit::PageClientImpl::setViewNeedsDisplay): Redraw the whole screen instead of a region during the gesture.
2172         (WebKit::PageClientImpl::takeViewSnapshot): Added.
2173         (WebKit::PageClientImpl::wheelEventWasNotHandledByWebCore): Pass unhandled events to the gesture controller.
2174         (WebKit::PageClientImpl::didRemoveNavigationGestureSnapshot): Redraw the widget immediately after removing snapshot.
2175         (WebKit::PageClientImpl::didStartProvisionalLoadForMainFrame): Added, send a notification to the gesture controller.
2176         (WebKit::PageClientImpl::didFirstVisuallyNonEmptyLayoutForMainFrame):  Send a notification to the gesture controller.
2177         (WebKit::PageClientImpl::didFinishLoadForMainFrame):  Send a notification to the gesture controller.
2178         (WebKit::PageClientImpl::didFailLoadForMainFrame):  Added, send a notification to the gesture controller.
2179         (WebKit::PageClientImpl::didSameDocumentNavigationForMainFrame):  Send a notification to the gesture controller.
2180         (WebKit::PageClientImpl::didRestoreScrollPosition):  Added, send a notification to the gesture controller.
2181         * UIProcess/API/gtk/PageClientImpl.h:
2182         * UIProcess/API/gtk/WebKitSettings.h:
2183         Add webkit_settings_get_enable_back_forward_navigation_gestures() and webkit_settings_get_enable_back_forward_navigation_gestures()
2184         to public API.
2185         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
2186         (webkitWebViewBaseDraw): Pass drawing to ViewGestureController during the gesture.
2187         (webkitWebViewBaseScrollEvent): Pass scroll events to ViewGestureController during the gesture.
2188         (webkitWebViewBaseGestureController): Renamed ViewGestureController to TouchGestureController.
2189         (webkitWebViewBaseViewGestureController): Added.
2190         (webkitWebViewBaseCreateWebPage): Create an instance of ViewGestureController.
2191         (webkitWebViewBaseTakeViewSnapshot): Added.
2192         (webkitWebViewBaseDidStartProvisionalLoadForMainFrame): Added.
2193         (webkitWebViewBaseDidFirstVisuallyNonEmptyLayoutForMainFrame): Added.
2194         (webkitWebViewBaseDidFinishLoadForMainFrame): Added.
2195         (webkitWebViewBaseDidFailLoadForMainFrame): Added.
2196         (webkitWebViewBaseDidSameDocumentNavigationForMainFrame): Added.
2197         (webkitWebViewBaseDidRestoreScrollPosition): Added.
2198         * UIProcess/API/gtk/WebKitWebViewBasePrivate.h:
2199         * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt: Mentioned the added functions in docs.
2200         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
2201         (WebKit::WebProcessPool::platformInitialize): Move the check from WebMemoryPressureHandlerCocoa.mm here.
2202         * UIProcess/PageClient.h: Add takeViewSnapshot() for GTK.
2203         * UIProcess/ViewGestureController.cpp: Renamed from Source/WebKit/UIProcess/Cocoa/ViewGestureController.cpp.
2204         (WebKit::ViewGestureController::ViewGestureController):
2205         (WebKit::ViewGestureController::~ViewGestureController):
2206         (WebKit::ViewGestureController::disconnectFromProcess):
2207         (WebKit::ViewGestureController::connectToProcess):
2208         (WebKit::ViewGestureController::controllerForGesture):
2209         (WebKit::ViewGestureController::takeNextGestureID):
2210         (WebKit::ViewGestureController::willBeginGesture):
2211         (WebKit::ViewGestureController::didEndGesture):
2212         (WebKit::ViewGestureController::setAlternateBackForwardListSourcePage):
2213         (WebKit::ViewGestureController::canSwipeInDirection const):
2214         (WebKit::ViewGestureController::didStartProvisionalOrSameDocumentLoadForMainFrame):
2215         (WebKit::ViewGestureController::didStartProvisionalLoadForMainFrame):
2216         (WebKit::ViewGestureController::didFirstVisuallyNonEmptyLayoutForMainFrame):
2217         (WebKit::ViewGestureController::didRepaintAfterNavigation):
2218         (WebKit::ViewGestureController::didHitRenderTreeSizeThreshold):
2219         (WebKit::ViewGestureController::didRestoreScrollPosition):
2220         (WebKit::ViewGestureController::didReachMainFrameLoadTerminalState):
2221         (WebKit::ViewGestureController::didSameDocumentNavigationForMainFrame):
2222         (WebKit::ViewGestureController::checkForActiveLoads):
2223         (WebKit::ViewGestureController::SnapshotRemovalTracker::SnapshotRemovalTracker):
2224         (WebKit::ViewGestureController::SnapshotRemovalTracker::eventsDescription):
2225         (WebKit::ViewGestureController::SnapshotRemovalTracker::log const):
2226         (WebKit::ViewGestureController::SnapshotRemovalTracker::resume):
2227         (WebKit::ViewGestureController::SnapshotRemovalTracker::start):
2228         (WebKit::ViewGestureController::SnapshotRemovalTracker::reset):
2229         (WebKit::ViewGestureController::SnapshotRemovalTracker::stopWaitingForEvent):
2230         (WebKit::ViewGestureController::SnapshotRemovalTracker::eventOccurred):
2231         (WebKit::ViewGestureController::SnapshotRemovalTracker::cancelOutstandingEvent):
2232         (WebKit::ViewGestureController::SnapshotRemovalTracker::hasOutstandingEvent):
2233         (WebKit::ViewGestureController::SnapshotRemovalTracker::fireRemovalCallbackIfPossible):
2234         (WebKit::ViewGestureController::SnapshotRemovalTracker::fireRemovalCallbackImmediately):
2235         (WebKit::ViewGestureController::SnapshotRemovalTracker::watchdogTimerFired):
2236         (WebKit::ViewGestureController::SnapshotRemovalTracker::startWatchdog):
2237         (WebKit::deltaShouldCancelSwipe):
2238         (WebKit::ViewGestureController::PendingSwipeTracker::PendingSwipeTracker):
2239         (WebKit::ViewGestureController::PendingSwipeTracker::scrollEventCanBecomeSwipe):
2240         (WebKit::ViewGestureController::PendingSwipeTracker::handleEvent):
2241         (WebKit::ViewGestureController::PendingSwipeTracker::eventWasNotHandledByWebCore):
2242         (WebKit::ViewGestureController::PendingSwipeTracker::tryToStartSwipe):
2243         (WebKit::ViewGestureController::PendingSwipeTracker::reset):
2244         (WebKit::ViewGestureController::startSwipeGesture):
2245         (WebKit::ViewGestureController::isPhysicallySwipingLeft const):
2246         (WebKit::ViewGestureController::shouldUseSnapshotForSize):
2247         (WebKit::ViewGestureController::forceRepaintIfNeeded):
2248         (WebKit::ViewGestureController::willEndSwipeGesture):
2249         (WebKit::ViewGestureController::endSwipeGesture):
2250         (WebKit::ViewGestureController::requestRenderTreeSizeNotificationIfNeeded):
2251         * UIProcess/ViewGestureController.h: Renamed from Source/WebKit/UIProcess/Cocoa/ViewGestureController.h.
2252         (WebKit::ViewGestureController::wheelEventWasNotHandledByWebCore):
2253         (WebKit::ViewGestureController::shouldIgnorePinnedState):
2254         (WebKit::ViewGestureController::setShouldIgnorePinnedState):
2255         (WebKit::ViewGestureController::hasActiveMagnificationGesture const):
2256         (WebKit::ViewGestureController::setCustomSwipeViews):
2257         (WebKit::ViewGestureController::setCustomSwipeViewsTopContentInset):
2258         (WebKit::ViewGestureController::setDidMoveSwipeSnapshotCallback):
2259         (WebKit::ViewGestureController::backgroundColorForCurrentSnapshot const):
2260         (WebKit::ViewGestureController::didFinishLoadForMainFrame):
2261         (WebKit::ViewGestureController::didFailLoadForMainFrame):
2262         (WebKit::ViewGestureController::setSwipeGestureEnabled):
2263         (WebKit::ViewGestureController::isSwipeGestureEnabled):
2264         (WebKit::ViewGestureController::SnapshotRemovalTracker::pause):
2265         (WebKit::ViewGestureController::SnapshotRemovalTracker::isPaused const):
2266         (WebKit::ViewGestureController::SnapshotRemovalTracker::hasRemovalCallback const):
2267         (WebKit::ViewGestureController::SnapshotRemovalTracker::renderTreeSizeThreshold const):
2268         (WebKit::ViewGestureController::SnapshotRemovalTracker::setRenderTreeSizeThreshold):
2269         (WebKit::ViewGestureController::PendingSwipeTracker::shouldIgnorePinnedState):
2270         (WebKit::ViewGestureController::PendingSwipeTracker::setShouldIgnorePinnedState):
2271         (WebKit::ViewGestureController::SwipeProgressTracker::progress const):
2272         (WebKit::ViewGestureController::SwipeProgressTracker::direction const):
2273         * UIProcess/ViewGestureController.messages.in: Renamed from Source/WebKit/UIProcess/Cocoa/ViewGestureController.messages.in.
2274         * UIProcess/ViewSnapshotStore.cpp: Copied from Source/WebKit/UIProcess/mac/ViewSnapshotStore.mm.
2275         (WebKit::ViewSnapshotStore::ViewSnapshotStore):
2276         (WebKit::ViewSnapshotStore::~ViewSnapshotStore):
2277         (WebKit::ViewSnapshotStore::singleton):
2278         (WebKit::ViewSnapshotStore::didAddImageToSnapshot):
2279         (WebKit::ViewSnapshotStore::willRemoveImageFromSnapshot):
2280         (WebKit::ViewSnapshotStore::pruneSnapshots):
2281         (WebKit::ViewSnapshotStore::recordSnapshot):
2282         (WebKit::ViewSnapshotStore::discardSnapshotImages):
2283         (WebKit::ViewSnapshot::~ViewSnapshot):
2284         * UIProcess/ViewSnapshotStore.h: Renamed from Source/WebKit/UIProcess/mac/ViewSnapshotStore.h.
2285         (WebKit::ViewSnapshot::setRenderTreeSize):
2286         (WebKit::ViewSnapshot::renderTreeSize const):
2287         (WebKit::ViewSnapshot::setBackgroundColor):
2288         (WebKit::ViewSnapshot::backgroundColor const):
2289         (WebKit::ViewSnapshot::setViewScrollPosition):
2290         (WebKit::ViewSnapshot::viewScrollPosition const):
2291         (WebKit::ViewSnapshot::setDeviceScaleFactor):
2292         (WebKit::ViewSnapshot::deviceScaleFactor const):
2293         (WebKit::ViewSnapshot::surface const):
2294         (WebKit::ViewSnapshot::imageSizeInBytes const):
2295         (WebKit::ViewSnapshot::size const):
2296         (WebKit::ViewSnapshotStore::setDisableSnapshotVolatilityForTesting):
2297         (WebKit::ViewSnapshotStore::disableSnapshotVolatilityForTesting const):
2298         * UIProcess/WebBackForwardList.cpp:
2299         (WebKit::WebBackForwardList::didRemoveItem): Unset snapshot for GTK.
2300         * UIProcess/WebMemoryPressureHandler.cpp: Copied from Source/WebKit/UIProcess/Cocoa/WebMemoryPressureHandlerCocoa.mm.
2301         (WebKit::installMemoryPressureHandler):
2302         * UIProcess/WebMemoryPressureHandler.h: Renamed from Source/WebKit/UIProcess/Cocoa/WebMemoryPressureHandlerCocoa.h.
2303         * UIProcess/WebPageProxy.cpp:
2304         (WebKit::WebPageProxy::recordNavigationSnapshot): Take snapshots for GTK.
2305         * UIProcess/WebPageProxy.h:
2306         * UIProcess/gtk/ViewGestureControllerGtk.cpp: Added. This is a port of
2307         UIProcess/mac/ViewGestureControllerMac.mm. SwipeProgressTracker class is a
2308         re-implementation of trackSwipeEventWithOptions.
2309         (WebKit::isEventStop):
2310         (WebKit::ViewGestureController::platformTeardown):
2311         (WebKit::ViewGestureController::PendingSwipeTracker::scrollEventCanStartSwipe):
2312         (WebKit::ViewGestureController::PendingSwipeTracker::scrollEventCanEndSwipe):
2313         (WebKit::ViewGestureController::PendingSwipeTracker::scrollEventCanInfluenceSwipe):
2314         (WebKit::ViewGestureController::PendingSwipeTracker::scrollEventGetScrollingDeltas):
2315         (WebKit::ViewGestureController::handleScrollWheelEvent):
2316         (WebKit::ViewGestureController::trackSwipeGesture):
2317         (WebKit::ViewGestureController::SwipeProgressTracker::SwipeProgressTracker):
2318         (WebKit::ViewGestureController::SwipeProgressTracker::startTracking):
2319         (WebKit::ViewGestureController::SwipeProgressTracker::reset):
2320         (WebKit::ViewGestureController::SwipeProgressTracker::handleEvent):
2321         (WebKit::ViewGestureController::SwipeProgressTracker::startAnimation):
2322         (WebKit::easeOutCubic):
2323         (WebKit::ViewGestureController::SwipeProgressTracker::onAnimationTick):
2324         (WebKit::ViewGestureController::SwipeProgressTracker::endAnimation):
2325         (WebKit::ViewGestureController::beginSwipeGesture):
2326         (WebKit::ViewGestureController::handleSwipeGesture):
2327         (WebKit::ViewGestureController::draw):
2328         (WebKit::ViewGestureController::removeSwipeSnapshot):
2329         (WebKit::ViewGestureController::beginSimulatedSwipeInDirectionForTesting):
2330         (WebKit::ViewGestureController::completeSimulatedSwipeInDirectionForTesting):
2331         * UIProcess/gtk/ViewSnapshotStoreGtk.cpp: Renamed from Source/WebKit/UIProcess/Cocoa/WebMemoryPressureHandlerCocoa.mm.
2332         (WebKit::ViewSnapshot::create):
2333         (WebKit::ViewSnapshot::ViewSnapshot):
2334         (WebKit::ViewSnapshot::hasImage const):
2335         (WebKit::ViewSnapshot::clearImage):
2336         (WebKit::ViewSnapshot::imageSizeInBytes const):
2337         (WebKit::ViewSnapshot::size const):
2338         * UIProcess/gtk/WebProcessPoolGtk.cpp:
2339         (WebKit::memoryPressureMonitorDisabled): Added.
2340         (WebKit::WebProcessPool::platformInitialize): Install memory pressure handler.
2341         (WebKit::WebProcessPool::platformInitializeWebProcess): Use memoryPressureMonitorDisabled().
2342         * UIProcess/mac/ViewGestureControllerMac.mm:
2343         Moved many functions into UIProcess/ViewGestureController.cpp
2344         (WebKit::ViewGestureController::PendingSwipeTracker::scrollEventCanStartSwipe):
2345         (WebKit::ViewGestureController::PendingSwipeTracker::scrollEventCanEndSwipe):
2346         (WebKit::ViewGestureController::PendingSwipeTracker::scrollEventCanInfluenceSwipe):
2347         (WebKit::ViewGestureController::PendingSwipeTracker::scrollEventGetScrollingDeltas):
2348         (WebKit::ViewGestureController::trackSwipeGesture):
2349         (WebKit::scrollEventCanInfluenceSwipe): Deleted.
2350         (WebKit::deltaShouldCancelSwipe): Deleted.
2351         (WebKit::ViewGestureController::PendingSwipeTracker::PendingSwipeTracker): Deleted.
2352         (WebKit::ViewGestureController::PendingSwipeTracker::scrollEventCanBecomeSwipe): Deleted.
2353         (WebKit::ViewGestureController::PendingSwipeTracker::handleEvent): Deleted.
2354         (WebKit::ViewGestureController::PendingSwipeTracker::eventWasNotHandledByWebCore): Deleted.
2355         (WebKit::ViewGestureController::PendingSwipeTracker::tryToStartSwipe): Deleted.
2356         (WebKit::ViewGestureController::PendingSwipeTracker::reset): Deleted.
2357         (WebKit::ViewGestureController::willEndSwipeGesture): Deleted.
2358         (WebKit::ViewGestureController::shouldUseSnapshotForSize): Deleted.
2359         (WebKit::ViewGestureController::isPhysicallySwipingLeft const): Deleted.
2360         (WebKit::ViewGestureController::endSwipeGesture): Deleted.
2361         (WebKit::ViewGestureController::forceRepaintIfNeeded): Deleted.
2362         (WebKit::ViewGestureController::requestRenderTreeSizeNotificationIfNeeded): Deleted.
2363         * UIProcess/mac/ViewSnapshotStoreMac.mm: Renamed from Source/WebKit/UIProcess/mac/ViewSnapshotStore.mm.
2364         (WebKit::ViewSnapshotStore::snapshottingContext):
2365         (WebKit::ViewSnapshot::create):
2366         (WebKit::ViewSnapshot::ViewSnapshot):
2367         (WebKit::ViewSnapshot::setSurface):
2368         (WebKit::ViewSnapshot::hasImage const):
2369         (WebKit::ViewSnapshot::clearImage):
2370         (WebKit::ViewSnapshot::setVolatile):
2371         (WebKit::ViewSnapshot::asLayerContents):
2372         (WebKit::ViewSnapshot::asImageForTesting):
2373         * WebKit.xcodeproj/project.pbxproj:
2374         * WebProcess/WebPage/ViewGestureGeometryCollector.cpp:
2375         Make SetRenderTreeSizeNotificationThreshold() cross-platform.
2376         (WebKit::ViewGestureGeometryCollector::ViewGestureGeometryCollector):
2377         (WebKit::ViewGestureGeometryCollector::computeMinimumAndMaximumViewportScales const):
2378         (WebKit::ViewGestureGeometryCollector::mainFrameDidLayout):
2379         * WebProcess/WebPage/ViewGestureGeometryCollector.h:
2380         * WebProcess/WebPage/ViewGestureGeometryCollector.messages.in:
2381         * WebProcess/WebPage/WebPage.cpp:
2382         Start using ViewGestureGeometryCollector for GTK.
2383         (WebKit::WebPage::mainFrameDidLayout):
2384         * WebProcess/WebPage/WebPage.h:
2385
2386 2019-02-08  Alex Christensen  <achristensen@webkit.org>
2387
2388         Add SPI to use networking daemon instead of XPC service
2389         https://bugs.webkit.org/show_bug.cgi?id=194427
2390
2391         Reviewed by Geoffrey Garen.
2392
2393         There is still work to be done, but with the proper plist it starts and loads webpages!
2394
2395         * NetworkProcess/EntryPoint/Cocoa/Daemon/DaemonEntryPoint.mm:
2396         (WebKit::DaemonMain):
2397         * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceEntryPoint.h:
2398         * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm:
2399         (WebKit::XPCEventHandler):
2400         (WebKit::XPCInitializationHandler):
2401         (WebKit::XPCServiceMain):
2402         (WebKit::XPCServiceEventHandler): Deleted.
2403         * UIProcess/API/APIProcessPoolConfiguration.h:
2404         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
2405         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
2406         (-[_WKProcessPoolConfiguration usesNetworkingDaemon]):
2407         (-[_WKProcessPoolConfiguration setUsesNetworkingDaemon:]):
2408         * UIProcess/AuxiliaryProcessProxy.cpp:
2409         (WebKit::AuxiliaryProcessProxy::getLaunchOptions):
2410         * UIProcess/Launcher/ProcessLauncher.h:
2411         * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
2412         (WebKit::serviceName):
2413         (WebKit::ProcessLauncher::launchProcess):
2414         * UIProcess/Network/NetworkProcessProxy.cpp:
2415         (WebKit::NetworkProcessProxy::getLaunchOptions):
2416         * UIProcess/WebProcessPool.cpp:
2417         (WebKit::WebProcessPool::usesNetworkingDaemon const):
2418         * UIProcess/WebProcessPool.h:
2419
2420 2019-02-08  Truitt Savell  <tsavell@apple.com>
2421
2422         Unreviewed, rolling out r241197.
2423
2424         Broke iOS Simulator Debug build and casued 1 API failure on
2425         High Sierra
2426
2427         Reverted changeset:
2428
2429         "Add SPI to use networking daemon instead of XPC service"
2430         https://bugs.webkit.org/show_bug.cgi?id=194427
2431         https://trac.webkit.org/changeset/241197
2432
2433 2019-02-08  Beth Dakin  <bdakin@apple.com>
2434
2435         Abstract and discussion comments needed for afterScreenUpdates
2436         https://bugs.webkit.org/show_bug.cgi?id=194442
2437
2438         Reviewed by Wenson Hsieh.
2439
2440         Forgot to add these comments with https://bugs.webkit.org/show_bug.cgi?id=194362
2441         * UIProcess/API/Cocoa/WKSnapshotConfiguration.h:
2442
2443 2019-02-08  Beth Dakin  <bdakin@apple.com>
2444
2445         Add afterScreenUpdates to WKSnapshotConfiguration
2446         https://bugs.webkit.org/show_bug.cgi?id=194362
2447         -and corresponding-
2448         <rdar://problem/40655528> Please add an "after screen updates" property to 
2449         WKSnapshotConfiguration (to solve blank snapshots)
2450
2451         Reviewed by Tim Horton.
2452
2453         This is the WebKit equivalent of - (UIView *)snapshotViewAfterScreenUpdates:(BOOL)afterUpdates;
2454         This makes our snapshotting API more predictable and reliable on iOS devices, 
2455         which is why the new configuration property defaults to YES.
2456
2457         New property that defaults to YES.
2458         * UIProcess/API/Cocoa/WKSnapshotConfiguration.h:
2459         * UIProcess/API/Cocoa/WKSnapshotConfiguration.mm:
2460         (-[WKSnapshotConfiguration init]):
2461         (-[WKSnapshotConfiguration copyWithZone:]):
2462
2463         When afterScreenUpdates is set, invoke the snapshot via 
2464         callAfterNextPresentationUpdate.
2465         * UIProcess/API/Cocoa/WKWebView.mm:
2466         (-[WKWebView takeSnapshotWithConfiguration:completionHandler:]):
2467         (-[WKWebView _callCompletionHandler:withSnapshotImage:atDeviceScale:]):
2468
2469 2019-02-08  Alex Christensen  <achristensen@webkit.org>
2470
2471         Add SPI to use networking daemon instead of XPC service
2472         https://bugs.webkit.org/show_bug.cgi?id=194427
2473
2474         Reviewed by Geoffrey Garen.
2475
2476         There is still work to be done, but with the proper plist it starts and loads webpages!
2477
2478         * NetworkProcess/EntryPoint/Cocoa/Daemon/DaemonEntryPoint.mm:
2479         (WebKit::DaemonMain):
2480         * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceEntryPoint.h:
2481         * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm:
2482         (WebKit::XPCEventHandler):
2483         (WebKit::XPCInitializationHandler):
2484         (WebKit::XPCServiceMain):
2485         (WebKit::XPCServiceEventHandler): Deleted.
2486         * UIProcess/API/APIProcessPoolConfiguration.h:
2487         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
2488         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
2489         (-[_WKProcessPoolConfiguration usesNetworkingDaemon]):
2490         (-[_WKProcessPoolConfiguration setUsesNetworkingDaemon:]):
2491         * UIProcess/AuxiliaryProcessProxy.cpp:
2492         (WebKit::AuxiliaryProcessProxy::getLaunchOptions):
2493         * UIProcess/Launcher/ProcessLauncher.h:
2494         * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
2495         (WebKit::serviceName):
2496         (WebKit::ProcessLauncher::launchProcess):
2497         * UIProcess/Network/NetworkProcessProxy.cpp:
2498         (WebKit::NetworkProcessProxy::getLaunchOptions):
2499         * UIProcess/WebProcessPool.cpp:
2500         (WebKit::WebProcessPool::usesNetworkingDaemon const):
2501         * UIProcess/WebProcessPool.h:
2502
2503 2019-02-08  Keith Rollin  <krollin@apple.com>
2504
2505         Unreviewed build fix.
2506
2507         r241135 modified how entitlements were built up for the macOS. Those
2508         changes broke the iOSMac builds. Bring back some deletions in order to
2509         fix iOSMac.
2510
2511         * Configurations/PluginService.64.xcconfig:
2512         * Configurations/PluginService.entitlements: Added.
2513         * WebKit.xcodeproj/project.pbxproj:
2514
2515 2019-02-07  Chris Dumez  <cdumez@apple.com>
2516
2517         Mark more heap-allocated classes as fast allocated
2518         https://bugs.webkit.org/show_bug.cgi?id=194422
2519
2520         Reviewed by Ryosuke Niwa.
2521
2522         * NetworkProcess/NetworkLoad.cpp:
2523         * NetworkProcess/NetworkLoadChecker.h:
2524         * NetworkProcess/NetworkResourceLoader.cpp:
2525         * Platform/IPC/Connection.h:
2526         * Platform/IPC/mac/ImportanceAssertion.h:
2527         * PluginProcess/PluginCreationParameters.h:
2528         * Shared/API/Cocoa/RemoteObjectRegistry.h:
2529         * Shared/WebEvent.h:
2530         * UIProcess/API/APIHTTPCookieStore.cpp:
2531         * UIProcess/API/APINotificationProvider.h:
2532         * UIProcess/API/Cocoa/PageLoadStateObserver.h:
2533         * UIProcess/API/Cocoa/WKHTTPCookieStore.mm:
2534         * UIProcess/API/Cocoa/WKWebView.mm:
2535         (-[WKWebView _setInputDelegate:]):
2536         * UIProcess/API/gtk/PageClientImpl.h:
2537         * UIProcess/BackingStore.h:
2538         * UIProcess/Cocoa/AutomationClient.h:
2539         * UIProcess/Cocoa/DiagnosticLoggingClient.h:
2540         * UIProcess/Cocoa/DownloadClient.h:
2541         * UIProcess/Cocoa/FindClient.h:
2542         * UIProcess/Cocoa/NavigationState.h:
2543         * UIProcess/Cocoa/UIDelegate.h:
2544         * UIProcess/Cocoa/ViewGestureController.h:
2545         * UIProcess/DeviceIdHashSaltStorage.h:
2546         * UIProcess/Downloads/DownloadProxyMap.h:
2547         * UIProcess/Gamepad/UIGamepad.h:
2548         * UIProcess/Notifications/WebNotificationProvider.h:
2549         * UIProcess/ProcessAssertion.h:
2550         * UIProcess/RemoteLayerTree/RemoteLayerTreeHost.h:
2551         * UIProcess/WebContextInjectedBundleClient.h:
2552         * UIProcess/WebFormClient.h:
2553         * UIProcess/WebGeolocationProvider.h:
2554         * UIProcess/WebPageProxy.h:
2555         * WebProcess/Automation/WebAutomationSessionProxy.h:
2556         * WebProcess/InjectedBundle/API/APIInjectedBundleBundleClient.h:
2557         * WebProcess/InjectedBundle/API/APIInjectedBundleEditorClient.h:
2558         * WebProcess/InjectedBundle/API/APIInjectedBundlePageContextMenuClient.h:
2559         * WebProcess/InjectedBundle/API/APIInjectedBundlePageLoaderClient.h:
2560         * WebProcess/InjectedBundle/API/APIInjectedBundlePageResourceLoadClient.h:
2561         * WebProcess/InjectedBundle/API/APIInjectedBundlePageUIClient.h:
2562         * WebProcess/InjectedBundle/APIInjectedBundleFormClient.h:
2563         * WebProcess/Network/webrtc/LibWebRTCNetwork.h:
2564         * WebProcess/Network/webrtc/LibWebRTCSocket.h:
2565         * WebProcess/Network/webrtc/WebRTCResolver.h:
2566         * WebProcess/WebCoreSupport/WebInspectorClient.cpp:
2567         * WebProcess/WebPage/DrawingArea.h:
2568
2569 2019-02-07  Wenson Hsieh  <wenson_hsieh@apple.com>
2570
2571         [iOS] [WK2] Modernize code for applying autocorrection
2572         https://bugs.webkit.org/show_bug.cgi?id=194397
2573
2574         Reviewed by Tim Horton.
2575
2576         * UIProcess/ios/WKContentViewInteraction.h:
2577         * UIProcess/ios/WKContentViewInteraction.mm:
2578         (-[WKContentView requestAutocorrectionRectsForString:withCompletionHandler:]):
2579         (-[WKContentView applyAutocorrection:toString:withCompletionHandler:]):
2580
2581         Use BlockPtr instead of temporarily storing the completion handler.
2582
2583         * WebProcess/WebPage/WebPage.h:
2584         * WebProcess/WebPage/WebPage.messages.in:
2585
2586         Change a LegacySync to Delayed.
2587
2588         * WebProcess/WebPage/ios/WebPageIOS.mm:
2589         (WebKit::WebPage::applyAutocorrection):
2590         (WebKit::WebPage::syncApplyAutocorrection):
2591         (WebKit::WebPage::applyAutocorrectionInternal):
2592
2593 2019-02-07  Wenson Hsieh  <wenson_hsieh@apple.com>
2594
2595         [iOS] Clicking links in Safari using Apple Pencil is much more difficult after r238475
2596         https://bugs.webkit.org/show_bug.cgi?id=194415
2597         <rdar://problem/47550281>
2598
2599         Reviewed by Tim Horton.
2600
2601         Fix the bug by not firing the Apple-pencil-exclusive tap gesture recognizer in the case where editable images
2602         are disabled. This gesture recognizer is only used for inserting editable images, and currently conflicts with
2603         the synthetic click gesture recognizer used to recognize clicks from generic digitizer inputs.
2604
2605         * UIProcess/ios/WKContentViewInteraction.mm:
2606         (-[WKContentView gestureRecognizerShouldBegin:]):
2607         (-[WKContentView _stylusSingleTapRecognized:]):
2608
2609 2019-02-07  Per Arne Vollan  <pvollan@apple.com>
2610
2611         [macOS] Block coreservicesd in sandbox.
2612         https://bugs.webkit.org/show_bug.cgi?id=192670
2613
2614         Reviewed by Alexey Proskuryakov.
2615
2616         We should block CoreServices in newer versions of macOS. In order to achieve this we need to avoid calling
2617         _RegisterApplication before entering the sandbox, since this call will open up a connection to CoreServices.
2618         The call to _RegisterApplication is moved to ChildProcess::updateProcessName, since it is needed to
2619         successfully update the process name. The call to ChildProcess::updateProcessName is made after entering
2620         the sandbox.
2621
2622         * Shared/AuxiliaryProcess.cpp:
2623         (WebKit::AuxiliaryProcess::initialize):
2624         * WebProcess/cocoa/WebProcessCocoa.mm:
2625         (WebKit::WebProcess::initializeProcessName):
2626         (WebKit::WebProcess::platformInitializeProcess):
2627         * WebProcess/com.apple.WebProcess.sb.in:
2628
2629 2019-02-07  Youenn Fablet  <youenn@apple.com>
2630
2631         Filter out Overconstrainederror.constraint when getUserMedia is not granted
2632         https://bugs.webkit.org/show_bug.cgi?id=194240
2633
2634         Reviewed by Eric Carlson.
2635
2636         Make sure in UIProcess to filter out constraint if either the page was not granted gum access or it has no persistent access.
2637
2638         Refactor UserMediaPermissionRequestManagerProxy to make the implementation easier to understand.
2639
2640         Covered by added test.
2641
2642         * UIProcess/UserMediaPermissionCheckProxy.cpp:
2643         (WebKit::UserMediaPermissionCheckProxy::setUserMediaAccessInfo):
2644         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
2645         (WebKit::UserMediaPermissionRequestManagerProxy::captureDevicesChanged):
2646         (WebKit::UserMediaPermissionRequestManagerProxy::userMediaAccessWasGranted):
2647         (WebKit::UserMediaPermissionRequestManagerProxy::grantAccess):
2648         (WebKit::UserMediaPermissionRequestManagerProxy::getRequestAction):
2649         (WebKit::UserMediaPermissionRequestManagerProxy::requestUserMediaPermissionForFrame):
2650         (WebKit::UserMediaPermissionRequestManagerProxy::processUserMediaPermissionRequest):
2651         (WebKit::UserMediaPermissionRequestManagerProxy::processUserMediaPermissionInvalidRequest):
2652         (WebKit::UserMediaPermissionRequestManagerProxy::processUserMediaPermissionValidRequest):
2653         (WebKit::UserMediaPermissionRequestManagerProxy::getUserMediaPermissionInfo):
2654         (WebKit::UserMediaPermissionRequestManagerProxy::wasGrantedVideoOrAudioAccess):
2655         (WebKit::UserMediaPermissionRequestManagerProxy::computeFilteredDeviceList):
2656         (WebKit::UserMediaPermissionRequestManagerProxy::enumerateMediaDevicesForFrame):
2657         (WebKit::UserMediaPermissionRequestManagerProxy::createPermissionRequest): Deleted.
2658         * UIProcess/UserMediaPermissionRequestManagerProxy.h:
2659         * UIProcess/UserMediaPermissionRequestProxy.h:
2660         (WebKit::UserMediaPermissionRequestProxy::isPending const):
2661         (WebKit::UserMediaPermissionRequestProxy::setEligibleVideoDeviceUIDs):
2662         (WebKit::UserMediaPermissionRequestProxy::setEligibleAudioDeviceUIDs):
2663         (WebKit::UserMediaPermissionRequestProxy::hasAudioDevice const):
2664         (WebKit::UserMediaPermissionRequestProxy::hasVideoDevice const):
2665         (WebKit::UserMediaPermissionRequestProxy::hasPersistentAccess const):
2666         (WebKit::UserMediaPermissionRequestProxy::setHasPersistentAccess):
2667         (WebKit::UserMediaPermissionRequestProxy::userMediaID const):
2668         (WebKit::UserMediaPermissionRequestProxy::topLevelDocumentSecurityOrigin const):
2669         (WebKit::UserMediaPermissionRequestProxy::userMediaDocumentSecurityOrigin const):
2670         (WebKit::UserMediaPermissionRequestProxy::userRequest const):
2671         (WebKit::UserMediaPermissionRequestProxy::setDeviceIdentifierHashSalt):
2672         (WebKit::UserMediaPermissionRequestProxy::deviceIdentifierHashSalt const):
2673         (WebKit::UserMediaPermissionRequestProxy::audioDevice const):
2674         (WebKit::UserMediaPermissionRequestProxy::videoDevice const):
2675         * UIProcess/WebPageProxy.cpp:
2676         (WebKit::WebPageProxy::requestUserMediaPermissionForFrame):
2677         * UIProcess/WebPageProxy.h:
2678
2679 2019-02-07  Wenson Hsieh  <wenson_hsieh@apple.com>
2680
2681         [iOS] [WK2] Modernize autocorrection context code
2682         https://bugs.webkit.org/show_bug.cgi?id=194373
2683
2684         Reviewed by Tim Horton.
2685
2686         * Shared/ios/WebAutocorrectionContext.h: Added.
2687         (WebKit::WebAutocorrectionContext::encode const):
2688         (WebKit::WebAutocorrectionContext::decode):
2689
2690         Introduce a WebAutocorrectionContext struct that encapsulates the individual pieces of autocorrection context.
2691         Change to use this instead of a long list of arguments when propagating autocorrection context information over
2692         IPC.
2693
2694         * UIProcess/AutoCorrectionCallback.h:
2695         * UIProcess/WebPageProxy.h:
2696         * UIProcess/WebPageProxy.messages.in:
2697         * UIProcess/ios/WKContentViewInteraction.h:
2698         * UIProcess/ios/WKContentViewInteraction.mm:
2699         (-[WKContentView requestAutocorrectionContextWithCompletionHandler:]):
2700         (+[WKAutocorrectionContext autocorrectionContextWithContext:]):
2701         (+[WKAutocorrectionContext autocorrectionContextWithData:markedText:selectedText:afterText:selectedRangeInMarkedText:]): Deleted.
2702
2703         Change this constructor to take an entire WebAutocorrectionContext.
2704
2705         * UIProcess/ios/WebPageProxyIOS.mm:
2706         (WebKit::WebPageProxy::autocorrectionContextCallback):
2707         (WebKit::WebPageProxy::requestAutocorrectionContext):
2708         (WebKit::WebPageProxy::autocorrectionContextSync):
2709         (WebKit::WebPageProxy::getAutocorrectionContext): Deleted.
2710         * WebKit.xcodeproj/project.pbxproj:
2711         * WebProcess/WebPage/WebPage.h:
2712         * WebProcess/WebPage/WebPage.messages.in:
2713
2714         Use Delayed instead of LegacySync.
2715
2716         * WebProcess/WebPage/ios/WebPageIOS.mm:
2717         (WebKit::WebPage::autocorrectionContext):
2718
2719         Renamed from computeAutocorrectionContext. This is now a private method on WebPage that uses the focused or main
2720         frame to compute and return a WebAutocorrectionContext.
2721
2722         (WebKit::WebPage::requestAutocorrectionContext):
2723         (WebKit::WebPage::autocorrectionContextSync):
2724
2725         Renamed getAutocorrectionContext to autocorrectionContextSync.
2726
2727         (WebKit::computeAutocorrectionContext): Deleted.
2728         (WebKit::WebPage::getAutocorrectionContext): Deleted.
2729
2730 2019-02-07  Youenn Fablet  <youenn@apple.com>
2731
2732         Simplify applyConstraints callbacks
2733         https://bugs.webkit.org/show_bug.cgi?id=194297
2734
2735         Reviewed by Eric Carlson.
2736
2737         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp:
2738         (WebKit::UserMediaCaptureManagerProxy::applyConstraints):
2739         * WebProcess/cocoa/UserMediaCaptureManager.cpp:
2740         (WebKit::UserMediaCaptureManager::Source::applyConstraintsSucceeded):
2741         (WebKit::UserMediaCaptureManager::Source::applyConstraintsFailed):
2742         (WebKit::UserMediaCaptureManager::applyConstraintsFailed):
2743         * WebProcess/cocoa/UserMediaCaptureManager.h:
2744
2745 2019-02-07  Brent Fulgham  <bfulgham@apple.com>
2746
2747         Permit additional IOKit Properties needed by Media PlugIns on older Mac Hardware
2748         https://bugs.webkit.org/show_bug.cgi?id=194412
2749         <rdar://problem/47820615>
2750
2751         Reviewed by Per Arne Vollan.
2752
2753         * PluginProcess/mac/com.apple.WebKit.plugin-common.sb.in:
2754
2755 2019-02-07  Brent Fulgham  <bfulgham@apple.com>
2756
2757         Permit additional IOKit Properties needed by older Mac Hardware
2758         https://bugs.webkit.org/show_bug.cgi?id=194410
2759         <rdar://problem/47820620>
2760
2761         Reviewed by Per Arne Vollan.
2762
2763         * WebProcess/com.apple.WebProcess.sb.in:
2764
2765 2019-02-07  Brady Eidson  <beidson@apple.com>
2766
2767         Rename the TAKE_DOWNLOAD_ASSERTION macro.
2768
2769         Rubberstamped by Andy Estes.
2770
2771         * NetworkProcess/Downloads/DownloadMap.cpp:
2772         * NetworkProcess/Downloads/DownloadMap.h:
2773
2774 2019-02-07  Keith Rollin  <krollin@apple.com>
2775
2776         Fix XCBuild issue related to codesigning WebContent process
2777         https://bugs.webkit.org/show_bug.cgi?id=193799
2778         <rdar://problem/47533890>
2779
2780         Reviewed by Brent Fulgham.
2781
2782         Building with XCBuild enabled results in the error message "cannot
2783         read entitlement data" when trying to codesign the macOS XPC
2784         processes. The reason for this error message is that there is a build
2785         step that deletes any previous "stale" generated .xcent file before
2786         building up a new one. With XCBuild enabled, the build steps got
2787         re-ordered, such that the step that deletes this file could get
2788         executed after the steps that build up the file. The built-up set of
2789         entitlements is now gone, and the build process fails when `codesign`
2790         tries to access it.
2791
2792         The apparent quick-fix to this problem -- of tweaking dependencies so
2793         that the build steps execute in the desired order -- wouldn't work
2794         with XCBuild. Establishing these dependencies would require both
2795         having multiple build phases produce the same .xcent file as output,
2796         as well as a build phase that has this file as an input and an output.
2797         XCBuild either forbids or frowns upon these configurations.
2798
2799         Ultimately, the solution that worked was to take over complete control
2800         of the codesigning process. This means (a) not specifying a base
2801         .entitlements file that XCode uses to start with (and which was
2802         subsequently altered via custom build scripts), (b) not letting XCode
2803         automatically and silently inject a 'get-task-all' entitlement used to
2804         facilitate debugging (we now add that entitlement by hand), and (c)
2805         building up all of our entitlements by hand via a single custom
2806         script. Because of the addition of this custom script, many other
2807         scripts and entitlements files could now be removed.
2808
2809         * Configurations/BaseXPCService.xcconfig:
2810         * Configurations/Databases-iOS.entitlements: Removed.
2811         * Configurations/Network-OSX-restricted.entitlements: Removed.
2812         * Configurations/Network-OSX-sandbox.entitlements: Removed.
2813         * Configurations/Network-OSX.entitlements: Removed.
2814         * Configurations/NetworkService.xcconfig:
2815         * Configurations/PluginService.64.xcconfig:
2816         * Configurations/PluginService.entitlements: Removed.
2817         * Configurations/WebContent-OSX-sandbox.entitlements: Removed.
2818         * Configurations/WebContent-OSX.entitlements: Removed.
2819         * Configurations/WebContent-or-Plugin-OSX-restricted.entitlements: Removed.
2820         * Configurations/WebContentService.xcconfig:
2821         * Scripts/copy-webcontent-resources-to-private-headers.sh:
2822         * Scripts/process-entitlements.sh: Added.
2823         * Scripts/process-network-sandbox-entitlements.sh: Removed.
2824         * Scripts/process-webcontent-or-plugin-entitlements.sh: Removed.
2825         * Scripts/process-webcontent-sandbox-entitlements.sh: Removed.
2826         * WebKit.xcodeproj/project.pbxproj:
2827
2828 2019-02-07  Alex Christensen  <achristensen@webkit.org>
2829
2830         Fix internal build after r241127
2831         https://bugs.webkit.org/show_bug.cgi?id=191394
2832
2833         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextControllerPrivate.h:
2834         Add some (un)availability macros.
2835
2836 2019-02-07  Youenn Fablet  <youenn@apple.com>
2837
2838         Make to clear sources from UserMediaCaptureManagerProxy and UserMediaCaptureManager when no longer needed
2839         https://bugs.webkit.org/show_bug.cgi?id=194312
2840
2841         Reviewed by Eric Carlson.
2842
2843         Sources in UserMediaCaptureManager and Proxy are never removed once added to their HashMap.
2844         Use the 'ended' mechanism to do the clean-up on WebProcess side.
2845         As part of this clean-up, send IPC to UIProcess to do clean-up on proxy side.
2846         On WebProcess crash case, clean-up the proxy as well.
2847
2848         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp:
2849         (WebKit::UserMediaCaptureManagerProxy::createMediaSourceForCaptureDeviceWithConstraints):
2850         (WebKit::UserMediaCaptureManagerProxy::end):
2851         (WebKit::UserMediaCaptureManagerProxy::clear):
2852         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.h:
2853         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.messages.in:
2854         * UIProcess/WebProcessProxy.cpp:
2855         (WebKit::WebProcessProxy::processDidTerminateOrFailedToLaunch):
2856         * WebProcess/cocoa/UserMediaCaptureManager.cpp:
2857         (WebKit::UserMediaCaptureManager::sourceEnded):
2858         * WebProcess/cocoa/UserMediaCaptureManager.h:
2859
2860 2019-02-07  Alex Christensen  <achristensen@webkit.org>
2861
2862         Print backgrounds preference should be honored instead of WKWebViewConfiguration value
2863         https://bugs.webkit.org/show_bug.cgi?id=194364
2864         <rdar://problem/47627599>
2865
2866         Reviewed by Tim Horton.
2867
2868         Without this patch, changing the preference for printing the background has no effect.
2869         This patch fixes that, and I verified it manually by checking "Print backgrounds" in Safari's print menu.
2870         Unfortunately, the only way to test this is actually printing because only values from WebPageProxy::preferences
2871         or WebPageProxy::configuration's preferences are exposed to the API, but values from WebPageProxy::preferencesStore
2872         are used when printing.  Actually printing verifies this change fixes the bug.
2873
2874         * UIProcess/API/Cocoa/WKWebView.mm:
2875         (-[WKWebView _initializeWithConfiguration:]):
2876
2877 2019-02-07  Chris Dumez  <cdumez@apple.com>
2878
2879         Mark DisplayLink as fast allocated
2880         https://bugs.webkit.org/show_bug.cgi?id=194400
2881
2882         Reviewed by Geoffrey Garen.
2883
2884         * UIProcess/mac/DisplayLink.h:
2885
2886 2019-02-07  Per Arne Vollan  <pvollan@apple.com>
2887
2888         [macOS] API test times out after r241026
2889         https://bugs.webkit.org/show_bug.cgi?id=194372
2890
2891         Reviewed by Alex Christensen.
2892
2893         The API test TestWebKitAPI.RenderingProgress.FirstMeaningfulPaint times out after r241026.
2894         A new function pointer, layoutMilestones, is added to WKBundlePageLoaderClient, in order
2895         for clients to decide which milestones they would like to listen for.
2896
2897         * WebProcess/InjectedBundle/API/c/WKBundlePageLoaderClient.h:
2898         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:
2899         (layoutMilestones):
2900         (setUpPageLoaderClient):
2901         * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp:
2902         (WebKit::InjectedBundlePageLoaderClient::layoutMilestones const):
2903         * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h:
2904
2905 2019-02-07  Alex Christensen  <achristensen@webkit.org>
2906
2907         Deprecate WKBundlePageSetDefersLoading
2908         https://bugs.webkit.org/show_bug.cgi?id=191394
2909
2910         Reviewed by Dean Jackson.
2911
2912         * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
2913         (WKBundlePageSetDefersLoading):
2914         * WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h:
2915         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:
2916         (-[WKWebProcessPlugInBrowserContextController _defersLoading]):
2917         (-[WKWebProcessPlugInBrowserContextController _setDefersLoading:]):
2918         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextControllerPrivate.h:
2919
2920 2019-02-07  Alex Christensen  <achristensen@webkit.org>
2921
2922         Digital crown should scroll safe browsing warning on watchOS
2923         https://bugs.webkit.org/show_bug.cgi?id=194363
2924         <rdar://problem/47348124>
2925
2926         Reviewed by Wenson Hsieh.
2927
2928         * UIProcess/Cocoa/WKSafeBrowsingWarning.h:
2929         * UIProcess/Cocoa/WKSafeBrowsingWarning.mm:
2930         (-[WKSafeBrowsingWarning initWithFrame:safeBrowsingWarning:completionHandler:]):
2931         (-[WKSafeBrowsingWarning addContent]):
2932
2933 2019-02-07  Alex Christensen  <achristensen@webkit.org>
2934
2935         Shrink and hyphenate safe browsing warning text on watchOS
2936         https://bugs.webkit.org/show_bug.cgi?id=194361
2937         <rdar://problem/47466549>
2938
2939         Reviewed by Geoffrey Garen.
2940
2941         Some internationalizations use long words that didn't fit on small watches.
2942
2943         * UIProcess/Cocoa/WKSafeBrowsingWarning.mm:
2944         (fontOfSize):
2945         (-[WKSafeBrowsingWarning addContent]):
2946         (-[WKSafeBrowsingTextView initWithAttributedString:forWarning:]):
2947
2948 2019-02-07  Miguel Gomez  <magomez@igalia.com>
2949
2950         [WPE] Implement GStreamer based holepunch
2951         https://bugs.webkit.org/show_bug.cgi?id=193715
2952
2953         Reviewed by Xabier Rodriguez-Calvar.
2954
2955         Add a new parameter to the calls of TextureMapper::drawSolidColor().
2956
2957         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
2958         (WebKit::CoordinatedGraphicsScene::paintToCurrentGLContext):
2959
2960 2019-02-06  Benjamin Poulain  <benjamin@webkit.org>
2961
2962         Unreviewed, rolling out r240759 and r240944.
2963
2964         Some timer uses are done off the main thread, WebCore::Timer
2965         cannot be used
2966
2967         Reverted changesets:
2968
2969         "<rdar://problem/47570443> Responsiveness timers are too
2970         expensive for frequent events"
2971         https://bugs.webkit.org/show_bug.cgi?id=194003
2972         https://trac.webkit.org/changeset/240759
2973
2974         "Use deferrable timer to restart the Responsiveness Timer on
2975         each wheel event"
2976         https://bugs.webkit.org/show_bug.cgi?id=194135
2977         https://trac.webkit.org/changeset/240944
2978
2979 2019-02-06  chris fleizach  <cfleizach@apple.com>
2980
2981         AX:  com.apple.WebKit.WebContent at WebKit: -[WKAccessibilityWebPageObjectBase axObjectCache]
2982         https://bugs.webkit.org/show_bug.cgi?id=194306
2983         <rdar://problem/47764549>
2984
2985         Reviewed by Zalan Bujtas.
2986
2987         Check the page reference is still valid.
2988         Modernize code in this area.
2989
2990         * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectBase.mm:
2991
2992 2019-02-06  Daniel Bates  <dabates@apple.com>
2993
2994         Move toNSEventModifierFlags() and toNSButtonNumber() to WebEventFactory.mm
2995         https://bugs.webkit.org/show_bug.cgi?id=194321
2996
2997         Reviewed by Jer Noble.
2998
2999         Move some code to WebEventFactory so that it can be shared by both WKNavigationAction.mm
3000         and UIDelegate.mm among other benefits.
3001
3002         * Shared/mac/WebEventFactory.h:
3003         * Shared/mac/WebEventFactory.mm:
3004         (WebKit::WebEventFactory::toNSEventModifierFlags):
3005         (WebKit::WebEventFactory::toNSButtonNumber):
3006         * UIProcess/API/Cocoa/WKNavigationAction.mm:
3007         (-[WKNavigationAction modifierFlags]):
3008         (-[WKNavigationAction buttonNumber]):
3009         (toNSEventModifierFlags): Deleted.
3010         (toNSButtonNumber): Deleted.
3011         * UIProcess/Cocoa/UIDelegate.mm:
3012         (WebKit::UIDelegate::UIClient::mouseDidMoveOverElement):
3013         (WebKit::toNSEventModifierFlags): Deleted.
3014
3015 2019-02-06  Andy Estes  <aestes@apple.com>
3016
3017         [Payment Request] It should be possible to require a phonetic name for shipping contacts
3018         https://bugs.webkit.org/show_bug.cgi?id=194311
3019         <rdar://46733045>
3020
3021         Reviewed by Alex Christensen.
3022
3023         * WebProcess/ApplePay/WebPaymentCoordinator.cpp:
3024         (WebKit::WebPaymentCoordinator::supportsVersion): Deleted.
3025         * WebProcess/ApplePay/WebPaymentCoordinator.h:
3026
3027 2019-02-06  Keith Rollin  <krollin@apple.com>
3028
3029         Really enable the automatic checking and regenerations of .xcfilelists during builds
3030         https://bugs.webkit.org/show_bug.cgi?id=194357
3031         <rdar://problem/47861231>
3032
3033         Reviewed by Chris Dumez.
3034
3035         Bug 194124 was supposed to enable the automatic checking and
3036         regenerating of .xcfilelist files during the build. While related
3037         changes were included in that patch, the change to actually enable the
3038         operation somehow was omitted. This patch actually enables the
3039         operation. The check-xcfilelist.sh scripts now check
3040         WK_DISABLE_CHECK_XCFILELISTS, and if it's "1", opts-out the developer
3041         from the checking.
3042
3043         * Scripts/check-xcfilelists.sh:
3044
3045 2019-02-06  John Wilander  <wilander@apple.com>
3046
3047         Forward Ad Click Attribution data from HTMLAnchorElement::handleClick() to WebKit::NavigationActionData
3048         https://bugs.webkit.org/show_bug.cgi?id=194325
3049         <rdar://problem/47840283>
3050
3051         Reviewed by Chris Dumez.
3052
3053         * Shared/NavigationActionData.cpp:
3054         (WebKit::NavigationActionData::encode const):
3055         (WebKit::NavigationActionData::decode):
3056         * Shared/NavigationActionData.h:
3057             Now holds an optional WebCore::AdClickAttribution object.
3058
3059 2019-02-06  Daniel Bates  <dabates@apple.com>
3060
3061         Fix the Apple Internal build. See <rdar://problem/47860943> for more details.
3062
3063         * UIProcess/ios/fullscreen/WKFullscreenStackView.mm:
3064         (-[WKFullscreenStackView init]):
3065
3066 2019-02-06  Daniel Bates  <dabates@apple.com>
3067
3068         Standardize on ControlKey instead of CtrlKey
3069         https://bugs.webkit.org/show_bug.cgi?id=194317
3070
3071         Reviewed by Tim Horton.
3072
3073         * Shared/WebEventConversion.cpp:
3074         (WebKit::WebKit2PlatformMouseEvent::WebKit2PlatformMouseEvent):
3075         (WebKit::WebKit2PlatformWheelEvent::WebKit2PlatformWheelEvent):
3076         (WebKit::WebKit2PlatformKeyboardEvent::WebKit2PlatformKeyboardEvent):
3077         (WebKit::WebKit2PlatformTouchEvent::WebKit2PlatformTouchEvent):
3078         (WebKit::WebKit2PlatformGestureEvent::WebKit2PlatformGestureEvent):
3079         * WebProcess/WebCoreSupport/gtk/WebEditorClientGtk.cpp:
3080         (WebKit::WebEditorClient::handleKeyboardEvent):
3081         * WebProcess/WebCoreSupport/wpe/WebEditorClientWPE.cpp:
3082         (WebKit::handleKeyPress):
3083
3084 2019-02-06  Per Arne Vollan  <pvollan@apple.com>
3085
3086         Roll out parts of r238819 since it is a PLT performance regression.
3087         https://bugs.webkit.org/show_bug.cgi?id=194346
3088
3089         Unreviewed performance fix.
3090
3091         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:
3092         (didStartProvisionalLoadForFrame):
3093         (didReceiveServerRedirectForProvisionalLoadForFrame):
3094         (didFinishLoadForFrame):
3095         (globalObjectIsAvailableForFrame):
3096         (didRemoveFrameFromHierarchy):
3097         (didCommitLoadForFrame):
3098         (didFinishDocumentLoadForFrame):
3099         (didFailProvisionalLoadWithErrorForFrame):
3100         (didFailLoadWithErrorForFrame):
3101         (didSameDocumentNavigationForFrame):
3102         (didLayoutForFrame):
3103         (didReachLayoutMilestone):
3104         (didFirstVisuallyNonEmptyLayoutForFrame):
3105         (didHandleOnloadEventsForFrame):
3106         (userAgentForURL):
3107         (setUpPageLoaderClient):
3108         (willSendRequestForFrame):
3109         (didInitiateLoadForResource):
3110         (didFinishLoadForResource):
3111         (didFailLoadForResource):
3112         (setUpResourceLoadClient):
3113         (-[WKWebProcessPlugInBrowserContextController setLoadDelegate:]):
3114         (ResourceLoadClient::ResourceLoadClient): Deleted.
3115         (ResourceLoadClient::loadDelegate const): Deleted.
3116         (ResourceLoadClient::pluginContextController const): Deleted.
3117         (PageLoaderClient::PageLoaderClient): Deleted.
3118         (PageLoaderClient::loadDelegate const): Deleted.
3119         (PageLoaderClient::pluginContextController const): Deleted.
3120         (PageLoaderClient::didStartProvisionalLoadForFrame): Deleted.
3121         (PageLoaderClient::didReceiveServerRedirectForProvisionalLoadForFrame): Deleted.
3122         (PageLoaderClient::didFinishLoadForFrame): Deleted.
3123         (PageLoaderClient::globalObjectIsAvailableForFrame): Deleted.
3124         (PageLoaderClient::didRemoveFrameFromHierarchy): Deleted.
3125         (PageLoaderClient::didCommitLoadForFrame): Deleted.
3126         (PageLoaderClient::didFinishDocumentLoadForFrame): Deleted.
3127         (PageLoaderClient::didFailProvisionalLoadWithErrorForFrame): Deleted.
3128         (PageLoaderClient::didFailLoadWithErrorForFrame): Deleted.
3129         (PageLoaderClient::didSameDocumentNavigationForFrame): Deleted.
3130         (PageLoaderClient::didLayoutForFrame): Deleted.
3131         (PageLoaderClient::didReachLayoutMilestone): Deleted.
3132         (PageLoaderClient::didFirstVisuallyNonEmptyLayoutForFrame): Deleted.
3133         (PageLoaderClient::layoutMilestones const): Deleted.
3134         (PageLoaderClient::didHandleOnloadEventsForFrame): Deleted.
3135         (PageLoaderClient::userAgentForURL const): Deleted.
3136         (ResourceLoadClient::willSendRequestForFrame): Deleted.
3137         (ResourceLoadClient::didInitiateLoadForResource): Deleted.
3138         (ResourceLoadClient::didFinishLoadForResource): Deleted.
3139         (ResourceLoadClient::didFailLoadForResource): Deleted.
3140
3141 2019-02-06  Michael Catanzaro  <mcatanzaro@igalia.com>
3142
3143         REGRESSION(r240785): [SOUP] Broke cookie persistent storage
3144         https://bugs.webkit.org/show_bug.cgi?id=194209
3145
3146         Reviewed by Carlos Garcia Campos.
3147
3148         I missed a spot when moving the persistent storage parameters from NetworkProcess to
3149         NetworkSession. They have to be initialized separately for the default session.
3150
3151         * UIProcess/soup/WebProcessPoolSoup.cpp:
3152         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
3153
3154 2019-02-05  Alex Christensen  <achristensen@webkit.org>
3155
3156         Stop using blobRegistry in NetworkProcess
3157         https://bugs.webkit.org/show_bug.cgi?id=194027
3158
3159         Reviewed by Youenn Fablet.
3160
3161         * NetworkProcess/Downloads/DownloadManager.cpp:
3162         (WebKit::DownloadManager::startDownload):
3163         * NetworkProcess/Downloads/PendingDownload.cpp:
3164         (WebKit::PendingDownload::PendingDownload):
3165         * NetworkProcess/Downloads/PendingDownload.h:
3166         * NetworkProcess/FileAPI/NetworkBlobRegistry.cpp:
3167         (WebKit::NetworkBlobRegistry::registerFileBlobURL):
3168         (WebKit::NetworkBlobRegistry::registerBlobURL):
3169         (WebKit::NetworkBlobRegistry::registerBlobURLOptionallyFileBacked):
3170         (WebKit::NetworkBlobRegistry::registerBlobURLForSlice):
3171         (WebKit::NetworkBlobRegistry::unregisterBlobURL):
3172         (WebKit::NetworkBlobRegistry::blobSize):
3173         (WebKit::NetworkBlobRegistry::writeBlobsToTemporaryFiles):
3174         (WebKit::NetworkBlobRegistry::writeBlobToFilePath):
3175         (WebKit::NetworkBlobRegistry::connectionToWebProcessDidClose):
3176         (WebKit::NetworkBlobRegistry::filesInBlob):
3177         (WebKit::NetworkBlobRegistry::singleton): Deleted.
3178         * NetworkProcess/FileAPI/NetworkBlobRegistry.h:
3179         (WebKit::NetworkBlobRegistry::blobRegistry):
3180         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
3181         (WebKit::NetworkConnectionToWebProcess::didClose):
3182         (WebKit::NetworkConnectionToWebProcess::resolveBlobReferences):
3183         (WebKit::NetworkConnectionToWebProcess::scheduleResourceLoad):
3184         (WebKit::NetworkConnectionToWebProcess::performSynchronousLoad):
3185         (WebKit::NetworkConnectionToWebProcess::loadPing):
3186         (WebKit::NetworkConnectionToWebProcess::preconnectTo):
3187         (WebKit::NetworkConnectionToWebProcess::registerFileBlobURL):
3188         (WebKit::NetworkConnectionToWebProcess::registerBlobURL):
3189         (WebKit::NetworkConnectionToWebProcess::registerBlobURLFromURL):
3190         (WebKit::NetworkConnectionToWebProcess::registerBlobURLOptionallyFileBacked):
3191         (WebKit::NetworkConnectionToWebProcess::registerBlobURLForSlice):
3192         (WebKit::NetworkConnectionToWebProcess::unregisterBlobURL):
3193         (WebKit::NetworkConnectionToWebProcess::blobSize):
3194         (WebKit::NetworkConnectionToWebProcess::writeBlobsToTemporaryFiles):
3195         (WebKit::NetworkConnectionToWebProcess::filesInBlob):
3196         (WebKit::NetworkConnectionToWebProcess::blobRegistry):
3197         * NetworkProcess/NetworkConnectionToWebProcess.h:
3198         * NetworkProcess/NetworkDataTask.cpp:
3199         (WebKit::NetworkDataTask::create):
3200         * NetworkProcess/NetworkDataTaskBlob.cpp:
3201         (WebKit::NetworkDataTaskBlob::NetworkDataTaskBlob):
3202         * NetworkProcess/NetworkDataTaskBlob.h:
3203         * NetworkProcess/NetworkLoad.cpp:
3204         (WebKit::NetworkLoad::NetworkLoad):
3205         (WebKit::NetworkLoad::initialize):
3206         * NetworkProcess/NetworkLoad.h:
3207         * NetworkProcess/NetworkProcess.cpp:
3208         (WebKit::NetworkProcess::NetworkProcess):
3209         (WebKit::NetworkProcess::removeNetworkConnectionToWebProcess):
3210         * NetworkProcess/NetworkProcess.h:
3211         (WebKit::NetworkProcess::networkBlobRegistry):
3212         * NetworkProcess/NetworkProcessPlatformStrategies.cpp:
3213         (WebKit::NetworkProcessPlatformStrategies::createBlobRegistry):
3214         * NetworkProcess/NetworkResourceLoader.cpp:
3215         (WebKit::m_shouldCaptureExtraNetworkLoadMetrics):
3216         (WebKit::NetworkResourceLoader::startNetworkLoad):
3217         * NetworkProcess/PreconnectTask.cpp:
3218         * NetworkProcess/cache/NetworkCacheSpeculativeLoad.cpp:
3219         (WebKit::NetworkCache::SpeculativeLoad::SpeculativeLoad):
3220
3221 2019-02-05  Daniel Bates  <dabates@apple.com>
3222
3223         Fix a typo in r241006. Substitute Modifier for Modifiers.
3224
3225         * Shared/mac/NativeWebGestureEventMac.mm:
3226         (WebKit::NativeWebGestureEvent::NativeWebGestureEvent):
3227
3228 2019-02-05  Daniel Bates  <dabates@apple.com>
3229
3230         Attempt to fix the build following r241000
3231         (https://bugs.webkit.org/show_bug.cgi?id=194241)
3232
3233         Substitute OptionSet<WebEvent::Modifier> for Modifiers.
3234
3235         * Shared/mac/NativeWebGestureEventMac.mm:
3236         (WebKit::NativeWebGestureEvent::NativeWebGestureEvent):
3237         * Shared/mac/WebGestureEvent.h:
3238         (WebKit::WebGestureEvent::WebGestureEvent):
3239
3240 2019-02-05  Truitt Savell  <tsavell@apple.com>
3241
3242         Unreviewed, rolling out r240984.
3243
3244         Revision casued two API timeouts
3245
3246         Reverted changeset:
3247
3248         "Stop using blobRegistry in NetworkProcess"
3249         https://bugs.webkit.org/show_bug.cgi?id=194027
3250         https://trac.webkit.org/changeset/240984
3251
3252 2019-02-05  Youenn Fablet  <youenn@apple.com>
3253
3254         UserMediaPermissionRequestManagerProxy lambdas should check for 'this' being valid
3255         https://bugs.webkit.org/show_bug.cgi?id=194246
3256
3257         Reviewed by Eric Carlson.
3258
3259         With PSON enabled, the manager proxy can be destroyed.
3260         It is thus important for its callbacks to check for 'this' to be valid.
3261
3262         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
3263         (WebKit::UserMediaPermissionRequestManagerProxy::captureDevicesChanged):
3264         (WebKit::UserMediaPermissionRequestManagerProxy::requestUserMediaPermissionForFrame):
3265         (WebKit::UserMediaPermissionRequestManagerProxy::enumerateMediaDevicesForFrame):
3266
3267 2019-02-05  Daniel Bates  <dabates@apple.com>
3268
3269         Attempt to fix the build following r241000
3270         (https://bugs.webkit.org/show_bug.cgi?id=194241)
3271
3272         Substitute WebEvent::Modifier::CapsLockKey for WebEvent::CapsLockKey.
3273
3274         * Shared/gtk/WebEventFactory.cpp:
3275         (WebKit::modifiersForEvent):
3276         * Shared/mac/WebEventFactory.mm:
3277         (WebKit::modifiersForEvent):
3278         * UIProcess/API/Cocoa/WKNavigationAction.mm:
3279         (toNSEventModifierFlags):
3280         * UIProcess/Automation/WebAutomationSession.cpp:
3281         (WebKit::protocolModifierToWebEventModifier):
3282         * UIProcess/Automation/gtk/WebAutomationSessionGtk.cpp:
3283         (WebKit::modifiersToEventState):
3284         * UIProcess/Automation/mac/WebAutomationSessionMac.mm:
3285         (WebKit::WebAutomationSession::platformSimulateMouseInteraction):
3286         * UIProcess/Cocoa/UIDelegate.mm:
3287         (WebKit::toNSEventModifierFlags):
3288
3289 2019-02-05  Daniel Bates  <dabates@apple.com>
3290
3291         Make WebEvent::Modifiers an OptionSet
3292         https://bugs.webkit.org/show_bug.cgi?id=194241
3293
3294         Reviewed by Simon Fraser.
3295
3296         Use an OptionSet to represent the bitmask of keyboard modifier flags. This improves type safety
3297         and makes debugging more enjoyable because our LLDB pretty-printers have built-in support for
3298         OptionSet.
3299
3300         While I am at it, make WebEvent::Modifier an enum class. It is currently an enum. This makes
3301         this enum more closely match WebCore::PlatformEvent::Modifier.
3302
3303         * Shared/API/c/WKSharedAPICast.h:
3304         (WebKit::toAPI):
3305         * Shared/NavigationActionData.cpp:
3306         (WebKit::NavigationActionData::encode const):
3307         (WebKit::NavigationActionData::decode):
3308         * Shared/NavigationActionData.h:
3309         * Shared/WebEvent.cpp:
3310         (WebKit::WebEvent::WebEvent):
3311         * Shared/WebEvent.h:
3312         (WebKit::WebEvent::shiftKey const):
3313         (WebKit::WebEvent::controlKey const):
3314         (WebKit::WebEvent::altKey const):
3315         (WebKit::WebEvent::metaKey const):
3316         (WebKit::WebEvent::capsLockKey const):
3317         (WebKit::WebEvent::modifiers const):
3318         (WebKit::WebTouchEvent::WebTouchEvent):
3319         * Shared/WebEventConversion.cpp:
3320         (WebKit::WebKit2PlatformMouseEvent::WebKit2PlatformMouseEvent):
3321         * Shared/WebKeyboardEvent.cpp:
3322         (WebKit::WebKeyboardEvent::WebKeyboardEvent):
3323         * Shared/WebMouseEvent.cpp:
3324         (WebKit::WebMouseEvent::WebMouseEvent):
3325         * Shared/WebTouchEvent.cpp:
3326         (WebKit::WebTouchEvent::WebTouchEvent):
3327         * Shared/WebWheelEvent.cpp:
3328         (WebKit::WebWheelEvent::WebWheelEvent):
3329         * Shared/gtk/WebEventFactory.cpp:
3330         (WebKit::modifiersForEvent):
3331         * Shared/ios/NativeWebTouchEventIOS.mm:
3332         (WebKit::NativeWebTouchEvent::NativeWebTouchEvent):
3333         * Shared/ios/WebIOSEventFactory.mm:
3334         (modifiersForEvent):
3335         (WebIOSEventFactory::createWebKeyboardEvent):
3336         (WebIOSEventFactory::createWebMouseEvent):
3337         * Shared/libwpe/WebEventFactory.cpp:
3338         (WebKit::modifiersForEventModifiers):
3339         (WebKit::WebEventFactory::createWebWheelEvent):
3340         (WebKit::WebEventFactory::createWebTouchEvent):
3341         * Shared/mac/WebEventFactory.mm:
3342         (WebKit::modifiersForEvent):
3343         (WebKit::WebEventFactory::createWebMouseEvent):
3344         (WebKit::WebEventFactory::createWebWheelEvent):
3345         (WebKit::WebEventFactory::createWebKeyboardEvent):
3346         * Shared/win/WebEventFactory.cpp:
3347         (WebKit::modifiersForEvent):
3348         (WebKit::modifiersForCurrentKeyState):
3349         (WebKit::WebEventFactory::createWebMouseEvent):
3350         (WebKit::WebEventFactory::createWebWheelEvent):
3351         (WebKit::WebEventFactory::createWebKeyboardEvent):
3352         * UIProcess/API/APINavigationAction.h:
3353         * UIProcess/API/APIUIClient.h:
3354         (API::UIClient::mouseDidMoveOverElement):
3355         * UIProcess/API/C/WKPage.cpp:
3356         (WKPageSetPageUIClient):
3357         * UIProcess/API/Cocoa/WKNavigationAction.mm:
3358         (toNSEventModifierFlags):
3359         * UIProcess/API/glib/WebKitPrivate.cpp:
3360         (toPlatformModifiers):
3361         * UIProcess/API/glib/WebKitPrivate.h:
3362         * UIProcess/API/glib/WebKitUIClient.cpp:
3363         * UIProcess/API/glib/WebKitWebView.cpp:
3364         (webkitWebViewMouseTargetChanged):
3365         * UIProcess/API/glib/WebKitWebViewPrivate.h:
3366         * UIProcess/Automation/WebAutomationSession.cpp:
3367         (WebKit::WebAutomationSession::simulateMouseInteraction):
3368         (WebKit::protocolModifierToWebEventModifier):
3369         (WebKit::WebAutomationSession::performMouseInteraction):
3370         * UIProcess/Automation/WebAutomationSession.h:
3371         * UIProcess/Automation/gtk/WebAutomationSessionGtk.cpp:
3372         (WebKit::modifiersToEventState):
3373         (WebKit::WebAutomationSession::platformSimulateMouseInteraction):
3374         * UIProcess/Automation/mac/WebAutomationSessionMac.mm:
3375         (WebKit::WebAutomationSession::platformSimulateMouseInteraction):
3376         * UIProcess/Automation/wpe/WebAutomationSessionWPE.cpp:
3377         (WebKit::modifiersToEventState):
3378         (WebKit::WebAutomationSession::platformSimulateMouseInteraction):
3379         * UIProcess/Cocoa/UIDelegate.h:
3380         * UIProcess/Cocoa/UIDelegate.mm:
3381         (WebKit::toNSEventModifierFlags):
3382         (WebKit::UIDelegate::UIClient::mouseDidMoveOverElement):
3383         * UIProcess/WebPageProxy.cpp:
3384         (WebKit::WebPageProxy::mouseDidMoveOverElement):
3385         * WebProcess/InjectedBundle/API/APIInjectedBundlePageUIClient.h:
3386         (API::InjectedBundle::PageUIClient::mouseDidMoveOverElement):
3387         * WebProcess/InjectedBundle/InjectedBundleNavigationAction.cpp:
3388         (WebKit::InjectedBundleNavigationAction::modifiersForNavigationAction):
3389         * WebProcess/InjectedBundle/InjectedBundleNavigationAction.h:
3390         (WebKit::InjectedBundleNavigationAction::modifiers const):
3391         * WebProcess/InjectedBundle/InjectedBundlePageUIClient.cpp:
3392         (WebKit::InjectedBundlePageUIClient::mouseDidMoveOverElement):
3393         * WebProcess/InjectedBundle/InjectedBundlePageUIClient.h:
3394         * WebProcess/Plugins/PDF/PDFPlugin.mm:
3395         (WebKit::PDFPlugin::showContextMenuAtPoint):
3396         * WebProcess/Plugins/PluginView.cpp:
3397         (WebKit::PluginView::createWebEvent const):
3398         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
3399         (WebKit::WebChromeClient::mouseDidMoveOverElement):
3400         * WebProcess/WebPage/WebPage.cpp:
3401         (WebKit::WebPage::simulateMouseDown):
3402         (WebKit::WebPage::simulateMouseUp):
3403         (WebKit::WebPage::simulateMouseMotion):
3404
3405 2019-02-05  Tim Horton  <timothy_horton@apple.com>