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