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