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