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