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