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