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