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