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