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