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