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