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