Provide option to not create a longpress gesture recognizer
[WebKit-https.git] / Source / WebKit / ChangeLog
1 2019-04-15  Dean Jackson  <dino@apple.com>
2
3         Provide option to not create a longpress gesture recognizer
4         https://bugs.webkit.org/show_bug.cgi?id=196937
5         <rdar://problem/49918278>
6
7         Build fix for iOS platforms that don't have link preview.
8
9         * UIProcess/ios/WKContentViewInteraction.mm:
10         (-[WKContentView setupInteraction]):
11
12 2019-04-15  Brent Fulgham  <bfulgham@apple.com>
13
14         InjectedBundle parameters often need initialization function called before unarchiving
15         https://bugs.webkit.org/show_bug.cgi?id=189709
16         <rdar://problem/44573653>
17
18         Reviewed by Ryosuke Niwa.
19
20         Handle the case where the InjectedBundle parameters do not successfully decode because they contain
21         an unexpected class from the embedding program. If this happens, try decoding the bundle parameters
22         after the bundle initialiation function runs, which gives the embedding program the opportunity to
23         register additional classes that are safe for serialization.
24
25         Extend WKWebProcessPlugIn with a method that returns the names of any custom classes that need
26         to be serialized by the InjectedBundle.
27         
28         Create a new 'decodeBundleParameters' method that contains the logic that used to live in 'initialize'.
29         Revise 'initialize' to call this new method.
30
31         * WebProcess/InjectedBundle/InjectedBundle.h:
32         * WebProcess/InjectedBundle/mac/InjectedBundleMac.mm:
33         (WebKit::InjectedBundle::initialize): Use the new method.
34         (WebKit::InjectedBundle::decodeBundleParameters): Added.
35         (WebKit::InjectedBundle::setBundleParameters): Use 'decodeObjectOfClasses' with the more complete
36         'classesForCoder' method to unarchive the passed bundle parameters, rather than the
37         NSDictionary-specific method, since InjectedBundles often encode other types of objects, and the
38         NSDictionary object may itself hold other kinds of objects.
39         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugIn.h:
40         (WebKit::WKWebProcessPlugIn::additionalClassesForParameterCoder): Added.
41
42 2019-04-15  Dean Jackson  <dino@apple.com>
43
44         Provide option to not create a longpress gesture recognizer
45         https://bugs.webkit.org/show_bug.cgi?id=196937
46         <rdar://problem/49918278>
47
48         Reviewed by Antoine Quint.
49
50         A WebKitAdditions file has changed name to WKContentViewInteractionWKInteraction.mm.
51
52         Add a property to toggle if we should add a long press gesture
53         recognizer.
54
55         * UIProcess/ios/WKContentViewInteraction.h:
56         * UIProcess/ios/WKContentViewInteraction.mm:
57         (-[WKContentView setupInteraction]):
58         (shouldUsePreviewForLongPress):
59         (-[WKContentView shouldUsePreviewForLongPress]):
60
61 2019-04-15  Don Olmstead  <don.olmstead@sony.com>
62
63         [CMake] WebCore derived sources should only be referenced inside WebCore
64         https://bugs.webkit.org/show_bug.cgi?id=196904
65
66         Reviewed by Konstantin Tokarev.
67
68         Remove reference to DERIVED_SOURCES_WEBCORE_DIR in PlatformMac.cmake.
69
70         * PlatformMac.cmake:
71
72 2019-04-15  Zalan Bujtas  <zalan@apple.com>
73
74         DrawingArea should only capture painting related milestones
75         https://bugs.webkit.org/show_bug.cgi?id=196926
76         <rdar://problem/48003845>
77
78         Reviewed by Tim Horton.
79
80         While dispatching layout milestones (mixture of layout and painting items), the associated drawing areas should only capture the painting related milestones.
81         These captured milestones get dispatched later in the commit handler to ensure that they are not forwarded prematurely.
82         However the truly layout related milestones (e.g. DidFirstVisuallyNonEmptyLayout) should be dispatched right away with no delay.
83
84         * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.h:
85         (WebKit::RemoteLayerTreeTransaction::newlyReachedPaintingMilestones const):
86         (WebKit::RemoteLayerTreeTransaction::setNewlyReachedPaintingMilestones):
87         (WebKit::RemoteLayerTreeTransaction::newlyReachedLayoutMilestones const): Deleted.
88         (WebKit::RemoteLayerTreeTransaction::setNewlyReachedLayoutMilestones): Deleted.
89         * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm:
90         (WebKit::RemoteLayerTreeTransaction::encode const):
91         (WebKit::RemoteLayerTreeTransaction::decode):
92         * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm:
93         (WebKit::RemoteLayerTreeDrawingAreaProxy::commitLayerTree):
94         * WebProcess/WebPage/DrawingArea.h:
95         (WebKit::DrawingArea::addMilestonesToDispatch):
96         (WebKit::DrawingArea::dispatchDidReachLayoutMilestone): Deleted.
97         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.h:
98         (WebKit::RemoteLayerTreeDrawingArea::addMilestonesToDispatch):
99         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
100         (WebKit::RemoteLayerTreeDrawingArea::flushLayers):
101         (WebKit::RemoteLayerTreeDrawingArea::dispatchDidReachLayoutMilestone): Deleted.
102         * WebProcess/WebPage/WebPage.cpp:
103         (WebKit::WebPage::dispatchDidReachLayoutMilestone):
104         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
105         (WebKit::TiledCoreAnimationDrawingArea::addMilestonesToDispatch):
106         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
107         (WebKit::TiledCoreAnimationDrawingArea::sendPendingNewlyReachedPaintingMilestones):
108         (WebKit::TiledCoreAnimationDrawingArea::flushLayers):
109         (WebKit::TiledCoreAnimationDrawingArea::sendPendingNewlyReachedLayoutMilestones): Deleted.
110         (WebKit::TiledCoreAnimationDrawingArea::dispatchDidReachLayoutMilestone): Deleted.
111
112 2019-04-15  John Wilander  <wilander@apple.com>
113
114         Send delayed Ad Click Attribution conversion requests to the click source
115         https://bugs.webkit.org/show_bug.cgi?id=196838
116         <rdar://problem/47650157>
117
118         Reviewed by Chris Dumez and Youenn Fablet.
119
120         This patch schedules a conversion request with appropriate data going to the
121         click source as a result of an ad click conversion.
122
123         WebKit::AdClickAttributionManager makes use of existing WebKit::PingLoad
124         infrastructure to make the request. This will probably be reworked into a
125         dedicated load class further on.
126
127         New test infrastructure allows for an override of both the conversion URL
128         and the 24-48 hour timer.
129
130         * NetworkProcess/AdClickAttributionManager.cpp: Added.
131         (WebKit::AdClickAttributionManager::ensureDestinationMapForSource):
132         (WebKit::AdClickAttributionManager::store):
133         (WebKit::AdClickAttributionManager::startTimer):
134             Convenience function to support test override.
135         (WebKit::AdClickAttributionManager::convert):
136             This function now sets the timer.
137         (WebKit::AdClickAttributionManager::fireConversionRequest):
138             Fire an individual request.
139         (WebKit::AdClickAttributionManager::firePendingConversionRequests):
140             This is the timer function that iterates over all pending attributions.
141         (WebKit::AdClickAttributionManager::clear):
142             Now clears the two new test settings members.
143         (WebKit::AdClickAttributionManager::toString const):
144         * NetworkProcess/AdClickAttributionManager.h: Renamed from Source/WebKit/NetworkProcess/NetworkAdClickAttribution.h.
145         (WebKit::AdClickAttributionManager::AdClickAttributionManager):
146         (WebKit::AdClickAttributionManager::setPingLoadFunction):
147         (WebKit::AdClickAttributionManager::setOverrideTimerForTesting):
148         (WebKit::AdClickAttributionManager::setConversionURLForTesting):
149         * NetworkProcess/NetworkAdClickAttribution.cpp: Renamed from Source/WebKit/NetworkProcess/NetworkAdClickAttribution.cpp.
150         * NetworkProcess/NetworkProcess.cpp:
151         (WebKit::NetworkProcess::storeAdClickAttribution):
152         (WebKit::NetworkProcess::dumpAdClickAttribution):
153         (WebKit::NetworkProcess::clearAdClickAttribution):
154         (WebKit::NetworkProcess::setAdClickAttributionOverrideTimerForTesting):
155         (WebKit::NetworkProcess::setAdClickAttributionConversionURLForTesting):
156         * NetworkProcess/NetworkProcess.h:
157         * NetworkProcess/NetworkProcess.messages.in:
158         * NetworkProcess/NetworkSession.cpp:
159         (WebKit::NetworkSession::NetworkSession):
160         (WebKit::NetworkSession::setAdClickAttributionOverrideTimerForTesting):
161         (WebKit::NetworkSession::setAdClickAttributionConversionURLForTesting):
162         * NetworkProcess/NetworkSession.h:
163         * NetworkProcess/PingLoad.cpp:
164         (WebKit::PingLoad::PingLoad):
165         (WebKit::m_blobFiles):
166         (WebKit::PingLoad::initialize):
167             The PingLoad constructor is now split in two to allow for construction
168             without a WebKit::NetworkConnectionToWebProcess object. The body of
169             the constructor was moved into the new initialize() function which is
170             shared between constructors.
171         * NetworkProcess/PingLoad.h:
172         * Sources.txt:
173             Removed NetworkProcess/NetworkAdClickAttribution.cpp and added
174             NetworkProcess/NetworkAdClickAttribution.cpp.
175         * UIProcess/API/C/WKPage.cpp:
176         (WKPageSetAdClickAttributionOverrideTimerForTesting):
177         (WKPageSetAdClickAttributionConversionURLForTesting):
178         * UIProcess/API/C/WKPagePrivate.h:
179         * UIProcess/Network/NetworkProcessProxy.cpp:
180         (WebKit::NetworkProcessProxy::dumpAdClickAttribution): Deleted.
181         (WebKit::NetworkProcessProxy::clearAdClickAttribution): Deleted.
182         * UIProcess/Network/NetworkProcessProxy.h:
183         * UIProcess/WebPageProxy.cpp:
184         (WebKit::WebPageProxy::dumpAdClickAttribution):
185         (WebKit::WebPageProxy::clearAdClickAttribution):
186         (WebKit::WebPageProxy::setAdClickAttributionOverrideTimerForTesting):
187         (WebKit::WebPageProxy::setAdClickAttributionConversionURLForTesting):
188         * UIProcess/WebPageProxy.h:
189         * UIProcess/WebProcessPool.cpp:
190         (WebKit::WebProcessPool::dumpAdClickAttribution): Deleted.
191         (WebKit::WebProcessPool::clearAdClickAttribution): Deleted.
192         * UIProcess/WebProcessPool.h:
193         * WebKit.xcodeproj/project.pbxproj:
194
195 2019-04-15  Devin Rousso  <drousso@apple.com>
196
197         WebDriver: Set Cookie endpoint does not correctly set subdomain cookies
198         https://bugs.webkit.org/show_bug.cgi?id=196872
199         <rdar://problem/49233240>
200
201         Reviewed by Joseph Pecoraro.
202
203         * UIProcess/Automation/WebAutomationSession.cpp:
204         (WebKit::WebAutomationSession::addSingleCookie):
205         Rather than try to "force" the cookie to be set on the current active URL, use the cookie
206         itself to figure out which domain it should be set on.
207
208 2019-04-15  Philippe Normand  <pnormand@igalia.com>
209
210         [GTK][WPE] Add enable-media websetting
211         https://bugs.webkit.org/show_bug.cgi?id=196863
212
213         Reviewed by Michael Catanzaro.
214
215         It can be useful for headless browsers, for instance. The setting is enabled by default.
216
217         * Shared/WebPreferences.yaml:
218         * UIProcess/API/glib/WebKitSettings.cpp:
219         (webKitSettingsSetProperty):
220         (webKitSettingsGetProperty):
221         (webkit_settings_class_init):
222         (webkit_settings_get_enable_media):
223         (webkit_settings_set_enable_media):
224         * UIProcess/API/gtk/WebKitSettings.h:
225         * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt:
226         * UIProcess/API/wpe/WebKitSettings.h:
227         * UIProcess/API/wpe/docs/wpe-1.0-sections.txt:
228
229 2019-04-14  Rob Buis  <rbuis@igalia.com>
230
231         Link prefetch not useful for top-level navigation
232         https://bugs.webkit.org/show_bug.cgi?id=195623
233
234         Reviewed by Youenn Fablet.
235
236         Cache cross-domain top-level prefetches in a dedicated cache. When a navigation
237         to the same url is done within a threshold (5 seconds), reuse the
238         prefetch cache entry, move it to the disk cache and navigate to
239         the url, meaning no extra network trip is needed. When not used within
240         the threshold period, the prefetch entry will be erased using a timer.
241
242         * NetworkProcess/NetworkProcess.cpp:
243         (WebKit::NetworkProcess::lowMemoryHandler):
244         * NetworkProcess/NetworkProcess.h:
245         (WebKit::NetworkProcess::prefetchCache):
246         * NetworkProcess/NetworkResourceLoader.cpp:
247         (WebKit::NetworkResourceLoader::retrieveCacheEntry):
248         (WebKit::NetworkResourceLoader::didReceiveResponse):
249         (WebKit::NetworkResourceLoader::didReceiveBuffer):
250         (WebKit::NetworkResourceLoader::tryStoreAsCacheEntry):
251         (WebKit::NetworkResourceLoader::isCrossOriginPrefetch const):
252         * NetworkProcess/NetworkResourceLoader.h:
253         * NetworkProcess/cache/PrefetchCache.cpp: Added.
254         (WebKit::PrefetchCache::Entry::Entry):
255         (WebKit::PrefetchCache::PrefetchCache):
256         (WebKit::PrefetchCache::~PrefetchCache):
257         (WebKit::PrefetchCache::clear):
258         (WebKit::PrefetchCache::take):
259         (WebKit::PrefetchCache::store):
260         (WebKit::PrefetchCache::sessionPrefetchMap const):
261         (WebKit::PrefetchCache::clearExpiredEntries):
262         * NetworkProcess/cache/PrefetchCache.h: Added.
263         (WebKit::PrefetchCache::Entry::response const):
264         (WebKit::PrefetchCache::Entry::releaseBuffer):
265         * Shared/WebPreferences.yaml:
266         * Sources.txt:
267         * WebKit.xcodeproj/project.pbxproj:
268
269 2019-04-14  Andy Estes  <aestes@apple.com>
270
271         [Cocoa] WKCustomProtocolLoader should store a WeakPtr to its LegacyCustomProtocolManagerProxy
272         https://bugs.webkit.org/show_bug.cgi?id=196893
273         <rdar://problem/48318983>
274
275         Reviewed by Anders Carlsson.
276
277         In addition to manually invalidating each WKCustomProtocolLoader's _customProtocolManagerProxy
278         pointer when the LegacyCustomProtocolManagerClient is invalidated, use a WeakPtr in case the
279         LegacyCustomProtocolManagerProxy is ever destroyed without first invalidating the client.
280         Also add null pointer checks to NSURLConnectionDelegate methods, which might be called after
281         the LegacyCustomProtocolManagerProxy has been destroyed.
282
283         * UIProcess/Cocoa/LegacyCustomProtocolManagerClient.mm:
284         (-[WKCustomProtocolLoader initWithLegacyCustomProtocolManagerProxy:customProtocolID:request:]):
285         (-[WKCustomProtocolLoader cancel]):
286         (-[WKCustomProtocolLoader connection:didFailWithError:]):
287         (-[WKCustomProtocolLoader connection:didReceiveResponse:]):
288         (-[WKCustomProtocolLoader connection:didReceiveData:]):
289         (-[WKCustomProtocolLoader connection:willSendRequest:redirectResponse:]):
290         (-[WKCustomProtocolLoader connectionDidFinishLoading:]):
291         (WebKit::LegacyCustomProtocolManagerClient::startLoading):
292         (WebKit::LegacyCustomProtocolManagerClient::invalidate):
293         (-[WKCustomProtocolLoader customProtocolManagerProxyDestroyed]): Deleted.
294         * UIProcess/Network/CustomProtocols/LegacyCustomProtocolManagerProxy.h:
295
296 2019-04-14  Don Olmstead  <don.olmstead@sony.com>
297
298         [CMake] JavaScriptCore derived sources should only be referenced inside JavaScriptCore
299         https://bugs.webkit.org/show_bug.cgi?id=196742
300
301         Reviewed by Konstantin Tokarev.
302
303         Don't set JavaScriptCore_SCRIPTS_DIR now that it is set within WebKitFS.
304
305         * CMakeLists.txt:
306         * PlatformWin.cmake:
307         
308         Remove use of DERIVED_SOURCES_JAVASCRIPTCORE_DIR.
309
310 2019-04-13  Chris Dumez  <cdumez@apple.com>
311
312         [ Mac Debug ] TestWebKitAPI.ProcessSwap.ReuseSuspendedProcessForRegularNavigationRetainBundlePage is a flaky crash
313         https://bugs.webkit.org/show_bug.cgi?id=196548
314         <rdar://problem/49567254>
315
316         Reviewed by Darin Adler.
317
318         Update ProvisionalPageProxy methods to more consistently ignore unexpected IPC from the process. Previously,
319         some of the methods were doing this, but some other like didFailProvisionalLoadForFrame() weren't and this
320         was leading to this flaky crash. The issue is that if we do the load in an existing process that was recently
321         doing, there may be leftover IPC for the same pageID and this IPC gets received by the ProvisionalPageProxy
322         even though it is from a previous navigation. For this reason, the ProvisionalPageProxy should ignore all
323         incoming IPC that is not for its associated navigation.
324
325         * UIProcess/ProvisionalPageProxy.cpp:
326         (WebKit::ProvisionalPageProxy::didPerformClientRedirect):
327         (WebKit::ProvisionalPageProxy::didStartProvisionalLoadForFrame):
328         (WebKit::ProvisionalPageProxy::didFailProvisionalLoadForFrame):
329         (WebKit::ProvisionalPageProxy::didCommitLoadForFrame):
330         (WebKit::ProvisionalPageProxy::didNavigateWithNavigationData):
331         (WebKit::ProvisionalPageProxy::didChangeProvisionalURLForFrame):
332         (WebKit::ProvisionalPageProxy::decidePolicyForNavigationActionAsync):
333         (WebKit::ProvisionalPageProxy::decidePolicyForResponse):
334         (WebKit::ProvisionalPageProxy::didPerformServerRedirect):
335         (WebKit::ProvisionalPageProxy::didReceiveServerRedirectForProvisionalLoadForFrame):
336         (WebKit::ProvisionalPageProxy::decidePolicyForNavigationActionSync):
337
338 2019-04-13  Wenson Hsieh  <wenson_hsieh@apple.com>
339
340         Unreviewed, try to fix the internal build after r244239
341
342         Force the bots to regenerate WKWebpagePreferences.h by touching the file. Adds a `Foundation/Foundation.h`
343         import that was missing anyways.
344
345         * UIProcess/API/Cocoa/WKWebpagePreferences.h:
346
347 2019-04-12  Wenson Hsieh  <wenson_hsieh@apple.com>
348
349         Enable modern compatibility mode by default in WKWebView on some devices
350         https://bugs.webkit.org/show_bug.cgi?id=196883
351         <rdar://problem/49864527>
352
353         Reviewed by Tim Horton.
354
355         Make some minor adjustments to new API.
356
357         * Shared/WebCompatibilityMode.h:
358
359         Rename WebCompatibilityMode::Default to WebCompatibilityMode::Recommended.
360
361         * Shared/WebPreferences.yaml:
362         * Shared/WebPreferencesDefaultValues.h:
363
364         Now that the role of the UseModernCompatibilityModeByDefault debug preference is limited to bypassing linked-on-
365         or-after and app bundle compatibility hacks, we no longer make this default to true in iOSMac.
366
367         * UIProcess/API/APIWebsitePolicies.h:
368         * UIProcess/API/Cocoa/WKNavigationDelegate.h:
369
370         Rename the withPreferences: label to just preferences:.
371
372         * UIProcess/API/Cocoa/WKWebViewConfiguration.h:
373         * UIProcess/Cocoa/NavigationState.mm:
374         (WebKit::NavigationState::setNavigationDelegate):
375         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
376         * UIProcess/Cocoa/VersionChecks.h:
377         * UIProcess/ios/WebPageProxyIOS.mm:
378
379 2019-04-12  Brian Burg  <bburg@apple.com>
380
381         WebDriver: fix typo in EnterFullscreen.js in error-handling code
382         https://bugs.webkit.org/show_bug.cgi?id=196882
383         <rdar://problem/49867122>
384
385         Reviewed by Devin Rousso.
386
387         * UIProcess/Automation/atoms/EnterFullscreen.js:
388         (enterFullscreen):
389
390 2019-04-12  Ross Kirsling  <ross.kirsling@sony.com>
391
392         Unreviewed fix for non-unified build.
393
394         * Shared/PrintInfo.cpp:
395         Add missing include from r244202.
396
397 2019-04-12  Saam barati  <sbarati@apple.com>
398
399         Sometimes we need to user fewer CPUs in our threading calculations
400         https://bugs.webkit.org/show_bug.cgi?id=196794
401         <rdar://problem/49389497>
402
403         Reviewed by Yusuke Suzuki.
404
405         * WebProcess/com.apple.WebProcess.sb.in:
406
407 2019-04-12  Devin Rousso  <drousso@apple.com>
408
409         WebDriver: evaluating javascript shouldn't fail if a dialog is shown
410         https://bugs.webkit.org/show_bug.cgi?id=196847
411         <rdar://problem/49609396>
412
413         Reviewed by Brian Burg.
414
415         * UIProcess/Automation/WebAutomationSession.cpp:
416         (WebKit::WebAutomationSession::willShowJavaScriptDialog):
417
418 2019-04-12  Ross Kirsling  <ross.kirsling@sony.com>
419
420         WebKit should build successfully even with -DENABLE_UNIFIED_BUILDS=OFF
421         https://bugs.webkit.org/show_bug.cgi?id=196845
422
423         Reviewed by Ryosuke Niwa.
424
425         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h:
426         * NetworkProcess/NetworkCORSPreflightChecker.cpp:
427         * NetworkProcess/NetworkDataTask.cpp:
428         * NetworkProcess/NetworkHTTPSUpgradeChecker.cpp:
429         * NetworkProcess/NetworkHTTPSUpgradeChecker.h: Include wtf/Forward.h for String and CompletionHandler fwd decls.
430         * NetworkProcess/NetworkProcess.cpp:
431         * NetworkProcess/NetworkResourceLoadMap.cpp:
432         * NetworkProcess/NetworkResourceLoadMap.h:
433         * NetworkProcess/NetworkResourceLoader.cpp:
434         * NetworkProcess/PingLoad.h:
435         * Shared/WebCompiledContentRuleListData.cpp:
436         * Shared/gtk/WebEventFactory.cpp:
437         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
438         (WKWebsiteDataStoreStatisticsClearInMemoryAndPersistentStore):
439         (WKWebsiteDataStoreStatisticsClearInMemoryAndPersistentStoreModifiedSinceHours):
440         (WKWebsiteDataStoreStatisticsResetToConsistentState):
441         * UIProcess/Downloads/DownloadProxyMap.cpp:
442         * UIProcess/InspectorTargetProxy.cpp:
443         * UIProcess/PageClient.h:
444         * UIProcess/ProcessAssertion.cpp:
445         * UIProcess/ProvisionalPageProxy.h:
446         * UIProcess/WebPageInspectorTargetAgent.h:
447         * UIProcess/geoclue/GeoclueGeolocationProvider.cpp:
448         * WebProcess/Cache/WebCacheStorageConnection.cpp:
449         (WebKit::WebCacheStorageConnection::updateQuotaBasedOnSpaceUsage):
450         * WebProcess/InjectedBundle/API/c/WKBundle.cpp:
451         (WKBundleSetDatabaseQuota):
452         * WebProcess/Storage/WebServiceWorkerFetchTaskClient.h:
453         Add missing includes / forward declarations to address compiler errors on GTK / WinCairo.
454
455 2019-04-12  Eric Carlson  <eric.carlson@apple.com>
456
457         Update AudioSession route sharing policy
458         https://bugs.webkit.org/show_bug.cgi?id=196776
459         <rdar://problem/46501611>
460
461         Reviewed by Jer Noble.
462
463         * UIProcess/ios/forms/WKAirPlayRoutePicker.mm:
464         (-[WKAirPlayRoutePicker showFromView:routeSharingPolicy:routingContextUID:hasVideo:]):
465
466 2019-04-12  Wenson Hsieh  <wenson_hsieh@apple.com>
467
468         WebsitePolicies doesn't copy its media source policy in WebsitePolicies::copy
469         https://bugs.webkit.org/show_bug.cgi?id=196862
470
471         Reviewed by Darin Adler.
472
473         Add a missing bit of code to copy m_mediaSourcePolicy over when making a copy of WebsitePolicies. This doesn't
474         have any observable effect, since m_mediaSourcePolicy isn't currently exposed as SPI on WKWebpagePreferences.
475
476         * UIProcess/API/APIWebsitePolicies.cpp:
477         (API::WebsitePolicies::copy const):
478
479 2019-04-12  Simon Fraser  <simon.fraser@apple.com>
480
481         [iOS WK2] Make -webkit-overflow-scrolling be a no-op
482         https://bugs.webkit.org/show_bug.cgi?id=196803
483         rdar://problem/49078202
484
485         Reviewed by Antti Koivisto.
486
487         Flip LegacyOverflowScrollingTouchEnabled to false.
488
489         * Shared/WebPreferences.yaml:
490
491 2019-04-12  Wenson Hsieh  <wenson_hsieh@apple.com>
492
493         [iOS] Software keyboard is shown too frequently on some websites
494         https://bugs.webkit.org/show_bug.cgi?id=195856
495         <rdar://problem/49191395>
496
497         Reviewed by Darin Adler.
498
499         On some websites, hidden editable elements are very frequently focused upon user interaction. Currently, this
500         causes the software keyboard to pop in and out unexpectedly; luckily, these same sites also apply
501         inputmode="none" to the hidden editable element, which ought to ensure that the software keyboard doesn't appear
502         when the element is focused.
503
504         However, since we disabled support for inputmode="none" in r240497, the software keyboard is no longer
505         suppressed, and becomes a big nuissance. r240497 removed support for this feature because, when using a hardware
506         keyboard, pressing the globe key no longer showed UI for switching languages. However, support for inputmode
507         none makes a much larger impact when a software keyboard is used (since the entire software keyboard animates in
508         and out), whereas a hardware keyboard only displays an input accessory view. For this reason, we can mitigate
509         this bug without reintroducing <rdar://problem/47406553> by re-enabling inputmode="none", but only when a
510         hardware keyboard is not attached.
511
512         * UIProcess/API/Cocoa/WKWebView.mm:
513         (hardwareKeyboardAvailabilityChangedCallback):
514         * UIProcess/ios/WKContentViewInteraction.h:
515         * UIProcess/ios/WKContentViewInteraction.mm:
516         (-[WKContentView shouldShowAutomaticKeyboardUI]):
517
518         Don't show the keyboard if inputmode is none and a hardware keyboard is not attached.
519
520         (-[WKContentView _hardwareKeyboardAvailabilityChanged]):
521
522         Reload input views if the inputmode is none to ensure that if a hardware keyboard is attached while editing an
523         element with inputmode="none", we'll show the input accessory view once again.
524
525 2019-04-12  Antoine Quint  <graouts@apple.com>
526
527         Opt some websites into the simulated mouse events dispatch quirk when in modern compatibility mode
528         https://bugs.webkit.org/show_bug.cgi?id=196830
529         <rdar://problem/49124313>
530
531         Reviewed by Wenson Hsieh.
532
533         We add a new policy to determine whether simulated mouse events dispatch are allowed.
534
535         * Shared/WebsitePoliciesData.cpp:
536         (WebKit::WebsitePoliciesData::encode const):
537         (WebKit::WebsitePoliciesData::decode):
538         (WebKit::WebsitePoliciesData::applyToDocumentLoader):
539         * Shared/WebsitePoliciesData.h:
540         * Shared/WebsiteSimulatedMouseEventsDispatchPolicy.h: Added.
541         * UIProcess/API/APIWebsitePolicies.cpp:
542         (API::WebsitePolicies::copy const):
543         (API::WebsitePolicies::data):
544         * UIProcess/API/APIWebsitePolicies.h:
545         * WebKit.xcodeproj/project.pbxproj:
546
547 2019-04-12  Chris Dumez  <cdumez@apple.com>
548
549         [iOS Sim Debug] ASSERTION FAILED: m_downloads.isEmpty() Layout Test http/tests/websocket/tests/hybi/network-process-crash-error.html is a flaky crash
550         https://bugs.webkit.org/show_bug.cgi?id=196781
551         <rdar://problem/49789381>
552
553         Reviewed by Darin Adler.
554
555         When the network process gets terminated by the client, the NetworkProcessProxy object (and thus its DownloadProxyMap member) get
556         destroyed right away, before we get a call to didClose(IPC::Connection&). As a result, if there are ongoing downloads at the time
557         of the termination, we will hit the assertion above. To address the issue, update the NetworkProcessProxy destructor to invalidate
558         its DownloadProxyMap member, similator to what it does in didClose(IPC::Connection&).
559
560         * UIProcess/Downloads/DownloadProxyMap.cpp:
561         (WebKit::DownloadProxyMap::invalidate):
562         (WebKit::DownloadProxyMap::processDidClose): Deleted.
563         * UIProcess/Downloads/DownloadProxyMap.h:
564         * UIProcess/Network/NetworkProcessProxy.cpp:
565         (WebKit::NetworkProcessProxy::~NetworkProcessProxy):
566         (WebKit::NetworkProcessProxy::didClose):
567
568 2019-04-11  Carlos Garcia Campos  <cgarcia@igalia.com>
569
570         [GTK] REGRESSION(r243860): Many tests failing
571         https://bugs.webkit.org/show_bug.cgi?id=196791
572
573         Reviewed by Joanmarie Diggs.
574
575         Calling updateAccessibilityTree() on document loaded was causing a re-layout because of the backing store update
576         that confused all those tests. We shouldn't need to update the accessibility tree on document load, it should
577         happen automatically when root object is attached/detached. This patch emits children-changed::add when the root
578         object wrapper is attached and children-changed::remove when the root object is detached. That way ATs are
579         notified of the changes in the accessibility tree.
580
581         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
582         (WebKit::WebFrameLoaderClient::dispatchDidFinishDocumentLoad): Remove call to WebPage::updateAccessibilityTree().
583         * WebProcess/WebPage/WebPage.h: Remove updateAccessibilityTree().
584         * WebProcess/WebPage/atk/WebKitWebPageAccessibilityObject.cpp:
585         (coreRootObjectWrapperDetachedCallback): Emit children-changed::remove.
586         (rootWebAreaWrapper): Helper to get the root WebArea wrapper.
587         (accessibilityRootObjectWrapper): Set the parent here when root object is created and emit children-changed::add.
588         (webkitWebPageAccessibilityObjectRefChild): Dot no set the parent here, it's now set when the root object is created.
589         * WebProcess/WebPage/atk/WebKitWebPageAccessibilityObject.h: Remove webkitWebPageAccessibilityObjectRefresh().
590         * WebProcess/WebPage/gtk/WebPageGtk.cpp:
591
592 2019-04-11  Megan Gardner  <megan_gardner@apple.com>
593
594         Update 'Save Image' to more clear instructions
595         https://bugs.webkit.org/show_bug.cgi?id=196833
596         <rdar://problem/47446845>
597
598         Reviewed by Wenson Hsieh.
599
600         Just updating to a new string.
601
602         * UIProcess/API/Cocoa/_WKElementAction.mm:
603         (+[_WKElementAction _elementActionWithType:customTitle:assistant:]):
604
605 2019-04-11  Chris Dumez  <cdumez@apple.com>
606
607         Unable to run system Safari with trunk WebKit
608         https://bugs.webkit.org/show_bug.cgi?id=196777
609         <rdar://problem/49784574>
610
611         Reviewed by Alex Christensen.
612
613         * UIProcess/API/Cocoa/WKWebView.mm:
614         (-[WKWebView _initializeWithConfiguration:]):
615         Add a linkedOnAfter check so that throwing exceptions when related web views use a different
616         data store only happens for apps rebuilt using recent SDK.
617
618         * UIProcess/Cocoa/VersionChecks.h:
619         * UIProcess/Cocoa/VersionChecks.mm:
620         (WebKit::linkedOnOrAfter):
621         - By default, linkedOnOrAfter assumed Safari / MobileSafari is always linked-on-after. To satisfy my
622           use cases, I introduced a new AssumeSafariIsAlwaysLinkedOnAfter parameter so that this behavior can
623           be controlled by the caller.
624         - In the header, DYLD_IOS_VERSION_* / DYLD_MACOS_VERSION_* constants are 0 when building with the
625           non-internal SDK. As a result, the check instead linkedOnOrAfter() would cause us to always return
626           true, which was wrong. I therefore updated the check inside linkedOnOrAfter() to special-case the
627           0 value for sdkVersion.
628
629 2019-04-11  Zalan Bujtas  <zalan@apple.com>
630
631         Add @page margin support
632         https://bugs.webkit.org/show_bug.cgi?id=196680
633         <rdar://problem/45217707>
634
635         Reviewed by Tim Horton.
636
637         * Shared/PrintInfo.cpp:
638         (WebKit::PrintInfo::encode const):
639         (WebKit::PrintInfo::decode):
640         * Shared/PrintInfo.h:
641         * Shared/WebPreferences.yaml:
642         * Shared/gtk/PrintInfoGtk.cpp:
643         (WebKit::PrintInfo::PrintInfo):
644         * Shared/mac/PrintInfoMac.mm:
645         (WebKit::PrintInfo::PrintInfo):
646         * UIProcess/API/C/WKPage.cpp:
647         (WKPageComputePagesForPrinting):
648         * UIProcess/API/C/WKPreferences.cpp:
649         (WKPreferencesSetPageAtRuleSupportEnabled):
650         (WKPreferencesGetPageAtRuleSupportEnabled):
651         * UIProcess/API/C/WKPreferencesRefPrivate.h:
652         * UIProcess/GenericCallback.h:
653         * UIProcess/WebPageProxy.cpp:
654         (WebKit::WebPageProxy::computedPagesCallback):
655         * UIProcess/WebPageProxy.h:
656         * UIProcess/WebPageProxy.messages.in:
657         * UIProcess/mac/WKPrintingView.mm:
658         (pageDidComputePageRects):
659         (-[WKPrintingView _askPageToComputePageRects]):
660         * WebProcess/WebPage/WebPage.cpp:
661         (WebKit::WebPage::beginPrinting):
662         (WebKit::WebPage::computePagesForPrinting):
663         (WebKit::WebPage::computePagesForPrintingImpl):
664         * WebProcess/WebPage/WebPage.h:
665         * WebProcess/WebPage/ios/WebPageIOS.mm:
666         (WebKit::WebPage::computePagesForPrintingAndDrawToPDF):
667
668 2019-04-11  Dean Jackson  <dino@apple.com>
669
670         Extract UTI mapping and allow for additions
671         https://bugs.webkit.org/show_bug.cgi?id=196822
672         <rdar://problem/49822339>
673
674         Reviewed by Tim Horton.
675
676         Use the new helper to map MIME type to UTI.
677
678         * UIProcess/Cocoa/SystemPreviewControllerCocoa.mm:
679         (-[_WKPreviewControllerDataSource previewController:previewItemAtIndex:]):
680         * UIProcess/ios/WKSystemPreviewView.mm:
681         (getUTIForSystemPreviewMIMEType):
682
683
684 2019-04-11  Said Abou-Hallawa  <sabouhallawa@apple.com>
685
686         REGRESSION (r244182): RemoteLayerTreeDrawingArea::flushLayers() should not be reentrant
687         https://bugs.webkit.org/show_bug.cgi?id=196825
688
689         Reviewed by Simon Fraser.
690
691         Ensure the layer transactions IDs are sequential. So bail out of
692         RemoteLayerTreeDrawingArea::flushLayers() if reentrancy is detected.
693
694         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.h:
695         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
696         (WebKit::RemoteLayerTreeDrawingArea::flushLayers):
697
698 2019-04-11  Wenson Hsieh  <wenson_hsieh@apple.com>
699
700         Allow the MediaSource API to be enabled via website policy
701         https://bugs.webkit.org/show_bug.cgi?id=196429
702         <rdar://problem/48774333>
703
704         Reviewed by Tim Horton.
705
706         Adds support for using WebsitePolicies to determine whether to enable the MediaSource API.
707
708         * Shared/WebPreferences.yaml:
709
710         Disengage the mediaSourceEnabled internal preference from the corresponding WebCore setting; to ensure that
711         setting the preference to `true` still results in enabling the MediaSource API, we instead make it such that
712         turning on mediaSourceEnabled causes WebsitePolicies to set its WebsiteMediaSourcePolicy to Enable.
713
714         In the future, we should deprecate and remove this preference, in favor of simply setting preferred
715         compatibility mode on WKWebpagePreferences.
716
717         * Shared/WebPreferences.yaml:
718         * Shared/WebsiteMediaSourcePolicy.h: Copied from Source/WebKit/Shared/WebsitePoliciesData.h.
719         * Shared/WebsitePoliciesData.cpp:
720         (WebKit::WebsitePoliciesData::encode const):
721         (WebKit::WebsitePoliciesData::decode):
722
723         Add plumbing for m_mediaSourcePolicy in the set of website policies.
724
725         (WebKit::WebsitePoliciesData::applyToDocumentLoader):
726
727         Update the document loader with the given media source policy. There are two possibilities when applying the set
728         of policies to the document loader; either the document loader is already attached to a Frame, or the document
729         loader is yet to be attached to a Frame.
730
731         In the first case, we update Frame's settings on the spot, by calling the new applyPoliciesToSettings helper
732         method. In the second scenario, we stash the policy state on DocumentLoader; when the DocumentLoader is attached
733         to a Frame, we'll then update the Frame's settings using DocumentLoader's policy.
734
735         * Shared/WebsitePoliciesData.h:
736         * UIProcess/API/APIWebsitePolicies.cpp:
737         (API::WebsitePolicies::data):
738         * UIProcess/API/APIWebsitePolicies.h:
739         * UIProcess/API/C/WKPage.cpp:
740         (WKPageSetPageNavigationClient):
741         * UIProcess/Cocoa/NavigationState.mm:
742         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
743
744         Move code that adjusts website policies after deciding policies for the navigation action from NavigationClient
745         ::decidePolicyForNavigationAction to the completion handler of the policy listener. This allows us to respect
746         default website policies on the web view configuration, even when using the C API to set the navigation client,
747         and also allows us to have a single call site for adjustPoliciesForCompatibilityMode. This also enables our
748         layout tests to opt into modern compatibility mode by default, when specifying modern compatibility mode on
749         webpage preferences.
750
751         * UIProcess/WebPageProxy.cpp:
752         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
753         (WebKit::WebPageProxy::adjustPoliciesForCompatibilityMode):
754         * UIProcess/WebPageProxy.h:
755         * WebKit.xcodeproj/project.pbxproj:
756
757 2019-04-11  Antti Koivisto  <antti@apple.com>
758
759         REGRESSION: changing iPad orientation on blogger.com crashes under RemoteScrollingCoordinatorProxy::establishLayerTreeScrollingRelations()
760         https://bugs.webkit.org/show_bug.cgi?id=196813
761         <rdar://problem/49393264>
762
763         Reviewed by Simon Fraser.
764
765         No test, can't repro.
766
767         * UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm:
768         (WebKit::RemoteScrollingCoordinatorProxy::establishLayerTreeScrollingRelations):
769
770         Null check the nodes.
771
772 2019-04-10  Chris Dumez  <cdumez@apple.com>
773
774         Regression(r244144) ProcessSwap.ReuseSuspendedProcessLoadHTMLString API test is flaky
775         https://bugs.webkit.org/show_bug.cgi?id=196784
776
777         Reviewed by Antti Koivisto.
778
779         When we enter accelerated compositing mode in the new process, we supposed to *close* the last
780         SuspendedPageProxy, not destroy it. This was causing flakiness in the test because it was testing
781         that we were using the SuspendedPageProxy's process for a cross-site link navigation, which is
782         an optimization. This optimization was partly broken by r244144 as the SuspendedPageProxy would
783         not sometimes be gone by the time we need it.
784
785         * UIProcess/SuspendedPageProxy.cpp:
786         (WebKit::SuspendedPageProxy::pageEnteredAcceleratedCompositingMode):
787
788 2019-04-10  Alex Christensen  <achristensen@webkit.org>
789
790         WKNavigationResponse._downloadAttribute should be nil when no download attribute is present
791         https://bugs.webkit.org/show_bug.cgi?id=196809
792         <rdar://49800762>
793
794         Reviewed by Brady Eidson.
795
796         * UIProcess/API/Cocoa/WKNavigationResponse.mm:
797         (-[WKNavigationResponse _downloadAttribute]):
798
799 2019-04-10  Tim Horton  <timothy_horton@apple.com>
800
801         REGRESSION (r241734): ⌥⌘↑ and ⌥⌘↓ no longer navigate to previous/next Reading List article
802         https://bugs.webkit.org/show_bug.cgi?id=196797
803         <rdar://problem/48484715>
804
805         Reviewed by Simon Fraser.
806
807         * UIProcess/ios/WKKeyboardScrollingAnimator.mm:
808         (-[WKKeyboardScrollingAnimator keyboardScrollForEvent:]):
809         Validate the set of modifier keys pressed when handling a key event for scrolling:
810         Ignore key events with multiple modifier keys pressed.
811         Ignore key events with an invalid modifier key pressed for a given primary key.
812
813 2019-04-10  Said Abou-Hallawa  <sabouhallawa@apple.com>
814
815         requestAnimationFrame should execute before the next frame
816         https://bugs.webkit.org/show_bug.cgi?id=177484
817
818         Reviewed by Simon Fraser.
819
820         Replace the calls to Page::layoutIfNeeded() and willDisplayPage() by
821         a single call to Page::updateRendering(). This new function implements 
822         "Update the rendering" step of the HTML Event Loop specification
823         <https://html.spec.whatwg.org/multipage/webappapis.html#update-the-rendering>.
824
825         * WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp:
826         (WebKit::DrawingAreaCoordinatedGraphics::scheduleCompositingLayerFlush):
827         (WebKit::DrawingAreaCoordinatedGraphics::updateBackingStoreState):
828         (WebKit::DrawingAreaCoordinatedGraphics::display):
829         * WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.cpp:
830         (WebKit::LayerTreeHost::layerFlushTimerFired):
831
832         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
833         (WebKit::RemoteLayerTreeDrawingArea::flushLayers):
834         -- Call Page::updateRendering() to make sure that "Update the rendering"
835            happens immediately before updating the page.
836
837         -- Move the call to RemoteLayerBackingStoreCollection::willFlushLayers()
838            to be exactly before flushing the layers. This fixes the assertion
839            ASSERT(m_inLayerFlush) which was firing when running a layout test.
840            RemoteLayerTreeDrawingArea::flushLayers() now can call itself through
841            TestRunner::notifyDone(). flushLayers() was calling willFlushLayers()
842            twice before calling didFlushLayers().
843
844         * WebProcess/WebPage/WebPage.cpp:
845         (WebKit::WebPage::layoutIfNeeded):
846         (WebKit::WebPage::updateRendering):
847         (WebKit::WebPage::willDisplayPage): Deleted.
848         * WebProcess/WebPage/WebPage.h:
849         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
850         (WebKit::TiledCoreAnimationDrawingArea::flushLayers):
851
852 2019-04-10  Devin Rousso  <drousso@apple.com>
853
854         Web Inspector: save sheet should be anchored underneath the tab bar when detached
855         https://bugs.webkit.org/show_bug.cgi?id=196722
856         <rdar://problem/49613280>
857
858         Reviewed by Timothy Hatcher.
859
860         * WebProcess/WebPage/WebInspectorUI.h:
861         * WebProcess/WebPage/WebInspectorUI.cpp:
862         (WebKit::WebInspectorUI::changeSheetRect): Added.
863         * UIProcess/WebInspectorProxy.messages.in:
864         * UIProcess/WebInspectorProxy.h:
865         (WebKit::WebInspectorProxy::sheetRect const): Added.
866         * UIProcess/WebInspectorProxy.cpp:
867         (WebKit::WebInspectorProxy::setSheetRect): Added.
868         (WebKit::WebInspectorProxy::platformSetSheetRect): Added.
869         * UIProcess/gtk/WebInspectorProxyGtk.cpp:
870         (WebKit::WebInspectorProxy::platformSetSheetRect): Added.
871         * UIProcess/mac/WebInspectorProxyMac.mm:
872         (-[WKWebInspectorProxyObjCAdapter window:willPositionSheet:usingRect:]): Added.
873         (WebKit::WebInspectorProxy::platformSetSheetRect): Added.
874         * UIProcess/win/WebInspectorProxyWin.cpp:
875         (WebKit::WebInspectorProxy::platformSetSheetRect): Added.
876         * UIProcess/wpe/WebInspectorProxyWPE.cpp:
877         (WebKit::WebInspectorProxy::platformSetSheetRect): Added.
878
879         * WebProcess/WebPage/RemoteWebInspectorUI.h:
880         * WebProcess/WebPage/RemoteWebInspectorUI.cpp:
881         (WebKit::RemoteWebInspectorUI::changeSheetRect): Added.
882         * UIProcess/RemoteWebInspectorProxy.messages.in:
883         * UIProcess/RemoteWebInspectorProxy.h:
884         (WebKit::RemoteWebInspectorProxy::sheetRect const): Added.
885         * UIProcess/RemoteWebInspectorProxy.cpp:
886         (WebKit::RemoteWebInspectorProxy::setSheetRect): Added.
887         (WebKit::RemoteWebInspectorProxy::platformSetSheetRect): Added.
888         * UIProcess/gtk/RemoteWebInspectorProxyGtk.cpp:
889         (WebKit::RemoteWebInspectorProxy::platformSetSheetRect): Added.
890         * UIProcess/mac/RemoteWebInspectorProxyMac.mm:
891         (-[WKRemoteWebInspectorProxyObjCAdapter window:willPositionSheet:usingRect:]): Added.
892         (WebKit::RemoteWebInspectorProxy::platformCreateFrontendPageAndWindow):
893         (WebKit::RemoteWebInspectorProxy::platformSetSheetRect): Added.
894
895 2019-04-10  Andy Estes  <aestes@apple.com>
896
897         [iOS] Let PDFHostViewController specify the background color to use for WKPDFView
898         https://bugs.webkit.org/show_bug.cgi?id=196785
899         <rdar://problem/48240051>
900
901         Reviewed by Tim Horton.
902
903         * UIProcess/ios/WKPDFView.mm:
904         (-[WKPDFView web_initWithFrame:webView:mimeType:]):
905
906 2019-04-10  Chris Dumez  <cdumez@apple.com>
907
908         Unreviewed, rolling out r244146.
909
910         Caused a few DeviceOrientation API test failures on iOS
911
912         Reverted changeset:
913
914         "Unable to run system Safari with trunk WebKit"
915         https://bugs.webkit.org/show_bug.cgi?id=196777
916         https://trac.webkit.org/changeset/244146
917
918 2019-04-10  Devin Rousso  <drousso@apple.com>
919
920         Web Inspector: REGRESSION: lazy agents used outside of frontend/instrumentation can be accessed before being created
921         https://bugs.webkit.org/show_bug.cgi?id=196725
922         <rdar://problem/49669810>
923
924         Reviewed by Timothy Hatcher.
925
926         * WebProcess/WebPage/WebInspector.cpp:
927         (WebKit::WebInspector::showMainResourceForFrame):
928
929 2019-04-10  Youenn Fablet  <youenn@apple.com>
930
931         Clear Cache Storage structures before removing all related files
932         https://bugs.webkit.org/show_bug.cgi?id=196650
933
934         Reviewed by Alex Christensen.
935
936         Previously, we were clearing files in parallel to clearing the internal CacheStorage structures.
937         To make things more deterministic, clear files/folders directly
938         after CachesStorage structures have finished being cleared.
939
940         * NetworkProcess/cache/CacheStorageEngine.cpp:
941         (WebKit::CacheStorage::Engine::clearAllCaches):
942         (WebKit::CacheStorage::Engine::clearCachesForOrigin):
943
944 2019-04-10  Alex Christensen  <achristensen@webkit.org>
945
946         Add SPI WKNavigationResponse._downloadAttribute
947         https://bugs.webkit.org/show_bug.cgi?id=196755
948         <rdar://49587365>
949
950         Reviewed by Brady Eidson.
951
952         * UIProcess/API/APINavigationResponse.h:
953         * UIProcess/API/Cocoa/WKNavigationResponse.mm:
954         (-[WKNavigationResponse _downloadAttribute]):
955         * UIProcess/API/Cocoa/WKNavigationResponsePrivate.h:
956         * UIProcess/ProvisionalPageProxy.cpp:
957         (WebKit::ProvisionalPageProxy::decidePolicyForResponse):
958         * UIProcess/ProvisionalPageProxy.h:
959         * UIProcess/WebPageProxy.cpp:
960         (WebKit::WebPageProxy::decidePolicyForResponse):
961         (WebKit::WebPageProxy::decidePolicyForResponseShared):
962         * UIProcess/WebPageProxy.h:
963         * UIProcess/WebPageProxy.messages.in:
964         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
965         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForResponse):
966         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
967
968 2019-04-10  Youenn Fablet  <youenn@apple.com>
969
970         SWClientConnection should not double hop to fire some events
971         https://bugs.webkit.org/show_bug.cgi?id=196735
972
973         Reviewed by Alex Christensen.
974
975         Removed unnecessary method.
976
977         * WebProcess/Storage/WebSWClientConnection.cpp:
978         * WebProcess/Storage/WebSWClientConnection.h:
979
980 2019-04-10  Per Arne Vollan  <pvollan@apple.com>
981
982         [iOS] Fix iokit-get-properties sandbox violations
983         https://bugs.webkit.org/show_bug.cgi?id=196782
984         <rdar://problem/49497720>
985
986         Reviewed by Brent Fulgham.
987
988         Add iokit properties to the WebContent sandbox on iOS.
989
990         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
991
992 2019-04-10  Tim Horton  <timothy_horton@apple.com>
993
994         Add modern API for overriding the page's specified viewport configuration
995         https://bugs.webkit.org/show_bug.cgi?id=167734
996         <rdar://problem/30331795>
997
998         Reviewed by Simon Fraser.
999
1000         * Shared/WebPageCreationParameters.cpp:
1001         (WebKit::WebPageCreationParameters::encode const):
1002         (WebKit::WebPageCreationParameters::decode):
1003         * Shared/WebPageCreationParameters.h:
1004         Plumb overrideViewportArguments in WebPageCreationParameters, so that
1005         if the process crashes (or swaps) they are maintained.
1006
1007         * UIProcess/API/Cocoa/WKWebView.mm:
1008         (viewportArgumentsFromDictionary):
1009         (-[WKWebView _overrideViewportWithArguments:]):
1010         Add SPI to set override viewport arguments. Parse them into a ViewportArguments
1011         object and use the existing (now improved) overrideViewportArguments mechanism
1012         to take over the page's viewport arguments.
1013
1014         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1015         * UIProcess/WebPageProxy.cpp:
1016         (WebKit::WebPageProxy::creationParameters):
1017         * UIProcess/WebPageProxy.h:
1018         * UIProcess/ios/WebPageProxyIOS.mm:
1019         (WebKit::WebPageProxy::setOverrideViewportArguments):
1020         * WebProcess/WebPage/WebPage.cpp:
1021         Plumb overrideViewportArguments around more.
1022
1023 2019-04-10  Jiewen Tan  <jiewen_tan@apple.com>
1024
1025         Add runJavaScriptInFrame for WebPageProxy/WebPage
1026         https://bugs.webkit.org/show_bug.cgi?id=196750
1027         <rdar://problem/49755738>
1028
1029         Reviewed by Youenn Fablet.
1030
1031         Tests of the new method will be covered by the internal counterpart.
1032
1033         * UIProcess/WebFrameProxy.cpp:
1034         (WebKit::WebFrameProxy::loadData):
1035         * UIProcess/WebFrameProxy.h:
1036         Add a comment.
1037         * UIProcess/WebPageProxy.cpp:
1038         (WebKit::WebPageProxy::runJavaScriptInMainFrame):
1039         (WebKit::WebPageProxy::runJavaScriptInMainFrameScriptWorld):
1040         Merge the above two runJavaScriptInMainFrame*.
1041         (WebKit::WebPageProxy::runJavaScriptInFrame):
1042         * UIProcess/WebPageProxy.h:
1043         * WebProcess/WebPage/WebPage.cpp:
1044         (WebKit::WebPage::loadDataInFrame):
1045         Add an assertion.
1046         (WebKit::WebPage::runJavaScript):
1047         (WebKit::WebPage::runJavaScriptInMainFrameScriptWorld):
1048         (WebKit::WebPage::runJavaScriptInFrame):
1049         (WebKit::WebPage::runJavaScriptInMainFrame): Deleted.
1050         * WebProcess/WebPage/WebPage.h:
1051         * WebProcess/WebPage/WebPage.messages.in:
1052
1053 2019-04-10  Chris Dumez  <cdumez@apple.com>
1054
1055         Unable to run system Safari with trunk WebKit
1056         https://bugs.webkit.org/show_bug.cgi?id=196777
1057         <rdar://problem/49784574>
1058
1059         Reviewed by Alex Christensen.
1060
1061         * UIProcess/API/Cocoa/WKWebView.mm:
1062         (-[WKWebView _initializeWithConfiguration:]):
1063         Add a linkedOnAfter check so that throwing exceptions when related web views use a different
1064         data store only happens for apps rebuilt using recent SDK.
1065
1066         * UIProcess/Cocoa/VersionChecks.h:
1067         * UIProcess/Cocoa/VersionChecks.mm:
1068         (WebKit::linkedOnOrAfter):
1069         - By default, linkedOnOrAfter assumed Safari / MobileSafari is always linked-on-after. To satisfy my
1070           use cases, I introduced a new AssumeSafariIsAlwaysLinkedOnAfter parameter so that this behavior can
1071           be controlled by the caller.
1072         - In the header, DYLD_IOS_VERSION_* / DYLD_MACOS_VERSION_* constants are 0 when building with the
1073           non-internal SDK. As a result, the check instead linkedOnOrAfter() would cause us to always return
1074           true, which was wrong. I therefore updated the check inside linkedOnOrAfter() to special-case the
1075           0 value for sdkVersion.
1076
1077 2019-04-10  Chris Dumez  <cdumez@apple.com>
1078
1079         Regression(r240562) Audio sometimes keeps playing in previous process after a process-swap
1080         https://bugs.webkit.org/show_bug.cgi?id=196774
1081         <rdar://problem/49460572>
1082
1083         Reviewed by Alex Christensen.
1084
1085         r240562 added logic to prevent flashing on navigation. When we receive the DidFailToSuspendAfterProcessSwap
1086         IPC from the previous process, we would delay closing the WebPage in that process until EnterAcceleratedCompositingMode
1087         IPC is received from the new process. The issue is that this was racy as we would receive the EnterAcceleratedCompositingMode
1088         IPC from the new process *before* receiving the DidFailToSuspendAfterProcessSwap IPC from the previous process, which which
1089         case we would fail to close the WebPage and audio could keep playing.
1090
1091         To address the issue, the WebPageProxy keeps track of its last suspended page and notifies it whenever it receives the
1092         EnterAcceleratedCompositingMode IPC. If the suspended page already received the DidFailToSuspendAfterProcessSwap IPC, it
1093         will close the page. Otherwise, it will set a boolean data member indicating that we should not delay page closing when
1094         the DidFailToSuspendAfterProcessSwap is eventually received.
1095
1096         * UIProcess/SuspendedPageProxy.cpp:
1097         (WebKit::SuspendedPageProxy::SuspendedPageProxy):
1098         (WebKit::SuspendedPageProxy::pageEnteredAcceleratedCompositingMode):
1099         (WebKit::SuspendedPageProxy::didProcessRequestToSuspend):
1100         * UIProcess/SuspendedPageProxy.h:
1101         * UIProcess/WebPageProxy.cpp:
1102         (WebKit::WebPageProxy::suspendCurrentPageIfPossible):
1103         (WebKit::WebPageProxy::enterAcceleratedCompositingMode):
1104         * UIProcess/WebPageProxy.h:
1105         * UIProcess/WebProcessPool.cpp:
1106         * UIProcess/WebProcessPool.h:
1107
1108 2019-04-10  Timothy Hatcher  <timothy@apple.com>
1109
1110         WKScrollView background color does not match WKWebView before content is loaded.
1111         https://bugs.webkit.org/show_bug.cgi?id=196745
1112         rdar://problem/49750810
1113
1114         Reviewed by Megan Gardner.
1115
1116         * UIProcess/API/Cocoa/WKWebView.mm:
1117         (scrollViewBackgroundColor): Default to _contentView.backgroundColor on invalid base color.
1118         (-[WKWebView _processDidExit]): Reset to _contentView.backgroundColor.
1119         (-[WKWebView setBackgroundColor:]): Call _updateScrollViewBackground since it can use
1120         _contentView.backgroundColor and it has changed.
1121
1122 2019-04-10  Megan Gardner  <megan_gardner@apple.com>
1123
1124         Fix text autoscrolling when typing in modern webkit
1125         https://bugs.webkit.org/show_bug.cgi?id=196718
1126         <rdar://problem/49225507>
1127
1128         Reviewed by Tim Horton.
1129
1130         For staging only. We need to turn off UIKit's scrolling behavior to land
1131         the changes we are making. To keep from the build ever breaking,
1132         I am temporarily circumventing the changes in UIKit. This will be removed
1133         once the next UIKit submission happens.
1134
1135         * UIProcess/ios/WKContentViewInteraction.mm:
1136         (-[WKUIWKTextInteractionAssistant scrollSelectionToVisible]):
1137         (-[WKContentView setUpTextSelectionAssistant]):
1138
1139 2019-04-10  Wenson Hsieh  <wenson_hsieh@apple.com>
1140
1141         [iOSMac] Opt into modern compatibility mode by default
1142         https://bugs.webkit.org/show_bug.cgi?id=196763
1143         <rdar://problem/49038732>
1144
1145         Reviewed by Tim Horton.
1146
1147         Achieve this by limiting legacy compatibility mode by default to non-iOSMac iOS only.
1148
1149         * Shared/WebPreferences.yaml:
1150         * Shared/WebPreferencesDefaultValues.h:
1151
1152 2019-04-10  Alex Christensen  <achristensen@webkit.org>
1153
1154         RemoteObjectRegistry message receiver should be removed when WebPage::close is called instead of waiting until dealloc
1155         https://bugs.webkit.org/show_bug.cgi?id=196744
1156         <rdar://49415309>
1157
1158         Reviewed by Chris Dumez.
1159
1160         This is a similar problem to the one I fixed in r241306 so I piggy-backed on the same test.
1161         When you do a cross site navigation but the previous page is in a suspended process then you navigate back,
1162         you can get two WebPage objects in the same process with the same IDs.  WebPage::close has been called
1163         on the old one which is supposed to make it so all the message receivers associated with it have been removed
1164         so we don't have any loss of communication, but we missed the RemoteObjectRegistry messages, which are owned
1165         by the ObjC bundle object wrapping the WebPage (which can keep it alive if a strong reference to it is held).
1166         To fix the assertion that happens in this case and the resulting communication breakage, teach the WebPage about
1167         these messages so it can tear down the message receiver with the others it removes at close time.
1168
1169         * Shared/API/Cocoa/RemoteObjectRegistry.h:
1170         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:
1171         (-[WKWebProcessPlugInBrowserContextController dealloc]):
1172         (-[WKWebProcessPlugInBrowserContextController _remoteObjectRegistry]):
1173         * WebProcess/WebPage/Cocoa/WebPageCocoa.mm:
1174         (WebKit::WebPage::addRemoteObjectRegistry):
1175         * WebProcess/WebPage/WebPage.cpp:
1176         (WebKit::WebPage::close):
1177         * WebProcess/WebPage/WebPage.h:
1178
1179 2019-04-10  Chris Dumez  <cdumez@apple.com>
1180
1181         Unreviewed, drop SuspendedPageProxy data member that is unused after r244075.
1182
1183         * UIProcess/SuspendedPageProxy.h:
1184
1185 2019-04-10  Antoine Quint  <graouts@apple.com>
1186
1187         Enable Pointer Events on watchOS
1188         https://bugs.webkit.org/show_bug.cgi?id=196771
1189         <rdar://problem/49040909>
1190
1191         Reviewed by Dean Jackson.
1192
1193         * Configurations/FeatureDefines.xcconfig:
1194
1195 2019-04-10  Brady Eidson  <beidson@apple.com>
1196
1197         Background tabs are not fully reactivated after a link is opened from an external application.
1198         <rdar://problem/49533278> and https://bugs.webkit.org/show_bug.cgi?id=196705
1199
1200         Reviewed by Chris Dumez.
1201
1202         If an app unparents a WKWebView right after activation but before the "applicationWillEnterForeground" notification
1203         is dispatched, then that WKWebView is in a broken state with a frozen layer tree.
1204
1205         The WKApplicationStateTrackingView logic needs to be a little more resilient.
1206
1207         * UIProcess/ios/WKApplicationStateTrackingView.mm:
1208         (-[WKApplicationStateTrackingView willMoveToWindow:]): When clearing the window, remember the current background state.
1209         (-[WKApplicationStateTrackingView didMoveToWindow]): If our last observed background state doesn't match the current
1210           background state then fake the relevant notification.
1211         (-[WKApplicationStateTrackingView _applicationDidEnterBackground]): Remember that we've observed a backgrounding.
1212         (-[WKApplicationStateTrackingView _applicationWillEnterForeground]): Remember that we've observed a foregrounding.
1213
1214 2019-04-10  Diego Pino Garcia  <dpino@igalia.com>
1215
1216         Unreviewed, build fix for r244097
1217
1218         * NetworkProcess/NetworkProcess.cpp:
1219         (WebKit::NetworkProcess::actualPrepareToSuspend):
1220         (WebKit::NetworkProcess::resume):
1221         Added guards for ENABLE(SERVICE_WORKER)
1222
1223 2019-04-09  Keith Rollin  <krollin@apple.com>
1224
1225         Unreviewed build maintenance -- update .xcfilelists.
1226
1227         * DerivedSources-input.xcfilelist:
1228         * DerivedSources-output.xcfilelist:
1229
1230 2019-04-09  Zalan Bujtas  <zalan@apple.com>
1231
1232         [AutoSizing] Avoid making text paragraphs scroll horizontally when there is a wide table
1233         https://bugs.webkit.org/show_bug.cgi?id=196743
1234         <rdar://problem/43897551>
1235
1236         Reviewed by Tim Horton.
1237
1238         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1239         (WebKit::WebFrameLoaderClient::transitionToCommittedForNewPage):
1240         * WebProcess/WebPage/WebPage.cpp:
1241         (WebKit::WebPage::setViewLayoutSize):
1242
1243 2019-04-09  Youenn Fablet  <youenn@apple.com>
1244
1245         Close service worker database on network process suspension
1246         https://bugs.webkit.org/show_bug.cgi?id=196623
1247         <rdar://problem/48930869>
1248
1249         Reviewed by Alex Christensen.
1250
1251         Close service worker database when preparing to suspend.
1252         On resume, push changes if any is needed.
1253
1254         * NetworkProcess/NetworkProcess.cpp:
1255         (WebKit::NetworkProcess::actualPrepareToSuspend):
1256         (WebKit::NetworkProcess::cancelPrepareToSuspend):
1257         (WebKit::NetworkProcess::processDidResume):
1258         * UIProcess/API/Cocoa/WKProcessPool.mm:
1259         (-[WKProcessPool _sendNetworkProcessWillSuspendImminently]):
1260         (-[WKProcessPool _sendNetworkProcessDidResume]):
1261         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
1262         * UIProcess/Network/NetworkProcessProxy.h:
1263         * UIProcess/WebProcessPool.cpp:
1264         (WebKit::WebProcessPool::sendNetworkProcessWillSuspendImminently):
1265         (WebKit::WebProcessPool::sendNetworkProcessDidResume):
1266         * UIProcess/WebProcessPool.h:
1267
1268 2019-04-09  Daniel Bates  <dabates@apple.com>
1269
1270         [iPad] Should open popover when the spacebar is pressed
1271         https://bugs.webkit.org/show_bug.cgi?id=196360
1272         <rdar://problem/49389129>
1273
1274         Reviewed by Brent Fulgham.
1275
1276         Pressing the spacebar should open the popover for a focused popup button (e.g. <select>) on iOS
1277         just like it does on the Mac.
1278
1279         For now, we keep the iPhone behavior of blurring the element when the Done button is pressed and
1280         hence pressing spacebar does nothing (because there is no focused element).
1281
1282         * UIProcess/ios/WKContentViewInteraction.h:
1283         * UIProcess/ios/WKContentViewInteraction.mm:
1284         (-[WKContentView accessoryOpen]): Added. Extracted the logic from -_elementDidFocus to scroll to
1285         the focused element, update the accessory and then tell the accessory to begin editing.
1286         (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
1287         Write in terms of -accessoryOpen.
1288         * UIProcess/ios/forms/WKFormPeripheralBase.mm:
1289         (-[WKFormPeripheralBase handleKeyEvent:]): Interpret the spacebar when the peripheral is closed (!_editing)
1290         and call -accessoryOpen to ultimately call back to this peripheral to tell it to begin editing,
1291         which will cause the popover to appear again.
1292
1293 2019-04-09  Chris Dumez  <cdumez@apple.com>
1294
1295         Unreviewed, fix webkitpy failure after r244085.
1296
1297         Use a list instead of a set for header includes so that the order is
1298         maintained.
1299
1300         * Scripts/webkit/messages.py:
1301
1302 2019-04-09  Andy Estes  <aestes@apple.com>
1303
1304         [Apple Pay] Add release logging to PaymentCoordinator
1305         https://bugs.webkit.org/show_bug.cgi?id=196738
1306
1307         Reviewed by Alex Christensen.
1308
1309         * WebProcess/ApplePay/WebPaymentCoordinator.cpp:
1310         (WebKit::WebPaymentCoordinator::isAlwaysOnLoggingAllowed const):
1311         * WebProcess/ApplePay/WebPaymentCoordinator.h:
1312
1313 2019-04-09  Jer Noble  <jer.noble@apple.com>
1314
1315         [Cocoa] Awaken UIProcess if WebContent process is awakened from suspensions unexpectedly.
1316         https://bugs.webkit.org/show_bug.cgi?id=196659
1317
1318         Reviewed by Chris Dumez.
1319
1320         * Platform/IPC/Connection.h:
1321         (IPC::Connection::sendWithAsyncReply):
1322         * Platform/spi/ios/AssertionServicesSPI.h:
1323         * Shared/Cocoa/ProcessTaskStateObserver.h: Added.
1324         (WebKit::ProcessTaskStateObserver::setClient):
1325         (WebKit::ProcessTaskStateObserver::client):
1326         (WebKit::ProcessTaskStateObserver::taskState const):
1327         * Shared/Cocoa/ProcessTaskStateObserver.mm: Added.
1328         (-[WKProcessTaskStateObserverDelegate process:taskStateDidChange:]):
1329         (WebKit::toProcessTaskStateObserverTaskState):
1330         (WebKit::ProcessTaskStateObserver::ProcessTaskStateObserver):
1331         (WebKit::ProcessTaskStateObserver::~ProcessTaskStateObserver):
1332         (WebKit::ProcessTaskStateObserver::setTaskState):
1333         * UIProcess/Cocoa/WebProcessProxyCocoa.mm:
1334         (WebKit::WebProcessProxy::processWasUnexpectedlyUnsuspended):
1335         * UIProcess/ProcessAssertion.h:
1336         * UIProcess/ProcessThrottler.cpp:
1337         (WebKit::ProcessThrottler::updateAssertion):
1338         * UIProcess/ProcessThrottler.h:
1339         (WebKit::ProcessThrottler::shouldBeRunnable const):
1340         * UIProcess/WebProcessProxy.h:
1341         * UIProcess/WebProcessProxy.messages.in:
1342         * UIProcess/ios/ProcessAssertionIOS.mm:
1343         (WebKit::reasonForState):
1344         (WebKit::toBKSProcessAssertionReason):
1345         (WebKit::ProcessAssertion::ProcessAssertion):
1346         * WebKit.xcodeproj/project.pbxproj:
1347         * WebProcess/WebProcess.cpp:
1348         (WebKit::WebProcess::actualPrepareToSuspend):
1349         (WebKit::WebProcess::cancelPrepareToSuspend):
1350         (WebKit::WebProcess::processDidResume):
1351         * WebProcess/WebProcess.h:
1352         * WebProcess/cocoa/WebProcessCocoa.mm:
1353         (WebKit::WebProcess::processTaskStateDidChange):
1354
1355 2019-04-09  Alex Christensen  <achristensen@webkit.org>
1356
1357         Clicking "Go Back" from a safe browsing warning from an iframe should navigate the WKWebView back to the previous page
1358         https://bugs.webkit.org/show_bug.cgi?id=196665
1359         <rdar://45115669>
1360
1361         Reviewed by Geoff Garen.
1362
1363         It is insufficient to just not navigate the subframe.  We must leave the page that contained it.
1364
1365         * UIProcess/API/Cocoa/WKWebView.mm:
1366         (-[WKWebView _showSafeBrowsingWarning:completionHandler:]):
1367         * UIProcess/Cocoa/WebViewImpl.mm:
1368         (WebKit::WebViewImpl::showSafeBrowsingWarning):
1369
1370 2019-04-09  John Wilander  <wilander@apple.com>
1371
1372         Pick up Ad Click Attribution conversions in NetworkResourceLoader::willSendRedirectedRequest()
1373         https://bugs.webkit.org/show_bug.cgi?id=196558
1374         <rdar://problem/47650245>
1375
1376         Reviewed by Youenn Fablet.
1377
1378         So called pixel requests have traditionally been used to send ad click
1379         attribution data to click sources. The privacy implications of such
1380         pixel requests are severe which is in part why browsers have started to
1381         block cookies from being sent in such third-party requests.
1382
1383         To allow for a smooth transition to more privacy-friendly ad click
1384         attribution, we should allow servers to make a redirect to
1385         https://click-source.example/.well-known/ad-click-attribution/ to
1386         trigger a so called conversion.
1387
1388         This patch checks for the well-known location in the path component of
1389         the redirect URL. If the request indeed goes to the well-known location,
1390         we parse the conversion data and send it to the storage in the network
1391         session.
1392
1393         * NetworkProcess/NetworkAdClickAttribution.cpp:
1394         (WebKit::NetworkAdClickAttribution::convert):
1395             Reporting function.
1396         * NetworkProcess/NetworkAdClickAttribution.h:
1397         * NetworkProcess/NetworkResourceLoader.cpp:
1398         (WebKit::NetworkResourceLoader::willSendRedirectedRequest):
1399             Now checks for the well-known location through a call to
1400             WebCore::AdClickAttribution::parseConversionRequest().
1401         * NetworkProcess/NetworkSession.cpp:
1402         (WebKit::NetworkSession::convertAdClickAttribution):
1403             Piping to WebKit::NetworkAdClickAttribution::convert().
1404         * NetworkProcess/NetworkSession.h:
1405
1406 2019-04-09  Chris Dumez  <cdumez@apple.com>
1407
1408         [iOS] WebContent processes should be marked as "Foreground Running" when their view is visible
1409         https://bugs.webkit.org/show_bug.cgi?id=196695
1410         <rdar://problem/48073787>
1411
1412         Reviewed by Tim Horton.
1413
1414         In order for WebContent processes to get marked as "Foreground Running" when their view
1415         is visible on iOS, we now construct a _UILayerHostView in the UIProcess and add it as
1416         a subview of the WKContentView. The _UILayerHostView's visibility target is the
1417         WebContent process currently associated with the view.
1418
1419         * Platform/spi/ios/UIKitSPI.h:
1420         * UIProcess/PageClient.h:
1421         (WebKit::PageClient::didCreateContextForVisibilityPropagation):
1422         * UIProcess/WebPageProxy.h:
1423         * UIProcess/WebProcessProxy.h:
1424         (WebKit::WebProcessProxy::contextIDForVisibilityPropagation):
1425         * UIProcess/WebProcessProxy.messages.in:
1426         * UIProcess/ios/PageClientImplIOS.h:
1427         * UIProcess/ios/PageClientImplIOS.mm:
1428         (WebKit::PageClientImpl::didCreateContextForVisibilityPropagation):
1429         * UIProcess/ios/WKContentView.h:
1430         * UIProcess/ios/WKContentView.mm:
1431         (-[WKContentView _commonInitializationWithProcessPool:configuration:]):
1432         (-[WKContentView _setupVisibilityPropagationView]):
1433         (-[WKContentView _processDidExit]):
1434         (-[WKContentView _didRelaunchProcess]):
1435         (-[WKContentView _processDidCreateContextForVisibilityPropagation]):
1436         * UIProcess/ios/WebPageProxyIOS.mm:
1437         (WebKit::WebPageProxy::didCreateContextForVisibilityPropagation):
1438         * UIProcess/ios/WebProcessProxyIOS.mm:
1439         (WebKit::WebProcessProxy::didCreateContextForVisibilityPropagation):
1440         * WebProcess/WebProcess.h:
1441         * WebProcess/cocoa/WebProcessCocoa.mm:
1442         (WebKit::WebProcess::platformInitializeWebProcess):
1443
1444 2019-04-09  Sihui Liu  <sihui_liu@apple.com>
1445
1446         Remove unnecessary network process assertion for IDB close
1447         https://bugs.webkit.org/show_bug.cgi?id=196693
1448
1449         Reviewed by Geoffrey Garen.
1450
1451         * NetworkProcess/NetworkProcess.cpp:
1452         (WebKit::NetworkProcess::createIDBServer):
1453         (WebKit::NetworkProcess::notifyHoldingLockedFiles): Deleted.
1454         * NetworkProcess/NetworkProcess.h:
1455         * UIProcess/Network/NetworkProcessProxy.cpp:
1456         (WebKit::NetworkProcessProxy::didClose):
1457         (WebKit::NetworkProcessProxy::setIsIDBDatabaseHoldingLockedFiles): Deleted.
1458         * UIProcess/Network/NetworkProcessProxy.h:
1459         * UIProcess/Network/NetworkProcessProxy.messages.in:
1460
1461 2019-04-09  Chris Dumez  <cdumez@apple.com>
1462
1463         Loads using loadHTMLString() cause flashing when process-swapping
1464         https://bugs.webkit.org/show_bug.cgi?id=196714
1465         <rdar://problem/49637354>
1466
1467         Reviewed by Antti Koivisto.
1468
1469         Our logic to decide if we should construct a SuspendedPageProxy on process-swap was assuming
1470         a SuspendedPageProxy is only useful for PageCache and would therefore not create one if PageCache
1471         is disabled or if there is no associated WebBackForwardListItem. However, constructing a
1472         SuspendedPageProxy is also useful to prevent flashing when process-swapping as we need to keep
1473         displaying the layer of the previous process until there is something meaningful to show in the
1474         new process.
1475
1476         This patch makes it so that we now construct a SuspendedPageProxy on process-swap, even if
1477         PageCache is disabled or if there is no associated WebBackForwardListItem. The process in
1478         question will not be useful for PageCache but it will avoid flashing. The SuspendedPageProxy's
1479         process may also get used for future navigations to the same site (as demonstrated by the
1480         API test) which is beneficial for performance.
1481
1482         * UIProcess/SuspendedPageProxy.cpp:
1483         (WebKit::SuspendedPageProxy::SuspendedPageProxy):
1484         * UIProcess/SuspendedPageProxy.h:
1485         * UIProcess/WebPageProxy.cpp:
1486         (WebKit::WebPageProxy::suspendCurrentPageIfPossible):
1487         * UIProcess/WebProcessPool.cpp:
1488         (WebKit::WebProcessPool::findReusableSuspendedPageProcess):
1489
1490 2019-04-08  Don Olmstead  <don.olmstead@sony.com>
1491
1492         [CMake][WinCairo] Separate copied headers into different directories
1493         https://bugs.webkit.org/show_bug.cgi?id=196655
1494
1495         Reviewed by Michael Catanzaro.
1496
1497         * CMakeLists.txt:
1498         * PlatformWin.cmake:
1499
1500 2019-04-08  Wenson Hsieh  <wenson_hsieh@apple.com>
1501
1502         [iOS] Do not allow starting selection drags when selection views are not visible
1503         https://bugs.webkit.org/show_bug.cgi?id=196686
1504         <rdar://problem/49399192>
1505
1506         Reviewed by Tim Horton.
1507
1508         Currently, on iOS, it's possible to start dragging selected text in a web view even if the selection itself is
1509         not visible. This can happen if the user selects some text, focuses a native text field, and then long presses
1510         the previously selected text. This is because the text is still selected in the document since we don't clear
1511         the selection when resigning first responder on iOS, despite the fact that the native selection view is no
1512         longer present.
1513
1514         To fix this, we add plumbing to specify the set of allowed drag source actions when requesting drag start; this
1515         set of allowed drag source actions only includes DragSourceActionSelection if the selection view can be visible
1516         (i.e. the content view is first responder, and isn't suppressing text interactions). We then update WebPage's
1517         allowed drag source actions with this given set of actions, while sending "dragstart" to the page.
1518
1519         * UIProcess/WebPageProxy.h:
1520         * UIProcess/ios/WKContentViewInteraction.mm:
1521         (-[WKContentView hasSelectablePositionAtPoint:]):
1522         (-[WKContentView textInteractionGesture:shouldBeginAtPoint:]):
1523
1524         Only bail out of text selection in text that is already selected if the web view allows dragging text selections
1525         (i.e. the web view is first responder, and is not suppressing text interactions).
1526
1527         (-[WKContentView _allowedDragSourceActions]):
1528         (-[WKContentView _dragInteraction:itemsForAddingToSession:withTouchAtPoint:completion:]):
1529         (-[WKContentView _dragInteraction:prepareForSession:completion:]):
1530
1531         Pass the set of allowed drag source actions when requesting a drag start or adding items to an existing session.
1532
1533         * UIProcess/ios/WebPageProxyIOS.mm:
1534         (WebKit::WebPageProxy::requestDragStart):
1535         (WebKit::WebPageProxy::requestAdditionalItemsForDragSession):
1536
1537         Plumb the allowed drag source actions from the UI process (WKContentView) over to the web process (WebPage).
1538
1539         * WebProcess/WebCoreSupport/WebDragClient.cpp:
1540         (WebKit::WebDragClient::dragSourceActionMaskForPoint):
1541
1542         Instead of always returning Any, consult WebPage's allowed drag source actions.
1543
1544         * WebProcess/WebPage/WebPage.h:
1545         (WebKit::WebPage::allowedDragSourceActions const):
1546         * WebProcess/WebPage/WebPage.messages.in:
1547         * WebProcess/WebPage/ios/WebPageIOS.mm:
1548         (WebKit::WebPage::requestDragStart):
1549         (WebKit::WebPage::requestAdditionalItemsForDragSession):
1550
1551         Set WebPage's allowed drag source actions to the given set of actions when sending a drag start to the page.
1552
1553 2019-04-08  Justin Fan  <justin_fan@apple.com>
1554
1555         [Web GPU] Fix Web GPU experimental feature on iOS
1556         https://bugs.webkit.org/show_bug.cgi?id=196632
1557
1558         Reviewed by Myles C. Maxfield.
1559
1560         Add feature conditionals for iOS 11.
1561         Properly make Web GPU available on iOS 11+.
1562
1563         * Configurations/FeatureDefines.xcconfig:
1564         * Configurations/WebKitTargetConditionals.xcconfig:
1565
1566 2019-04-08  Alex Christensen  <achristensen@webkit.org>
1567
1568         Fix selector name after r243834
1569         https://bugs.webkit.org/show_bug.cgi?id=196549
1570
1571         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
1572         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
1573         I forgot the colon in the setter's name.
1574
1575 2019-04-08  Antti Koivisto  <antti@apple.com>
1576
1577         Compute touch actions for touch point from remote layer tree regions
1578         https://bugs.webkit.org/show_bug.cgi?id=196701
1579
1580         Reviewed by Simon Fraser.
1581
1582         Add a function for finding the right layer and getting the touch actions in UI process side.
1583
1584         The code is not used yet.
1585
1586         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.h:
1587         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm:
1588         (WebKit::touchActionsForPoint):
1589
1590         Use the same code as overlap hit testing for collecting the candidate layers for the touch point,
1591         taking event regions into account.
1592         Return the touch actions from the deepest event sensitive layer hit.
1593
1594         (-[UIView _web_findDescendantViewAtPoint:withEvent:]):
1595
1596         Modernize.
1597
1598 2019-04-08  Brent Fulgham  <bfulgham@apple.com>
1599
1600         Make HSTS list handling more robust against unexpected content 
1601         https://bugs.webkit.org/show_bug.cgi?id=196552
1602         <rdar://problem/43403817>
1603
1604         Reviewed by Chris Dumez.
1605
1606         Crash logs indicate we sometimes encounter null key values during processing.
1607         This patch adds some debug assertions to catch this in test environments, and
1608         allows the code to skip the bad entries if encountered.
1609
1610         It also avoids calling CFDictionaryApplyFunction when the HSTS policies returned
1611         by _CFNetworkCopyHSTSPolicies is nullptr, which is a possible return value.
1612
1613         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
1614         (WebKit::filterPreloadHSTSEntry):
1615         (WebKit::NetworkProcess::getHostNamesWithHSTSCache):
1616
1617 2019-04-05  Brian Burg  <bburg@apple.com>
1618
1619         Web Automation: clean up some WebAutomationSession methods to use modern async IPC
1620         https://bugs.webkit.org/show_bug.cgi?id=196168
1621
1622         Reviewed by Devin Rousso.
1623
1624         Modern WebKit IPC is capable of providing completion handlers and can track callback IDs.
1625         So, most messages between WebAutomationSession and its proxy can use this facility and stop
1626         keeping track of callback IDs manually. This makes most code easier to read on both the
1627         sender and receiver side.
1628
1629         There are two cases that could not be converted:
1630         - For evaluateJavaScript, we cannot use async IPC because WebAutomationSession expects to
1631         be able to cancel all pending replies when a page navigates away, the web process crashes,
1632         or when handling an alert.
1633         - For takeScreenshot, there is not currently support in the modern async IPC code paths for
1634         sending the result back. ShareableBitmap and friends lack a modern decoder implementation.
1635
1636         * UIProcess/Automation/WebAutomationSession.cpp:
1637         (WebKit::WebAutomationSession::resolveChildFrameHandle):
1638         (WebKit::WebAutomationSession::resolveParentFrameHandle):
1639         (WebKit::WebAutomationSession::computeElementLayout):
1640         (WebKit::WebAutomationSession::selectOptionElement):
1641         (WebKit::WebAutomationSession::getAllCookies):
1642         (WebKit::WebAutomationSession::deleteSingleCookie):
1643         (WebKit::WebAutomationSession::viewportInViewCenterPointOfElement):
1644         (WebKit::WebAutomationSession::didResolveChildFrame): Deleted.
1645         (WebKit::WebAutomationSession::didResolveParentFrame): Deleted.
1646         (WebKit::WebAutomationSession::didComputeElementLayout): Deleted.
1647         (WebKit::WebAutomationSession::didSelectOptionElement): Deleted.
1648         (WebKit::WebAutomationSession::didGetCookiesForFrame): Deleted.
1649         (WebKit::WebAutomationSession::didDeleteCookie): Deleted.
1650         * UIProcess/Automation/WebAutomationSession.h:
1651         * UIProcess/Automation/WebAutomationSession.messages.in:
1652         * WebProcess/Automation/WebAutomationSessionProxy.cpp:
1653         (WebKit::WebAutomationSessionProxy::resolveChildFrameWithOrdinal):
1654         (WebKit::WebAutomationSessionProxy::resolveChildFrameWithNodeHandle):
1655         (WebKit::WebAutomationSessionProxy::resolveChildFrameWithName):
1656         (WebKit::WebAutomationSessionProxy::resolveParentFrame):
1657         (WebKit::WebAutomationSessionProxy::computeElementLayout):
1658         (WebKit::WebAutomationSessionProxy::selectOptionElement):
1659         (WebKit::WebAutomationSessionProxy::getCookiesForFrame):
1660         (WebKit::WebAutomationSessionProxy::deleteCookie):
1661         * WebProcess/Automation/WebAutomationSessionProxy.h:
1662         * WebProcess/Automation/WebAutomationSessionProxy.messages.in:
1663
1664 2019-04-08  Alex Christensen  <achristensen@webkit.org>
1665
1666         REGRESSION(236463) DownloadManager can call a null CompletionHandler
1667         https://bugs.webkit.org/show_bug.cgi?id=196414
1668         <rdar://problem/48389434>
1669
1670         Reviewed by Geoff Garen.
1671
1672         * NetworkProcess/NetworkResourceLoader.cpp:
1673         (WebKit::NetworkResourceLoader::convertToDownload):
1674         DownloadManager::continueDecidePendingDownloadDestination is being called when there is no completion handler.
1675         r236463 introduced an unchecked code path that can allow this to happen.
1676
1677 2019-04-07  Commit Queue  <commit-queue@webkit.org>
1678
1679         Unreviewed, rolling out r243956.
1680         https://bugs.webkit.org/show_bug.cgi?id=196688
1681
1682         Broke API Test SafeBrowsing.WKWebViewGoBackIFrame (Requested
1683         by aakashjain on #webkit).
1684
1685         Reverted changeset:
1686
1687         "Clicking "Go Back" from a safe browsing warning from an
1688         iframe should navigate the WKWebView back to the previous
1689         page"
1690         https://bugs.webkit.org/show_bug.cgi?id=196665
1691         https://trac.webkit.org/changeset/243956
1692
1693 2019-04-07  Geoffrey Garen  <ggaren@apple.com>
1694
1695         Remove stray byte added by r241131
1696         https://bugs.webkit.org/show_bug.cgi?id=196682
1697
1698         Reviewed by Alexey Proskuryakov.
1699
1700         Sublime Text thinks WKWebView.mm is binary instead of text.
1701
1702         According to online documentation and bisecting, this is because r241131
1703         introduced a stray byte (probably a null byte?) into the file.
1704
1705         I fixed this with Cmd-C Cmd-V.
1706
1707         * UIProcess/API/Cocoa/WKWebView.mm:
1708         (-[WKWebView _initializeWithConfiguration:]):
1709
1710 2019-04-06  Wenson Hsieh  <wenson_hsieh@apple.com>
1711
1712         Hide next and previous form control buttons when WKWebView is editable
1713         https://bugs.webkit.org/show_bug.cgi?id=196672
1714         <rdar://problem/35625321>
1715
1716         Reviewed by Tim Horton.
1717
1718         Adopt new UIKit SPI to hide or show next and previous controls in the form accessory view when changing
1719         editability.
1720
1721         Test: KeyboardInputTests.FormNavigationAssistantBarButtonItems
1722
1723         * Platform/spi/ios/UIKitSPI.h:
1724         * UIProcess/API/Cocoa/WKWebView.mm:
1725         (-[WKWebView _setEditable:]):
1726         * UIProcess/ios/WKContentViewInteraction.h:
1727         * UIProcess/ios/WKContentViewInteraction.mm:
1728         (-[WKContentView _updateAccessory]):
1729         (-[WKContentView _didChangeWebViewEditability]):
1730
1731 2019-04-06  Antti Koivisto  <antti@apple.com>
1732
1733         Combine event and touch action regions into a single class
1734         https://bugs.webkit.org/show_bug.cgi?id=196644
1735         <rdar://problem/49643614>
1736
1737         Reviewed by Darin Adler.
1738
1739         * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.h:
1740         * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm:
1741         (WebKit::RemoteLayerTreeTransaction::LayerProperties::decode):
1742         * UIProcess/RemoteLayerTree/RemoteLayerTreeNode.h:
1743         (WebKit::RemoteLayerTreeNode::eventRegion const):
1744         * UIProcess/RemoteLayerTree/RemoteLayerTreeNode.mm:
1745         (WebKit::RemoteLayerTreeNode::setEventRegion):
1746         * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.cpp:
1747         (WebKit::PlatformCALayerRemote::setEventRegion):
1748         * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.h:
1749
1750 2019-04-05  Yongjun Zhang  <yongjun_zhang@apple.com>
1751
1752         We should pass minimumEffectiveDeviceWidth to web process on new page creation.
1753         https://bugs.webkit.org/show_bug.cgi?id=196077
1754         <rdar://problem/49108202>
1755
1756         Reviewed by Chris Dumez.
1757
1758         When a new web view is created, it is possible we don't have the web content process till a load
1759         is requested. This patch stashes minimumEffectiveDeviceWidth in WebPageProxy.cpp and passes that
1760         value down to web process via WebPageCreationParameters when a new process is created, just like
1761         we did for other values like viewportConfigurationLayoutSizeScaleFactor or viewportConfigurationViewLayoutSize.
1762
1763         * Shared/WebPageCreationParameters.cpp:
1764         (WebKit::WebPageCreationParameters::encode const): Encode viewportConfigurationMinimumEffectiveDeviceWidth value.
1765         (WebKit::WebPageCreationParameters::decode): Decode viewportConfigurationMinimumEffectiveDeviceWidth value.
1766         * Shared/WebPageCreationParameters.h:
1767         * UIProcess/API/Cocoa/WKWebView.mm: Now that we stash the minimumEffectiveDeviceWidth value in WebPageProxy, we
1768             don't need the iVar in WKWebView any more.
1769         (-[WKWebView _dispatchSetViewLayoutSize:]): Use _page->minimumEffectiveDeviceWidth().
1770         (-[WKWebView _setViewScale:]): Ditto.
1771         (-[WKWebView _setMinimumEffectiveDeviceWidth:]): Ditto.
1772         (-[WKWebView _minimumEffectiveDeviceWidth]): Ditto.
1773         * UIProcess/WebPageProxy.cpp:
1774         (WebKit::WebPageProxy::creationParameters): Also add viewportConfigurationMinimumEffectiveDeviceWidth to
1775             web process creation parameter.
1776         * UIProcess/WebPageProxy.h:
1777         (WebKit::WebPageProxy::minimumEffectiveDeviceWidth const): Returns m_viewportConfigurationMinimumEffectiveDeviceWidth.
1778         * UIProcess/ios/WebPageProxyIOS.mm:
1779         (WebKit::WebPageProxy::setViewportConfigurationViewLayoutSize): Pass parameters.viewportConfigurationMinimumEffectiveDeviceWidth
1780             to web process.
1781         * WebProcess/WebPage/WebPage.cpp:
1782         (WebKit::WebPage::WebPage): Take viewportConfigurationMinimumEffectiveDeviceWidth value from the parameter and
1783             set that to viewport configuration.
1784
1785 2019-04-05  Jer Noble  <jer.noble@apple.com>
1786
1787         [Cocoa] Deactivate the audio session before the WebProcess suspends.
1788         https://bugs.webkit.org/show_bug.cgi?id=196658
1789
1790         Reviewed by Eric Carlson.
1791
1792         Notify the PlatformMediaSessionManager when the process suspends or resumes.
1793
1794         * WebProcess/WebProcess.cpp:
1795         (WebKit::WebProcess::actualPrepareToSuspend):
1796         (WebKit::WebProcess::cancelPrepareToSuspend):
1797         (WebKit::WebProcess::processDidResume):
1798
1799 2019-04-05  Sihui Liu  <sihui_liu@apple.com>
1800
1801         [iOS] Web process gets suspended while holding locked database files
1802         https://bugs.webkit.org/show_bug.cgi?id=196519
1803         <rdar://problem/49531797>
1804
1805         Reviewed by Chris Dumez.
1806
1807         * WebProcess/WebProcess.cpp:
1808         (WebKit::WebProcess::actualPrepareToSuspend):
1809
1810 2019-04-05  Alex Christensen  <achristensen@webkit.org>
1811
1812         Clicking "Go Back" from a safe browsing warning from an iframe should navigate the WKWebView back to the previous page
1813         https://bugs.webkit.org/show_bug.cgi?id=196665
1814         <rdar://45115669>
1815
1816         Reviewed by Geoff Garen.
1817
1818         It is insufficient to just not navigate the subframe.  We must leave the page that contained it.
1819
1820         * UIProcess/API/Cocoa/WKWebView.mm:
1821         (-[WKWebView _showSafeBrowsingWarning:completionHandler:]):
1822         * UIProcess/Cocoa/WebViewImpl.mm:
1823         (WebKit::WebViewImpl::showSafeBrowsingWarning):
1824
1825 2019-04-05  Alex Christensen  <achristensen@webkit.org>
1826
1827         Undeprecate WKNavigationData
1828         https://bugs.webkit.org/show_bug.cgi?id=196559
1829         <rdar://44927425>
1830
1831         Reviewed by Geoff Garen.
1832
1833         * UIProcess/API/Cocoa/WKNavigationData.h:
1834         It is used to communicate information from FrameLoaderClient::updateGlobalHistory() to the application.
1835         This use in WKBrowsingContextHistoryDelegate is definitely still deprecated, but its use in
1836         WKHistoryDelegatePrivate does not have an adequate replacement yet, so it must remain undeprecated SPI.
1837
1838 2019-04-05  Sihui Liu  <sihui_liu@apple.com>
1839
1840         [iOS] Web process gets suspended while holding locked database files
1841         https://bugs.webkit.org/show_bug.cgi?id=196519
1842         <rdar://problem/49531797>
1843
1844         Reviewed by Chris Dumez.
1845
1846         * Shared/WebSQLiteDatabaseTracker.cpp:
1847         (WebKit::WebSQLiteDatabaseTracker::~WebSQLiteDatabaseTracker):
1848         * Shared/WebSQLiteDatabaseTracker.h:
1849         * WebProcess/WebProcess.cpp:
1850         (WebKit::m_webSQLiteDatabaseTracker):
1851         (WebKit::WebProcess::actualPrepareToSuspend):
1852         (WebKit::WebProcess::processWillSuspendImminently):
1853         (WebKit::WebProcess::cancelPrepareToSuspend):
1854         (WebKit::WebProcess::processDidResume):
1855         * WebProcess/WebProcess.h:
1856
1857 2019-04-05  Commit Queue  <commit-queue@webkit.org>
1858
1859         Unreviewed, rolling out r243833.
1860         https://bugs.webkit.org/show_bug.cgi?id=196645
1861
1862         This change breaks build of WPE and GTK ports (Requested by
1863         annulen on #webkit).
1864
1865         Reverted changeset:
1866
1867         "[CMake][WTF] Mirror XCode header directories"
1868         https://bugs.webkit.org/show_bug.cgi?id=191662
1869         https://trac.webkit.org/changeset/243833
1870
1871 2019-04-05  David Kilzer  <ddkilzer@apple.com>
1872
1873         REGRESSION(r240685): Remove duplicate Headers entry for _WKInspectorWindow.h in Xcode project
1874         <https://bugs.webkit.org/show_bug.cgi?id=193951>
1875         <rdar://problem/47621366>
1876
1877         Fixes the following build warnings:
1878             Warning: Multiple build commands for output file WebKit2_WebKit.roots/BuildRecords/WebKit2_installhdrs/Root/System/Library/Frameworks/WebKit.framework/PrivateHeaders/_WKInspectorWindow.h
1879             Warning: Multiple build commands for output file WebKit2_WebKit.roots/BuildRecords/WebKit2_installapi/Root/System/Library/Frameworks/WebKit.framework/PrivateHeaders/_WKInspectorWindow.h
1880             Warning: Multiple build commands for output file WebKit2_WebKit.roots/BuildRecords/WebKit2_install/Root/System/Library/Frameworks/WebKit.framework/PrivateHeaders/_WKInspectorWindow.h
1881
1882         * WebKit.xcodeproj/project.pbxproj: Remove duplicate entry for
1883         _WKInspectorWindow.h.  In r240685, a second Headers entry was
1884         added, but the first one was never removed.
1885
1886 2019-04-05  Carlos Garcia Campos  <cgarcia@igalia.com>
1887
1888         [ATK] Use a smart pointer for AccessibilityObject wrapper and remove GTK specific code
1889         https://bugs.webkit.org/show_bug.cgi?id=196593
1890         <rdar://problem/49599153>
1891
1892         Reviewed by Michael Catanzaro.
1893
1894         * WebProcess/WebPage/atk/WebKitWebPageAccessibilityObject.cpp:
1895         (accessibilityRootObjectWrapper): Cast wrapper() as AtkObject.
1896
1897 2019-04-04  Simon Fraser  <simon.fraser@apple.com>
1898
1899         Simple iframe scrolling test fails to get a composited scrolling frame in WebKitTestRunnerApp
1900         https://bugs.webkit.org/show_bug.cgi?id=196635
1901
1902         Reviewed by Antti Koivisto.
1903
1904         Remove WKBundleSetAsyncFrameScrollingEnabled().
1905
1906         * WebProcess/InjectedBundle/API/c/WKBundle.cpp:
1907         (WKBundleSetAsyncFrameScrollingEnabled): Deleted.
1908         * WebProcess/InjectedBundle/API/c/WKBundlePrivate.h:
1909
1910 2019-04-04  Simon Fraser  <simon.fraser@apple.com>
1911
1912         [iOS WK2] REGRESSION (r242687): Programmatic scroll of overflow scroll results in bad rendering
1913         https://bugs.webkit.org/show_bug.cgi?id=195584
1914
1915         Reviewed by Zalan Bujtas.
1916
1917         Push data to the scrolling tree about whether an overflow:scroll scroll was programmatic, by having
1918         RenderLayer::scrollToOffset() call into AsyncScrollingCoordinator::requestScrollPositionUpdate(),
1919         just as we do for frames.
1920
1921         AsyncScrollingCoordinator::requestScrollPositionUpdate() is generalized to take any ScrollableArea.
1922
1923         Fix an assumption in the ScrollingTree that we only care about programmatic scrolls on the root node.
1924         ScrollingTree::commitTreeState() no longer sets isHandlingProgrammaticScroll; instead,
1925         callers of ScrollingTreeScrollingNode::scrollTo() pass a ScrollType. Commit functions pass
1926         ScrollType::Programmatic when handling RequestedScrollPosition changes as necessary.
1927
1928         Programmatic scrolls need to get to the scrolling tree in the UI process so that we update
1929         the tree's notion of scroll position, and trigger actual UIScrollView scrolls (layers may have
1930         already been put in the right locations, but the UI process needs to know that a scroll happened).
1931         However, we need to prevent notifications from programmatic scrolls getting back to the
1932         web process, because this causes jumpiness. This is done via an early return in
1933         RemoteScrollingCoordinatorProxy::scrollingTreeNodeDidScroll().
1934
1935         * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp:
1936         (WebKit::RemoteScrollingCoordinatorProxy::scrollingTreeNodeDidScroll):
1937         * UIProcess/RemoteLayerTree/ios/ScrollingTreeFrameScrollingNodeRemoteIOS.mm:
1938         (WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::commitStateAfterChildren): Subframe nodes have
1939         a delegate, and that will take care of the requestedScrollPosition update.
1940         * UIProcess/RemoteLayerTree/ios/ScrollingTreeOverflowScrollingNodeIOS.h:
1941         * UIProcess/RemoteLayerTree/ios/ScrollingTreeOverflowScrollingNodeIOS.mm:
1942         (WebKit::ScrollingTreeOverflowScrollingNodeIOS::commitStateAfterChildren):
1943         * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm:
1944         (WebKit::ScrollingTreeScrollingNodeDelegateIOS::commitStateAfterChildren):
1945
1946 2019-04-04  Ryan Haddad  <ryanhaddad@apple.com>
1947
1948         Unreviewed, rolling out r243888.
1949
1950         Introduced layout test crashes.
1951
1952         Reverted changeset:
1953
1954         "[macOS][iOS] Add filter to syscall sandbox rule"
1955         https://bugs.webkit.org/show_bug.cgi?id=196613
1956         https://trac.webkit.org/changeset/243888
1957
1958 2019-04-04  Youenn Fablet  <youenn@apple.com>
1959
1960         Pass storage quota parameters from UIProcess to NetworkProcess as part of WebsiteDataStore parameters
1961         https://bugs.webkit.org/show_bug.cgi?id=196543
1962
1963         Reviewed by Alex Christensen.
1964
1965         Renamed methods used to set cache storage quota to be storage generic
1966         since they will apply to all storage.
1967
1968         Pass quota parameters as part of WebsiteDataStoreParameters from UIProcess
1969         to NetworkProcess (start-up time and new WebsiteDataStore time).
1970
1971         Compute on UIProcess the quota for third party origins using the default rule of dividing by 10.
1972
1973         * NetworkProcess/NetworkProcess.cpp:
1974         (WebKit::NetworkProcess::initializeNetworkProcess):
1975         (WebKit::NetworkProcess::addWebsiteDataStore):
1976         (WebKit::NetworkProcess::initializeStorageQuota):
1977         (WebKit::NetworkProcess::setCacheStorageParameters):
1978         * NetworkProcess/NetworkProcess.h:
1979         * NetworkProcess/NetworkProcess.messages.in:
1980         * Shared/WebsiteDataStoreParameters.cpp:
1981         (WebKit::WebsiteDataStoreParameters::encode const):
1982         (WebKit::WebsiteDataStoreParameters::decode):
1983         * Shared/WebsiteDataStoreParameters.h:
1984         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
1985         (WKWebsiteDataStoreSetPerOriginStorageQuota):
1986         (WKWebsiteDataStoreSetCacheStoragePerOriginQuota): Deleted.
1987         * UIProcess/API/C/WKWebsiteDataStoreRef.h:
1988         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
1989         (-[WKWebsiteDataStore _perOriginStorageQuota]):
1990         (-[WKWebsiteDataStore _setPerOriginStorageQuota:]):
1991         (-[WKWebsiteDataStore _cacheStoragePerOriginQuota]): Deleted.
1992         (-[WKWebsiteDataStore _setCacheStoragePerOriginQuota:]): Deleted.
1993         * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
1994         * UIProcess/Network/NetworkProcessProxy.cpp:
1995         (WebKit::NetworkProcessProxy::retrieveCacheStorageParameters):
1996         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
1997         (WebKit::WebsiteDataStore::parameters):
1998         * UIProcess/WebsiteData/WebsiteDataStore.h:
1999         (WebKit::WebsiteDataStore::perOriginStorageQuota const):
2000         (WebKit::WebsiteDataStore::setPerOriginStorageQuota):
2001         (WebKit::WebsiteDataStore::cacheStoragePerOriginQuota const): Deleted.
2002         (WebKit::WebsiteDataStore::setCacheStoragePerOriginQuota): Deleted.
2003         * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.cpp:
2004         (WebKit::WebsiteDataStoreConfiguration::copy):
2005         * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.h:
2006         (WebKit::WebsiteDataStoreConfiguration::perOriginStorageQuota):
2007         (WebKit::WebsiteDataStoreConfiguration::setPerOriginStorageQuota):
2008         (WebKit::WebsiteDataStoreConfiguration::cacheStoragePerOriginQuota): Deleted.
2009         (WebKit::WebsiteDataStoreConfiguration::setCacheStoragePerOriginQuota): Deleted.
2010
2011 2019-04-04  Wenson Hsieh  <wenson_hsieh@apple.com>
2012
2013         Changing default website policies shouldn't change default website policies in subsequent navigations
2014         https://bugs.webkit.org/show_bug.cgi?id=196562
2015         <rdar://problem/49573377>
2016
2017         Reviewed by Tim Horton.
2018
2019         Currently, changing the default WKWebpagePreferences object when deciding navigation policy causes the set of
2020         default policies to change in subsequent navigations. Among other things, this prevents clients from passing
2021         a modified version of the default website policies into the decision handler without impacting future
2022         navigations. To fix this, teach API::WebsitePolicies to make a copy of itself, and then use this to pass a copy
2023         of the default website policies to the navigation delegate when deciding navigation policies.
2024
2025         Test: DoNotAllowChangingDefaultWebpagePreferencesInDelegateMethod
2026
2027         * UIProcess/API/APIWebsitePolicies.cpp:
2028         (API::WebsitePolicies::copy const):
2029
2030         Add a helper method to copy a set of website policies.
2031
2032         * UIProcess/API/APIWebsitePolicies.h:
2033         * UIProcess/Cocoa/NavigationState.mm:
2034         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
2035
2036 2019-04-04  Michael Catanzaro  <mcatanzaro@igalia.com>
2037
2038         Unreviewed, fix -Wreturn-type warning
2039
2040         * Shared/WebsiteData/WebsiteData.cpp:
2041         (WebKit::WebsiteData::ownerProcess):
2042
2043 2019-04-04  Per Arne Vollan  <pvollan@apple.com>
2044
2045         [macOS] Fix sandbox violations
2046         https://bugs.webkit.org/show_bug.cgi?id=196616
2047         <rdar://problem/49498040>
2048
2049         Reviewed by Brent Fulgham.
2050
2051         Fix some observed sandbox violations in the WebContent process on macOS.
2052
2053         * WebProcess/com.apple.WebProcess.sb.in:
2054
2055 2019-04-04  Eric Carlson  <eric.carlson@apple.com>
2056
2057         [MediaStream] Host should be able to mute screen capture and camera/microphone independently
2058         https://bugs.webkit.org/show_bug.cgi?id=196555
2059         <rdar://problem/47303865>
2060
2061         Reviewed by Youenn Fablet.
2062
2063         * UIProcess/API/C/WKPagePrivate.h: Add kWKMediaScreenCaptureMuted.
2064
2065         * UIProcess/API/Cocoa/WKWebView.mm:
2066         (-[WKWebView _setPageMuted:]):
2067         (-[WKWebView _setMediaCaptureMuted:]): Deleted, it was unused.
2068         (-[WKWebView _muteMediaCapture]): Deleted, it was unused.
2069         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
2070
2071         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
2072         (WebKit::UserMediaPermissionRequestManagerProxy::processUserMediaPermissionValidRequest): Fix
2073         a log comment typo.
2074
2075         * UIProcess/WebPageProxy.cpp:
2076         (WebKit::WebPageProxy::setMediaStreamCaptureMuted): Use the new flag.
2077         (WebKit::WebPageProxy::activateMediaStreamCaptureInPage): Ditto.
2078         (WebKit::WebPageProxy::setMuted): Ditto.
2079         * UIProcess/WebPageProxy.h:
2080         (WebKit::WebPageProxy::isMediaStreamCaptureMuted const): Ditto.
2081
2082 2019-04-04  Per Arne Vollan  <pvollan@apple.com>
2083
2084         [macOS][iOS] Add filter to syscall sandbox rule
2085         https://bugs.webkit.org/show_bug.cgi?id=196613
2086         <rdar://problem/49531420>
2087
2088         Reviewed by Brent Fulgham.
2089
2090         This will restrict the existing sandbox rule for the syscall.
2091
2092         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
2093         * WebProcess/com.apple.WebProcess.sb.in:
2094
2095 2019-04-04  Youenn Fablet  <youenn@apple.com>
2096
2097         Service Worker Process does not have the right domain name
2098         https://bugs.webkit.org/show_bug.cgi?id=196585
2099
2100         Reviewed by Chris Dumez.
2101
2102         * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceEntryPoint.mm:
2103         (WebKit::XPCServiceInitializerDelegate::getExtraInitializationData):
2104         Updated extraInitializationData to go from "security-origin" to "registrable-domain".
2105
2106 2019-04-04  Chris Dumez  <cdumez@apple.com>
2107
2108         Temporarily disable delayed WebProcess launch on iOS to address PLT regression
2109         https://bugs.webkit.org/show_bug.cgi?id=196604
2110         <rdar://problem/49074131>
2111
2112         Reviewed by Geoffrey Garen.
2113
2114         Temporarily disable delayed WebProcess launch on iOS to address PLT regression. This
2115         is while I figure out how to enable this on iOS without regressed PLT.
2116
2117         * UIProcess/WebProcessPool.h:
2118
2119 2019-04-04  Miguel Gomez  <magomez@igalia.com>
2120
2121         [CoordGraphics] Revalidate need for 'coordinated update completion' in ThreadedCompositor
2122         https://bugs.webkit.org/show_bug.cgi?id=188839
2123
2124         Reviewed by Žan Doberšek.
2125
2126         Even if a platform layer has changed, don't wait for a main thread callback to finish the
2127         CompositingRunLoop update. It can be finished as soon as we receive the frameComplete signal.
2128
2129         * Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.cpp:
2130         (WebKit::CompositingRunLoop::scheduleUpdate):
2131         (WebKit::CompositingRunLoop::stopUpdates):
2132         (WebKit::CompositingRunLoop::updateCompleted):
2133         (WebKit::CompositingRunLoop::updateTimerFired):
2134         (WebKit::CompositingRunLoop::compositionCompleted): Deleted.
2135         * Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.h:
2136         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
2137         (WebKit::ThreadedCompositor::renderLayerTree):
2138         (WebKit::ThreadedCompositor::sceneUpdateFinished):
2139         (WebKit::ThreadedCompositor::displayRefreshMonitor):
2140         (WebKit::ThreadedCompositor::handleDisplayRefreshMonitorUpdate): Deleted.
2141         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h:
2142         * WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.cpp:
2143         (WebKit::LayerTreeHost::handleDisplayRefreshMonitorUpdate):
2144
2145 2019-04-03  Carlos Garcia Campos  <cgarcia@igalia.com>
2146
2147         [ATK] Cleanup WebPageAccessibilityObjectAtk
2148         https://bugs.webkit.org/show_bug.cgi?id=196537
2149
2150         Reviewed by Michael Catanzaro.
2151
2152         Several changes and cleanups:
2153
2154          - Add WebKit prefix so that style checker doesn't complain about GObject conventions.
2155          - Rename the header to remove the Atk prefix to match the cpp file and class name.
2156          - Use pragma once.
2157          - Use nullptr instead of 0.
2158          - Use WEBKIT_DEFINE_TYPE instead of G_DEFINE_TYPE.
2159          - Return generic AtkObject* from constructor.
2160
2161         * SourcesGTK.txt:
2162         * WebProcess/WebPage/WebPage.h:
2163         * WebProcess/WebPage/atk/WebKitWebPageAccessibilityObject.cpp: Renamed from Source/WebKit/WebProcess/WebPage/atk/WebPageAccessibilityObjectAtk.cpp.
2164         (accessibilityRootObjectWrapper):
2165         (webkitWebPageAccessibilityObjectInitialize):
2166         (webkitWebPageAccessibilityObjectGetIndexInParent):
2167         (webkitWebPageAccessibilityObjectGetNChildren):
2168         (webkitWebPageAccessibilityObjectRefChild):
2169         (webkit_web_page_accessibility_object_class_init):
2170         (webkitWebPageAccessibilityObjectNew):
2171         (webkitWebPageAccessibilityObjectRefresh):
2172         * WebProcess/WebPage/atk/WebKitWebPageAccessibilityObject.h: Added.
2173         * WebProcess/WebPage/atk/WebPageAccessibilityObject.h: Removed.
2174         * WebProcess/WebPage/gtk/WebPageGtk.cpp:
2175         (WebKit::WebPage::platformInitialize):
2176         (WebKit::WebPage::updateAccessibilityTree):
2177
2178 2019-04-03  Carlos Garcia Campos  <cgarcia@igalia.com>
2179
2180         [ATK] Set ATK_STATE_TRANSIENT on the atk socket until it's embedded
2181         https://bugs.webkit.org/show_bug.cgi?id=196535
2182
2183         Reviewed by Michael Catanzaro.
2184
2185         This way the properties are not cached. Right now, if number of children is queried before the socket is
2186         embedded, 0 is returned and cached, so ATs don't see the child even after the socket has been embedded.
2187
2188         * UIProcess/API/gtk/WebKitWebViewBaseAccessible.cpp:
2189         (webkitWebViewBaseAccessibleRefStateSet): Set ATK_STATE_TRANSIENT is the socket is not occupied.
2190         * UIProcess/gtk/WebPageProxyGtk.cpp:
2191         (WebKit::WebPageProxy::bindAccessibilityTree): Unset ATK_STATE_TRANSIENT.
2192
2193 2019-04-03  Carlos Garcia Campos  <cgarcia@igalia.com>
2194
2195         [ATK] Embed the AtkSocket as soon as we receive the plug ID
2196         https://bugs.webkit.org/show_bug.cgi?id=196534
2197
2198         Reviewed by Michael Catanzaro.
2199
2200         We are currently storing the ID and waiting for the next time get_accessible is called to embed the socket. We
2201         can simply embed the socket when the plug ID is received.
2202
2203         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
2204         (webkitWebViewBaseGetAccessible):
2205         * UIProcess/WebPageProxy.h:
2206         * UIProcess/gtk/WebPageProxyGtk.cpp:
2207         (WebKit::WebPageProxy::bindAccessibilityTree):
2208
2209 2019-04-03  Carlos Garcia Campos  <cgarcia@igalia.com>
2210
2211         [ATK] Don't touch accessibility tree in WebFrameLoaderClient::dispatchDidClearWindowObjectInWorld
2212         https://bugs.webkit.org/show_bug.cgi?id=193914
2213
2214         Reviewed by Michael Catanzaro.
2215
2216         Move it to dispatchDidFinishDocumentLoad, since we know we have the document at that point and we can create the
2217         root accessibility object wrapper.
2218
2219         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
2220         (WebKit::WebFrameLoaderClient::dispatchDidFinishDocumentLoad):
2221         (WebKit::WebFrameLoaderClient::dispatchDidClearWindowObjectInWorld):
2222
2223 2019-04-03  Simon Fraser  <simon.fraser@apple.com>
2224
2225         Simplify some "programmaticScroll" code paths
2226         https://bugs.webkit.org/show_bug.cgi?id=196589
2227
2228         Reviewed by Zalan Bujtas.
2229
2230         * WebProcess/WebPage/RemoteLayerTree/RemoteScrollingCoordinator.mm: Remove the parameter.
2231         (WebKit::RemoteScrollingCoordinator::scrollPositionChangedForNode): Use the enum type.
2232         * WebProcess/WebPage/ios/WebPageIOS.mm:
2233         (WebKit::WebPage::updateVisibleContentRects):
2234
2235 2019-04-03  Chris Dumez  <cdumez@apple.com>
2236
2237         The page's focusedFrame / frameSetLargestFrame do not get cleared on process swap or crash
2238         https://bugs.webkit.org/show_bug.cgi?id=196588
2239         <rdar://problem/49365787>
2240
2241         Reviewed by Ryosuke Niwa.
2242
2243         The page's focusedFrame / frameSetLargestFrame do not get cleared on process swap or crash.
2244         This can lead to returning stale frames to the client if it asks for those.
2245
2246         * UIProcess/WebPageProxy.cpp:
2247         (WebKit::WebPageProxy::resetState):
2248
2249 2019-04-03  Simon Fraser  <simon.fraser@apple.com>
2250
2251         Remove the isProgrammaticScroll argument to requestScroll() because no-one uses it
2252         https://bugs.webkit.org/show_bug.cgi?id=196587
2253
2254         Reviewed by Zalan Bujtas.
2255
2256         This argument was unused.
2257
2258         * UIProcess/API/gtk/PageClientImpl.cpp:
2259         (WebKit::PageClientImpl::requestScroll):
2260         * UIProcess/API/gtk/PageClientImpl.h:
2261         * UIProcess/API/wpe/PageClientImpl.cpp:
2262         (WebKit::PageClientImpl::requestScroll):
2263         * UIProcess/API/wpe/PageClientImpl.h:
2264         * UIProcess/PageClient.h:
2265         * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm:
2266         (WebKit::RemoteLayerTreeDrawingAreaProxy::commitLayerTree):
2267         * UIProcess/WebPageProxy.cpp:
2268         (WebKit::WebPageProxy::requestScroll):
2269         * UIProcess/WebPageProxy.h:
2270         * UIProcess/ios/PageClientImplIOS.h:
2271         * UIProcess/ios/PageClientImplIOS.mm:
2272         (WebKit::PageClientImpl::requestScroll):
2273         * UIProcess/mac/PageClientImplMac.h:
2274         * UIProcess/mac/PageClientImplMac.mm:
2275         (WebKit::PageClientImpl::requestScroll):
2276         * UIProcess/win/PageClientImpl.cpp:
2277         (WebKit::PageClientImpl::requestScroll):
2278         * UIProcess/win/PageClientImpl.h:
2279
2280 2019-04-03  Myles C. Maxfield  <mmaxfield@apple.com>
2281
2282         -apple-trailing-word is needed for browser detection
2283         https://bugs.webkit.org/show_bug.cgi?id=196575
2284
2285         Unreviewed.
2286
2287         * Configurations/FeatureDefines.xcconfig:
2288
2289 2019-04-03  Wenson Hsieh  <wenson_hsieh@apple.com>
2290
2291         Add a WebKit internal feature flag to always enable modern compatibility mode by default
2292         https://bugs.webkit.org/show_bug.cgi?id=196526
2293         <rdar://problem/49532923>
2294
2295         Reviewed by Tim Horton.
2296
2297         Change UseModernCompatibilityModeByDefault from an internal preference to a debug preference, so that it may be
2298         enabled for all apps on the system.
2299
2300         * Shared/WebPreferences.yaml:
2301
2302 2019-04-03  Alex Christensen  <achristensen@webkit.org>
2303
2304         Fix internal build after r243829
2305         https://bugs.webkit.org/show_bug.cgi?id=196549
2306
2307         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
2308         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
2309         Some SDK's don't include this selector in the header.
2310         Use NSSelectorFromString.
2311
2312 2019-04-03  Don Olmstead  <don.olmstead@sony.com>
2313
2314         [CMake][WTF] Mirror XCode header directories
2315         https://bugs.webkit.org/show_bug.cgi?id=191662
2316
2317         Reviewed by Konstantin Tokarev.
2318
2319         Use WTFFramework as a dependency and include frameworks/WTF.cmake for AppleWin internal
2320         builds.
2321
2322         * CMakeLists.txt:
2323
2324 2019-04-03  Alex Christensen  <achristensen@webkit.org>
2325
2326         Add SPI to disable legacy TLS fallback
2327         https://bugs.webkit.org/show_bug.cgi?id=196549
2328         <rdar://44979744>
2329
2330         Reviewed by Geoffrey Garen.
2331
2332         * NetworkProcess/NetworkSessionCreationParameters.cpp:
2333         (WebKit::NetworkSessionCreationParameters::privateSessionParameters):
2334         (WebKit::NetworkSessionCreationParameters::encode const):
2335         (WebKit::NetworkSessionCreationParameters::decode):
2336         * NetworkProcess/NetworkSessionCreationParameters.h:
2337         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
2338         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
2339         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
2340         (-[WKWebsiteDataStore _setAllowsTLSFallback:]):
2341         (-[WKWebsiteDataStore _allowsTLSFallback]):
2342         * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
2343         * UIProcess/WebProcessPool.cpp:
2344         (WebKit::WebProcessPool::ensureNetworkProcess):
2345         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
2346         (WebKit::WebsiteDataStore::parameters):
2347         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
2348         (WebKit::WebsiteDataStore::setSourceApplicationSecondaryIdentifier):
2349         (WebKit::WebsiteDataStore::setAllowsTLSFallback):
2350         (WebKit::WebsiteDataStore::setSourceApplicationBundleIdentifier):
2351         * UIProcess/WebsiteData/WebsiteDataStore.h:
2352         (WebKit::WebsiteDataStore::allowsTLSFallback const):
2353         (WebKit::WebsiteDataStore::networkingHasBegun):
2354         (WebKit::WebsiteDataStore::finalizeApplicationIdentifiers): Deleted.
2355
2356 2019-04-03  Myles C. Maxfield  <mmaxfield@apple.com>
2357
2358         Remove support for -apple-trailing-word
2359         https://bugs.webkit.org/show_bug.cgi?id=196525
2360
2361         Reviewed by Zalan Bujtas.
2362
2363         This CSS property is nonstandard and not used.
2364
2365         * Configurations/FeatureDefines.xcconfig:
2366
2367 2019-04-03  Alex Christensen  <achristensen@webkit.org>
2368
2369         Resurrect and fix layout test http/tests/adClickAttribution/store-ad-click-attribution.html
2370         https://bugs.webkit.org/show_bug.cgi?id=196476
2371
2372         Reviewed by Chris Dumez.
2373
2374         Re-apply a change I reverted in r241754 now that it's safe to do so.
2375
2376         * UIProcess/WebPageProxy.cpp:
2377         (WebKit::WebPageProxy::didCommitLoadForFrame):
2378
2379 2019-04-03  Daniel Bates  <dabates@apple.com>
2380
2381         [iOS] Should be able to dismiss picker or popover using the keyboard
2382         https://bugs.webkit.org/show_bug.cgi?id=196272
2383         <rdar://problem/48943170>
2384
2385         Reviewed by Wenson Hsieh.
2386
2387         Intercept key events and route them to the current input peripheral (if we have one). Add a base key event handler
2388         for all form peripherals that dismisses the accessory when either the Escape key is pressed or Command + . is pressed.
2389         I will fix this issue for the file upload picker/popover in <https://bugs.webkit.org/show_bug.cgi?id=196287>.
2390
2391         * SourcesCocoa.txt: Add file WKFormPeripheralBase.mm.
2392         * UIProcess/ios/WKContentViewInteraction.mm:
2393         (-[WKContentView endEditingAndUpdateFocusAppearanceWithReason]): Added.
2394         (-[WKContentView resignFirstResponderForWebView]): Write in terms of -endEditingAndUpdateFocusAppearance.
2395         (-[WKContentView inputView]): Code style nit while I am here; add an empty line to demarcate the "crazy"
2396         code that the FIXME is referring to and should ideally be removed from the code that is sane to always do.
2397         (-[WKContentView accessoryDone]): When the accessory is dismissed via the Done button (iPhone) or by pressing
2398         Escape or Command + . using a hardware keyboard (iPhone or iPad) then end the current editing session, but
2399         do not resign first responder status as the page activation state should not be changed.
2400         (-[WKContentView _handleKeyUIEvent:]): Bring back this code when building with USE(UIKIT_KEYBOARD_ADDITIONS)
2401         as we need to route key events to the input peripheral (if we have one). If the input peripheral handles it
2402         then we're done: no need to let UIKit or WebKit handle it when building with USE(UIKIT_KEYBOARD_ADDITIONS),
2403         respectively. If the input peripheral does not handle it then do what we do now.
2404         (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
2405         If the element is re-focused and we have an input peripheral then we want to ensure we are first responder,
2406         reveal the focused element, update the accessory and tell the peripheral that editing has begun (again).
2407         For all other element re-focusing where we don't have a peripheral do what we do now. Also, update _isEditable
2408         to reflect whether the focused element contains selectable text. This is what UIKit wants to know when it queries
2409         -isEditable. Now that we no longer blur the focused element on iPad when the popover is dismissed and keep the
2410         peripheral until there is a focus change we need to ensure that we give the correct answer to UIKit on view
2411         editability. Otherwise, UIKit thinks it needs to update the text selection state when a popup button is tapped
2412         again (as part of its gesture recognizer logic) and this causes an assertion failure in UIKit after it calls back
2413         into us to ask for selection details, which we correctly respond with the equivalent of "we have none" and is
2414         not the answer UIKit expects since we told it we are editable. (Currently we manage to get away with telling UIKit
2415         we are always editable because it is not possible to perform a selection operation when we have a popover open.
2416         Closing the popover blurs the element, setting -isEditable to NO and deallocates the peripheral avoiding this issue).
2417         * UIProcess/ios/forms/WKFormColorControl.h:
2418         * UIProcess/ios/forms/WKFormColorControl.mm:
2419         (-[WKColorPopover controlEndEditing]): Dismiss the popover.
2420         (-[WKFormColorControl initWithView:]): Modified to call base class initializer.
2421         (-[WKFormColorControl assistantView]): Deleted.
2422         (-[WKFormColorControl beginEditing]): Deleted.
2423         (-[WKFormColorControl endEditing]): Deleted.
2424         * UIProcess/ios/forms/WKFormInputControl.h:
2425         * UIProcess/ios/forms/WKFormInputControl.mm:
2426         (-[WKFormInputControl initWithView:]): Modified to call base class initializer.
2427         (-[WKFormInputControl dateTimePickerCalendarType]): Write in terms of self.control.
2428         (-[WKDateTimePopover controlEndEditing]): Dismiss the popover and tell the controller that editing ended.
2429         (-[WKFormInputControl beginEditing]): Deleted.
2430         (-[WKFormInputControl endEditing]): Deleted.
2431         (-[WKFormInputControl assistantView]): Deleted.
2432         * UIProcess/ios/forms/WKFormPeripheral.h:
2433         * UIProcess/ios/forms/WKFormPeripheralBase.h: Added.
2434         * UIProcess/ios/forms/WKFormPeripheralBase.mm: Added.
2435         (-[WKFormPeripheralBase initWithView:control:]): Take ownership of the passed WKFormControl.
2436         (-[WKFormPeripheralBase beginEditing]): Turn around and tell the control.
2437         (-[WKFormPeripheralBase endEditing]): Ditto.
2438         (-[WKFormPeripheralBase assistantView]): Ditto.
2439         (-[WKFormPeripheralBase control]): Return the control.
2440         (-[WKFormPeripheralBase handleKeyEvent:]): Dismiss the accessory (in the same way we dismiss when the Done
2441         button is pressed on iPhone) on keydown of the Escape key or when we receive a UIKeyInputEscape event (for
2442         Command + .).
2443         * UIProcess/ios/forms/WKFormSelectControl.h:
2444         * UIProcess/ios/forms/WKFormSelectControl.mm:
2445         (-[WKFormSelectControl initWithView:]): Modified to call base class initializer.
2446         (-[WKFormSelectControl selectRow:inComponent:extendingSelection:]): Write in terms of self.control.
2447         (-[WKFormSelectControl selectFormPopoverTitle]): Ditto.
2448         (-[WKFormSelectControl assistantView]): Deleted.
2449         (-[WKFormSelectControl beginEditing]): Deleted.
2450         (-[WKFormSelectControl endEditing]): Deleted.
2451         * UIProcess/ios/forms/WKFormSelectPopover.mm:
2452         (-[WKSelectPopover controlEndEditing]): Dismiss the popover.
2453         * WebKit.xcodeproj/project.pbxproj: Add files WKFormPeripheralBase.{h, mm}.
2454
2455 2019-04-03  Youenn Fablet  <youenn@apple.com>
2456
2457         Resetting quota should take into account third party origins
2458         https://bugs.webkit.org/show_bug.cgi?id=196462
2459
2460         Reviewed by Geoffrey Garen.
2461
2462         When clearing the storage quota, we were resetting it to the default value
2463         without taking care of whether third party or not.
2464         Updated the code to ensure that the default quota is computed based on the origin.
2465
2466         Updated existing test to cover this case.
2467
2468         * NetworkProcess/NetworkProcess.cpp:
2469         (WebKit::NetworkProcess::clearStorageQuota):
2470         (WebKit::NetworkProcess::setCacheStorageParameters):
2471         (WebKit::NetworkProcess::updateQuotaBasedOnSpaceUsageForTesting):
2472         (WebKit::NetworkProcess::storageQuotaManager):
2473         * NetworkProcess/NetworkProcess.h:
2474         (WebKit::NetworkProcess::StorageQuotaManagers::defaultQuota const):
2475         (WebKit::NetworkProcess::StorageQuotaManagers::setDefaultQuotas):
2476         (WebKit::NetworkProcess::StorageQuotaManagers::managersPerOrigin):
2477
2478 2019-04-03  Michael Catanzaro  <mcatanzaro@igalia.com>
2479
2480         Get rid of HTMLInputElement::setEditingValue
2481         https://bugs.webkit.org/show_bug.cgi?id=196402
2482
2483         Reviewed by Darin Adler.
2484
2485         * WebProcess/InjectedBundle/API/glib/DOM/WebKitDOMElement.cpp:
2486         (webkit_dom_element_html_input_element_set_editing_value):
2487         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLInputElement.cpp:
2488         (webkit_dom_html_input_element_set_editing_value):
2489
2490 2019-04-03  Wenson Hsieh  <wenson_hsieh@apple.com>
2491
2492         Add a WebKit internal feature flag to always enable modern compatibility mode by default
2493         https://bugs.webkit.org/show_bug.cgi?id=196526
2494         <rdar://problem/49532923>
2495
2496         Reviewed by Antoine Quint.
2497
2498         * Shared/WebPreferences.yaml:
2499
2500 2019-04-03  Wenson Hsieh  <wenson_hsieh@apple.com>
2501
2502         Introduce and add plumbing for a website policy for meta viewport tag handling
2503         https://bugs.webkit.org/show_bug.cgi?id=196285
2504
2505         Reviewed by Tim Horton.
2506
2507         Add WebsiteMetaViewportPolicy, a bit that can be used to determine whether to respect or ignore the meta
2508         viewport tag and use native web page parameters instead of the default parameters.
2509
2510         * Shared/WebsiteMetaViewportPolicy.h: Copied from Source/WebKit/Shared/WebsitePoliciesData.h.
2511         * Shared/WebsitePoliciesData.cpp:
2512         (WebKit::WebsitePoliciesData::encode const):
2513         (WebKit::WebsitePoliciesData::decode):
2514         (WebKit::WebsitePoliciesData::applyToDocumentLoader):
2515
2516         Convert WebKit::WebsiteMetaViewportPolicy into WebCore::MetaViewportPolicy.
2517
2518         * Shared/WebsitePoliciesData.h:
2519         * UIProcess/API/APIWebsitePolicies.cpp:
2520         (API::WebsitePolicies::data):
2521         * UIProcess/API/APIWebsitePolicies.h:
2522
2523         Add additional plumbing for the policy flag.
2524
2525         * WebKit.xcodeproj/project.pbxproj:
2526         * WebProcess/WebPage/ios/WebPageIOS.mm:
2527         (WebKit::WebPage::resetViewportDefaultConfiguration):
2528
2529         Use native web page parameters if either "shouldIgnoreMetaViewport" is enabled, or the new policy is set.
2530         Eventually, the policy should completely replace the former preference once no internal clients depend on it.
2531
2532 2019-04-03  Wenson Hsieh  <wenson_hsieh@apple.com>
2533
2534         Add plumbing for a compatibility mode preference in WebKit
2535         https://bugs.webkit.org/show_bug.cgi?id=196005
2536
2537         Reviewed by Tim Horton.
2538
2539         Add plumbing between the Cocoa API object (WKWebpagePreferences) and the inner C++ API object
2540         (API::WebsitePolicies) for compatibility mode.
2541
2542         * Shared/WebCompatibilityMode.h: Added.
2543         * UIProcess/API/APIWebsitePolicies.h:
2544         * UIProcess/API/Cocoa/WKWebpagePreferences.mm:
2545         * UIProcess/Cocoa/NavigationState.mm:
2546         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
2547         * UIProcess/WebPageProxy.cpp:
2548         (WebKit::WebPageProxy::adjustPoliciesForCompatibilityMode):
2549         * UIProcess/WebPageProxy.h:
2550         * UIProcess/ios/WebPageProxyIOS.mm:
2551         * WebKit.xcodeproj/project.pbxproj:
2552
2553 2019-04-03  Carlos Garcia Campos  <cgarcia@igalia.com>
2554
2555         [CoordinatedGraphics] Hidden pages are not suspended after a web view resize
2556         https://bugs.webkit.org/show_bug.cgi?id=196487
2557
2558         Reviewed by Žan Doberšek.
2559
2560         When resizing the window, the hidden tabs are updated too, to avoid flickering or getting the old size when
2561         switching tabs. For that we need to resume painting but we are not suspending it again after the update.
2562
2563         * WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp:
2564         (WebKit::DrawingAreaCoordinatedGraphics::updateBackingStoreState): Suspend the painting again after a
2565         synchronous update if needed.
2566
2567 2019-04-03  Carlos Garcia Campos  <cgarcia@igalia.com>
2568
2569         Web Inspector: [GTK] Copy copies to nowhere
2570         https://bugs.webkit.org/show_bug.cgi?id=181228
2571
2572         Reviewed by Michael Catanzaro.
2573
2574         The thing is that those items are actually submenu items, with options, for example in the case of Copy to copy
2575         HTML, Text, XPath, etc. We are not correctly handling submenus when populating the context menu received from
2576         the web process.
2577
2578         * UIProcess/gtk/WebContextMenuProxyGtk.cpp:
2579         (WebKit::WebContextMenuProxyGtk::populateSubMenu): Helper to populate submenu items recursively.
2580         (WebKit::WebContextMenuProxyGtk::populate): Handle submenu items.
2581         * UIProcess/gtk/WebContextMenuProxyGtk.h:
2582
2583 2019-04-02  Wenson Hsieh  <wenson_hsieh@apple.com>
2584
2585         [Cocoa] Add new API around WKWebpagePreferences in WKNavigationDelegate and WKWebViewConfiguration
2586         https://bugs.webkit.org/show_bug.cgi?id=196284
2587         <rdar://problem/47228232>
2588
2589         Reviewed by Tim Horton.
2590
2591         Tests for both of these APIs will be added in a subsequent patch.
2592
2593         * Shared/API/Cocoa/WebKit.h:
2594         * UIProcess/API/APIPageConfiguration.cpp:
2595         (API::PageConfiguration::defaultWebsitePolicies const):
2596         (API::PageConfiguration::setDefaultWebsitePolicies):
2597         * UIProcess/API/APIPageConfiguration.h:
2598         * UIProcess/API/Cocoa/WKNavigationDelegate.h:
2599
2600         Add a new navigation delegate hook to allow clients to return a WKWebpagePreference targeting the given
2601         navigation action.
2602
2603         * UIProcess/API/Cocoa/WKWebView.mm:
2604         (-[WKWebView _initializeWithConfiguration:]):
2605         * UIProcess/API/Cocoa/WKWebViewConfiguration.h:
2606         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
2607
2608         Add new API on WKWebViewConfiguration to specify a default WKWebpagePreference to use when navigating.
2609
2610         (-[WKWebViewConfiguration copyWithZone:]):
2611         (-[WKWebViewConfiguration defaultWebpagePreferences]):
2612         (-[WKWebViewConfiguration setDefaultWebpagePreferences:]):
2613         * UIProcess/API/Cocoa/WKWebpagePreferences.h:
2614         * UIProcess/Cocoa/NavigationState.h:
2615         * UIProcess/Cocoa/NavigationState.mm:
2616         (WebKit::NavigationState::setNavigationDelegate):
2617         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
2618
2619         Invoke the new WKWebpagePreferences-based navigation delegate method.
2620
2621         * WebKit.xcodeproj/project.pbxproj:
2622         * mac/postprocess-framework-headers.sh:
2623         * mac/replace-webkit-additions-in-framework-headers.sh: Added.
2624
2625         Move logic in the "Postprocess Framework Headers" step responsible for stripping away included files from
2626         WebKitAdditions out into a separate build phase, called "Replace WebKitAdditions in Framework Headers". This
2627         ensures headers attempting to include from WebKitAdditions have these additional statements removed.
2628
2629 2019-04-02  Geoffrey Garen  <ggaren@apple.com>
2630
2631         Eliminate plugin sandbox exceptions
2632         https://bugs.webkit.org/show_bug.cgi?id=196510
2633
2634         Reviewed by Chris Dumez.
2635
2636         * PluginProcess/mac/PluginProcessMac.mm:
2637         (WebKit::PluginProcess::initializeSandbox):
2638         * UIProcess/Plugins/PluginInfoStore.cpp:
2639         (WebKit::PluginInfoStore::shouldAllowPluginToRunUnsandboxed): Deleted.
2640         * UIProcess/Plugins/PluginInfoStore.h:
2641         * UIProcess/Plugins/mac/PluginInfoStoreMac.mm:
2642         (WebKit::PluginInfoStore::shouldUsePlugin):
2643         (WebKit::PluginInfoStore::shouldAllowPluginToRunUnsandboxed): Deleted.
2644
2645 2019-04-02  Alex Christensen  <achristensen@webkit.org>
2646
2647         Fix assertion in http/tests/adClickAttribution/store-ad-click-attribution.html
2648         https://bugs.webkit.org/show_bug.cgi?id=196503
2649
2650         Reviewed by Chris Dumez.
2651
2652         In WebPageProxy::didDestroyNavigation we try to ignore a request to destroy a navigation from a page being navigated from
2653         during a cross-site navigation, but if the old web process sends the message after WebPageProxy::commitProvisionalPage
2654         has been called, we can still destroy a navigation when we are continuing a navigation in another process.  To prevent this,
2655         have the process not send the message when it knows the navigation is continuing in another process.
2656         Also make the use of unchecked navigation pointers more robust by checking it for nullity.
2657
2658         * UIProcess/WebPageProxy.cpp:
2659         (WebKit::WebPageProxy::didCommitLoadForFrame):
2660         * WebProcess/WebPage/WebFrame.cpp:
2661         (WebKit::WebFrame::didReceivePolicyDecision):
2662         (WebKit::WebFrame::documentLoaderDetached):
2663         * WebProcess/WebPage/WebFrame.h:
2664
2665 2019-04-02  Per Arne Vollan  <pvollan@apple.com>
2666
2667         [iOS] Fix iokit-get-properties sandbox violation in the WebContent process
2668         https://bugs.webkit.org/show_bug.cgi?id=196500
2669         <rdar://problem/49497788>
2670
2671         Reviewed by Brent Fulgham.
2672
2673         Attempting to get the iokit properties 'product-description', 'artwork-display-gamut' and
2674         'artwork-scale-factor' is causing sandbox violations.
2675
2676         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
2677
2678 2019-04-02  Chris Dumez  <cdumez@apple.com>
2679
2680         [WK2] Add support for Window's beforeprint / afterprint events
2681         https://bugs.webkit.org/show_bug.cgi?id=196478
2682
2683         Reviewed by Alex Christensen.
2684
2685         Add support for Window's beforeprint / afterprint events as per:
2686         - https://html.spec.whatwg.org/#dom-print
2687
2688         Blink and Gecko already support this.
2689
2690         * WebProcess/WebPage/WebPage.cpp:
2691         (WebKit::WebPage::beginPrinting):
2692         (WebKit::WebPage::endPrinting):
2693
2694 2019-04-02  Wenson Hsieh  <wenson_hsieh@apple.com>
2695
2696         REGRESSION (r243726): Crash at unrecognized selector: -[WKWebpagePreferences webpagePreferences]
2697         https://bugs.webkit.org/show_bug.cgi?id=196496
2698         <rdar://problem/49521634>
2699
2700         Reviewed by Chris Dumez.
2701
2702         r243726 made an incorrect assumption that all callers of -decidePolicyForNavigationAction:decisionHandler: and
2703         -decidePolicyForNavigationAction:userInfo:decisionHandler: must be instances of _WKWebsitePolicies, as opposed
2704         to the new WKWebpagePreferences. However, it's possible for clients (in this case, Safari) to already generate
2705         and pass in an instance of WKWebpagePreferences by bridging the C API opaque ref (WKWebsitePoliciesRef) into the
2706         Objective-C object (which is now WKWebpagePreferences, after my change).
2707
2708         To maintain binary compatibility of trunk WebKit against prior versions of Safari, we need to handle both
2709         WKWebpagePreferences and the soon-to-be-deprecated _WKWebsitePolicies in the navigation action policy decision
2710         handler.
2711
2712         Tests:  WebKit.WebsitePoliciesWithBridgingCast
2713                 WebKit.WebsitePoliciesWithUnexpectedType
2714
2715         * UIProcess/Cocoa/NavigationState.mm:
2716         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
2717
2718 2019-04-01  Chris Dumez  <cdumez@apple.com>
2719
2720         Unreviewed, drop debug logging landed as part of r242903 by mistake.
2721
2722         * UIProcess/WebPageProxy.cpp:
2723         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
2724
2725 2019-04-01  Remy Demarest  <rdemarest@apple.com>
2726
2727         Add SPI to give injected bundles access to displayed PDFDocuments
2728         https://bugs.webkit.org/show_bug.cgi?id=196471
2729         <rdar://problem/48080768>
2730
2731         Reviewed by Tim Horton.
2732
2733         * WebKit.xcodeproj/project.pbxproj:
2734
2735         * WebProcess/InjectedBundle/API/c/mac/WKBundlePageMac.h: Added.
2736         * WebProcess/InjectedBundle/API/c/mac/WKBundlePageMac.mm: Added.
2737         (WKBundlePageGetPDFDocumentInFrame):
2738
2739 2019-04-01  Wenson Hsieh  <wenson_hsieh@apple.com>
2740
2741         [WebKit2] Introduce a public version of WKWebsitePolicies
2742         https://bugs.webkit.org/show_bug.cgi?id=195989
2743         <rdar://problem/47228232>
2744
2745         Reviewed by Tim Horton.
2746
2747         Expose the existing _WKWebsitePolicies object as WKWebpagePreferences, in what will eventually become a public
2748         header in the WebKit SDK (WKWebpagePreferences.h). Following a similar transitioning strategy as
2749         _WKWebsiteDataStore and WKWebsiteDataStore, we move existing logic from _WKWebsitePolicies to WKWebpagePreferences
2750         and make _WKWebsitePolicies a wrapper around WKWebpagePreferences.
2751
2752         No change in behavior.
2753
2754         * Shared/Cocoa/APIObject.mm:
2755         (API::Object::newObject):
2756
2757         Wrap API::WebsitePolicies with WKWebpagePreferences.
2758
2759         * SourcesCocoa.txt:
2760         * UIProcess/API/Cocoa/WKWebView.mm:
2761         (-[WKWebView _updateWebsitePolicies:]):
2762         * UIProcess/API/Cocoa/WKWebpagePreferences.h: Copied from Source/WebKit/UIProcess/API/Cocoa/_WKWebsitePoliciesInternal.h.
2763         * UIProcess/API/Cocoa/WKWebpagePreferences.mm: Copied from Source/WebKit/UIProcess/API/Cocoa/_WKWebsitePolicies.mm.
2764
2765         Introduce WKWebpagePreferences.
2766
2767         (+[WKWebpagePreferences defaultPreferences]):
2768         (-[WKWebpagePreferences dealloc]):
2769         (-[WKWebpagePreferences init]):
2770         (-[WKWebpagePreferences _setContentBlockersEnabled:]):
2771         (-[WKWebpagePreferences _contentBlockersEnabled]):
2772         (-[WKWebpagePreferences _setAllowedAutoplayQuirks:]):
2773         (-[WKWebpagePreferences _allowedAutoplayQuirks]):
2774         (-[WKWebpagePreferences _setAutoplayPolicy:]):
2775         (-[WKWebpagePreferences _autoplayPolicy]):
2776         (-[WKWebpagePreferences _setDeviceOrientationAndMotionAccessPolicy:]):
2777         (-[WKWebpagePreferences _deviceOrientationAndMotionAccessPolicy]):
2778         (-[WKWebpagePreferences _setPopUpPolicy:]):
2779         (-[WKWebpagePreferences _popUpPolicy]):
2780         (-[WKWebpagePreferences _customHeaderFields]):
2781         (-[WKWebpagePreferences _setCustomHeaderFields:]):
2782         (-[WKWebpagePreferences _websiteDataStore]):
2783         (-[WKWebpagePreferences _setWebsiteDataStore:]):
2784         (-[WKWebpagePreferences _setCustomUserAgent:]):
2785         (-[WKWebpagePreferences _customUserAgent]):
2786         (-[WKWebpagePreferences _setCustomJavaScriptUserAgentAsSiteSpecificQuirks:]):
2787         (-[WKWebpagePreferences _customJavaScriptUserAgentAsSiteSpecificQuirks]):
2788         (-[WKWebpagePreferences _setCustomNavigatorPlatform:]):
2789         (-[WKWebpagePreferences _customNavigatorPlatform]):
2790         (-[WKWebpagePreferences _apiObject]):
2791         * UIProcess/API/Cocoa/WKWebpagePreferencesInternal.h: Copied from Source/WebKit/UIProcess/API/Cocoa/_WKWebsitePoliciesInternal.h.
2792         * UIProcess/API/Cocoa/WKWebpagePreferencesPrivate.h: Copied from Source/WebKit/UIProcess/API/Cocoa/_WKWebsitePolicies.h.
2793
2794         Reintroduce all the interfaces currently available on _WKWebsitePolicies as underscore-prefixed SPI on
2795         WKWebpagePreferences.
2796
2797         * UIProcess/API/Cocoa/_WKWebsitePolicies.h:
2798         * UIProcess/API/Cocoa/_WKWebsitePolicies.mm:
2799
2800         Make _WKWebsitePolicies wrap WKWebpagePreferences, and plumb all existing SPI on WKWebsitePolicies through to
2801         WKWebpagePreferences.
2802
2803         (-[_WKWebsitePolicies init]):
2804         (-[_WKWebsitePolicies webpagePreferences]):
2805         (-[_WKWebsitePolicies setContentBlockersEnabled:]):
2806         (-[_WKWebsitePolicies contentBlockersEnabled]):
2807         (-[_WKWebsitePolicies setAllowedAutoplayQuirks:]):
2808         (-[_WKWebsitePolicies allowedAutoplayQuirks]):
2809         (-[_WKWebsitePolicies setAutoplayPolicy:]):
2810         (-[_WKWebsitePolicies autoplayPolicy]):
2811         (-[_WKWebsitePolicies setDeviceOrientationAndMotionAccessPolicy:]):
2812         (-[_WKWebsitePolicies deviceOrientationAndMotionAccessPolicy]):
2813         (-[_WKWebsitePolicies setPopUpPolicy:]):
2814         (-[_WKWebsitePolicies popUpPolicy]):
2815         (-[_WKWebsitePolicies customHeaderFields]):
2816         (-[_WKWebsitePolicies setCustomHeaderFields:]):
2817         (-[_WKWebsitePolicies websiteDataStore]):
2818         (-[_WKWebsitePolicies setWebsiteDataStore:]):
2819         (-[_WKWebsitePolicies setCustomUserAgent:]):
2820         (-[_WKWebsitePolicies customUserAgent]):
2821         (-[_WKWebsitePolicies setCustomJavaScriptUserAgentAsSiteSpecificQuirks:]):
2822         (-[_WKWebsitePolicies customJavaScriptUserAgentAsSiteSpecificQuirks]):
2823         (-[_WKWebsitePolicies setCustomNavigatorPlatform:]):
2824         (-[_WKWebsitePolicies customNavigatorPlatform]):
2825         (-[_WKWebsitePolicies description]):
2826         (-[_WKWebsitePolicies _apiObject]):
2827         (-[_WKWebsitePolicies dealloc]): Deleted.
2828         * UIProcess/API/Cocoa/_WKWebsitePoliciesInternal.h:
2829         * UIProcess/Cocoa/NavigationState.mm:
2830         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
2831         * WebKit.xcodeproj/project.pbxproj:
2832
2833 2019-04-01  Wenson Hsieh  <wenson_hsieh@apple.com>
2834
2835         Unable to copy and paste a PDF from Notes into Mail compose body
2836         https://bugs.webkit.org/show_bug.cgi?id=196442
2837         <rdar://problem/48573098>
2838
2839         Reviewed by Tim Horton.
2840
2841         Relax the -canPerformAction: logic in the case of pasting an attachment. Consider an NSItemProvider to possibly
2842         paste as an attachment if either it has a preferred presentation style of UIPreferredPresentationStyleAttachment
2843         or has a style of UIPreferredPresentationStyleUnspecified, but has a suggested file name.
2844
2845         This allows for the "Paste" action to be shown in the callout menu when copying and pasting a non-text file.
2846
2847         * UIProcess/ios/WKContentViewInteraction.mm:
2848         (-[WKContentView canPerformActionForWebView:withSender:]):
2849
2850 2019-04-01  Tim Horton  <timothy_horton@apple.com>
2851
2852         Make UIWKDocumentContext rects per-character instead of per-word
2853         https://bugs.webkit.org/show_bug.cgi?id=196459
2854
2855         Reviewed by Wenson Hsieh.
2856
2857         * WebProcess/WebPage/ios/WebPageIOS.mm:
2858         (WebKit::WebPage::requestDocumentEditingContext):
2859         Switch to CharacterIterator instead of TextIterator directly, to get
2860         per-character rects as the API requests.
2861
2862 2019-04-01  Chris Dumez  <cdumez@apple.com>
2863
2864         UIProcess crash when a prewarmed process is terminated
2865         https://bugs.webkit.org/show_bug.cgi?id=196451
2866         <rdar://problem/49245471>
2867
2868         Reviewed by Geoffrey Garen.
2869
2870         Stop assuming that WebProcessProxy::m_websiteDataStore is non-null as this is no longer
2871         true after r243384. For example, prewarmed WebContent processe do not get a data store
2872         until they actually get used.
2873
2874         * UIProcess/API/Cocoa/WKProcessPool.mm:
2875         (-[WKProcessPool _prewarmedProcessIdentifier]):
2876         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
2877         * UIProcess/WebProcessPool.cpp:
2878         (WebKit::WebProcessPool::networkProcessIdentifier):
2879         (WebKit::WebProcessPool::prewarmedProcessIdentifier):
2880         * UIProcess/WebProcessPool.h:
2881         * UIProcess/WebProcessProxy.cpp:
2882         (WebKit::WebProcessProxy::didClose):
2883         (WebKit::WebProcessProxy::didFinishLaunching):
2884         (WebKit::WebProcessProxy::requestTermination):
2885         (WebKit::WebProcessProxy::isReleaseLoggingAllowed const):
2886         * UIProcess/WebProcessProxy.h:
2887
2888 2019-04-01  Patrick Griffis  <pgriffis@igalia.com>
2889
2890         [GTK][WPE] Add more websitedatastore directories to web process sandbox
2891         https://bugs.webkit.org/show_bug.cgi?id=196447
2892
2893         Reviewed by Michael Catanzaro.
2894
2895         * UIProcess/Launcher/glib/BubblewrapLauncher.cpp:
2896         (WebKit::bubblewrapSpawn):
2897         * UIProcess/glib/WebProcessProxyGLib.cpp:
2898         (WebKit::WebProcessProxy::platformGetLaunchOptions):
2899
2900 2019-04-01  Per Arne Vollan  <pvollan@apple.com>
2901
2902         [macOS] Crash when loading Twitter with autoplay video enabled.
2903         https://bugs.webkit.org/show_bug.cgi?id=196446
2904         <rdar://problem/49060359>
2905
2906         Reviewed by Brent Fulgham.
2907
2908         This is caused by a syscall violation.
2909
2910         * WebProcess/com.apple.WebProcess.sb.in:
2911
2912 2019-04-01  Patrick Griffis  <pgriffis@igalia.com>
2913
2914         [GTK][WPE] Fix seccomp rule for blacklisting TIOCSTI
2915         https://bugs.webkit.org/show_bug.cgi?id=196297
2916
2917         Reviewed by Michael Catanzaro.
2918
2919         More information can be found here: https://www.exploit-db.com/exploits/46594
2920
2921         Note that this sandbox never made it into production so does not
2922         warrant any CVE specific to WebKit.
2923
2924         * UIProcess/Launcher/glib/BubblewrapLauncher.cpp:
2925         (WebKit::setupSeccomp):
2926
2927 2019-03-31  Wenson Hsieh  <wenson_hsieh@apple.com>
2928
2929         [iOS] Crash when changing inputmode for certain types of focusable elements
2930         https://bugs.webkit.org/show_bug.cgi?id=196431
2931         <rdar://problem/49454962>
2932
2933         Reviewed by Tim Horton.
2934
2935         The crash is happening because WebPage::focusedElementDidChangeInputMode assumes that the document's focused
2936         element must be the same as m_focusedElement in WebPage. However, this is not the case, since m_focusedElement
2937         is only set for certain types of elements that require user input (e.g. text fields, editable content, select
2938         menus, etc.). The function then attempts to dereference m_focusedElement, which may be null if the document's
2939         focused element doesn't fall into one of the aforementioned categories.
2940
2941         To fix this, bail if the element that is changing inputmode is not equal to the WebPage's current focused
2942         element. See below for more details.
2943
2944         Test: fast/forms/change-inputmode-crash.html
2945
2946         * WebProcess/WebPage/WebPage.cpp:
2947         (WebKit::isTextFormControlOrEditableContent):
2948
2949         Clean up some existing logic by introducing a helper method for determining whether an element should
2950         propagate inputmode attribute changes to the UI process. Also, check the element type using type traits instead
2951         of checking against the tag name.
2952
2953         (WebKit::WebPage::elementDidFocus):
2954         (WebKit::WebPage::focusedElementDidChangeInputMode):
2955
2956 2019-03-31  Sam Weinig  <weinig@apple.com>
2957
2958         Remove more i386 specific configurations
2959         https://bugs.webkit.org/show_bug.cgi?id=196430
2960
2961         Reviewed by Alexey Proskuryakov.
2962
2963         * Configurations/BaseTarget.xcconfig:
2964         WK_HAVE_CORE_PREDICTION can now be enabled unconditionally.
2965  
2966         * Configurations/FeatureDefines.xcconfig:
2967         ENABLE_WEB_AUTHN_macosx can now be enabled unconditionally on macOS.
2968
2969 2019-03-31  Andy Estes  <aestes@apple.com>
2970
2971         [iOS] WebKit should consult the navigation response policy delegate before previewing a QuickLook document
2972         https://bugs.webkit.org/show_bug.cgi?id=196433
2973         <rdar://problem/49293305>
2974
2975         Reviewed by Tim Horton.
2976
2977         Added WKWebViewConfiguration SPI for setting the QuickLook navigation response policy
2978         decision behavior. The configuration setting defaults to YES for clients linked on or after
2979         this WebKit change and NO otherwise.
2980
2981         * NetworkProcess/NetworkResourceLoader.cpp:
2982         (WebKit::NetworkResourceLoader::shouldInterruptLoadForCSPFrameAncestorsOrXFrameOptions):
2983         * Shared/WebPreferences.yaml:
2984         * Shared/ios/QuickLookDocumentData.cpp:
2985         (WebKit::QuickLookDocumentData::isEmpty const):
2986         * Shared/ios/QuickLookDocumentData.h:
2987         * UIProcess/API/Cocoa/WKWebView.mm:
2988         (-[WKWebView _initializeWithConfiguration:]):
2989         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
2990         (defaultShouldDecidePolicyBeforeLoadingQuickLookPreview):
2991         (-[WKWebViewConfiguration init]):
2992         (-[WKWebViewConfiguration encodeWithCoder:]):
2993         (-[WKWebViewConfiguration initWithCoder:]):
2994         (-[WKWebViewConfiguration copyWithZone:]):
2995         (-[WKWebViewConfiguration _shouldDecidePolicyBeforeLoadingQuickLookPreview]):
2996         (-[WKWebViewConfiguration _setShouldDecidePolicyBeforeLoadingQuickLookPreview:]):
2997         * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
2998         * UIProcess/Cocoa/VersionChecks.h:
2999         * WebProcess/WebCoreSupport/ios/WebPreviewLoaderClient.cpp:
3000         (WebKit::WebPreviewLoaderClient::didReceiveDataArray):
3001
3002 2019-03-30  Zalan Bujtas  <zalan@apple.com>
3003
3004         [ContentChangeObserver] Subframe load should not reset content observation on the mainframe
3005         https://bugs.webkit.org/show_bug.cgi?id=196408
3006         <rdar://problem/49436797>
3007
3008         Reviewed by Simon Fraser.
3009
3010         Hover intent fails when an unrelated frame commits a load the same time.
3011         cancelPotentialTapInFrame is called from didCommitLoad, but what we are looking for here is the user initiated cancel of a tap (cancelPotentialTap).
3012         (If the current frame navigates away, willDetachPage takes care of canceling the observation.)
3013
3014         * WebProcess/WebPage/ios/WebPageIOS.mm:
3015         (WebKit::WebPage::cancelPotentialTap):
3016         (WebKit::WebPage::cancelPotentialTapInFrame):
3017
3018 2019-03-29  John Wilander  <wilander@apple.com>
3019
3020         Move WebResourceLoadStatisticsStore IPC calls from the UI process to the network process
3021         https://bugs.webkit.org/show_bug.cgi?id=196407
3022         <rdar://problem/47859936>
3023
3024         Reviewed by Brent Fulgham.
3025
3026         The two WebResourceLoadStatisticsStore IPC endpoints were left behind when we
3027         moved Resource Load Statistics from the UI process to the network process. One
3028         of the endpoints is the message RequestStorageAccessUnderOpener which underpins
3029         our compatibility fix for federated logins using popups. This patch redirects
3030         these IPC calls to the network process and cleans up some assumptions around
3031         them.
3032
3033         * CMakeLists.txt:
3034             Removed the old IPC receiver.
3035         * DerivedSources.make:
3036             Removed the old IPC receiver.
3037         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
3038         (WebKit::WebResourceLoadStatisticsStore::requestUpdate): Deleted.
3039             This is no longer needed since there is a dedicated update mechanism
3040             that actually sends the update.
3041         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
3042         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
3043         (WebKit::NetworkConnectionToWebProcess::resourceLoadStatisticsUpdated):
3044         (WebKit::NetworkConnectionToWebProcess::requestStorageAccessUnderOpener):
3045             Two new IPC receivers to pipe the calls to the network process.
3046         (WebKit::NetworkConnectionToWebProcess::requestResourceLoadStatisticsUpdate): Deleted.
3047             NetworkConnectionToWebProcess::resourceLoadStatisticsUpdated now serves
3048             this purpose.
3049         * NetworkProcess/NetworkConnectionToWebProcess.h:
3050         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
3051         * UIProcess/WebResourceLoadStatisticsStore.messages.in: Removed.
3052             Removed the old IPC receiver.
3053         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
3054         * WebKit.xcodeproj/project.pbxproj:
3055         * WebProcess/InjectedBundle/API/c/WKBundle.cpp:
3056         (WKBundleResourceLoadStatisticsNotifyObserver):
3057             Function name update.
3058         * WebProcess/WebProcess.cpp:
3059             Now calls IPC to the network process instead of the UI process.
3060
3061 2019-03-29  Myles C. Maxfield  <mmaxfield@apple.com>
3062
3063         Delete WebMetal implementation in favor of WebGPU
3064         https://bugs.webkit.org/show_bug.cgi?id=195418
3065
3066         Reviewed by Dean Jackson.
3067
3068         * Configurations/FeatureDefines.xcconfig:
3069         * Shared/WebPreferences.yaml:
3070         * WebProcess/InjectedBundle/InjectedBundle.cpp:
3071         (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner):
3072
3073 2019-03-29  Takashi Komori  <Takashi.Komori@sony.com>
3074
3075         [Curl] Add Server Trust Evaluation Support.
3076         https://bugs.webkit.org/show_bug.cgi?id=191646
3077
3078         Reviewed by Fujii Hironori.
3079
3080         Tests: http/tests/ssl/iframe-upgrade.https.html
3081                http/tests/ssl/mixedContent/insecure-websocket.html
3082                http/tests/ssl/upgrade-origin-usage.html
3083
3084         * NetworkProcess/curl/NetworkDataTaskCurl.cpp:
3085         (WebKit::NetworkDataTaskCurl::curlDidFailWithError):
3086         (WebKit::NetworkDataTaskCurl::tryServerTrustEvaluation):
3087         (WebKit::NetworkDataTaskCurl::restartWithCredential):
3088         * NetworkProcess/curl/NetworkDataTaskCurl.h:
3089
3090 2019-03-29  Cathie Chen  <cathiechen@igalia.com>
3091
3092         Implement ResizeObserver.
3093         https://bugs.webkit.org/show_bug.cgi?id=157743
3094
3095         Reviewed by Simon Fraser.
3096
3097         Add WebPreferences and FeatureDefines for ResizeObserver.
3098
3099         * Configurations/FeatureDefines.xcconfig:
3100         * Shared/WebPreferences.yaml:
3101
3102 2019-03-28  Timothy Hatcher  <timothy@apple.com>
3103
3104         CFDictionary encoder crashes on non-string keys.
3105         https://bugs.webkit.org/show_bug.cgi?id=196388
3106         rdar://problem/49339242
3107
3108         Reviewed by Ryosuke Niwa.
3109
3110         Allow non-string keys in CFDictionary encoding/decoding. Encode the correct
3111         size for dictionaries and arrays when unknown keys or values are skipped.
3112         Allow null array encoding and decoding like dictionary already allowed.
3113
3114         * Shared/cf/ArgumentCodersCF.cpp:
3115         (IPC::encode):
3116         (IPC::decode):
3117
3118 2019-03-28  John Wilander  <wilander@apple.com>
3119
3120         Resource Load Statistics: IPC to the WebsiteDataStore in the UI process from NetworkProcess::deleteWebsiteDataForRegistrableDomains()
3121         https://bugs.webkit.org/show_bug.cgi?id=196281
3122         <rdar://problem/48938748>
3123
3124         Reviewed by Alex Christensen.
3125
3126         The move of Resource Load Statistics to the network process requires that it
3127         calls the UI process when clearing website data (previously the other way
3128         around). This patch achieves that.
3129
3130         Specifically, NetworkProcess::deleteWebsiteDataForRegistrableDomains() now
3131         filters its WebsiteDataTypes down to just the ones applicable for the UI
3132         process and then calls DeleteWebsiteDataInUIProcessForRegistrableDomains over
3133         IPC.
3134
3135         NetworkProcessProxy::deleteWebsiteDataInUIProcessForRegistrableDomains() on
3136         the UI process side makes use of the re-introduced
3137         WebsiteDataStore::fetchDataForRegistrableDomains() function to get the relevant
3138         data records and call WebsiteDataStore::removeData(). The re-introduced
3139         WebsiteDataStore::fetchDataForRegistrableDomains() was removed as dead code in
3140         https://trac.webkit.org/changeset/242056/webkit, then under the name
3141         WebsiteDataStore::fetchDataForTopPrivatelyControlledDomains(). The reason it
3142         was dead code was the lack of IPC call that this patch adds.
3143
3144         * NetworkProcess/NetworkProcess.cpp:
3145         (WebKit::NetworkProcess::deleteWebsiteDataForRegistrableDomains):
3146            Now calls DeleteWebsiteDataInUIProcessForRegistrableDomains over IPC if there
3147            are WebsiteDataTypes applicable to the UI process.
3148         * NetworkProcess/NetworkProcess.h:
3149         * Shared/WebsiteData/WebsiteData.cpp:
3150         (WebKit::WebsiteData::ownerProcess):
3151         (WebKit::WebsiteData::filter):
3152             Convenience functions to manage process ownership of website data types.
3153         * Shared/WebsiteData/WebsiteData.h:
3154         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
3155         (WKWebsiteDataStoreStatisticsHasLocalStorage):
3156             Test infrastructure, called by the TestRunner.
3157         * UIProcess/API/C/WKWebsiteDataStoreRef.h:
3158         * UIProcess/Network/NetworkProcessProxy.cpp:
3159         (WebKit::NetworkProcessProxy::deleteWebsiteDataInUIProcessForRegistrableDomains):
3160             New function to be called from the network process.
3161         * UIProcess/Network/NetworkProcessProxy.h:
3162         * UIProcess/Network/NetworkProcessProxy.messages.in:
3163         * UIProcess/WebsiteData/WebsiteDataRecord.cpp:
3164         (WebKit::WebsiteDataRecord::matches const):
3165             Now matches with WebCore::RegistrableDomain instead of a string.
3166         (WebKit::WebsiteDataRecord::matchesTopPrivatelyControlledDomain const): Deleted.
3167             Replaced by WebsiteDataRecord::matches().
3168         * UIProcess/WebsiteData/WebsiteDataRecord.h:
3169         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
3170         (WebKit::WebsiteDataStore::fetchDataForRegistrableDomains):
3171             Re-introduced. It was removed as dead code in r242056.
3172         (WebKit::computeNetworkProcessAccessTypeForDataRemoval):
3173         (WebKit::WebsiteDataStore::hasLocalStorageForTesting const):
3174             Test infrastructure, called by the TestRunner.
3175         * UIProcess/WebsiteData/WebsiteDataStore.h:
3176
3177 2019-03-28  Jiewen Tan  <jiewen_tan@apple.com>
3178
3179         API::Data::createWithoutCopying should do a null check before calling CFRelease
3180         https://bugs.webkit.org/show_bug.cgi?id=196276
3181         <rdar://problem/48059859>
3182
3183         Reviewed by Alex Christensen.
3184
3185         * Shared/Cocoa/APIDataCocoa.mm:
3186         (API::Data::createWithoutCopying):
3187
3188 2019-03-28  Per Arne Vollan  <pvollan@apple.com>
3189
3190         [iOS] Automatic focus of input field is flaky
3191         https://bugs.webkit.org/show_bug.cgi?id=196302
3192
3193         Reviewed by Brent Fulgham.
3194
3195         Sometimes the status of whether a keyboard is connected can be incorrect, both in the UI process, and in
3196         the WebContent process. Fix this by sending the keyboard status to the WebContent process as part of the
3197         Web page creation parameters. Stop caching the keyboard status in the Web process proxy, and call
3198         [UIKeyboard isInHardwareKeyboardMode] instead, since this method is swizzled in the test harness.
3199
3200         * Shared/WebPageCreationParameters.cpp:
3201         (WebKit::WebPageCreationParameters::encode const):
3202         (WebKit::WebPageCreationParameters::decode):
3203         * Shared/WebPageCreationParameters.h:
3204         * UIProcess/API/Cocoa/WKWebView.mm:
3205         (hardwareKeyboardAvailabilityChangedCallback):
3206         * UIProcess/WebPageProxy.cpp:
3207         (WebKit::WebPageProxy::creationParameters):
3208         * UIProcess/WebPageProxy.h:
3209         * UIProcess/WebProcessProxy.cpp:
3210         * UIProcess/WebProcessProxy.h:
3211         (WebKit::WebProcessProxy::setKeyboardIsAttached): Deleted.
3212         (WebKit::WebProcessProxy::keyboardIsAttached const): Deleted.
3213         * UIProcess/ios/WKContentViewInteraction.mm:
3214         (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
3215         * UIProcess/ios/WebPageProxyIOS.mm:
3216         (WebKit::WebPageProxy::isInHardwareKeyboardMode):
3217         (WebKit::WebPageProxy::applicationWillEnterForeground):
3218         * WebProcess/WebPage/WebPage.cpp:
3219         * WebProcess/WebPage/WebPage.h:
3220
3221 2019-03-28  Tim Horton  <timothy_horton@apple.com>
3222
3223         Fix the build.
3224
3225         * UIProcess/ios/WKActionSheetAssistant.mm:
3226         (-[WKActionSheetAssistant showImageSheet]):
3227         * UIProcess/ios/WKContentViewInteraction.mm:
3228         (-[WKContentView actionSheetAssistant:showCustomSheetForElement:]):
3229
3230 2019-03-28  Michael Catanzaro  <mcatanzaro@igalia.com>
3231
3232         [WPE][GTK] webkit_web_resource_get_data_finish can return NULL without setting error
3233         https://bugs.webkit.org/show_bug.cgi?id=186276
3234
3235         Reviewed by Carlos Garcia Campos.
3236
3237         Currently it's possible for webkit_web_resource_get_data_finish() to return NULL without
3238         setting the error parameter. This is illegal because it is an API guarantee (and a GObject
3239         convention) that if an error parameter exists, it should be set whenever a function call
3240         returns NULL. Epiphany correctly dereferences the error in this case without checking if it
3241         is NULL, because it knows it does not have to, and crashes. Fix this. We'll return a byte
3242         array of length 1 containing a NUL character. This isn't great, but there's not really any
3243         better solution without deprecating the API or returning an error code to indicate an empty
3244         resource, and it at least fixes the Epiphany crash.
3245
3246         This does not fix bug #186276, in which this function incorrectly returns no data when it
3247         ought to. But that is a different bug. Now, at least we won't crash when no data is
3248         available.
3249
3250         * UIProcess/API/glib/WebKitWebResource.cpp:
3251         (resourceDataCallback):
3252
3253 2019-03-28  Daniel Bates  <dabates@apple.com>
3254
3255         [iPad] Tapping on a popup form control may not show a popover
3256         https://bugs.webkit.org/show_bug.cgi?id=196322
3257         <rdar://problem/49229632>
3258
3259         Reviewed by Wenson Hsieh.
3260
3261         Stop taking advantage of -[WKContentView inputView] being called when we invoke -reloadInputViews
3262         to "lazily" allocate the input peripheral for the currently focused element. In theory, UIKit only
3263         needs to call -inputView when it actually needs to display the input view (the keyboard). For
3264         popup menu buttons, like <select>, no keyboard is needed. Instead we should create the peripheral
3265         as part of the logic in the UI process to focus a new element before we call -reloadInputViews.
3266
3267         * UIProcess/ios/WKContentViewInteraction.mm:
3268         (-[WKContentView inputView]): Extract logic to allocate the peripheral from here and moved it to createInputPeripheralWithView().
3269         (-[WKContentView accessoryTab:]): While I am here, add a FIXME comment to explain why we need to
3270         end the input sessions and nullify the input peripheral before we tell the web process to switch
3271         focus as opposed to letting this happen after the web process tells us it focused a new element.
3272         (createInputPeripheralWithView): Added.
3273         (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
3274         Write in terms of createInputPeripheralWithView(). Create the input peripheral after becoming
3275         first responder because creating the peripheral has known side-effects: for popup buttons it
3276         tells the popup controller to present the popover. For key input to popovers to work from the get-go,
3277         the content view must be the first responder. See <https://bugs.webkit.org/show_bug.cgi?id=196272>
3278         for more details.
3279
3280 2019-03-28  Víctor Manuel Jáquez Leal  <vjaquez@igalia.com>
3281
3282         Silence lot of warnings when compiling with clang
3283         https://bugs.webkit.org/show_bug.cgi?id=196310
3284
3285         Reviewed by Michael Catanzaro.
3286
3287         * UIProcess/API/glib/WebKitInjectedBundleClient.cpp: add missing
3288         override clause.
3289         * WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.h: add
3290         missing override clause.
3291
3292 2019-03-27  Ryosuke Niwa  <rniwa@webkit.org>
3293
3294         [macOS] Select element doesn't show popup if select element had lost focus while popup was previosuly shown
3295         https://bugs.webkit.org/show_bug.cgi?id=196336
3296
3297         Reviewed by Tim Horton.
3298
3299         The bug was caused by WebPopupMenu::hide never notifying PopupClient that the popup had been dismissed.
3300         This resulted in RenderMenuList::m_popupIsVisible to be never reset.
3301
3302         Also fixed a bug in WebPopupMenuProxyMac::hidePopupMenu that this function was never dismissing
3303         the popup as the selector "dismissPopUp", on the contrary to its name, does not dimiss the popup.
3304         Send cancelTracking to NSMenu instead, which DOES dismiss the popup.
3305
3306         Tests: fast/forms/select/mac-wk2/blur-dismisses-select-popup.html
3307                fast/forms/select/mac-wk2/open-select-popup-after-dismissing-by-blur.html
3308
3309         * UIProcess/mac/WebPopupMenuProxyMac.mm:
3310         (WebKit::WebPopupMenuProxyMac::hidePopupMenu):
3311         * WebProcess/WebCoreSupport/WebPopupMenu.cpp:
3312         (WebKit::WebPopupMenu::hide):
3313
3314 2019-03-27  Dean Jackson  <dino@apple.com>
3315
3316         [ARKit] Black view when opening a 3D model usdz file in new tab
3317         https://bugs.webkit.org/show_bug.cgi?id=196333
3318         <rdar://problem/47693367>
3319
3320         Reviewed by Tim Horton.
3321
3322         When opening a new WKSystemPreviewView, we were exiting if there was no
3323         presentingViewController. This code was unnecessary, and causing blank
3324         content when opening a new tab.
3325
3326         * UIProcess/ios/WKSystemPreviewView.mm:
3327         (-[WKSystemPreviewView web_setContentProviderData:suggestedFilename:]):
3328         Remove the code looking for a presentingViewController.
3329
3330 2019-03-27  Wenson Hsieh  <wenson_hsieh@apple.com>
3331
3332         Need a way to include WebKitAdditions code in WebKit API headers
3333         https://bugs.webkit.org/show_bug.cgi?id=196173
3334
3335         Reviewed by Tim Horton.
3336
3337         Introduce a mechanism that allows us to insert code from WebKitAdditions into public or private SDK headers
3338         using `#import`s of the form:
3339
3340         ```
3341         #if USE(APPLE_INTERNAL_SDK)
3342         #import <WebKitAdditions/WKWebViewConfigurationAdditions.h>
3343         #endif
3344         ```
3345
3346         The resulting header in the built products directory will contain the contents of the imported file inserted in
3347         place of the `#if USE(APPLE_INTERNAL_SDK) … #endif` block; however, when building with the Apple internal SDK,
3348         the additions header content will be imported by the usual means.
3349
3350         * mac/postprocess-framework-headers.sh:
3351         * mac/replace-webkit-additions-includes.py: Added.
3352
3353         Add a step when post-processing framework headers to replace instances of `#if USE(APPLE_INTERNAL_SDK) … #endif`
3354         with the text content of the additions files. The replacement script first searches in the built products
3355         directory for the matching additions file, and falls back to the SDK if no matching file is found. If neither
3356         are present (e.g. a build using the public SDK), then the block is simply replaced by the empty string.
3357
3358         (read_content_from_webkit_additions):
3359         (main):
3360
3361 2019-03-27  Andy Estes  <aestes@apple.com>
3362
3363         REGRESSION (r242686): package-root creates roots with broken symlinks in WebKit.framework/XPCServices/
3364         https://bugs.webkit.org/show_bug.cgi?id=196317
3365
3366         Reviewed by Dan Bernstein.
3367
3368         Removed some remnants of the Storage Process.
3369
3370         * Configurations/BaseTarget.xcconfig:
3371         * Resources/SandboxProfiles/ios/com.apple.WebKit.Storage.sb: Removed.
3372         * WebKit.xcodeproj/project.pbxproj:
3373
3374 2019-03-27  Keith Rollin  <krollin@apple.com>
3375
3376         Include the CFNetworking task UUID to the NSError when a resource-load fails
3377         https://bugs.webkit.org/show_bug.cgi?id=196156
3378
3379         Reviewed by Alex Christensen.
3380
3381         In order to help track the connection between a failed resource-load
3382         and a user-visible error message, include the CFNetworking task UUID
3383         in the associated error as an element of the userInfo property. This
3384         can then be pulled out and reported in the logging at the point the
3385         error is reported to the user.
3386
3387         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
3388         (-[WKNetworkSessionDelegate URLSession:task:didCompleteWithError:]):
3389
3390 2019-03-27  Chris Dumez  <cdumez@apple.com>
3391
3392         [ iOS Sim ] REGRESSION (r242277) Layout Test http/tests/cookies/same-site/lax-samesite-cookie-after-cross-site-history-load.php is a flaky timeout
3393         https://bugs.webkit.org/show_bug.cgi?id=195425
3394         <rdar://problem/48682403>
3395
3396         Reviewed by Alex Christensen.
3397
3398         When process-swapping on history navigation, we lookup the WebProcessProxy we'd like to use from the
3399         process identifier that is saved on the WebBackForwardListItem, to try and load the item in the process
3400         in which it was previously loaded. However, we were failing to check if the WebProcess in question was
3401         still running so we could potentially try to use a process that's already exited.
3402
3403         * UIProcess/WebProcessPool.cpp:
3404         (WebKit::WebProcessPool::processForNavigationInternal):
3405
3406 2019-03-27  Zalan Bujtas  <zalan@apple.com>
3407
3408         [ContentChangeObserver] Always dispatch the synthetic click asynchronously
3409         https://bugs.webkit.org/show_bug.cgi?id=196278
3410         <rdar://problem/49299968>
3411
3412         Reviewed by Simon Fraser.
3413
3414         This patch ensures that all completeSyntheticClick() calls happen in an asynchronous manner (unless the feature is turned off).
3415
3416         * WebProcess/WebPage/ios/WebPageIOS.mm:
3417         (WebKit::dispatchSyntheticMouseMove):
3418         (WebKit::WebPage::handleSyntheticClick):
3419
3420 2019-03-27  Tim Horton  <timothy_horton@apple.com>
3421
3422         Fix some more deprecation warnings in WKDrawingView
3423         https://bugs.webkit.org/show_bug.cgi?id=196282
3424         <rdar://problem/47637608>
3425
3426         Reviewed by Wenson Hsieh.
3427
3428         * Platform/spi/ios/PencilKitSPI.h:
3429         * SourcesCocoa.txt:
3430         * UIProcess/ios/PencilKitSoftLink.h:
3431         * UIProcess/ios/PencilKitSoftLink.mm:
3432         * UIProcess/ios/WKContentViewInteraction.mm:
3433         * UIProcess/ios/WKDrawingCoordinator.h:
3434         * UIProcess/ios/WKDrawingCoordinator.mm:
3435         (-[WKDrawingCoordinator initWithContentView:]):
3436         (-[WKDrawingCoordinator currentInk]):
3437         (-[WKDrawingCoordinator undoManagerForInkPicker:]):
3438         (-[WKDrawingCoordinator containingViewForInkPicker:]):
3439         (-[WKDrawingCoordinator inkPickerDidToggleRuler:]):
3440         (-[WKDrawingCoordinator inkPickerDidChangeInk:]):
3441         (-[WKDrawingCoordinator installInkPickerForDrawing:]):
3442         (-[WKDrawingCoordinator uninstallInkPicker]):
3443         (-[WKDrawingCoordinator inkPicker]): Deleted.
3444         (-[WKDrawingCoordinator didChangeRulerState:]): Deleted.
3445         (-[WKDrawingCoordinator didChangeInk:]): Deleted.
3446         * UIProcess/ios/WKDrawingView.mm:
3447         (-[WKDrawingView _canvasViewWillBeginDrawing:]):
3448         * UIProcess/ios/WKInkPickerView.h: Removed.
3449         * UIProcess/ios/WKInkPickerView.mm: Removed.
3450         * WebKit.xcodeproj/project.pbxproj:
3451         Adopt the new names.
3452
3453 2019-03-27  Carlos Garcia Campos  <cgarcia@igalia.com>
3454
3455         Geolocation request not complete when watch request was started in a different web process
3456         https://bugs.webkit.org/show_bug.cgi?id=195996
3457
3458         Reviewed by Alex Christensen.
3459
3460         In WebGeolocationManagerProxy::startUpdating() we do nothing when the provider is already updating. We should
3461         reply with a DidChangePosition using the last known position, if available. If we are updating, but we still
3462         don't have a known position, the request will be completed when
3463         WebGeolocationManagerProxy::providerDidChangePosition() is called since it always notifies all web
3464         processes.
3465
3466         * UIProcess/WebGeolocationManagerProxy.cpp:
3467         (WebKit::WebGeolocationManagerProxy::providerDidChangePosition): Cache the position.
3468         (WebKit::WebGeolocationManagerProxy::startUpdating): Reply using cached position if already known.
3469         * UIProcess/WebGeolocationManagerProxy.h:
3470         (WebKit::WebGeolocationManagerProxy::lastPosition const): Return cached position.
3471         * WebProcess/WebCoreSupport/WebGeolocationClient.cpp:
3472         (WebKit::WebGeolocationClient::lastPosition): Remove the FIXME since we don't want this feature.
3473
3474 2019-03-26  Brent Fulgham  <bfulgham@apple.com>
3475
3476         [macOS] Correct kerberos-related sandbox violations
3477         https://bugs.webkit.org/show_bug.cgi?id=196279
3478         <rdar://problem/48622502>
3479
3480         Reviewed by Per Arne Vollan.
3481
3482         We need to allow communications with a Kerberos-related service on macOS
3483         until <rdar://problem/35542803> is fixed.
3484
3485         * NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in:
3486
3487 2019-03-26  Chris Dumez  <cdumez@apple.com>
3488
3489         [macOS] The network process is not exiting reliably when the WebProcessPool is destroyed
3490         https://bugs.webkit.org/show_bug.cgi?id=196277
3491         <rdar://problem/49127581>
3492
3493         Reviewed by Alex Christensen.
3494
3495         When, an AuxiliaryProcess receives the AuxiliaryProcess::Terminate IPC, it calls stopRunLoop()
3496         to exit. WebProcess overrides AuxiliaryProcess::stopRunLoop() to call exit(0) on the main
3497         thread. Other auxiliary processes such as the NetworkProcess would end up calling
3498         platformStopRunLoop(). On iOS and iOSMac, platformStopRunLoop() calls XPCServiceExit(), which
3499         makes sense since auxiliary processes run their run loop by calling xpc_main(). However, on
3500         macOS, platformStopRunLoop() was calling RunLoop::main().stop() to exit instead, which was
3501         unreliable as demonstrated by the test app attached to the radar.
3502
3503         Updating platformStopRunLoop() to call XPCServiceExit() on macOS fixes the problem and I now
3504         see the NetworkProcess exiting reliably there. This is the approach I have chosen in this
3505         patch since it appears to be reliable and it makes the code consistent on all Cocoa platforms.
3506
3507         * Shared/AuxiliaryProcess.cpp:
3508         * Shared/Cocoa/AuxiliaryProcessCocoa.mm:
3509         (WebKit::AuxiliaryProcess::platformStopRunLoop):
3510         * Shared/ios/AuxiliaryProcessIOS.mm:
3511         (WebKit::AuxiliaryProcess::platformStopRunLoop): Deleted.
3512         * Shared/mac/AuxiliaryProcessMac.mm:
3513         (WebKit::AuxiliaryProcess::platformStopRunLoop): Deleted.
3514
3515 2019-03-26  Keith Rollin  <krollin@apple.com>
3516
3517         Inhibit CFNetwork logging in private sessions
3518         https://bugs.webkit.org/show_bug.cgi?id=196268
3519         <rdar://problem/48210793>
3520
3521         Reviewed by Alex Christensen.
3522
3523         Before performing any logging, the NetworkProcess checks to see if
3524         it's performing an operation associated with a private (ephemeral)
3525         browsing session. If so, it skips the logging. However, networking
3526         layers below the NetworkProcess don't know about private browsing, so
3527         they would still perform their own logging. CFNetwork now has a flag
3528         that lets us control that, so set it to False if private browsing.
3529
3530         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
3531         (WebKit::configurationForSessionID):
3532
3533 2019-03-26  Chris Dumez  <cdumez@apple.com>
3534
3535         Add basic layout test coverage for File Picker on iOS
3536         https://bugs.webkit.org/show_bug.cgi?id=196265
3537
3538         Reviewed by Wenson Hsieh.
3539
3540         Add layout test infrastructure to test the file picker on iOS.
3541
3542         * UIProcess/API/Cocoa/WKWebView.mm:
3543         (-[WKWebView _dismissFilePicker]):
3544         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
3545         * UIProcess/ios/WKContentViewInteraction.h:
3546         * UIProcess/ios/WKContentViewInteraction.mm:
3547         (-[WKContentView dismissFilePicker]):
3548         (-[WKContentView _contentsOfUserInterfaceItem:]):
3549         * UIProcess/ios/forms/WKFileUploadPanel.h:
3550         * UIProcess/ios/forms/WKFileUploadPanel.mm:
3551         (-[WKFileUploadPanel currentAvailableActionTitles]):
3552
3553 2019-03-26  Daniel Bates  <dabates@apple.com>
3554
3555         [iOS][WK2] Use a better concept to describe the reason we defer zooming a focused element: selectabiltiy
3556         https://bugs.webkit.org/show_bug.cgi?id=196264
3557
3558         Reviewed by Wenson Hsieh.
3559
3560         Rename shouldDeferZoomingToSelectionWhenRevealingFocusedElement() to mayContainSelectableText() to describe
3561         the criterion that we will use to decide whether to defer zooming or not. We defer zooming only for elements
3562         that may support text selection on initial focus because we do not have an up-to-date selection rect at that
3563         time. For element, like <select>, that do not support text selection, we can zoom them immediately when focused.
3564
3565         * UIProcess/ios/WKContentViewInteraction.mm:
3566         (mayContainSelectableText): Renamed from shouldDeferZoomingToSelectionWhenRevealingFocusedElement.
3567         List all the input types in the switch block and remove the default case to force the compiler to check that we
3568         covered all cases. This will prevent unforseen keyboard issues (why isn't the keyboard shown? or why is the keyboard shown?)
3569         for future input types that we may add.
3570         (rectToRevealWhenZoomingToFocusedElement): Update for renaming.
3571         (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]): Add a
3572         comment to explain why we may need to defer the zoom: the focused element supports text selection and we need
3573         to wait for the web process to call back to provide an up-to-date selection rect for us to zoom and reveal.
3574         (-[WKContentView _didReceiveEditorStateUpdateAfterFocus]): Update for renaming.
3575         (shouldDeferZoomingToSelectionWhenRevealingFocusedElement): Deleted.
3576
3577 2019-03-26  Wenson Hsieh  <wenson_hsieh@apple.com>
3578
3579         Implement async paste method on UIWKInteractionViewProtocol
3580         https://bugs.webkit.org/show_bug.cgi?id=196267
3581         <rdar://problem/49236346>
3582
3583         Reviewed by Tim Horton.
3584
3585         Implement a new UIWKInteractionViewProtocol hook to perform a paste command, and invoke the given completion
3586         handler when pasting is finished.
3587
3588         Test: UIPasteboardTests.PasteWithCompletionHandler
3589
3590         * UIProcess/ios/WKContentViewInteraction.mm:
3591         (-[WKContentView pasteWithCompletionHandler:]):
3592
3593 2019-03-26  Per Arne Vollan  <pvollan@apple.com>
3594
3595         [macOS] Fix sandbox violations
3596         https://bugs.webkit.org/show_bug.cgi?id=196262
3597         <rdar://problem/47738015>
3598
3599         Reviewed by Brent Fulgham.
3600
3601         Fix various observed sandbox violations.
3602
3603         * NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in:
3604         * WebProcess/com.apple.WebProcess.sb.in:
3605
3606 2019-03-26  Tomoki Imai  <Tomoki.Imai@sony.com>
3607
3608         Assertion failure !isInAcceleratedCompositingMode() in DrawingAreaProxyCoordinatedGraphics::incorporateUpdate when forceCompositingMode is turned on
3609         https://bugs.webkit.org/show_bug.cgi?id=195879
3610
3611         Reviewed by Carlos Garcia Campos.
3612
3613         The root cause is that DrawingAreaProxyCoordinatedGraphics::isInAcceleratedCompositingMode checks both of alwaysUseCompositing() and !m_layerTreeContext.isEmpty().
3614         alwaysUseCompositing() refers preferences, which is written by the application (UIProcess).
3615         On the other hand, m_layerTreeContext is changed when it receives enterAcceleratedCompositingMode/exitAcceleratedCompositingMode from WebProcess.
3616
3617         It results when we set forceCompositingMode and acceleratedCompositingEnabled to true, WebProcess and UIProcess is out of sync until WebProcess sends enterAcceleratedCompositingMode message.
3618         In such situation, WebProcess sends incorporateUpdate to UIProcess because WebProcess is in non-AC mode, but isInAcceleratedCompositingMode becomes true in UIProcess side.
3619
3620         * UIProcess/CoordinatedGraphics/DrawingAreaProxyCoordinatedGraphics.cpp:
3621         (WebKit::DrawingAreaProxyCoordinatedGraphics::~DrawingAreaProxyCoordinatedGraphics): Should call exitAcceleratedCompositingMode even when alwaysUseCompositing is true.
3622         (WebKit::DrawingAreaProxyCoordinatedGraphics::enterAcceleratedCompositingMode): enterAcceleratedCompositingMode should check enterAcceleratedCompositingMode is not called twice.
3623         * UIProcess/CoordinatedGraphics/DrawingAreaProxyCoordinatedGraphics.h: Remove alwaysUseCompositing from isInAcceleratedCompositingMode
3624
3625 2019-03-26  Antoine Quint  <graouts@apple.com>
3626
3627         Remove mousemoveEventHandlingPreventsDefault internal setting and quirk
3628         https://bugs.webkit.org/show_bug.cgi?id=196254
3629         <rdar://problem/49124334>
3630
3631         Reviewed by Dean Jackson.
3632
3633         * Shared/WebPreferences.yaml:
3634
3635 2019-03-26  Philippe Normand  <pnormand@igalia.com>
3636
3637         [WPE][Qt] Uninitialized racy ViewBackend
3638         https://bugs.webkit.org/show_bug.cgi?id=196247
3639
3640         Reviewed by Carlos Garcia Campos.
3641
3642         * UIProcess/API/wpe/qt/WPEQtView.h: Initialize the backend pointer to nullptr.
3643
3644 2019-03-26  Carlos Garcia Campos  <cgarcia@igalia.com>
3645
3646         Unreviewed. Fix typo in GLib geolocation API after r243285.
3647
3648         gelocation -> geolocation.
3649
3650         * UIProcess/API/glib/WebKitGeolocationManager.cpp:
3651         (webkit_geolocation_manager_class_init):
3652         (webkit_geolocation_manager_update_position):
3653         (webkit_geolocation_manager_failed):
3654         (webkit_gelocation_manager_update_position): Deleted.
3655         (webkit_gelocation_manager_failed): Deleted.
3656         * UIProcess/API/gtk/WebKitGeolocationManager.h:
3657         * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt:
3658         * UIProcess/API/wpe/WebKitGeolocationManager.h:
3659         * UIProcess/API/wpe/docs/wpe-1.0-sections.txt:
3660
3661 2019-03-26  Patrick Griffis  <pgriffis@igalia.com>
3662
3663         [GTK][WPE] Disable process warming
3664         https://bugs.webkit.org/show_bug.cgi?id=196208
3665
3666         Reviewed by Chris Dumez.
3667
3668         Fixes crash caused by r243384.
3669
3670         Process warming is incompatible with our launcher as it expects a valid
3671         WebsiteDataStore at initialization time for sandbox permissions.
3672
3673         * UIProcess/glib/WebProcessPoolGLib.cpp:
3674         (WebKit::WebProcessPool::platformInitialize):
3675
3676 2019-03-25  Alex Christensen  <achristensen@webkit.org>
3677
3678         Do not terminate the NetworkProcess if a third party application sends a NSCredential with a SecIdentityRef
3679         https://bugs.webkit.org/show_bug.cgi?id=196213
3680
3681         Reviewed by Geoff Garen.
3682
3683         A release assertion added in r230225 was reachable.  I reached it in a unit test that responds to a challenge
3684         with a SecIdentityRef wrapped in an NSCredential.
3685
3686         * Shared/cf/ArgumentCodersCF.cpp:
3687         (IPC::decode):
3688
3689 2019-03-25  Chris Dumez  <cdumez@apple.com>
3690
3691         Regression(r242369) Trying to change profile picture on linked in shows file picker, not the image picker
3692         https://bugs.webkit.org/show_bug.cgi?id=196205
3693         <rdar://problem/49083324>
3694
3695         Reviewed by Geoffrey Garen.
3696
3697         Update our FileUploadPanel code on iOS to properly deal with the MIME types containing
3698         wild cards (e.g. "image/*") that are defined in the HTML specification:
3699         - https://html.spec.whatwg.org/multipage/input.html#attr-input-accept
3700
3701         Previously, we would fail to convert those to UTIs.
3702
3703         * UIProcess/ios/forms/WKFileUploadPanel.mm:
3704
3705 2019-03-25  Tim Horton  <timothy_horton@apple.com>
3706
3707         Remove some now-unnecessary dynamic class lookup
3708         https://bugs.webkit.org/show_bug.cgi?id=196237
3709
3710         Reviewed by Simon Fraser.
3711
3712         * Shared/DocumentEditingContext.mm:
3713         (WebKit::DocumentEditingContext::toPlatformContext):
3714
3715 2019-03-25  Tim Horton  <timothy_horton@apple.com>
3716
3717         Get rid of ENABLE(ANIMATED_KEYBOARD_SCROLLING)
3718         https://bugs.webkit.org/show_bug.cgi?id=196224
3719
3720         Reviewed by Simon Fraser.
3721
3722         * Platform/spi/ios/AccessibilitySupportSPI.h:
3723         * UIProcess/ios/WKKeyboardScrollingAnimator.mm:
3724         (-[WKKeyboardScrollingAnimator invalidate]):
3725         (perpendicularAbsoluteUnitVector):
3726         (-[WKKeyboardScrollingAnimator beginWithEvent:]):
3727         (-[WKKeyboardScrollingAnimator stopAnimatedScroll]):
3728         (-[WKKeyboardScrollingAnimator willStartInteractiveScroll]):
3729         (-[WKKeyboardScrollViewAnimator scrollToContentOffset:animated:]):
3730         (-[WKKeyboardScrollViewAnimator scrollWithScrollToExtentAnimationTo:]):
3731         (-[WKKeyboardScrollingAnimator startRepeatTimerIfNeeded]): Deleted.
3732         (-[WKKeyboardScrollingAnimator stopRepeatTimer]): Deleted.
3733         (-[WKKeyboardScrollingAnimator performDiscreteScroll]): Deleted.
3734
3735 2019-03-25  Fujii Hironori  <Hironori.Fujii@sony.com>
3736
3737         Enable IPC sending and receiving non-default-constructible types
3738         https://bugs.webkit.org/show_bug.cgi?id=196132
3739         <rdar://problem/49229221>
3740
3741         Unreviewed build fix for WinCairo port.
3742
3743         error C2440: '=': cannot convert from 'int' to 'HANDLE'
3744
3745         * Platform/win/SharedMemoryWin.cpp:
3746         (WebKit::SharedMemory::Handle::Handle): std::exchange HANDLE with nullptr, not 0.
3747         (WebKit::SharedMemory::Handle::operator=): Ditto.
3748
3749 2019-03-25  Fujii Hironori  <Hironori.Fujii@sony.com>
3750
3751         [Coordinated Graphics][WinCairo] ASSERTION FAILED: state.id == m_nicosia.state.id
3752         https://bugs.webkit.org/show_bug.cgi?id=196190
3753
3754         Reviewed by Žan Doberšek.
3755
3756         This assertion assumes the pre-committed and the committed scenes
3757         are identical. But, the pre-committed scene is updated in the main
3758         thread. Removed the false assertion.
3759
3760         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
3761         (WebKit::CoordinatedGraphicsScene::purgeGLResources): Remove the
3762         assertion. Removed layers of committed scene, not pre-committed
3763         scene.
3764
3765 2019-03-25  Brady Eidson  <beidson@apple.com>
3766
3767         Add socket-delegate to another entitlements config
3768         rdar://problem/48090350 and https://bugs.webkit.org/show_bug.cgi?id=196227
3769
3770         Reviewed by Geoffrey Garen.
3771
3772         * Configurations/Network-iOSMac.entitlements:
3773
3774 2019-03-25  Commit Queue  <commit-queue@webkit.org>
3775
3776         Unreviewed, rolling out r243465.
3777         https://bugs.webkit.org/show_bug.cgi?id=196226
3778
3779         the test doesn't build (Requested by thorton on #webkit).
3780
3781         Reverted changeset:
3782
3783         "Do not terminate the NetworkProcess if a third party
3784         application sends a NSCredential with a SecIdentityRef"
3785         https://bugs.webkit.org/show_bug.cgi?id=196213
3786         https://trac.webkit.org/changeset/243465
3787
3788 2019-03-25  Simon Fraser  <simon.fraser@apple.com>
3789
3790         REGRESSION (r242687): Flicker when pinch-zooming pages in macOS Safari
3791         https://bugs.webkit.org/show_bug.cgi?id=196126
3792         rdar://problem/49095791
3793
3794         Reviewed by Tim Horton.
3795         
3796         I fumbled the commit after the enum rename. Make this actually work.
3797
3798         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
3799         (WebKit::TiledCoreAnimationDrawingArea::flushLayers):
3800
3801 2019-03-25  Simon Fraser  <simon.fraser@apple.com>
3802
3803         Zoom on macOS is centered around a point lower than the cursor
3804         https://bugs.webkit.org/show_bug.cgi?id=196225
3805         rdar://problem/49213574
3806
3807         Reviewed by Tim Horton.
3808         
3809         The origin handed to ViewGestureController::handleMagnificationGestureEvent is in WKWebView
3810         coordinates, but we end up setting the transform on the RenderView's layer, so we need
3811         to subtract the topContentInset.
3812
3813         * UIProcess/mac/ViewGestureControllerMac.mm:
3814         (WebKit::ViewGestureController::handleMagnificationGestureEvent):
3815
3816 2019-03-25  Alex Christensen  <achristensen@webkit.org>
3817
3818         Do not terminate the NetworkProcess if a third party application sends a NSCredential with a SecIdentityRef
3819         https://bugs.webkit.org/show_bug.cgi?id=196213
3820
3821         Reviewed by Geoff Garen.
3822
3823         A release assertion added in r230225 was reachable.  I reached it in a unit test that responds to a challenge
3824         with a SecIdentityRef wrapped in an NSCredential.
3825
3826         * Shared/cf/ArgumentCodersCF.cpp:
3827         (IPC::decode):
3828
3829 2019-03-25  Chris Dumez  <cdumez@apple.com>
3830
3831         Get rid of WebPage::m_shouldResetDrawingAreaAfterSuspend flag
3832         https://bugs.webkit.org/show_bug.cgi?id=196210
3833         <rdar://problem/48681326>
3834
3835         Reviewed by Geoffrey Garen.
3836
3837         Get rid of WebPage::m_shouldResetDrawingAreaAfterSuspend flag and use the drawing area identifier
3838         instead to reset the DrawingArea in the WebProcess whenever the UIProcess did.
3839
3840         This is less error-prone and guarantees that the WebProcess and the UIProcess can reliably
3841         communicate via DrawingArea IPC.
3842
3843         * WebProcess/WebPage/WebPage.cpp:
3844         (WebKit::WebPage::reinitializeWebPage):
3845         (WebKit::WebPage::setIsSuspended):
3846         * WebProcess/WebPage/WebPage.h:
3847
3848 2019-03-25  Alex Christensen  <achristensen@webkit.org>
3849
3850         Enable IPC sending and receiving non-default-constructible types
3851         https://bugs.webkit.org/show_bug.cgi?id=196132
3852
3853         Reviewed by Geoff Garen.
3854
3855         * Platform/IPC/ArgumentCoder.h:
3856         * Platform/IPC/ArgumentCoders.h:
3857         (IPC::TupleEncoder::encode):
3858         (IPC::tupleFromTupleAndObject):
3859         (IPC::TupleDecoderImpl::decode):
3860         (IPC::TupleDecoderImpl<Type>::decode):
3861         (IPC::TupleDecoder::decode):
3862         (IPC::TupleDecoder<0>::decode):
3863         (IPC::TupleCoder::encode): Deleted.
3864         (IPC::TupleCoder::decode): Deleted.
3865         * Platform/IPC/Connection.h:
3866         (IPC::Connection::sendWithReply):
3867         (IPC::TupleMover::move):
3868         (IPC::moveTuple):
3869         (IPC::Connection::sendSync):
3870         * Platform/IPC/Decoder.h:
3871         (IPC::Decoder::decode):
3872         (IPC::Decoder::operator>>):
3873         * Platform/IPC/HandleMessage.h:
3874         (IPC::handleMessage):
3875         (IPC::handleMessageSynchronous):
3876         (IPC::handleMessageSynchronousWantsConnection):
3877         (IPC::handleMessageAsync):
3878         * Platform/SharedMemory.h:
3879         * Scripts/webkit/LegacyMessages-expected.h:
3880         * Scripts/webkit/Messages-expected.h:
3881         * Scripts/webkit/MessagesSuperclass-expected.h:
3882         * Scripts/webkit/messages.py:
3883         * Shared/Databases/IndexedDB/WebIDBResult.h:
3884         * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.h:
3885         * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm:
3886         * Shared/ShareableBitmap.h:
3887         * Shared/ShareableResource.h:
3888         * Shared/UpdateInfo.h:
3889         * Shared/WebEvent.h:
3890         * Shared/WebProcessCreationParameters.cpp:
3891         * Shared/WebProcessCreationParameters.h:
3892         * Shared/mac/SecItemResponseData.cpp:
3893         (WebKit::SecItemResponseData::SecItemResponseData):
3894         (WebKit::SecItemResponseData::decode):
3895         * Shared/mac/SecItemResponseData.h:
3896         * WebProcess/MediaStream/MediaDeviceSandboxExtensions.h:
3897
3898 2019-03-25  Tim Horton  <timothy_horton@apple.com>
3899
3900         Animated keyboard scrolling is extremely chaotic
3901         https://bugs.webkit.org/show_bug.cgi?id=196164
3902         <rdar://problem/48702444>
3903
3904         Reviewed by Simon Fraser.
3905
3906         * UIProcess/ios/WKContentViewInteraction.mm:
3907         (-[WKContentView _interpretKeyEvent:isCharEvent:]):
3908         Consume keyboard events instead of interpreting them traditionally
3909         if WKKeyboardScrollingAnimator is animating.
3910
3911         * UIProcess/ios/WKKeyboardScrollingAnimator.h:
3912         * UIProcess/ios/WKKeyboardScrollingAnimator.mm:
3913         (-[WKKeyboardScrollingAnimator beginWithEvent:]):
3914         (-[WKKeyboardScrollingAnimator handleKeyEvent:]):
3915         (-[WKKeyboardScrollingAnimator stopAnimatedScroll]):
3916         (-[WKKeyboardScrollingAnimator scrollTriggeringKeyIsPressed]):
3917         (-[WKKeyboardScrollingAnimator displayLinkFired:]):
3918         (-[WKKeyboardScrollViewAnimator scrollTriggeringKeyIsPressed]):
3919         Expose the current state of interactive scrolling, and rename the related member.
3920
3921 2019-03-25  Keith Rollin  <krollin@apple.com>
3922
3923         Add WebKit logging for first paint and other interesting layout milestones
3924         https://bugs.webkit.org/show_bug.cgi?id=196159
3925         <rdar://problem/49128952>
3926
3927         Reviewed by Simon Fraser.
3928
3929         Add some logging to indicate what layout milestones have been reached.
3930         This should help us determine if there's a client, rendering, layout,
3931         or some other issue when page content does not appear in the client
3932         window.
3933
3934         The logging is being added to
3935         WebFrameLoaderClient::dispatchDidReachLayoutMilestone. This seems like
3936         a nice central place to capture layout milestones. However, it will
3937         only log notifications that are being sent to clients. It does not
3938         indicate all milestones that have occurred. That is, it does not
3939         report milestones that are filtered out due to client disinterest.
3940         There doesn't seem to be a good central place to capture all
3941         milestones, regardless of client interest.
3942
3943         * Platform/Logging.h:
3944         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
3945         (WebKit::WebFrameLoaderClient::dispatchDidReachLayoutMilestone):
3946
3947 2019-03-25  Patrick Griffis  <pgriffis@igalia.com>
3948
3949         [GTK][WPE] Remove network access from web process sandbox
3950         https://bugs.webkit.org/show_bug.cgi?id=189967
3951
3952         Reviewed by Michael Catanzaro.
3953
3954         * UIProcess/Launcher/glib/BubblewrapLauncher.cpp:
3955         (WebKit::createFlatpakInfo):
3956         (WebKit::bubblewrapSpawn):
3957         * UIProcess/Launcher/glib/FlatpakLauncher.cpp:
3958         (WebKit::flatpakSpawn):
3959
3960 2019-03-25  Andy Estes  <aestes@apple.com>
3961
3962         [Apple Pay] Call +canMakePayments on a work queue
3963         https://bugs.webkit.org/show_bug.cgi?id=196179
3964         <rdar://problem/45388749>
3965
3966         Reviewed by Brady Eidson.
3967
3968         Calling +canMakePayments on either PKPaymentAuthorizationController or
3969         PKPaymentAuthorizationViewController results in synchronous IPC and is therefore very
3970         expensive to call on the main thread. On iOS, these calls are made in the network process,
3971         and on Mac in the UI process.
3972
3973         Call these methods on a work queue to avoid main thread spins.
3974
3975         * Shared/ApplePay/WebPaymentCoordinatorProxy.cpp:
3976         (WebKit::WebPaymentCoordinatorProxy::canMakePayments):
3977         * Shared/ApplePay/WebPaymentCoordinatorProxy.h:
3978         * Shared/ApplePay/ios/WebPaymentCoordinatorProxyIOS.mm:
3979         (WebKit::WebPaymentCoordinatorProxy::platformCanMakePayments):
3980         * Shared/ApplePay/mac/WebPaymentCoordinatorProxyMac.mm:
3981         (WebKit::WebPaymentCoordinatorProxy::platformCanMakePayments):
3982
3983 2019-03-25  Andy Estes  <aestes@apple.com>
3984
3985         [Apple Pay] Remove the AvailablePaymentNetworks synchronous message
3986         https://bugs.webkit.org/show_bug.cgi?id=196180
3987
3988         Reviewed by Youenn Fablet.
3989
3990         Unlike many PassKit interactions, it's ok to call +[PKPaymentRequest availableNetworks]
3991         without an entitlement. Therefore, we can call it from the web process directly rather than
3992         synchronously messaging the entitled UI or networking process.
3993
3994         * Shared/ApplePay/WebPaymentCoordinatorProxy.cpp: