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