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