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