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