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