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