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