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