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