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