[iOS] Callout menu overlaps in-page controls when editing a comment in github.com...
[WebKit-https.git] / Source / WebKit / ChangeLog
1 2019-02-22  Wenson Hsieh  <wenson_hsieh@apple.com>
2
3         [iOS] Callout menu overlaps in-page controls when editing a comment in github.com's issue tracker
4         https://bugs.webkit.org/show_bug.cgi?id=194873
5         <rdar://problem/46701974>
6
7         Reviewed by Tim Horton.
8
9         On the topic of supporting web-based rich text editors on iOS, one problematic area has always been handling
10         conflicts between platform UI (i.e., the system callout menu) and in-page text editing controls. This issue
11         comes up in websites that don't use the "hidden contenteditable" approach to rich text editing, but also show
12         additional controls in a toolbar or contextual menu above the selection. In these cases, what often happens is
13         that system controls overlap controls in the page.
14
15         Luckily, the iOS callout menu (i.e. the private UICalloutBar) is capable of presenting with a list of "evasion
16         rects" to avoid; if the callout bar would normally intersect with one of these rects, then a different
17         orientation that does not intersect with one of these rects is chosen instead. Currently, the only rect added
18         here by UIKit when presenting the callout menu is the bounding rect of the on-screen keyboard, but after
19         <rdar://problem/48128337>, we now have a generalized mechanism for offering additional evasion rects before
20         UIKit presents the callout menu.
21
22         This patch adopts the mechanism introduced in <rdar://problem/48128337>, and introduces a heuristic for
23         determining the approximate location of controls in the page which might overlap the callout menu. This
24         heuristic works by hit-testing for clickable (but non-editable) nodes above the bounds of the selection, which
25         are additionally not hit-tested by advancing outwards from any of the other edges of the selection bounds.
26         Additionally, any hit-tested nodes whose bounding rects are very large (relative to the content view size) are
27         ignored (this deals with scenarios where the body or a large container element has a click handler). We then add
28         the bounding rects of each of the nodes that fit this criteria to the list of rects for UIKit to avoid when
29         presenting the system callout menu.
30
31         The result is that WebKit will, by default, avoid overlapping anything that looks like controls in the page when
32         showing a callout menu in editable content. In practice, this fixes overlapping controls on most websites that
33         roll their own context menu or toolbar in their rich text editor.
34
35         Test: editing/selection/ios/avoid-showing-callout-menu-over-controls.html
36
37         * Platform/spi/ios/UIKitSPI.h:
38         * UIProcess/WebPageProxy.h:
39         * UIProcess/ios/WKContentViewInteraction.mm:
40         (-[WKContentView requestAutocorrectionRectsForString:withCompletionHandler:]):
41         (-[WKContentView requestRectsToEvadeForSelectionCommandsWithCompletionHandler:]):
42         (-[WKContentView requestAutocorrectionContextWithCompletionHandler:]):
43
44         Drive-by: handle null completion handler arguments more gracefully, by raising an NSException and bailing before
45         attempting to invoke a nil block.
46
47         * UIProcess/ios/WebPageProxyIOS.mm:
48         (WebKit::WebPageProxy::requestEvasionRectsAboveSelection):
49
50         See above for more detail.
51
52         * WebProcess/WebPage/WebPage.h:
53         * WebProcess/WebPage/WebPage.messages.in:
54         * WebProcess/WebPage/ios/WebPageIOS.mm:
55         (WebKit::WebPage::requestEvasionRectsAboveSelection):
56
57 2019-02-22  Simon Fraser  <simon.fraser@apple.com>
58
59         Unreviewed build fix: need a WebCore:: namespace on ScrollingEventResult.
60
61         * UIProcess/RemoteLayerTree/ios/ScrollingTreeOverflowScrollingNodeIOS.h:
62
63 2019-02-22  Chris Dumez  <cdumez@apple.com>
64
65         Regression(PSON) Unable to preview password-protected documents on iCloud.com
66         https://bugs.webkit.org/show_bug.cgi?id=194954
67         <rdar://problem/48127957>
68
69         Reviewed by Alex Christensen.
70
71         Make sure the ProvisionalPageProxy forwards to the WebPageProxy the QuickLook-related
72         IPC on iOS.
73
74         * UIProcess/ProvisionalPageProxy.cpp:
75         (WebKit::ProvisionalPageProxy::didRequestPasswordForQuickLookDocumentInMainFrame):
76         (WebKit::ProvisionalPageProxy::didReceiveMessage):
77         * UIProcess/ProvisionalPageProxy.h:
78         * UIProcess/WebPageProxy.h:
79         * UIProcess/ios/WebPageProxyIOS.mm:
80         (WebKit::WebPageProxy::didRequestPasswordForQuickLookDocumentInMainFrame):
81         (WebKit::WebPageProxy::didRequestPasswordForQuickLookDocumentInMainFrameShared):
82
83 2019-02-22  Per Arne Vollan  <pvollan@apple.com>
84
85         [iOS] Sandbox should allow mach lookups related to media capturing
86         https://bugs.webkit.org/show_bug.cgi?id=194951
87         <rdar://problem/48013875>
88
89         Reviewed by Brent Fulgham.
90
91         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
92
93 2019-02-22  Alexander Mikhaylenko  <exalm7659@gmail.com>
94
95         [GTK] Navigation gesture improvements
96         https://bugs.webkit.org/show_bug.cgi?id=194943
97
98         Reviewed by Michael Catanzaro.
99
100         Cancel the gesture if progress is less than 0.5 and velocity is not high enough.
101
102         Allow to continue the gesture during animation. Introduce finished state to be used
103         when showing snapshot after the animation ends.
104
105         Fix duration calculation, also slow it down so that the initial velocity matches
106         what it was during the gesture.
107
108         * UIProcess/ViewGestureController.h: Add shouldCancel() and State::Finishing to SwipeProgressTracker.
109         * UIProcess/gtk/ViewGestureControllerGtk.cpp:
110         (WebKit::ViewGestureController::SwipeProgressTracker::handleEvent):
111         Fix velocity calculation, allow scrolling during State::Animating.
112         (WebKit::ViewGestureController::SwipeProgressTracker::shouldCancel): Added.
113         (WebKit::ViewGestureController::SwipeProgressTracker::startAnimation): Use shouldCancel() and fix duration calculation.
114         (WebKit::ViewGestureController::SwipeProgressTracker::endAnimation): Set state to State::Finishing when the animation ends.
115
116 2019-02-22  Chris Dumez  <cdumez@apple.com>
117
118         REGRESSION(PSON) Scroll position is sometimes not restored on history navigation
119         https://bugs.webkit.org/show_bug.cgi?id=194924
120         <rdar://problem/48216125>
121
122         Reviewed by Geoffrey Garen.
123
124         When process-swapping, we would create a new WebPage in the new process, which would
125         call restoreSessionInternal() to restore the HistoryItems based on the UIProcess's
126         backforward list. The issue is that this session restoring would send HistoryItem
127         updates back to the UIProcess. Without PSON, this would be unnecessary but harmless.
128         With PSON though, this may end up overwriting values set by the previous process,
129         such as the scroll position.
130
131         Address the issue by temporarily disabling the HistoryItem update notifications to
132         the UIProcess while restoring a session.
133
134         * UIProcess/API/Cocoa/WKBackForwardListItem.mm:
135         (-[WKBackForwardListItem _scrollPosition]):
136         * UIProcess/API/Cocoa/WKBackForwardListItemPrivate.h:
137         * WebProcess/WebPage/WebPage.cpp:
138         (WebKit::WebPage::restoreSessionInternal):
139
140 2019-02-21  Adrian Perez de Castro  <aperez@igalia.com>
141
142         [WPE][GTK] No API documentation generated for WebKitUserContentFilterStore
143         https://bugs.webkit.org/show_bug.cgi?id=194908
144
145         Reviewed by Carlos Garcia Campos.
146
147         * UIProcess/API/gtk/docs/webkit2gtk-4.0.types: Add entry for webkit_user_content_filter_store_get_type().
148         * UIProcess/API/gtk/docs/webkit2gtk-docs.sgml: Add entry for WebKitUserContentFilterStore.
149         * UIProcess/API/wpe/docs/wpe-docs.sgml: Ditto.
150
151 2019-02-21  Carlos Garcia Campos  <cgarcia@igalia.com>
152
153         wpewebkit-2.23.90 Failing to build on Fedora
154         https://bugs.webkit.org/show_bug.cgi?id=194922
155
156         Unreviewed. Fix path to WebKitUserContentFilterStore.h in WPE_API_INSTALLED_HEADERS.
157
158         * PlatformWPE.cmake:
159
160 2019-02-21  Simon Fraser  <simon.fraser@apple.com>
161
162         Hardcode Visual Viewports on everywhere except iOS WK1
163         https://bugs.webkit.org/show_bug.cgi?id=194928
164
165         Reviewed by Zalan Bujtas.
166
167         Remove the WK1 and WK2 preferences and MiniBrowser menu item for "visual viewports",
168         change the default value of the Setting to 'true', and hardcode WebView on iOS to
169         set it to false. The setting has shipped for several years and there's no need to turn
170         it off now.
171
172         Similarly, disable the "Visual Viewport API" on iOS WK1, since it makes no sense if
173         Visual Viewports are not enabled.
174         
175         Remove the "visualViewportEnabled" flag and unused code paths from scrolling tree code
176         that only runs in WK2
177
178         * Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.cpp:
179         (ArgumentCoder<ScrollingStateFrameScrollingNode>::encode):
180         (ArgumentCoder<ScrollingStateFrameScrollingNode>::decode):
181         * Shared/WebPreferences.yaml:
182         * UIProcess/API/Cocoa/WKPreferences.mm:
183         (-[WKPreferences _visualViewportEnabled]): Deleted.
184         (-[WKPreferences _setVisualViewportEnabled:]): Deleted.
185         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
186         * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm:
187         (WebKit::RemoteLayerTreeDrawingAreaProxy::commitLayerTree):
188         * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h:
189         (WebKit::RemoteScrollingCoordinatorProxy::visualViewportEnabled const): Deleted.
190         * UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm:
191         (WebKit::RemoteScrollingCoordinatorProxy::customFixedPositionRect const):
192         * UIProcess/WebPageProxy.h:
193         * UIProcess/ios/WKContentView.mm:
194         (-[WKContentView didUpdateVisibleRect:unobscuredRect:contentInsets:unobscuredRectInScrollViewCoordinates:obscuredInsets:unobscuredSafeAreaInsets:inputViewBounds:scale:minimumScale:inStableState:isChangingObscuredInsetsInteractively:enclosedInScrollableAncestorView:]):
195         * UIProcess/ios/WebPageProxyIOS.mm:
196         (WebKit::WebPageProxy::computeCustomFixedPositionRect const):
197         * WebProcess/Automation/WebAutomationSessionProxy.cpp:
198         (WebKit::WebAutomationSessionProxy::computeElementLayout):
199         * WebProcess/InjectedBundle/InjectedBundle.cpp:
200         (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner):
201         * WebProcess/WebPage/ios/WebPageIOS.mm:
202         (WebKit::WebPage::getFocusedElementInformation):
203         (WebKit::WebPage::dynamicViewportSizeUpdate):
204         (WebKit::WebPage::updateVisibleContentRects):
205
206 2019-02-21  Carlos Garcia Campos  <cgarcia@igalia.com>
207
208         [GTK] Epiphany searching for plugins even if plugins are disabled
209         https://bugs.webkit.org/show_bug.cgi?id=194352
210
211         Reviewed by Michael Catanzaro.
212
213         Check pluginsEnabled setting before trying to get plugins from UI process.
214
215         * WebProcess/Plugins/WebPluginInfoProvider.cpp:
216         (WebKit::WebPluginInfoProvider::populatePluginCache):
217
218 2019-02-21  Darin Adler  <darin@apple.com>
219
220         Some refinements for Node and Document
221         https://bugs.webkit.org/show_bug.cgi?id=194764
222
223         Reviewed by Ryosuke Niwa.
224
225         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDocumentGtk.cpp:
226         (webkit_dom_document_get_override_style): Changed to return nullptr directly instead of
227         calling a bunch of WebCore code first. No real value in checking arguments or doing any work.
228
229         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
230         (WebKit::WebFrameLoaderClient::shouldAlwaysUsePluginDocument const): Deleted.
231         No need to override the function inherited from the base class, nor to keep track of the
232         unnecessary task of implementing this some day.
233         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h: Updated for the above.
234
235 2019-02-21  Ryosuke Niwa  <rniwa@webkit.org>
236
237         Discard cached processes when clearing website data store
238         https://bugs.webkit.org/show_bug.cgi?id=194894
239
240         Reviewed by Chris Dumez.
241
242         Clear the process cache when clearing the website data store so that there is no way to infer
243         which site the user had visited by observing for which sites WebContent processes had been cached.
244
245         There is one sublty in WebsiteDataStore::removeData that we have to delay the clearing of
246         the web process cache until the next run loop because SuspendedPageProxy::~SuspendedPageProxy
247         invokes WebProcessProxy::maybeShutDown in the next run loop. We also have to disable the process
248         cache during this time as it would otherwise trigger the responsiveness check of WebContent process
249         can take arbitrarily long time.
250
251         * UIProcess/API/Cocoa/WKProcessPool.mm:
252         (-[WKProcessPool _processCacheCapacity]): Added for testing.
253         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
254         * UIProcess/WebProcessCache.cpp:
255         (WebKit::WebProcessCache::addProcess): Avoid adding web processes to the cache while the suspended
256         pages are being cleared.
257         * UIProcess/WebProcessCache.h:
258         (WebKit::WebProcessCache::disabled const): Added.
259         (WebKit::WebProcessCache::setDisabled): Added.
260         * UIProcess/WebProcessPool.cpp:
261         (WebKit::WebProcessPool::handleMemoryPressureWarning):
262         (WebKit::WebProcessPool::clearSuspendedPages): Added.
263         * UIProcess/WebProcessPool.h:
264         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
265         (WebKit::WebsiteDataStore::removeData):
266
267 2019-02-21  Alex Christensen  <achristensen@webkit.org>
268
269         Clicking "Go Back" on a safe browsing warning before a WKWebView has loaded any page should request to close the WKWebView
270         https://bugs.webkit.org/show_bug.cgi?id=194914
271         <rdar://problem/47586889>
272
273         Reviewed by Geoffrey Garen.
274
275         * UIProcess/API/APIUIClient.h:
276         (API::UIClient::didShowSafeBrowsingWarning):
277         (API::UIClient::didClickGoBackFromSafeBrowsingWarning): Deleted.
278         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
279         * UIProcess/Cocoa/UIDelegate.h:
280         * UIProcess/Cocoa/UIDelegate.mm:
281         (WebKit::UIDelegate::setDelegate):
282         (WebKit::UIDelegate::UIClient::didClickGoBackFromSafeBrowsingWarning): Deleted.
283         * UIProcess/WebPageProxy.cpp:
284         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
285
286 2019-02-21  Tim Horton  <timothy_horton@apple.com>
287
288         Turn a high-value UI-side-compositing assertion into a release assert
289         https://bugs.webkit.org/show_bug.cgi?id=194887
290
291         Reviewed by Simon Fraser.
292
293         * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.cpp:
294         (WebKit::PlatformCALayerRemote::recursiveBuildTransaction):
295         There is absolutely no situation in which this assert should fire
296         if WebKit is behaving correctly, and it will basically always result
297         in a UI process crash (or at least confusion), so make it a release assert.
298         This would have saved us a lot of stress in bug 194845.
299
300 2019-02-21  Don Olmstead  <don.olmstead@sony.com>
301
302         [MSVC] Fix compilation errors with lambdas in ResourceLoadStatistics
303         https://bugs.webkit.org/show_bug.cgi?id=194913
304
305         Reviewed by Brent Fulgham.
306
307         MSVC has problems with the scoping of `this` within a nested lambda. To work around the
308         behavior the enclosing lambda's wrapping of `this` is used within the nested lambda.
309
310         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
311         (WebKit::ResourceLoadStatisticsMemoryStore::processStatisticsAndDataRecords):
312         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
313         (WebKit::WebResourceLoadStatisticsStore::requestStorageAccessGranted):
314
315 2019-02-21  Chris Dumez  <cdumez@apple.com>
316
317         Fix API test crashes after r241855.
318
319         Reviewed by Ryosuke Niwa.
320
321         * UIProcess/WebProcessCache.cpp:
322         (WebKit::WebProcessCache::addProcessIfPossible):
323
324 2019-02-21  Alex Christensen  <achristensen@webkit.org>
325
326         API::HTTPCookieStore should expose setCookies()
327         https://bugs.webkit.org/show_bug.cgi?id=194861
328
329         Reviewed by Brent Fulgham.
330
331         Pass a Vector<Cookie> instead of just one cookie at a time.
332         This will add the ability to set multiple cookies without an IPC roundtrip per cookie.
333
334         * NetworkProcess/Cookies/WebCookieManager.cpp:
335         (WebKit::WebCookieManager::setCookie):
336         * NetworkProcess/Cookies/WebCookieManager.h:
337         * NetworkProcess/Cookies/WebCookieManager.messages.in:
338         * UIProcess/API/APIHTTPCookieStore.cpp:
339         (API::HTTPCookieStore::setCookies):
340         (API::HTTPCookieStore::setCookie): Deleted.
341         * UIProcess/API/APIHTTPCookieStore.h:
342         * UIProcess/API/Cocoa/WKHTTPCookieStore.mm:
343         (-[WKHTTPCookieStore setCookie:completionHandler:]):
344         * UIProcess/WebCookieManagerProxy.cpp:
345         (WebKit::WebCookieManagerProxy::setCookies):
346         (WebKit::WebCookieManagerProxy::setCookie): Deleted.
347         * UIProcess/WebCookieManagerProxy.h:
348
349 2019-02-21  Antoine Quint  <graouts@apple.com>
350
351         Move UIWebTouchEventsGestureRecognizer.activeTouchesByIdentifier to SPI
352         https://bugs.webkit.org/show_bug.cgi?id=194531
353         <rdar://problem/47714562>
354
355         Reviewed by Tim Horton.
356
357         Follow-up commit to ensure this SPI is only called on newer versions of iOS.
358
359         * UIProcess/ios/WKContentViewInteraction.mm:
360         (-[WKContentView cancelPointersForGestureRecognizer:]):
361
362 2019-02-21  Tim Horton  <timothy_horton@apple.com>
363
364         Crash under RemoteLayerTreePropertyApplier::applyProperties when reattaching to old process
365         https://bugs.webkit.org/show_bug.cgi?id=194845
366         <rdar://problem/47944579>
367
368         Reviewed by Antti Koivisto.
369
370         New test: ProcessSwap.PageOverlayLayerPersistence
371
372         * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.h:
373         (WebKit::RemoteLayerTreeTransaction::LayerProperties::notePropertiesChanged):
374         Keep track of all properties that have ever changed on a layer, so we
375         can re-send them if a layer moves between contexts.
376
377         * WebProcess/WebPage/DrawingArea.cpp:
378         (WebKit::DrawingArea::~DrawingArea):
379         (WebKit::DrawingArea::removeMessageReceiverIfNeeded):
380         * WebProcess/WebPage/DrawingArea.h:
381         (WebKit::DrawingArea::layerHostDidFlushLayers):
382         Make it possible to tear down DrawingArea's MessageReceiver before it is destroyed,
383         so that we can keep two DrawingAreas alive in a single process for a short time.
384
385         (WebKit::DrawingArea::adoptLayersFromDrawingArea):
386         Add adoptLayersFromDrawingArea; see below for its only useful implementation.
387
388         * WebProcess/WebPage/RemoteLayerTree/GraphicsLayerCARemote.cpp:
389         (WebKit::GraphicsLayerCARemote::GraphicsLayerCARemote):
390         (WebKit::GraphicsLayerCARemote::~GraphicsLayerCARemote):
391         (WebKit::GraphicsLayerCARemote::createPlatformCALayer):
392         (WebKit::GraphicsLayerCARemote::createPlatformCALayerForEmbeddedView):
393         (WebKit::GraphicsLayerCARemote::moveToContext):
394         * WebProcess/WebPage/RemoteLayerTree/GraphicsLayerCARemote.h:
395         Make it possible to move a GraphicsLayerCARemote between RemoteLayerTreeContexts.
396
397         * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.cpp:
398         (WebKit::PlatformCALayerRemote::create):
399         (WebKit::PlatformCALayerRemote::createForEmbeddedView):
400         (WebKit::PlatformCALayerRemote::~PlatformCALayerRemote):
401         (WebKit::PlatformCALayerRemote::moveToContext):
402         * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.h:
403         * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemoteCustom.mm:
404         (WebKit::PlatformCALayerRemoteCustom::create):
405         (WebKit::PlatformCALayerRemoteCustom::clone const):
406         Make it possible to move a PlatformCALayerRemote between RemoteLayerTreeContexts.
407
408         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeContext.h:
409         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeContext.mm:
410         (WebKit::RemoteLayerTreeContext::~RemoteLayerTreeContext):
411         (WebKit::RemoteLayerTreeContext::adoptLayersFromContext):
412         (WebKit::RemoteLayerTreeContext::layerDidEnterContext):
413         (WebKit::RemoteLayerTreeContext::layerWillLeaveContext):
414         (WebKit::RemoteLayerTreeContext::graphicsLayerDidEnterContext):
415         (WebKit::RemoteLayerTreeContext::graphicsLayerWillLeaveContext):
416         (WebKit::RemoteLayerTreeContext::layerWasCreated): Deleted.
417         (WebKit::RemoteLayerTreeContext::layerWillBeDestroyed): Deleted.
418         Keep track of all GraphicsLayerCARemote instances in the context, like we
419         do for PlatformCALayerRemote, so that we can update their context backpointers if needed.
420
421         Also make it possible to move all outstanding layers to a new context.
422
423         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.h:
424         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
425         (WebKit::RemoteLayerTreeDrawingArea::adoptLayersFromDrawingArea):
426         * WebProcess/WebPage/WebPage.cpp:
427         (WebKit::WebPage::reinitializeWebPage):
428         When doing a DrawingArea swap, transition all layers from the old context
429         to the new one. In order to do this, we temporarily keep both DrawingAreas
430         alive, but make use of the new mechanism to remove the old one's MessageReceiver
431         before installing the new one, so that destroying the old one later doesn't
432         remove it (avoiding re-introducing bug 189481).
433
434 2019-02-21  Chris Dumez  <cdumez@apple.com>
435
436         Unreviewed API test fix after r241855.
437
438         * UIProcess/WebProcessProxy.cpp:
439         (WebKit::WebProcessProxy::~WebProcessProxy):
440
441 2019-02-21  Antoine Quint  <graouts@apple.com>
442
443         Move UIWebTouchEventsGestureRecognizer.activeTouchesByIdentifier to SPI
444         https://bugs.webkit.org/show_bug.cgi?id=194531
445         <rdar://problem/47714562>
446
447         Reviewed by Dean Jackson.
448
449         * Platform/spi/ios/UIKitSPI.h:
450         * UIProcess/ios/WKContentViewInteraction.mm:
451         (-[WKContentView cancelPointersForGestureRecognizer:]): We update the referenced Radar since we need to keep the call
452         to respondsToSelector until the SPI has shipped for OpenSource builds to work.
453
454 2019-02-20  Antti Koivisto  <antti@apple.com>
455
456         Make programmatic frame scrolling work on iOS
457         https://bugs.webkit.org/show_bug.cgi?id=194886
458
459         Reviewed by Simon Fraser.
460
461         * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm:
462         (WebKit::ScrollingTreeScrollingNodeDelegateIOS::commitStateAfterChildren):
463
464         Don't move based on the layout scroll position. This just overrides the user scroll position.
465         Remove ScrolledContentsLayer checks, we only need to deal with the ScrollContainerLayer here.
466
467         (WebKit::ScrollingTreeScrollingNodeDelegateIOS::setScrollLayerPosition):
468
469         Scroll the UIScrollView correctly. This is called as a result of setting the RequestedScrollPosition property.
470         Remove scroll origin code, it doesn't look correct (and is untested).
471
472 2019-02-20  Chris Dumez  <cdumez@apple.com>
473
474         [PSON] Make sure hung processes are not kept alive by suspended pages or process caching
475         https://bugs.webkit.org/show_bug.cgi?id=194881
476         <rdar://problem/48249014>
477
478         Reviewed by Geoffrey Garen.
479
480         After we construct a SuspendedPageProxy and before we send the IPC to the WebProcess to
481         ask it to suspend, start a 10 seconds timer. If the process does not answer the request
482         to suspend before the timer fires, we destroy the SuspendedPageProxy so that we do not
483         keep a hung process around.
484
485         For the WebProcessCache, we now call WebProcessProxy::isResponsive() on the process
486         before adding it to the cache. Internally, this relies on an IPC handshake with the
487         WebProcess. If the process is not responsive, we do not add it to the cache and we
488         shut it down. If it is responsive then we proceed normally with adding it to the
489         cache.
490
491         * UIProcess/SuspendedPageProxy.cpp:
492         (WebKit::SuspendedPageProxy::SuspendedPageProxy):
493         (WebKit::SuspendedPageProxy::didProcessRequestToSuspend):
494         (WebKit::SuspendedPageProxy::suspensionTimedOut):
495         * UIProcess/SuspendedPageProxy.h:
496         * UIProcess/WebProcessCache.cpp:
497         (WebKit::WebProcessCache::addProcessIfPossible):
498         (WebKit::WebProcessCache::addProcess):
499         * UIProcess/WebProcessCache.h:
500         * UIProcess/WebProcessProxy.cpp:
501         (WebKit::WebProcessProxy::processDidTerminateOrFailedToLaunch):
502         (WebKit::WebProcessProxy::maybeShutDown):
503         (WebKit::WebProcessProxy::isResponsive):
504         * UIProcess/WebProcessProxy.h:
505
506 2019-02-20  Chris Dumez  <cdumez@apple.com>
507
508         Unreviewed build fix after r241823.
509
510         * UIProcess/SuspendedPageProxy.h:
511
512 2019-02-20  Alex Christensen  <achristensen@webkit.org>
513
514         Unreviewed, rolling out r241838.
515
516         Broke API tests
517
518         Reverted changeset:
519
520         "Resolve WebsiteDataStore/HTTPCookieStore ref cycle"
521         https://bugs.webkit.org/show_bug.cgi?id=194868
522         https://trac.webkit.org/changeset/241838
523
524 2019-02-20  Wenson Hsieh  <wenson_hsieh@apple.com>
525
526         REGRESSION: [ iOS ] Layout Test editing/input/ios/rtl-keyboard-input-on-focus.html is a Timeout
527         https://bugs.webkit.org/show_bug.cgi?id=194601
528         <rdar://problem/48080316>
529
530         Reviewed by Tim Horton.
531
532         Following r241311, if a web view becomes first responder and is then moved offscreen (or obscured, hidden, or in
533         the case of WebKitTestRunner, its UIWindow loses its status as keyWindow), we end up holding on to the input
534         view update deferral token indefinitely, waiting for the current focused element to be blurred or refocused.
535
536         This also manifests other user-facing bugs, the most common of which is the keyboard occasionally remaining
537         onscreen after typing a URL in the unified field in MobileSafari and hitting Return, in the case where there is
538         no autofocused element on the page.
539
540         To fix this, when becoming the first responder, additionally install a callback to detect when the page is
541         finished handling the activity state change, and invalidate the input deferral token then. This retains the
542         behavior where calling -becomeFirstResponder on the web view while a different view is focused will keep the
543         keyboard stable, since the focused element message from the web process should be dispatched when handling the
544         activity state change within the web process.
545
546         Of course, the web process may not be responsive at all while the web view is still in the view hierarchy, in
547         which case we may still end up deferring input view updates indefinitely. In this case, we maintain a separate
548         watchdog timer with a short delay, after which we unconditionally invalidate the token.
549
550         * UIProcess/WebPageProxy.cpp:
551         (WebKit::WebPageProxy::installActivityStateChangeCompletionHandler):
552
553         Move the implementation of installActivityStateChangeCompletionHandler into cross-platform code.
554
555         * UIProcess/WebPageProxy.h:
556         * UIProcess/ios/WKContentView.mm:
557         * UIProcess/ios/WKContentViewInteraction.mm:
558         (-[WKContentView cleanupInteraction]):
559         (-[WKContentView _cancelPreviousResetInputViewDeferralRequest]):
560         (-[WKContentView _scheduleResetInputViewDeferralAfterBecomingFirstResponder]):
561         (-[WKContentView _resetInputViewDeferral]):
562         (-[WKContentView becomeFirstResponderForWebView]):
563         (-[WKContentView resignFirstResponderForWebView]):
564         (-[WKContentView _commitPotentialTapFailed]):
565         (-[WKContentView _didNotHandleTapAsClick:]):
566         (-[WKContentView _didCompleteSyntheticClick]):
567
568         Funnel all existing calls that reset _inputViewDeferralToken to nullptr, such that they go through a helper
569         method instead that also cancels any scheduled requests to clear the token.
570
571         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
572         (WebKit::RemoteLayerTreeDrawingArea::activityStateDidChange):
573
574         Respond to all pending callbacks after handling the activity state change.
575
576 2019-02-20  Chris Dumez  <cdumez@apple.com>
577
578         Regression(PSON) "Reload without content extensions" does not work when the main resource is blocked
579         https://bugs.webkit.org/show_bug.cgi?id=194872
580         <rdar://problem/47924500>
581
582         Reviewed by Alex Christensen.
583
584         [WKWebView _reloadWithoutContentBlockers] relies on a ReloadOption flag that is passed to WebCore
585         instead of using WebsitePolicies.contentBlockersEnabled flag. If the reload causes a process swap
586         due to PSON, then the new process does not know about this ReloadOption and fails to honor it.
587
588         Since the modern way to do this is WebsitePolicies, and since WebsitePolicies are properly
589         propagated cross-process in case of process swap, this patch updates _reloadWithoutContentBlockers
590         to set a flag on the Navigation which we use to later set the WebsitePolicies.contentBlockersEnabled
591         flag in WebPageProxy::receivedNavigationPolicyDecision().
592
593         * UIProcess/API/APINavigation.h:
594         (API::Navigation::setUserContentExtensionsEnabled):
595         (API::Navigation::userContentExtensionsEnabled const):
596         * UIProcess/WebPageProxy.cpp:
597         (WebKit::WebPageProxy::reload):
598         (WebKit::WebPageProxy::receivedNavigationPolicyDecision):
599
600 2019-02-20  Truitt Savell  <tsavell@apple.com>
601
602         Unreviewed, rolling out r241817.
603
604         Caused 4 API failures
605
606         Reverted changeset:
607
608         "[GTK] Epiphany searching for plugins even if plugins are
609         disabled"
610         https://bugs.webkit.org/show_bug.cgi?id=194352
611         https://trac.webkit.org/changeset/241817
612
613 2019-02-20  Andy Estes  <aestes@apple.com>
614
615         [Xcode] Add SDKVariant.xcconfig to various Xcode projects
616         https://bugs.webkit.org/show_bug.cgi?id=194869
617
618         Rubber-stamped by Jer Noble.
619
620         * WebKit.xcodeproj/project.pbxproj:
621
622 2019-02-20  Alex Christensen  <achristensen@webkit.org>
623
624         Resolve WebsiteDataStore/HTTPCookieStore ref cycle
625         https://bugs.webkit.org/show_bug.cgi?id=194868
626
627         Reviewed by Geoffrey Garen.
628
629         * UIProcess/API/APIHTTPCookieStore.cpp:
630         (API::HTTPCookieStore::HTTPCookieStore):
631         (API::HTTPCookieStore::cookies):
632         (API::HTTPCookieStore::setCookie):
633         (API::HTTPCookieStore::deleteCookie):
634         (API::HTTPCookieStore::registerObserver):
635         (API::HTTPCookieStore::unregisterObserver):
636         (API::HTTPCookieStore::cookieManagerDestroyed):
637         (API::HTTPCookieStore::registerForNewProcessPoolNotifications):
638         (API::HTTPCookieStore::ref const):
639         (API::HTTPCookieStore::deref const):
640         * UIProcess/API/APIHTTPCookieStore.h:
641
642 2019-02-20  Per Arne Vollan  <pvollan@apple.com>
643
644         [iOS] Open sandbox for specific call.
645         https://bugs.webkit.org/show_bug.cgi?id=194860
646         <rdar://problem/48166729>
647
648         Reviewed by Brent Fulgham.
649
650         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
651
652 2019-02-20  Alex Christensen  <achristensen@webkit.org>
653
654         Move API::HTTPCookieStore ownership from API::WebsiteDataStore to WebKit::WebsiteDataStore
655         https://bugs.webkit.org/show_bug.cgi?id=194842
656
657         Reviewed by Geoff Garen.
658
659         We need a way to get from WebKit::WebsiteDataStore to API::HTTPCookieStore.  It can't be done before this.
660         This made an existing reference cycle easier to see, and we should fix it in a followup patch.
661
662         * UIProcess/API/APIWebsiteDataStore.cpp:
663         (API::WebsiteDataStore::httpCookieStore):
664         * UIProcess/API/APIWebsiteDataStore.h:
665         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
666         (WebKit::WebsiteDataStore::cookieStore):
667         * UIProcess/WebsiteData/WebsiteDataStore.h:
668
669 2019-02-20  Chris Dumez  <cdumez@apple.com>
670
671         Regression(PSON) Crash under WebKit::WebPageProxy::decidePolicyForNavigationActionSync
672         https://bugs.webkit.org/show_bug.cgi?id=194857
673         <rdar://problem/47759323>
674
675         Reviewed by Alex Christensen.
676
677         The ProvisionalPageProxy was blindly forwarding the DecidePolicyForNavigationActionSync
678         synchronous IPC to the WebPageProxy, without passing it the process the IPC came from.
679         As a result, WebPageProxy::decidePolicyForNavigationActionSync() would try to look up
680         a WebFrameProxy using the provided frameID from the wrong process and we would end up
681         hitting a RELEASE_ASSERT().
682
683         * UIProcess/ProvisionalPageProxy.cpp:
684         (WebKit::ProvisionalPageProxy::decidePolicyForNavigationActionSync):
685         (WebKit::ProvisionalPageProxy::didReceiveSyncMessage):
686         * UIProcess/ProvisionalPageProxy.h:
687         * UIProcess/WebPageProxy.cpp:
688         (WebKit::WebPageProxy::decidePolicyForNavigationActionSync):
689         (WebKit::WebPageProxy::decidePolicyForNavigationActionSyncShared):
690         * UIProcess/WebPageProxy.h:
691
692 2019-02-20  Don Olmstead  <don.olmstead@sony.com>
693
694         [MSVC] Fix compilation errors with lambdas in Service Workers
695         https://bugs.webkit.org/show_bug.cgi?id=194841
696
697         Reviewed by Alex Christensen.
698
699         * WebProcess/Storage/ServiceWorkerClientFetch.cpp:
700         (WebKit::ServiceWorkerClientFetch::didReceiveRedirectResponse):
701
702 2019-02-20  Carlos Garcia Campos  <cgarcia@igalia.com>
703
704         [GTK] Epiphany searching for plugins even if plugins are disabled
705         https://bugs.webkit.org/show_bug.cgi?id=194352
706
707         Reviewed by Michael Catanzaro.
708
709         Check pluginsEnabled setting before trying to get plugins from UI process.
710
711         * WebProcess/Plugins/WebPluginInfoProvider.cpp:
712         (WebKit::WebPluginInfoProvider::populatePluginCache):
713
714 2019-02-20  Carlos Garcia Campos  <cgarcia@igalia.com>
715
716         [WPE] Send client host fd and library name as web process creation parameters
717         https://bugs.webkit.org/show_bug.cgi?id=194494
718
719         Reviewed by Žan Doberšek.
720
721         Instead of using command line arguments. The code is simpler and we don't need wpe specific code in process
722         launcher glib implementation.
723
724         * Shared/WebProcessCreationParameters.cpp:
725         (WebKit::WebProcessCreationParameters::encode const):
726         (WebKit::WebProcessCreationParameters::decode):
727         * Shared/WebProcessCreationParameters.h:
728         * UIProcess/Launcher/glib/ProcessLauncherGLib.cpp:
729         (WebKit::ProcessLauncher::launchProcess):
730         * UIProcess/glib/WebProcessPoolGLib.cpp:
731         (WebKit::WebProcessPool::platformInitializeWebProcess):
732         * WebProcess/glib/WebProcessGLib.cpp:
733         (WebKit::WebProcess::platformInitializeWebProcess):
734         * WebProcess/wpe/WebProcessMainWPE.cpp:
735
736 2019-02-20  Adrian Perez de Castro  <aperez@igalia.com>
737
738         [WPE][GTK] Enable support for CONTENT_EXTENSIONS
739         https://bugs.webkit.org/show_bug.cgi?id=167941
740
741         Reviewed by Carlos Garcia Campos.
742
743         Adds new API to manage a collection of content extensions on disk (including compilation
744         of new ones) using WebKitUserContentFilterStore; the associated WebKitUserContentFilter
745         type (which represents a compiled content extension); and the functions needed to enable
746         and disable them for a given WebKitUserContentManager.
747
748         The WebKitUserContentFilterStore public API is expressed in abstract terms of "saving"
749         filters into the store (which involves compiling the JSON source rule set); and "loading"
750         them back as main operations. This way we do not disclose to users of the API any detail
751         about compilation, nor how contents are laid out on disk, and the documentation explicitly
752         tells about only using the provided functions to manipulate the on-disk contents. This
753         way we allow ourselves some leeway if the implementation needs changing in the future.
754
755         * PlatformGTK.cmake: Added WebKitUserContentFilterStore.h to the list of public API headers.
756         * PlatformWPE.cmake: Ditto.
757         * SourcesGTK.txt: Added WebKitUserContentFilterStore.cpp
758         * SourcesWPE.txt: Ditto.
759         * UIProcess/API/glib/WebKitError.cpp: Add definition of webkit_user_content_filter_error_quark().
760         * UIProcess/API/glib/WebKitUserContent.cpp: Added WebKitUserContentFilter.
761         (_WebKitUserContentFilter::_WebKitUserContentFilter):
762         (webkit_user_content_filter_ref):
763         (webkit_user_content_filter_unref):
764         (webkit_user_content_filter_get_identifier):
765         (webkitUserContentFilterCreate):
766         (webkitUserContentFilterGetContentRuleList):
767         * UIProcess/API/glib/WebKitUserContentFilterStore.cpp: Added.
768         (toGError): Utility function to convert content extension error codes to GError.
769         (webkit_user_content_filter_store_class_init):
770         (webkit_user_content_filter_store_new):
771         (webkit_user_content_filter_store_get_path):
772         (webkitUserContentFilterStoreSaveBytes): Common function used as final step for all the
773         functions which save (compile) JSON rule sets into the store, to avoid duplicating code.
774         (webkit_user_content_filter_store_save):
775         (webkit_user_content_filter_store_save_finish):
776         (webkit_user_content_filter_store_save_from_file):
777         (webkit_user_content_filter_store_save_from_file_finish):
778         (webkit_user_content_filter_store_remove):
779         (webkit_user_content_filter_store_remove_finish):
780         (webkit_user_content_filter_store_load):
781         (webkit_user_content_filter_store_lookup_finish):
782         (webkit_user_content_filter_store_fetch_identifiers):
783         (webkit_user_content_filter_store_fetch_identifiers_finish):
784         * UIProcess/API/glib/WebKitUserContentManager.cpp: Added definitions for the new API
785         functions to add and remove filters from an user content manager.
786         (webkit_user_content_manager_add_filter):
787         (webkit_user_content_manager_remove_filter):
788         (webkit_user_content_manager_remove_all_filters):
789         * UIProcess/API/glib/WebKitUserContentPrivate.h: Added declarations for
790         webkitUserContentFilterCreate() and webkitUserContentFilterGetContentRuleList().
791         * UIProcess/API/gtk/WebKitAutocleanups.h: Added autocleanups for WebKitUserContentFilter
792         and WebKitUserContentFilterStore.
793         * UIProcess/API/gtk/WebKitError.h: Added declarations for WEBKIT_USER_CONTENT_FILTER_ERROR
794         plus the associated webkit_user_content_filter_error_quark() function and
795         WebKitUserContentFilterErrror enum.
796         * UIProcess/API/gtk/WebKitUserContent.h: Added declarations for WebKitUserContentFilter
797         and its associated functions.
798         * UIProcess/API/gtk/WebKitUserContentFilterStore.h: Added.
799         * UIProcess/API/gtk/WebKitUserContentManager.h: Added declarations for the functions to
800         add and remove filters from the user content manager.
801         * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt: Added new API functions and types to
802         be included in the documentation.
803         * UIProcess/API/gtk/webkit2.h: Added inclusion of WebKitUserContentFilterStore.h
804         * UIProcess/API/wpe/WebKitError.h: Same as for the GTK port header.
805         * UIProcess/API/wpe/WebKitUserContent.h: Same as for the GTK port header.
806         * UIProcess/API/wpe/WebKitUserContentFilterStore.h: Added.
807         * UIProcess/API/wpe/WebKitUserContentManager.h: Same as for the GTK port header.
808         * UIProcess/API/wpe/docs/wpe-0.1-sections.txt: Added new API functions and types to be
809         included in the documentation.
810         * UIProcess/API/wpe/webkit.h: Added inclusion of WebKitUserContentFilterStore.h
811
812 2019-02-19  Antti Koivisto  <antti@apple.com>
813
814         Pass rootContentsLayer to Mac remote layer tree
815         https://bugs.webkit.org/show_bug.cgi?id=194828
816
817         Reviewed by Simon Fraser.
818
819         Make this code path work again.
820
821         * Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.cpp:
822         (ArgumentCoder<ScrollingStateFrameScrollingNode>::encode):
823         (ArgumentCoder<ScrollingStateFrameScrollingNode>::decode):
824         * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp:
825         (WebKit::RemoteScrollingCoordinatorProxy::connectStateNodeLayers):
826
827 2019-02-19  Alex Christensen  <achristensen@webkit.org>
828
829         Reduce use of LegacySync IPC messages
830         https://bugs.webkit.org/show_bug.cgi?id=194783
831
832         Reviewed by Geoffrey Garen.
833
834         * UIProcess/WebProcessPool.cpp:
835         (WebKit::WebProcessPool::handleSynchronousMessage):
836         * UIProcess/WebProcessPool.h:
837         * UIProcess/WebProcessPool.messages.in:
838         * UIProcess/WebProcessProxy.cpp:
839         (WebKit::WebProcessProxy::getPlugins):
840         (WebKit::WebProcessProxy::shouldTerminate):
841         * UIProcess/WebProcessProxy.h:
842         * UIProcess/WebProcessProxy.messages.in:
843         * WebProcess/Plugins/PluginProcessConnection.cpp:
844         (WebKit::PluginProcessConnection::setException):
845         * WebProcess/Plugins/PluginProcessConnection.h:
846         * WebProcess/Plugins/PluginProcessConnection.messages.in:
847         * WebProcess/Plugins/PluginProxy.cpp:
848         (WebKit::PluginProxy::didCreatePlugin):
849         (WebKit::PluginProxy::didFailToCreatePlugin):
850         (WebKit::PluginProxy::proxiesForURL):
851         (WebKit::PluginProxy::cookiesForURL):
852         (WebKit::PluginProxy::getAuthenticationInfo):
853         (WebKit::PluginProxy::getPluginElementNPObject):
854         (WebKit::PluginProxy::evaluate):
855         (WebKit::PluginProxy::createPluginContainer):
856         * WebProcess/Plugins/PluginProxy.h:
857         * WebProcess/Plugins/PluginProxy.messages.in:
858
859 2019-02-19  Alex Christensen  <achristensen@webkit.org>
860
861         Remove assertion introduced in r229683
862         https://bugs.webkit.org/show_bug.cgi?id=194825
863         <rdar://problem/47628258>
864
865         Reviewed by Geoffrey Garen.
866
867         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
868         (WebKit::WebFrameLoaderClient::dispatchWillSubmitForm):
869         If we reach this code and the form's original Document's Frame has been destroyed,
870         we have already been told to submit the form so do so, just like we do if the WebPage
871         has been destroyed.  This is a rare edge case having to do with the timing of Frame
872         destruction and decidePolicyForNavigationAction response, which unfortunately does not
873         reproduce with a test case unless the timing of IPC is just right.
874
875 2019-02-19  Antoine Quint  <graouts@apple.com>
876
877         [iOS] "touch-action: none" should not prevent text selection or tapping on a link
878         https://bugs.webkit.org/show_bug.cgi?id=194812
879         <rdar://problem/47901131>
880
881         Reviewed by Dean Jackson.
882
883         We shouldn't prevent all gestures to be disabled when "touch-action: none" is set and instead follow the same code path we would use should
884         "pan-x", "pan-y" or "pinch-zoom" be used.
885
886         * UIProcess/ios/WKContentViewInteraction.mm:
887         (-[WKContentView _handleTouchActionsForTouchEvent:]):
888
889 2019-02-18  Alex Christensen  <achristensen@webkit.org>
890
891         Revert functional part of r241451
892         https://bugs.webkit.org/show_bug.cgi?id=194510
893
894         * UIProcess/WebPageProxy.cpp:
895         (WebKit::WebPageProxy::didFinishDocumentLoadForFrame):
896         It caused crashes and assertions on Linux and Cocoa without safe browsing, which
897         means it's fundamentally flawed in some way.  The testing piping was fine.
898
899 2019-02-18  Chris Dumez  <cdumez@apple.com>
900
901         REGRESSION (PSON): Can't access optumbank.com from myuhc.com
902         https://bugs.webkit.org/show_bug.cgi?id=194797
903         <rdar://problem/48055151>
904
905         Reviewed by Geoffrey Garen.
906
907         The issue was caused by us mistakenly process-swapping for a same-site server side redirect.
908         The reason we were getting it wrong is because the logic in
909         WebProcessPool::processForNavigationInternal() was expecting page.process() to be the source
910         process and page.pageLoadState().url() to be the source URL. Those assumptions are incorrect
911         when a server-side redirect occurs in a provisional process. In such case, the source process
912         is the ProvisionalPageProxy's process and the source URL is the provisional URL, not the
913         committed one.
914
915         * UIProcess/ProvisionalPageProxy.cpp:
916         (WebKit::ProvisionalPageProxy::didPerformServerRedirect):
917         (WebKit::ProvisionalPageProxy::didReceiveServerRedirectForProvisionalLoadForFrame):
918         (WebKit::ProvisionalPageProxy::didReceiveMessage):
919         * UIProcess/ProvisionalPageProxy.h:
920         Make sure the provisional page forwards IPC related to server-side redirects to the page so
921         that the client gets informed.
922
923         * UIProcess/WebPageProxy.cpp:
924         (WebKit::WebPageProxy::receivedNavigationPolicyDecision):
925         (WebKit::WebPageProxy::didPerformServerRedirect):
926         (WebKit::WebPageProxy::didPerformServerRedirectShared):
927         * UIProcess/WebPageProxy.h:
928         * UIProcess/WebProcessPool.cpp:
929         (WebKit::WebProcessPool::processForNavigation):
930         (WebKit::WebProcessPool::processForNavigationInternal):
931         * UIProcess/WebProcessPool.h:
932
933 2019-02-16  Darin Adler  <darin@apple.com>
934
935         Continue reducing use of String::format, now focusing on hex: "%p", "%x", etc.
936         https://bugs.webkit.org/show_bug.cgi?id=194752
937
938         Reviewed by Daniel Bates.
939
940         * Platform/IPC/win/ConnectionWin.cpp:
941         (IPC::Connection::createServerAndClientIdentifiers): Use makeString instead of
942         String::format.
943         * Shared/win/WebEventFactory.cpp:
944         (WebKit::keyIdentifierFromEvent): Ditto.
945
946         * UIProcess/API/APINavigation.cpp:
947         (API::Navigation::loggingString const): Use hex instead of String::format.
948         * UIProcess/SuspendedPageProxy.cpp:
949         (WebKit::SuspendedPageProxy::loggingString const): Ditto.
950
951         * UIProcess/WebBackForwardList.cpp:
952         (WebKit::WebBackForwardList::loggingString): Added a "0x".
953
954         * UIProcess/gtk/InputMethodFilter.cpp:
955         (WebKit::InputMethodFilter::logHandleKeyboardEventForTesting): Use makeString and hex
956         instead of String::format and "%x".
957         (WebKit::InputMethodFilter::logHandleKeyboardEventWithCompositionResultsForTesting):
958         Ditto.
959
960 2019-02-18  Wenson Hsieh  <wenson_hsieh@apple.com>
961
962         [iOS] Support pasting item-provider-backed data on the pasteboard as attachment elements
963         https://bugs.webkit.org/show_bug.cgi?id=194670
964         <rdar://problem/39066529>
965
966         Reviewed by Tim Horton.
967
968         Remove all IPC plumbing for getTypesByFidelityForItemAtIndex, now that the types in fidelity order have been
969         rolled into PasteboardItemInfo.
970
971         Additionally, remove support for subresource URL replacement. This feature was originally added with the
972         intention that private clients (i.e. Mail) would intercept pasted or dropped images and replace their URLs.
973         However, since <rdar://problem/43216836>, our strategy for this scenario has changed, such that WebKit now
974         handles the drop/paste, and later delivers the image data to the client via NSFileWrappers in the UI process.
975         At this time, there are no adopters of this SPI, and no adopters of the V2 injected bundle editing client. As
976         such, we can simply revert all of this to its state prior to the introduction of the replacement URL SPI, with
977         the exception to changes in WKBundlePageEditorClient.h, wherein there is a nonzero (but likely tiny) chance of
978         completely breaking binary compatability with any third parties on macOS which may have tried to adopt
979         subresource URL replacement.
980
981         * UIProcess/Cocoa/WebPasteboardProxyCocoa.mm:
982         (WebKit::WebPasteboardProxy::getPasteboardTypesByFidelityForItemAtIndex): Deleted.
983         * UIProcess/WebPasteboardProxy.h:
984         * UIProcess/WebPasteboardProxy.messages.in:
985         * UIProcess/ios/WKContentViewInteraction.mm:
986         (-[WKContentView canPerformActionForWebView:withSender:]):
987
988         Return YES for -paste: in the case where:
989         1. The pasteboard contains items that are explicitly marked as attachments.
990         2. The selection is richly contenteditable.
991         3. Attachment elements are enabled.
992
993         Among other things, this allows the callout bar on iOS to show the "Paste" action.
994
995         * WebProcess/InjectedBundle/API/APIInjectedBundleEditorClient.h:
996         (API::InjectedBundle::EditorClient::performTwoStepDrop):
997         (API::InjectedBundle::EditorClient::replacementURLForResource): Deleted.
998         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInEditingDelegate.h:
999         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:
1000         (-[WKWebProcessPlugInBrowserContextController _setEditingDelegate:]):
1001         * WebProcess/InjectedBundle/InjectedBundlePageEditorClient.cpp:
1002         (WebKit::InjectedBundlePageEditorClient::replacementURLForResource): Deleted.
1003         * WebProcess/InjectedBundle/InjectedBundlePageEditorClient.h:
1004         * WebProcess/WebCoreSupport/WebEditorClient.cpp:
1005         (WebKit::WebEditorClient::replacementURLForResource): Deleted.
1006         * WebProcess/WebCoreSupport/WebEditorClient.h:
1007         * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
1008         (WebKit::WebPlatformStrategies::getTypesByFidelityForItemAtIndex): Deleted.
1009         * WebProcess/WebCoreSupport/WebPlatformStrategies.h:
1010
1011 2019-02-18  Jeremy Jones  <jeremyj@apple.com>
1012
1013         exitFullscreen should not instantiate a new model/interface mapping.
1014         https://bugs.webkit.org/show_bug.cgi?id=191988
1015         rdar://problem/42327939
1016
1017         Reviewed by Jer Noble.
1018
1019         This change is a speculative fix for a crash that cannot be reproduced.
1020
1021         Somehow, exitFullscreen is being requested after didCleanupFullscreen has completed.
1022         This change should allow us to prevent the crash in release, and assert in debug.
1023
1024         * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm:
1025         (WebKit::VideoFullscreenManagerProxy::exitFullscreen):
1026
1027 2019-02-18  John Wilander  <wilander@apple.com>
1028
1029         Check the existence of the frame in Document::hasFrameSpecificStorageAccess() and Document::setHasFrameSpecificStorageAccess()
1030         https://bugs.webkit.org/show_bug.cgi?id=194777
1031         <rdar://problem/47731945>
1032
1033         Reviewed by Geoffrey Garen and Chris Dumez.
1034
1035         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
1036         (WebKit::NetworkConnectionToWebProcess::logUserInteraction):
1037            Now returns early if the incoming session ID is invalid.
1038            Added an ASSERT to help us find other call sites passing invalid session IDs.
1039
1040 2019-02-18  Per Arne Vollan  <pvollan@apple.com>
1041
1042         It should be possible to get the mouse event modifiers for a page overlay client.
1043         https://bugs.webkit.org/show_bug.cgi?id=189621
1044         <rdar://problem/44437279>
1045
1046         Reviewed by Daniel Bates.
1047
1048         When access to the WindowServer is blocked, [NSEvent modifierFlags] always returns 0.
1049         This can be fixed by swizzling the class method, and getting the cached modifiers from
1050         PlatformKeyboardEvent.
1051  
1052         * WebProcess/cocoa/WebProcessCocoa.mm:
1053         (WebKit::currentModifierFlags):
1054         (WebKit::WebProcess::platformInitializeProcess):
1055
1056 2019-02-18  Claudio Saavedra  <csaavedra@igalia.com>
1057
1058         WebPageProxy::didFinishDocumentLoadForFrame() crashing in WPE and GTK+ ports
1059         https://bugs.webkit.org/show_bug.cgi?id=194774
1060
1061         Reviewed by Alex Christensen.
1062
1063         * UIProcess/WebPageProxy.cpp:
1064         (WebKit::WebPageProxy::didFinishDocumentLoadForFrame):
1065         Null check navigation before using it.
1066         This is a regression from r241451.
1067
1068 2019-02-18  Daniel Bates  <dabates@apple.com>
1069
1070         [iOS] Keyups for non-modifier keys identified as "Dead" when not focused in a content-editable element
1071         https://bugs.webkit.org/show_bug.cgi?id=192824
1072         <rdar://problem/47100332>
1073
1074         Reviewed by Wenson Hsieh.
1075
1076         Use the same code path for key events to editable elements and non-editable elements.
1077
1078         Currently we have different code paths for hardware key events depending on whether the active element
1079         is editable or non-editable. Historically to support dispatching DOM keyboard events for hardware key
1080         presses this differentiation was a necessary workaround for UIKit's event processing precedence of
1081         interpreting key events for system text editing commands and app commands before dispatching unhandled
1082         key events to WebKit. This workaround intercepted raw key UIEvents and manually reconstructed a
1083         WebEvent from it. However there is not enough information in an UIEvent to reconstruct a WebEvent that
1084         is identical to the WebEvent that UIKit would have dispatched. In particular, keyup UIEvents always have
1085         empty modified and unmodified input strings. The UIKit keyboard machinery maintains additional state
1086         that is necessary to manufacture the correct WebEvent corresponding to a UIEvent.
1087
1088         As a side benefit of this change, with the exception of modifier flag changes, both hardware and software
1089         key events use the same code path.
1090
1091         * UIProcess/ios/WKContentViewInteraction.h:
1092         * UIProcess/ios/WKContentViewInteraction.mm:
1093         (-[WKContentView shouldShowAutomaticKeyboardUI]): Extracted code from _requiresKeyboardWhenFirstResponder
1094         (-[WKContentView _disableAutomaticKeyboardUI]): Implement UIKit SPI to prevent showing the keyboard UI
1095         when there is no focused element now that we are no longer intercepting key UIEvents. Formerly the
1096         keyboard UI was disabled as a side effect of not becoming first responder when there was no focused
1097         element (by returning NO in -_requiresKeyboardWhenFirstResponder).
1098         (-[WKContentView _requiresKeyboardWhenFirstResponder]): Always return YES when building with USE(UIKIT_KEYBOARD_ADDITIONS)
1099         so that we always accept key events. Instead of selectively replying to create a keyboard as a means of
1100         hiding the automatic keyboard UI we now implement _disableAutomaticKeyboardUI to selectively hide the
1101         automatic keyboard UI.
1102         (-[WKContentView applyAutocorrection:toString:withCompletionHandler:]): If we are not in an editable
1103         element then we cannot perform the replacement. This logic was necessary now that we always require a
1104         keyboard.
1105         (-[WKContentView requestAutocorrectionContextWithCompletionHandler:]): If we are not in an editable
1106         element then return an autocorrection object that indicates that we could not compute this data. This
1107         logic was necessary now that we always require a keyboard.
1108         (-[WKContentView textInputTraits]): Do not update traits when the keyboard is going to be dismissed
1109         now that we require a keyboard when first responder even if the focused element is non-editable.
1110         (-[WKContentView _didHandleKeyEvent:eventWasHandled:]): Skip logic for re-sending UIEvents to UIKit
1111         as UIKit now processes the event first. This logic was necessary in order to finally allow UIKit
1112         its chance to interpret the UIEvent, we intercepted, for app key commands.
1113         (-[WKContentView _elementDidBlur]): Call [self _endEditing] so that we dismiss any open form controls
1114         (e.g. a <select> popover menu). Currently this happens either by -_requiresKeyboardWhenFirstResponder
1115         responding NO when switching to another field or pressing Tab or Shift + Tab key command, which we will
1116         no longer use when building with USE(UIKIT_KEYBOARD_ADDITIONS) once I land <https://bugs.webkit.org/show_bug.cgi?id=193048>.
1117         * UIProcess/ios/forms/WKFormSelectPopover.mm:
1118         (-[WKSelectPopover initWithView:hasGroups:]): Do not assign ourself as the keyboard delegate. Otherwise,
1119         type ahead and tab cycling will not work. Currently type ahead and tab cycling work by using the non-
1120         editable code path via -_handleKeyUIEvent. Now that we no longer differentiate between key events for
1121         editable and non-editable elements we need to ensure that the WKContentView is the keyboard delegate
1122         when the popover is presented.
1123
1124 2019-02-18  Jiewen Tan  <jiewen_tan@apple.com>
1125
1126         Tell Networking Process to not optimize load
1127         https://bugs.webkit.org/show_bug.cgi?id=194753
1128         <rdar://problem/48143603>
1129
1130         Reviewed by Brent Fulgham.
1131
1132         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
1133         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
1134
1135 2019-02-18  Dean Jackson  <dino@apple.com>
1136
1137         iOS Safari will not load USDZ in QLPreview when opening as BLOB
1138         https://bugs.webkit.org/show_bug.cgi?id=194766
1139         <rdar://problem/42769186>
1140
1141         Reviewed by Wenson Hsieh.
1142
1143         A download from a Blob URL can happen effectively instantly, which means
1144         that the loadHandler on the registerItemForTypeIdentifier method might not have
1145         been called yet, and we haven't been told what the completionHandler is.
1146         In this case, keep a record of the URL we finished with, and call the completionHandler
1147         right away.
1148
1149         * UIProcess/Cocoa/SystemPreviewControllerCocoa.mm: Add a new private member variable: _downloadedURL.
1150         (-[_WKPreviewControllerDataSource previewController:previewItemAtIndex:]): Call the completionHandler
1151         right away if we've finished.
1152         (-[_WKPreviewControllerDataSource finish:]): Remember that we've finished by recording the URL.
1153
1154 2019-02-18  Alex Christensen  <achristensen@webkit.org>
1155
1156         Disable safe browsing in WKWebView and remove its WKPreferences API
1157         https://bugs.webkit.org/show_bug.cgi?id=194723
1158         <rdar://problem/48122993>
1159
1160         Reviewed by Geoffrey Garen.
1161
1162         * Shared/WebPreferences.yaml:
1163         * UIProcess/API/Cocoa/WKPreferences.h:
1164         * UIProcess/API/Cocoa/WKPreferences.mm:
1165         (-[WKPreferences setSafeBrowsingEnabled:]): Deleted.
1166         (-[WKPreferences isSafeBrowsingEnabled]): Deleted.
1167
1168 2019-02-18  Chris Fleizach  <cfleizach@apple.com>
1169
1170         AX: PSON: Going back from apple.com to search results, cannot interact with HTML content. Disabling Swap Processes on Cross-Site Navigation resolves the issue.
1171         https://bugs.webkit.org/show_bug.cgi?id=194742
1172
1173         Reviewed by Chris Dumez.
1174
1175         Re-initialize the accessibility web process tokens when swapping processes.
1176         Send page load notifications from the UIProcess instead of the WebProcess to improve reliability.
1177
1178         * UIProcess/mac/PageClientImplMac.mm:
1179         (WebKit::PageClientImpl::didFinishLoadForMainFrame):
1180         (WebKit::PageClientImpl::didFailLoadForMainFrame):
1181         * WebProcess/WebPage/WebPage.cpp:
1182         (WebKit::WebPage::reinitializeWebPage):
1183         * WebProcess/WebPage/WebPage.h:
1184         * WebProcess/WebPage/gtk/WebPageGtk.cpp:
1185         (WebKit::WebPage::platformReinitialize):
1186         (WebKit::WebPage::platformDetach): Deleted.
1187         (WebKit::WebPage::platformEditorState const): Deleted.
1188         (WebKit::WebPage::updateAccessibilityTree): Deleted.
1189         (WebKit::WebPage::performDefaultBehaviorForKeyEvent): Deleted.
1190         (WebKit::WebPage::platformCanHandleRequest): Deleted.
1191         (WebKit::WebPage::platformUserAgent const): Deleted.
1192         (WebKit::WebPage::getCenterForZoomGesture): Deleted.
1193         (WebKit::WebPage::setInputMethodState): Deleted.
1194         (WebKit::WebPage::collapseSelectionInFrame): Deleted.
1195         * WebProcess/WebPage/ios/WebPageIOS.mm:
1196         (WebKit::WebPage::platformReinitialize):
1197         * WebProcess/WebPage/mac/WebPageMac.mm:
1198         (WebKit::WebPage::platformReinitialize):
1199         * WebProcess/WebPage/win/WebPageWin.cpp:
1200         (WebKit::WebPage::platformReinitialize):
1201         * WebProcess/WebPage/wpe/WebPageWPE.cpp:
1202         (WebKit::WebPage::platformReinitialize):
1203
1204 2019-02-18  Carlos Garcia Campos  <cgarcia@igalia.com>
1205
1206         [GTK] Crash while filling selection data during drag and drop
1207         https://bugs.webkit.org/show_bug.cgi?id=194698
1208
1209         Reviewed by Michael Catanzaro.
1210
1211         I can't reproduce this, but it seems that m_draggingSelectionData is nullptr in fillDragData(). That can happen
1212         when startDrag cancels a previous DND operation, because the new m_draggingSelectionData is set before the
1213         current DND operation is cancelled, which sets it to nullptr.
1214
1215         * UIProcess/gtk/DragAndDropHandler.cpp:
1216         (WebKit::DragAndDropHandler::startDrag): Finish the previous operation before setting m_draggingSelectionData.
1217
1218 2019-02-17  Youenn Fablet  <youenn@apple.com>
1219
1220         https://device.login.microsoftonline.com is hanging on STP75
1221         https://bugs.webkit.org/show_bug.cgi?id=194734
1222         <rdar://problem/47573830>
1223
1224         Reviewed by Jiewen Tan.
1225
1226         Make sure to only go the XPC route if SecKeyProxyStore has credentials.
1227         Tested manually by going to the above website with and without the patch.
1228         Load hangs without the patch and completes with the patch.
1229
1230         * UIProcess/Authentication/AuthenticationChallengeProxy.cpp:
1231         (WebKit::AuthenticationChallengeProxy::AuthenticationChallengeProxy):
1232         * UIProcess/Authentication/cocoa/SecKeyProxyStore.h:
1233         * UIProcess/Authentication/cocoa/SecKeyProxyStore.mm:
1234         (WebKit::SecKeyProxyStore::initialize):
1235
1236 2019-02-17  David Kilzer  <ddkilzer@apple.com>
1237
1238         Unreviewed, rolling out r241620.
1239
1240         "Causes use-after-free crashes running layout tests with ASan and GuardMalloc."
1241         (Requested by ddkilzer on #webkit.)
1242
1243         Reverted changeset:
1244
1245         "[WTF] Add environment variable helpers"
1246         https://bugs.webkit.org/show_bug.cgi?id=192405
1247         https://trac.webkit.org/changeset/241620
1248
1249 2019-02-15  Youenn Fablet  <youenn@apple.com>
1250
1251         NetworkDataTask should check its client before calling shouldCaptureExtraNetworkLoadMetrics
1252         https://bugs.webkit.org/show_bug.cgi?id=194732
1253
1254         Reviewed by Geoffrey Garen.
1255
1256         NetworkDataTask may be kept alive if refing it after its NetworkLoad is gone.
1257         This might happen for instance in DownloadManager or when checking for TLS certificates.
1258         In that case, if the NetworkLoad gets destroyed, it clears the client of the NetworkDataTask.
1259         To ensure that NetworkDataTask does not try to use its client, add a null check.
1260
1261         * NetworkProcess/NetworkDataTask.cpp:
1262         (WebKit::NetworkDataTask::shouldCaptureExtraNetworkLoadMetrics const):
1263
1264 2019-02-15  Chris Dumez  <cdumez@apple.com>
1265
1266         [PSON] Allow tweaking WebProcess cache parameters via user defaults
1267         https://bugs.webkit.org/show_bug.cgi?id=194731
1268         <rdar://problem/48125377>
1269
1270         Reviewed by Geoffrey Garen.
1271
1272         Allow tweaking WebProcess cache parameters via user defaults like so:
1273         $ defaults write com.apple.Safari WebProcessCacheCachedProcessLifetimeInSeconds 120
1274         -> Cached processes will be evicted after 2 minutes (instead of 30)
1275
1276         $ defaults write com.apple.Safari WebProcessCacheClearingDelayAfterApplicationResignsActiveInSeconds 60
1277         -> Web process cache will be cleared if Safari is no longer active for 1 minutes (instead of 5).
1278
1279         * SourcesCocoa.txt:
1280         * UIProcess/Cocoa/WebProcessCacheCocoa.mm: Copied from Source/WebKit/UIProcess/WebProcessCache.h.
1281         (WebKit::WebProcessCache::platformInitialize):
1282         * UIProcess/WebProcessCache.cpp:
1283         (WebKit::WebProcessCache::WebProcessCache):
1284         (WebKit::WebProcessCache::platformInitialize):
1285         * UIProcess/WebProcessCache.h:
1286         * WebKit.xcodeproj/project.pbxproj:
1287
1288 2019-02-15  Chris Dumez  <cdumez@apple.com>
1289
1290         [PSON] Disable WebContent process cache on devices with less than 3GB of RAM
1291         https://bugs.webkit.org/show_bug.cgi?id=194726
1292         <rdar://problem/48126255>
1293
1294         Reviewed by Geoffrey Garen.
1295
1296         * UIProcess/WebProcessCache.cpp:
1297         (WebKit::WebProcessCache::updateCapacity):
1298
1299 2019-02-15  Andy Estes  <aestes@apple.com>
1300
1301         [iOS] Stop setting a background color on the PDF host view
1302         https://bugs.webkit.org/show_bug.cgi?id=194722
1303         <rdar://48124152>
1304
1305         Reviewed by Wenson Hsieh.
1306
1307         PDFKit already sets a background color on this view, so there’s no need (and some harm) in
1308         us doing it too.
1309
1310         * UIProcess/ios/WKPDFView.mm:
1311         (-[WKPDFView web_setContentProviderData:suggestedFilename:]):
1312
1313 2019-02-15  Alex Christensen  <achristensen@webkit.org>
1314
1315         Update IPC code generator unit test expectations after r241611
1316         https://bugs.webkit.org/show_bug.cgi?id=194678
1317
1318         * Scripts/webkit/LegacyMessages-expected.h:
1319         * Scripts/webkit/Messages-expected.h:
1320         * Scripts/webkit/MessagesSuperclass-expected.h:
1321
1322 2019-02-15  Ross Kirsling  <ross.kirsling@sony.com>
1323
1324         [WTF] Add environment variable helpers
1325         https://bugs.webkit.org/show_bug.cgi?id=192405
1326
1327         Reviewed by Michael Catanzaro.
1328
1329         * NetworkProcess/EntryPoint/unix/NetworkProcessMain.cpp:
1330         (main):
1331         * Platform/unix/LoggingUnix.cpp:
1332         (WebKit::logLevelString):
1333         * Platform/win/LoggingWin.cpp:
1334         (WebKit::logLevelString):
1335         * PluginProcess/mac/PluginProcessMac.mm:
1336         (WebKit::shouldCallRealDebugger):
1337         * Shared/Plugins/unix/PluginSearchPath.cpp:
1338         (WebKit::pluginsDirectories):
1339         * Shared/glib/ProcessExecutablePathGLib.cpp:
1340         (WebKit::findWebKitProcess):
1341         * UIProcess/API/glib/WebKitSettings.cpp:
1342         (webKitSettingsConstructed):
1343         (webKitSettingsSetProperty):
1344         * UIProcess/API/glib/WebKitWebContext.cpp:
1345         (injectedBundleDirectory):
1346         (webkitWebContextConstructed):
1347         * UIProcess/API/gtk/WebKitWebViewGtk.cpp:
1348         (webkitWebViewMaximizeWindow):
1349         (webkitWebViewRestoreWindow):
1350         * UIProcess/API/wpe/WPEView.cpp:
1351         (WKWPE::m_backend):
1352         * UIProcess/AuxiliaryProcessProxy.cpp:
1353         (WebKit::AuxiliaryProcessProxy::getLaunchOptions):
1354         * UIProcess/Launcher/glib/BubblewrapLauncher.cpp:
1355         (WebKit::XDGDBusProxyLauncher::launch):
1356         (WebKit::bindDBusSession):
1357         (WebKit::bindX11):
1358         (WebKit::bindWayland):
1359         (WebKit::bindPulse):
1360         (WebKit::bindPathVar):
1361         (WebKit::bindGStreamerData):
1362         (WebKit::bubblewrapSpawn):
1363         * UIProcess/Launcher/glib/ProcessLauncherGLib.cpp:
1364         (WebKit::ProcessLauncher::launchProcess):
1365         * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
1366         (WebKit::systemDirectoryPath):
1367         (WebKit::ProcessLauncher::launchProcess):
1368         * UIProcess/glib/WebProcessPoolGLib.cpp:
1369         (WebKit::memoryPressureMonitorDisabled):
1370         (WebKit::WebProcessPool::platformInitialize):
1371         (WebKit::WebProcessPool::platformInitializeWebProcess):
1372         * UIProcess/gtk/HardwareAccelerationManager.cpp:
1373         (WebKit::HardwareAccelerationManager::HardwareAccelerationManager):
1374         * WebProcess/EntryPoint/unix/WebProcessMain.cpp:
1375         (main):
1376         * WebProcess/gtk/WebProcessMainGtk.cpp:
1377         * WebProcess/wpe/WebProcessMainWPE.cpp:
1378         Utilize WTF::Environment where possible.
1379
1380 2019-02-15  Alex Christensen  <achristensen@webkit.org>
1381
1382         Add SPI version of WKPreferences.safeBrowsingEnabled
1383         https://bugs.webkit.org/show_bug.cgi?id=194718
1384         <rdar://problem/48122993>
1385
1386         Rubber-stamped by Brady Eidson.
1387
1388         * UIProcess/API/Cocoa/WKPreferences.mm:
1389         (-[WKPreferences _isSafeBrowsingEnabled]):
1390         (-[WKPreferences _setSafeBrowsingEnabled:]):
1391         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
1392
1393 2019-02-15  Wenson Hsieh  <wenson_hsieh@apple.com>
1394
1395         [iOS] WKWebView callout bar is missing Change Writing Direction item
1396         https://bugs.webkit.org/show_bug.cgi?id=190015
1397         <rdar://problem/44810366>
1398
1399         Reviewed by Tim Horton.
1400
1401         Support -makeTextWritingDirectionLeftToRight: and -makeTextWritingDirectionRightToLeft: in WKWebView on iOS.
1402         To match behavior in native UITextViews on iOS, we implement these methods by changing the *base* writing
1403         direction, rather than the text writing direction (this is in contrast to macOS, which has different
1404         NSResponder methods for changing the base writing direction as opposed to the text writing direction).
1405
1406         Additionally fixes the implementation of -makeTextWritingDirectionNatural:, which currently attempts to change
1407         the text writing direction instead of the base writing direction.
1408
1409         * Platform/spi/ios/UIKitSPI.h:
1410
1411         Add a forward declaration for keyboards SPI to determine whether the user has an active RTL keyboard.
1412
1413         * Shared/EditorState.cpp:
1414         (WebKit::EditorState::PostLayoutData::encode const):
1415         (WebKit::EditorState::PostLayoutData::decode):
1416         (WebKit::operator<<):
1417         * Shared/EditorState.h:
1418
1419         Plumb the base writing direction to the UI process through EditorState.
1420
1421         * UIProcess/ios/WKContentViewInteraction.h:
1422         * UIProcess/ios/WKContentViewInteraction.mm:
1423         (-[WKContentView makeTextWritingDirectionNaturalForWebView:]):
1424         (-[WKContentView makeTextWritingDirectionLeftToRightForWebView:]):
1425         (-[WKContentView makeTextWritingDirectionRightToLeftForWebView:]):
1426
1427         Implement the new SPI (see above for more details).
1428
1429         (-[WKContentView canPerformActionForWebView:withSender:]):
1430
1431         Implement -canPerformAction: for LTR and RTL actions. To match existing UIWebView behavior, we only enable
1432         these actions if either the base writing direction is RTL, or the user has an active RTL keyboard. This means,
1433         for instance, that in the case where a user with only an English keyboard is editing LTR content, we would never
1434         show an option to convert to RTL.
1435
1436         * WebProcess/WebPage/WebPage.cpp:
1437         (WebKit::WebPage::editorState const):
1438
1439 2019-02-15  Alex Christensen  <achristensen@webkit.org>
1440
1441         Make WebPaymentCoordinatorProxy more robust and modern
1442         https://bugs.webkit.org/show_bug.cgi?id=194678
1443
1444         Reviewed by Andy Estes.
1445
1446         Use WeakPtr instead of storing raw pointers in lambdas or the global activePaymentCoordinatorProxy to avoid UAF problems.
1447         Call CompletionHandlers in all code paths to avoid hangs.
1448         Use Delayed instead of LegacySync for synchronous messaging to progress towards removing LegacySync messages.
1449
1450         * Scripts/webkit/messages.py:
1451         * UIProcess/ApplePay/WebPaymentCoordinatorProxy.cpp:
1452         (WebKit::activePaymentCoordinatorProxy):
1453         (WebKit::WebPaymentCoordinatorProxy::~WebPaymentCoordinatorProxy):
1454         (WebKit::WebPaymentCoordinatorProxy::availablePaymentNetworks):
1455         (WebKit::WebPaymentCoordinatorProxy::canMakePayments):
1456         (WebKit::WebPaymentCoordinatorProxy::showPaymentUI):
1457         (WebKit::WebPaymentCoordinatorProxy::didReachFinalState):
1458         * UIProcess/ApplePay/WebPaymentCoordinatorProxy.h:
1459         * UIProcess/ApplePay/WebPaymentCoordinatorProxy.messages.in:
1460         * UIProcess/ApplePay/ios/WebPaymentCoordinatorProxyIOS.mm:
1461         (WebKit::WebPaymentCoordinatorProxy::platformShowPaymentUI):
1462         * UIProcess/ApplePay/mac/WebPaymentCoordinatorProxyMac.mm:
1463         (WebKit::WebPaymentCoordinatorProxy::platformShowPaymentUI):
1464
1465 2019-02-15  Youenn Fablet  <youenn@apple.com>
1466
1467         Make ServiceWorkerClientFetch closer to WebResourceLoader
1468         https://bugs.webkit.org/show_bug.cgi?id=194651
1469
1470         Unreviewed, build fix for WPE.
1471
1472         * WebProcess/Storage/WebServiceWorkerFetchTaskClient.h:
1473
1474 2019-02-15  Chris Dumez  <cdumez@apple.com>
1475
1476         Regression(PSON) Navigating quickly back and forth can lead to getting 'about:blank' in the backforward list
1477         https://bugs.webkit.org/show_bug.cgi?id=194717
1478         <rdar://problem/47884404>
1479
1480         Reviewed by Brady Eidson.
1481
1482         When the client does a history navigation, the UIProcess sends a WebPage::GoToBackForwardItem IPC to the
1483         WebProcess and the WebProcess sends a WebPageProxy::BackForwardGoToItem IPC back to the UIProcess to
1484         update the current item in the BackForwardList. This means that there is a slight delay between the
1485         point a client requests a history navigation and the point where the BackForwardList's current item gets
1486         update. This delay is pre-existing behavior and not new to PSON.
1487
1488         However, with PSON enabled, if we decide to process-swap for the history navigation, we'll tell the
1489         previous (committed) process to ignore the load and we ask a new (provisional) process to do the history
1490         navigation. When the previous process receives the request to ignore the history navigation, it restores
1491         the History's current item to the one previous the navigation, which sends a WebPageProxy::GoToBackForwardItem
1492         IPC to the UIProcess to update the BackForwardList as well. In parallel, the new process starts the
1493         history navigation and also sends a WebPageProxy::GoToBackForwardItem to update the BackForwardList's
1494         current item as well. We end up with a race between the 2 GoToBackForwardItem IPC messages coming from
1495         the old and new process. If the old process's message loses the race, we end up with the wrong current
1496         history item getting set in the UIProcess. Later, when we commit the provisional load and try to suspend
1497         the previous page, we would save the SuspendedPage on the *wrong* BackForwardList item. If one tries to
1498         load this BackForwardList item later, we'll use its SuspendedPage and try to unsuspend it. However,
1499         because the PageCache entry is saved on another HistoryItem than the one getting loaded in the WebProcess
1500         side, we attempt to do a regular load instead of a PageCache restore. We end up failing the load because
1501         pages cannot trigger new loads while in page cache. Because the load fails, we end up loading the
1502         initial empty document and this is how we end up with 'about:blank' in the back forward list.
1503
1504         To address the issue, update WebPageProxy::backForwardGoToItem() to ignore messages from the old/committed
1505         WebProcess when there is a pending provisional load. If the committed processes starts a legit new
1506         load, it would clear any existing pending provisional load before attempting the call backForwardGoToItem().
1507         As a result, ignoring such messages from the old processes when there is a pending provisional load is
1508         safe.
1509
1510         In the future, we should probably move more of the history / backForwardList management to the UIProcess
1511         to avoid this sort of issues. This would be a much larger refactoring though so I am going with this
1512         simpler fix that is easily cherry-pickable for now.
1513
1514         * UIProcess/WebPageProxy.cpp:
1515         (WebKit::WebPageProxy::suspendCurrentPageIfPossible):
1516         (WebKit::WebPageProxy::continueNavigationInNewProcess):
1517         (WebKit::WebPageProxy::backForwardGoToItem):
1518
1519 2019-02-15  Alex Christensen  <achristensen@webkit.org>
1520
1521         Update IPC code generator unit test expectations after r241595
1522         https://bugs.webkit.org/show_bug.cgi?id=194679
1523
1524         * Scripts/webkit/LegacyMessageReceiver-expected.cpp:
1525         (WebKit::WebPage::didReceiveSyncWebPageMessage):
1526         * Scripts/webkit/MessageReceiver-expected.cpp:
1527         (WebKit::WebPage::didReceiveSyncMessage):
1528
1529 2019-02-15  Youenn Fablet  <youenn@apple.com>
1530
1531         Make ServiceWorkerClientFetch closer to WebResourceLoader
1532         https://bugs.webkit.org/show_bug.cgi?id=194651
1533
1534         Reviewed by Alex Christensen.
1535
1536         The goal of this refactoring is to, at some point use the regular network process load path for service worker loads.
1537         This should simplify things and allow less IPC exchanges, for instance in the case of fetch not handled by service worker.
1538
1539         Introduce two IPC messages for supporting redirect responses and allow the didReceiveResponse/continueDidReceiveResponse
1540         handshake for navigation loads.
1541
1542         This makes ServiceWorker having to buffer load information for this particular case.
1543
1544         * NetworkProcess/NetworkProcess.cpp:
1545         (WebKit::NetworkProcess::didReceiveFetchRedirectResponse):
1546         (WebKit::NetworkProcess::didReceiveFetchResponse):
1547         * NetworkProcess/NetworkProcess.h:
1548         * NetworkProcess/NetworkProcess.messages.in:
1549         * NetworkProcess/ServiceWorker/WebSWServerConnection.cpp:
1550         (WebKit::WebSWServerConnection::continueDidReceiveFetchResponse):
1551         (WebKit::WebSWServerConnection::didReceiveFetchRedirectResponse):
1552         (WebKit::WebSWServerConnection::didReceiveFetchResponse):
1553         * NetworkProcess/ServiceWorker/WebSWServerConnection.h:
1554         * NetworkProcess/ServiceWorker/WebSWServerConnection.messages.in:
1555         * WebProcess/Storage/ServiceWorkerClientFetch.cpp:
1556         (WebKit::ServiceWorkerClientFetch::start):
1557         (WebKit::ServiceWorkerClientFetch::didReceiveRedirectResponse):
1558         (WebKit::ServiceWorkerClientFetch::didReceiveResponse):
1559         (WebKit::ServiceWorkerClientFetch::didReceiveData):
1560         (WebKit::ServiceWorkerClientFetch::didFinish):
1561         (WebKit::ServiceWorkerClientFetch::didFail):
1562         (WebKit::ServiceWorkerClientFetch::didNotHandle):
1563         (WebKit::ServiceWorkerClientFetch::cancel):
1564         * WebProcess/Storage/ServiceWorkerClientFetch.h:
1565         * WebProcess/Storage/ServiceWorkerClientFetch.messages.in:
1566         * WebProcess/Storage/WebSWClientConnection.cpp:
1567         (WebKit::WebSWClientConnection::startFetch):
1568         (WebKit::WebSWClientConnection::cancelFetch):
1569         (WebKit::WebSWClientConnection::continueDidReceiveFetchResponse):
1570         * WebProcess/Storage/WebSWClientConnection.h:
1571         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
1572         (WebKit::WebSWContextManagerConnection::continueDidReceiveFetchResponse):
1573         (WebKit::WebSWContextManagerConnection::startFetch):
1574         * WebProcess/Storage/WebSWContextManagerConnection.h:
1575         * WebProcess/Storage/WebSWContextManagerConnection.messages.in:
1576         * WebProcess/Storage/WebServiceWorkerFetchTaskClient.cpp:
1577         (WebKit::WebServiceWorkerFetchTaskClient::WebServiceWorkerFetchTaskClient):
1578         (WebKit::WebServiceWorkerFetchTaskClient::didReceiveRedirection):
1579         (WebKit::WebServiceWorkerFetchTaskClient::didReceiveResponse):
1580         (WebKit::WebServiceWorkerFetchTaskClient::didReceiveData):
1581         (WebKit::WebServiceWorkerFetchTaskClient::didReceiveFormDataAndFinish):
1582         (WebKit::WebServiceWorkerFetchTaskClient::didFail):
1583         (WebKit::WebServiceWorkerFetchTaskClient::didFinish):
1584         (WebKit::WebServiceWorkerFetchTaskClient::continueDidReceiveResponse):
1585         * WebProcess/Storage/WebServiceWorkerFetchTaskClient.h:
1586
1587 2019-02-15  Brian Burg  <bburg@apple.com>
1588
1589         [Mac] WebInspectorUI.framework does not need to be soft-linked anymore
1590         https://bugs.webkit.org/show_bug.cgi?id=194411
1591         <rdar://problem/47787614>
1592
1593         Reviewed by Joseph Pecoraro.
1594
1595         * Configurations/WebKit.xcconfig:
1596         Conditionalize weak linking to WebInspectorUI.framework for Mac only.
1597
1598         * UIProcess/mac/WebInspectorProxyMac.mm:
1599         (WebKit::WebInspectorProxy::inspectorPageURL):
1600         (WebKit::WebInspectorProxy::inspectorTestPageURL):
1601         (WebKit::WebInspectorProxy::inspectorBaseURL):
1602         * WebProcess/WebPage/mac/WebInspectorUIMac.mm:
1603         (WebKit::webInspectorUILocalizedStringsURL):
1604         Rewrite uses of the bundle to exit early if bundle couldn't be loaded.
1605
1606 2019-02-15  Alex Christensen  <achristensen@webkit.org>
1607
1608         IPC code should support messages with both Delayed and WantsConnection attributes
1609         https://bugs.webkit.org/show_bug.cgi?id=194679
1610
1611         Reviewed by Geoffrey Garen.
1612
1613         * Platform/IPC/HandleMessage.h:
1614         (IPC::callMemberFunctionImpl):
1615         (IPC::callMemberFunction):
1616         (IPC::handleMessageDelayedWantsConnection):
1617         * Scripts/webkit/messages.py:
1618         * UIProcess/WebStorage/StorageManager.cpp:
1619         (WebKit::StorageManager::getValues):
1620         * UIProcess/WebStorage/StorageManager.h:
1621         * UIProcess/WebStorage/StorageManager.messages.in:
1622
1623 2019-02-15  Commit Queue  <commit-queue@webkit.org>
1624
1625         Unreviewed, rolling out r241559 and r241566.
1626         https://bugs.webkit.org/show_bug.cgi?id=194710
1627
1628         Causes layout test crashes under GuardMalloc (Requested by
1629         ryanhaddad on #webkit).
1630
1631         Reverted changesets:
1632
1633         "[WTF] Add environment variable helpers"
1634         https://bugs.webkit.org/show_bug.cgi?id=192405
1635         https://trac.webkit.org/changeset/241559
1636
1637         "Unreviewed build fix for WinCairo Debug after r241559."
1638         https://trac.webkit.org/changeset/241566
1639
1640 2019-02-15  Michael Catanzaro  <mcatanzaro@igalia.com>
1641
1642         [WPE][GTK] Defer sandboxing APIs to 2.26
1643         https://bugs.webkit.org/show_bug.cgi?id=194274
1644
1645         Reviewed by Carlos Garcia Campos.
1646
1647         The web process sandbox has not been widely-tested yet, so we should defer the new APIs to
1648         2.26.
1649
1650         * UIProcess/API/glib/WebKitWebContext.cpp:
1651
1652 2019-02-10  Darin Adler  <darin@apple.com>
1653
1654         Replace more uses of String::format with StringConcatenate (mostly non-Apple platform-specific cases)
1655         https://bugs.webkit.org/show_bug.cgi?id=194487
1656
1657         Reviewed by Daniel Bates.
1658
1659         * NetworkProcess/NetworkProcess.cpp:
1660         (WebKit::NetworkProcess::switchToNewTestingSession): Use makeString instead of String::format.
1661         * NetworkProcess/soup/NetworkProcessSoup.cpp:
1662         (WebKit::buildAcceptLanguages): Ditto.
1663         * UIProcess/API/glib/IconDatabase.cpp:
1664         (WebKit::IconDatabase::performURLImport): Ditto.
1665         * UIProcess/gtk/InputMethodFilter.cpp:
1666         (WebKit::InputMethodFilter::logConfirmCompositionForTesting): Ditto.
1667         (WebKit::InputMethodFilter::logSetPreeditForTesting): Ditto.
1668
1669 2019-02-15  Truitt Savell  <tsavell@apple.com>
1670
1671         Unreviewed, rolling out r241564.
1672
1673         Caused 50+ Timeouts on Mac WK2, mostly in the http/ directory
1674
1675         Reverted changeset:
1676
1677         "[Mac] WebInspectorUI.framework does not need to be soft-
1678         linked anymore"
1679         https://bugs.webkit.org/show_bug.cgi?id=194411
1680         https://trac.webkit.org/changeset/241564
1681
1682 2019-02-15  Carlos Garcia Campos  <cgarcia@igalia.com>
1683
1684         Unreviewed. Fix GTK+ build after r241556
1685
1686         I guess this is due to unified builds after a new file being added in r241556.
1687
1688         * UIProcess/API/C/WKAuthenticationDecisionListener.cpp:
1689         * UIProcess/API/C/WKPage.cpp:
1690
1691 2019-02-14  Brent Fulgham  <bfulgham@apple.com>
1692
1693         REGRESSION (r240446): Storage Access API does not handle domains consistently
1694         https://bugs.webkit.org/show_bug.cgi?id=194664
1695
1696         Reviewed by Alex Christensen.
1697         
1698         During my refactoring of the ResourceLoadStatistics code, I introduced two bugs:
1699         (1) I neglected to be consistent in my use of 'primaryDomain', causing some Storage
1700         Access API code paths to store approves under one domain (e.g., 'www.example.com'),
1701         while checking status under the eTLD+1 (e.g., 'example.com'). The exact string matching
1702         requirement caused these to get missed.
1703
1704         (2) I used a move operator before a final set of copies of domain names, leading to
1705         some empty strings being passed to Storage Access API calls.
1706
1707         Both issues are corrected in this patch.
1708
1709         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
1710         (WebKit::WebResourceLoadStatisticsStore::setPrevalentResourceForDebugMode): Always make the
1711         domain comply with our 'primaryDomain' logic.
1712         (WebKit::WebResourceLoadStatisticsStore::hasStorageAccess): Ditto.
1713         (WebKit::WebResourceLoadStatisticsStore::requestStorageAccessGranted): Ditto.
1714         (WebKit::WebResourceLoadStatisticsStore::logFrameNavigation): Ditto.
1715         (WebKit::WebResourceLoadStatisticsStore::logWebSocketLoading): Ditto.
1716         (WebKit::WebResourceLoadStatisticsStore::logSubresourceLoading): Ditto.
1717         (WebKit::WebResourceLoadStatisticsStore::logSubresourceRedirect): Ditto.
1718         (WebKit::WebResourceLoadStatisticsStore::logUserInteraction): Ditto.
1719         (WebKit::WebResourceLoadStatisticsStore::clearUserInteraction): Ditto.
1720         (WebKit::WebResourceLoadStatisticsStore::hasHadUserInteraction): Ditto.
1721         (WebKit::WebResourceLoadStatisticsStore::setLastSeen): Ditto.
1722         (WebKit::WebResourceLoadStatisticsStore::setPrevalentResource): Ditto.
1723         (WebKit::WebResourceLoadStatisticsStore::setVeryPrevalentResource): Ditto.
1724         (WebKit::WebResourceLoadStatisticsStore::isPrevalentResource): Ditto.
1725         (WebKit::WebResourceLoadStatisticsStore::isVeryPrevalentResource): Ditto.
1726         (WebKit::WebResourceLoadStatisticsStore::isRegisteredAsSubresourceUnder): Ditto.
1727         (WebKit::WebResourceLoadStatisticsStore::isRegisteredAsSubFrameUnder): Ditto.
1728         (WebKit::WebResourceLoadStatisticsStore::isRegisteredAsRedirectingTo): Ditto.
1729         (WebKit::WebResourceLoadStatisticsStore::clearPrevalentResource): Ditto.
1730         (WebKit::WebResourceLoadStatisticsStore::setGrandfathered): Ditto.
1731         (WebKit::WebResourceLoadStatisticsStore::isGrandfathered): Ditto.
1732         (WebKit::WebResourceLoadStatisticsStore::setSubframeUnderTopFrameOrigin): Ditto.
1733         (WebKit::WebResourceLoadStatisticsStore::setSubresourceUnderTopFrameOrigin): Ditto.
1734         (WebKit::WebResourceLoadStatisticsStore::setSubresourceUniqueRedirectTo): Ditto.
1735         (WebKit::WebResourceLoadStatisticsStore::setSubresourceUniqueRedirectFrom): Ditto.
1736         (WebKit::WebResourceLoadStatisticsStore::setTopFrameUniqueRedirectTo): Ditto.
1737         (WebKit::WebResourceLoadStatisticsStore::setTopFrameUniqueRedirectFrom): Ditto.
1738         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
1739         (WebKit::WebsiteDataStore::hasStorageAccess): Always make the
1740         domain comply with our 'primaryDomain' logic.
1741         (WebKit::WebsiteDataStore::requestStorageAccess): Ditto. Also make copy of domain
1742         names before moving them to the completion handler.
1743         (WebKit::WebsiteDataStore::grantStorageAccess): Ditto.
1744         * WebProcess/WebPage/WebPage.cpp:
1745         (WebKit::WebPage::hasStorageAccess):  Always make the domain comply with our
1746         'primaryDomain' logic.
1747         (WebKit::WebPage::requestStorageAccess): Ditto.
1748
1749 2019-02-14  Tim Horton  <timothy_horton@apple.com>
1750
1751         Fix the build.
1752
1753         * UIProcess/ios/WKDrawingView.mm:
1754         (-[WKDrawingView renderedDrawing]):
1755
1756 2019-02-14  Youenn Fablet  <youenn@apple.com>
1757
1758         ASSERTION FAILED: m_caches.isEmpty() || !m_pendingInitializationCallbacks.isEmpty() in WebKit::CacheStorage::Caches::clearMemoryRepresentation()
1759         https://bugs.webkit.org/show_bug.cgi?id=188393
1760         <rdar://problem/43025665>
1761
1762         Reviewed by Alex Christensen.
1763
1764         In case Caches::dispose is called, clearMemoryRepresentation might be called if there is no active cache.
1765         We also ensure to not clear the memory representation if there is any remaining removed cache.
1766         Update the clearMemoryRepresentation assertion to take that into account.
1767
1768         In case a Caches is cleared twice, the clearMemoryRepresentation assertion will assert while it should not.
1769         In that case m_storage is null the second time. Update the assertion accordingly.
1770
1771         * NetworkProcess/cache/CacheStorageEngineCaches.cpp:
1772         (WebKit::CacheStorage::Caches::hasActiveCache const):
1773         (WebKit::CacheStorage::Caches::dispose):
1774         (WebKit::CacheStorage::Caches::clearMemoryRepresentation):
1775         * NetworkProcess/cache/CacheStorageEngineCaches.h:
1776
1777 2019-02-14  Brian Burg  <bburg@apple.com>
1778
1779         [Mac] WebInspectorUI.framework does not need to be soft-linked anymore
1780         https://bugs.webkit.org/show_bug.cgi?id=194411
1781         <rdar://problem/47787614>
1782
1783         Reviewed by Joseph Pecoraro.
1784
1785         * Configurations/WebKit.xcconfig:
1786         Conditionalize weak linking to WebInspectorUI.framework for Mac only.
1787
1788         * UIProcess/mac/WebInspectorProxyMac.mm:
1789         (WebKit::WebInspectorProxy::inspectorPageURL):
1790         (WebKit::WebInspectorProxy::inspectorTestPageURL):
1791         (WebKit::WebInspectorProxy::inspectorBaseURL):
1792         * WebProcess/WebPage/mac/WebInspectorUIMac.mm:
1793         (WebKit::webInspectorUILocalizedStringsURL):
1794         Rewrite uses of the bundle to exit early if bundle couldn't be loaded.
1795
1796 2019-02-14  Michael Catanzaro  <mcatanzaro@igalia.com>
1797
1798         [GTK] WebKitGTK+ -> WebKitGTK
1799         https://bugs.webkit.org/show_bug.cgi?id=194658
1800
1801         Reviewed by Alex Christensen.
1802
1803         This renames WebKitGTK+ to WebKitGTK in a few user-visible places: the API documentation,
1804         the pkg-config, and an error message.
1805
1806         In a couple places where it's exposed in WPE documentation, WPE is now mentioned, or the
1807         reference to "WebKitGTK+" is changed to just "WebKit."
1808
1809         * UIProcess/API/glib/WebKitSettings.cpp:
1810         (webkit_settings_class_init):
1811         * UIProcess/API/glib/WebKitWebView.cpp:
1812         * UIProcess/API/gtk/docs/webkit2gtk-docs.sgml:
1813         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMPrivateGtk.h:
1814         * gtk/webkit2gtk-web-extension.pc.in:
1815         * gtk/webkit2gtk.pc.in:
1816
1817 2019-02-14  Ross Kirsling  <ross.kirsling@sony.com>
1818
1819         [WTF] Add environment variable helpers
1820         https://bugs.webkit.org/show_bug.cgi?id=192405
1821
1822         Reviewed by Michael Catanzaro.
1823
1824         * NetworkProcess/EntryPoint/unix/NetworkProcessMain.cpp:
1825         (main):
1826         * Platform/unix/EnvironmentUtilities.cpp:
1827         (WebKit::EnvironmentUtilities::stripValuesEndingWithString):
1828         * Platform/unix/LoggingUnix.cpp:
1829         (WebKit::logLevelString):
1830         * Platform/win/LoggingWin.cpp:
1831         (WebKit::logLevelString):
1832         * PluginProcess/mac/PluginProcessMac.mm:
1833         (WebKit::shouldCallRealDebugger):
1834         * Shared/Plugins/unix/PluginSearchPath.cpp:
1835         (WebKit::pluginsDirectories):
1836         * Shared/glib/ProcessExecutablePathGLib.cpp:
1837         (WebKit::findWebKitProcess):
1838         * UIProcess/API/glib/WebKitSettings.cpp:
1839         (webKitSettingsConstructed):
1840         (webKitSettingsSetProperty):
1841         * UIProcess/API/glib/WebKitWebContext.cpp:
1842         (injectedBundleDirectory):
1843         (webkitWebContextConstructed):
1844         * UIProcess/API/gtk/WebKitWebViewGtk.cpp:
1845         (webkitWebViewMaximizeWindow):
1846         (webkitWebViewRestoreWindow):
1847         * UIProcess/API/wpe/WPEView.cpp:
1848         (WKWPE::m_backend):
1849         * UIProcess/AuxiliaryProcessProxy.cpp:
1850         (WebKit::AuxiliaryProcessProxy::getLaunchOptions):
1851         * UIProcess/Launcher/glib/BubblewrapLauncher.cpp:
1852         (WebKit::XDGDBusProxyLauncher::launch):
1853         (WebKit::bindDBusSession):
1854         (WebKit::bindX11):
1855         (WebKit::bindWayland):
1856         (WebKit::bindPulse):
1857         (WebKit::bindPathVar):
1858         (WebKit::bindGStreamerData):
1859         (WebKit::bubblewrapSpawn):
1860         * UIProcess/Launcher/glib/ProcessLauncherGLib.cpp:
1861         (WebKit::ProcessLauncher::launchProcess):
1862         * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
1863         (WebKit::systemDirectoryPath):
1864         (WebKit::ProcessLauncher::launchProcess):
1865         * UIProcess/glib/WebProcessPoolGLib.cpp:
1866         (WebKit::memoryPressureMonitorDisabled):
1867         (WebKit::WebProcessPool::platformInitialize):
1868         (WebKit::WebProcessPool::platformInitializeWebProcess):
1869         * UIProcess/gtk/HardwareAccelerationManager.cpp:
1870         (WebKit::HardwareAccelerationManager::HardwareAccelerationManager):
1871         * WebProcess/EntryPoint/unix/WebProcessMain.cpp:
1872         (main):
1873         * WebProcess/gtk/WebProcessMainGtk.cpp:
1874         * WebProcess/wpe/WebProcessMainWPE.cpp:
1875         Utilize WTF::Environment where possible.
1876
1877 2019-02-14  Jiewen Tan  <jiewen_tan@apple.com>
1878
1879         Handle _WKNavigationActionPolicyAllowWithoutTryingAppLink for LoadOptimizer
1880         https://bugs.webkit.org/show_bug.cgi?id=194640
1881         <rdar://problem/48064140>
1882
1883         Reviewed by Brent Fulgham.
1884
1885         * UIProcess/Cocoa/NavigationState.mm:
1886         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
1887
1888 2019-02-14  Chris Dumez  <cdumez@apple.com>
1889
1890         [PSON] Introduce a WebContent Process cache
1891         https://bugs.webkit.org/show_bug.cgi?id=194594
1892         <rdar://problem/46793397>
1893
1894         Reviewed by Geoff Garen.
1895
1896         Introduce a WebContent Process cache to reduce the number of process launches when
1897         process swap on navigation is enabled, and to reduce the power cost of the feature.
1898
1899         If a WebProcess loaded pages from a single registrable domain then it is eligible
1900         for the cache. When process-swapping on navigation to a new registrable domain, we
1901         now attempt to retrieve a process from the cache for the domain in question instead
1902         of always launching a new one.
1903
1904         The WebProcess cache currently has the following attributes:
1905         - It may contains 4 processes per GB of RAM the machine has, up to 30 processes.
1906         - WebProcesses automatically get evicted from the cache after 30 minutes.
1907         - If the application is no longer the active app, then the cache will get cleared
1908           after 5 minutes.
1909         - WebProcesses that are in the cache are reported as "(Cached)" in Activity Monitor.
1910
1911         The WebProcess cache is currently disabled by default and can by enabled by the
1912         client via SPI.
1913
1914         * Shared/WebBackForwardListItem.cpp:
1915         (WebKit::WebBackForwardListItem::WebBackForwardListItem):
1916         * Shared/WebBackForwardListItem.h:
1917         (WebKit::WebBackForwardListItem::lastProcessIdentifier const):
1918         (WebKit::WebBackForwardListItem::setLastProcessIdentifier):
1919         Add new lastProcessIdentifier data member that reflects which process this item
1920         was last loaded in. It is normally identical to the identifier of the process
1921         that created the item but it gets overriden in case of cross-site client-side
1922         redirect, since a new process takes over the item in this case.
1923
1924         * Sources.txt:
1925         Add new source file.
1926
1927         * UIProcess/API/APIProcessPoolConfiguration.cpp:
1928         (API::ProcessPoolConfiguration::copy):
1929         * UIProcess/API/APIProcessPoolConfiguration.h:
1930         * UIProcess/API/C/WKContextConfigurationRef.cpp:
1931         (WKContextConfigurationUsesWebProcessCache):
1932         (WKContextConfigurationSetUsesWebProcessCache):
1933         * UIProcess/API/C/WKContextConfigurationRef.h:
1934         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
1935         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
1936         (-[_WKProcessPoolConfiguration setUsesWebProcessCache:]):
1937         (-[_WKProcessPoolConfiguration usesWebProcessCache]):
1938         Add new SPI to enable the WebProcess cache.
1939
1940         * UIProcess/API/Cocoa/WKProcessPool.mm:
1941         (-[WKProcessPool _webProcessCountIgnoringPrewarmedAndCached]):
1942         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
1943         Add new SPI for testing which returns the number of WebProcesses ignoring
1944         both prewarmed and cached ones.
1945
1946         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
1947         (WebKit::WebProcessPool::registerNotificationObservers):
1948         (WebKit::WebProcessPool::unregisterNotificationObservers):
1949         Add application active state observers as the WebProcess cache gets cleared
1950         when the application resigns active state for more than 5 minutes.
1951
1952         * UIProcess/ProvisionalPageProxy.cpp:
1953         (WebKit::ProvisionalPageProxy::loadRequest):
1954         When doing a load in a new process with the BackForwardList locked (i.e. client-side
1955         redirect), make sure we update the last process identifier for the BackForwardListItem.
1956         This is important because the logic in WebProcessPool::processForNavigation() relies on
1957         this identifier to select which process to do the history navigation into, and we want
1958         to do the load in the post-redirect process, not the pre-redirect one.
1959
1960         * UIProcess/WebPageProxy.cpp:
1961         (WebKit::WebPageProxy::didStartProvisionalLoadForFrameShared):
1962         Tell the WebProcess whenever a main frame provisional load is started, providing the URL.
1963
1964         * UIProcess/WebProcessCache.cpp: Added.
1965         (WebKit::WebProcessCache::WebProcessCache):
1966         (WebKit::WebProcessCache::addProcess):
1967         (WebKit::WebProcessCache::takeProcess):
1968         (WebKit::WebProcessCache::updateMaximumSize):
1969         (WebKit::WebProcessCache::clear):
1970         (WebKit::WebProcessCache::setApplicationIsActive):
1971         (WebKit::WebProcessCache::evictProcess):
1972         (WebKit::WebProcessCache::CachedProcess::CachedProcess):
1973         (WebKit::WebProcessCache::CachedProcess::~CachedProcess):
1974         (WebKit::WebProcessCache::CachedProcess::takeProcess):
1975         (WebKit::WebProcessCache::CachedProcess::evictionTimerFired):
1976         * UIProcess/WebProcessCache.h: Added.
1977         (WebKit::WebProcessCache::maximumSize):
1978         (WebKit::WebProcessCache::size const):
1979         (WebKit::WebProcessCache::CachedProcess::process):
1980         Add process cache implementation.
1981
1982         * UIProcess/WebProcessPool.cpp:
1983         (WebKit::m_webProcessCache):
1984         WebProcessCache is stored on the WebProcessPool via m_webProcessCache data member.
1985
1986         (WebKit::WebProcessPool::~WebProcessPool):
1987         Clear the WebProcess cache in the destructor.
1988
1989         (WebKit::WebProcessPool::setApplicationIsActive):
1990         Notify the WebProcessCache whenever the application's active state changes.
1991
1992         (WebKit::WebProcessPool::createWebPage):
1993         If the state of PSON changes via the experimental features menu, dynamically
1994         update the WebProcessCache's size. This is needed because the cache is disabled
1995         when PSON is disabled.
1996
1997         (WebKit::WebProcessPool::handleMemoryPressureWarning):
1998         Clear the WebProcess cache on memory pressure.
1999
2000         (WebKit::WebProcessPool::processForNavigationInternal):
2001         Query the WebProcessCache before attempting to create a new WebProcess for a cross-site
2002         navigation.
2003
2004         (WebKit::WebProcessPool::findReusableSuspendedPageProcess):
2005         This logic was split out of processForNavigationInternal() to reduce the size
2006         of the method.
2007
2008         * UIProcess/WebProcessPool.h:
2009         * UIProcess/WebProcessProxy.cpp:
2010         (WebKit::WebProcessProxy::setIsInProcessCache):
2011         Update the isInProcessCache flag on the WebProcessProxy and send an IPC to the WebContent
2012         process so that it can update its name in Activity Monitor.
2013         We also need to stop holding a strong reference to the WebProcessPool whenever the process
2014         is in the cache, similarly to what we do for pre-warmed processes, given that such processes
2015         should not keep the process pool alive.
2016
2017         (WebKit::WebProcessProxy::addExistingWebPage):
2018         Assert that we never try to add a page to a cached process, it should be taken out of the
2019         cache before use.
2020
2021         (WebKit::WebProcessProxy::hasProvisionalPageWithID const):
2022         (WebKit::WebProcessProxy::isAllowedToUpdateBackForwardItem const):
2023         (WebKit::WebProcessProxy::updateBackForwardItem):
2024         In case of client-side redirects, the previous process would sometimes send an IPC causing
2025         the UIProcess' backforward list item to get updated with the pre-redirect URL after we've
2026         already redirected. This previously would be unlikely to occur because we do not suspend
2027         client-redirect pages and their process would normally exit before getting a chance to send
2028         the IPC. However, with the process cache, the bug became obvious as the process would stay
2029         alive and send up the "bad" IPC. To address the issue, we now only let the IPC update the
2030         item if the item's page is (still) associated with the process. In the future, we may want
2031         to update the IPC so that it gets sent to the WebPageProxy instead of the WebProcessProxy.
2032
2033         (WebKit::WebProcessProxy::processDidTerminateOrFailedToLaunch):
2034         If a cached WebProcess crashes, remove it from the cache so that we do not attempt to use
2035         it for a load later.
2036
2037         (WebKit::WebProcessProxy::canBeAddedToWebProcessCache const):
2038         Only cache WebProcesses that have loaded a single registrable domain. Also prevent caching
2039         for service worker and inspector processes.
2040
2041         (WebKit::WebProcessProxy::maybeShutDown):
2042         If the process is cacheable, add it to the cache instead of shutting it down right away.
2043
2044         (WebKit::WebProcessProxy::canTerminateAuxiliaryProcess):
2045         Make sure we do not attempt to terminate a processes that is in the cache.
2046
2047         (WebKit::WebProcessProxy::didStartProvisionalLoadForMainFrame):
2048         Whenever a main frame provisional load starts, make sure we update the process's associated
2049         registrable domain. nullopt indicates that there is no associated domain yet. Null string
2050         indicates that the process is associated with several registrable domain and is therefore
2051         not eligible for caching.
2052
2053         * UIProcess/WebProcessProxy.h:
2054         (WebKit::WebProcessProxy::registrableDomain const):
2055         (WebKit::WebProcessProxy::isInProcessCache const):
2056         (WebKit::WebProcessProxy::provisionalPageCount const):
2057         Add convenience getters.
2058
2059         * WebKit.xcodeproj/project.pbxproj:
2060         Add new files to project.
2061
2062         * WebProcess/WebProcess.cpp:
2063         (WebKit::WebProcess::setIsInProcessCache):
2064         * WebProcess/WebProcess.h:
2065         * WebProcess/WebProcess.messages.in:
2066         * WebProcess/cocoa/WebProcessCocoa.mm:
2067         (WebKit::WebProcess::updateProcessName):
2068         Update the WebProcess' name in Activity Monitor whenever it goes into or out of the WebProcess
2069         cache.
2070
2071 2019-02-14  Per Arne Vollan  <pvollan@apple.com>
2072
2073         [iOS] Open sandbox for certain calls.
2074         https://bugs.webkit.org/show_bug.cgi?id=194626
2075
2076         Reviewed by Brent Fulgham.
2077
2078         Reporting shows that certain calls needs to be allowed in the sandbox.
2079
2080         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
2081
2082 2019-02-14  Chris Fleizach  <cfleizach@apple.com>
2083
2084         AX: ARIA Reflection was disabled in error
2085         https://bugs.webkit.org/show_bug.cgi?id=194647
2086         <rdar://problem/48068336>
2087
2088         Reviewed by Ryosuke Niwa.
2089
2090         * Shared/WebPreferences.yaml:
2091
2092 2019-02-14  Commit Queue  <commit-queue@webkit.org>
2093
2094         Unreviewed, rolling out r241486.
2095         https://bugs.webkit.org/show_bug.cgi?id=194655
2096
2097         causing API failures in builds (Requested by ShawnRoberts on
2098         #webkit).
2099
2100         Reverted changeset:
2101
2102         "[Cocoa] Media elements will restart network buffering just
2103         before suspending"
2104         https://bugs.webkit.org/show_bug.cgi?id=193691
2105         https://trac.webkit.org/changeset/241486
2106
2107 2019-02-14  Youenn Fablet  <youenn@apple.com>
2108
2109         Do not add a caches to its engine if the salt cannot be initialized
2110         https://bugs.webkit.org/show_bug.cgi?id=194604
2111
2112         Reviewed by Antti Koivisto.
2113
2114         This is a follow-up to https://bugs.webkit.org/show_bug.cgi?id=194588.
2115         We should return early if initialize fails.
2116
2117         * NetworkProcess/cache/CacheStorageEngine.cpp:
2118         (WebKit::CacheStorage::Engine::readCachesFromDisk):
2119
2120 2019-02-13  Carlos Garcia Campos  <cgarcia@igalia.com>
2121
2122         [GTK] Use a scrolled window for script alerts text
2123         https://bugs.webkit.org/show_bug.cgi?id=184875
2124
2125         Reviewed by Michael Catanzaro.
2126
2127         To ensure long text doesn't make the dialog bigger.
2128
2129         * UIProcess/API/gtk/WebKitScriptDialogImpl.cpp:
2130         (webkitScriptDialogImplConstructed): Use PANGO_ELLIPSIZE_END for the title and add a scrolled window for the body.
2131         (webkitScriptDialogImplSetText): Helper function to set the dialog body, ensuring the scrolled window fills the
2132         dialog available size.
2133         (webkitScriptDialogImplNew): It now receives the maximum size and uses webkitScriptDialogImplSetText().
2134         * UIProcess/API/gtk/WebKitScriptDialogImpl.h:
2135         * UIProcess/API/gtk/WebKitWebViewGtk.cpp:
2136         (webkitWebViewScriptDialog): Pass the 80% of the web view size as the maximum size of script dialogs.
2137
2138 2019-02-13  Ryosuke Niwa  <rniwa@webkit.org>
2139
2140         Crash in WKBundleFrameGetParentFrame when called inside didRemoveFrameFromHierarchy
2141         https://bugs.webkit.org/show_bug.cgi?id=194641
2142
2143         Reviewed by Geoffrey Garen.
2144
2145         Fixed the bug by adding a null check to WebFrame::parentFrame.
2146
2147         * WebProcess/WebPage/WebFrame.cpp:
2148         (WebKit::WebFrame::parentFrame const):
2149
2150 2019-02-13  Timothy Hatcher  <timothy@apple.com>
2151
2152         Allow some deprecations in WKDrawingView.
2153         https://bugs.webkit.org/show_bug.cgi?id=194636
2154
2155         Reviewed by Wenson Hsieh.
2156
2157         * UIProcess/ios/WKDrawingView.mm:
2158         (-[WKDrawingView PNGRepresentation]):
2159         (-[WKDrawingView loadDrawingFromPNGRepresentation:]):
2160         (-[WKDrawingView _canvasViewWillBeginDrawing:]):
2161         (-[WKDrawingView didChangeInk:]):
2162
2163 2019-02-13  Jer Noble  <jer.noble@apple.com>
2164
2165         [Cocoa] Media elements will restart network buffering just before suspending
2166         https://bugs.webkit.org/show_bug.cgi?id=193691
2167
2168         Reviewed by Eric Carlson.
2169
2170         When the WebProcess receives a notification that the process is about to become
2171         suspended, it tells the MemoryPressureHandler to release all critical memory. This
2172         has the side effect of causing AVFoundation-backed media elements to dump their
2173         in-memory caches and start downloading media data again. Instead, media elements
2174         should all stop buffering media data during suspension. Add new testing SPI to
2175         simulate suspension and resume messages.
2176
2177         * UIProcess/API/Cocoa/WKWebView.mm:
2178         (-[WKWebView _processWillSuspendImminentlyForTesting]):
2179         (-[WKWebView _processDidResumeForTesting]):
2180         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
2181         * UIProcess/WebProcessProxy.h:
2182         * UIProcess/ios/WKInkPickerView.mm:
2183         * WebProcess/WebPage/WebPage.cpp:
2184         (WebKit::WebPage::suspendAllMediaBuffering):
2185         (WebKit::WebPage::resumeAllMediaBuffering):
2186         * WebProcess/WebPage/WebPage.h:
2187         * WebProcess/WebProcess.cpp:
2188         (WebKit::WebProcess::actualPrepareToSuspend):
2189         (WebKit::WebProcess::cancelPrepareToSuspend):
2190         (WebKit::WebProcess::processDidResume):
2191         (WebKit::WebProcess::suspendAllMediaBuffering):
2192         (WebKit::WebProcess::resumeAllMediaBuffering):
2193         * WebProcess/WebProcess.h:
2194
2195 2019-02-13  Per Arne Vollan  <pvollan@apple.com>
2196
2197         [iOS] Fix sandbox violation during media playback
2198         https://bugs.webkit.org/show_bug.cgi?id=194616
2199         <rdar://problem/48049264>
2200
2201         Reviewed by Brent Fulgham.
2202
2203         Mach lookup to "com.apple.coremedia.figcontentkeysession.xpc" should be allowed.
2204
2205         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
2206
2207 2019-02-13  Tim Horton  <timothy_horton@apple.com>
2208
2209         Encrypted PDFs inside <embed> or <object> crash the Web Content process
2210         https://bugs.webkit.org/show_bug.cgi?id=194605
2211         <rdar://problem/19894818>
2212
2213         Reviewed by Andy Estes.
2214
2215         * WebProcess/Plugins/PDF/PDFPlugin.mm:
2216         (WebKit::PDFPlugin::createPasswordEntryForm):
2217         Don't try to create a password form field if we can't make form fields.
2218
2219         This means you will be left with a useless embedded PDF, but at least
2220         the Web Content process won't crash.
2221
2222         We'll need to find an alternative implementation of PDF embedded form
2223         fields that is compatible with <embed> and <object> if we want to support
2224         this. Currently we piggy-back off the fact that we can just insert
2225         <input>s into the PluginDocument's DOM, but we can't do that if there
2226         is no PluginDocument, just a main document, like in the <embed> case.
2227
2228 2019-02-12  Jiewen Tan  <jiewen_tan@apple.com>
2229
2230         Further restricting webarchive loads
2231         https://bugs.webkit.org/show_bug.cgi?id=194567
2232         <rdar://problem/47610130>
2233
2234         Reviewed by Youenn Fablet.
2235
2236         * WebProcess/WebPage/WebPage.cpp:
2237         (WebKit::WebPage::loadRequest):
2238         Set a flag to indicate a load is started from clients.
2239
2240 2019-02-13  Michael Catanzaro  <mcatanzaro@igalia.com>
2241
2242         [WPE][GTK] Merge WebProcessPoolWPE.cpp and WebProcessPoolGtk.cpp
2243         https://bugs.webkit.org/show_bug.cgi?id=194551
2244
2245         Reviewed by Carlos Garcia Campos.
2246
2247         * SourcesGTK.txt:
2248         * SourcesWPE.txt:
2249         * UIProcess/glib/WebProcessPoolGLib.cpp: Renamed from Source/WebKit/UIProcess/gtk/WebProcessPoolGtk.cpp.
2250         (WebKit::initializeRemoteInspectorServer):
2251         (WebKit::memoryPressureMonitorDisabled):
2252         (WebKit::WebProcessPool::platformInitialize):
2253         (WebKit::WebProcessPool::platformInitializeWebProcess):
2254         (WebKit::WebProcessPool::platformInvalidateContext):
2255         (WebKit::WebProcessPool::platformResolvePathsForSandboxExtensions):
2256         * UIProcess/wpe/WebProcessPoolWPE.cpp: Removed.
2257
2258 2019-02-13  Michael Catanzaro  <mcatanzaro@igalia.com>
2259
2260         Fix -Wformat warning from r241401
2261         https://bugs.webkit.org/show_bug.cgi?id=194584
2262         <rdar://problem/47761293>
2263
2264         * WebProcess/WebPage/WebPage.cpp:
2265         (WebKit::WebPage::setActivityState):
2266
2267 2019-02-13  Youenn Fablet  <youenn@apple.com>
2268
2269         Make WebRTCUnifiedPlanEnabled true by default
2270         https://bugs.webkit.org/show_bug.cgi?id=194595
2271
2272         Reviewed by Eric Carlson.
2273
2274         * Shared/WebPreferences.yaml:
2275
2276 2019-02-13  John Wilander  <wilander@apple.com>
2277
2278         Store Ad Click Attribution requests in the network process
2279         https://bugs.webkit.org/show_bug.cgi?id=194510
2280         <rdar://problem/47650118>
2281
2282         Reviewed by Alex Christensen and Daniel Bates.
2283
2284         With this patch, WebPageProxy::didCommitLoadForFrame() now looks for
2285         an AdClickAttribution object in its navigation state. If there is an
2286         attribution, it sends it to the network process where the 
2287         WebKit::NetworkSession stores it in an object of a new class,
2288         WebKit::NetworkAdClickAttribution.
2289
2290         This patch also covers test infrastructure to support two new
2291         TestRunner functions:
2292         - dumpAdClickAttribution()
2293         - clearAdClickAttribution()
2294
2295         * NetworkProcess/Cookies/WebCookieManager.cpp:
2296             Added missing header include.
2297         * NetworkProcess/Downloads/DownloadManager.cpp:
2298             Added missing header include.
2299         * NetworkProcess/NetworkAdClickAttribution.cpp: Added.
2300         (WebKit::NetworkAdClickAttribution::ensureDestinationMapForSource):
2301         (WebKit::NetworkAdClickAttribution::store):
2302         (WebKit::NetworkAdClickAttribution::clear):
2303         (WebKit::NetworkAdClickAttribution::toString const):
2304         * NetworkProcess/NetworkAdClickAttribution.h: Added.
2305             Stores WebCore::AdClickAttribution objects in a map structure.
2306         * NetworkProcess/NetworkLoad.cpp:
2307             Added missing header includes.
2308         * NetworkProcess/NetworkProcess.cpp:
2309         (WebKit::NetworkProcess::storeAdClickAttribution):
2310         (WebKit::NetworkProcess::dumpAdClickAttribution):
2311         (WebKit::NetworkProcess::clearAdClickAttribution):
2312         * NetworkProcess/NetworkProcess.h:
2313         * NetworkProcess/NetworkProcess.messages.in:
2314         * NetworkProcess/NetworkSession.cpp:
2315         (WebKit::NetworkSession::NetworkSession):
2316         (WebKit::NetworkSession::storeAdClickAttribution):
2317         (WebKit::NetworkSession::dumpAdClickAttribution):
2318         (WebKit::NetworkSession::clearAdClickAttribution):
2319         * NetworkProcess/NetworkSession.h:
2320         * NetworkProcess/soup/RemoteNetworkingContextSoup.cpp:
2321             Added missing header include.
2322         * Sources.txt:
2323             Added NetworkProcess/NetworkAdClickAttribution.cpp.
2324         * UIProcess/API/APINavigation.h:
2325         (API::Navigation::adClickAttribution const):
2326         * UIProcess/API/C/WKPage.cpp:
2327         (WKPageDumpAdClickAttribution):
2328         (WKPageClearAdClickAttribution):
2329             Test infrastructure.
2330         * UIProcess/API/C/WKPagePrivate.h:
2331         * UIProcess/Network/NetworkProcessProxy.cpp:
2332         (WebKit::NetworkProcessProxy::dumpAdClickAttribution):
2333         (WebKit::NetworkProcessProxy::clearAdClickAttribution):
2334             Test infrastructure.
2335         * UIProcess/Network/NetworkProcessProxy.h:
2336         * UIProcess/WebPageProxy.cpp:
2337         (WebKit::WebPageProxy::didFinishDocumentLoadForFrame):
2338             This is where pending Ad Click Attributions are forwarded to the
2339             network process.
2340         (WebKit::WebPageProxy::dumpAdClickAttribution):
2341         (WebKit::WebPageProxy::clearAdClickAttribution):
2342             Test infrastructure.
2343         * UIProcess/WebPageProxy.h:
2344         * UIProcess/WebProcessPool.cpp:
2345         (WebKit::WebProcessPool::dumpAdClickAttribution):
2346         (WebKit::WebProcessPool::clearAdClickAttribution):
2347             Test infrastructure.
2348         * UIProcess/WebProcessPool.h:
2349         * WebKit.xcodeproj/project.pbxproj:
2350         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
2351         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
2352             Added missing data copying from navigationAction to navigationActionData.
2353
2354 2019-02-13  Antti Koivisto  <antti@apple.com>
2355
2356         Crash in WebKit::CacheStorage::Engine::cachesRootPath
2357         https://bugs.webkit.org/show_bug.cgi?id=194588
2358         <rdar://problem/46363997>
2359
2360         Reviewed by Youenn Fablet.
2361
2362         * NetworkProcess/cache/CacheStorageEngine.cpp:
2363         (WebKit::CacheStorage::Engine::cachesRootPath):
2364
2365         Salt may have not been initialized yet when the Engine is destroyed.
2366
2367 2019-02-13  Alex Christensen  <achristensen@webkit.org>
2368
2369         Remove legacy sync messaging in some IPC code
2370         https://bugs.webkit.org/show_bug.cgi?id=194561
2371
2372         Reviewed by Geoffrey Garen.
2373
2374         Changing some LegacySync messages to Delayed messages.  We should probably rename Delayed to Sync.
2375         There are too many ways to send messages.  Let's work to get rid of the old one.
2376
2377         * NetworkProcess/NetworkProcess.cpp:
2378         (WebKit::NetworkProcess::setAllowsAnySSLCertificateForWebSocket):
2379         (WebKit::NetworkProcess::processWillSuspendImminently):
2380         * NetworkProcess/NetworkProcess.h:
2381         * NetworkProcess/NetworkProcess.messages.in:
2382         * PluginProcess/PluginControllerProxy.cpp:
2383         (WebKit::PluginControllerProxy::handleWheelEvent):
2384         (WebKit::PluginControllerProxy::handleMouseEnterEvent):
2385         (WebKit::PluginControllerProxy::handleMouseLeaveEvent):
2386         (WebKit::PluginControllerProxy::handleKeyboardEvent):
2387         (WebKit::PluginControllerProxy::handleEditingCommand):
2388         (WebKit::PluginControllerProxy::isEditingCommandEnabled):
2389         (WebKit::PluginControllerProxy::handlesPageScaleFactor):
2390         (WebKit::PluginControllerProxy::requiresUnifiedScaleFactor):
2391         (WebKit::PluginControllerProxy::paintEntirePlugin):
2392         (WebKit::PluginControllerProxy::supportsSnapshotting):
2393         (WebKit::PluginControllerProxy::snapshot):
2394         (WebKit::PluginControllerProxy::getPluginScriptableNPObject):
2395         (WebKit::PluginControllerProxy::getFormValue):
2396         * PluginProcess/PluginControllerProxy.h:
2397         * PluginProcess/PluginControllerProxy.messages.in:
2398         * Shared/Plugins/NPObjectMessageReceiver.cpp:
2399         (WebKit::NPObjectMessageReceiver::deallocate):
2400         (WebKit::NPObjectMessageReceiver::hasMethod):
2401         (WebKit::NPObjectMessageReceiver::invoke):
2402         (WebKit::NPObjectMessageReceiver::invokeDefault):
2403         (WebKit::NPObjectMessageReceiver::hasProperty):
2404         (WebKit::NPObjectMessageReceiver::getProperty):
2405         (WebKit::NPObjectMessageReceiver::setProperty):
2406         (WebKit::NPObjectMessageReceiver::removeProperty):
2407         (WebKit::NPObjectMessageReceiver::enumerate):
2408         (WebKit::NPObjectMessageReceiver::construct):
2409         * Shared/Plugins/NPObjectMessageReceiver.h:
2410         * Shared/Plugins/NPObjectMessageReceiver.messages.in:
2411         * UIProcess/mac/SecItemShimProxy.cpp:
2412         (WebKit::SecItemShimProxy::secItemRequest):
2413         * UIProcess/mac/SecItemShimProxy.h:
2414         * UIProcess/mac/SecItemShimProxy.messages.in:
2415
2416 2019-02-13  Truitt Savell  <tsavell@apple.com>
2417
2418         Unreviewed, rolling out r241433.
2419
2420         Broke internal builds.
2421
2422         Reverted changeset:
2423
2424         "Move
2425         UIWebTouchEventsGestureRecognizer.activeTouchesByIdentifier to
2426         SPI"
2427         https://bugs.webkit.org/show_bug.cgi?id=194531
2428         https://trac.webkit.org/changeset/241433
2429
2430 2019-02-12  Antoine Quint  <graouts@apple.com>
2431
2432         Move UIWebTouchEventsGestureRecognizer.activeTouchesByIdentifier to SPI
2433         https://bugs.webkit.org/show_bug.cgi?id=194531
2434         <rdar://problem/47714562>
2435
2436         Reviewed by Dean Jackson.
2437
2438         * Platform/spi/ios/UIKitSPI.h:
2439         * UIProcess/ios/WKContentViewInteraction.mm:
2440         (-[WKContentView cancelPointersForGestureRecognizer:]): We update the referenced Radar since we need to keep the call
2441         to respondsToSelector until the SPI has shipped for OpenSource builds to work.
2442
2443 2019-02-13  Antoine Quint  <graouts@apple.com>
2444
2445         Support simulated mouse events on iOS based on a PlatformTouchEvent
2446         https://bugs.webkit.org/show_bug.cgi?id=194501
2447         <rdar://problem/46910790>
2448
2449         Reviewed by Dean Jackson.
2450
2451         Add two new internal runtime flags to control whether simulated mouse events should be dipatched along with touch events and whether
2452         simulated mousemove events dispatched should automatically trigger the behavior preventDefault() would also trigger. We also ensure
2453         that we correctly create touch tracking regions for mouse events.
2454
2455         * Shared/WebPreferences.yaml:
2456         * UIProcess/WebPageProxy.cpp:
2457         (WebKit::WebPageProxy::updateTouchEventTracking):
2458
2459 2019-02-13  Ryosuke Niwa  <rniwa@webkit.org>
2460
2461         Crash in Page::setActivityState because m_page is null
2462         https://bugs.webkit.org/show_bug.cgi?id=194584
2463
2464         Reviewed by Antti Koivisto.
2465
2466         Add a null check to avoid the crash. Also add a debug assertion to help diagnose this in the future.
2467
2468         * WebProcess/WebPage/WebPage.cpp:
2469         (WebKit::WebPage::setActivityState):
2470
2471 2019-02-13  Ryosuke Niwa  <rniwa@webkit.org>
2472
2473         Release assert in PolicyCheckIdentifier::isValidFor via WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction
2474         https://bugs.webkit.org/show_bug.cgi?id=194582
2475
2476         Reviewed by Antti Koivisto.
2477
2478         The bug was caused by WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction invoking the callback
2479         with responseIdentifier even when we had failed to send the policy check IPC. Clearly, responseIdentifier
2480         is invalid in that case, and we should be using requestIdentifier instead.
2481
2482         Unfortunately no new tests since I'm not aware of a way to make sendSync fail in this case.
2483
2484         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
2485         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
2486
2487 2019-02-13  Benjamin Poulain  <benjamin@webkit.org>
2488
2489         Responsiveness timers are too expensive for frequent events
2490         https://bugs.webkit.org/show_bug.cgi?id=194003
2491
2492         Reviewed by Geoffrey Garen.
2493
2494         With each event, we set a responsivness timer to check if the WebProcess
2495         is responsive, and reset the timer when the WebProcess sends an answer.
2496
2497         For frequent events (e.g. wheel events, mouse force events, etc),
2498         we are spamming the kernel with hundreds of timers per second.
2499         That is a bit inefficient.
2500
2501         Another source of inefficiency comes from the timer implementation
2502         itself. Stopping a RunLoop::Timer removes the timer from every mode
2503         and invalidate the timer. It becomes costly since we do it a lot.
2504
2505         With this patch, I tweak ResponsivenessTimer and its use to minimize
2506         how often we schedule system timers.
2507
2508         The first change is to not stop the timer when we get the stop()
2509         calls if we expect more events to come in. Instead, we keep track
2510         if we care about the timeout or not in the attribute "m_waitingForTimer".
2511         When the next event starts, we can reschedule the timer without ever
2512         having told the kernel about the stop.
2513         If there are no next events, the timeout fires but m_waitingForTimer
2514         is false. To avoid idle wake up, the lazy stop is only used when having
2515         following events is common.
2516
2517         The second improvements comes from not even rescheduling the timer
2518         when restarted. Instead of changing the timer, we let the original timer
2519         fire and re-shedule a new one with the missing time.
2520
2521         For more context, also see patches r240759 and r240944.
2522
2523         * UIProcess/ResponsivenessTimer.cpp:
2524         (WebKit::ResponsivenessTimer::ResponsivenessTimer):
2525         (WebKit::ResponsivenessTimer::invalidate):
2526         (WebKit::ResponsivenessTimer::timerFired):
2527         (WebKit::ResponsivenessTimer::start):
2528         (WebKit::ResponsivenessTimer::startWithLazyStop):
2529         (WebKit::ResponsivenessTimer::stop):
2530         (WebKit::ResponsivenessTimer::processTerminated):
2531         (WebKit::ResponsivenessTimer::~ResponsivenessTimer): Deleted.
2532         * UIProcess/ResponsivenessTimer.h:
2533         (WebKit::ResponsivenessTimer::hasActiveTimer const):
2534         * UIProcess/WebPageProxy.cpp:
2535         (WebKit::WebPageProxy::processNextQueuedMouseEvent):
2536         (WebKit::WebPageProxy::sendWheelEvent):
2537         (WebKit::WebPageProxy::handleKeyboardEvent):
2538         (WebKit::WebPageProxy::handleGestureEvent):
2539         * UIProcess/WebProcessProxy.cpp:
2540         (WebKit::WebProcessProxy::isResponsiveWithLazyStop):
2541         * UIProcess/WebProcessProxy.h:
2542
2543 2019-02-12  Tim Horton  <timothy_horton@apple.com>
2544
2545         Null deref in userInterfaceLayoutDirection under ViewGestureController::handleSwipeGesture
2546         https://bugs.webkit.org/show_bug.cgi?id=194569
2547         <rdar://problem/46711049>
2548
2549         Reviewed by Wenson Hsieh.
2550
2551         * UIProcess/mac/ViewGestureControllerMac.mm:
2552         (WebKit::ViewGestureController::handleSwipeGesture):
2553         It is conceivable that we could get here if the client closes the page
2554         e.g. in the callback from willEndSwipeGesture. We already guarded against
2555         this ... one line too late! Rearrange the lines so we don't call into
2556         WebPageProxy at all if we don't have a drawing area (which is a strict subset
2557         of the time that isValid would return true). This is a speculative fix,
2558         since I can no longer reproduce the crash on demand.
2559
2560 2019-02-12  Youenn Fablet  <youenn@apple.com>
2561
2562         WebServiceWorkerProvider::handleFetch no longer needs a CachedResource parameter
2563         https://bugs.webkit.org/show_bug.cgi?id=194548
2564
2565         Reviewed by Alex Christensen.
2566
2567         * WebProcess/Network/WebLoaderStrategy.cpp:
2568         (WebKit::WebLoaderStrategy::scheduleLoad):
2569         * WebProcess/Storage/WebServiceWorkerProvider.cpp:
2570         (WebKit::WebServiceWorkerProvider::handleFetch):
2571         * WebProcess/Storage/WebServiceWorkerProvider.h:
2572
2573 2019-02-12  Tim Horton  <timothy_horton@apple.com>
2574
2575         Remove WKLegacyPDFView
2576         https://bugs.webkit.org/show_bug.cgi?id=194559
2577
2578         Reviewed by Andy Estes.
2579
2580         * Platform/spi/ios/CorePDFSPI.h: Removed.
2581         * SourcesCocoa.txt:
2582         * UIProcess/Cocoa/WKWebViewContentProviderRegistry.mm:
2583         (-[WKWebViewContentProviderRegistry initWithConfiguration:]):
2584         * UIProcess/ios/WKLegacyPDFView.h: Removed.
2585         * UIProcess/ios/WKLegacyPDFView.mm: Removed.
2586         * WebKit.xcodeproj/project.pbxproj:
2587
2588 2019-02-12  Chris Dumez  <cdumez@apple.com>
2589
2590         Regression(PSON) MESSAGE_CHECK() hit under WebPageProxy::didFailProvisionalLoadForFrameShared()
2591         https://bugs.webkit.org/show_bug.cgi?id=194568
2592         <rdar://problem/47944490>
2593
2594         Reviewed by Ryosuke Niwa.
2595
2596         When the provisional process crashes, it is unsafe to call ProvisionalPageProxy::cancel() because
2597         the WebProcessProxy clears its frame map as soon as the process crashes. Calling cancel() after
2598         that would call WebPageProxy::didFailProvisionalLoadForFrameShared(), which would try to look up
2599         the frame by ID and MESSAGE_CHECK() that the frame is not null. We would fail this check since
2600         the frame has been removed from the WebProcessProxy at this point.
2601
2602         * UIProcess/API/Cocoa/WKWebView.mm:
2603         (-[WKWebView _provisionalWebProcessIdentifier]):
2604         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
2605         * UIProcess/WebPageProxy.cpp:
2606         (WebKit::WebPageProxy::didFailProvisionalLoadForFrameShared):
2607         (WebKit::WebPageProxy::provisionalProcessDidTerminate):
2608
2609 2019-02-12  Per Arne Vollan  <pvollan@apple.com>
2610
2611         [iOS] Youtube fails to play.
2612         https://bugs.webkit.org/show_bug.cgi?id=194565
2613         <rdar://problem/47974770>
2614
2615         Reviewed by Geoffrey Garen.
2616
2617         This is caused by sandbox violations and was introduced in r240500.
2618
2619         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
2620
2621 2019-02-12  Alex Christensen  <achristensen@webkit.org>
2622
2623         Remove firing assertion after r241317
2624         https://bugs.webkit.org/show_bug.cgi?id=194506
2625
2626         * WebProcess/Network/WebLoaderStrategy.cpp:
2627         (WebKit::WebLoaderStrategy::setDefersLoading):
2628         The creation of a PageGroupLoadDeferrer in Chrome.cpp tries to defer loading.
2629         See comments in Chrome::runJavaScriptAlert et al.
2630         This was necessary with WebKitLegacy, so keep it, but it doesn't need to do anything in modern WebKit.
2631
2632 2019-02-12  Tim Horton  <timothy_horton@apple.com>
2633
2634         Find on Page shouldn't zoom in on matches
2635         https://bugs.webkit.org/show_bug.cgi?id=194557
2636         <rdar://problem/42087017>
2637
2638         Reviewed by Wenson Hsieh.
2639
2640         * UIProcess/ios/SmartMagnificationController.h:
2641         * UIProcess/ios/SmartMagnificationController.messages.in:
2642         * UIProcess/ios/SmartMagnificationController.mm:
2643         (WebKit::SmartMagnificationController::scrollToRect):
2644         * WebProcess/WebPage/ios/FindControllerIOS.mm:
2645         (WebKit::FindController::updateFindIndicator):
2646         Only scroll to reveal the find result, do not zoom in.
2647
2648 2019-02-12  Wenson Hsieh  <wenson_hsieh@apple.com>
2649
2650         Allow pages to trigger programmatic paste from script on iOS
2651         https://bugs.webkit.org/show_bug.cgi?id=194271
2652         <rdar://problem/47808810>
2653
2654         Reviewed by Tim Horton.
2655
2656         Cancel the pending DOM paste access handler when the menu is about to hide, rather than when the hiding
2657         animation has completed. This ensures that if the page (on behalf of the user) requests DOM paste again during
2658         user interaction before the callout bar has finished fading after the previous DOM paste, we won't automatically
2659         cancel the incoming DOM paste access request because the callout bar animation finished.
2660
2661         This scenario is exercised in the layout test editing/pasteboard/ios/dom-paste-consecutive-confirmations.html.
2662
2663         * Platform/spi/ios/UIKitSPI.h:
2664         * UIProcess/ios/WKContentViewInteraction.mm:
2665         (-[WKContentView setupInteraction]):
2666         (-[WKContentView _willHideMenu:]):
2667         (-[WKContentView _didHideMenu:]):
2668
2669 2019-02-12  Chris Fleizach  <cfleizach@apple.com>
2670
2671         AX: IsolatedTree: Implement more attributes
2672         https://bugs.webkit.org/show_bug.cgi?id=193911
2673         <rdar://problem/47599217>
2674
2675         Reviewed by Daniel Bates.
2676
2677         * Platform/spi/mac/AccessibilityPrivSPI.h: Added.
2678         * WebKit.xcodeproj/project.pbxproj:
2679         * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectBase.h:
2680         * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectBase.mm:
2681         (-[WKAccessibilityWebPageObjectBase clientSupportsIsolatedTree]):
2682         (-[WKAccessibilityWebPageObjectBase isolatedTreeRootObject]):
2683         (-[WKAccessibilityWebPageObjectBase accessibilityRootObjectWrapper]):
2684         * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectMac.mm:
2685         (-[WKAccessibilityWebPageObject IGNORE_WARNINGS_END]):
2686         (-[WKAccessibilityWebPageObject convertScreenPointToRootView:]):
2687         (-[WKAccessibilityWebPageObject accessibilityAttributeValue:]):
2688         (-[WKAccessibilityWebPageObject accessibilityAttributeSizeValue]):
2689         (-[WKAccessibilityWebPageObject accessibilityAttributePositionValue]):
2690         (-[WKAccessibilityWebPageObject accessibilityDataDetectorValue:point:]):
2691         (-[WKAccessibilityWebPageObject accessibilityAttributeValue:forParameter:]):
2692         (-[WKAccessibilityWebPageObject accessibilityHitTest:]):
2693
2694 2019-02-12  Wenson Hsieh  <wenson_hsieh@apple.com>
2695
2696         Allow pages to trigger programmatic paste from script on iOS
2697         https://bugs.webkit.org/show_bug.cgi?id=194271
2698         <rdar://problem/47808810>
2699
2700         Reviewed by Ryosuke Niwa.
2701
2702         * Shared/WebPreferences.yaml:
2703         * Shared/WebPreferencesDefaultValues.h:
2704
2705         Add an internal setting to enable or disable DOM paste access requests. This is on by default in iOS only
2706         (excluding watchOS and Apple TV), and is additionally disabled on macOS.
2707
2708         * UIProcess/API/gtk/PageClientImpl.cpp:
2709         (WebKit::PageClientImpl::requestDOMPasteAccess):
2710         * UIProcess/API/gtk/PageClientImpl.h:
2711         * UIProcess/API/wpe/PageClientImpl.cpp:
2712         (WebKit::PageClientImpl::requestDOMPasteAccess):
2713
2714         Plumb DOM paste access requests from the web process (WebEditorClient) to the view (WKContentView). As per the
2715         usual, this involves WebEditorClient, WebPage, WebPageProxy, PageClient and finally WKContentView.
2716
2717         * UIProcess/API/wpe/PageClientImpl.h:
2718         * UIProcess/PageClient.h:
2719         * UIProcess/WebPageProxy.cpp:
2720         (WebKit::WebPageProxy::requestDOMPasteAccess):
2721         * UIProcess/WebPageProxy.h:
2722         * UIProcess/WebPageProxy.messages.in:
2723         * UIProcess/ios/PageClientImplIOS.h:
2724         * UIProcess/ios/PageClientImplIOS.mm:
2725         (WebKit::PageClientImpl::requestDOMPasteAccess):
2726         * UIProcess/ios/WKContentViewInteraction.h:
2727         * UIProcess/ios/WKContentViewInteraction.mm:
2728         (-[WKContentView setupInteraction]):
2729         (-[WKContentView cleanupInteraction]):
2730         (-[WKContentView resignFirstResponderForWebView]):
2731         (-[WKContentView _webTouchEventsRecognized:]):
2732
2733         Bail from any pending DOM paste access handler the moment we start handling touches on the web view, or if the
2734         web view resigns first responder, or if the web process crashes.
2735
2736         (-[WKContentView textInteractionGesture:shouldBeginAtPoint:]):
2737
2738         Reject text selection gestures while waiting for DOM paste access.
2739
2740         (-[WKContentView canPerformAction:withSender:]):
2741         (-[WKContentView canPerformActionForWebView:withSender:]):
2742
2743         If we're handling a DOM paste, always return YES to allow the callout bar to show the "Paste" option.
2744
2745         (-[WKContentView _didHideMenu:]):
2746
2747         If the menu is programmatically hidden by the app while handling a DOM paste request, immediately reject the DOM
2748         paste request.
2749
2750         (-[WKContentView pasteForWebView:]):
2751
2752         Adjust -pasteForWebView: on WKContentView to first check whether there's an outstanding DOM paste completion
2753         handler to invoke, instead of telling the page to execute a paste command.
2754
2755         (-[WKContentView _handleDOMPasteRequestWithResult:]):
2756
2757         Add a helper to take and invoke the current DOM paste completion handler (if it exists) with the given result,
2758         and then dismiss the shared callout bar. Returns whether or not the paste completion handler exists. Invoked
2759         from various sources of user interaction or significant state changes (e.g. following a web process crash in
2760         -cleanupInteraction).
2761
2762         (-[WKContentView _willPerformAction:sender:]):
2763         (-[WKContentView _didPerformAction:sender:]):
2764
2765         Add hooks to detect when WKContentView is executing an editing action. This is to ensure that the page doesn't
2766         get stuck in a bad state in the case where WKWebView has been subclassed, overrides `-paste:`, and does not
2767         invoke the superclass method (which calls back into `-[WKContentView pasteForWebView:]`). There are a few
2768         possibilities here:
2769         1. WKWebView's `-paste:` action is not overridden. In this case, we will call back into `-pasteForWebView:`,
2770            which will notice that we have a pending paste completion handler and invoke it.
2771         2. WKWebView's `-paste:` action is overridden and does not call back into the content view. In this case, we
2772            will invoke the paste completion handler in `-_didPerformAction:sender:`.
2773         3. WKWebView's `-canPerformAction:withSender:` is overridden to include additional actions. In this case, we may
2774            get a call to invoke a different action selector while waiting for a potential paste action. If this happens,
2775            prevent the DOM paste in `-_willPerformAction:sender:` prior to handling the other action.
2776
2777         (-[WKContentView handleKeyWebEvent:withCompletionHandler:]):
2778
2779         Dismiss DOM paste UI upon handling any key event.
2780
2781         (-[WKContentView showGlobalMenuControllerInRect:]):
2782         (-[WKContentView hideGlobalMenuController]):
2783
2784         Helper methods to present and dismiss the global UIMenuController, that accounts for available platform APIs for
2785         presenting or dismissing the menu controller on iOS.
2786
2787         (-[WKContentView _requestDOMPasteAccessWithElementRect:completionHandler:]):
2788
2789         Attempt to find a good target presentation rect when showing the callout menu. First, we will try to use the
2790         rect of the element the user has interacted with when triggering the paste. If such an element is too large or
2791         does not exist, we fall back to presenting the callout menu near the user's last touch location (with a small
2792         amount of margin, such that the action doesn't overlap with the user's finger, stylus, etc.).
2793
2794         (-[WKContentView _resetShowingTextStyle:]): Deleted.
2795
2796         Rename this to `-_didHideMenu:`.
2797
2798         * UIProcess/mac/PageClientImplMac.h:
2799         * UIProcess/win/PageClientImpl.cpp:
2800         (WebKit::PageClientImpl::requestDOMPasteAccess):
2801         * UIProcess/win/PageClientImpl.h:
2802         * WebProcess/WebCoreSupport/WebEditorClient.cpp:
2803         (WebKit::WebEditorClient::requestDOMPasteAccess):
2804         * WebProcess/WebCoreSupport/WebEditorClient.h:
2805         * WebProcess/WebPage/WebPage.cpp:
2806         (WebKit::WebPage::requestDOMPasteAccess):
2807
2808         Add more plumbing and method stubs.
2809
2810         (WebKit::WebPage::updateCurrentModifierState):
2811         (WebKit::WebPage::rectForElementAtInteractionLocation const):
2812         * WebProcess/WebPage/WebPage.h:
2813         * WebProcess/WebPage/ios/WebPageIOS.mm:
2814         (WebKit::WebPage::rectForElementAtInteractionLocation const):
2815         (WebKit::WebPage::rectForElementAtInteractionLocation): Deleted.
2816
2817         Mark this method as const, add a platform-agnostic stub, and adopt it for the purposes of determining where to
2818         position the callout bar when pasting.
2819
2820 2019-02-12  Alex Christensen  <achristensen@webkit.org>
2821
2822         Remove setDefersLoading infrastructure from WebKit2
2823         https://bugs.webkit.org/show_bug.cgi?id=194506
2824
2825         Reviewed by Brady Eidson.
2826
2827         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
2828         (WebKit::NetworkConnectionToWebProcess::setDefersLoading): Deleted.
2829         * NetworkProcess/NetworkConnectionToWebProcess.h:
2830         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
2831         * NetworkProcess/NetworkDataTask.h:
2832         * NetworkProcess/NetworkDataTaskBlob.cpp:
2833         (WebKit::NetworkDataTaskBlob::suspend): Deleted.
2834         * NetworkProcess/NetworkDataTaskBlob.h:
2835         * NetworkProcess/NetworkLoad.cpp:
2836         (WebKit::NetworkLoad::initialize):
2837         (WebKit::NetworkLoad::setDefersLoading): Deleted.
2838         * NetworkProcess/NetworkLoad.h:
2839         * NetworkProcess/NetworkLoadParameters.h:
2840         * NetworkProcess/NetworkResourceLoadParameters.cpp:
2841         (WebKit::NetworkResourceLoadParameters::encode const):
2842         (WebKit::NetworkResourceLoadParameters::decode):
2843         * NetworkProcess/NetworkResourceLoader.cpp:
2844         (WebKit::NetworkResourceLoader::start):
2845         (WebKit::NetworkResourceLoader::startNetworkLoad):
2846         (WebKit::NetworkResourceLoader::setDefersLoading): Deleted.
2847         * NetworkProcess/NetworkResourceLoader.h:
2848         * NetworkProcess/cocoa/NetworkDataTaskCocoa.h:
2849         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
2850         (WebKit::NetworkDataTaskCocoa::suspend): Deleted.
2851         * NetworkProcess/curl/NetworkDataTaskCurl.cpp:
2852         (WebKit::NetworkDataTaskCurl::suspend): Deleted.
2853         * NetworkProcess/curl/NetworkDataTaskCurl.h:
2854         * NetworkProcess/soup/NetworkDataTaskSoup.cpp:
2855         (WebKit::NetworkDataTaskSoup::suspend): Deleted.
2856         * NetworkProcess/soup/NetworkDataTaskSoup.h:
2857         * WebProcess/Network/WebLoaderStrategy.cpp:
2858         (WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess):
2859         (WebKit::WebLoaderStrategy::setDefersLoading):
2860
2861 2019-02-12  Michael Catanzaro  <mcatanzaro@igalia.com>
2862
2863         Unreviewed, fix build warnings after content extensions enablement
2864         https://bugs.webkit.org/show_bug.cgi?id=193622
2865         <rdar://problem/47982850>
2866
2867         * UIProcess/API/C/WKUserContentExtensionStoreRef.cpp:
2868         (toResult):
2869
2870 2019-02-12  Tim Horton  <timothy_horton@apple.com>
2871
2872         Switching focus from a UITextField to an editable WKWebView causes the keyboard to dance
2873         https://bugs.webkit.org/show_bug.cgi?id=194524
2874         <rdar://problem/35481797>
2875
2876         Reviewed by Wenson Hsieh.
2877
2878         * Platform/spi/ios/UIKitSPI.h:
2879         * UIProcess/ios/InputViewUpdateDeferrer.h:
2880         * UIProcess/ios/InputViewUpdateDeferrer.mm:
2881         (WebKit::InputViewUpdateDeferrer::InputViewUpdateDeferrer):
2882         (WebKit::InputViewUpdateDeferrer::~InputViewUpdateDeferrer):
2883         Make use of the per-responder and much safer input view pinning mechanism.
2884
2885         * UIProcess/ios/WKContentViewInteraction.mm:
2886         (-[WKContentView becomeFirstResponderForWebView]):
2887         (-[WKContentView _singleTapCommited:]):
2888         (-[WKContentView _attemptClickAtLocation:modifierFlags:]):
2889         Always temporarily pin input views when becoming first responder; there are
2890         many paths (such as through the text interaction assistant) that can
2891         focus us on tap, trying to cover them all is a fool's errand. We'll
2892         just get out the big hammer and call it in becomeFirstResponder.
2893         This also means we can remove it from _singleTapCommitted and _attemptClick...
2894
2895         (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
2896         Don't release the input view pinning until we return from _elementDidFocus;
2897         it does the rebuilding synchronously, so we need to have actually updated
2898         all of the prerequisites of -inputView before depinning.
2899
2900 2019-02-12  Youenn Fablet  <youenn@apple.com>
2901
2902         Make use of is<SubresourceLoader>
2903         https://bugs.webkit.org/show_bug.cgi?id=194541
2904
2905         Reviewed by Alex Christensen.
2906
2907         * WebProcess/Network/WebLoaderStrategy.cpp:
2908         (WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess):
2909
2910 2019-02-12  Alex Christensen  <achristensen@webkit.org>
2911
2912         WebPage::close needs to remove all message receivers associated with that WebPage, not WebPage::~WebPage
2913         https://bugs.webkit.org/show_bug.cgi?id=194522
2914         <rdar://problem/47789393>
2915
2916         Reviewed by Chris Dumez.
2917
2918         The InjectedBundle SPI can retain the WebPage or wrapping objects (WKWebProcessPlugInBrowserContextController/WKBundlePageRef).
2919         This can make it so WebPage::close is called before WebPage::~WebPage, and if the SuspendedPageProxy is reused for a subsequent
2920         navigation to the same domain, the WebProcess is reused with a different WebPage instance with the same PageID, which causes problems
2921         when another WebPage registers message handlers and then the previous WebPage is destroyed, which removes both message handlers.
2922
2923         * WebProcess/WebPage/WebPage.cpp:
2924         (WebKit::WebPage::~WebPage):
2925         (WebKit::WebPage::close):
2926         (WebKit::WebPage::mainFrameDidLayout):
2927         * WebProcess/WebPage/WebPage.h:
2928         * WebProcess/WebProcess.h:
2929         (WebKit::WebProcess::eventDispatcher):
2930
2931 2019-02-12  Michael Catanzaro  <mcatanzaro@igalia.com>
2932
2933         [WPE][GTK] Unsafe g_unsetenv() use in WebProcessPool::platformInitialize
2934         https://bugs.webkit.org/show_bug.cgi?id=194370
2935
2936         Reviewed by Darin Adler.
2937
2938         It is incorrect to use g_unsetenv() here because it is MT-Unsafe. We know that it is
2939         impossible and unreasonable to expect the application has not started other threads at this
2940         point, and threads will be calling getenv(). WebKit itself has probably already started
2941         threads of its own.
2942
2943         Fortunately, the remote inspector in the web process is already prepared to deal with
2944         failure to connect to the inspector server, so we don't need to do anything except stop
2945         messing with the environment.
2946
2947         Note these files are copies of each other. I'll merge them together in a follow-up patch.
2948
2949         * UIProcess/gtk/WebProcessPoolGtk.cpp:
2950         (WebKit::initializeRemoteInspectorServer):
2951         (WebKit::WebProcessPool::platformInitialize):
2952         * UIProcess/wpe/WebProcessPoolWPE.cpp:
2953         (WebKit::initializeRemoteInspectorServer):
2954         (WebKit::WebProcessPool::platformInitialize):
2955
2956 2019-02-08  Beth Dakin  <bdakin@apple.com>
2957
2958         Ensure old binaries have old snapshotting behaviors
2959         https://bugs.webkit.org/show_bug.cgi?id=194449
2960         -and corresponding-
2961         rdar://problem/47931954
2962
2963         Reviewed by Darin Adler.
2964
2965         Make sure that a nil configuration behaves the same way that it used to on apps 
2966         that were linked before FirstWithSnapshotAfterScreenUpdates
2967
2968         * UIProcess/API/Cocoa/WKWebView.mm:
2969         (-[WKWebView takeSnapshotWithConfiguration:completionHandler:]):
2970         * UIProcess/Cocoa/VersionChecks.h:
2971
2972 2019-02-12  Andy Estes  <aestes@apple.com>
2973
2974         [iOSMac] Enable Parental Controls Content Filtering
2975         https://bugs.webkit.org/show_bug.cgi?id=194521
2976         <rdar://39732376>
2977
2978         Reviewed by Tim Horton.
2979
2980         * Configurations/FeatureDefines.xcconfig:
2981
2982 2019-02-11  Alex Christensen  <achristensen@webkit.org>
2983
2984         Remove noisy and unnecessary logs added in r241223
2985         https://bugs.webkit.org/show_bug.cgi?id=194427
2986
2987         * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
2988         (WebKit::ProcessLauncher::launchProcess):
2989         Errors occur all the time in the XPC connection's event handler, like when a process terminates.
2990         We don't need to print an "error" every time any process terminates.
2991
2992 2019-02-11  Brian Burg  <bburg@apple.com>
2993
2994         [Cocoa] Web Automation: client callbacks are not called if delegate does not override
2995         https://bugs.webkit.org/show_bug.cgi?id=194519
2996         <rdar://problem/47981961>
2997
2998         Reviewed by Joseph Pecoraro.
2999
3000         Call the completion handler directly if the delegate does not implement the relevant method.
3001
3002         * UIProcess/Cocoa/AutomationSessionClient.mm:
3003         (WebKit::AutomationSessionClient::requestNewPageWithOptions):
3004         (WebKit::AutomationSessionClient::requestSwitchToPage):
3005         (WebKit::AutomationSessionClient::requestHideWindowOfPage):
3006         (WebKit::AutomationSessionClient::requestRestoreWindowOfPage):
3007         (WebKit::AutomationSessionClient::requestMaximizeWindowOfPage):
3008
3009 2019-02-11  Daniel Bates  <dabates@apple.com>
3010
3011         [iOS] Adopt SPI to support Emacs bindings: transpose and delete to end of paragraph
3012         https://bugs.webkit.org/show_bug.cgi?id=194505
3013         <rdar://problem/47743533>
3014
3015         Reviewed by Tim Horton.
3016
3017         * UIProcess/ios/WKContentViewInteraction.mm:
3018         (-[WKContentView _deleteToEndOfParagraph]): Added.
3019         (-[WKContentView _transpose]): Added.
3020
3021 2019-02-11  Adrian Perez de Castro  <aperez@igalia.com>
3022
3023         [GTK][WPE] Add content extensions support in WKTR and unskip layout tests
3024         https://bugs.webkit.org/show_bug.cgi?id=193622
3025
3026         Reviewed by Michael Catanzaro.
3027
3028         * NetworkProcess/cache/NetworkCacheData.h: Define an adoptAndMapFile() implementation
3029         for GFileIOStream objects.
3030         * NetworkProcess/cache/NetworkCacheDataSoup.cpp:
3031         (WebKit::NetworkCache::adoptAndMapFile): Added implementation, which extracts the file
3032         descriptor from a GFileIOStream, as it inherits from GFileDescriptorBased, and then
3033         reuses the version of adoptAndMapFile() which takes a file descritor for the actual work.
3034         * NetworkProcess/NetworkLoadChecker.cpp:
3035         (Webkit::NetworkLoadChecker::checkRequest): Use "this" when referring to
3036         processContentExtensionRulesForLoad() in order to avoid ambiguity.
3037         * Sources.txt: Add WKUserContentExtensionStoreRef.cpp, all ports use it now.
3038         * SourcesCocoa.txt: Remove WKUserContentExtensionStoreRef.cpp, because it is not
3039         Cocoa-specific anymore.
3040         * SourcesGTK.txt: Add APIContentRuleListStoreGLib.cpp.
3041         * SourcesWPE.txt: Ditto.
3042         * UIProcess/API/C/WKUserContentExtensionStoreRef.cpp:
3043         (WKUserContentExtensionStoreCreate): Added.
3044         (toResult): Added.
3045         (WKUserContentExtensionStoreCompile): Added.
3046         (WKUserContentExtensionStoreLookup): Added.
3047         (WKUserContentExtensionStoreRemove): Added.
3048         * UIProcess/API/C/WKUserContentExtensionStoreRef.h: Add declarations for the new C API
3049         functions and for the WKUserContentExtensionStoreResult status enum.
3050         * UIProcess/API/glib/APIContentRuleListStoreGLib.cpp: Added.
3051         (API::ContentRuleListStore::defaultStorePath): Add a dummy implementation. The public API
3052         for the GLib based ports (GTK+ and WPE) will not allow using the default store and will
3053         always indicating a path.
3054
3055 2019-02-11  Daniel Bates  <dabates@apple.com>
3056
3057         [iOS] Mouse/Touch/Pointer events are missing modifier keys
3058         https://bugs.webkit.org/show_bug.cgi?id=191446
3059         <rdar://problem/45929460>
3060
3061         Reviewed by Tim Horton.
3062
3063         Make use of UIKit SPI to retreive the modifier flags when dispatching mouse and touch events.
3064         Add new WebKit SPI for iOS, -[WKNavigationAction modifierFlags], to retrieve the the modifier
3065         flags held when a navigation action was initiated.
3066
3067         * Platform/spi/ios/UIKitSPI.h: Expose SPI.
3068         * Shared/NativeWebTouchEvent.h: Re-arrange macro guards so that we can expose the helper function
3069         WebKit::webEventModifierFlags(). This is a bit more involved that usual since this header is included
3070         from both C++ and Objective-C source files. It only makes sense to expose this function when
3071         compiling as part of an Objective-C source file.
3072         * Shared/ios/NativeWebTouchEventIOS.mm:
3073         (WebKit::NativeWebTouchEvent::NativeWebTouchEvent): Modified to take the modifier flags held down
3074         when the platform touch event was received and pass them through to the base constructor.
3075         (WebKit::webEventModifierFlags): Added. Converts from the platform-speciifc UIKeyModifierFlags to
3076         OptionSet<WebKit::WebEvent::Modifier>.
3077         * Shared/ios/WebIOSEventFactory.h:
3078         * Shared/ios/WebIOSEventFactory.mm:
3079         (WebIOSEventFactory::toUIKeyModifierFlags): Added. Converts from OptionSet<WebKit::WebEvent::Modifier>
3080         to the platform-specific UIKeyModifierFlags.
3081         * UIProcess/API/Cocoa/WKNavigationAction.mm:
3082         (-[WKNavigationAction modifierFlags]): Added.
3083         * UIProcess/API/Cocoa/WKNavigationActionPrivate.h:
3084         * UIProcess/WebPageProxy.h:
3085         * UIProcess/ios/WKContentViewInteraction.h:
3086         * UIProcess/ios/WKContentViewInteraction.mm:
3087         (gestureRecognizerModifierFlags): Added.
3088
3089         (-[WKContentView _webTouchEventsRecognized:]):
3090         (-[WKContentView _highlightLongPressRecognized:]):
3091         (-[WKContentView _twoFingerSingleTapGestureRecognized:]):
3092         (-[WKContentView _singleTapCommited:]):
3093         Pass modifier flags through.
3094
3095         (-[WKContentView _attemptClickAtLocation:modifierFlags:]): Added.
3096         (-[WKContentView actionSheetAssistant:openElementAtLocation:]): This is invoked when a person opens a link
3097         via the action sheet. We don't have access to the modifier flags to pass. It also seems like an implementation
3098         detail that this action is implemented via mouse click and we should re-evaluate this decision in light of
3099         the fact tht the action sheet is browser UI and we tend to be very reserved on what UI actions are visible
3100         to the page. On Mac, opening a link via the context menu is not visible to the page, at least from a mouse
3101         event perspective.
3102         (webEventFlagsForUIKeyModifierFlags): Added.
3103         (-[WKContentView _hoverGestureRecognizerChanged:]): Pass modifier flags through.
3104         (-[WKContentView _attemptClickAtLocation:]): Deleted.
3105         * UIProcess/ios/WebPageProxyIOS.mm:
3106         (WebKit::WebPageProxy::handleTwoFingerTapAtPoint):
3107         (WebKit::WebPageProxy::commitPotentialTap):
3108         (WebKit::WebPageProxy::handleTap):
3109         * WebProcess/WebPage/WebPage.h:
3110         * WebProcess/WebPage/WebPage.messages.in:
3111         * WebProcess/WebPage/ios/WebPageIOS.mm:
3112         (WebKit::WebPage::handleSyntheticClick):
3113         (WebKit::WebPage::completePendingSyntheticClickForContentChangeObserver):
3114         (WebKit::WebPage::completeSyntheticClick):
3115         (WebKit::WebPage::handleTap):
3116         (WebKit::WebPage::handleTwoFingerTapAtPoint):
3117         (WebKit::WebPage::commitPotentialTap):
3118         Pass modifier flags through.
3119
3120 2019-02-11  Jer Noble  <jer.noble@apple.com>
3121
3122         [Cocoa] Notify AVSystemController of our presenting PID before registering as a Now Playing app.
3123         https://bugs.webkit.org/show_bug.cgi?id=194504
3124
3125         Reviewed by Eric Carlson.
3126
3127         * WebKit.xcodeproj/project.pbxproj:
3128         * WebProcess/WebCoreSupport/WebUserMediaClient.cpp:
3129         (WebKit::WebUserMediaClient::requestUserMediaAccess):
3130         * WebProcess/WebPage/WebPage.cpp:
3131         (WebKit::WebPage::prepareToSendUserMediaPermissionRequest): Deleted.
3132         * WebProcess/WebPage/WebPage.h:
3133         (WebKit::WebPage::userMediaPermissionRequestManager):
3134         * WebProcess/WebPage/ios/WebPageIOS.mm:
3135         (WebKit::WebPage::prepareToSendUserMediaPermissionRequest): Deleted.
3136
3137 2019-02-11  Commit Queue  <commit-queue@webkit.org>
3138
3139         Unreviewed, rolling out r241272 and r241276.
3140         https://bugs.webkit.org/show_bug.cgi?id=194514
3141
3142         Broke the Apple Internal build and the fix requires human
3143         intervention :( (Requested by dydz on #webkit).
3144
3145         Reverted changesets:
3146
3147         "[iOS] Mouse/Touch/Pointer events are missing modifier keys"
3148         https://bugs.webkit.org/show_bug.cgi?id=191446
3149         https://trac.webkit.org/changeset/241272
3150
3151         "Fix internal iOS build after r241272"
3152         https://bugs.webkit.org/show_bug.cgi?id=191446
3153         https://trac.webkit.org/changeset/241276
3154
3155 2019-02-11  Alex Christensen  <achristensen@webkit.org>
3156
3157         Fix internal iOS build after r241272
3158         https://bugs.webkit.org/show_bug.cgi?id=191446
3159
3160         * Platform/spi/ios/UIKitSPI.h:
3161         Declare the _modifierFlags when using the internal SDK also.
3162
3163 2019-02-11  Wenson Hsieh  <wenson_hsieh@apple.com>
3164
3165         fast/forms/ios/force-gregorian-calendar-for-credit-card-expiry.html does not work on iPad
3166         https://bugs.webkit.org/show_bug.cgi?id=194313
3167
3168         Reviewed by Tim Horton.
3169
3170         Make `-dateTimePickerCalendarType` work on iPad by handling the case where the date picker control is a
3171         WKDateTimePopover. This fixes UIScriptController::calendarType() returning null on iPad.
3172
3173         * UIProcess/ios/forms/WKFormInputControl.mm:
3174         (-[WKFormInputControl dateTimePickerCalendarType]):
3175         (-[WKDateTimePopover calendarType]):
3176
3177 2019-02-11  Daniel Bates  <dabates@apple.com>
3178
3179         [iOS] Mouse/Touch/Pointer events are missing modifier keys
3180         https://bugs.webkit.org/show_bug.cgi?id=191446
3181         <rdar://problem/45929460>
3182
3183         Reviewed by Tim Horton.
3184
3185         Make use of UIKit SPI to retreive the modifier flags when dispatching mouse and touch events.
3186         Add new WebKit SPI for iOS, -[WKNavigationAction modifierFlags], to retrieve the the modifier
3187         flags held when a navigation action was initiated.
3188
3189         * Platform/spi/ios/UIKitSPI.h: Expose SPI.
3190         * Shared/NativeWebTouchEvent.h: Re-arrange macro guards so that we can expose the helper function
3191         WebKit::webEventModifierFlags(). This is a bit more involved that usual since this header is included
3192         from both C++ and Objective-C source files. It only makes sense to expose this function when
3193         compiling as part of an Objective-C source file.
3194         * Shared/ios/NativeWebTouchEventIOS.mm:
3195         (WebKit::NativeWebTouchEvent::NativeWebTouchEvent): Modified to take the modifier flags held down
3196         when the platform touch event was received and pass them through to the base constructor.
3197         (WebKit::webEventModifierFlags): Added. Converts from the platform-speciifc UIKeyModifierFlags to
3198         OptionSet<WebKit::WebEvent::Modifier>.
3199         * Shared/ios/WebIOSEventFactory.h:
3200         * Shared/ios/WebIOSEventFactory.mm:
3201         (WebIOSEventFactory::toUIKeyModifierFlags): Added. Converts from OptionSet<WebKit::WebEvent::Modifier>
3202         to the platform-specific UIKeyModifierFlags.
3203         * UIProcess/API/Cocoa/WKNavigationAction.mm:
3204         (-[WKNavigationAction modifierFlags]): Added.
3205         * UIProcess/API/Cocoa/WKNavigationActionPrivate.h:
3206         * UIProcess/WebPageProxy.h:
3207         * UIProcess/ios/WKContentViewInteraction.h:
3208         * UIProcess/ios/WKContentViewInteraction.mm:
3209         (gestureRecognizerModifierFlags): Added.
3210
3211         (-[WKContentView _webTouchEventsRecognized:]):
3212         (-[WKContentView _highlightLongPressRecognized:]):
3213         (-[WKContentView _twoFingerSingleTapGestureRecognized:]):
3214         (-[WKContentView _singleTapCommited:]):
3215         Pass modifier flags through.
3216
3217         (-[WKContentView _attemptClickAtLocation:modifierFlags:]): Added.
3218         (-[WKContentView actionSheetAssistant:openElementAtLocation:]): This is invoked when a person opens a link
3219         via the action sheet. We don't have access to the modifier flags to pass. It also seems like an implementation
3220         detail that this action is implemented via mouse click and we should re-evaluate this decision in light of
3221         the fact tht the action sheet is browser UI and we tend to be very reserved on what UI actions are visible
3222         to the page. On Mac, opening a link via the context menu is not visible to the page, at least from a mouse
3223         event perspective.
3224         (webEventFlagsForUIKeyModifierFlags): Added.
3225         (-[WKContentView _hoverGestureRecognizerChanged:]): Pass modifier flags through.
3226         (-[WKContentView _attemptClickAtLocation:]): Deleted.
3227         * UIProcess/ios/WebPageProxyIOS.mm:
3228         (WebKit::WebPageProxy::handleTwoFingerTapAtPoint):
3229         (WebKit::WebPageProxy::commitPotentialTap):
3230         (WebKit::WebPageProxy::handleTap):
3231         * WebProcess/WebPage/WebPage.h:
3232         * WebProcess/WebPage/WebPage.messages.in:
3233         * WebProcess/WebPage/ios/WebPageIOS.mm:
3234         (WebKit::WebPage::handleSyntheticClick):
3235         (WebKit::WebPage::completePendingSyntheticClickForContentChangeObserver):
3236         (WebKit::WebPage::completeSyntheticClick):
3237         (WebKit::WebPage::handleTap):
3238         (WebKit::WebPage::handleTwoFingerTapAtPoint):
3239         (WebKit::WebPage::commitPotentialTap):
3240         Pass modifier flags through.
3241
3242 2019-02-11  Youenn Fablet  <youenn@apple.com>
3243
3244         Filter out Overconstrainederror.constraint when getUserMedia is not granted
3245         https://bugs.webkit.org/show_bug.cgi?id=194240
3246
3247         Reviewed by Eric Carlson.
3248
3249         Make sure in UIProcess to filter out constraint if either the page was not granted gum access or it has no persistent access.
3250
3251         Refactor UserMediaPermissionRequestManagerProxy to make the implementation easier to understand.
3252
3253         Covered by added test.
3254
3255         * UIProcess/UserMediaPermissionCheckProxy.cpp:
3256         (WebKit::UserMediaPermissionCheckProxy::setUserMediaAccessInfo):
3257         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
3258         (WebKit::UserMediaPermissionRequestManagerProxy::captureDevicesChanged):
3259         (WebKit::UserMediaPermissionRequestManagerProxy::userMediaAccessWasGranted):
3260         (WebKit::UserMediaPermissionRequestManagerProxy::grantAccess):
3261         (WebKit::UserMediaPermissionRequestManagerProxy::getRequestAction):
3262         (WebKit::UserMediaPermissionRequestManagerProxy::requestUserMediaPermissionForFrame):
3263         (WebKit::UserMediaPermissionRequestManagerProxy::processUserMediaPermissionRequest):
3264         (WebKit::UserMediaPermissionRequestManagerProxy::processUserMediaPermissionInvalidRequest):
3265         (WebKit::UserMediaPermissionRequestManagerProxy::processUserMediaPermissionValidRequest):
3266         (WebKit::UserMediaPermissionRequestManagerProxy::getUserMediaPermissionInfo):
3267         (WebKit::UserMediaPermissionRequestManagerProxy::wasGrantedVideoOrAudioAccess):
3268         (WebKit::UserMediaPermissionRequestManagerProxy::computeFilteredDeviceList):
3269         (WebKit::UserMediaPermissionRequestManagerProxy::enumerateMediaDevicesForFrame):
3270         (WebKit::UserMediaPermissionRequestManagerProxy::createPermissionRequest): Deleted.
3271         * UIProcess/UserMediaPermissionRequestManagerProxy.h:
3272         * UIProcess/UserMediaPermissionRequestProxy.h:
3273         (WebKit::UserMediaPermissionRequestProxy::isPending const):
3274         (WebKit::UserMediaPermissionRequestProxy::setEligibleVideoDeviceUIDs):
3275         (WebKit::UserMediaPermissionRequestProxy::setEligibleAudioDeviceUIDs):
3276         (WebKit::UserMediaPermissionRequestProxy::hasAudioDevice const):
3277         (WebKit::UserMediaPermissionRequestProxy::hasVideoDevice const):
3278         (WebKit::UserMediaPermissionRequestProxy::hasPersistentAccess const):
3279         (WebKit::UserMediaPermissionRequestProxy::setHasPersistentAccess):
3280         (WebKit::UserMediaPermissionRequestProxy::userMediaID const):
3281         (WebKit::UserMediaPermissionRequestProxy::topLevelDocumentSecurityOrigin const):
3282         (WebKit::UserMediaPermissionRequestProxy::userMediaDocumentSecurityOrigin const):
3283         (WebKit::UserMediaPermissionRequestProxy::userRequest const):
3284         (WebKit::UserMediaPermissionRequestProxy::setDeviceIdentifierHashSalt):
3285         (WebKit::UserMediaPermissionRequestProxy::deviceIdentifierHashSalt const):
3286         (WebKit::UserMediaPermissionRequestProxy::audioDevice const):
3287         (WebKit::UserMediaPermissionRequestProxy::videoDevice const):
3288         * UIProcess/WebPageProxy.cpp:
3289         (WebKit::WebPageProxy::requestUserMediaPermissionForFrame):
3290         * UIProcess/WebPageProxy.h:
3291
3292 2019-02-11  Carlos Garcia Campos  <cgarcia@igalia.com>
3293
3294         [WPE] Do not try to create empty egl windows
3295         https://bugs.webkit.org/show_bug.cgi?id=194497
3296
3297         Reviewed by Žan Doberšek.
3298
3299         In AcceleratedSurfaceWPE we ensure the size we pass to wpe is at least 0x0, but wl_egl_window_create() returns
3300         nullptr if 0 is passed as width or height. We should use at least 1x1 instead.
3301
3302         * WebProcess/WebPage/wpe/AcceleratedSurfaceWPE.cpp:
3303         (WebKit::AcceleratedSurfaceWPE::initialize):
3304         (WebKit::AcceleratedSurfaceWPE::clientResize):
3305
3306 2019-02-10  Carlos Garcia Campos  <cgarcia@igalia.com>
3307
3308         [WPE] Do not use a sync IPC message to send the host FD to the web process
3309         https://bugs.webkit.org/show_bug.cgi?id=194216
3310
3311         Reviewed by Darin Adler.
3312
3313         It can be sent as a web page creation parameter instead.
3314
3315         * PlatformWPE.cmake:
3316         * Shared/WebPageCreationParameters.cpp:
3317         (WebKit::WebPageCreationParameters::encode const):
3318         (WebKit::WebPageCreationParameters::decode):
3319         * Shared/WebPageCreationParameters.h:
3320         * SourcesWPE.txt:
3321         * UIProcess/API/wpe/CompositingManagerProxy.cpp: Removed.
3322         * UIProcess/API/wpe/CompositingManagerProxy.h: Removed.
3323         * UIProcess/API/wpe/CompositingManagerProxy.messages.in: Removed.
3324         * UIProcess/API/wpe/PageClientImpl.cpp:
3325         (WebKit::PageClientImpl::hostFileDescriptor):
3326         * UIProcess/API/wpe/PageClientImpl.h:
3327         * UIProcess/API/wpe/WPEView.cpp:
3328         (WKWPE::m_backend):
3329         * UIProcess/API/wpe/WPEView.h:
3330         (WKWPE::View::create):
3331         * UIProcess/PageClient.h:
3332         * UIProcess/WebPageProxy.cpp:
3333         (WebKit::WebPageProxy::creationParameters):
3334         * WebProcess/WebPage/WebPage.cpp:
3335         (WebKit::m_hostFileDescriptor):
3336         * WebProcess/WebPage/WebPage.h:
3337         (WebKit::WebPage::releaseHostFileDescriptor):
3338         * WebProcess/WebPage/wpe/AcceleratedSurfaceWPE.cpp:
3339         (WebKit::AcceleratedSurfaceWPE::AcceleratedSurfaceWPE):
3340         (WebKit::AcceleratedSurfaceWPE::initialize):
3341         * WebProcess/WebPage/wpe/AcceleratedSurfaceWPE.h:
3342         * WebProcess/WebPage/wpe/CompositingManager.cpp: Removed.
3343         * WebProcess/WebPage/wpe/CompositingManager.h: Removed.
3344
3345 2019-02-04  Carlos Garcia Campos  <cgarcia@igalia.com>
3346
3347         [GTK][WPE] Add enable-javascript-markup setting
3348         https://bugs.webkit.org/show_bug.cgi?id=193439
3349
3350         Reviewed by Michael Catanzaro.
3351
3352         Expose JavaScriptMarkupEnabled setting in the GLib API.
3353
3354         * UIProcess/API/glib/WebKitSettings.cpp:
3355         (webKitSettingsSetProperty):
3356         (webKitSettingsGetProperty):
3357         (webkit_settings_class_init):
3358         (webkit_settings_get_enable_javascript_markup):
3359         (webkit_settings_set_enable_javascript_markup):
3360         * UIProcess/API/gtk/WebKitSettings.h:
3361         * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt:
3362         * UIProcess/API/wpe/WebKitSettings.h:
3363         * UIProcess/API/wpe/docs/wpe-0.1-sections.txt:
3364
3365 2019-02-10  Darin Adler  <darin@apple.com>
3366
3367         Switch uses of StringBuilder with String::format for hex numbers to use HexNumber.h instead
3368         https://bugs.webkit.org/show_bug.cgi?id=194485
3369
3370         Reviewed by Daniel Bates.
3371
3372         * UIProcess/DeviceIdHashSaltStorage.cpp:
3373         (WebKit::DeviceIdHashSaltStorage::completeDeviceIdHashSaltForOriginCall): Use
3374         appendUnsignedAsHex instead of appendUnsigned64AsHex.
3375
3376         * UIProcess/WebBackForwardList.cpp:
3377         (WebKit::WebBackForwardList::loggingString): Use appendUnsignedAsHex and
3378         reinterpret_cast<uintptr_t> instead of String::format and "%p".
3379
3380 2019-02-10  Commit Queue  <commit-queue@webkit.org>
3381
3382         Unreviewed, rolling out r241167.
3383         https://bugs.webkit.org/show_bug.cgi?id=194482
3384
3385         Broke the GTK mediastream tests (Requested by philn on
3386         #webkit).
3387
3388         Reverted changeset:
3389
3390         "Filter out Overconstrainederror.constraint when getUserMedia
3391         is not granted"