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