REGRESSION (r244182): RemoteLayerTreeDrawingArea::flushLayers() should not be reentrant
[WebKit-https.git] / Source / WebKit / ChangeLog
1 2019-04-11  Said Abou-Hallawa  <sabouhallawa@apple.com>
2
3         REGRESSION (r244182): RemoteLayerTreeDrawingArea::flushLayers() should not be reentrant
4         https://bugs.webkit.org/show_bug.cgi?id=196825
5
6         Reviewed by Simon Fraser.
7
8         Ensure the layer transactions IDs are sequential. So bail out of
9         RemoteLayerTreeDrawingArea::flushLayers() if reentrancy is detected.
10
11         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.h:
12         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
13         (WebKit::RemoteLayerTreeDrawingArea::flushLayers):
14
15 2019-04-11  Wenson Hsieh  <wenson_hsieh@apple.com>
16
17         Allow the MediaSource API to be enabled via website policy
18         https://bugs.webkit.org/show_bug.cgi?id=196429
19         <rdar://problem/48774333>
20
21         Reviewed by Tim Horton.
22
23         Adds support for using WebsitePolicies to determine whether to enable the MediaSource API.
24
25         * Shared/WebPreferences.yaml:
26
27         Disengage the mediaSourceEnabled internal preference from the corresponding WebCore setting; to ensure that
28         setting the preference to `true` still results in enabling the MediaSource API, we instead make it such that
29         turning on mediaSourceEnabled causes WebsitePolicies to set its WebsiteMediaSourcePolicy to Enable.
30
31         In the future, we should deprecate and remove this preference, in favor of simply setting preferred
32         compatibility mode on WKWebpagePreferences.
33
34         * Shared/WebPreferences.yaml:
35         * Shared/WebsiteMediaSourcePolicy.h: Copied from Source/WebKit/Shared/WebsitePoliciesData.h.
36         * Shared/WebsitePoliciesData.cpp:
37         (WebKit::WebsitePoliciesData::encode const):
38         (WebKit::WebsitePoliciesData::decode):
39
40         Add plumbing for m_mediaSourcePolicy in the set of website policies.
41
42         (WebKit::WebsitePoliciesData::applyToDocumentLoader):
43
44         Update the document loader with the given media source policy. There are two possibilities when applying the set
45         of policies to the document loader; either the document loader is already attached to a Frame, or the document
46         loader is yet to be attached to a Frame.
47
48         In the first case, we update Frame's settings on the spot, by calling the new applyPoliciesToSettings helper
49         method. In the second scenario, we stash the policy state on DocumentLoader; when the DocumentLoader is attached
50         to a Frame, we'll then update the Frame's settings using DocumentLoader's policy.
51
52         * Shared/WebsitePoliciesData.h:
53         * UIProcess/API/APIWebsitePolicies.cpp:
54         (API::WebsitePolicies::data):
55         * UIProcess/API/APIWebsitePolicies.h:
56         * UIProcess/API/C/WKPage.cpp:
57         (WKPageSetPageNavigationClient):
58         * UIProcess/Cocoa/NavigationState.mm:
59         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
60
61         Move code that adjusts website policies after deciding policies for the navigation action from NavigationClient
62         ::decidePolicyForNavigationAction to the completion handler of the policy listener. This allows us to respect
63         default website policies on the web view configuration, even when using the C API to set the navigation client,
64         and also allows us to have a single call site for adjustPoliciesForCompatibilityMode. This also enables our
65         layout tests to opt into modern compatibility mode by default, when specifying modern compatibility mode on
66         webpage preferences.
67
68         * UIProcess/WebPageProxy.cpp:
69         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
70         (WebKit::WebPageProxy::adjustPoliciesForCompatibilityMode):
71         * UIProcess/WebPageProxy.h:
72         * WebKit.xcodeproj/project.pbxproj:
73
74 2019-04-11  Antti Koivisto  <antti@apple.com>
75
76         REGRESSION: changing iPad orientation on blogger.com crashes under RemoteScrollingCoordinatorProxy::establishLayerTreeScrollingRelations()
77         https://bugs.webkit.org/show_bug.cgi?id=196813
78         <rdar://problem/49393264>
79
80         Reviewed by Simon Fraser.
81
82         No test, can't repro.
83
84         * UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm:
85         (WebKit::RemoteScrollingCoordinatorProxy::establishLayerTreeScrollingRelations):
86
87         Null check the nodes.
88
89 2019-04-10  Chris Dumez  <cdumez@apple.com>
90
91         Regression(r244144) ProcessSwap.ReuseSuspendedProcessLoadHTMLString API test is flaky
92         https://bugs.webkit.org/show_bug.cgi?id=196784
93
94         Reviewed by Antti Koivisto.
95
96         When we enter accelerated compositing mode in the new process, we supposed to *close* the last
97         SuspendedPageProxy, not destroy it. This was causing flakiness in the test because it was testing
98         that we were using the SuspendedPageProxy's process for a cross-site link navigation, which is
99         an optimization. This optimization was partly broken by r244144 as the SuspendedPageProxy would
100         not sometimes be gone by the time we need it.
101
102         * UIProcess/SuspendedPageProxy.cpp:
103         (WebKit::SuspendedPageProxy::pageEnteredAcceleratedCompositingMode):
104
105 2019-04-10  Alex Christensen  <achristensen@webkit.org>
106
107         WKNavigationResponse._downloadAttribute should be nil when no download attribute is present
108         https://bugs.webkit.org/show_bug.cgi?id=196809
109         <rdar://49800762>
110
111         Reviewed by Brady Eidson.
112
113         * UIProcess/API/Cocoa/WKNavigationResponse.mm:
114         (-[WKNavigationResponse _downloadAttribute]):
115
116 2019-04-10  Tim Horton  <timothy_horton@apple.com>
117
118         REGRESSION (r241734): ⌥⌘↑ and ⌥⌘↓ no longer navigate to previous/next Reading List article
119         https://bugs.webkit.org/show_bug.cgi?id=196797
120         <rdar://problem/48484715>
121
122         Reviewed by Simon Fraser.
123
124         * UIProcess/ios/WKKeyboardScrollingAnimator.mm:
125         (-[WKKeyboardScrollingAnimator keyboardScrollForEvent:]):
126         Validate the set of modifier keys pressed when handling a key event for scrolling:
127         Ignore key events with multiple modifier keys pressed.
128         Ignore key events with an invalid modifier key pressed for a given primary key.
129
130 2019-04-10  Said Abou-Hallawa  <sabouhallawa@apple.com>
131
132         requestAnimationFrame should execute before the next frame
133         https://bugs.webkit.org/show_bug.cgi?id=177484
134
135         Reviewed by Simon Fraser.
136
137         Replace the calls to Page::layoutIfNeeded() and willDisplayPage() by
138         a single call to Page::updateRendering(). This new function implements 
139         "Update the rendering" step of the HTML Event Loop specification
140         <https://html.spec.whatwg.org/multipage/webappapis.html#update-the-rendering>.
141
142         * WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp:
143         (WebKit::DrawingAreaCoordinatedGraphics::scheduleCompositingLayerFlush):
144         (WebKit::DrawingAreaCoordinatedGraphics::updateBackingStoreState):
145         (WebKit::DrawingAreaCoordinatedGraphics::display):
146         * WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.cpp:
147         (WebKit::LayerTreeHost::layerFlushTimerFired):
148
149         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
150         (WebKit::RemoteLayerTreeDrawingArea::flushLayers):
151         -- Call Page::updateRendering() to make sure that "Update the rendering"
152            happens immediately before updating the page.
153
154         -- Move the call to RemoteLayerBackingStoreCollection::willFlushLayers()
155            to be exactly before flushing the layers. This fixes the assertion
156            ASSERT(m_inLayerFlush) which was firing when running a layout test.
157            RemoteLayerTreeDrawingArea::flushLayers() now can call itself through
158            TestRunner::notifyDone(). flushLayers() was calling willFlushLayers()
159            twice before calling didFlushLayers().
160
161         * WebProcess/WebPage/WebPage.cpp:
162         (WebKit::WebPage::layoutIfNeeded):
163         (WebKit::WebPage::updateRendering):
164         (WebKit::WebPage::willDisplayPage): Deleted.
165         * WebProcess/WebPage/WebPage.h:
166         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
167         (WebKit::TiledCoreAnimationDrawingArea::flushLayers):
168
169 2019-04-10  Devin Rousso  <drousso@apple.com>
170
171         Web Inspector: save sheet should be anchored underneath the tab bar when detached
172         https://bugs.webkit.org/show_bug.cgi?id=196722
173         <rdar://problem/49613280>
174
175         Reviewed by Timothy Hatcher.
176
177         * WebProcess/WebPage/WebInspectorUI.h:
178         * WebProcess/WebPage/WebInspectorUI.cpp:
179         (WebKit::WebInspectorUI::changeSheetRect): Added.
180         * UIProcess/WebInspectorProxy.messages.in:
181         * UIProcess/WebInspectorProxy.h:
182         (WebKit::WebInspectorProxy::sheetRect const): Added.
183         * UIProcess/WebInspectorProxy.cpp:
184         (WebKit::WebInspectorProxy::setSheetRect): Added.
185         (WebKit::WebInspectorProxy::platformSetSheetRect): Added.
186         * UIProcess/gtk/WebInspectorProxyGtk.cpp:
187         (WebKit::WebInspectorProxy::platformSetSheetRect): Added.
188         * UIProcess/mac/WebInspectorProxyMac.mm:
189         (-[WKWebInspectorProxyObjCAdapter window:willPositionSheet:usingRect:]): Added.
190         (WebKit::WebInspectorProxy::platformSetSheetRect): Added.
191         * UIProcess/win/WebInspectorProxyWin.cpp:
192         (WebKit::WebInspectorProxy::platformSetSheetRect): Added.
193         * UIProcess/wpe/WebInspectorProxyWPE.cpp:
194         (WebKit::WebInspectorProxy::platformSetSheetRect): Added.
195
196         * WebProcess/WebPage/RemoteWebInspectorUI.h:
197         * WebProcess/WebPage/RemoteWebInspectorUI.cpp:
198         (WebKit::RemoteWebInspectorUI::changeSheetRect): Added.
199         * UIProcess/RemoteWebInspectorProxy.messages.in:
200         * UIProcess/RemoteWebInspectorProxy.h:
201         (WebKit::RemoteWebInspectorProxy::sheetRect const): Added.
202         * UIProcess/RemoteWebInspectorProxy.cpp:
203         (WebKit::RemoteWebInspectorProxy::setSheetRect): Added.
204         (WebKit::RemoteWebInspectorProxy::platformSetSheetRect): Added.
205         * UIProcess/gtk/RemoteWebInspectorProxyGtk.cpp:
206         (WebKit::RemoteWebInspectorProxy::platformSetSheetRect): Added.
207         * UIProcess/mac/RemoteWebInspectorProxyMac.mm:
208         (-[WKRemoteWebInspectorProxyObjCAdapter window:willPositionSheet:usingRect:]): Added.
209         (WebKit::RemoteWebInspectorProxy::platformCreateFrontendPageAndWindow):
210         (WebKit::RemoteWebInspectorProxy::platformSetSheetRect): Added.
211
212 2019-04-10  Andy Estes  <aestes@apple.com>
213
214         [iOS] Let PDFHostViewController specify the background color to use for WKPDFView
215         https://bugs.webkit.org/show_bug.cgi?id=196785
216         <rdar://problem/48240051>
217
218         Reviewed by Tim Horton.
219
220         * UIProcess/ios/WKPDFView.mm:
221         (-[WKPDFView web_initWithFrame:webView:mimeType:]):
222
223 2019-04-10  Chris Dumez  <cdumez@apple.com>
224
225         Unreviewed, rolling out r244146.
226
227         Caused a few DeviceOrientation API test failures on iOS
228
229         Reverted changeset:
230
231         "Unable to run system Safari with trunk WebKit"
232         https://bugs.webkit.org/show_bug.cgi?id=196777
233         https://trac.webkit.org/changeset/244146
234
235 2019-04-10  Devin Rousso  <drousso@apple.com>
236
237         Web Inspector: REGRESSION: lazy agents used outside of frontend/instrumentation can be accessed before being created
238         https://bugs.webkit.org/show_bug.cgi?id=196725
239         <rdar://problem/49669810>
240
241         Reviewed by Timothy Hatcher.
242
243         * WebProcess/WebPage/WebInspector.cpp:
244         (WebKit::WebInspector::showMainResourceForFrame):
245
246 2019-04-10  Youenn Fablet  <youenn@apple.com>
247
248         Clear Cache Storage structures before removing all related files
249         https://bugs.webkit.org/show_bug.cgi?id=196650
250
251         Reviewed by Alex Christensen.
252
253         Previously, we were clearing files in parallel to clearing the internal CacheStorage structures.
254         To make things more deterministic, clear files/folders directly
255         after CachesStorage structures have finished being cleared.
256
257         * NetworkProcess/cache/CacheStorageEngine.cpp:
258         (WebKit::CacheStorage::Engine::clearAllCaches):
259         (WebKit::CacheStorage::Engine::clearCachesForOrigin):
260
261 2019-04-10  Alex Christensen  <achristensen@webkit.org>
262
263         Add SPI WKNavigationResponse._downloadAttribute
264         https://bugs.webkit.org/show_bug.cgi?id=196755
265         <rdar://49587365>
266
267         Reviewed by Brady Eidson.
268
269         * UIProcess/API/APINavigationResponse.h:
270         * UIProcess/API/Cocoa/WKNavigationResponse.mm:
271         (-[WKNavigationResponse _downloadAttribute]):
272         * UIProcess/API/Cocoa/WKNavigationResponsePrivate.h:
273         * UIProcess/ProvisionalPageProxy.cpp:
274         (WebKit::ProvisionalPageProxy::decidePolicyForResponse):
275         * UIProcess/ProvisionalPageProxy.h:
276         * UIProcess/WebPageProxy.cpp:
277         (WebKit::WebPageProxy::decidePolicyForResponse):
278         (WebKit::WebPageProxy::decidePolicyForResponseShared):
279         * UIProcess/WebPageProxy.h:
280         * UIProcess/WebPageProxy.messages.in:
281         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
282         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForResponse):
283         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
284
285 2019-04-10  Youenn Fablet  <youenn@apple.com>
286
287         SWClientConnection should not double hop to fire some events
288         https://bugs.webkit.org/show_bug.cgi?id=196735
289
290         Reviewed by Alex Christensen.
291
292         Removed unnecessary method.
293
294         * WebProcess/Storage/WebSWClientConnection.cpp:
295         * WebProcess/Storage/WebSWClientConnection.h:
296
297 2019-04-10  Per Arne Vollan  <pvollan@apple.com>
298
299         [iOS] Fix iokit-get-properties sandbox violations
300         https://bugs.webkit.org/show_bug.cgi?id=196782
301         <rdar://problem/49497720>
302
303         Reviewed by Brent Fulgham.
304
305         Add iokit properties to the WebContent sandbox on iOS.
306
307         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
308
309 2019-04-10  Tim Horton  <timothy_horton@apple.com>
310
311         Add modern API for overriding the page's specified viewport configuration
312         https://bugs.webkit.org/show_bug.cgi?id=167734
313         <rdar://problem/30331795>
314
315         Reviewed by Simon Fraser.
316
317         * Shared/WebPageCreationParameters.cpp:
318         (WebKit::WebPageCreationParameters::encode const):
319         (WebKit::WebPageCreationParameters::decode):
320         * Shared/WebPageCreationParameters.h:
321         Plumb overrideViewportArguments in WebPageCreationParameters, so that
322         if the process crashes (or swaps) they are maintained.
323
324         * UIProcess/API/Cocoa/WKWebView.mm:
325         (viewportArgumentsFromDictionary):
326         (-[WKWebView _overrideViewportWithArguments:]):
327         Add SPI to set override viewport arguments. Parse them into a ViewportArguments
328         object and use the existing (now improved) overrideViewportArguments mechanism
329         to take over the page's viewport arguments.
330
331         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
332         * UIProcess/WebPageProxy.cpp:
333         (WebKit::WebPageProxy::creationParameters):
334         * UIProcess/WebPageProxy.h:
335         * UIProcess/ios/WebPageProxyIOS.mm:
336         (WebKit::WebPageProxy::setOverrideViewportArguments):
337         * WebProcess/WebPage/WebPage.cpp:
338         Plumb overrideViewportArguments around more.
339
340 2019-04-10  Jiewen Tan  <jiewen_tan@apple.com>
341
342         Add runJavaScriptInFrame for WebPageProxy/WebPage
343         https://bugs.webkit.org/show_bug.cgi?id=196750
344         <rdar://problem/49755738>
345
346         Reviewed by Youenn Fablet.
347
348         Tests of the new method will be covered by the internal counterpart.
349
350         * UIProcess/WebFrameProxy.cpp:
351         (WebKit::WebFrameProxy::loadData):
352         * UIProcess/WebFrameProxy.h:
353         Add a comment.
354         * UIProcess/WebPageProxy.cpp:
355         (WebKit::WebPageProxy::runJavaScriptInMainFrame):
356         (WebKit::WebPageProxy::runJavaScriptInMainFrameScriptWorld):
357         Merge the above two runJavaScriptInMainFrame*.
358         (WebKit::WebPageProxy::runJavaScriptInFrame):
359         * UIProcess/WebPageProxy.h:
360         * WebProcess/WebPage/WebPage.cpp:
361         (WebKit::WebPage::loadDataInFrame):
362         Add an assertion.
363         (WebKit::WebPage::runJavaScript):
364         (WebKit::WebPage::runJavaScriptInMainFrameScriptWorld):
365         (WebKit::WebPage::runJavaScriptInFrame):
366         (WebKit::WebPage::runJavaScriptInMainFrame): Deleted.
367         * WebProcess/WebPage/WebPage.h:
368         * WebProcess/WebPage/WebPage.messages.in:
369
370 2019-04-10  Chris Dumez  <cdumez@apple.com>
371
372         Unable to run system Safari with trunk WebKit
373         https://bugs.webkit.org/show_bug.cgi?id=196777
374         <rdar://problem/49784574>
375
376         Reviewed by Alex Christensen.
377
378         * UIProcess/API/Cocoa/WKWebView.mm:
379         (-[WKWebView _initializeWithConfiguration:]):
380         Add a linkedOnAfter check so that throwing exceptions when related web views use a different
381         data store only happens for apps rebuilt using recent SDK.
382
383         * UIProcess/Cocoa/VersionChecks.h:
384         * UIProcess/Cocoa/VersionChecks.mm:
385         (WebKit::linkedOnOrAfter):
386         - By default, linkedOnOrAfter assumed Safari / MobileSafari is always linked-on-after. To satisfy my
387           use cases, I introduced a new AssumeSafariIsAlwaysLinkedOnAfter parameter so that this behavior can
388           be controlled by the caller.
389         - In the header, DYLD_IOS_VERSION_* / DYLD_MACOS_VERSION_* constants are 0 when building with the
390           non-internal SDK. As a result, the check instead linkedOnOrAfter() would cause us to always return
391           true, which was wrong. I therefore updated the check inside linkedOnOrAfter() to special-case the
392           0 value for sdkVersion.
393
394 2019-04-10  Chris Dumez  <cdumez@apple.com>
395
396         Regression(r240562) Audio sometimes keeps playing in previous process after a process-swap
397         https://bugs.webkit.org/show_bug.cgi?id=196774
398         <rdar://problem/49460572>
399
400         Reviewed by Alex Christensen.
401
402         r240562 added logic to prevent flashing on navigation. When we receive the DidFailToSuspendAfterProcessSwap
403         IPC from the previous process, we would delay closing the WebPage in that process until EnterAcceleratedCompositingMode
404         IPC is received from the new process. The issue is that this was racy as we would receive the EnterAcceleratedCompositingMode
405         IPC from the new process *before* receiving the DidFailToSuspendAfterProcessSwap IPC from the previous process, which which
406         case we would fail to close the WebPage and audio could keep playing.
407
408         To address the issue, the WebPageProxy keeps track of its last suspended page and notifies it whenever it receives the
409         EnterAcceleratedCompositingMode IPC. If the suspended page already received the DidFailToSuspendAfterProcessSwap IPC, it
410         will close the page. Otherwise, it will set a boolean data member indicating that we should not delay page closing when
411         the DidFailToSuspendAfterProcessSwap is eventually received.
412
413         * UIProcess/SuspendedPageProxy.cpp:
414         (WebKit::SuspendedPageProxy::SuspendedPageProxy):
415         (WebKit::SuspendedPageProxy::pageEnteredAcceleratedCompositingMode):
416         (WebKit::SuspendedPageProxy::didProcessRequestToSuspend):
417         * UIProcess/SuspendedPageProxy.h:
418         * UIProcess/WebPageProxy.cpp:
419         (WebKit::WebPageProxy::suspendCurrentPageIfPossible):
420         (WebKit::WebPageProxy::enterAcceleratedCompositingMode):
421         * UIProcess/WebPageProxy.h:
422         * UIProcess/WebProcessPool.cpp:
423         * UIProcess/WebProcessPool.h:
424
425 2019-04-10  Timothy Hatcher  <timothy@apple.com>
426
427         WKScrollView background color does not match WKWebView before content is loaded.
428         https://bugs.webkit.org/show_bug.cgi?id=196745
429         rdar://problem/49750810
430
431         Reviewed by Megan Gardner.
432
433         * UIProcess/API/Cocoa/WKWebView.mm:
434         (scrollViewBackgroundColor): Default to _contentView.backgroundColor on invalid base color.
435         (-[WKWebView _processDidExit]): Reset to _contentView.backgroundColor.
436         (-[WKWebView setBackgroundColor:]): Call _updateScrollViewBackground since it can use
437         _contentView.backgroundColor and it has changed.
438
439 2019-04-10  Megan Gardner  <megan_gardner@apple.com>
440
441         Fix text autoscrolling when typing in modern webkit
442         https://bugs.webkit.org/show_bug.cgi?id=196718
443         <rdar://problem/49225507>
444
445         Reviewed by Tim Horton.
446
447         For staging only. We need to turn off UIKit's scrolling behavior to land
448         the changes we are making. To keep from the build ever breaking,
449         I am temporarily circumventing the changes in UIKit. This will be removed
450         once the next UIKit submission happens.
451
452         * UIProcess/ios/WKContentViewInteraction.mm:
453         (-[WKUIWKTextInteractionAssistant scrollSelectionToVisible]):
454         (-[WKContentView setUpTextSelectionAssistant]):
455
456 2019-04-10  Wenson Hsieh  <wenson_hsieh@apple.com>
457
458         [iOSMac] Opt into modern compatibility mode by default
459         https://bugs.webkit.org/show_bug.cgi?id=196763
460         <rdar://problem/49038732>
461
462         Reviewed by Tim Horton.
463
464         Achieve this by limiting legacy compatibility mode by default to non-iOSMac iOS only.
465
466         * Shared/WebPreferences.yaml:
467         * Shared/WebPreferencesDefaultValues.h:
468
469 2019-04-10  Alex Christensen  <achristensen@webkit.org>
470
471         RemoteObjectRegistry message receiver should be removed when WebPage::close is called instead of waiting until dealloc
472         https://bugs.webkit.org/show_bug.cgi?id=196744
473         <rdar://49415309>
474
475         Reviewed by Chris Dumez.
476
477         This is a similar problem to the one I fixed in r241306 so I piggy-backed on the same test.
478         When you do a cross site navigation but the previous page is in a suspended process then you navigate back,
479         you can get two WebPage objects in the same process with the same IDs.  WebPage::close has been called
480         on the old one which is supposed to make it so all the message receivers associated with it have been removed
481         so we don't have any loss of communication, but we missed the RemoteObjectRegistry messages, which are owned
482         by the ObjC bundle object wrapping the WebPage (which can keep it alive if a strong reference to it is held).
483         To fix the assertion that happens in this case and the resulting communication breakage, teach the WebPage about
484         these messages so it can tear down the message receiver with the others it removes at close time.
485
486         * Shared/API/Cocoa/RemoteObjectRegistry.h:
487         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:
488         (-[WKWebProcessPlugInBrowserContextController dealloc]):
489         (-[WKWebProcessPlugInBrowserContextController _remoteObjectRegistry]):
490         * WebProcess/WebPage/Cocoa/WebPageCocoa.mm:
491         (WebKit::WebPage::addRemoteObjectRegistry):
492         * WebProcess/WebPage/WebPage.cpp:
493         (WebKit::WebPage::close):
494         * WebProcess/WebPage/WebPage.h:
495
496 2019-04-10  Chris Dumez  <cdumez@apple.com>
497
498         Unreviewed, drop SuspendedPageProxy data member that is unused after r244075.
499
500         * UIProcess/SuspendedPageProxy.h:
501
502 2019-04-10  Antoine Quint  <graouts@apple.com>
503
504         Enable Pointer Events on watchOS
505         https://bugs.webkit.org/show_bug.cgi?id=196771
506         <rdar://problem/49040909>
507
508         Reviewed by Dean Jackson.
509
510         * Configurations/FeatureDefines.xcconfig:
511
512 2019-04-10  Brady Eidson  <beidson@apple.com>
513
514         Background tabs are not fully reactivated after a link is opened from an external application.
515         <rdar://problem/49533278> and https://bugs.webkit.org/show_bug.cgi?id=196705
516
517         Reviewed by Chris Dumez.
518
519         If an app unparents a WKWebView right after activation but before the "applicationWillEnterForeground" notification
520         is dispatched, then that WKWebView is in a broken state with a frozen layer tree.
521
522         The WKApplicationStateTrackingView logic needs to be a little more resilient.
523
524         * UIProcess/ios/WKApplicationStateTrackingView.mm:
525         (-[WKApplicationStateTrackingView willMoveToWindow:]): When clearing the window, remember the current background state.
526         (-[WKApplicationStateTrackingView didMoveToWindow]): If our last observed background state doesn't match the current
527           background state then fake the relevant notification.
528         (-[WKApplicationStateTrackingView _applicationDidEnterBackground]): Remember that we've observed a backgrounding.
529         (-[WKApplicationStateTrackingView _applicationWillEnterForeground]): Remember that we've observed a foregrounding.
530
531 2019-04-10  Diego Pino Garcia  <dpino@igalia.com>
532
533         Unreviewed, build fix for r244097
534
535         * NetworkProcess/NetworkProcess.cpp:
536         (WebKit::NetworkProcess::actualPrepareToSuspend):
537         (WebKit::NetworkProcess::resume):
538         Added guards for ENABLE(SERVICE_WORKER)
539
540 2019-04-09  Keith Rollin  <krollin@apple.com>
541
542         Unreviewed build maintenance -- update .xcfilelists.
543
544         * DerivedSources-input.xcfilelist:
545         * DerivedSources-output.xcfilelist:
546
547 2019-04-09  Zalan Bujtas  <zalan@apple.com>
548
549         [AutoSizing] Avoid making text paragraphs scroll horizontally when there is a wide table
550         https://bugs.webkit.org/show_bug.cgi?id=196743
551         <rdar://problem/43897551>
552
553         Reviewed by Tim Horton.
554
555         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
556         (WebKit::WebFrameLoaderClient::transitionToCommittedForNewPage):
557         * WebProcess/WebPage/WebPage.cpp:
558         (WebKit::WebPage::setViewLayoutSize):
559
560 2019-04-09  Youenn Fablet  <youenn@apple.com>
561
562         Close service worker database on network process suspension
563         https://bugs.webkit.org/show_bug.cgi?id=196623
564         <rdar://problem/48930869>
565
566         Reviewed by Alex Christensen.
567
568         Close service worker database when preparing to suspend.
569         On resume, push changes if any is needed.
570
571         * NetworkProcess/NetworkProcess.cpp:
572         (WebKit::NetworkProcess::actualPrepareToSuspend):
573         (WebKit::NetworkProcess::cancelPrepareToSuspend):
574         (WebKit::NetworkProcess::processDidResume):
575         * UIProcess/API/Cocoa/WKProcessPool.mm:
576         (-[WKProcessPool _sendNetworkProcessWillSuspendImminently]):
577         (-[WKProcessPool _sendNetworkProcessDidResume]):
578         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
579         * UIProcess/Network/NetworkProcessProxy.h:
580         * UIProcess/WebProcessPool.cpp:
581         (WebKit::WebProcessPool::sendNetworkProcessWillSuspendImminently):
582         (WebKit::WebProcessPool::sendNetworkProcessDidResume):
583         * UIProcess/WebProcessPool.h:
584
585 2019-04-09  Daniel Bates  <dabates@apple.com>
586
587         [iPad] Should open popover when the spacebar is pressed
588         https://bugs.webkit.org/show_bug.cgi?id=196360
589         <rdar://problem/49389129>
590
591         Reviewed by Brent Fulgham.
592
593         Pressing the spacebar should open the popover for a focused popup button (e.g. <select>) on iOS
594         just like it does on the Mac.
595
596         For now, we keep the iPhone behavior of blurring the element when the Done button is pressed and
597         hence pressing spacebar does nothing (because there is no focused element).
598
599         * UIProcess/ios/WKContentViewInteraction.h:
600         * UIProcess/ios/WKContentViewInteraction.mm:
601         (-[WKContentView accessoryOpen]): Added. Extracted the logic from -_elementDidFocus to scroll to
602         the focused element, update the accessory and then tell the accessory to begin editing.
603         (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
604         Write in terms of -accessoryOpen.
605         * UIProcess/ios/forms/WKFormPeripheralBase.mm:
606         (-[WKFormPeripheralBase handleKeyEvent:]): Interpret the spacebar when the peripheral is closed (!_editing)
607         and call -accessoryOpen to ultimately call back to this peripheral to tell it to begin editing,
608         which will cause the popover to appear again.
609
610 2019-04-09  Chris Dumez  <cdumez@apple.com>
611
612         Unreviewed, fix webkitpy failure after r244085.
613
614         Use a list instead of a set for header includes so that the order is
615         maintained.
616
617         * Scripts/webkit/messages.py:
618
619 2019-04-09  Andy Estes  <aestes@apple.com>
620
621         [Apple Pay] Add release logging to PaymentCoordinator
622         https://bugs.webkit.org/show_bug.cgi?id=196738
623
624         Reviewed by Alex Christensen.
625
626         * WebProcess/ApplePay/WebPaymentCoordinator.cpp:
627         (WebKit::WebPaymentCoordinator::isAlwaysOnLoggingAllowed const):
628         * WebProcess/ApplePay/WebPaymentCoordinator.h:
629
630 2019-04-09  Jer Noble  <jer.noble@apple.com>
631
632         [Cocoa] Awaken UIProcess if WebContent process is awakened from suspensions unexpectedly.
633         https://bugs.webkit.org/show_bug.cgi?id=196659
634
635         Reviewed by Chris Dumez.
636
637         * Platform/IPC/Connection.h:
638         (IPC::Connection::sendWithAsyncReply):
639         * Platform/spi/ios/AssertionServicesSPI.h:
640         * Shared/Cocoa/ProcessTaskStateObserver.h: Added.
641         (WebKit::ProcessTaskStateObserver::setClient):
642         (WebKit::ProcessTaskStateObserver::client):
643         (WebKit::ProcessTaskStateObserver::taskState const):
644         * Shared/Cocoa/ProcessTaskStateObserver.mm: Added.
645         (-[WKProcessTaskStateObserverDelegate process:taskStateDidChange:]):
646         (WebKit::toProcessTaskStateObserverTaskState):
647         (WebKit::ProcessTaskStateObserver::ProcessTaskStateObserver):
648         (WebKit::ProcessTaskStateObserver::~ProcessTaskStateObserver):
649         (WebKit::ProcessTaskStateObserver::setTaskState):
650         * UIProcess/Cocoa/WebProcessProxyCocoa.mm:
651         (WebKit::WebProcessProxy::processWasUnexpectedlyUnsuspended):
652         * UIProcess/ProcessAssertion.h:
653         * UIProcess/ProcessThrottler.cpp:
654         (WebKit::ProcessThrottler::updateAssertion):
655         * UIProcess/ProcessThrottler.h:
656         (WebKit::ProcessThrottler::shouldBeRunnable const):
657         * UIProcess/WebProcessProxy.h:
658         * UIProcess/WebProcessProxy.messages.in:
659         * UIProcess/ios/ProcessAssertionIOS.mm:
660         (WebKit::reasonForState):
661         (WebKit::toBKSProcessAssertionReason):
662         (WebKit::ProcessAssertion::ProcessAssertion):
663         * WebKit.xcodeproj/project.pbxproj:
664         * WebProcess/WebProcess.cpp:
665         (WebKit::WebProcess::actualPrepareToSuspend):
666         (WebKit::WebProcess::cancelPrepareToSuspend):
667         (WebKit::WebProcess::processDidResume):
668         * WebProcess/WebProcess.h:
669         * WebProcess/cocoa/WebProcessCocoa.mm:
670         (WebKit::WebProcess::processTaskStateDidChange):
671
672 2019-04-09  Alex Christensen  <achristensen@webkit.org>
673
674         Clicking "Go Back" from a safe browsing warning from an iframe should navigate the WKWebView back to the previous page
675         https://bugs.webkit.org/show_bug.cgi?id=196665
676         <rdar://45115669>
677
678         Reviewed by Geoff Garen.
679
680         It is insufficient to just not navigate the subframe.  We must leave the page that contained it.
681
682         * UIProcess/API/Cocoa/WKWebView.mm:
683         (-[WKWebView _showSafeBrowsingWarning:completionHandler:]):
684         * UIProcess/Cocoa/WebViewImpl.mm:
685         (WebKit::WebViewImpl::showSafeBrowsingWarning):
686
687 2019-04-09  John Wilander  <wilander@apple.com>
688
689         Pick up Ad Click Attribution conversions in NetworkResourceLoader::willSendRedirectedRequest()
690         https://bugs.webkit.org/show_bug.cgi?id=196558
691         <rdar://problem/47650245>
692
693         Reviewed by Youenn Fablet.
694
695         So called pixel requests have traditionally been used to send ad click
696         attribution data to click sources. The privacy implications of such
697         pixel requests are severe which is in part why browsers have started to
698         block cookies from being sent in such third-party requests.
699
700         To allow for a smooth transition to more privacy-friendly ad click
701         attribution, we should allow servers to make a redirect to
702         https://click-source.example/.well-known/ad-click-attribution/ to
703         trigger a so called conversion.
704
705         This patch checks for the well-known location in the path component of
706         the redirect URL. If the request indeed goes to the well-known location,
707         we parse the conversion data and send it to the storage in the network
708         session.
709
710         * NetworkProcess/NetworkAdClickAttribution.cpp:
711         (WebKit::NetworkAdClickAttribution::convert):
712             Reporting function.
713         * NetworkProcess/NetworkAdClickAttribution.h:
714         * NetworkProcess/NetworkResourceLoader.cpp:
715         (WebKit::NetworkResourceLoader::willSendRedirectedRequest):
716             Now checks for the well-known location through a call to
717             WebCore::AdClickAttribution::parseConversionRequest().
718         * NetworkProcess/NetworkSession.cpp:
719         (WebKit::NetworkSession::convertAdClickAttribution):
720             Piping to WebKit::NetworkAdClickAttribution::convert().
721         * NetworkProcess/NetworkSession.h:
722
723 2019-04-09  Chris Dumez  <cdumez@apple.com>
724
725         [iOS] WebContent processes should be marked as "Foreground Running" when their view is visible
726         https://bugs.webkit.org/show_bug.cgi?id=196695
727         <rdar://problem/48073787>
728
729         Reviewed by Tim Horton.
730
731         In order for WebContent processes to get marked as "Foreground Running" when their view
732         is visible on iOS, we now construct a _UILayerHostView in the UIProcess and add it as
733         a subview of the WKContentView. The _UILayerHostView's visibility target is the
734         WebContent process currently associated with the view.
735
736         * Platform/spi/ios/UIKitSPI.h:
737         * UIProcess/PageClient.h:
738         (WebKit::PageClient::didCreateContextForVisibilityPropagation):
739         * UIProcess/WebPageProxy.h:
740         * UIProcess/WebProcessProxy.h:
741         (WebKit::WebProcessProxy::contextIDForVisibilityPropagation):
742         * UIProcess/WebProcessProxy.messages.in:
743         * UIProcess/ios/PageClientImplIOS.h:
744         * UIProcess/ios/PageClientImplIOS.mm:
745         (WebKit::PageClientImpl::didCreateContextForVisibilityPropagation):
746         * UIProcess/ios/WKContentView.h:
747         * UIProcess/ios/WKContentView.mm:
748         (-[WKContentView _commonInitializationWithProcessPool:configuration:]):
749         (-[WKContentView _setupVisibilityPropagationView]):
750         (-[WKContentView _processDidExit]):
751         (-[WKContentView _didRelaunchProcess]):
752         (-[WKContentView _processDidCreateContextForVisibilityPropagation]):
753         * UIProcess/ios/WebPageProxyIOS.mm:
754         (WebKit::WebPageProxy::didCreateContextForVisibilityPropagation):
755         * UIProcess/ios/WebProcessProxyIOS.mm:
756         (WebKit::WebProcessProxy::didCreateContextForVisibilityPropagation):
757         * WebProcess/WebProcess.h:
758         * WebProcess/cocoa/WebProcessCocoa.mm:
759         (WebKit::WebProcess::platformInitializeWebProcess):
760
761 2019-04-09  Sihui Liu  <sihui_liu@apple.com>
762
763         Remove unnecessary network process assertion for IDB close
764         https://bugs.webkit.org/show_bug.cgi?id=196693
765
766         Reviewed by Geoffrey Garen.
767
768         * NetworkProcess/NetworkProcess.cpp:
769         (WebKit::NetworkProcess::createIDBServer):
770         (WebKit::NetworkProcess::notifyHoldingLockedFiles): Deleted.
771         * NetworkProcess/NetworkProcess.h:
772         * UIProcess/Network/NetworkProcessProxy.cpp:
773         (WebKit::NetworkProcessProxy::didClose):
774         (WebKit::NetworkProcessProxy::setIsIDBDatabaseHoldingLockedFiles): Deleted.
775         * UIProcess/Network/NetworkProcessProxy.h:
776         * UIProcess/Network/NetworkProcessProxy.messages.in:
777
778 2019-04-09  Chris Dumez  <cdumez@apple.com>
779
780         Loads using loadHTMLString() cause flashing when process-swapping
781         https://bugs.webkit.org/show_bug.cgi?id=196714
782         <rdar://problem/49637354>
783
784         Reviewed by Antti Koivisto.
785
786         Our logic to decide if we should construct a SuspendedPageProxy on process-swap was assuming
787         a SuspendedPageProxy is only useful for PageCache and would therefore not create one if PageCache
788         is disabled or if there is no associated WebBackForwardListItem. However, constructing a
789         SuspendedPageProxy is also useful to prevent flashing when process-swapping as we need to keep
790         displaying the layer of the previous process until there is something meaningful to show in the
791         new process.
792
793         This patch makes it so that we now construct a SuspendedPageProxy on process-swap, even if
794         PageCache is disabled or if there is no associated WebBackForwardListItem. The process in
795         question will not be useful for PageCache but it will avoid flashing. The SuspendedPageProxy's
796         process may also get used for future navigations to the same site (as demonstrated by the
797         API test) which is beneficial for performance.
798
799         * UIProcess/SuspendedPageProxy.cpp:
800         (WebKit::SuspendedPageProxy::SuspendedPageProxy):
801         * UIProcess/SuspendedPageProxy.h:
802         * UIProcess/WebPageProxy.cpp:
803         (WebKit::WebPageProxy::suspendCurrentPageIfPossible):
804         * UIProcess/WebProcessPool.cpp:
805         (WebKit::WebProcessPool::findReusableSuspendedPageProcess):
806
807 2019-04-08  Don Olmstead  <don.olmstead@sony.com>
808
809         [CMake][WinCairo] Separate copied headers into different directories
810         https://bugs.webkit.org/show_bug.cgi?id=196655
811
812         Reviewed by Michael Catanzaro.
813
814         * CMakeLists.txt:
815         * PlatformWin.cmake:
816
817 2019-04-08  Wenson Hsieh  <wenson_hsieh@apple.com>
818
819         [iOS] Do not allow starting selection drags when selection views are not visible
820         https://bugs.webkit.org/show_bug.cgi?id=196686
821         <rdar://problem/49399192>
822
823         Reviewed by Tim Horton.
824
825         Currently, on iOS, it's possible to start dragging selected text in a web view even if the selection itself is
826         not visible. This can happen if the user selects some text, focuses a native text field, and then long presses
827         the previously selected text. This is because the text is still selected in the document since we don't clear
828         the selection when resigning first responder on iOS, despite the fact that the native selection view is no
829         longer present.
830
831         To fix this, we add plumbing to specify the set of allowed drag source actions when requesting drag start; this
832         set of allowed drag source actions only includes DragSourceActionSelection if the selection view can be visible
833         (i.e. the content view is first responder, and isn't suppressing text interactions). We then update WebPage's
834         allowed drag source actions with this given set of actions, while sending "dragstart" to the page.
835
836         * UIProcess/WebPageProxy.h:
837         * UIProcess/ios/WKContentViewInteraction.mm:
838         (-[WKContentView hasSelectablePositionAtPoint:]):
839         (-[WKContentView textInteractionGesture:shouldBeginAtPoint:]):
840
841         Only bail out of text selection in text that is already selected if the web view allows dragging text selections
842         (i.e. the web view is first responder, and is not suppressing text interactions).
843
844         (-[WKContentView _allowedDragSourceActions]):
845         (-[WKContentView _dragInteraction:itemsForAddingToSession:withTouchAtPoint:completion:]):
846         (-[WKContentView _dragInteraction:prepareForSession:completion:]):
847
848         Pass the set of allowed drag source actions when requesting a drag start or adding items to an existing session.
849
850         * UIProcess/ios/WebPageProxyIOS.mm:
851         (WebKit::WebPageProxy::requestDragStart):
852         (WebKit::WebPageProxy::requestAdditionalItemsForDragSession):
853
854         Plumb the allowed drag source actions from the UI process (WKContentView) over to the web process (WebPage).
855
856         * WebProcess/WebCoreSupport/WebDragClient.cpp:
857         (WebKit::WebDragClient::dragSourceActionMaskForPoint):
858
859         Instead of always returning Any, consult WebPage's allowed drag source actions.
860
861         * WebProcess/WebPage/WebPage.h:
862         (WebKit::WebPage::allowedDragSourceActions const):
863         * WebProcess/WebPage/WebPage.messages.in:
864         * WebProcess/WebPage/ios/WebPageIOS.mm:
865         (WebKit::WebPage::requestDragStart):
866         (WebKit::WebPage::requestAdditionalItemsForDragSession):
867
868         Set WebPage's allowed drag source actions to the given set of actions when sending a drag start to the page.
869
870 2019-04-08  Justin Fan  <justin_fan@apple.com>
871
872         [Web GPU] Fix Web GPU experimental feature on iOS
873         https://bugs.webkit.org/show_bug.cgi?id=196632
874
875         Reviewed by Myles C. Maxfield.
876
877         Add feature conditionals for iOS 11.
878         Properly make Web GPU available on iOS 11+.
879
880         * Configurations/FeatureDefines.xcconfig:
881         * Configurations/WebKitTargetConditionals.xcconfig:
882
883 2019-04-08  Alex Christensen  <achristensen@webkit.org>
884
885         Fix selector name after r243834
886         https://bugs.webkit.org/show_bug.cgi?id=196549
887
888         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
889         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
890         I forgot the colon in the setter's name.
891
892 2019-04-08  Antti Koivisto  <antti@apple.com>
893
894         Compute touch actions for touch point from remote layer tree regions
895         https://bugs.webkit.org/show_bug.cgi?id=196701
896
897         Reviewed by Simon Fraser.
898
899         Add a function for finding the right layer and getting the touch actions in UI process side.
900
901         The code is not used yet.
902
903         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.h:
904         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm:
905         (WebKit::touchActionsForPoint):
906
907         Use the same code as overlap hit testing for collecting the candidate layers for the touch point,
908         taking event regions into account.
909         Return the touch actions from the deepest event sensitive layer hit.
910
911         (-[UIView _web_findDescendantViewAtPoint:withEvent:]):
912
913         Modernize.
914
915 2019-04-08  Brent Fulgham  <bfulgham@apple.com>
916
917         Make HSTS list handling more robust against unexpected content 
918         https://bugs.webkit.org/show_bug.cgi?id=196552
919         <rdar://problem/43403817>
920
921         Reviewed by Chris Dumez.
922
923         Crash logs indicate we sometimes encounter null key values during processing.
924         This patch adds some debug assertions to catch this in test environments, and
925         allows the code to skip the bad entries if encountered.
926
927         It also avoids calling CFDictionaryApplyFunction when the HSTS policies returned
928         by _CFNetworkCopyHSTSPolicies is nullptr, which is a possible return value.
929
930         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
931         (WebKit::filterPreloadHSTSEntry):
932         (WebKit::NetworkProcess::getHostNamesWithHSTSCache):
933
934 2019-04-05  Brian Burg  <bburg@apple.com>
935
936         Web Automation: clean up some WebAutomationSession methods to use modern async IPC
937         https://bugs.webkit.org/show_bug.cgi?id=196168
938
939         Reviewed by Devin Rousso.
940
941         Modern WebKit IPC is capable of providing completion handlers and can track callback IDs.
942         So, most messages between WebAutomationSession and its proxy can use this facility and stop
943         keeping track of callback IDs manually. This makes most code easier to read on both the
944         sender and receiver side.
945
946         There are two cases that could not be converted:
947         - For evaluateJavaScript, we cannot use async IPC because WebAutomationSession expects to
948         be able to cancel all pending replies when a page navigates away, the web process crashes,
949         or when handling an alert.
950         - For takeScreenshot, there is not currently support in the modern async IPC code paths for
951         sending the result back. ShareableBitmap and friends lack a modern decoder implementation.
952
953         * UIProcess/Automation/WebAutomationSession.cpp:
954         (WebKit::WebAutomationSession::resolveChildFrameHandle):
955         (WebKit::WebAutomationSession::resolveParentFrameHandle):
956         (WebKit::WebAutomationSession::computeElementLayout):
957         (WebKit::WebAutomationSession::selectOptionElement):
958         (WebKit::WebAutomationSession::getAllCookies):
959         (WebKit::WebAutomationSession::deleteSingleCookie):
960         (WebKit::WebAutomationSession::viewportInViewCenterPointOfElement):
961         (WebKit::WebAutomationSession::didResolveChildFrame): Deleted.
962         (WebKit::WebAutomationSession::didResolveParentFrame): Deleted.
963         (WebKit::WebAutomationSession::didComputeElementLayout): Deleted.
964         (WebKit::WebAutomationSession::didSelectOptionElement): Deleted.
965         (WebKit::WebAutomationSession::didGetCookiesForFrame): Deleted.
966         (WebKit::WebAutomationSession::didDeleteCookie): Deleted.
967         * UIProcess/Automation/WebAutomationSession.h:
968         * UIProcess/Automation/WebAutomationSession.messages.in:
969         * WebProcess/Automation/WebAutomationSessionProxy.cpp:
970         (WebKit::WebAutomationSessionProxy::resolveChildFrameWithOrdinal):
971         (WebKit::WebAutomationSessionProxy::resolveChildFrameWithNodeHandle):
972         (WebKit::WebAutomationSessionProxy::resolveChildFrameWithName):
973         (WebKit::WebAutomationSessionProxy::resolveParentFrame):
974         (WebKit::WebAutomationSessionProxy::computeElementLayout):
975         (WebKit::WebAutomationSessionProxy::selectOptionElement):
976         (WebKit::WebAutomationSessionProxy::getCookiesForFrame):
977         (WebKit::WebAutomationSessionProxy::deleteCookie):
978         * WebProcess/Automation/WebAutomationSessionProxy.h:
979         * WebProcess/Automation/WebAutomationSessionProxy.messages.in:
980
981 2019-04-08  Alex Christensen  <achristensen@webkit.org>
982
983         REGRESSION(236463) DownloadManager can call a null CompletionHandler
984         https://bugs.webkit.org/show_bug.cgi?id=196414
985         <rdar://problem/48389434>
986
987         Reviewed by Geoff Garen.
988
989         * NetworkProcess/NetworkResourceLoader.cpp:
990         (WebKit::NetworkResourceLoader::convertToDownload):
991         DownloadManager::continueDecidePendingDownloadDestination is being called when there is no completion handler.
992         r236463 introduced an unchecked code path that can allow this to happen.
993
994 2019-04-07  Commit Queue  <commit-queue@webkit.org>
995
996         Unreviewed, rolling out r243956.
997         https://bugs.webkit.org/show_bug.cgi?id=196688
998
999         Broke API Test SafeBrowsing.WKWebViewGoBackIFrame (Requested
1000         by aakashjain on #webkit).
1001
1002         Reverted changeset:
1003
1004         "Clicking "Go Back" from a safe browsing warning from an
1005         iframe should navigate the WKWebView back to the previous
1006         page"
1007         https://bugs.webkit.org/show_bug.cgi?id=196665
1008         https://trac.webkit.org/changeset/243956
1009
1010 2019-04-07  Geoffrey Garen  <ggaren@apple.com>
1011
1012         Remove stray byte added by r241131
1013         https://bugs.webkit.org/show_bug.cgi?id=196682
1014
1015         Reviewed by Alexey Proskuryakov.
1016
1017         Sublime Text thinks WKWebView.mm is binary instead of text.
1018
1019         According to online documentation and bisecting, this is because r241131
1020         introduced a stray byte (probably a null byte?) into the file.
1021
1022         I fixed this with Cmd-C Cmd-V.
1023
1024         * UIProcess/API/Cocoa/WKWebView.mm:
1025         (-[WKWebView _initializeWithConfiguration:]):
1026
1027 2019-04-06  Wenson Hsieh  <wenson_hsieh@apple.com>
1028
1029         Hide next and previous form control buttons when WKWebView is editable
1030         https://bugs.webkit.org/show_bug.cgi?id=196672
1031         <rdar://problem/35625321>
1032
1033         Reviewed by Tim Horton.
1034
1035         Adopt new UIKit SPI to hide or show next and previous controls in the form accessory view when changing
1036         editability.
1037
1038         Test: KeyboardInputTests.FormNavigationAssistantBarButtonItems
1039
1040         * Platform/spi/ios/UIKitSPI.h:
1041         * UIProcess/API/Cocoa/WKWebView.mm:
1042         (-[WKWebView _setEditable:]):
1043         * UIProcess/ios/WKContentViewInteraction.h:
1044         * UIProcess/ios/WKContentViewInteraction.mm:
1045         (-[WKContentView _updateAccessory]):
1046         (-[WKContentView _didChangeWebViewEditability]):
1047
1048 2019-04-06  Antti Koivisto  <antti@apple.com>
1049
1050         Combine event and touch action regions into a single class
1051         https://bugs.webkit.org/show_bug.cgi?id=196644
1052         <rdar://problem/49643614>
1053
1054         Reviewed by Darin Adler.
1055
1056         * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.h:
1057         * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm:
1058         (WebKit::RemoteLayerTreeTransaction::LayerProperties::decode):
1059         * UIProcess/RemoteLayerTree/RemoteLayerTreeNode.h:
1060         (WebKit::RemoteLayerTreeNode::eventRegion const):
1061         * UIProcess/RemoteLayerTree/RemoteLayerTreeNode.mm:
1062         (WebKit::RemoteLayerTreeNode::setEventRegion):
1063         * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.cpp:
1064         (WebKit::PlatformCALayerRemote::setEventRegion):
1065         * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.h:
1066
1067 2019-04-05  Yongjun Zhang  <yongjun_zhang@apple.com>
1068
1069         We should pass minimumEffectiveDeviceWidth to web process on new page creation.
1070         https://bugs.webkit.org/show_bug.cgi?id=196077
1071         <rdar://problem/49108202>
1072
1073         Reviewed by Chris Dumez.
1074
1075         When a new web view is created, it is possible we don't have the web content process till a load
1076         is requested. This patch stashes minimumEffectiveDeviceWidth in WebPageProxy.cpp and passes that
1077         value down to web process via WebPageCreationParameters when a new process is created, just like
1078         we did for other values like viewportConfigurationLayoutSizeScaleFactor or viewportConfigurationViewLayoutSize.
1079
1080         * Shared/WebPageCreationParameters.cpp:
1081         (WebKit::WebPageCreationParameters::encode const): Encode viewportConfigurationMinimumEffectiveDeviceWidth value.
1082         (WebKit::WebPageCreationParameters::decode): Decode viewportConfigurationMinimumEffectiveDeviceWidth value.
1083         * Shared/WebPageCreationParameters.h:
1084         * UIProcess/API/Cocoa/WKWebView.mm: Now that we stash the minimumEffectiveDeviceWidth value in WebPageProxy, we
1085             don't need the iVar in WKWebView any more.
1086         (-[WKWebView _dispatchSetViewLayoutSize:]): Use _page->minimumEffectiveDeviceWidth().
1087         (-[WKWebView _setViewScale:]): Ditto.
1088         (-[WKWebView _setMinimumEffectiveDeviceWidth:]): Ditto.
1089         (-[WKWebView _minimumEffectiveDeviceWidth]): Ditto.
1090         * UIProcess/WebPageProxy.cpp:
1091         (WebKit::WebPageProxy::creationParameters): Also add viewportConfigurationMinimumEffectiveDeviceWidth to
1092             web process creation parameter.
1093         * UIProcess/WebPageProxy.h:
1094         (WebKit::WebPageProxy::minimumEffectiveDeviceWidth const): Returns m_viewportConfigurationMinimumEffectiveDeviceWidth.
1095         * UIProcess/ios/WebPageProxyIOS.mm:
1096         (WebKit::WebPageProxy::setViewportConfigurationViewLayoutSize): Pass parameters.viewportConfigurationMinimumEffectiveDeviceWidth
1097             to web process.
1098         * WebProcess/WebPage/WebPage.cpp:
1099         (WebKit::WebPage::WebPage): Take viewportConfigurationMinimumEffectiveDeviceWidth value from the parameter and
1100             set that to viewport configuration.
1101
1102 2019-04-05  Jer Noble  <jer.noble@apple.com>
1103
1104         [Cocoa] Deactivate the audio session before the WebProcess suspends.
1105         https://bugs.webkit.org/show_bug.cgi?id=196658
1106
1107         Reviewed by Eric Carlson.
1108
1109         Notify the PlatformMediaSessionManager when the process suspends or resumes.
1110
1111         * WebProcess/WebProcess.cpp:
1112         (WebKit::WebProcess::actualPrepareToSuspend):
1113         (WebKit::WebProcess::cancelPrepareToSuspend):
1114         (WebKit::WebProcess::processDidResume):
1115
1116 2019-04-05  Sihui Liu  <sihui_liu@apple.com>
1117
1118         [iOS] Web process gets suspended while holding locked database files
1119         https://bugs.webkit.org/show_bug.cgi?id=196519
1120         <rdar://problem/49531797>
1121
1122         Reviewed by Chris Dumez.
1123
1124         * WebProcess/WebProcess.cpp:
1125         (WebKit::WebProcess::actualPrepareToSuspend):
1126
1127 2019-04-05  Alex Christensen  <achristensen@webkit.org>
1128
1129         Clicking "Go Back" from a safe browsing warning from an iframe should navigate the WKWebView back to the previous page
1130         https://bugs.webkit.org/show_bug.cgi?id=196665
1131         <rdar://45115669>
1132
1133         Reviewed by Geoff Garen.
1134
1135         It is insufficient to just not navigate the subframe.  We must leave the page that contained it.
1136
1137         * UIProcess/API/Cocoa/WKWebView.mm:
1138         (-[WKWebView _showSafeBrowsingWarning:completionHandler:]):
1139         * UIProcess/Cocoa/WebViewImpl.mm:
1140         (WebKit::WebViewImpl::showSafeBrowsingWarning):
1141
1142 2019-04-05  Alex Christensen  <achristensen@webkit.org>
1143
1144         Undeprecate WKNavigationData
1145         https://bugs.webkit.org/show_bug.cgi?id=196559
1146         <rdar://44927425>
1147
1148         Reviewed by Geoff Garen.
1149
1150         * UIProcess/API/Cocoa/WKNavigationData.h:
1151         It is used to communicate information from FrameLoaderClient::updateGlobalHistory() to the application.
1152         This use in WKBrowsingContextHistoryDelegate is definitely still deprecated, but its use in
1153         WKHistoryDelegatePrivate does not have an adequate replacement yet, so it must remain undeprecated SPI.
1154
1155 2019-04-05  Sihui Liu  <sihui_liu@apple.com>
1156
1157         [iOS] Web process gets suspended while holding locked database files
1158         https://bugs.webkit.org/show_bug.cgi?id=196519
1159         <rdar://problem/49531797>
1160
1161         Reviewed by Chris Dumez.
1162
1163         * Shared/WebSQLiteDatabaseTracker.cpp:
1164         (WebKit::WebSQLiteDatabaseTracker::~WebSQLiteDatabaseTracker):
1165         * Shared/WebSQLiteDatabaseTracker.h:
1166         * WebProcess/WebProcess.cpp:
1167         (WebKit::m_webSQLiteDatabaseTracker):
1168         (WebKit::WebProcess::actualPrepareToSuspend):
1169         (WebKit::WebProcess::processWillSuspendImminently):
1170         (WebKit::WebProcess::cancelPrepareToSuspend):
1171         (WebKit::WebProcess::processDidResume):
1172         * WebProcess/WebProcess.h:
1173
1174 2019-04-05  Commit Queue  <commit-queue@webkit.org>
1175
1176         Unreviewed, rolling out r243833.
1177         https://bugs.webkit.org/show_bug.cgi?id=196645
1178
1179         This change breaks build of WPE and GTK ports (Requested by
1180         annulen on #webkit).
1181
1182         Reverted changeset:
1183
1184         "[CMake][WTF] Mirror XCode header directories"
1185         https://bugs.webkit.org/show_bug.cgi?id=191662
1186         https://trac.webkit.org/changeset/243833
1187
1188 2019-04-05  David Kilzer  <ddkilzer@apple.com>
1189
1190         REGRESSION(r240685): Remove duplicate Headers entry for _WKInspectorWindow.h in Xcode project
1191         <https://bugs.webkit.org/show_bug.cgi?id=193951>
1192         <rdar://problem/47621366>
1193
1194         Fixes the following build warnings:
1195             Warning: Multiple build commands for output file WebKit2_WebKit.roots/BuildRecords/WebKit2_installhdrs/Root/System/Library/Frameworks/WebKit.framework/PrivateHeaders/_WKInspectorWindow.h
1196             Warning: Multiple build commands for output file WebKit2_WebKit.roots/BuildRecords/WebKit2_installapi/Root/System/Library/Frameworks/WebKit.framework/PrivateHeaders/_WKInspectorWindow.h
1197             Warning: Multiple build commands for output file WebKit2_WebKit.roots/BuildRecords/WebKit2_install/Root/System/Library/Frameworks/WebKit.framework/PrivateHeaders/_WKInspectorWindow.h
1198
1199         * WebKit.xcodeproj/project.pbxproj: Remove duplicate entry for
1200         _WKInspectorWindow.h.  In r240685, a second Headers entry was
1201         added, but the first one was never removed.
1202
1203 2019-04-05  Carlos Garcia Campos  <cgarcia@igalia.com>
1204
1205         [ATK] Use a smart pointer for AccessibilityObject wrapper and remove GTK specific code
1206         https://bugs.webkit.org/show_bug.cgi?id=196593
1207         <rdar://problem/49599153>
1208
1209         Reviewed by Michael Catanzaro.
1210
1211         * WebProcess/WebPage/atk/WebKitWebPageAccessibilityObject.cpp:
1212         (accessibilityRootObjectWrapper): Cast wrapper() as AtkObject.
1213
1214 2019-04-04  Simon Fraser  <simon.fraser@apple.com>
1215
1216         Simple iframe scrolling test fails to get a composited scrolling frame in WebKitTestRunnerApp
1217         https://bugs.webkit.org/show_bug.cgi?id=196635
1218
1219         Reviewed by Antti Koivisto.
1220
1221         Remove WKBundleSetAsyncFrameScrollingEnabled().
1222
1223         * WebProcess/InjectedBundle/API/c/WKBundle.cpp:
1224         (WKBundleSetAsyncFrameScrollingEnabled): Deleted.
1225         * WebProcess/InjectedBundle/API/c/WKBundlePrivate.h:
1226
1227 2019-04-04  Simon Fraser  <simon.fraser@apple.com>
1228
1229         [iOS WK2] REGRESSION (r242687): Programmatic scroll of overflow scroll results in bad rendering
1230         https://bugs.webkit.org/show_bug.cgi?id=195584
1231
1232         Reviewed by Zalan Bujtas.
1233
1234         Push data to the scrolling tree about whether an overflow:scroll scroll was programmatic, by having
1235         RenderLayer::scrollToOffset() call into AsyncScrollingCoordinator::requestScrollPositionUpdate(),
1236         just as we do for frames.
1237
1238         AsyncScrollingCoordinator::requestScrollPositionUpdate() is generalized to take any ScrollableArea.
1239
1240         Fix an assumption in the ScrollingTree that we only care about programmatic scrolls on the root node.
1241         ScrollingTree::commitTreeState() no longer sets isHandlingProgrammaticScroll; instead,
1242         callers of ScrollingTreeScrollingNode::scrollTo() pass a ScrollType. Commit functions pass
1243         ScrollType::Programmatic when handling RequestedScrollPosition changes as necessary.
1244
1245         Programmatic scrolls need to get to the scrolling tree in the UI process so that we update
1246         the tree's notion of scroll position, and trigger actual UIScrollView scrolls (layers may have
1247         already been put in the right locations, but the UI process needs to know that a scroll happened).
1248         However, we need to prevent notifications from programmatic scrolls getting back to the
1249         web process, because this causes jumpiness. This is done via an early return in
1250         RemoteScrollingCoordinatorProxy::scrollingTreeNodeDidScroll().
1251
1252         * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp:
1253         (WebKit::RemoteScrollingCoordinatorProxy::scrollingTreeNodeDidScroll):
1254         * UIProcess/RemoteLayerTree/ios/ScrollingTreeFrameScrollingNodeRemoteIOS.mm:
1255         (WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::commitStateAfterChildren): Subframe nodes have
1256         a delegate, and that will take care of the requestedScrollPosition update.
1257         * UIProcess/RemoteLayerTree/ios/ScrollingTreeOverflowScrollingNodeIOS.h:
1258         * UIProcess/RemoteLayerTree/ios/ScrollingTreeOverflowScrollingNodeIOS.mm:
1259         (WebKit::ScrollingTreeOverflowScrollingNodeIOS::commitStateAfterChildren):
1260         * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm:
1261         (WebKit::ScrollingTreeScrollingNodeDelegateIOS::commitStateAfterChildren):
1262
1263 2019-04-04  Ryan Haddad  <ryanhaddad@apple.com>
1264
1265         Unreviewed, rolling out r243888.
1266
1267         Introduced layout test crashes.
1268
1269         Reverted changeset:
1270
1271         "[macOS][iOS] Add filter to syscall sandbox rule"
1272         https://bugs.webkit.org/show_bug.cgi?id=196613
1273         https://trac.webkit.org/changeset/243888
1274
1275 2019-04-04  Youenn Fablet  <youenn@apple.com>
1276
1277         Pass storage quota parameters from UIProcess to NetworkProcess as part of WebsiteDataStore parameters
1278         https://bugs.webkit.org/show_bug.cgi?id=196543
1279
1280         Reviewed by Alex Christensen.
1281
1282         Renamed methods used to set cache storage quota to be storage generic
1283         since they will apply to all storage.
1284
1285         Pass quota parameters as part of WebsiteDataStoreParameters from UIProcess
1286         to NetworkProcess (start-up time and new WebsiteDataStore time).
1287
1288         Compute on UIProcess the quota for third party origins using the default rule of dividing by 10.
1289
1290         * NetworkProcess/NetworkProcess.cpp:
1291         (WebKit::NetworkProcess::initializeNetworkProcess):
1292         (WebKit::NetworkProcess::addWebsiteDataStore):
1293         (WebKit::NetworkProcess::initializeStorageQuota):
1294         (WebKit::NetworkProcess::setCacheStorageParameters):
1295         * NetworkProcess/NetworkProcess.h:
1296         * NetworkProcess/NetworkProcess.messages.in:
1297         * Shared/WebsiteDataStoreParameters.cpp:
1298         (WebKit::WebsiteDataStoreParameters::encode const):
1299         (WebKit::WebsiteDataStoreParameters::decode):
1300         * Shared/WebsiteDataStoreParameters.h:
1301         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
1302         (WKWebsiteDataStoreSetPerOriginStorageQuota):
1303         (WKWebsiteDataStoreSetCacheStoragePerOriginQuota): Deleted.
1304         * UIProcess/API/C/WKWebsiteDataStoreRef.h:
1305         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
1306         (-[WKWebsiteDataStore _perOriginStorageQuota]):
1307         (-[WKWebsiteDataStore _setPerOriginStorageQuota:]):
1308         (-[WKWebsiteDataStore _cacheStoragePerOriginQuota]): Deleted.
1309         (-[WKWebsiteDataStore _setCacheStoragePerOriginQuota:]): Deleted.
1310         * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
1311         * UIProcess/Network/NetworkProcessProxy.cpp:
1312         (WebKit::NetworkProcessProxy::retrieveCacheStorageParameters):
1313         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
1314         (WebKit::WebsiteDataStore::parameters):
1315         * UIProcess/WebsiteData/WebsiteDataStore.h:
1316         (WebKit::WebsiteDataStore::perOriginStorageQuota const):
1317         (WebKit::WebsiteDataStore::setPerOriginStorageQuota):
1318         (WebKit::WebsiteDataStore::cacheStoragePerOriginQuota const): Deleted.
1319         (WebKit::WebsiteDataStore::setCacheStoragePerOriginQuota): Deleted.
1320         * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.cpp:
1321         (WebKit::WebsiteDataStoreConfiguration::copy):
1322         * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.h:
1323         (WebKit::WebsiteDataStoreConfiguration::perOriginStorageQuota):
1324         (WebKit::WebsiteDataStoreConfiguration::setPerOriginStorageQuota):
1325         (WebKit::WebsiteDataStoreConfiguration::cacheStoragePerOriginQuota): Deleted.
1326         (WebKit::WebsiteDataStoreConfiguration::setCacheStoragePerOriginQuota): Deleted.
1327
1328 2019-04-04  Wenson Hsieh  <wenson_hsieh@apple.com>
1329
1330         Changing default website policies shouldn't change default website policies in subsequent navigations
1331         https://bugs.webkit.org/show_bug.cgi?id=196562
1332         <rdar://problem/49573377>
1333
1334         Reviewed by Tim Horton.
1335
1336         Currently, changing the default WKWebpagePreferences object when deciding navigation policy causes the set of
1337         default policies to change in subsequent navigations. Among other things, this prevents clients from passing
1338         a modified version of the default website policies into the decision handler without impacting future
1339         navigations. To fix this, teach API::WebsitePolicies to make a copy of itself, and then use this to pass a copy
1340         of the default website policies to the navigation delegate when deciding navigation policies.
1341
1342         Test: DoNotAllowChangingDefaultWebpagePreferencesInDelegateMethod
1343
1344         * UIProcess/API/APIWebsitePolicies.cpp:
1345         (API::WebsitePolicies::copy const):
1346
1347         Add a helper method to copy a set of website policies.
1348
1349         * UIProcess/API/APIWebsitePolicies.h:
1350         * UIProcess/Cocoa/NavigationState.mm:
1351         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
1352
1353 2019-04-04  Michael Catanzaro  <mcatanzaro@igalia.com>
1354
1355         Unreviewed, fix -Wreturn-type warning
1356
1357         * Shared/WebsiteData/WebsiteData.cpp:
1358         (WebKit::WebsiteData::ownerProcess):
1359
1360 2019-04-04  Per Arne Vollan  <pvollan@apple.com>
1361
1362         [macOS] Fix sandbox violations
1363         https://bugs.webkit.org/show_bug.cgi?id=196616
1364         <rdar://problem/49498040>
1365
1366         Reviewed by Brent Fulgham.
1367
1368         Fix some observed sandbox violations in the WebContent process on macOS.
1369
1370         * WebProcess/com.apple.WebProcess.sb.in:
1371
1372 2019-04-04  Eric Carlson  <eric.carlson@apple.com>
1373
1374         [MediaStream] Host should be able to mute screen capture and camera/microphone independently
1375         https://bugs.webkit.org/show_bug.cgi?id=196555
1376         <rdar://problem/47303865>
1377
1378         Reviewed by Youenn Fablet.
1379
1380         * UIProcess/API/C/WKPagePrivate.h: Add kWKMediaScreenCaptureMuted.
1381
1382         * UIProcess/API/Cocoa/WKWebView.mm:
1383         (-[WKWebView _setPageMuted:]):
1384         (-[WKWebView _setMediaCaptureMuted:]): Deleted, it was unused.
1385         (-[WKWebView _muteMediaCapture]): Deleted, it was unused.
1386         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1387
1388         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
1389         (WebKit::UserMediaPermissionRequestManagerProxy::processUserMediaPermissionValidRequest): Fix
1390         a log comment typo.
1391
1392         * UIProcess/WebPageProxy.cpp:
1393         (WebKit::WebPageProxy::setMediaStreamCaptureMuted): Use the new flag.
1394         (WebKit::WebPageProxy::activateMediaStreamCaptureInPage): Ditto.
1395         (WebKit::WebPageProxy::setMuted): Ditto.
1396         * UIProcess/WebPageProxy.h:
1397         (WebKit::WebPageProxy::isMediaStreamCaptureMuted const): Ditto.
1398
1399 2019-04-04  Per Arne Vollan  <pvollan@apple.com>
1400
1401         [macOS][iOS] Add filter to syscall sandbox rule
1402         https://bugs.webkit.org/show_bug.cgi?id=196613
1403         <rdar://problem/49531420>
1404
1405         Reviewed by Brent Fulgham.
1406
1407         This will restrict the existing sandbox rule for the syscall.
1408
1409         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
1410         * WebProcess/com.apple.WebProcess.sb.in:
1411
1412 2019-04-04  Youenn Fablet  <youenn@apple.com>
1413
1414         Service Worker Process does not have the right domain name
1415         https://bugs.webkit.org/show_bug.cgi?id=196585
1416
1417         Reviewed by Chris Dumez.
1418
1419         * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceEntryPoint.mm:
1420         (WebKit::XPCServiceInitializerDelegate::getExtraInitializationData):
1421         Updated extraInitializationData to go from "security-origin" to "registrable-domain".
1422
1423 2019-04-04  Chris Dumez  <cdumez@apple.com>
1424
1425         Temporarily disable delayed WebProcess launch on iOS to address PLT regression
1426         https://bugs.webkit.org/show_bug.cgi?id=196604
1427         <rdar://problem/49074131>
1428
1429         Reviewed by Geoffrey Garen.
1430
1431         Temporarily disable delayed WebProcess launch on iOS to address PLT regression. This
1432         is while I figure out how to enable this on iOS without regressed PLT.
1433
1434         * UIProcess/WebProcessPool.h:
1435
1436 2019-04-04  Miguel Gomez  <magomez@igalia.com>
1437
1438         [CoordGraphics] Revalidate need for 'coordinated update completion' in ThreadedCompositor
1439         https://bugs.webkit.org/show_bug.cgi?id=188839
1440
1441         Reviewed by Žan Doberšek.
1442
1443         Even if a platform layer has changed, don't wait for a main thread callback to finish the
1444         CompositingRunLoop update. It can be finished as soon as we receive the frameComplete signal.
1445
1446         * Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.cpp:
1447         (WebKit::CompositingRunLoop::scheduleUpdate):
1448         (WebKit::CompositingRunLoop::stopUpdates):
1449         (WebKit::CompositingRunLoop::updateCompleted):
1450         (WebKit::CompositingRunLoop::updateTimerFired):
1451         (WebKit::CompositingRunLoop::compositionCompleted): Deleted.
1452         * Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.h:
1453         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
1454         (WebKit::ThreadedCompositor::renderLayerTree):
1455         (WebKit::ThreadedCompositor::sceneUpdateFinished):
1456         (WebKit::ThreadedCompositor::displayRefreshMonitor):
1457         (WebKit::ThreadedCompositor::handleDisplayRefreshMonitorUpdate): Deleted.
1458         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h:
1459         * WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.cpp:
1460         (WebKit::LayerTreeHost::handleDisplayRefreshMonitorUpdate):
1461
1462 2019-04-03  Carlos Garcia Campos  <cgarcia@igalia.com>
1463
1464         [ATK] Cleanup WebPageAccessibilityObjectAtk
1465         https://bugs.webkit.org/show_bug.cgi?id=196537
1466
1467         Reviewed by Michael Catanzaro.
1468
1469         Several changes and cleanups:
1470
1471          - Add WebKit prefix so that style checker doesn't complain about GObject conventions.
1472          - Rename the header to remove the Atk prefix to match the cpp file and class name.
1473          - Use pragma once.
1474          - Use nullptr instead of 0.
1475          - Use WEBKIT_DEFINE_TYPE instead of G_DEFINE_TYPE.
1476          - Return generic AtkObject* from constructor.
1477
1478         * SourcesGTK.txt:
1479         * WebProcess/WebPage/WebPage.h:
1480         * WebProcess/WebPage/atk/WebKitWebPageAccessibilityObject.cpp: Renamed from Source/WebKit/WebProcess/WebPage/atk/WebPageAccessibilityObjectAtk.cpp.
1481         (accessibilityRootObjectWrapper):
1482         (webkitWebPageAccessibilityObjectInitialize):
1483         (webkitWebPageAccessibilityObjectGetIndexInParent):
1484         (webkitWebPageAccessibilityObjectGetNChildren):
1485         (webkitWebPageAccessibilityObjectRefChild):
1486         (webkit_web_page_accessibility_object_class_init):
1487         (webkitWebPageAccessibilityObjectNew):
1488         (webkitWebPageAccessibilityObjectRefresh):
1489         * WebProcess/WebPage/atk/WebKitWebPageAccessibilityObject.h: Added.
1490         * WebProcess/WebPage/atk/WebPageAccessibilityObject.h: Removed.
1491         * WebProcess/WebPage/gtk/WebPageGtk.cpp:
1492         (WebKit::WebPage::platformInitialize):
1493         (WebKit::WebPage::updateAccessibilityTree):
1494
1495 2019-04-03  Carlos Garcia Campos  <cgarcia@igalia.com>
1496
1497         [ATK] Set ATK_STATE_TRANSIENT on the atk socket until it's embedded
1498         https://bugs.webkit.org/show_bug.cgi?id=196535
1499
1500         Reviewed by Michael Catanzaro.
1501
1502         This way the properties are not cached. Right now, if number of children is queried before the socket is
1503         embedded, 0 is returned and cached, so ATs don't see the child even after the socket has been embedded.
1504
1505         * UIProcess/API/gtk/WebKitWebViewBaseAccessible.cpp:
1506         (webkitWebViewBaseAccessibleRefStateSet): Set ATK_STATE_TRANSIENT is the socket is not occupied.
1507         * UIProcess/gtk/WebPageProxyGtk.cpp:
1508         (WebKit::WebPageProxy::bindAccessibilityTree): Unset ATK_STATE_TRANSIENT.
1509
1510 2019-04-03  Carlos Garcia Campos  <cgarcia@igalia.com>
1511
1512         [ATK] Embed the AtkSocket as soon as we receive the plug ID
1513         https://bugs.webkit.org/show_bug.cgi?id=196534
1514
1515         Reviewed by Michael Catanzaro.
1516
1517         We are currently storing the ID and waiting for the next time get_accessible is called to embed the socket. We
1518         can simply embed the socket when the plug ID is received.
1519
1520         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
1521         (webkitWebViewBaseGetAccessible):
1522         * UIProcess/WebPageProxy.h:
1523         * UIProcess/gtk/WebPageProxyGtk.cpp:
1524         (WebKit::WebPageProxy::bindAccessibilityTree):
1525
1526 2019-04-03  Carlos Garcia Campos  <cgarcia@igalia.com>
1527
1528         [ATK] Don't touch accessibility tree in WebFrameLoaderClient::dispatchDidClearWindowObjectInWorld
1529         https://bugs.webkit.org/show_bug.cgi?id=193914
1530
1531         Reviewed by Michael Catanzaro.
1532
1533         Move it to dispatchDidFinishDocumentLoad, since we know we have the document at that point and we can create the
1534         root accessibility object wrapper.
1535
1536         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1537         (WebKit::WebFrameLoaderClient::dispatchDidFinishDocumentLoad):
1538         (WebKit::WebFrameLoaderClient::dispatchDidClearWindowObjectInWorld):
1539
1540 2019-04-03  Simon Fraser  <simon.fraser@apple.com>
1541
1542         Simplify some "programmaticScroll" code paths
1543         https://bugs.webkit.org/show_bug.cgi?id=196589
1544
1545         Reviewed by Zalan Bujtas.
1546
1547         * WebProcess/WebPage/RemoteLayerTree/RemoteScrollingCoordinator.mm: Remove the parameter.
1548         (WebKit::RemoteScrollingCoordinator::scrollPositionChangedForNode): Use the enum type.
1549         * WebProcess/WebPage/ios/WebPageIOS.mm:
1550         (WebKit::WebPage::updateVisibleContentRects):
1551
1552 2019-04-03  Chris Dumez  <cdumez@apple.com>
1553
1554         The page's focusedFrame / frameSetLargestFrame do not get cleared on process swap or crash
1555         https://bugs.webkit.org/show_bug.cgi?id=196588
1556         <rdar://problem/49365787>
1557
1558         Reviewed by Ryosuke Niwa.
1559
1560         The page's focusedFrame / frameSetLargestFrame do not get cleared on process swap or crash.
1561         This can lead to returning stale frames to the client if it asks for those.
1562
1563         * UIProcess/WebPageProxy.cpp:
1564         (WebKit::WebPageProxy::resetState):
1565
1566 2019-04-03  Simon Fraser  <simon.fraser@apple.com>
1567
1568         Remove the isProgrammaticScroll argument to requestScroll() because no-one uses it
1569         https://bugs.webkit.org/show_bug.cgi?id=196587
1570
1571         Reviewed by Zalan Bujtas.
1572
1573         This argument was unused.
1574
1575         * UIProcess/API/gtk/PageClientImpl.cpp:
1576         (WebKit::PageClientImpl::requestScroll):
1577         * UIProcess/API/gtk/PageClientImpl.h:
1578         * UIProcess/API/wpe/PageClientImpl.cpp:
1579         (WebKit::PageClientImpl::requestScroll):
1580         * UIProcess/API/wpe/PageClientImpl.h:
1581         * UIProcess/PageClient.h:
1582         * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm:
1583         (WebKit::RemoteLayerTreeDrawingAreaProxy::commitLayerTree):
1584         * UIProcess/WebPageProxy.cpp:
1585         (WebKit::WebPageProxy::requestScroll):
1586         * UIProcess/WebPageProxy.h:
1587         * UIProcess/ios/PageClientImplIOS.h:
1588         * UIProcess/ios/PageClientImplIOS.mm:
1589         (WebKit::PageClientImpl::requestScroll):
1590         * UIProcess/mac/PageClientImplMac.h:
1591         * UIProcess/mac/PageClientImplMac.mm:
1592         (WebKit::PageClientImpl::requestScroll):
1593         * UIProcess/win/PageClientImpl.cpp:
1594         (WebKit::PageClientImpl::requestScroll):
1595         * UIProcess/win/PageClientImpl.h:
1596
1597 2019-04-03  Myles C. Maxfield  <mmaxfield@apple.com>
1598
1599         -apple-trailing-word is needed for browser detection
1600         https://bugs.webkit.org/show_bug.cgi?id=196575
1601
1602         Unreviewed.
1603
1604         * Configurations/FeatureDefines.xcconfig:
1605
1606 2019-04-03  Wenson Hsieh  <wenson_hsieh@apple.com>
1607
1608         Add a WebKit internal feature flag to always enable modern compatibility mode by default
1609         https://bugs.webkit.org/show_bug.cgi?id=196526
1610         <rdar://problem/49532923>
1611
1612         Reviewed by Tim Horton.
1613
1614         Change UseModernCompatibilityModeByDefault from an internal preference to a debug preference, so that it may be
1615         enabled for all apps on the system.
1616
1617         * Shared/WebPreferences.yaml:
1618
1619 2019-04-03  Alex Christensen  <achristensen@webkit.org>
1620
1621         Fix internal build after r243829
1622         https://bugs.webkit.org/show_bug.cgi?id=196549
1623
1624         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
1625         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
1626         Some SDK's don't include this selector in the header.
1627         Use NSSelectorFromString.
1628
1629 2019-04-03  Don Olmstead  <don.olmstead@sony.com>
1630
1631         [CMake][WTF] Mirror XCode header directories
1632         https://bugs.webkit.org/show_bug.cgi?id=191662
1633
1634         Reviewed by Konstantin Tokarev.
1635
1636         Use WTFFramework as a dependency and include frameworks/WTF.cmake for AppleWin internal
1637         builds.
1638
1639         * CMakeLists.txt:
1640
1641 2019-04-03  Alex Christensen  <achristensen@webkit.org>
1642
1643         Add SPI to disable legacy TLS fallback
1644         https://bugs.webkit.org/show_bug.cgi?id=196549
1645         <rdar://44979744>
1646
1647         Reviewed by Geoffrey Garen.
1648
1649         * NetworkProcess/NetworkSessionCreationParameters.cpp:
1650         (WebKit::NetworkSessionCreationParameters::privateSessionParameters):
1651         (WebKit::NetworkSessionCreationParameters::encode const):
1652         (WebKit::NetworkSessionCreationParameters::decode):
1653         * NetworkProcess/NetworkSessionCreationParameters.h:
1654         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
1655         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
1656         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
1657         (-[WKWebsiteDataStore _setAllowsTLSFallback:]):
1658         (-[WKWebsiteDataStore _allowsTLSFallback]):
1659         * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
1660         * UIProcess/WebProcessPool.cpp:
1661         (WebKit::WebProcessPool::ensureNetworkProcess):
1662         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
1663         (WebKit::WebsiteDataStore::parameters):
1664         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
1665         (WebKit::WebsiteDataStore::setSourceApplicationSecondaryIdentifier):
1666         (WebKit::WebsiteDataStore::setAllowsTLSFallback):
1667         (WebKit::WebsiteDataStore::setSourceApplicationBundleIdentifier):
1668         * UIProcess/WebsiteData/WebsiteDataStore.h:
1669         (WebKit::WebsiteDataStore::allowsTLSFallback const):
1670         (WebKit::WebsiteDataStore::networkingHasBegun):
1671         (WebKit::WebsiteDataStore::finalizeApplicationIdentifiers): Deleted.
1672
1673 2019-04-03  Myles C. Maxfield  <mmaxfield@apple.com>
1674
1675         Remove support for -apple-trailing-word
1676         https://bugs.webkit.org/show_bug.cgi?id=196525
1677
1678         Reviewed by Zalan Bujtas.
1679
1680         This CSS property is nonstandard and not used.
1681
1682         * Configurations/FeatureDefines.xcconfig:
1683
1684 2019-04-03  Alex Christensen  <achristensen@webkit.org>
1685
1686         Resurrect and fix layout test http/tests/adClickAttribution/store-ad-click-attribution.html
1687         https://bugs.webkit.org/show_bug.cgi?id=196476
1688
1689         Reviewed by Chris Dumez.
1690
1691         Re-apply a change I reverted in r241754 now that it's safe to do so.
1692
1693         * UIProcess/WebPageProxy.cpp:
1694         (WebKit::WebPageProxy::didCommitLoadForFrame):
1695
1696 2019-04-03  Daniel Bates  <dabates@apple.com>
1697
1698         [iOS] Should be able to dismiss picker or popover using the keyboard
1699         https://bugs.webkit.org/show_bug.cgi?id=196272
1700         <rdar://problem/48943170>
1701
1702         Reviewed by Wenson Hsieh.
1703
1704         Intercept key events and route them to the current input peripheral (if we have one). Add a base key event handler
1705         for all form peripherals that dismisses the accessory when either the Escape key is pressed or Command + . is pressed.
1706         I will fix this issue for the file upload picker/popover in <https://bugs.webkit.org/show_bug.cgi?id=196287>.
1707
1708         * SourcesCocoa.txt: Add file WKFormPeripheralBase.mm.
1709         * UIProcess/ios/WKContentViewInteraction.mm:
1710         (-[WKContentView endEditingAndUpdateFocusAppearanceWithReason]): Added.
1711         (-[WKContentView resignFirstResponderForWebView]): Write in terms of -endEditingAndUpdateFocusAppearance.
1712         (-[WKContentView inputView]): Code style nit while I am here; add an empty line to demarcate the "crazy"
1713         code that the FIXME is referring to and should ideally be removed from the code that is sane to always do.
1714         (-[WKContentView accessoryDone]): When the accessory is dismissed via the Done button (iPhone) or by pressing
1715         Escape or Command + . using a hardware keyboard (iPhone or iPad) then end the current editing session, but
1716         do not resign first responder status as the page activation state should not be changed.
1717         (-[WKContentView _handleKeyUIEvent:]): Bring back this code when building with USE(UIKIT_KEYBOARD_ADDITIONS)
1718         as we need to route key events to the input peripheral (if we have one). If the input peripheral handles it
1719         then we're done: no need to let UIKit or WebKit handle it when building with USE(UIKIT_KEYBOARD_ADDITIONS),
1720         respectively. If the input peripheral does not handle it then do what we do now.
1721         (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
1722         If the element is re-focused and we have an input peripheral then we want to ensure we are first responder,
1723         reveal the focused element, update the accessory and tell the peripheral that editing has begun (again).
1724         For all other element re-focusing where we don't have a peripheral do what we do now. Also, update _isEditable
1725         to reflect whether the focused element contains selectable text. This is what UIKit wants to know when it queries
1726         -isEditable. Now that we no longer blur the focused element on iPad when the popover is dismissed and keep the
1727         peripheral until there is a focus change we need to ensure that we give the correct answer to UIKit on view
1728         editability. Otherwise, UIKit thinks it needs to update the text selection state when a popup button is tapped
1729         again (as part of its gesture recognizer logic) and this causes an assertion failure in UIKit after it calls back
1730         into us to ask for selection details, which we correctly respond with the equivalent of "we have none" and is
1731         not the answer UIKit expects since we told it we are editable. (Currently we manage to get away with telling UIKit
1732         we are always editable because it is not possible to perform a selection operation when we have a popover open.
1733         Closing the popover blurs the element, setting -isEditable to NO and deallocates the peripheral avoiding this issue).
1734         * UIProcess/ios/forms/WKFormColorControl.h:
1735         * UIProcess/ios/forms/WKFormColorControl.mm:
1736         (-[WKColorPopover controlEndEditing]): Dismiss the popover.
1737         (-[WKFormColorControl initWithView:]): Modified to call base class initializer.
1738         (-[WKFormColorControl assistantView]): Deleted.
1739         (-[WKFormColorControl beginEditing]): Deleted.
1740         (-[WKFormColorControl endEditing]): Deleted.
1741         * UIProcess/ios/forms/WKFormInputControl.h:
1742         * UIProcess/ios/forms/WKFormInputControl.mm:
1743         (-[WKFormInputControl initWithView:]): Modified to call base class initializer.
1744         (-[WKFormInputControl dateTimePickerCalendarType]): Write in terms of self.control.
1745         (-[WKDateTimePopover controlEndEditing]): Dismiss the popover and tell the controller that editing ended.
1746         (-[WKFormInputControl beginEditing]): Deleted.
1747         (-[WKFormInputControl endEditing]): Deleted.
1748         (-[WKFormInputControl assistantView]): Deleted.
1749         * UIProcess/ios/forms/WKFormPeripheral.h:
1750         * UIProcess/ios/forms/WKFormPeripheralBase.h: Added.
1751         * UIProcess/ios/forms/WKFormPeripheralBase.mm: Added.
1752         (-[WKFormPeripheralBase initWithView:control:]): Take ownership of the passed WKFormControl.
1753         (-[WKFormPeripheralBase beginEditing]): Turn around and tell the control.
1754         (-[WKFormPeripheralBase endEditing]): Ditto.
1755         (-[WKFormPeripheralBase assistantView]): Ditto.
1756         (-[WKFormPeripheralBase control]): Return the control.
1757         (-[WKFormPeripheralBase handleKeyEvent:]): Dismiss the accessory (in the same way we dismiss when the Done
1758         button is pressed on iPhone) on keydown of the Escape key or when we receive a UIKeyInputEscape event (for
1759         Command + .).
1760         * UIProcess/ios/forms/WKFormSelectControl.h:
1761         * UIProcess/ios/forms/WKFormSelectControl.mm:
1762         (-[WKFormSelectControl initWithView:]): Modified to call base class initializer.
1763         (-[WKFormSelectControl selectRow:inComponent:extendingSelection:]): Write in terms of self.control.
1764         (-[WKFormSelectControl selectFormPopoverTitle]): Ditto.
1765         (-[WKFormSelectControl assistantView]): Deleted.
1766         (-[WKFormSelectControl beginEditing]): Deleted.
1767         (-[WKFormSelectControl endEditing]): Deleted.
1768         * UIProcess/ios/forms/WKFormSelectPopover.mm:
1769         (-[WKSelectPopover controlEndEditing]): Dismiss the popover.
1770         * WebKit.xcodeproj/project.pbxproj: Add files WKFormPeripheralBase.{h, mm}.
1771
1772 2019-04-03  Youenn Fablet  <youenn@apple.com>
1773
1774         Resetting quota should take into account third party origins
1775         https://bugs.webkit.org/show_bug.cgi?id=196462
1776
1777         Reviewed by Geoffrey Garen.
1778
1779         When clearing the storage quota, we were resetting it to the default value
1780         without taking care of whether third party or not.
1781         Updated the code to ensure that the default quota is computed based on the origin.
1782
1783         Updated existing test to cover this case.
1784
1785         * NetworkProcess/NetworkProcess.cpp:
1786         (WebKit::NetworkProcess::clearStorageQuota):
1787         (WebKit::NetworkProcess::setCacheStorageParameters):
1788         (WebKit::NetworkProcess::updateQuotaBasedOnSpaceUsageForTesting):
1789         (WebKit::NetworkProcess::storageQuotaManager):
1790         * NetworkProcess/NetworkProcess.h:
1791         (WebKit::NetworkProcess::StorageQuotaManagers::defaultQuota const):
1792         (WebKit::NetworkProcess::StorageQuotaManagers::setDefaultQuotas):
1793         (WebKit::NetworkProcess::StorageQuotaManagers::managersPerOrigin):
1794
1795 2019-04-03  Michael Catanzaro  <mcatanzaro@igalia.com>
1796
1797         Get rid of HTMLInputElement::setEditingValue
1798         https://bugs.webkit.org/show_bug.cgi?id=196402
1799
1800         Reviewed by Darin Adler.
1801
1802         * WebProcess/InjectedBundle/API/glib/DOM/WebKitDOMElement.cpp:
1803         (webkit_dom_element_html_input_element_set_editing_value):
1804         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLInputElement.cpp:
1805         (webkit_dom_html_input_element_set_editing_value):
1806
1807 2019-04-03  Wenson Hsieh  <wenson_hsieh@apple.com>
1808
1809         Add a WebKit internal feature flag to always enable modern compatibility mode by default
1810         https://bugs.webkit.org/show_bug.cgi?id=196526
1811         <rdar://problem/49532923>
1812
1813         Reviewed by Antoine Quint.
1814
1815         * Shared/WebPreferences.yaml:
1816
1817 2019-04-03  Wenson Hsieh  <wenson_hsieh@apple.com>
1818
1819         Introduce and add plumbing for a website policy for meta viewport tag handling
1820         https://bugs.webkit.org/show_bug.cgi?id=196285
1821
1822         Reviewed by Tim Horton.
1823
1824         Add WebsiteMetaViewportPolicy, a bit that can be used to determine whether to respect or ignore the meta
1825         viewport tag and use native web page parameters instead of the default parameters.
1826
1827         * Shared/WebsiteMetaViewportPolicy.h: Copied from Source/WebKit/Shared/WebsitePoliciesData.h.
1828         * Shared/WebsitePoliciesData.cpp:
1829         (WebKit::WebsitePoliciesData::encode const):
1830         (WebKit::WebsitePoliciesData::decode):
1831         (WebKit::WebsitePoliciesData::applyToDocumentLoader):
1832
1833         Convert WebKit::WebsiteMetaViewportPolicy into WebCore::MetaViewportPolicy.
1834
1835         * Shared/WebsitePoliciesData.h:
1836         * UIProcess/API/APIWebsitePolicies.cpp:
1837         (API::WebsitePolicies::data):
1838         * UIProcess/API/APIWebsitePolicies.h:
1839
1840         Add additional plumbing for the policy flag.
1841
1842         * WebKit.xcodeproj/project.pbxproj:
1843         * WebProcess/WebPage/ios/WebPageIOS.mm:
1844         (WebKit::WebPage::resetViewportDefaultConfiguration):
1845
1846         Use native web page parameters if either "shouldIgnoreMetaViewport" is enabled, or the new policy is set.
1847         Eventually, the policy should completely replace the former preference once no internal clients depend on it.
1848
1849 2019-04-03  Wenson Hsieh  <wenson_hsieh@apple.com>
1850
1851         Add plumbing for a compatibility mode preference in WebKit
1852         https://bugs.webkit.org/show_bug.cgi?id=196005
1853
1854         Reviewed by Tim Horton.
1855
1856         Add plumbing between the Cocoa API object (WKWebpagePreferences) and the inner C++ API object
1857         (API::WebsitePolicies) for compatibility mode.
1858
1859         * Shared/WebCompatibilityMode.h: Added.
1860         * UIProcess/API/APIWebsitePolicies.h:
1861         * UIProcess/API/Cocoa/WKWebpagePreferences.mm:
1862         * UIProcess/Cocoa/NavigationState.mm:
1863         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
1864         * UIProcess/WebPageProxy.cpp:
1865         (WebKit::WebPageProxy::adjustPoliciesForCompatibilityMode):
1866         * UIProcess/WebPageProxy.h:
1867         * UIProcess/ios/WebPageProxyIOS.mm:
1868         * WebKit.xcodeproj/project.pbxproj:
1869
1870 2019-04-03  Carlos Garcia Campos  <cgarcia@igalia.com>
1871
1872         [CoordinatedGraphics] Hidden pages are not suspended after a web view resize
1873         https://bugs.webkit.org/show_bug.cgi?id=196487
1874
1875         Reviewed by Žan Doberšek.
1876
1877         When resizing the window, the hidden tabs are updated too, to avoid flickering or getting the old size when
1878         switching tabs. For that we need to resume painting but we are not suspending it again after the update.
1879
1880         * WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp:
1881         (WebKit::DrawingAreaCoordinatedGraphics::updateBackingStoreState): Suspend the painting again after a
1882         synchronous update if needed.
1883
1884 2019-04-03  Carlos Garcia Campos  <cgarcia@igalia.com>
1885
1886         Web Inspector: [GTK] Copy copies to nowhere
1887         https://bugs.webkit.org/show_bug.cgi?id=181228
1888
1889         Reviewed by Michael Catanzaro.
1890
1891         The thing is that those items are actually submenu items, with options, for example in the case of Copy to copy
1892         HTML, Text, XPath, etc. We are not correctly handling submenus when populating the context menu received from
1893         the web process.
1894
1895         * UIProcess/gtk/WebContextMenuProxyGtk.cpp:
1896         (WebKit::WebContextMenuProxyGtk::populateSubMenu): Helper to populate submenu items recursively.
1897         (WebKit::WebContextMenuProxyGtk::populate): Handle submenu items.
1898         * UIProcess/gtk/WebContextMenuProxyGtk.h:
1899
1900 2019-04-02  Wenson Hsieh  <wenson_hsieh@apple.com>
1901
1902         [Cocoa] Add new API around WKWebpagePreferences in WKNavigationDelegate and WKWebViewConfiguration
1903         https://bugs.webkit.org/show_bug.cgi?id=196284
1904         <rdar://problem/47228232>
1905
1906         Reviewed by Tim Horton.
1907
1908         Tests for both of these APIs will be added in a subsequent patch.
1909
1910         * Shared/API/Cocoa/WebKit.h:
1911         * UIProcess/API/APIPageConfiguration.cpp:
1912         (API::PageConfiguration::defaultWebsitePolicies const):
1913         (API::PageConfiguration::setDefaultWebsitePolicies):
1914         * UIProcess/API/APIPageConfiguration.h:
1915         * UIProcess/API/Cocoa/WKNavigationDelegate.h:
1916
1917         Add a new navigation delegate hook to allow clients to return a WKWebpagePreference targeting the given
1918         navigation action.
1919
1920         * UIProcess/API/Cocoa/WKWebView.mm:
1921         (-[WKWebView _initializeWithConfiguration:]):
1922         * UIProcess/API/Cocoa/WKWebViewConfiguration.h:
1923         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
1924
1925         Add new API on WKWebViewConfiguration to specify a default WKWebpagePreference to use when navigating.
1926
1927         (-[WKWebViewConfiguration copyWithZone:]):
1928         (-[WKWebViewConfiguration defaultWebpagePreferences]):
1929         (-[WKWebViewConfiguration setDefaultWebpagePreferences:]):
1930         * UIProcess/API/Cocoa/WKWebpagePreferences.h:
1931         * UIProcess/Cocoa/NavigationState.h:
1932         * UIProcess/Cocoa/NavigationState.mm:
1933         (WebKit::NavigationState::setNavigationDelegate):
1934         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
1935
1936         Invoke the new WKWebpagePreferences-based navigation delegate method.
1937
1938         * WebKit.xcodeproj/project.pbxproj:
1939         * mac/postprocess-framework-headers.sh:
1940         * mac/replace-webkit-additions-in-framework-headers.sh: Added.
1941
1942         Move logic in the "Postprocess Framework Headers" step responsible for stripping away included files from
1943         WebKitAdditions out into a separate build phase, called "Replace WebKitAdditions in Framework Headers". This
1944         ensures headers attempting to include from WebKitAdditions have these additional statements removed.
1945
1946 2019-04-02  Geoffrey Garen  <ggaren@apple.com>
1947
1948         Eliminate plugin sandbox exceptions
1949         https://bugs.webkit.org/show_bug.cgi?id=196510
1950
1951         Reviewed by Chris Dumez.
1952
1953         * PluginProcess/mac/PluginProcessMac.mm:
1954         (WebKit::PluginProcess::initializeSandbox):
1955         * UIProcess/Plugins/PluginInfoStore.cpp:
1956         (WebKit::PluginInfoStore::shouldAllowPluginToRunUnsandboxed): Deleted.
1957         * UIProcess/Plugins/PluginInfoStore.h:
1958         * UIProcess/Plugins/mac/PluginInfoStoreMac.mm:
1959         (WebKit::PluginInfoStore::shouldUsePlugin):
1960         (WebKit::PluginInfoStore::shouldAllowPluginToRunUnsandboxed): Deleted.
1961
1962 2019-04-02  Alex Christensen  <achristensen@webkit.org>
1963
1964         Fix assertion in http/tests/adClickAttribution/store-ad-click-attribution.html
1965         https://bugs.webkit.org/show_bug.cgi?id=196503
1966
1967         Reviewed by Chris Dumez.
1968
1969         In WebPageProxy::didDestroyNavigation we try to ignore a request to destroy a navigation from a page being navigated from
1970         during a cross-site navigation, but if the old web process sends the message after WebPageProxy::commitProvisionalPage
1971         has been called, we can still destroy a navigation when we are continuing a navigation in another process.  To prevent this,
1972         have the process not send the message when it knows the navigation is continuing in another process.
1973         Also make the use of unchecked navigation pointers more robust by checking it for nullity.
1974
1975         * UIProcess/WebPageProxy.cpp:
1976         (WebKit::WebPageProxy::didCommitLoadForFrame):
1977         * WebProcess/WebPage/WebFrame.cpp:
1978         (WebKit::WebFrame::didReceivePolicyDecision):
1979         (WebKit::WebFrame::documentLoaderDetached):
1980         * WebProcess/WebPage/WebFrame.h:
1981
1982 2019-04-02  Per Arne Vollan  <pvollan@apple.com>
1983
1984         [iOS] Fix iokit-get-properties sandbox violation in the WebContent process
1985         https://bugs.webkit.org/show_bug.cgi?id=196500
1986         <rdar://problem/49497788>
1987
1988         Reviewed by Brent Fulgham.
1989
1990         Attempting to get the iokit properties 'product-description', 'artwork-display-gamut' and
1991         'artwork-scale-factor' is causing sandbox violations.
1992
1993         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
1994
1995 2019-04-02  Chris Dumez  <cdumez@apple.com>
1996
1997         [WK2] Add support for Window's beforeprint / afterprint events
1998         https://bugs.webkit.org/show_bug.cgi?id=196478
1999
2000         Reviewed by Alex Christensen.
2001
2002         Add support for Window's beforeprint / afterprint events as per:
2003         - https://html.spec.whatwg.org/#dom-print
2004
2005         Blink and Gecko already support this.
2006
2007         * WebProcess/WebPage/WebPage.cpp:
2008         (WebKit::WebPage::beginPrinting):
2009         (WebKit::WebPage::endPrinting):
2010
2011 2019-04-02  Wenson Hsieh  <wenson_hsieh@apple.com>
2012
2013         REGRESSION (r243726): Crash at unrecognized selector: -[WKWebpagePreferences webpagePreferences]
2014         https://bugs.webkit.org/show_bug.cgi?id=196496
2015         <rdar://problem/49521634>
2016
2017         Reviewed by Chris Dumez.
2018
2019         r243726 made an incorrect assumption that all callers of -decidePolicyForNavigationAction:decisionHandler: and
2020         -decidePolicyForNavigationAction:userInfo:decisionHandler: must be instances of _WKWebsitePolicies, as opposed
2021         to the new WKWebpagePreferences. However, it's possible for clients (in this case, Safari) to already generate
2022         and pass in an instance of WKWebpagePreferences by bridging the C API opaque ref (WKWebsitePoliciesRef) into the
2023         Objective-C object (which is now WKWebpagePreferences, after my change).
2024
2025         To maintain binary compatibility of trunk WebKit against prior versions of Safari, we need to handle both
2026         WKWebpagePreferences and the soon-to-be-deprecated _WKWebsitePolicies in the navigation action policy decision
2027         handler.
2028
2029         Tests:  WebKit.WebsitePoliciesWithBridgingCast
2030                 WebKit.WebsitePoliciesWithUnexpectedType
2031
2032         * UIProcess/Cocoa/NavigationState.mm:
2033         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
2034
2035 2019-04-01  Chris Dumez  <cdumez@apple.com>
2036
2037         Unreviewed, drop debug logging landed as part of r242903 by mistake.
2038
2039         * UIProcess/WebPageProxy.cpp:
2040         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
2041
2042 2019-04-01  Remy Demarest  <rdemarest@apple.com>
2043
2044         Add SPI to give injected bundles access to displayed PDFDocuments
2045         https://bugs.webkit.org/show_bug.cgi?id=196471
2046         <rdar://problem/48080768>
2047
2048         Reviewed by Tim Horton.
2049
2050         * WebKit.xcodeproj/project.pbxproj:
2051
2052         * WebProcess/InjectedBundle/API/c/mac/WKBundlePageMac.h: Added.
2053         * WebProcess/InjectedBundle/API/c/mac/WKBundlePageMac.mm: Added.
2054         (WKBundlePageGetPDFDocumentInFrame):
2055
2056 2019-04-01  Wenson Hsieh  <wenson_hsieh@apple.com>
2057
2058         [WebKit2] Introduce a public version of WKWebsitePolicies
2059         https://bugs.webkit.org/show_bug.cgi?id=195989
2060         <rdar://problem/47228232>
2061
2062         Reviewed by Tim Horton.
2063
2064         Expose the existing _WKWebsitePolicies object as WKWebpagePreferences, in what will eventually become a public
2065         header in the WebKit SDK (WKWebpagePreferences.h). Following a similar transitioning strategy as
2066         _WKWebsiteDataStore and WKWebsiteDataStore, we move existing logic from _WKWebsitePolicies to WKWebpagePreferences
2067         and make _WKWebsitePolicies a wrapper around WKWebpagePreferences.
2068
2069         No change in behavior.
2070
2071         * Shared/Cocoa/APIObject.mm:
2072         (API::Object::newObject):
2073
2074         Wrap API::WebsitePolicies with WKWebpagePreferences.
2075
2076         * SourcesCocoa.txt:
2077         * UIProcess/API/Cocoa/WKWebView.mm:
2078         (-[WKWebView _updateWebsitePolicies:]):
2079         * UIProcess/API/Cocoa/WKWebpagePreferences.h: Copied from Source/WebKit/UIProcess/API/Cocoa/_WKWebsitePoliciesInternal.h.
2080         * UIProcess/API/Cocoa/WKWebpagePreferences.mm: Copied from Source/WebKit/UIProcess/API/Cocoa/_WKWebsitePolicies.mm.
2081
2082         Introduce WKWebpagePreferences.
2083
2084         (+[WKWebpagePreferences defaultPreferences]):
2085         (-[WKWebpagePreferences dealloc]):
2086         (-[WKWebpagePreferences init]):
2087         (-[WKWebpagePreferences _setContentBlockersEnabled:]):
2088         (-[WKWebpagePreferences _contentBlockersEnabled]):
2089         (-[WKWebpagePreferences _setAllowedAutoplayQuirks:]):
2090         (-[WKWebpagePreferences _allowedAutoplayQuirks]):
2091         (-[WKWebpagePreferences _setAutoplayPolicy:]):
2092         (-[WKWebpagePreferences _autoplayPolicy]):
2093         (-[WKWebpagePreferences _setDeviceOrientationAndMotionAccessPolicy:]):
2094         (-[WKWebpagePreferences _deviceOrientationAndMotionAccessPolicy]):
2095         (-[WKWebpagePreferences _setPopUpPolicy:]):
2096         (-[WKWebpagePreferences _popUpPolicy]):
2097         (-[WKWebpagePreferences _customHeaderFields]):
2098         (-[WKWebpagePreferences _setCustomHeaderFields:]):
2099         (-[WKWebpagePreferences _websiteDataStore]):
2100         (-[WKWebpagePreferences _setWebsiteDataStore:]):
2101         (-[WKWebpagePreferences _setCustomUserAgent:]):
2102         (-[WKWebpagePreferences _customUserAgent]):
2103         (-[WKWebpagePreferences _setCustomJavaScriptUserAgentAsSiteSpecificQuirks:]):
2104         (-[WKWebpagePreferences _customJavaScriptUserAgentAsSiteSpecificQuirks]):
2105         (-[WKWebpagePreferences _setCustomNavigatorPlatform:]):
2106         (-[WKWebpagePreferences _customNavigatorPlatform]):
2107         (-[WKWebpagePreferences _apiObject]):
2108         * UIProcess/API/Cocoa/WKWebpagePreferencesInternal.h: Copied from Source/WebKit/UIProcess/API/Cocoa/_WKWebsitePoliciesInternal.h.
2109         * UIProcess/API/Cocoa/WKWebpagePreferencesPrivate.h: Copied from Source/WebKit/UIProcess/API/Cocoa/_WKWebsitePolicies.h.
2110
2111         Reintroduce all the interfaces currently available on _WKWebsitePolicies as underscore-prefixed SPI on
2112         WKWebpagePreferences.
2113
2114         * UIProcess/API/Cocoa/_WKWebsitePolicies.h:
2115         * UIProcess/API/Cocoa/_WKWebsitePolicies.mm:
2116
2117         Make _WKWebsitePolicies wrap WKWebpagePreferences, and plumb all existing SPI on WKWebsitePolicies through to
2118         WKWebpagePreferences.
2119
2120         (-[_WKWebsitePolicies init]):
2121         (-[_WKWebsitePolicies webpagePreferences]):
2122         (-[_WKWebsitePolicies setContentBlockersEnabled:]):
2123         (-[_WKWebsitePolicies contentBlockersEnabled]):
2124         (-[_WKWebsitePolicies setAllowedAutoplayQuirks:]):
2125         (-[_WKWebsitePolicies allowedAutoplayQuirks]):
2126         (-[_WKWebsitePolicies setAutoplayPolicy:]):
2127         (-[_WKWebsitePolicies autoplayPolicy]):
2128         (-[_WKWebsitePolicies setDeviceOrientationAndMotionAccessPolicy:]):
2129         (-[_WKWebsitePolicies deviceOrientationAndMotionAccessPolicy]):
2130         (-[_WKWebsitePolicies setPopUpPolicy:]):
2131         (-[_WKWebsitePolicies popUpPolicy]):
2132         (-[_WKWebsitePolicies customHeaderFields]):
2133         (-[_WKWebsitePolicies setCustomHeaderFields:]):
2134         (-[_WKWebsitePolicies websiteDataStore]):
2135         (-[_WKWebsitePolicies setWebsiteDataStore:]):
2136         (-[_WKWebsitePolicies setCustomUserAgent:]):
2137         (-[_WKWebsitePolicies customUserAgent]):
2138         (-[_WKWebsitePolicies setCustomJavaScriptUserAgentAsSiteSpecificQuirks:]):
2139         (-[_WKWebsitePolicies customJavaScriptUserAgentAsSiteSpecificQuirks]):
2140         (-[_WKWebsitePolicies setCustomNavigatorPlatform:]):
2141         (-[_WKWebsitePolicies customNavigatorPlatform]):
2142         (-[_WKWebsitePolicies description]):
2143         (-[_WKWebsitePolicies _apiObject]):
2144         (-[_WKWebsitePolicies dealloc]): Deleted.
2145         * UIProcess/API/Cocoa/_WKWebsitePoliciesInternal.h:
2146         * UIProcess/Cocoa/NavigationState.mm:
2147         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
2148         * WebKit.xcodeproj/project.pbxproj:
2149
2150 2019-04-01  Wenson Hsieh  <wenson_hsieh@apple.com>
2151
2152         Unable to copy and paste a PDF from Notes into Mail compose body
2153         https://bugs.webkit.org/show_bug.cgi?id=196442
2154         <rdar://problem/48573098>
2155
2156         Reviewed by Tim Horton.
2157
2158         Relax the -canPerformAction: logic in the case of pasting an attachment. Consider an NSItemProvider to possibly
2159         paste as an attachment if either it has a preferred presentation style of UIPreferredPresentationStyleAttachment
2160         or has a style of UIPreferredPresentationStyleUnspecified, but has a suggested file name.
2161
2162         This allows for the "Paste" action to be shown in the callout menu when copying and pasting a non-text file.
2163
2164         * UIProcess/ios/WKContentViewInteraction.mm:
2165         (-[WKContentView canPerformActionForWebView:withSender:]):
2166
2167 2019-04-01  Tim Horton  <timothy_horton@apple.com>
2168
2169         Make UIWKDocumentContext rects per-character instead of per-word
2170         https://bugs.webkit.org/show_bug.cgi?id=196459
2171
2172         Reviewed by Wenson Hsieh.
2173
2174         * WebProcess/WebPage/ios/WebPageIOS.mm:
2175         (WebKit::WebPage::requestDocumentEditingContext):
2176         Switch to CharacterIterator instead of TextIterator directly, to get
2177         per-character rects as the API requests.
2178
2179 2019-04-01  Chris Dumez  <cdumez@apple.com>
2180
2181         UIProcess crash when a prewarmed process is terminated
2182         https://bugs.webkit.org/show_bug.cgi?id=196451
2183         <rdar://problem/49245471>
2184
2185         Reviewed by Geoffrey Garen.
2186
2187         Stop assuming that WebProcessProxy::m_websiteDataStore is non-null as this is no longer
2188         true after r243384. For example, prewarmed WebContent processe do not get a data store
2189         until they actually get used.
2190
2191         * UIProcess/API/Cocoa/WKProcessPool.mm:
2192         (-[WKProcessPool _prewarmedProcessIdentifier]):
2193         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
2194         * UIProcess/WebProcessPool.cpp:
2195         (WebKit::WebProcessPool::networkProcessIdentifier):
2196         (WebKit::WebProcessPool::prewarmedProcessIdentifier):
2197         * UIProcess/WebProcessPool.h:
2198         * UIProcess/WebProcessProxy.cpp:
2199         (WebKit::WebProcessProxy::didClose):
2200         (WebKit::WebProcessProxy::didFinishLaunching):
2201         (WebKit::WebProcessProxy::requestTermination):
2202         (WebKit::WebProcessProxy::isReleaseLoggingAllowed const):
2203         * UIProcess/WebProcessProxy.h:
2204
2205 2019-04-01  Patrick Griffis  <pgriffis@igalia.com>
2206
2207         [GTK][WPE] Add more websitedatastore directories to web process sandbox
2208         https://bugs.webkit.org/show_bug.cgi?id=196447
2209
2210         Reviewed by Michael Catanzaro.
2211
2212         * UIProcess/Launcher/glib/BubblewrapLauncher.cpp:
2213         (WebKit::bubblewrapSpawn):
2214         * UIProcess/glib/WebProcessProxyGLib.cpp:
2215         (WebKit::WebProcessProxy::platformGetLaunchOptions):
2216
2217 2019-04-01  Per Arne Vollan  <pvollan@apple.com>
2218
2219         [macOS] Crash when loading Twitter with autoplay video enabled.
2220         https://bugs.webkit.org/show_bug.cgi?id=196446
2221         <rdar://problem/49060359>
2222
2223         Reviewed by Brent Fulgham.
2224
2225         This is caused by a syscall violation.
2226
2227         * WebProcess/com.apple.WebProcess.sb.in:
2228
2229 2019-04-01  Patrick Griffis  <pgriffis@igalia.com>
2230
2231         [GTK][WPE] Fix seccomp rule for blacklisting TIOCSTI
2232         https://bugs.webkit.org/show_bug.cgi?id=196297
2233
2234         Reviewed by Michael Catanzaro.
2235
2236         More information can be found here: https://www.exploit-db.com/exploits/46594
2237
2238         Note that this sandbox never made it into production so does not
2239         warrant any CVE specific to WebKit.
2240
2241         * UIProcess/Launcher/glib/BubblewrapLauncher.cpp:
2242         (WebKit::setupSeccomp):
2243
2244 2019-03-31  Wenson Hsieh  <wenson_hsieh@apple.com>
2245
2246         [iOS] Crash when changing inputmode for certain types of focusable elements
2247         https://bugs.webkit.org/show_bug.cgi?id=196431
2248         <rdar://problem/49454962>
2249
2250         Reviewed by Tim Horton.
2251
2252         The crash is happening because WebPage::focusedElementDidChangeInputMode assumes that the document's focused
2253         element must be the same as m_focusedElement in WebPage. However, this is not the case, since m_focusedElement
2254         is only set for certain types of elements that require user input (e.g. text fields, editable content, select
2255         menus, etc.). The function then attempts to dereference m_focusedElement, which may be null if the document's
2256         focused element doesn't fall into one of the aforementioned categories.
2257
2258         To fix this, bail if the element that is changing inputmode is not equal to the WebPage's current focused
2259         element. See below for more details.
2260
2261         Test: fast/forms/change-inputmode-crash.html
2262
2263         * WebProcess/WebPage/WebPage.cpp:
2264         (WebKit::isTextFormControlOrEditableContent):
2265
2266         Clean up some existing logic by introducing a helper method for determining whether an element should
2267         propagate inputmode attribute changes to the UI process. Also, check the element type using type traits instead
2268         of checking against the tag name.
2269
2270         (WebKit::WebPage::elementDidFocus):
2271         (WebKit::WebPage::focusedElementDidChangeInputMode):
2272
2273 2019-03-31  Sam Weinig  <weinig@apple.com>
2274
2275         Remove more i386 specific configurations
2276         https://bugs.webkit.org/show_bug.cgi?id=196430
2277
2278         Reviewed by Alexey Proskuryakov.
2279
2280         * Configurations/BaseTarget.xcconfig:
2281         WK_HAVE_CORE_PREDICTION can now be enabled unconditionally.
2282  
2283         * Configurations/FeatureDefines.xcconfig:
2284         ENABLE_WEB_AUTHN_macosx can now be enabled unconditionally on macOS.
2285
2286 2019-03-31  Andy Estes  <aestes@apple.com>
2287
2288         [iOS] WebKit should consult the navigation response policy delegate before previewing a QuickLook document
2289         https://bugs.webkit.org/show_bug.cgi?id=196433
2290         <rdar://problem/49293305>
2291
2292         Reviewed by Tim Horton.
2293
2294         Added WKWebViewConfiguration SPI for setting the QuickLook navigation response policy
2295         decision behavior. The configuration setting defaults to YES for clients linked on or after
2296         this WebKit change and NO otherwise.
2297
2298         * NetworkProcess/NetworkResourceLoader.cpp:
2299         (WebKit::NetworkResourceLoader::shouldInterruptLoadForCSPFrameAncestorsOrXFrameOptions):
2300         * Shared/WebPreferences.yaml:
2301         * Shared/ios/QuickLookDocumentData.cpp:
2302         (WebKit::QuickLookDocumentData::isEmpty const):
2303         * Shared/ios/QuickLookDocumentData.h:
2304         * UIProcess/API/Cocoa/WKWebView.mm:
2305         (-[WKWebView _initializeWithConfiguration:]):
2306         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
2307         (defaultShouldDecidePolicyBeforeLoadingQuickLookPreview):
2308         (-[WKWebViewConfiguration init]):
2309         (-[WKWebViewConfiguration encodeWithCoder:]):
2310         (-[WKWebViewConfiguration initWithCoder:]):
2311         (-[WKWebViewConfiguration copyWithZone:]):
2312         (-[WKWebViewConfiguration _shouldDecidePolicyBeforeLoadingQuickLookPreview]):
2313         (-[WKWebViewConfiguration _setShouldDecidePolicyBeforeLoadingQuickLookPreview:]):
2314         * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
2315         * UIProcess/Cocoa/VersionChecks.h:
2316         * WebProcess/WebCoreSupport/ios/WebPreviewLoaderClient.cpp:
2317         (WebKit::WebPreviewLoaderClient::didReceiveDataArray):
2318
2319 2019-03-30  Zalan Bujtas  <zalan@apple.com>
2320
2321         [ContentChangeObserver] Subframe load should not reset content observation on the mainframe
2322         https://bugs.webkit.org/show_bug.cgi?id=196408
2323         <rdar://problem/49436797>
2324
2325         Reviewed by Simon Fraser.
2326
2327         Hover intent fails when an unrelated frame commits a load the same time.
2328         cancelPotentialTapInFrame is called from didCommitLoad, but what we are looking for here is the user initiated cancel of a tap (cancelPotentialTap).
2329         (If the current frame navigates away, willDetachPage takes care of canceling the observation.)
2330
2331         * WebProcess/WebPage/ios/WebPageIOS.mm:
2332         (WebKit::WebPage::cancelPotentialTap):
2333         (WebKit::WebPage::cancelPotentialTapInFrame):
2334
2335 2019-03-29  John Wilander  <wilander@apple.com>
2336
2337         Move WebResourceLoadStatisticsStore IPC calls from the UI process to the network process
2338         https://bugs.webkit.org/show_bug.cgi?id=196407
2339         <rdar://problem/47859936>
2340
2341         Reviewed by Brent Fulgham.
2342
2343         The two WebResourceLoadStatisticsStore IPC endpoints were left behind when we
2344         moved Resource Load Statistics from the UI process to the network process. One
2345         of the endpoints is the message RequestStorageAccessUnderOpener which underpins
2346         our compatibility fix for federated logins using popups. This patch redirects
2347         these IPC calls to the network process and cleans up some assumptions around
2348         them.
2349
2350         * CMakeLists.txt:
2351             Removed the old IPC receiver.
2352         * DerivedSources.make:
2353             Removed the old IPC receiver.
2354         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
2355         (WebKit::WebResourceLoadStatisticsStore::requestUpdate): Deleted.
2356             This is no longer needed since there is a dedicated update mechanism
2357             that actually sends the update.
2358         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
2359         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
2360         (WebKit::NetworkConnectionToWebProcess::resourceLoadStatisticsUpdated):
2361         (WebKit::NetworkConnectionToWebProcess::requestStorageAccessUnderOpener):
2362             Two new IPC receivers to pipe the calls to the network process.
2363         (WebKit::NetworkConnectionToWebProcess::requestResourceLoadStatisticsUpdate): Deleted.
2364             NetworkConnectionToWebProcess::resourceLoadStatisticsUpdated now serves
2365             this purpose.
2366         * NetworkProcess/NetworkConnectionToWebProcess.h:
2367         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
2368         * UIProcess/WebResourceLoadStatisticsStore.messages.in: Removed.
2369             Removed the old IPC receiver.
2370         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
2371         * WebKit.xcodeproj/project.pbxproj:
2372         * WebProcess/InjectedBundle/API/c/WKBundle.cpp:
2373         (WKBundleResourceLoadStatisticsNotifyObserver):
2374             Function name update.
2375         * WebProcess/WebProcess.cpp:
2376             Now calls IPC to the network process instead of the UI process.
2377
2378 2019-03-29  Myles C. Maxfield  <mmaxfield@apple.com>
2379
2380         Delete WebMetal implementation in favor of WebGPU
2381         https://bugs.webkit.org/show_bug.cgi?id=195418
2382
2383         Reviewed by Dean Jackson.
2384
2385         * Configurations/FeatureDefines.xcconfig:
2386         * Shared/WebPreferences.yaml:
2387         * WebProcess/InjectedBundle/InjectedBundle.cpp:
2388         (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner):
2389
2390 2019-03-29  Takashi Komori  <Takashi.Komori@sony.com>
2391
2392         [Curl] Add Server Trust Evaluation Support.
2393         https://bugs.webkit.org/show_bug.cgi?id=191646
2394
2395         Reviewed by Fujii Hironori.
2396
2397         Tests: http/tests/ssl/iframe-upgrade.https.html
2398                http/tests/ssl/mixedContent/insecure-websocket.html
2399                http/tests/ssl/upgrade-origin-usage.html
2400
2401         * NetworkProcess/curl/NetworkDataTaskCurl.cpp:
2402         (WebKit::NetworkDataTaskCurl::curlDidFailWithError):
2403         (WebKit::NetworkDataTaskCurl::tryServerTrustEvaluation):
2404         (WebKit::NetworkDataTaskCurl::restartWithCredential):
2405         * NetworkProcess/curl/NetworkDataTaskCurl.h:
2406
2407 2019-03-29  Cathie Chen  <cathiechen@igalia.com>
2408
2409         Implement ResizeObserver.
2410         https://bugs.webkit.org/show_bug.cgi?id=157743
2411
2412         Reviewed by Simon Fraser.
2413
2414         Add WebPreferences and FeatureDefines for ResizeObserver.
2415
2416         * Configurations/FeatureDefines.xcconfig:
2417         * Shared/WebPreferences.yaml:
2418
2419 2019-03-28  Timothy Hatcher  <timothy@apple.com>
2420
2421         CFDictionary encoder crashes on non-string keys.
2422         https://bugs.webkit.org/show_bug.cgi?id=196388
2423         rdar://problem/49339242
2424
2425         Reviewed by Ryosuke Niwa.
2426
2427         Allow non-string keys in CFDictionary encoding/decoding. Encode the correct
2428         size for dictionaries and arrays when unknown keys or values are skipped.
2429         Allow null array encoding and decoding like dictionary already allowed.
2430
2431         * Shared/cf/ArgumentCodersCF.cpp:
2432         (IPC::encode):
2433         (IPC::decode):
2434
2435 2019-03-28  John Wilander  <wilander@apple.com>
2436
2437         Resource Load Statistics: IPC to the WebsiteDataStore in the UI process from NetworkProcess::deleteWebsiteDataForRegistrableDomains()
2438         https://bugs.webkit.org/show_bug.cgi?id=196281
2439         <rdar://problem/48938748>
2440
2441         Reviewed by Alex Christensen.
2442
2443         The move of Resource Load Statistics to the network process requires that it
2444         calls the UI process when clearing website data (previously the other way
2445         around). This patch achieves that.
2446
2447         Specifically, NetworkProcess::deleteWebsiteDataForRegistrableDomains() now
2448         filters its WebsiteDataTypes down to just the ones applicable for the UI
2449         process and then calls DeleteWebsiteDataInUIProcessForRegistrableDomains over
2450         IPC.
2451
2452         NetworkProcessProxy::deleteWebsiteDataInUIProcessForRegistrableDomains() on
2453         the UI process side makes use of the re-introduced
2454         WebsiteDataStore::fetchDataForRegistrableDomains() function to get the relevant
2455         data records and call WebsiteDataStore::removeData(). The re-introduced
2456         WebsiteDataStore::fetchDataForRegistrableDomains() was removed as dead code in
2457         https://trac.webkit.org/changeset/242056/webkit, then under the name
2458         WebsiteDataStore::fetchDataForTopPrivatelyControlledDomains(). The reason it
2459         was dead code was the lack of IPC call that this patch adds.
2460
2461         * NetworkProcess/NetworkProcess.cpp:
2462         (WebKit::NetworkProcess::deleteWebsiteDataForRegistrableDomains):
2463            Now calls DeleteWebsiteDataInUIProcessForRegistrableDomains over IPC if there
2464            are WebsiteDataTypes applicable to the UI process.
2465         * NetworkProcess/NetworkProcess.h:
2466         * Shared/WebsiteData/WebsiteData.cpp:
2467         (WebKit::WebsiteData::ownerProcess):
2468         (WebKit::WebsiteData::filter):
2469             Convenience functions to manage process ownership of website data types.
2470         * Shared/WebsiteData/WebsiteData.h:
2471         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
2472         (WKWebsiteDataStoreStatisticsHasLocalStorage):
2473             Test infrastructure, called by the TestRunner.
2474         * UIProcess/API/C/WKWebsiteDataStoreRef.h:
2475         * UIProcess/Network/NetworkProcessProxy.cpp:
2476         (WebKit::NetworkProcessProxy::deleteWebsiteDataInUIProcessForRegistrableDomains):
2477             New function to be called from the network process.
2478         * UIProcess/Network/NetworkProcessProxy.h:
2479         * UIProcess/Network/NetworkProcessProxy.messages.in:
2480         * UIProcess/WebsiteData/WebsiteDataRecord.cpp:
2481         (WebKit::WebsiteDataRecord::matches const):
2482             Now matches with WebCore::RegistrableDomain instead of a string.
2483         (WebKit::WebsiteDataRecord::matchesTopPrivatelyControlledDomain const): Deleted.
2484             Replaced by WebsiteDataRecord::matches().
2485         * UIProcess/WebsiteData/WebsiteDataRecord.h:
2486         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
2487         (WebKit::WebsiteDataStore::fetchDataForRegistrableDomains):
2488             Re-introduced. It was removed as dead code in r242056.
2489         (WebKit::computeNetworkProcessAccessTypeForDataRemoval):
2490         (WebKit::WebsiteDataStore::hasLocalStorageForTesting const):
2491             Test infrastructure, called by the TestRunner.
2492         * UIProcess/WebsiteData/WebsiteDataStore.h:
2493
2494 2019-03-28  Jiewen Tan  <jiewen_tan@apple.com>
2495
2496         API::Data::createWithoutCopying should do a null check before calling CFRelease
2497         https://bugs.webkit.org/show_bug.cgi?id=196276
2498         <rdar://problem/48059859>
2499
2500         Reviewed by Alex Christensen.
2501
2502         * Shared/Cocoa/APIDataCocoa.mm:
2503         (API::Data::createWithoutCopying):
2504
2505 2019-03-28  Per Arne Vollan  <pvollan@apple.com>
2506
2507         [iOS] Automatic focus of input field is flaky
2508         https://bugs.webkit.org/show_bug.cgi?id=196302
2509
2510         Reviewed by Brent Fulgham.
2511
2512         Sometimes the status of whether a keyboard is connected can be incorrect, both in the UI process, and in
2513         the WebContent process. Fix this by sending the keyboard status to the WebContent process as part of the
2514         Web page creation parameters. Stop caching the keyboard status in the Web process proxy, and call
2515         [UIKeyboard isInHardwareKeyboardMode] instead, since this method is swizzled in the test harness.
2516
2517         * Shared/WebPageCreationParameters.cpp:
2518         (WebKit::WebPageCreationParameters::encode const):
2519         (WebKit::WebPageCreationParameters::decode):
2520         * Shared/WebPageCreationParameters.h:
2521         * UIProcess/API/Cocoa/WKWebView.mm:
2522         (hardwareKeyboardAvailabilityChangedCallback):
2523         * UIProcess/WebPageProxy.cpp:
2524         (WebKit::WebPageProxy::creationParameters):
2525         * UIProcess/WebPageProxy.h:
2526         * UIProcess/WebProcessProxy.cpp:
2527         * UIProcess/WebProcessProxy.h:
2528         (WebKit::WebProcessProxy::setKeyboardIsAttached): Deleted.
2529         (WebKit::WebProcessProxy::keyboardIsAttached const): Deleted.
2530         * UIProcess/ios/WKContentViewInteraction.mm:
2531         (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
2532         * UIProcess/ios/WebPageProxyIOS.mm:
2533         (WebKit::WebPageProxy::isInHardwareKeyboardMode):
2534         (WebKit::WebPageProxy::applicationWillEnterForeground):
2535         * WebProcess/WebPage/WebPage.cpp:
2536         * WebProcess/WebPage/WebPage.h:
2537
2538 2019-03-28  Tim Horton  <timothy_horton@apple.com>
2539
2540         Fix the build.
2541
2542         * UIProcess/ios/WKActionSheetAssistant.mm:
2543         (-[WKActionSheetAssistant showImageSheet]):
2544         * UIProcess/ios/WKContentViewInteraction.mm:
2545         (-[WKContentView actionSheetAssistant:showCustomSheetForElement:]):
2546
2547 2019-03-28  Michael Catanzaro  <mcatanzaro@igalia.com>
2548
2549         [WPE][GTK] webkit_web_resource_get_data_finish can return NULL without setting error
2550         https://bugs.webkit.org/show_bug.cgi?id=186276
2551
2552         Reviewed by Carlos Garcia Campos.
2553
2554         Currently it's possible for webkit_web_resource_get_data_finish() to return NULL without
2555         setting the error parameter. This is illegal because it is an API guarantee (and a GObject
2556         convention) that if an error parameter exists, it should be set whenever a function call
2557         returns NULL. Epiphany correctly dereferences the error in this case without checking if it
2558         is NULL, because it knows it does not have to, and crashes. Fix this. We'll return a byte
2559         array of length 1 containing a NUL character. This isn't great, but there's not really any
2560         better solution without deprecating the API or returning an error code to indicate an empty
2561         resource, and it at least fixes the Epiphany crash.
2562
2563         This does not fix bug #186276, in which this function incorrectly returns no data when it
2564         ought to. But that is a different bug. Now, at least we won't crash when no data is
2565         available.
2566
2567         * UIProcess/API/glib/WebKitWebResource.cpp:
2568         (resourceDataCallback):
2569
2570 2019-03-28  Daniel Bates  <dabates@apple.com>
2571
2572         [iPad] Tapping on a popup form control may not show a popover
2573         https://bugs.webkit.org/show_bug.cgi?id=196322
2574         <rdar://problem/49229632>
2575
2576         Reviewed by Wenson Hsieh.
2577
2578         Stop taking advantage of -[WKContentView inputView] being called when we invoke -reloadInputViews
2579         to "lazily" allocate the input peripheral for the currently focused element. In theory, UIKit only
2580         needs to call -inputView when it actually needs to display the input view (the keyboard). For
2581         popup menu buttons, like <select>, no keyboard is needed. Instead we should create the peripheral
2582         as part of the logic in the UI process to focus a new element before we call -reloadInputViews.
2583
2584         * UIProcess/ios/WKContentViewInteraction.mm:
2585         (-[WKContentView inputView]): Extract logic to allocate the peripheral from here and moved it to createInputPeripheralWithView().
2586         (-[WKContentView accessoryTab:]): While I am here, add a FIXME comment to explain why we need to
2587         end the input sessions and nullify the input peripheral before we tell the web process to switch
2588         focus as opposed to letting this happen after the web process tells us it focused a new element.
2589         (createInputPeripheralWithView): Added.
2590         (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
2591         Write in terms of createInputPeripheralWithView(). Create the input peripheral after becoming
2592         first responder because creating the peripheral has known side-effects: for popup buttons it
2593         tells the popup controller to present the popover. For key input to popovers to work from the get-go,
2594         the content view must be the first responder. See <https://bugs.webkit.org/show_bug.cgi?id=196272>
2595         for more details.
2596
2597 2019-03-28  Víctor Manuel Jáquez Leal  <vjaquez@igalia.com>
2598
2599         Silence lot of warnings when compiling with clang
2600         https://bugs.webkit.org/show_bug.cgi?id=196310
2601
2602         Reviewed by Michael Catanzaro.
2603
2604         * UIProcess/API/glib/WebKitInjectedBundleClient.cpp: add missing
2605         override clause.
2606         * WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.h: add
2607         missing override clause.
2608
2609 2019-03-27  Ryosuke Niwa  <rniwa@webkit.org>
2610
2611         [macOS] Select element doesn't show popup if select element had lost focus while popup was previosuly shown
2612         https://bugs.webkit.org/show_bug.cgi?id=196336
2613
2614         Reviewed by Tim Horton.
2615
2616         The bug was caused by WebPopupMenu::hide never notifying PopupClient that the popup had been dismissed.
2617         This resulted in RenderMenuList::m_popupIsVisible to be never reset.
2618
2619         Also fixed a bug in WebPopupMenuProxyMac::hidePopupMenu that this function was never dismissing
2620         the popup as the selector "dismissPopUp", on the contrary to its name, does not dimiss the popup.
2621         Send cancelTracking to NSMenu instead, which DOES dismiss the popup.
2622
2623         Tests: fast/forms/select/mac-wk2/blur-dismisses-select-popup.html
2624                fast/forms/select/mac-wk2/open-select-popup-after-dismissing-by-blur.html
2625
2626         * UIProcess/mac/WebPopupMenuProxyMac.mm:
2627         (WebKit::WebPopupMenuProxyMac::hidePopupMenu):
2628         * WebProcess/WebCoreSupport/WebPopupMenu.cpp:
2629         (WebKit::WebPopupMenu::hide):
2630
2631 2019-03-27  Dean Jackson  <dino@apple.com>
2632
2633         [ARKit] Black view when opening a 3D model usdz file in new tab
2634         https://bugs.webkit.org/show_bug.cgi?id=196333
2635         <rdar://problem/47693367>
2636
2637         Reviewed by Tim Horton.
2638
2639         When opening a new WKSystemPreviewView, we were exiting if there was no
2640         presentingViewController. This code was unnecessary, and causing blank
2641         content when opening a new tab.
2642
2643         * UIProcess/ios/WKSystemPreviewView.mm:
2644         (-[WKSystemPreviewView web_setContentProviderData:suggestedFilename:]):
2645         Remove the code looking for a presentingViewController.
2646
2647 2019-03-27  Wenson Hsieh  <wenson_hsieh@apple.com>
2648
2649         Need a way to include WebKitAdditions code in WebKit API headers
2650         https://bugs.webkit.org/show_bug.cgi?id=196173
2651
2652         Reviewed by Tim Horton.
2653
2654         Introduce a mechanism that allows us to insert code from WebKitAdditions into public or private SDK headers
2655         using `#import`s of the form:
2656
2657         ```
2658         #if USE(APPLE_INTERNAL_SDK)
2659         #import <WebKitAdditions/WKWebViewConfigurationAdditions.h>
2660         #endif
2661         ```
2662
2663         The resulting header in the built products directory will contain the contents of the imported file inserted in
2664         place of the `#if USE(APPLE_INTERNAL_SDK) … #endif` block; however, when building with the Apple internal SDK,
2665         the additions header content will be imported by the usual means.
2666
2667         * mac/postprocess-framework-headers.sh:
2668         * mac/replace-webkit-additions-includes.py: Added.
2669
2670         Add a step when post-processing framework headers to replace instances of `#if USE(APPLE_INTERNAL_SDK) … #endif`
2671         with the text content of the additions files. The replacement script first searches in the built products
2672         directory for the matching additions file, and falls back to the SDK if no matching file is found. If neither
2673         are present (e.g. a build using the public SDK), then the block is simply replaced by the empty string.
2674
2675         (read_content_from_webkit_additions):
2676         (main):
2677
2678 2019-03-27  Andy Estes  <aestes@apple.com>
2679
2680         REGRESSION (r242686): package-root creates roots with broken symlinks in WebKit.framework/XPCServices/
2681         https://bugs.webkit.org/show_bug.cgi?id=196317
2682
2683         Reviewed by Dan Bernstein.
2684
2685         Removed some remnants of the Storage Process.
2686
2687         * Configurations/BaseTarget.xcconfig:
2688         * Resources/SandboxProfiles/ios/com.apple.WebKit.Storage.sb: Removed.
2689         * WebKit.xcodeproj/project.pbxproj:
2690
2691 2019-03-27  Keith Rollin  <krollin@apple.com>
2692
2693         Include the CFNetworking task UUID to the NSError when a resource-load fails
2694         https://bugs.webkit.org/show_bug.cgi?id=196156
2695
2696         Reviewed by Alex Christensen.
2697
2698         In order to help track the connection between a failed resource-load
2699         and a user-visible error message, include the CFNetworking task UUID
2700         in the associated error as an element of the userInfo property. This
2701         can then be pulled out and reported in the logging at the point the
2702         error is reported to the user.
2703
2704         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
2705         (-[WKNetworkSessionDelegate URLSession:task:didCompleteWithError:]):
2706
2707 2019-03-27  Chris Dumez  <cdumez@apple.com>
2708
2709         [ iOS Sim ] REGRESSION (r242277) Layout Test http/tests/cookies/same-site/lax-samesite-cookie-after-cross-site-history-load.php is a flaky timeout
2710         https://bugs.webkit.org/show_bug.cgi?id=195425
2711         <rdar://problem/48682403>
2712
2713         Reviewed by Alex Christensen.
2714
2715         When process-swapping on history navigation, we lookup the WebProcessProxy we'd like to use from the
2716         process identifier that is saved on the WebBackForwardListItem, to try and load the item in the process
2717         in which it was previously loaded. However, we were failing to check if the WebProcess in question was
2718         still running so we could potentially try to use a process that's already exited.
2719
2720         * UIProcess/WebProcessPool.cpp:
2721         (WebKit::WebProcessPool::processForNavigationInternal):
2722
2723 2019-03-27  Zalan Bujtas  <zalan@apple.com>
2724
2725         [ContentChangeObserver] Always dispatch the synthetic click asynchronously
2726         https://bugs.webkit.org/show_bug.cgi?id=196278
2727         <rdar://problem/49299968>
2728
2729         Reviewed by Simon Fraser.
2730
2731         This patch ensures that all completeSyntheticClick() calls happen in an asynchronous manner (unless the feature is turned off).
2732
2733         * WebProcess/WebPage/ios/WebPageIOS.mm:
2734         (WebKit::dispatchSyntheticMouseMove):
2735         (WebKit::WebPage::handleSyntheticClick):
2736
2737 2019-03-27  Tim Horton  <timothy_horton@apple.com>
2738
2739         Fix some more deprecation warnings in WKDrawingView
2740         https://bugs.webkit.org/show_bug.cgi?id=196282
2741         <rdar://problem/47637608>
2742
2743         Reviewed by Wenson Hsieh.
2744
2745         * Platform/spi/ios/PencilKitSPI.h:
2746         * SourcesCocoa.txt:
2747         * UIProcess/ios/PencilKitSoftLink.h:
2748         * UIProcess/ios/PencilKitSoftLink.mm:
2749         * UIProcess/ios/WKContentViewInteraction.mm:
2750         * UIProcess/ios/WKDrawingCoordinator.h:
2751         * UIProcess/ios/WKDrawingCoordinator.mm:
2752         (-[WKDrawingCoordinator initWithContentView:]):
2753         (-[WKDrawingCoordinator currentInk]):
2754         (-[WKDrawingCoordinator undoManagerForInkPicker:]):
2755         (-[WKDrawingCoordinator containingViewForInkPicker:]):
2756         (-[WKDrawingCoordinator inkPickerDidToggleRuler:]):
2757         (-[WKDrawingCoordinator inkPickerDidChangeInk:]):
2758         (-[WKDrawingCoordinator installInkPickerForDrawing:]):
2759         (-[WKDrawingCoordinator uninstallInkPicker]):
2760         (-[WKDrawingCoordinator inkPicker]): Deleted.
2761         (-[WKDrawingCoordinator didChangeRulerState:]): Deleted.
2762         (-[WKDrawingCoordinator didChangeInk:]): Deleted.
2763         * UIProcess/ios/WKDrawingView.mm:
2764         (-[WKDrawingView _canvasViewWillBeginDrawing:]):
2765         * UIProcess/ios/WKInkPickerView.h: Removed.
2766         * UIProcess/ios/WKInkPickerView.mm: Removed.
2767         * WebKit.xcodeproj/project.pbxproj:
2768         Adopt the new names.
2769
2770 2019-03-27  Carlos Garcia Campos  <cgarcia@igalia.com>
2771
2772         Geolocation request not complete when watch request was started in a different web process
2773         https://bugs.webkit.org/show_bug.cgi?id=195996
2774
2775         Reviewed by Alex Christensen.
2776
2777         In WebGeolocationManagerProxy::startUpdating() we do nothing when the provider is already updating. We should
2778         reply with a DidChangePosition using the last known position, if available. If we are updating, but we still
2779         don't have a known position, the request will be completed when
2780         WebGeolocationManagerProxy::providerDidChangePosition() is called since it always notifies all web
2781         processes.
2782
2783         * UIProcess/WebGeolocationManagerProxy.cpp:
2784         (WebKit::WebGeolocationManagerProxy::providerDidChangePosition): Cache the position.
2785         (WebKit::WebGeolocationManagerProxy::startUpdating): Reply using cached position if already known.
2786         * UIProcess/WebGeolocationManagerProxy.h:
2787         (WebKit::WebGeolocationManagerProxy::lastPosition const): Return cached position.
2788         * WebProcess/WebCoreSupport/WebGeolocationClient.cpp:
2789         (WebKit::WebGeolocationClient::lastPosition): Remove the FIXME since we don't want this feature.
2790
2791 2019-03-26  Brent Fulgham  <bfulgham@apple.com>
2792
2793         [macOS] Correct kerberos-related sandbox violations
2794         https://bugs.webkit.org/show_bug.cgi?id=196279
2795         <rdar://problem/48622502>
2796
2797         Reviewed by Per Arne Vollan.
2798
2799         We need to allow communications with a Kerberos-related service on macOS
2800         until <rdar://problem/35542803> is fixed.
2801
2802         * NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in:
2803
2804 2019-03-26  Chris Dumez  <cdumez@apple.com>
2805
2806         [macOS] The network process is not exiting reliably when the WebProcessPool is destroyed
2807         https://bugs.webkit.org/show_bug.cgi?id=196277
2808         <rdar://problem/49127581>
2809
2810         Reviewed by Alex Christensen.
2811
2812         When, an AuxiliaryProcess receives the AuxiliaryProcess::Terminate IPC, it calls stopRunLoop()
2813         to exit. WebProcess overrides AuxiliaryProcess::stopRunLoop() to call exit(0) on the main
2814         thread. Other auxiliary processes such as the NetworkProcess would end up calling
2815         platformStopRunLoop(). On iOS and iOSMac, platformStopRunLoop() calls XPCServiceExit(), which
2816         makes sense since auxiliary processes run their run loop by calling xpc_main(). However, on
2817         macOS, platformStopRunLoop() was calling RunLoop::main().stop() to exit instead, which was
2818         unreliable as demonstrated by the test app attached to the radar.
2819
2820         Updating platformStopRunLoop() to call XPCServiceExit() on macOS fixes the problem and I now
2821         see the NetworkProcess exiting reliably there. This is the approach I have chosen in this
2822         patch since it appears to be reliable and it makes the code consistent on all Cocoa platforms.
2823
2824         * Shared/AuxiliaryProcess.cpp:
2825         * Shared/Cocoa/AuxiliaryProcessCocoa.mm:
2826         (WebKit::AuxiliaryProcess::platformStopRunLoop):
2827         * Shared/ios/AuxiliaryProcessIOS.mm:
2828         (WebKit::AuxiliaryProcess::platformStopRunLoop): Deleted.
2829         * Shared/mac/AuxiliaryProcessMac.mm:
2830         (WebKit::AuxiliaryProcess::platformStopRunLoop): Deleted.
2831
2832 2019-03-26  Keith Rollin  <krollin@apple.com>
2833
2834         Inhibit CFNetwork logging in private sessions
2835         https://bugs.webkit.org/show_bug.cgi?id=196268
2836         <rdar://problem/48210793>
2837
2838         Reviewed by Alex Christensen.
2839
2840         Before performing any logging, the NetworkProcess checks to see if
2841         it's performing an operation associated with a private (ephemeral)
2842         browsing session. If so, it skips the logging. However, networking
2843         layers below the NetworkProcess don't know about private browsing, so
2844         they would still perform their own logging. CFNetwork now has a flag
2845         that lets us control that, so set it to False if private browsing.
2846
2847         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
2848         (WebKit::configurationForSessionID):
2849
2850 2019-03-26  Chris Dumez  <cdumez@apple.com>
2851
2852         Add basic layout test coverage for File Picker on iOS
2853         https://bugs.webkit.org/show_bug.cgi?id=196265
2854
2855         Reviewed by Wenson Hsieh.
2856
2857         Add layout test infrastructure to test the file picker on iOS.
2858
2859         * UIProcess/API/Cocoa/WKWebView.mm:
2860         (-[WKWebView _dismissFilePicker]):
2861         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
2862         * UIProcess/ios/WKContentViewInteraction.h:
2863         * UIProcess/ios/WKContentViewInteraction.mm:
2864         (-[WKContentView dismissFilePicker]):
2865         (-[WKContentView _contentsOfUserInterfaceItem:]):
2866         * UIProcess/ios/forms/WKFileUploadPanel.h:
2867         * UIProcess/ios/forms/WKFileUploadPanel.mm:
2868         (-[WKFileUploadPanel currentAvailableActionTitles]):
2869
2870 2019-03-26  Daniel Bates  <dabates@apple.com>
2871
2872         [iOS][WK2] Use a better concept to describe the reason we defer zooming a focused element: selectabiltiy
2873         https://bugs.webkit.org/show_bug.cgi?id=196264
2874
2875         Reviewed by Wenson Hsieh.
2876
2877         Rename shouldDeferZoomingToSelectionWhenRevealingFocusedElement() to mayContainSelectableText() to describe
2878         the criterion that we will use to decide whether to defer zooming or not. We defer zooming only for elements
2879         that may support text selection on initial focus because we do not have an up-to-date selection rect at that
2880         time. For element, like <select>, that do not support text selection, we can zoom them immediately when focused.
2881
2882         * UIProcess/ios/WKContentViewInteraction.mm:
2883         (mayContainSelectableText): Renamed from shouldDeferZoomingToSelectionWhenRevealingFocusedElement.
2884         List all the input types in the switch block and remove the default case to force the compiler to check that we
2885         covered all cases. This will prevent unforseen keyboard issues (why isn't the keyboard shown? or why is the keyboard shown?)
2886         for future input types that we may add.
2887         (rectToRevealWhenZoomingToFocusedElement): Update for renaming.
2888         (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]): Add a
2889         comment to explain why we may need to defer the zoom: the focused element supports text selection and we need
2890         to wait for the web process to call back to provide an up-to-date selection rect for us to zoom and reveal.
2891         (-[WKContentView _didReceiveEditorStateUpdateAfterFocus]): Update for renaming.
2892         (shouldDeferZoomingToSelectionWhenRevealingFocusedElement): Deleted.
2893
2894 2019-03-26  Wenson Hsieh  <wenson_hsieh@apple.com>
2895
2896         Implement async paste method on UIWKInteractionViewProtocol
2897         https://bugs.webkit.org/show_bug.cgi?id=196267
2898         <rdar://problem/49236346>
2899
2900         Reviewed by Tim Horton.
2901
2902         Implement a new UIWKInteractionViewProtocol hook to perform a paste command, and invoke the given completion
2903         handler when pasting is finished.
2904
2905         Test: UIPasteboardTests.PasteWithCompletionHandler
2906
2907         * UIProcess/ios/WKContentViewInteraction.mm:
2908         (-[WKContentView pasteWithCompletionHandler:]):
2909
2910 2019-03-26  Per Arne Vollan  <pvollan@apple.com>
2911
2912         [macOS] Fix sandbox violations
2913         https://bugs.webkit.org/show_bug.cgi?id=196262
2914         <rdar://problem/47738015>
2915
2916         Reviewed by Brent Fulgham.
2917
2918         Fix various observed sandbox violations.
2919
2920         * NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in:
2921         * WebProcess/com.apple.WebProcess.sb.in:
2922
2923 2019-03-26  Tomoki Imai  <Tomoki.Imai@sony.com>
2924
2925         Assertion failure !isInAcceleratedCompositingMode() in DrawingAreaProxyCoordinatedGraphics::incorporateUpdate when forceCompositingMode is turned on
2926         https://bugs.webkit.org/show_bug.cgi?id=195879
2927
2928         Reviewed by Carlos Garcia Campos.
2929
2930         The root cause is that DrawingAreaProxyCoordinatedGraphics::isInAcceleratedCompositingMode checks both of alwaysUseCompositing() and !m_layerTreeContext.isEmpty().
2931         alwaysUseCompositing() refers preferences, which is written by the application (UIProcess).
2932         On the other hand, m_layerTreeContext is changed when it receives enterAcceleratedCompositingMode/exitAcceleratedCompositingMode from WebProcess.
2933
2934         It results when we set forceCompositingMode and acceleratedCompositingEnabled to true, WebProcess and UIProcess is out of sync until WebProcess sends enterAcceleratedCompositingMode message.
2935         In such situation, WebProcess sends incorporateUpdate to UIProcess because WebProcess is in non-AC mode, but isInAcceleratedCompositingMode becomes true in UIProcess side.
2936
2937         * UIProcess/CoordinatedGraphics/DrawingAreaProxyCoordinatedGraphics.cpp:
2938         (WebKit::DrawingAreaProxyCoordinatedGraphics::~DrawingAreaProxyCoordinatedGraphics): Should call exitAcceleratedCompositingMode even when alwaysUseCompositing is true.
2939         (WebKit::DrawingAreaProxyCoordinatedGraphics::enterAcceleratedCompositingMode): enterAcceleratedCompositingMode should check enterAcceleratedCompositingMode is not called twice.
2940         * UIProcess/CoordinatedGraphics/DrawingAreaProxyCoordinatedGraphics.h: Remove alwaysUseCompositing from isInAcceleratedCompositingMode
2941
2942 2019-03-26  Antoine Quint  <graouts@apple.com>
2943
2944         Remove mousemoveEventHandlingPreventsDefault internal setting and quirk
2945         https://bugs.webkit.org/show_bug.cgi?id=196254
2946         <rdar://problem/49124334>
2947
2948         Reviewed by Dean Jackson.
2949
2950         * Shared/WebPreferences.yaml:
2951
2952 2019-03-26  Philippe Normand  <pnormand@igalia.com>
2953
2954         [WPE][Qt] Uninitialized racy ViewBackend
2955         https://bugs.webkit.org/show_bug.cgi?id=196247
2956
2957         Reviewed by Carlos Garcia Campos.
2958
2959         * UIProcess/API/wpe/qt/WPEQtView.h: Initialize the backend pointer to nullptr.
2960
2961 2019-03-26  Carlos Garcia Campos  <cgarcia@igalia.com>
2962
2963         Unreviewed. Fix typo in GLib geolocation API after r243285.
2964
2965         gelocation -> geolocation.
2966
2967         * UIProcess/API/glib/WebKitGeolocationManager.cpp:
2968         (webkit_geolocation_manager_class_init):
2969         (webkit_geolocation_manager_update_position):
2970         (webkit_geolocation_manager_failed):
2971         (webkit_gelocation_manager_update_position): Deleted.
2972         (webkit_gelocation_manager_failed): Deleted.
2973         * UIProcess/API/gtk/WebKitGeolocationManager.h:
2974         * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt:
2975         * UIProcess/API/wpe/WebKitGeolocationManager.h:
2976         * UIProcess/API/wpe/docs/wpe-1.0-sections.txt:
2977
2978 2019-03-26  Patrick Griffis  <pgriffis@igalia.com>
2979
2980         [GTK][WPE] Disable process warming
2981         https://bugs.webkit.org/show_bug.cgi?id=196208
2982
2983         Reviewed by Chris Dumez.
2984
2985         Fixes crash caused by r243384.
2986
2987         Process warming is incompatible with our launcher as it expects a valid
2988         WebsiteDataStore at initialization time for sandbox permissions.
2989
2990         * UIProcess/glib/WebProcessPoolGLib.cpp:
2991         (WebKit::WebProcessPool::platformInitialize):
2992
2993 2019-03-25  Alex Christensen  <achristensen@webkit.org>
2994
2995         Do not terminate the NetworkProcess if a third party application sends a NSCredential with a SecIdentityRef
2996         https://bugs.webkit.org/show_bug.cgi?id=196213
2997
2998         Reviewed by Geoff Garen.
2999
3000         A release assertion added in r230225 was reachable.  I reached it in a unit test that responds to a challenge
3001         with a SecIdentityRef wrapped in an NSCredential.
3002
3003         * Shared/cf/ArgumentCodersCF.cpp:
3004         (IPC::decode):
3005
3006 2019-03-25  Chris Dumez  <cdumez@apple.com>
3007
3008         Regression(r242369) Trying to change profile picture on linked in shows file picker, not the image picker
3009         https://bugs.webkit.org/show_bug.cgi?id=196205
3010         <rdar://problem/49083324>
3011
3012         Reviewed by Geoffrey Garen.
3013
3014         Update our FileUploadPanel code on iOS to properly deal with the MIME types containing
3015         wild cards (e.g. "image/*") that are defined in the HTML specification:
3016         - https://html.spec.whatwg.org/multipage/input.html#attr-input-accept
3017
3018         Previously, we would fail to convert those to UTIs.
3019
3020         * UIProcess/ios/forms/WKFileUploadPanel.mm:
3021
3022 2019-03-25  Tim Horton  <timothy_horton@apple.com>
3023
3024         Remove some now-unnecessary dynamic class lookup
3025         https://bugs.webkit.org/show_bug.cgi?id=196237
3026
3027         Reviewed by Simon Fraser.
3028
3029         * Shared/DocumentEditingContext.mm:
3030         (WebKit::DocumentEditingContext::toPlatformContext):
3031
3032 2019-03-25  Tim Horton  <timothy_horton@apple.com>
3033
3034         Get rid of ENABLE(ANIMATED_KEYBOARD_SCROLLING)
3035         https://bugs.webkit.org/show_bug.cgi?id=196224
3036
3037         Reviewed by Simon Fraser.
3038
3039         * Platform/spi/ios/AccessibilitySupportSPI.h:
3040         * UIProcess/ios/WKKeyboardScrollingAnimator.mm:
3041         (-[WKKeyboardScrollingAnimator invalidate]):
3042         (perpendicularAbsoluteUnitVector):
3043         (-[WKKeyboardScrollingAnimator beginWithEvent:]):
3044         (-[WKKeyboardScrollingAnimator stopAnimatedScroll]):
3045         (-[WKKeyboardScrollingAnimator willStartInteractiveScroll]):
3046         (-[WKKeyboardScrollViewAnimator scrollToContentOffset:animated:]):
3047         (-[WKKeyboardScrollViewAnimator scrollWithScrollToExtentAnimationTo:]):
3048         (-[WKKeyboardScrollingAnimator startRepeatTimerIfNeeded]): Deleted.
3049         (-[WKKeyboardScrollingAnimator stopRepeatTimer]): Deleted.
3050         (-[WKKeyboardScrollingAnimator performDiscreteScroll]): Deleted.
3051
3052 2019-03-25  Fujii Hironori  <Hironori.Fujii@sony.com>
3053
3054         Enable IPC sending and receiving non-default-constructible types
3055         https://bugs.webkit.org/show_bug.cgi?id=196132
3056         <rdar://problem/49229221>
3057
3058         Unreviewed build fix for WinCairo port.
3059
3060         error C2440: '=': cannot convert from 'int' to 'HANDLE'
3061
3062         * Platform/win/SharedMemoryWin.cpp:
3063         (WebKit::SharedMemory::Handle::Handle): std::exchange HANDLE with nullptr, not 0.
3064         (WebKit::SharedMemory::Handle::operator=): Ditto.
3065
3066 2019-03-25  Fujii Hironori  <Hironori.Fujii@sony.com>
3067
3068         [Coordinated Graphics][WinCairo] ASSERTION FAILED: state.id == m_nicosia.state.id
3069         https://bugs.webkit.org/show_bug.cgi?id=196190
3070
3071         Reviewed by Žan Doberšek.
3072
3073         This assertion assumes the pre-committed and the committed scenes
3074         are identical. But, the pre-committed scene is updated in the main
3075         thread. Removed the false assertion.
3076
3077         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
3078         (WebKit::CoordinatedGraphicsScene::purgeGLResources): Remove the
3079         assertion. Removed layers of committed scene, not pre-committed
3080         scene.
3081
3082 2019-03-25  Brady Eidson  <beidson@apple.com>
3083
3084         Add socket-delegate to another entitlements config
3085         rdar://problem/48090350 and https://bugs.webkit.org/show_bug.cgi?id=196227
3086
3087         Reviewed by Geoffrey Garen.
3088
3089         * Configurations/Network-iOSMac.entitlements:
3090
3091 2019-03-25  Commit Queue  <commit-queue@webkit.org>
3092
3093         Unreviewed, rolling out r243465.
3094         https://bugs.webkit.org/show_bug.cgi?id=196226
3095
3096         the test doesn't build (Requested by thorton on #webkit).
3097
3098         Reverted changeset:
3099
3100         "Do not terminate the NetworkProcess if a third party
3101         application sends a NSCredential with a SecIdentityRef"
3102         https://bugs.webkit.org/show_bug.cgi?id=196213
3103         https://trac.webkit.org/changeset/243465
3104
3105 2019-03-25  Simon Fraser  <simon.fraser@apple.com>
3106
3107         REGRESSION (r242687): Flicker when pinch-zooming pages in macOS Safari
3108         https://bugs.webkit.org/show_bug.cgi?id=196126
3109         rdar://problem/49095791
3110
3111         Reviewed by Tim Horton.
3112         
3113         I fumbled the commit after the enum rename. Make this actually work.
3114
3115         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
3116         (WebKit::TiledCoreAnimationDrawingArea::flushLayers):
3117
3118 2019-03-25  Simon Fraser  <simon.fraser@apple.com>
3119
3120         Zoom on macOS is centered around a point lower than the cursor
3121         https://bugs.webkit.org/show_bug.cgi?id=196225
3122         rdar://problem/49213574
3123
3124         Reviewed by Tim Horton.
3125         
3126         The origin handed to ViewGestureController::handleMagnificationGestureEvent is in WKWebView
3127         coordinates, but we end up setting the transform on the RenderView's layer, so we need
3128         to subtract the topContentInset.
3129
3130         * UIProcess/mac/ViewGestureControllerMac.mm:
3131         (WebKit::ViewGestureController::handleMagnificationGestureEvent):
3132
3133 2019-03-25  Alex Christensen  <achristensen@webkit.org>
3134
3135         Do not terminate the NetworkProcess if a third party application sends a NSCredential with a SecIdentityRef
3136         https://bugs.webkit.org/show_bug.cgi?id=196213
3137
3138         Reviewed by Geoff Garen.
3139
3140         A release assertion added in r230225 was reachable.  I reached it in a unit test that responds to a challenge
3141         with a SecIdentityRef wrapped in an NSCredential.
3142
3143         * Shared/cf/ArgumentCodersCF.cpp:
3144         (IPC::decode):
3145
3146 2019-03-25  Chris Dumez  <cdumez@apple.com>
3147
3148         Get rid of WebPage::m_shouldResetDrawingAreaAfterSuspend flag
3149         https://bugs.webkit.org/show_bug.cgi?id=196210
3150         <rdar://problem/48681326>
3151
3152         Reviewed by Geoffrey Garen.
3153
3154         Get rid of WebPage::m_shouldResetDrawingAreaAfterSuspend flag and use the drawing area identifier
3155         instead to reset the DrawingArea in the WebProcess whenever the UIProcess did.
3156
3157         This is less error-prone and guarantees that the WebProcess and the UIProcess can reliably
3158         communicate via DrawingArea IPC.
3159
3160         * WebProcess/WebPage/WebPage.cpp:
3161         (WebKit::WebPage::reinitializeWebPage):
3162         (WebKit::WebPage::setIsSuspended):
3163         * WebProcess/WebPage/WebPage.h:
3164
3165 2019-03-25  Alex Christensen  <achristensen@webkit.org>
3166
3167         Enable IPC sending and receiving non-default-constructible types
3168         https://bugs.webkit.org/show_bug.cgi?id=196132
3169
3170         Reviewed by Geoff Garen.
3171
3172         * Platform/IPC/ArgumentCoder.h:
3173         * Platform/IPC/ArgumentCoders.h:
3174         (IPC::TupleEncoder::encode):
3175         (IPC::tupleFromTupleAndObject):
3176         (IPC::TupleDecoderImpl::decode):
3177         (IPC::TupleDecoderImpl<Type>::decode):
3178         (IPC::TupleDecoder::decode):
3179         (IPC::TupleDecoder<0>::decode):
3180         (IPC::TupleCoder::encode): Deleted.
3181         (IPC::TupleCoder::decode): Deleted.
3182         * Platform/IPC/Connection.h:
3183         (IPC::Connection::sendWithReply):
3184         (IPC::TupleMover::move):
3185         (IPC::moveTuple):
3186         (IPC::Connection::sendSync):
3187         * Platform/IPC/Decoder.h:
3188         (IPC::Decoder::decode):
3189         (IPC::Decoder::operator>>):
3190         * Platform/IPC/HandleMessage.h:
3191         (IPC::handleMessage):
3192         (IPC::handleMessageSynchronous):
3193         (IPC::handleMessageSynchronousWantsConnection):
3194         (IPC::handleMessageAsync):
3195         * Platform/SharedMemory.h:
3196         * Scripts/webkit/LegacyMessages-expected.h:
3197         * Scripts/webkit/Messages-expected.h:
3198         * Scripts/webkit/MessagesSuperclass-expected.h:
3199         * Scripts/webkit/messages.py:
3200         * Shared/Databases/IndexedDB/WebIDBResult.h:
3201         * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.h:
3202         * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm:
3203         * Shared/ShareableBitmap.h:
3204         * Shared/ShareableResource.h:
3205         * Shared/UpdateInfo.h:
3206         * Shared/WebEvent.h:
3207         * Shared/WebProcessCreationParameters.cpp:
3208         * Shared/WebProcessCreationParameters.h:
3209         * Shared/mac/SecItemResponseData.cpp:
3210         (WebKit::SecItemResponseData::SecItemResponseData):
3211         (WebKit::SecItemResponseData::decode):
3212         * Shared/mac/SecItemResponseData.h:
3213         * WebProcess/MediaStream/MediaDeviceSandboxExtensions.h:
3214
3215 2019-03-25  Tim Horton  <timothy_horton@apple.com>
3216
3217         Animated keyboard scrolling is extremely chaotic
3218         https://bugs.webkit.org/show_bug.cgi?id=196164
3219         <rdar://problem/48702444>
3220
3221         Reviewed by Simon Fraser.
3222
3223         * UIProcess/ios/WKContentViewInteraction.mm:
3224         (-[WKContentView _interpretKeyEvent:isCharEvent:]):
3225         Consume keyboard events instead of interpreting them traditionally
3226         if WKKeyboardScrollingAnimator is animating.
3227
3228         * UIProcess/ios/WKKeyboardScrollingAnimator.h:
3229         * UIProcess/ios/WKKeyboardScrollingAnimator.mm:
3230         (-[WKKeyboardScrollingAnimator beginWithEvent:]):
3231         (-[WKKeyboardScrollingAnimator handleKeyEvent:]):
3232         (-[WKKeyboardScrollingAnimator stopAnimatedScroll]):
3233         (-[WKKeyboardScrollingAnimator scrollTriggeringKeyIsPressed]):
3234         (-[WKKeyboardScrollingAnimator displayLinkFired:]):
3235         (-[WKKeyboardScrollViewAnimator scrollTriggeringKeyIsPressed]):
3236         Expose the current state of interactive scrolling, and rename the related member.
3237
3238 2019-03-25  Keith Rollin  <krollin@apple.com>
3239
3240         Add WebKit logging for first paint and other interesting layout milestones
3241         https://bugs.webkit.org/show_bug.cgi?id=196159
3242         <rdar://problem/49128952>
3243
3244         Reviewed by Simon Fraser.
3245
3246         Add some logging to indicate what layout milestones have been reached.
3247         This should help us determine if there's a client, rendering, layout,
3248         or some other issue when page content does not appear in the client
3249         window.
3250
3251         The logging is being added to
3252         WebFrameLoaderClient::dispatchDidReachLayoutMilestone. This seems like
3253         a nice central place to capture layout milestones. However, it will
3254         only log notifications that are being sent to clients. It does not
3255         indicate all milestones that have occurred. That is, it does not
3256         report milestones that are filtered out due to client disinterest.
3257         There doesn't seem to be a good central place to capture all
3258         milestones, regardless of client interest.
3259
3260         * Platform/Logging.h:
3261         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
3262         (WebKit::WebFrameLoaderClient::dispatchDidReachLayoutMilestone):
3263
3264 2019-03-25  Patrick Griffis  <pgriffis@igalia.com>
3265
3266         [GTK][WPE] Remove network access from web process sandbox
3267         https://bugs.webkit.org/show_bug.cgi?id=189967
3268
3269         Reviewed by Michael Catanzaro.
3270
3271         * UIProcess/Launcher/glib/BubblewrapLauncher.cpp:
3272         (WebKit::createFlatpakInfo):
3273         (WebKit::bubblewrapSpawn):
3274         * UIProcess/Launcher/glib/FlatpakLauncher.cpp:
3275         (WebKit::flatpakSpawn):
3276
3277 2019-03-25  Andy Estes  <aestes@apple.com>
3278
3279         [Apple Pay] Call +canMakePayments on a work queue
3280         https://bugs.webkit.org/show_bug.cgi?id=196179
3281         <rdar://problem/45388749>
3282
3283         Reviewed by Brady Eidson.
3284
3285         Calling +canMakePayments on either PKPaymentAuthorizationController or
3286         PKPaymentAuthorizationViewController results in synchronous IPC and is therefore very
3287         expensive to call on the main thread. On iOS, these calls are made in the network process,
3288         and on Mac in the UI process.
3289
3290         Call these methods on a work queue to avoid main thread spins.
3291
3292         * Shared/ApplePay/WebPaymentCoordinatorProxy.cpp:
3293         (WebKit::WebPaymentCoordinatorProxy::canMakePayments):
3294         * Shared/ApplePay/WebPaymentCoordinatorProxy.h:
3295         * Shared/ApplePay/ios/WebPaymentCoordinatorProxyIOS.mm:
3296         (WebKit::WebPaymentCoordinatorProxy::platformCanMakePayments):
3297         * Shared/ApplePay/mac/WebPaymentCoordinatorProxyMac.mm:
3298         (WebKit::WebPaymentCoordinatorProxy::platformCanMakePayments):
3299
3300 2019-03-25  Andy Estes  <aestes@apple.com>
3301
3302         [Apple Pay] Remove the AvailablePaymentNetworks synchronous message
3303         https://bugs.webkit.org/show_bug.cgi?id=196180
3304
3305         Reviewed by Youenn Fablet.
3306
3307         Unlike many PassKit interactions, it's ok to call +[PKPaymentRequest availableNetworks]
3308         without an entitlement. Therefore, we can call it from the web process directly rather than
3309         synchronously messaging the entitled UI or networking process.
3310
3311         * Shared/ApplePay/WebPaymentCoordinatorProxy.cpp:
3312         * Shared/ApplePay/WebPaymentCoordinatorProxy.h:
3313         * Shared/ApplePay/WebPaymentCoordinatorProxy.messages.in:
3314         * Shared/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
3315         * SourcesCocoa.txt:
3316         * WebKit.xcodeproj/project.pbxproj:
3317         * WebProcess/ApplePay/WebPaymentCoordinator.cpp:
3318         (WebKit::WebPaymentCoordinator::availablePaymentNetworks):
3319         * WebProcess/ApplePay/WebPaymentCoordinator.h:
3320         * WebProcess/ApplePay/cocoa/WebPaymentCoordinatorCocoa.mm: Added.
3321         (WebKit::WebPaymentCoordinator::platformAvailablePaymentNetworks const):
3322         * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectBase.mm:
3323         (-[WKAccessibilityWebPageObjectBase accessibilityRootObjectWrapper]):
3324         (-[WKAccessibilityWebPageObjectBase setWebPage:]):
3325
3326 2019-03-25  Chris Dumez  <cdumez@apple.com>
3327
3328         Unreviewed, tiny fix after r243388 to address API test failures on iOS
3329
3330         m_processType was properly initialized on macOS but not iOS.
3331
3332         * WebProcess/cocoa/WebProcessCocoa.mm:
3333         (WebKit::WebProcess::platformInitializeProcess):
3334
3335 2019-03-25  Carlos Garcia Campos  <cgarcia@igalia.com>
3336
3337         [GTK][WPE] Do not allow changes in active URI before provisional load starts for non-API requests
3338         https://bugs.webkit.org/show_bug.cgi?id=194208
3339
3340         Reviewed by Michael Catanzaro.
3341
3342         * UIProcess/API/glib/WebKitWebView.cpp:
3343         (webkitWebViewWillStartLoad): Block updates of active URL.
3344         (webkitWebViewLoadChanged): Unblock updates of active URL on WEBKIT_LOAD_STARTED.
3345
3346 2019-03-25  Gyuyoung Kim  <gyuyoung.kim@webkit.org>
3347
3348         Remove NavigatorContentUtils in WebCore/Modules
3349         https://bugs.webkit.org/show_bug.cgi?id=196070
3350
3351         Reviewed by Alex Christensen.
3352
3353         NavigatorContentUtils was to support the custom scheme spec [1].
3354         However, in WebKit side, no port has supported the feature in
3355         WebKit layer after EFL port was removed. So there has been the
3356         only IDL implementation of the NavigatorContentUtils in WebCore.
3357         So we don't need to keep the implementation in WebCore anymore.
3358
3359         [1] https://html.spec.whatwg.org/multipage/system-state.html#custom-handlers
3360
3361         * Configurations/FeatureDefines.xcconfig:
3362         * WebProcess/WebCoreSupport/WebNavigatorContentUtilsClient.h: Removed.
3363
3364 2019-03-24  Zan Dobersek  <zdobersek@igalia.com>
3365
3366         Unreviewed WPE build fix.
3367
3368         * UIProcess/wpe/WebPasteboardProxyWPE.cpp:
3369         Add an explicit CompletionHandler.h include to avoid a trip-up in
3370         unified builds.
3371
3372 2019-03-24  Fujii Hironori  <Hironori.Fujii@sony.com>
3373
3374         [WinCairo] WebProcessDataStoreParameters.h(32): error C2653: 'SandboxExtension': is not a class or namespace name
3375         https://bugs.webkit.org/show_bug.cgi?id=196192
3376
3377         Unreviewed for WinCairo port.
3378
3379         * Shared/WebProcessDataStoreParameters.h: Added #include "SandboxExtension.h".
3380
3381 2019-03-24  Andy Estes  <aestes@apple.com>
3382
3383         [watchOS] Remove unused Proximity Networking code
3384         https://bugs.webkit.org/show_bug.cgi?id=196188
3385
3386         Reviewed by Tim Horton.
3387
3388         * Configurations/WebKit.xcconfig:
3389         * NetworkProcess/NetworkProcess.cpp:
3390         (WebKit::NetworkProcess::NetworkProcess):
3391         * NetworkProcess/NetworkProcess.h:
3392         * NetworkProcess/NetworkProcessCreationParameters.cpp:
3393         (WebKit::NetworkProcessCreationParameters::encode const):
3394         (WebKit::NetworkProcessCreationParameters::decode):
3395         * NetworkProcess/NetworkProcessCreationParameters.h:
3396         * NetworkProcess/cocoa/NetworkDataTaskCocoa.h:
3397         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
3398         (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa):
3399         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
3400         (WebKit::NetworkProcess::platformPrepareToSuspend):
3401         (WebKit::NetworkProcess::platformProcessDidResume):
3402         (WebKit::NetworkProcess::platformProcessDidTransitionToBackground):
3403         (WebKit::NetworkProcess::platformProcessDidTransitionToForeground):
3404         * NetworkProcess/watchos/NetworkProximityAssertion.h: Removed.
3405         * NetworkProcess/watchos/NetworkProximityAssertion.mm: Removed.
3406         * NetworkProcess/watchos/NetworkProximityManager.h: Removed.
3407         * NetworkProcess/watchos/NetworkProximityManager.mm: Removed.
3408         * SourcesCocoa.txt:
3409         * UIProcess/API/APIProcessPoolConfiguration.cpp:
3410         (API::ProcessPoolConfiguration::copy):
3411         * UIProcess/API/APIProcessPoolConfiguration.h:
3412         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
3413         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
3414         (-[_WKProcessPoolConfiguration wirelessContextIdentifier]):
3415         (-[_WKProcessPoolConfiguration setWirelessContextIdentifier:]):
3416         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
3417         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
3418         * WebKit.xcodeproj/project.pbxproj:
3419
3420 2019-03-23  Chris Dumez  <cdumez@apple.com>
3421
3422         Unreviewed, fix typo in comment added in r243379.
3423
3424         * UIProcess/API/Cocoa/WKProcessGroup.mm:
3425         (-[WKProcessGroup setDelegate:]):
3426
3427 2019-03-23  Simon Fraser  <simon.fraser@apple.com>
3428
3429         REGRESSION (iOS 8): Scrollbar can't be hidden when webkit-overflow-scrolling is set to touch
3430         https://bugs.webkit.org/show_bug.cgi?id=137043
3431         rdar://problem/16595330
3432
3433         Reviewed by Zalan Bujtas.
3434
3435         Plumb horizontalScrollbarHiddenByStyle/verticalScrollbarHiddenByStyle through ScrollableAreaParameters
3436         to the UI process, and use it to set UIScrollView indicators visible or not.
3437         
3438         The scroll snap changes in ScrollingTreeScrollingNodeDelegateIOS::commitStateAfterChildren() fix a bug
3439         where hasChangedProperty(HorizontalSnapOffsets) was nested inside another set of hasChangedProperty()
3440         tests, so would never get called.
3441
3442         * Shared/WebCoreArgumentCoders.cpp:
3443         (IPC::ArgumentCoder<ScrollableAreaParameters>::encode):
3444         (IPC::ArgumentCoder<ScrollableAreaParameters>::decode):
3445         * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm:
3446         (WebKit::ScrollingTreeScrollingNodeDelegateIOS::commitStateAfterChildren):
3447
3448 2019-03-23  Zalan Bujtas  <zalan@apple.com>
3449
3450         [ContentChangeObserver] Taping on a form control should always result in click.
3451         https://bugs.webkit.org/show_bug.cgi?id=196177
3452
3453         Reviewed by Simon Fraser.
3454
3455         This patch enures that we send a synthetic click when the traget node is a form control (button, edit field etc) even if
3456         the mousemove brings up some hover content.
3457
3458         * WebProcess/WebPage/ios/WebPageIOS.mm:
3459         (WebKit::WebPage::handleSyntheticClick):
3460
3461 2019-03-23  Andy Estes  <aestes@apple.com>
3462
3463         [Apple Pay] Stop calling PKPaymentAuthorizationViewController class methods on iOS
3464         https://bugs.webkit.org/show_bug.cgi?id=196163
3465         <rdar://problem/48787564>
3466
3467         Reviewed by Anders Carlsson.
3468
3469         Now that we've transitioned to PKPaymentAuthorizationController on iOS, we should stop
3470         calling PKPaymentAuthorizationViewController class methods on iOS in favor of their
3471         PKPaymentAuthorizationController alternatives.
3472
3473         While we're here, we should also transition to calling
3474         +paymentServicesMerchantURLForAPIType:completion: on both
3475         PKPaymentAuthorizationViewController and PKPaymentAuthorizationController.
3476
3477         * Platform/cocoa/PaymentAuthorizationViewController.mm:
3478         (-[WKPaymentAuthorizationViewControllerDelegate _paymentServicesMerchantURLForAPIType:completion:]):
3479         * Platform/cocoa/WKPaymentAuthorizationDelegate.h:
3480         * Platform/cocoa/WKPaymentAuthorizationDelegate.mm:
3481         (-[WKPaymentAuthorizationDelegate _initWithRequest:presenter:]):
3482         (-[WKPaymentAuthorizationDelegate _paymentServicesMerchantURLForAPIType:completion:]):
3483         * Platform/ios/PaymentAuthorizationController.mm:
3484         (-[WKPaymentAuthorizationControllerDelegate _paymentServicesMerchantURLForAPIType:completion:]):
3485         * Shared/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
3486         (WebKit::WebPaymentCoordinatorProxy::platformCanMakePayments): Deleted.
3487         * Shared/ApplePay/ios/WebPaymentCoordinatorProxyIOS.mm:
3488         (WebKit::WebPaymentCoordinatorProxy::platformCanMakePayments):
3489         * Shared/ApplePay/mac/WebPaymentCoordinatorProxyMac.mm:
3490         (WebKit::WebPaymentCoordinatorProxy::platformCanMakePayments):
3491
3492 2019-03-23  Carlos Garcia Campos  <cgarcia@igalia.com>
3493
3494         Unreviewed. Fix GTK build after r243409.
3495
3496         Build failure is actually unrelated to r243409, it's yet another unified build failure that happens when source
3497         file list changes.
3498
3499         * UIProcess/gtk/WebInspectorProxyGtk.cpp:
3500         (WebKit::WebInspectorProxy::platformShowCertificate): Use WebCore namespace for CertificateInfo parameter.
3501
3502 2019-03-23  Carlos Garcia Campos  <cgarcia@igalia.com>
3503
3504         [GTK] Remove build time dependency on Geoclue2
3505         https://bugs.webkit.org/show_bug.cgi?id=195994
3506
3507         Reviewed by Michael Catanzaro.
3508
3509         Add GeoclueGeolocationProvider class to provide geolocation position updates using Geoclue2 DBus service.
3510
3511         * PlatformGTK.cmake:
3512         * PlatformWPE.cmake:
3513         * SourcesGTK.txt:
3514         * SourcesWPE.txt:
3515         * UIProcess/API/glib/WebKitGeolocationManager.cpp:
3516         (_WebKitGeolocationPosition::_WebKitGeolocationPosition):
3517         (webkitGeolocationManagerStop):
3518         (webkitGeolocationManagerSetEnableHighAccuracy):
3519         (webkitGeolocationManagerDispose):
3520         (webkit_geolocation_manager_class_init):
3521         * UIProcess/geoclue/GeoclueGeolocationProvider.cpp: Added.
3522         (WebKit::GeoclueGeolocationProvider::GeoclueGeolocationProvider):
3523         (WebKit::GeoclueGeolocationProvider::~GeoclueGeolocationProvider):
3524         (WebKit::GeoclueGeolocationProvider::start):
3525         (WebKit::GeoclueGeolocationProvider::stop):
3526         (WebKit::GeoclueGeolocationProvider::setEnableHighAccuracy):
3527         (WebKit::GeoclueGeolocationProvider::destroyManagerLater):
3528         (WebKit::GeoclueGeolocationProvider::destroyManager):
3529         (WebKit::GeoclueGeolocationProvider::setupManager):
3530         (WebKit::GeoclueGeolocationProvider::createClient):
3531         (WebKit::GeoclueGeolocationProvider::setupClient):
3532         (WebKit::GeoclueGeolocationProvider::startClient):
3533         (WebKit::GeoclueGeolocationProvider::stopClient):
3534         (WebKit::GeoclueGeolocationProvider::requestAccuracyLevel):
3535         (WebKit::GeoclueGeolocationProvider::clientLocationUpdatedCallback):
3536         (WebKit::GeoclueGeolocationProvider::createLocation):
3537         (WebKit::GeoclueGeolocationProvider::locationUpdated):
3538         (WebKit::GeoclueGeolocationProvider::didFail):
3539         * UIProcess/geoclue/GeoclueGeolocationProvider.h: Added.
3540
3541 2019-03-22  Simon Fraser  <simon.fraser@apple.com>
3542
3543         Undo collision with r243390.
3544
3545         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
3546         (stringForSSLProtocol):
3547
3548 2019-03-22  Simon Fraser  <simon.fraser@apple.com>
3549
3550         Fix internal builds.
3551
3552         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
3553         (stringForSSLProtocol):
3554
3555 2019-03-22  Keith Rollin  <krollin@apple.com>
3556
3557         Enable ThinLTO support in Production builds
3558         https://bugs.webkit.org/show_bug.cgi?id=190758
3559         <rdar://problem/45413233>
3560
3561         Reviewed by Daniel Bates.
3562
3563         Enable building with Thin LTO in Production when using Xcode 10.2 or
3564         later. This change results in a 1.45% progression in PLT5. Full
3565         Production build times increase about 2-3%. Incremental build times
3566         are more severely affected, and so LTO is not enabled for local
3567         engineering builds.
3568
3569         LTO is enabled only on macOS for now, until rdar://problem/49013399,
3570         which affects ARM builds, is fixed.
3571
3572         To change the LTO setting when building locally:
3573
3574         - If building with `make`, specify WK_LTO_MODE={none,thin,full} on the
3575           command line.
3576         - If building with `build-webkit`, specify --lto-mode={none,thin,full}
3577           on the command line.
3578         - If building with `build-root`, specify --lto={none,thin,full} on the
3579           command line.
3580         - If building with Xcode, create a LocalOverrides.xcconfig file at the
3581           top level of your repository directory (if needed) and define
3582           WK_LTO_MODE to full, thin, or none.
3583
3584         * Configurations/Base.xcconfig:
3585
3586 2019-03-22  Chris Dumez  <cdumez@apple.com>
3587
3588         Unreviewed build fix after r243388.
3589
3590         * WebProcess/WebProcess.h:
3591
3592 2019-03-22  Per Arne Vollan  <pvollan@apple.com>
3593
3594         [macOS] Fix sandbox violation
3595         https://bugs.webkit.org/show_bug.cgi?id=196153
3596         <rdar://problem/49123855>
3597
3598         Reviewed by Brent Fulgham.
3599
3600         The sandbox on macOS is blocking the mach lookup.
3601
3602         * WebProcess/com.apple.WebProcess.sb.in:
3603
3604 2019-03-21  Ryan Haddad  <ryanhaddad@apple.com>
3605
3606         Unreviewed, fix the build with recent SDKs.
3607
3608         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
3609         (stringForSSLProtocol):
3610
3611 2019-03-22  Chris Dumez  <cdumez@apple.com>
3612
3613         Implement WebProcess freezer opt-in completely on WebContent process side
3614         https://bugs.webkit.org/show_bug.cgi?id=196149
3615
3616         Reviewed by Brady Eidson.
3617
3618         Implement WebProcess freezer opt-in completely on WebContent process side, we do not need
3619         to involve the UIProcess with this and rely on IPC which may be fragile.
3620
3621         In the future, we may want to set freezable state from the UIProcess when the API supports
3622         it. We can move the logic to be fully on the UIProcess side then. In the mean time, it is
3623         likely best not to rely on IPC and process coordination for this.
3624
3625         * UIProcess/WebProcessProxy.cpp:
3626         (WebKit::globalPageMap):
3627         (WebKit::WebProcessProxy::WebProcessProxy):
3628         (WebKit::WebProcessProxy::setIsInProcessCache):
3629         (WebKit::WebProcessProxy::markIsNoLongerInPrewarmedPool):
3630         (WebKit::WebProcessProxy::didFinishLaunching):
3631         (WebKit::WebProcessProxy::validateFreezerStatus): Deleted.
3632         * UIProcess/WebProcessProxy.h:
3633         (WebKit::WebProcessProxy::removeProvisionalPageProxy):
3634         (WebKit::WebProcessProxy::WebPageProxyMap::WebPageProxyMap): Deleted.
3635         (WebKit::WebProcessProxy::WebPageProxyMap::size const): Deleted.
3636         (WebKit::WebProcessProxy::WebPageProxyMap::values): Deleted.
3637         (WebKit::WebProcessProxy::WebPageProxyMap::values const): Deleted.
3638         (WebKit::WebProcessProxy::WebPageProxyMap::begin): Deleted.
3639         (WebKit::WebProcessProxy::WebPageProxyMap::end): Deleted.
3640         (WebKit::WebProcessProxy::WebPageProxyMap::get): Deleted.
3641         (WebKit::WebProcessProxy::WebPageProxyMap::contains const): Deleted.
3642         (WebKit::WebProcessProxy::WebPageProxyMap::isEmpty const): Deleted.
3643         (WebKit::WebProcessProxy::WebPageProxyMap::set): Deleted.
3644         (WebKit::WebProcessProxy::WebPageProxyMap::take): Deleted.
3645         * WebProcess/WebProcess.cpp:
3646         (WebKit::WebProcess::setIsInProcessCache):
3647         (WebKit::WebProcess::markIsNoLongerPrewarmed):
3648         (WebKit::WebProcess::actualPrepareToSuspend):
3649         (WebKit::WebProcess::setFreezable): Deleted.
3650         * WebProcess/WebProcess.h:
3651         * WebProcess/WebProcess.messages.in:
3652         * WebProcess/cocoa/WebProcessCocoa.mm:
3653         (WebKit::WebProcess::updateProcessName):
3654         (WebKit::WebProcess::shouldFreezeOnSuspension const):
3655         (WebKit::WebProcess::updateFreezerStatus):
3656
3657 2019-03-22  Chris Dumez  <cdumez@apple.com>
3658
3659         Prewarmed processes should be usable with any website data store
3660         https://bugs.webkit.org/show_bug.cgi?id=196104
3661
3662         Reviewed by Alex Christensen.
3663
3664         Split WebsiteDataStore-specific data out of WebProcessCreationParameters and into a new
3665         WebProcessDataStoreParameters struct so that we do not need a WebsiteDataStore in order
3666         to lauch and initialize a WebProcess. When the process finally gets used and we thus
3667         know which WebsiteDataStore they will be used for, we send the WebProcessDataStoreParameters
3668         to the process to that it can do its data store-specific initialization.
3669
3670         This allows prewarmed processes not not have a WebsiteDataStore assocated with them. They
3671         can then be used for any WebsiteDataStore when we need them.
3672
3673         This is also used by our dummy WebProcessProxy since it does not have a backing process and
3674         thus has no associated WebsiteDataStore.
3675
3676         * Shared/WebProcessCreationParameters.cpp:
3677         (WebKit::WebProcessCreationParameters::encode const):
3678         (WebKit::WebProcessCreationParameters::decode):
3679         * Shared/WebProcessCreationParameters.h:
3680         * Shared/WebProcessDataStoreParameters.h: Added.
3681         (WebKit::WebProcessDataStoreParameters::encode const):
3682         (WebKit::WebProcessDataStoreParameters::decode):
3683         * UIProcess/API/C/WKContext.cpp:
3684         (WKContextWarmInitialProcess):
3685         * UIProcess/API/Cocoa/WKProcessPool.mm:
3686         (-[WKProcessPool _warmInitialProcess]):
3687         * UIProcess/ServiceWorkerProcessProxy.cpp:
3688         (WebKit::ServiceWorkerProcessProxy::ServiceWorkerProcessProxy):
3689         * UIProcess/WebPageProxy.cpp:
3690         (WebKit::WebPageProxy::notifyProcessPoolToPrewarm):
3691         * UIProcess/WebProcessPool.cpp:
3692         (WebKit::WebProcessPool::establishWorkerContextConnectionToNetworkProcess):
3693         (WebKit::WebProcessPool::createNewWebProcess):
3694         (WebKit::WebProcessPool::tryTakePrewarmedProcess):
3695         (WebKit::WebProcessPool::sendWebProcessDataStoreParameters):
3696         (WebKit::WebProcessPool::initializeNewWebProcess):
3697         (WebKit::WebProcessPool::prewarmProcess):
3698         (WebKit::WebProcessPool::processForRegistrableDomain):
3699         (WebKit::WebProcessPool::createWebPage):
3700         (WebKit::WebProcessPool::didReachGoodTimeToPrewarm):
3701         * UIProcess/WebProcessPool.h:
3702         (WebKit::WebProcessPool::sendToOneProcess):
3703         * UIProcess/WebProcessProxy.cpp:
3704         (WebKit::WebProcessProxy::create):
3705         (WebKit::WebProcessProxy::WebProcessProxy):
3706         (WebKit::WebProcessProxy::setWebsiteDataStore):
3707         (WebKit::WebProcessProxy::addExistingWebPage):
3708         * UIProcess/WebProcessProxy.h:
3709         (WebKit::WebProcessProxy::websiteDataStore const):
3710         * WebKit.xcodeproj/project.pbxproj:
3711         * WebProcess/MediaCache/WebMediaKeyStorageManager.cpp:
3712         (WebKit::WebMediaKeyStorageManager::setWebsiteDataStore):
3713         * WebProcess/MediaCache/WebMediaKeyStorageManager.h:
3714         * WebProcess/WebProcess.cpp:
3715         (WebKit::WebProcess::initializeWebProcess):
3716         (WebKit::WebProcess::setWebsiteDataStoreParameters):
3717         * WebProcess/WebProcess.h:
3718         * WebProcess/WebProcess.messages.in:
3719         * WebProcess/WebProcessSupplement.h:
3720         (WebKit::WebProcessSupplement::initialize):
3721         (WebKit::WebProcessSupplement::setWebsiteDataStore):
3722         * WebProcess/cocoa/WebProcessCocoa.mm:
3723         (WebKit::WebProcess::platformInitializeWebProcess):
3724         (WebKit::WebProcess::platformSetWebsiteDataStoreParameters):
3725         * WebProcess/win/WebProcessWin.cpp:
3726         (WebKit::WebProcess::platformInitializeWebProcess):
3727         (WebKit::WebProcess::platformSetWebsiteDataStoreParameters):
3728
3729 2019-03-22  Simon Fraser  <simon.fraser@apple.com>
3730
3731         REGRESSION (r242687): Flicker when pinch-zooming pages in macOS Safari
3732         https://bugs.webkit.org/show_bug.cgi?id=196126
3733         rdar://problem/49095791
3734
3735         Reviewed by Antti Koivisto.
3736
3737         The scrolling tree doesn't have an accurate picture of the main view's scroll position
3738         during pinch-zooming, so don't have it apply layer positions if a transient zoom is
3739         in progress.
3740
3741         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
3742         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
3743         (WebKit::TiledCoreAnimationDrawingArea::flushLayers):
3744         (WebKit::TiledCoreAnimationDrawingArea::applyTransientZoomToPage):
3745
3746 2019-03-22  Antti Koivisto  <antti@apple.com>
3747
3748         Handle UI side hit testing for ScrollPositioningBehavior::Stationary positioned nodes
3749         https://bugs.webkit.org/show_bug.cgi?id=196100
3750         <rdar://problem/49117933>
3751
3752         Reviewed by Simon Fraser.
3753
3754         Test: fast/scrolling/ios/overflow-scroll-overlap-6.html
3755
3756         * UIProcess/RemoteLayerTree/RemoteLayerTreeNode.h:
3757         (WebKit::RemoteLayerTreeNode::relatedScrollContainerIDs const):
3758         (WebKit::RemoteLayerTreeNode::relatedScrollContainerPositioningBehavior const):
3759
3760         Make more generic and save the associated positioning behavior.
3761
3762         (WebKit::RemoteLayerTreeNode::nonAncestorScrollContainerIDs const): Deleted.
3763         (WebKit::RemoteLayerTreeNode::addNonAncestorScrollContainerID): Deleted.
3764         (WebKit::RemoteLayerTreeNode::clearNonAncestorScrollContainerIDs): Deleted.
3765         * UIProcess/RemoteLayerTree/RemoteLayerTreeNode.mm:
3766         (WebKit::RemoteLayerTreeNode::setRelatedScrollContainerBehaviorAndIDs):
3767         * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h:
3768         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm:
3769         (WebKit::isScrolledBy):
3770
3771         Stationary relationship means the layer won't scroll the scroller.
3772
3773         * UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm:
3774         (WebKit::RemoteScrollingCoordinatorProxy::establishLayerTreeScrollingRelations):
3775
3776 2019-03-22  Chris Dumez  <cdumez@apple.com>
3777
3778         REGRESSION (r243094): ePub files do not render or open in Books
3779         https://bugs.webkit.org/show_bug.cgi?id=196119
3780         <rdar://problem/49121686>
3781
3782         Reviewed by Brady Eidson.
3783
3784         Do not delay the WebProcess launch until a load when contructing a web view and the client
3785         may observe when its injected bundle is loaded via WKProcessGroupDelegate's
3786         didCreateConnectionToWebProcessPlugIn.
3787
3788         * UIProcess/API/Cocoa/WKProcessGroup.mm:
3789         (-[WKProcessGroup setDelegate:]):
3790         * UIProcess/WebInspectorUtilities.cpp:
3791         (WebKit::inspectorProcessPool):
3792         * UIProcess/WebProcessPool.cpp:
3793         (WebKit::WebProcessPool::createWebPage):
3794         * UIProcess/WebProcessPool.h:
3795
3796 2019-03-22  Carlos Garcia Campos  <cgarcia@igalia.com>
3797
3798         REGRESSION(r243094): Automation: browser crash in WebAutomationSession::exitFullscreenWindowForPage()
3799         https://bugs.webkit.org/show_bug.cgi?id=196140
3800
3801         Reviewed by Chris Dumez.
3802
3803         Since r243094, the WebPageProxy fullscreen manager is not created in the constructor, but once the page has a
3804         process launched.
3805
3806         * UIProcess/Automation/WebAutomationSession.cpp:
3807         (WebKit::WebAutomationSession::exitFullscreenWindowForPage): Null check WebPageProxy::fullScreenManager() before
3808         using it.
3809
3810 2019-03-22  Timothy Hatcher  <timothy@apple.com>
3811
3812         Change macosx() to macos() in WK_API... and JSC_API... macros.
3813         https://bugs.webkit.org/show_bug.cgi?id=196106
3814
3815         Reviewed by Brian Burg.
3816
3817         * Shared/API/Cocoa/WKBrowsingContextHandle.h:
3818         * Shared/API/Cocoa/WKDragDestinationAction.h:
3819         * Shared/API/Cocoa/WKMain.h:
3820         * Shared/API/Cocoa/_WKFrameHandle.h:
3821         * Shared/API/Cocoa/_WKHitTestResult.h:
3822         * Shared/API/Cocoa/_WKNSWindowExtras.h:
3823         * Shared/API/Cocoa/_WKRemoteObjectInterface.h:
3824         * Shared/API/Cocoa/_WKRemoteObjectRegistry.h:
3825         * Shared/API/Cocoa/_WKRenderingProgressEvents.h:
3826         * Shared/API/Cocoa/_WKSameDocumentNavigationType.h:
3827         * UIProcess/API/C/WKPage.h:
3828         * UIProcess/API/Cocoa/NSAttributedString.h:
3829         * UIProcess/API/Cocoa/WKBackForwardList.h:
3830         * UIProcess/API/Cocoa/WKBackForwardListItem.h:
3831         * UIProcess/API/Cocoa/WKBackForwardListItemPrivate.h:
3832         * UIProcess/API/Cocoa/WKBrowsingContextLoadDelegate.h:
3833         * UIProcess/API/Cocoa/WKContentRuleList.h:
3834         * UIProcess/API/Cocoa/WKContentRuleListStore.h:
3835         * UIProcess/API/Cocoa/WKError.h:
3836         * UIProcess/API/Cocoa/WKErrorPrivate.h:
3837         * UIProcess/API/Cocoa/WKFrameInfo.h:
3838         * UIProcess/API/Cocoa/WKFrameInfoPrivate.h:
3839         * UIProcess/API/Cocoa/WKHTTPCookieStore.h:
3840         * UIProcess/API/Cocoa/WKMenuItemIdentifiersPrivate.h:
3841         * UIProcess/API/Cocoa/WKNavigation.h:
3842         * UIProcess/API/Cocoa/WKNavigationAction.h:
3843         * UIProcess/API/Cocoa/WKNavigationActionPrivate.h:
3844         * UIProcess/API/Cocoa/WKNavigationDelegate.h:
3845         * UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h:
3846         * UIProcess/API/Cocoa/WKNavigationResponse.h:
3847         * UIProcess/API/Cocoa/WKOpenPanelParameters.h:
3848         * UIProcess/API/Cocoa/WKOpenPanelParametersPrivate.h:
3849         * UIProcess/API/Cocoa/WKPreferences.h:
3850         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
3851         * UIProcess/API/Cocoa/WKProcessPool.h:
3852         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
3853         * UIProcess/API/Cocoa/WKScriptMessage.h:
3854         * UIProcess/API/Cocoa/WKSecurityOrigin.h:
3855         * UIProcess/API/Cocoa/WKSnapshotConfiguration.h:
3856         * UIProcess/API/Cocoa/WKUIDelegate.h:
3857         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
3858         * UIProcess/API/Cocoa/WKURLSchemeHandler.h:
3859         * UIProcess/API/Cocoa/WKURLSchemeTask.h:
3860         * UIProcess/API/Cocoa/WKURLSchemeTaskPrivate.h:
3861         * UIProcess/API/Cocoa/WKUserContentController.h:
3862         * UIProcess/API/Cocoa/WKUserContentControllerPrivate.h:
3863         * UIProcess/API/Cocoa/WKUserScript.h:
3864         * UIProcess/API/Cocoa/WKUserScriptPrivate.h:
3865         * UIProcess/API/Cocoa/WKViewPrivate.h:
3866         * UIProcess/API/Cocoa/WKWebView.h:
3867         * UIProcess/API/Cocoa/WKWebViewConfiguration.h:
3868         * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
3869         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
3870         * UIProcess/API/Cocoa/WKWebsiteDataRecord.h:
3871         * UIProcess/API/Cocoa/WKWebsiteDataRecordPrivate.h:
3872         * UIProcess/API/Cocoa/WKWebsiteDataStore.h:
3873         * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
3874         * UIProcess/API/Cocoa/WKWindowFeatures.h:
3875         * UIProcess/API/Cocoa/WKWindowFeaturesPrivate.h:
3876         * UIProcess/API/Cocoa/_WKActivatedElementInfo.h:
3877         * UIProcess/API/Cocoa/_WKApplicationManifest.h:
3878         * UIProcess/API/Cocoa/_WKAttachment.h:
3879         * UIProcess/API/Cocoa/_WKAutomationDelegate.h:
3880         * UIProcess/API/Cocoa/_WKAutomationSession.h:
3881         * UIProcess/API/Cocoa/_WKAutomationSessionConfiguration.h:
3882         * UIProcess/API/Cocoa/_WKAutomationSessionDelegate.h:
3883         * UIProcess/API/Cocoa/_WKContextMenuElementInfo.h:
3884         * UIProcess/API/Cocoa/_WKDiagnosticLoggingDelegate.h:
3885         * UIProcess/API/Cocoa/_WKDownload.h:
3886         * UIProcess/API/Cocoa/_WKDownloadDelegate.h:
3887         * UIProcess/API/Cocoa/_WKElementAction.h:
3888         * UIProcess/API/Cocoa/_WKExperimentalFeature.h:
3889         * UIProcess/API/Cocoa/_WKFindOptions.h:
3890         * UIProcess/API/Cocoa/_WKFocusedElementInfo.h:
3891         * UIProcess/API/Cocoa/_WKFormInputSession.h:
3892         * UIProcess/API/Cocoa/_WKFullscreenDelegate.h:
3893         * UIProcess/API/Cocoa/_WKGeolocationCoreLocationProvider.h:
3894         * UIProcess/API/Cocoa/_WKInspector.h:
3895         * UIProcess/API/Cocoa/_WKInspectorWindow.h:
3896         * UIProcess/API/Cocoa/_WKInternalDebugFeature.h:
3897         * UIProcess/API/Cocoa/_WKLayoutMode.h:
3898         * UIProcess/API/Cocoa/_WKLinkIconParameters.h:
3899         * UIProcess/API/Cocoa/_WKOverlayScrollbarStyle.h:
3900         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
3901         * UIProcess/API/Cocoa/_WKRemoteWebInspectorViewController.h:
3902         * UIProcess/API/Cocoa/_WKSessionState.h:
3903         * UIProcess/API/Cocoa/_WKTextInputContext.h:
3904         * UIProcess/API/Cocoa/_WKThumbnailView.h:
3905         * UIProcess/API/Cocoa/_WKUserContentExtensionStore.h:
3906         * UIProcess/API/Cocoa/_WKUserContentExtensionStorePrivate.h:
3907         * UIProcess/API/Cocoa/_WKUserContentFilter.h:
3908         * UIProcess/API/Cocoa/_WKUserContentFilterPrivate.h:
3909         * UIProcess/API/Cocoa/_WKUserContentWorld.h:
3910         * UIProcess/API/Cocoa/_WKUserInitiatedAction.h:
3911         * UIProcess/API/Cocoa/_WKUserStyleSheet.h:
3912         * UIProcess/API/Cocoa/_WKVisitedLinkStore.h:
3913         * UIProcess/API/Cocoa/_WKWebsiteDataSize.h:
3914         * UIProcess/API/Cocoa/_WKWebsiteDataStore.h:
3915         * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.h:
3916         * UIProcess/API/Cocoa/_WKWebsiteDataStoreDelegate.h:
3917         * UIProcess/API/Cocoa/_WKWebsitePolicies.h:
3918         * WebProcess/API/Cocoa/WKWebProcess.h:
3919         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInEditingDelegate.h:
3920         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInFrame.h:
3921         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInHitTestResult.h:
3922         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandle.h:
3923         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandlePrivate.h:
3924         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInPageGroup.h:
3925         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInRangeHandle.h:
3926         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInScriptWorld.h:
3927         * WebProcess/InjectedBundle/API/mac/WKDOMDocument.h:
3928         * WebProcess/InjectedBundle/API/mac/WKDOMElement.h:
3929         * WebProcess/InjectedBundle/API/mac/WKDOMNode.h:
3930         * WebProcess/InjectedBundle/API/mac/WKDOMRange.h:
3931         * WebProcess/InjectedBundle/API/mac/WKDOMText.h:
3932         * WebProcess/InjectedBundle/API/mac/WKDOMTextIterator.h:
3933         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugIn.h:
3934         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.h:
3935         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextControllerPrivate.h:
3936
3937 2019-03-22  Yousuke Kimoto  <Yousuke.Kimoto@sony.com>
3938
3939         Unreviewed build fix.
3940
3941         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
3942
3943 2019-03-22  Tim Horton  <timothy_horton@apple.com>
3944
3945         Fix the build after r243354
3946         https://bugs.webkit.org/show_bug.cgi?id=196138
3947         <rdar://problem/49145951>
3948
3949         * Platform/spi/ios/UIKitSPI.h:
3950         * Shared/DocumentEditingContext.mm:
3951         (WebKit::DocumentEditingContext::toPlatformContext):
3952         * UIProcess/ios/WKContentViewInteraction.mm:
3953
3954 2019-03-21  Simon Fraser  <simon.fraser@apple.com>
3955
3956         Clean up some TiledCoreAnimationDrawingArea members
3957         https://bugs.webkit.org/show_bug.cgi?id=196124
3958
3959         Reviewed by Tim Horton.
3960
3961         The giant m_transform was unused.
3962         
3963         Group the bools etc.
3964
3965         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
3966         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
3967         (WebKit::TiledCoreAnimationDrawingArea::TiledCoreAnimationDrawingArea):
3968         (WebKit::TiledCoreAnimationDrawingArea::setRootCompositingLayer):
3969
3970 2019-03-21  Brady Eidson  <beidson@apple.com>
3971
3972         Certain WebProcesses should opt-out of the freezer.
3973         <rdar://problem/42846139> and https://bugs.webkit.org/show_bug.cgi?id=196062
3974
3975         Reviewed by Andy Estes.
3976
3977         WebProcesses should opt-in and opt-out of the freezer as is appropriate.
3978         By default a WebProcess is freezer eligible.
3979         If any of the following become true then it should become ineligible:
3980         - The WebProcess is a pre-warmed process.
3981         - The WebProcess is in the process cache.
3982         - The WebProcess is not actively hosting any web pages (e.g. it only has suspending web pages)
3983
3984         The most complicated part of the above is guaranteeing that any operation that changes
3985         the active pages hosted by the process causes a recalculation of the freezer opt-in state.
3986
3987         To do that this replaces the basic WebPageProxyMap with a custom class.
3988
3989         * UIProcess/WebProcessProxy.cpp:
3990         (WebKit::globalPageMap):
3991         (WebKit::WebProcessProxy::WebProcessProxy):
3992         (WebKit::WebProcessProxy::validateFreezerStatus):
3993         (WebKit::WebProcessProxy::setIsInProcessCache):
3994         (WebKit::WebProcessProxy::markIsNoLongerInPrewarmedPool):
3995         (WebKit::WebProcessProxy::didFinishLaunching):
3996         * UIProcess/WebProcessProxy.h:
3997         (WebKit::WebProcessProxy::WebPageProxyMap::WebPageProxyMap):
3998         (WebKit::WebProcessProxy::WebPageProxyMap::size const):
3999         (WebKit::WebProcessProxy::WebPageProxyMap::values):
4000         (WebKit::WebProcessProxy::WebPageProxyMap::values const):
4001         (WebKit::WebProcessProxy::WebPageProxyMap::begin):
4002         (WebKit::WebProcessProxy::WebPageProxyMap::end):
4003    &nbs