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