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