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