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