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