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