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