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