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