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