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