f4a71c905a9f780f013da71d95a0de5e386045f2
[WebKit.git] / Source / WebKit2 / ChangeLog
1 2017-07-06  Wenson Hsieh  <wenson_hsieh@apple.com>
2
3         [iOS DnD] [WK2] Add delegate hooks for specifying the data owner for a drag or drop session
4         https://bugs.webkit.org/show_bug.cgi?id=174139
5         <rdar://problem/33126212>
6
7         Reviewed by Beth Dakin.
8
9         Add hooks to query the UI delegate for a _UIDataOwner on both drag and drop sides.
10
11         * Platform/spi/ios/UIKitSPI.h:
12         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
13         * UIProcess/ios/WKContentViewInteraction.mm:
14         (-[WKContentView _dragInteraction:dataOwnerForSession:]):
15         (-[WKContentView _dropInteraction:dataOwnerForSession:]):
16
17 2017-07-06  Brent Fulgham  <bfulgham@apple.com>
18
19         [WK2] ResourceLoadStatistics should batch its writes
20         https://bugs.webkit.org/show_bug.cgi?id=174111
21         <rdar://problem/33115894>
22
23         Reviewed by Chris Dumez.
24
25         Revise the data writing operation to only write on a specific interval (currently
26         set to 5 minutes).
27
28         Also make 'writeStoreToDisk' simpler to use by moving the deleting (before write) and
29         creating (after write) of the FileMonitor into the method, rather than requiring this
30         knowledge in multiple places.
31
32         Make sure that we write our statistics file out before exiting so that we do not
33         lose any data if we exit before the five-minute window has elapsed.
34
35         * UIProcess/Storage/ResourceLoadStatisticsStore.cpp:
36         (WebKit::ResourceLoadStatisticsStore::setWritePersistentStoreCallback): Deleted.
37         * UIProcess/WebResourceLoadStatisticsStore.cpp:
38         (WebKit::WebResourceLoadStatisticsStore::processStatisticsAndDataRecords): Remove the stop
39         and start monitoring into 'writeStoreToDisk'. Also check if enough time has elapsed since
40         the last write to commit to disk.
41         (WebKit::WebResourceLoadStatisticsStore::registerSharedResourceLoadObserver): Remove the
42         stop and start monitoring into 'writeStoreToDisk'.
43         (WebKit::WebResourceLoadStatisticsStore::writeStoreToDisk): Add the stop and start monitoring
44         commands here, so callers don't have to know to do so.
45
46 2017-07-06  Chris Dumez  <cdumez@apple.com>
47
48         FileMonitor should not be ref counted
49         https://bugs.webkit.org/show_bug.cgi?id=174166
50
51         Reviewed by Brent Fulgham.
52
53         Update code using FileMonitor to reflect API change.
54
55         * UIProcess/WebResourceLoadStatisticsStore.cpp:
56         (WebKit::WebResourceLoadStatisticsStore::startMonitoringStatisticsStorage):
57         (WebKit::WebResourceLoadStatisticsStore::stopMonitoringStatisticsStorage):
58         * UIProcess/WebResourceLoadStatisticsStore.h:
59
60 2017-07-06  Matt Rajca  <mrajca@apple.com>
61
62         Fix build with VIDEO support disabled.
63         https://bugs.webkit.org/show_bug.cgi?id=174217
64
65         Unreviewed build fix.
66
67         * WebProcess/WebPage/WebPage.cpp:
68         (WebKit::WebPage::updateWebsitePolicies):
69
70 2017-07-06  Chris Dumez  <cdumez@apple.com>
71
72         Crash under WebResourceLoadStatisticsStore::persistentStoragePath(WTF::String const&)
73         https://bugs.webkit.org/show_bug.cgi?id=174205
74         <rdar://problem/33093552>
75
76         Reviewed by Brent Fulgham.
77
78         Make sure we isolateCopy() m_statisticsStoragePath before using it from the background
79         thread.
80
81         * UIProcess/WebResourceLoadStatisticsStore.cpp:
82         (WebKit::WebResourceLoadStatisticsStore::readDataFromDiskIfNeeded):
83         (WebKit::WebResourceLoadStatisticsStore::refreshFromDisk):
84         (WebKit::WebResourceLoadStatisticsStore::resourceLogFilePath):
85         (WebKit::WebResourceLoadStatisticsStore::statisticsFilePath):
86         (WebKit::WebResourceLoadStatisticsStore::writeStoreToDisk):
87         (WebKit::WebResourceLoadStatisticsStore::writeEncoderToDisk):
88         (WebKit::WebResourceLoadStatisticsStore::deleteStoreFromDisk):
89         (WebKit::WebResourceLoadStatisticsStore::startMonitoringStatisticsStorage):
90         (WebKit::WebResourceLoadStatisticsStore::syncWithExistingStatisticsStorageIfNeeded):
91         (WebKit::WebResourceLoadStatisticsStore::persistentStoragePath): Deleted.
92         * UIProcess/WebResourceLoadStatisticsStore.h:
93
94 2017-07-06  Alex Christensen  <achristensen@webkit.org>
95
96         Fix CFURLRequestRef serialization after r207330
97         https://bugs.webkit.org/show_bug.cgi?id=163332
98
99         * Shared/mac/WebCoreArgumentCodersMac.mm:
100         (IPC::ArgumentCoder<ResourceRequest>::encodePlatformData):
101         The CFURLConnection code was not updated.
102         We did not catch this because nobody uses the WebKit2 CFURLConnection code, but I need to use it to debug something.
103
104 2017-07-06  Chris Dumez  <cdumez@apple.com>
105
106         Move ResourceLoadObserver notification throttling logic from WebProcess class to ResourceLoadObserver
107         https://bugs.webkit.org/show_bug.cgi?id=174194
108
109         Reviewed by Brent Fulgham.
110
111         Move ResourceLoadObserver notification throttling logic from WebProcess class to
112         ResourceLoadObserver. This makes more sense and decreases the complexity of the
113         WebProcess class.
114
115         * WebProcess/WebProcess.cpp:
116         (WebKit::m_webSQLiteDatabaseTracker):
117         (WebKit::WebProcess::statisticsChangedTimerFired): Deleted.
118         * WebProcess/WebProcess.h:
119
120 2017-07-06  Chris Dumez  <cdumez@apple.com>
121
122         WebResourceLoadStatisticsStore should only be constructed when the feature is enabled
123         https://bugs.webkit.org/show_bug.cgi?id=174189
124
125         Reviewed by Brent Fulgham.
126
127         Delay the construction of the WebResourceLoadStatisticsStore until the feature gets
128         enabled via WebsiteDataStore::setResourceLoadStatisticsEnabled(). Previously, we would
129         always construct a store and then have a boolean on the store to indicate if it is
130         enabled or not.
131
132         Also simplify the initialization process of the WebResourceLoadStatisticsStore, we
133         used to have:
134         1. WebResourceLoadStatisticsStore constructor
135         2. WebResourceLoadStatisticsStore::registerSharedResourceLoadObserver()
136         3. WebResourceLoadStatisticsStore::setResourceLoadStatisticsEnabled(true)
137
138         All 3 steps are now taken care of by the WebResourceLoadStatisticsStore constructor.
139
140         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
141         (WebKit::WebProcessPool::platformInitialize):
142         * UIProcess/WebResourceLoadStatisticsStore.cpp:
143         (WebKit::WebResourceLoadStatisticsStore::WebResourceLoadStatisticsStore):
144         (WebKit::WebResourceLoadStatisticsStore::readDataFromDiskIfNeeded):
145         * UIProcess/WebResourceLoadStatisticsStore.h:
146         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
147         (WebKit::WebsiteDataStore::platformInitialize):
148         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
149         (WebKit::WebsiteDataStore::WebsiteDataStore):
150         (WebKit::WebsiteDataStore::resourceLoadStatisticsEnabled):
151         (WebKit::WebsiteDataStore::setResourceLoadStatisticsEnabled):
152         * UIProcess/WebsiteData/WebsiteDataStore.h:
153         (WebKit::WebsiteDataStore::resourceLoadStatistics):
154         * UIProcess/wpe/WebProcessPoolWPE.cpp:
155         (WebKit::WebProcessPool::platformInitialize):
156
157 2017-07-06  Claudio Saavedra  <csaavedra@igalia.com>
158
159         [GTK] It should process MouseMoved events when the parent window is not active
160         https://bugs.webkit.org/show_bug.cgi?id=116691
161
162         Reviewed by Michael Catanzaro.
163
164         From reading the comments in the related code, only in Safari it
165         is desired that MouseMoved events are not processed when the
166         parent window is not active. In other ports, in particular those
167         targeting Linux, these events should be processed for consistency
168         with other browsers.
169
170         * UIProcess/WebPageProxy.cpp:
171         (WebKit::WebPageProxy::setCursor):
172         * UIProcess/mac/PageClientImpl.mm:
173         (WebKit::PageClientImpl::setCursor):
174         * WebProcess/WebPage/WebPage.cpp:
175         (WebKit::handleMouseEvent):
176         (WebKit::WebPage::mouseEvent):  No need to always pass a boolean
177         parameter that is only checked for one type of event. Do the check
178         internally in handleMouseEvent() only when needed and only in Cocoa.
179
180 2017-07-05  Don Olmstead  <don.olmstead@sony.com>
181
182         [WTF] Move SoftLinking.h into WTF
183         https://bugs.webkit.org/show_bug.cgi?id=174000
184
185         Reviewed by Alex Christensen.
186
187         * Platform/mac/StringUtilities.mm:
188         * Platform/spi/ios/ManagedConfigurationSPI.h:
189         * Shared/Cocoa/DataDetectionResult.mm:
190         * Shared/Cocoa/WebCoreArgumentCodersCocoa.mm:
191         * Shared/ios/InteractionInformationAtPosition.mm:
192         * Shared/ios/WebIconUtilities.mm:
193         * Shared/mac/CookieStorageShim.mm:
194         * Shared/mac/WebCoreArgumentCodersMac.mm:
195         * UIProcess/API/Cocoa/_WKElementAction.mm:
196         * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
197         * UIProcess/ApplePay/ios/WebPaymentCoordinatorProxyIOS.mm:
198         * UIProcess/ApplePay/mac/WebPaymentCoordinatorProxyMac.mm:
199         * UIProcess/Cocoa/UIDelegate.mm:
200         * UIProcess/Cocoa/WebViewImpl.mm:
201         * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
202         * UIProcess/ios/WKActionSheetAssistant.mm:
203         * UIProcess/ios/WKContentViewInteraction.mm:
204         * UIProcess/ios/forms/WKAirPlayRoutePicker.mm:
205         * UIProcess/ios/forms/WKFileUploadPanel.mm:
206         * UIProcess/mac/WKImmediateActionController.mm:
207         * UIProcess/mac/WebInspectorProxyMac.mm:
208         * WebProcess/WebPage/mac/PlatformCALayerRemoteCustom.mm:
209         * WebProcess/WebPage/mac/WebInspectorUIMac.mm:
210         * WebProcess/cocoa/WebProcessCocoa.mm:
211
212 2017-07-05  Brady Eidson  <beidson@apple.com>
213
214         Allow navigations in subframes to get a ShouldOpenExternalURLsPolicy of "ShouldAllow".
215         <rdar://problem/22485589> and https://bugs.webkit.org/show_bug.cgi?id=174178
216
217         Reviewed by Alex Christensen.
218
219         Adopt to the new constructor for FrameLoadRequest.
220
221         * WebProcess/Plugins/PluginView.cpp:
222         (WebKit::PluginView::loadURL):
223         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
224         (WebKit::WebFrameLoaderClient::dispatchCreatePage):
225         * WebProcess/WebPage/WebInspector.cpp:
226         (WebKit::WebInspector::openInNewTab):
227
228 2017-07-05  Ryosuke Niwa  <rniwa@webkit.org>
229
230         Remove unnecessary forward declartions now that we include Foundation.h
231
232         * UIProcess/API/Cocoa/WKContentRuleListStore.h:
233
234 2017-07-05  Ryosuke Niwa  <rniwa@webkit.org>
235
236         Make WebKit's public headers on Mac and iOS C++ module safe
237         https://bugs.webkit.org/show_bug.cgi?id=174175
238
239         Reviewed by Alex Christensen.
240
241         Fixed the header files.
242
243         * UIProcess/API/Cocoa/WKContentRuleList.h:
244         * UIProcess/API/Cocoa/WKContentRuleListStore.h:
245         * UIProcess/API/Cocoa/WKUIDelegate.h:
246
247 2017-07-05  Chris Dumez  <cdumez@apple.com>
248
249         [WK2] WebsiteDataStore::setResourceLoadStatisticsEnabled() updates processPools the store is not associated with
250         https://bugs.webkit.org/show_bug.cgi?id=174174
251
252         Reviewed by Brent Fulgham.
253
254         WebsiteDataStore::setResourceLoadStatisticsEnabled() updates processPools the store is not associated with.
255         Fix this by iterating over WebsiteDataStore::processPools() instead of WebProcessPool::allProcessPools().
256
257         Also rename shouldPartitionCookiesForTopPrivatelyOwnedDomains methods / IPC messages to
258         updateCookiePartitioningForTopPrivatelyOwnedDomains since this is a setter, not a getter.
259
260         Finally, drop ShouldPartitionCookiesForTopPrivatelyOwnedDomains IPC message to the NetworkProcessProxy
261         as well as corresponding methods as those appear to be unused.
262
263         * NetworkProcess/NetworkProcess.cpp:
264         (WebKit::NetworkProcess::updateCookiePartitioningForTopPrivatelyOwnedDomains):
265         (WebKit::NetworkProcess::shouldPartitionCookiesForTopPrivatelyOwnedDomains): Deleted.
266         * NetworkProcess/NetworkProcess.h:
267         * NetworkProcess/NetworkProcess.messages.in:
268         * UIProcess/Network/NetworkProcessProxy.cpp:
269         (WebKit::NetworkProcessProxy::shouldPartitionCookiesForTopPrivatelyOwnedDomains): Deleted.
270         * UIProcess/Network/NetworkProcessProxy.h:
271         * UIProcess/Network/NetworkProcessProxy.messages.in:
272         * UIProcess/WebProcessPool.cpp:
273         (WebKit::WebProcessPool::setResourceLoadStatisticsEnabled):
274         * UIProcess/WebProcessPool.h:
275         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
276         (WebKit::WebsiteDataStore::updateCookiePartitioningForTopPrivatelyOwnedDomains):
277         (WebKit::WebsiteDataStore::setResourceLoadStatisticsEnabled):
278         (WebKit::WebsiteDataStore::registerSharedResourceLoadObserver):
279         (WebKit::WebsiteDataStore::shouldPartitionCookiesForTopPrivatelyOwnedDomains): Deleted.
280         * UIProcess/WebsiteData/WebsiteDataStore.h:
281
282 2017-07-05  Tim Horton  <timothy_horton@apple.com>
283
284         Async Image Decoding: Image flashes away briefly when tapping on tab in iPad tab picker
285         https://bugs.webkit.org/show_bug.cgi?id=174173
286         <rdar://problem/32431952>
287
288         Reviewed by Geoffrey Garen.
289
290         * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm:
291         (WebKit::RemoteLayerTreeDrawingArea::addTransactionCallbackID):
292         When a client uses e.g. doAfterNextPresentationUpdate (or internally,
293         dispatchAfterEnsuringDrawing), they're doing so in the hopes that the
294         callback is called after the page is well-painted -- for example, to
295         remove a snapshot (in the tab picker case, as well as for navigation
296         gestures), or to *take* a snapshot. In all of these cases, it is
297         preferable to do a synchronous decode, to ensure that the image does
298         not flash away temporarily.
299
300         Use the existing mechanism that was implemented for the synchronous
301         activity state change flush to also force synchronous image decoding
302         any time there is a post-commit transaction callback.
303
304 2017-07-05  Wenson Hsieh  <wenson_hsieh@apple.com>
305
306         [iOS DnD] [WK2] 3D touch fails to recognize when UIDragInteraction is enabled on phone
307         https://bugs.webkit.org/show_bug.cgi?id=174171
308         <rdar://problem/32956929>
309
310         Reviewed by Tim Horton.
311
312         By default, UIKit defers all competing long press gesture recognizers if dragging is enabled. However, this
313         would cause 3D touch to be prevented, due to UIKit asking us whether or not we can proceed with the 3D touch
314         gesture in -_interactionShouldBeginFromPreviewItemController:forPosition:, while the highlight long press
315         gesture recognizer is being deferred. To address this, we use SPI on UIDragInteraction to allow the highlight
316         long press gesture recognizer to recognize alongside the drag lift gesture. We then (already) manually cancel
317         the highlight long press gesture in _dragInteraction:prepareForSession:completion:.
318
319         * UIProcess/ios/WKContentViewInteraction.mm:
320         (-[WKContentView _dragInteraction:shouldDelayCompetingGestureRecognizer:]):
321
322 2017-07-03  Myles C. Maxfield  <mmaxfield@apple.com>
323
324         Remove copy of ICU headers from WebKit
325         https://bugs.webkit.org/show_bug.cgi?id=116407
326
327         Reviewed by Alex Christensen.
328
329         * Configurations/BaseTarget.xcconfig:
330
331 2017-07-05  Chris Dumez  <cdumez@apple.com>
332
333         Regression(r218821): Bad cast to WebKit::DiagnosticLoggingClient in WKWebView's _setDiagnosticLoggingDelegate
334         https://bugs.webkit.org/show_bug.cgi?id=174163
335         <rdar://problem/33067518>
336
337         Reviewed by Alex Christensen.
338
339         After r218821, WebPageProxy::setDiagnosticLoggingClient() would no longer set the client in
340         private session. This is an issue because there is code in WKWebView which expects the
341         DiagnosticLoggingClient to be set and of a specific type. This would lead to bad casts in
342         WKWebView's _diagnosticLoggingDelegate / _setDiagnosticLoggingDelegate.
343
344         To avoid the issue, we now unconditionally update the client in
345         WebPageProxy::setDiagnosticLoggingClient(). Instead, we implement the logic for disabling
346         logging in private session in the logging methods themselves, via the
347         WebPageProxy::effectiveDiagnosticLoggingClient() helper instead.
348
349         I also added null checks in WKWebView's _diagnosticLoggingDelegate /
350         _setDiagnosticLoggingDelegate. Even though the WKWebView sets itself as the diagnostic
351         logging client, WebPageProxy::diagnosticLoggingClient() can still return null after
352         calling WebPageProxy::close(). Previously, we would have done a bad cast if the WKWebView's
353         client would have used this API after calling 'close' as well.
354
355         * UIProcess/API/APIDiagnosticLoggingClient.h:
356         * UIProcess/API/Cocoa/WKWebView.mm:
357         (-[WKWebView _diagnosticLoggingDelegate]):
358         (-[WKWebView _setDiagnosticLoggingDelegate:]):
359         * UIProcess/WebPageProxy.cpp:
360         (WebKit::WebPageProxy::WebPageProxy):
361         (WebKit::WebPageProxy::setDiagnosticLoggingClient):
362         (WebKit::WebPageProxy::close):
363         (WebKit::WebPageProxy::effectiveDiagnosticLoggingClient):
364         (WebKit::WebPageProxy::logDiagnosticMessage):
365         (WebKit::WebPageProxy::logDiagnosticMessageWithResult):
366         (WebKit::WebPageProxy::logDiagnosticMessageWithValue):
367         (WebKit::WebPageProxy::logDiagnosticMessageWithEnhancedPrivacy):
368         * UIProcess/WebPageProxy.h:
369         (WebKit::WebPageProxy::diagnosticLoggingClient):
370
371 2017-07-05  Daniel Bates  <dabates@apple.com>
372
373         Do not pass API::FrameInfo for source frame or clear out page of target frame on
374         API navigation
375         https://bugs.webkit.org/show_bug.cgi?id=174170
376         <rdar://problem/33140328>
377
378         Reviewed by Brady Eidson.
379
380         As a step towards making it straightforward for an embedding client to determine whether
381         a WebPageProxy::decidePolicyForNavigationAction() callback was initiated from API we
382         should not pass frame info for the source frame and should not nullify the page pointer
383         in the target frame info.
384
385         Currently we always pass frame info for the source frame and nullify the page pointer
386         in both the source frame info and target frame info if the navigation was initiated from
387         API. This seems subtle and error prone. Instead we should not pass frame info for
388         the source frame and not nullify the page pointer in the target frame info as a step
389         towards making using this API less error-prone.
390
391         * UIProcess/WebPageProxy.cpp:
392         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
393
394 2017-07-05  Chris Dumez  <cdumez@apple.com>
395
396         Add a few more WebKit2 owners
397         https://bugs.webkit.org/show_bug.cgi?id=174169
398
399         Reviewed by Brady Eidson.
400
401         * Owners:
402
403 2017-07-05  Brent Fulgham  <bfulgham@apple.com>
404
405         [WK2] Prevent ResourceLoadStatistics from triggering a cascade of read/write events
406         https://bugs.webkit.org/show_bug.cgi?id=174062\
407         <rdar://problem/33086744>
408
409         Reviewed by Chris Dumez.
410
411         ResourceLoadStatistics was triggering periods of high CPU use due to a cascade of read/write
412         operations:
413         (1) The 'makeRefPtr' call in FileMonitor::startMonitoring was capturing a reference to itself, preventing
414             the FileMonitor from being destroyed. This caused the file modification handler to fire in response
415             to our own write events, creating a ridiculous read/write cycle. This problem was addressed in
416             the short term by stopping the file monitor in WebResourceLoadStatisticsStore::stopMonitoringStatisticsStorage,
417             rather than relying on the destructor to shut things down. This will be improved in a
418             subsequent patch.
419         (2) 'syncWithExistingStatisticsStorageIfNeeded' was creating a FileMonitor during the write operation,
420             which exacerbated the chain of read/writes already present due to the self-reference described above.
421         (3) Because VNODE dispatch sources are low level, they do not offer a means of filtering out operations
422             triggered by the current process. To avoid this, I added code to track the file modification time, so
423             that we don't bother reading a file that holds data that is older than the in-memory data, even though
424             we receive a file modification dispatch. Writes seem to trigger a chain of notification events in rapid
425             succession. Once we've responded to the first of these events, we don't need to to further reads until
426             the data on disk changes again.    
427
428         We also shouldn't allow the ResourceLoadStatistics worker thread to consume high CPU resources. Run it
429         as utility QoS, avoiding using the CPU when other work is going on.
430
431         Drive-by fix: The closure in setWritePersistentStoreCallback() should stop monitoring before writing
432         data, and should start monitoring after the write completes.
433
434         * UIProcess/WebResourceLoadStatisticsStore.cpp:
435         (WebKit::WebResourceLoadStatisticsStore::WebResourceLoadStatisticsStore): Run our worker queue
436         as a utility-level process.
437         (WebKit::WebResourceLoadStatisticsStore::registerSharedResourceLoadObserver): Stop checking for
438         updates before writing, and begin checking again once the write is complete.
439         (WebKit::WebResourceLoadStatisticsStore::statisticsFileModificationTime): Added.
440         (WebKit::WebResourceLoadStatisticsStore::readDataFromDiskIfNeeded): Avoid reading the file if it
441         was last modified on (or before) the time we last read the file.
442         (WebKit::WebResourceLoadStatisticsStore::refreshFromDisk): Ditto.
443         (WebKit::WebResourceLoadStatisticsStore::stopMonitoringStatisticsStorage): Explicitly stop file
444         monitoring so that the active file modification handler will terminate.
445         (WebKit::WebResourceLoadStatisticsStore::syncWithExistingStatisticsStorageIfNeeded): Do not begin
446         monitoring the file after syncing, since this is only used as part of an ongoing write operation.
447
448 2017-07-05  Jonathan Bedard  <jbedard@apple.com>
449
450         Add WebKitPrivateFrameworkStubs for iOS 11
451         https://bugs.webkit.org/show_bug.cgi?id=173988
452
453         Reviewed by David Kilzer.
454
455         * Configurations/BaseTarget.xcconfig: iphoneos and iphonesimulator should use the
456         same directory for private framework stubs.
457
458 2017-07-05  Andy Estes  <aestes@apple.com>
459
460         [iOS] WKActionSheetAssistants can outlive their host views
461         https://bugs.webkit.org/show_bug.cgi?id=174160
462         <rdar://problem/20638607>
463
464         Reviewed by Tim Horton.
465
466         WKActionSheetAssistant keeps a raw pointer to its host UIView, and nothing clears it when
467         the host view is deallocated. If the assistant outlives the view, we can end up accessing a
468         pointer to a deallocated UIView and crashing.
469
470         I don't know how to reproduce such a crash, but this patch guards against it by doing the
471         following:
472
473         1. Make _view a WeakObjCPtr in WKActionSheetAssistant to ensure it gets set to nil when the
474            UIView is deallocated.
475         2. Call -[WKActionSheetAssistant cleanupSheet] when a WKContentView or WKPDFView is
476            deallocated, or when the Web process crashes. This will ensure the action sheet is
477            dismissed and prevent the user from tapping on an action that's no longer valid.
478
479         * UIProcess/ios/WKActionSheetAssistant.mm:
480         (-[WKActionSheetAssistant superviewForSheet]):
481         (-[WKActionSheetAssistant _presentationRectForSheetGivenPoint:inHostView:]):
482         (-[WKActionSheetAssistant presentationRectForElementUsingClosestIndicatedRect]):
483         (-[WKActionSheetAssistant presentationRectForIndicatedElement]):
484         (-[WKActionSheetAssistant _shouldPresentAtTouchLocationForElementRect:]):
485         * UIProcess/ios/WKContentViewInteraction.mm:
486         (-[WKContentView cleanupInteraction]):
487         * UIProcess/ios/WKPDFView.mm:
488         (-[WKPDFView dealloc]):
489
490 2017-07-05  Frederic Wang  <fwang@igalia.com>
491
492         Move ScrolledContentsLayer property to ScrollingStateScrollingNode
493         https://bugs.webkit.org/show_bug.cgi?id=174134
494
495         Reviewed by Simon Fraser.
496
497         * Shared/Scrolling/RemoteScrollingCoordinatorTransaction.cpp:
498         (ArgumentCoder<ScrollingStateScrollingNode>::encode): Add encoding for scrolled contents
499         layer.
500         (ArgumentCoder<ScrollingStateFrameScrollingNode>::encode): Remove encoding for scrolled
501         contents layer.
502         (ArgumentCoder<ScrollingStateOverflowScrollingNode>::encode): Ditto.
503         (ArgumentCoder<ScrollingStateScrollingNode>::decode): Add decoding for scrolled contents
504         layer.
505         (ArgumentCoder<ScrollingStateFrameScrollingNode>::decode): Remove decoding for scrolled
506         contents layer.
507         (ArgumentCoder<ScrollingStateOverflowScrollingNode>::decode): Ditto.
508         (WebKit::dump): Move dumping of scrolled contents layer from overflow/frame nodes to
509         scrolling node.
510         * UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.cpp:
511         (WebKit::RemoteScrollingCoordinatorProxy::connectStateNodeLayers): Adjust enum value to use
512         ScrollingStateScrollingNode::ScrolledContentsLayer.
513         * UIProcess/Scrolling/ios/ScrollingTreeOverflowScrollingNodeIOS.mm:
514         (WebKit::ScrollingTreeOverflowScrollingNodeIOS::commitStateBeforeChildren): Ditto.
515         * UIProcess/ios/RemoteScrollingCoordinatorProxyIOS.mm:
516         (WebKit::RemoteScrollingCoordinatorProxy::connectStateNodeLayers): Ditto.
517
518 2017-07-05  Ada Chan  <adachan@apple.com>
519
520         Fix crash in UIKit: +[UIViewController _viewControllerForFullScreenPresentationFromView:]
521         https://bugs.webkit.org/show_bug.cgi?id=174143
522         <rdar://problem/28384582>
523
524         Reviewed by Wenson Hsieh.
525
526         In -[WKActionSheet willRotate], we can't guarantee that the action sheet belongs
527         in a window, and passing nil to +[UIViewController _viewControllerForFullScreenPresentationFromView:]
528         throws an exception. To fix this, bail early if the result from -hostViewForSheet is nil.
529
530         * UIProcess/ios/WKActionSheet.mm:
531         (-[WKActionSheet willRotate]):
532
533 2017-07-05  Eric Carlson  <eric.carlson@apple.com>
534
535         [MediaStream] Protect request and web view during gUM client callback
536         https://bugs.webkit.org/show_bug.cgi?id=174096
537         <rdar://problem/32833102>
538
539         Reviewed by Youenn Fablet.
540
541         Retain the message and WebView during asynchronous calls so they won't be 
542         released if a navigation happens during a call to the UA for getUserMedia 
543         or enumerateMediaDevices.
544
545         * UIProcess/Cocoa/UIDelegate.mm:
546         (WebKit::requestUserMediaAuthorizationForDevices):
547         (WebKit::UIDelegate::UIClient::decidePolicyForUserMediaPermissionRequest):
548         (WebKit::UIDelegate::UIClient::checkUserMediaPermissionForOrigin):
549
550 2017-07-05  Matt Lewis  <jlewis3@apple.com>
551
552         Unreviewed, rolling out r219128.
553
554         Spoke with engineer who originally submitted, Patch for APi
555         test to follow.
556
557         Reverted changeset:
558
559         "Unreviewed, rolling out r219070."
560         https://bugs.webkit.org/show_bug.cgi?id=174082
561         http://trac.webkit.org/changeset/219128
562
563 2017-07-05  Matt Lewis  <jlewis3@apple.com>
564
565         Unreviewed, rolling out r219070.
566
567         This revision caused consistent failures of the API test
568         UIPasteboardTests.DoNotPastePlainTextAsURL on iOS.
569
570         Reverted changeset:
571
572         "Pasting single words copied to UIPasteboard inserts URLs in
573         editable areas"
574         https://bugs.webkit.org/show_bug.cgi?id=174082
575         http://trac.webkit.org/changeset/219070
576
577 2017-07-05  Zan Dobersek  <zdobersek@igalia.com>
578
579         [GLib] Incorrect <glib/gi18n.h> include in WebKitWebsiteData
580         https://bugs.webkit.org/show_bug.cgi?id=174093
581
582         Reviewed by Michael Catanzaro.
583
584         * UIProcess/API/glib/WebKitWebsiteData.cpp: Include <glib/gi18n-lib.h>
585         rather than <glib/gi18n.h>, since the former has to be included in a
586         library while the latter should only be included in a standalone application.
587
588 2017-07-04  Joseph Pecoraro  <pecoraro@apple.com>
589
590         Cleanup some StringBuilder use
591         https://bugs.webkit.org/show_bug.cgi?id=174118
592
593         Reviewed by Andreas Kling.
594
595         * NetworkProcess/capture/NetworkCaptureManager.cpp:
596         (WebKit::NetworkCapture::Manager::hashToPath):
597         * UIProcess/WebPageProxy.cpp:
598
599 2017-07-03  Wenson Hsieh  <wenson_hsieh@apple.com>
600
601         [iOS DnD] [WK2] Callout bar should reappear after dragging ends for a text selection
602         https://bugs.webkit.org/show_bug.cgi?id=174116
603         <rdar://problem/33017845>
604
605         Reviewed by Ryosuke Niwa.
606
607         -willStartScrollingOverflow -didEndScrollingOverflow are helper methods on both the UIWKTextInteractionAssistant
608         and UIWebSelectionAssistant that handle hiding selection and callout bar UI during overflow scrolling and making
609         it reappear after scrolling ends. However, these hooks do not contain logic specific to scrolling, and simply
610         tell the inner UIWebSelectionView to either show or hide and are safe to invoke outside of the context of
611         scrolling.
612
613         This patch invokes these hooks when beginning a drag on a selection, and when a dragging ends, if it called
614         -willStartScrollingOverflow to begin with. We should rename these in the future to be something along the lines
615         of -hideSelectionViewAndControls and -showSelectionViewAndControls, respectively, and adopt these new names in
616         WebKit. We also move logic to hide the callout out of -itemsForBeginningSession: and into
617         -willAnimateLiftWithAnimator:, when the lift actually begins.
618
619         * UIProcess/ios/WKContentViewInteraction.h:
620         * UIProcess/ios/WKContentViewInteraction.mm:
621         (-[WKContentView cleanUpDragSourceSessionState]):
622         (-[WKContentView _restoreCalloutBarIfNeeded]):
623         (-[WKContentView dragInteraction:itemsForBeginningSession:]):
624         (-[WKContentView dragInteraction:willAnimateLiftWithAnimator:session:]):
625         (-[WKContentView dragInteraction:session:didEndWithOperation:]):
626
627 2017-07-03  Matt Rajca  <mrajca@apple.com>
628
629         Add/remove appropriate media element behavior restrictions when updateWebsitePolicies is called
630         https://bugs.webkit.org/show_bug.cgi?id=174103
631
632         Reviewed by Alex Christensen.
633
634         Currently, when -[WKWebView evaluateJavaScript:completionHandler:] is invoked, we end up simulating
635         a user gesture unconditionally. This is not desireable for some tests, so I added a private variant
636         of this method that takes a boolean that is ultimately passed to `executeScript` for the
637         `forceUserGesture` parameter (instead of unconditionally passing `true`).
638
639         * UIProcess/API/C/WKPage.cpp:
640         (WKPageRunJavaScriptInMainFrame):
641         * UIProcess/API/Cocoa/WKWebView.mm:
642         (-[WKWebView evaluateJavaScript:completionHandler:]):
643         (-[WKWebView _evaluateJavaScript:forceUserGesture:completionHandler:]):
644         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
645         * UIProcess/WebPageProxy.cpp:
646         (WebKit::WebPageProxy::runJavaScriptInMainFrame):
647         * UIProcess/WebPageProxy.h:
648         * WebProcess/WebPage/WebPage.cpp:
649         (WebKit::WebPage::runJavaScriptInMainFrame):
650         (WebKit::WebPage::updateWebsitePolicies): Update behavior restrictions on any existing media elements.
651         * WebProcess/WebPage/WebPage.h:
652         * WebProcess/WebPage/WebPage.messages.in:
653
654 2017-07-03  Matt Lewis  <jlewis3@apple.com>
655
656         Unreviewed, rolling out r219103.
657
658         Caused multiple build failures.
659
660         Reverted changeset:
661
662         "Remove copy of ICU headers from WebKit"
663         https://bugs.webkit.org/show_bug.cgi?id=116407
664         http://trac.webkit.org/changeset/219103
665
666 2017-07-03  Myles C. Maxfield  <mmaxfield@apple.com>
667
668         Remove copy of ICU headers from WebKit
669         https://bugs.webkit.org/show_bug.cgi?id=116407
670
671         Reviewed by Alex Christensen.
672
673         Use WTF's copy of ICU headers.
674
675         * Configurations/BaseTarget.xcconfig:
676
677 2017-07-03  Brady Eidson  <beidson@apple.com>
678
679         Switch all WebKit API related to favicons from WebIconDatabase over to new WebCore::IconLoader mechanism.
680         https://bugs.webkit.org/show_bug.cgi?id=174073
681
682         Reviewed by Andy Estes.
683
684         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
685         (WebKit::WebFrameLoaderClient::getLoadDecisionForIcons):
686         (WebKit::WebFrameLoaderClient::dispatchDidReceiveIcon): Deleted.
687         (WebKit::WebFrameLoaderClient::registerForIconNotification): Deleted.
688         (WebKit::WebFrameLoaderClient::getLoadDecisionForIcon): Deleted.
689         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
690
691 2017-07-03  Sam Weinig  <sam@webkit.org>
692
693         [WebIDL] Remove more unnecessary uses of the preprocessor in idl files
694         https://bugs.webkit.org/show_bug.cgi?id=174083
695
696         Reviewed by Alex Christensen.
697
698         * Configurations/FeatureDefines.xcconfig:
699         Add ENABLE_NAVIGATOR_STANDALONE.
700
701 2017-07-03  Matt Lewis  <jlewis3@apple.com>
702
703         Unreviewed, rolling out r219083.
704
705         The revision caused an API failure on all testing platforms.
706
707         Reverted changeset:
708
709         "[MediaStream] Protect request and web view during gUM client
710         callback"
711         https://bugs.webkit.org/show_bug.cgi?id=174096
712         http://trac.webkit.org/changeset/219083
713
714 2017-07-03  Ryosuke Niwa  <rniwa@webkit.org>
715
716         WebContent processes crash when the network process crashes with pending connection requests
717         https://bugs.webkit.org/show_bug.cgi?id=174065
718         <rdar://problem/30359835>
719
720         Reviewed by Tim Horton.
721
722         The bug was caused by the UI process clearing away pending network connection requests whenever the existing
723         network process crashed. This resulted in WebContent process killing itself inside ensureNetworkProcessConnection.
724
725         Fixed the bug by re-launching a new network process when this happens. We don't try to re-launch a new process
726         if the previous attempt to launch a network process had failed.
727
728         This patch splits NetworkProcessProxy::networkProcessCrashedOrFailedToLaunch into networkProcessFailedToLaunch
729         and networkProcessCrashed to differentiate those two cases, and invoke the respective callbacks in WebProcessPool.
730
731         * UIProcess/API/Cocoa/WKProcessPool.mm:
732         (-[WKProcessPool _networkProcessIdentifier]): Added.
733         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
734         * UIProcess/Network/NetworkProcessProxy.cpp:
735         (WebKit::NetworkProcessProxy::networkProcessCrashed): Added.
736         (WebKit::NetworkProcessProxy::networkProcessCrashedOrFailedToLaunch): Split into the two following functions.
737         (WebKit::NetworkProcessProxy::networkProcessFailedToLaunch): Extracted from networkProcessCrashedOrFailedToLaunch.
738         (WebKit::NetworkProcessProxy::clearCallbackStates): Extracted from networkProcessCrashedOrFailedToLaunch
739         (WebKit::NetworkProcessProxy::didClose): Call networkProcessCrashed.
740         (WebKit::NetworkProcessProxy::didFinishLaunching): Call networkProcessFailedToLaunch.
741         * UIProcess/Network/NetworkProcessProxy.h:
742         * UIProcess/WebProcessPool.cpp:
743         (WebKit::WebProcessPool::networkProcessCrashed): Start a new network process when there are pending connection
744         requests the crached network failed to fullfil.
745         (WebKit::WebProcessPool::networkProcessFailedToLaunch):
746         * UIProcess/WebProcessPool.h:
747
748 2017-07-03  Eric Carlson  <eric.carlson@apple.com>
749
750         [MediaStream] Protect request and web view during gUM client callback
751         https://bugs.webkit.org/show_bug.cgi?id=174096
752         <rdar://problem/32833102>
753
754         Reviewed by Youenn Fablet.
755
756         Retain the message and WebView during asynchronous calls so they won't be 
757         released if a navigation happens during a call to the UA for getUserMedia 
758         or enumerateMediaDevices.
759
760         * UIProcess/Cocoa/UIDelegate.mm:
761         (WebKit::requestUserMediaAuthorizationForDevices):
762         (WebKit::UIDelegate::UIClient::decidePolicyForUserMediaPermissionRequest):
763         (WebKit::UIDelegate::UIClient::checkUserMediaPermissionForOrigin):
764
765 2017-07-03  Andy Estes  <aestes@apple.com>
766
767         [Xcode] Add an experimental setting to build with ccache
768         https://bugs.webkit.org/show_bug.cgi?id=173875
769
770         Reviewed by Tim Horton.
771
772         * Configurations/DebugRelease.xcconfig: Included ccache.xcconfig.
773
774 2017-07-03  Chris Dumez  <cdumez@apple.com>
775
776         Drop ResourceLoadStatisticsStore's statisticsLock
777         https://bugs.webkit.org/show_bug.cgi?id=174080
778
779         Reviewed by Brent Fulgham.
780
781         Drop ResourceLoadStatisticsStore's statisticsLock. It added complexity and was only needed
782         do that the SPI exposed to WebKitTestRunner would query the store synchronously from the
783         main thread. Instead, I made the SPI asynchronous and make sure we always access the store
784         from the same background thread. As a result, there is no longer any need for locking.
785
786         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
787         (-[WKWebsiteDataStore _resourceLoadStatisticsIsPrevalentResource:completionHandler:]):
788         (-[WKWebsiteDataStore _resourceLoadStatisticsHadUserInteraction:completionHandler:]):
789         (-[WKWebsiteDataStore _resourceLoadStatisticsIsGrandfathered:completionHandler:]):
790         * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
791         * UIProcess/Storage/ResourceLoadStatisticsStore.cpp:
792         (WebKit::ResourceLoadStatisticsStore::isPrevalentResource):
793         (WebKit::ResourceLoadStatisticsStore::isGrandFathered):
794         (WebKit::ResourceLoadStatisticsStore::ensureResourceStatisticsForPrimaryDomain):
795         (WebKit::ResourceLoadStatisticsStore::createEncoderFromData):
796         (WebKit::ResourceLoadStatisticsStore::readDataFromDecoder):
797         (WebKit::ResourceLoadStatisticsStore::clearInMemory):
798         (WebKit::ResourceLoadStatisticsStore::mergeStatistics):
799         (WebKit::ResourceLoadStatisticsStore::fireShouldPartitionCookiesHandler):
800         (WebKit::ResourceLoadStatisticsStore::processStatistics):
801         (WebKit::ResourceLoadStatisticsStore::topPrivatelyControlledDomainsToRemoveWebsiteDataFor):
802         (WebKit::ResourceLoadStatisticsStore::sortedPrevalentResourceTelemetry):
803         (WebKit::ResourceLoadStatisticsStore::updateStatisticsForRemovedDataRecords):
804         (WebKit::ResourceLoadStatisticsStore::handleFreshStartWithEmptyOrNoStore):
805         * UIProcess/Storage/ResourceLoadStatisticsStore.h:
806         * UIProcess/WebResourceLoadStatisticsStore.cpp:
807         (WebKit::WebResourceLoadStatisticsStore::processStatisticsAndDataRecords):
808         (WebKit::WebResourceLoadStatisticsStore::readDataFromDiskIfNeeded):
809         (WebKit::WebResourceLoadStatisticsStore::refreshFromDisk):
810         (WebKit::WebResourceLoadStatisticsStore::clearInMemoryData):
811         (WebKit::WebResourceLoadStatisticsStore::submitTelemetry):
812         (WebKit::WebResourceLoadStatisticsStore::logUserInteraction):
813         (WebKit::WebResourceLoadStatisticsStore::clearUserInteraction):
814         (WebKit::WebResourceLoadStatisticsStore::hasHadUserInteraction):
815         (WebKit::WebResourceLoadStatisticsStore::setPrevalentResource):
816         (WebKit::WebResourceLoadStatisticsStore::isPrevalentResource):
817         (WebKit::WebResourceLoadStatisticsStore::clearPrevalentResource):
818         (WebKit::WebResourceLoadStatisticsStore::setGrandfathered):
819         (WebKit::WebResourceLoadStatisticsStore::isGrandfathered):
820         (WebKit::WebResourceLoadStatisticsStore::setSubframeUnderTopFrameOrigin):
821         (WebKit::WebResourceLoadStatisticsStore::setSubresourceUnderTopFrameOrigin):
822         (WebKit::WebResourceLoadStatisticsStore::setSubresourceUniqueRedirectTo):
823         * UIProcess/WebResourceLoadStatisticsStore.h:
824
825 2017-07-03  Wenson Hsieh  <wenson_hsieh@apple.com>
826
827         Pasting single words copied to UIPasteboard inserts URLs in editable areas
828         https://bugs.webkit.org/show_bug.cgi?id=174082
829         <rdar://problem/33046992>
830
831         Reviewed by Tim Horton.
832
833         Add a hook to WKPreferences to allow programatic pasting.
834
835         * UIProcess/API/Cocoa/WKPreferences.mm:
836         (-[WKPreferences _setDOMPasteAllowed:]):
837         (-[WKPreferences _domPasteAllowed]):
838         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
839
840 2017-07-03  Zan Dobersek  <zdobersek@igalia.com>
841
842         Unreviewed GTK+ and WPE build fix when building with GCC 4.9.
843
844         * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp:
845         (WebKit::CoordinatedLayerTreeHost::renderNextFrame): Don't use brace-list
846         initialization to override the m_forceRepaintAsync struct. Instead, manually
847         assign the OptionalCallbackID() value to the m_forceRepaintAsync.callbackID
848         member variable, and override the m_forceRepaintAsync.needsFreshFlush member
849         variable with `false`.
850
851 2017-07-03  Zan Dobersek  <zdobersek@igalia.com>
852
853         [ThreadedCompositor] Update and retrieve scene attributes under a Lock
854         https://bugs.webkit.org/show_bug.cgi?id=173762
855
856         Reviewed by Carlos Garcia Campos.
857
858         Instead of dispatching separate tasks on the composition run loop, update
859         various scene attributes by locking a common lock object and updating the
860         appropriate attribute.
861
862         In ThreadedCompositor::renderLayerTree(), where these attributes are used
863         in scene composition, the lock is again obtained and the attributes copied
864         into local variables, releasing the lock afterwards. The attribute values
865         in local copies are then used for that renderLayerTree() invocation.
866
867         This approach is more efficient than dispatching separate tasks that can
868         race against renderLayerTree() dispatches.
869
870         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
871         (WebKit::ThreadedCompositor::ThreadedCompositor):
872         (WebKit::m_displayRefreshMonitor):
873         (WebKit::ThreadedCompositor::setScaleFactor):
874         (WebKit::ThreadedCompositor::setScrollPosition):
875         (WebKit::ThreadedCompositor::setViewportSize):
876         (WebKit::ThreadedCompositor::setDrawsBackground):
877         (WebKit::ThreadedCompositor::renderLayerTree):
878         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h:
879
880 2017-07-01  Dan Bernstein  <mitz@apple.com>
881
882         [iOS] Remove code only needed when building for iOS 9.x
883         https://bugs.webkit.org/show_bug.cgi?id=174068
884
885         Reviewed by Tim Horton.
886
887         * Configurations/FeatureDefines.xcconfig:
888         * Configurations/WebKit.xcconfig:
889         * Platform/spi/ios/UIKitSPI.h:
890         * UIProcess/API/Cocoa/WKWebView.mm:
891         (-[WKWebView dealloc]):
892         * UIProcess/ios/WKContentViewInteraction.mm:
893         (-[WKFormInputSession setSuggestions:]):
894         (-[WKFormInputSession invalidate]):
895         (-[WKContentView insertTextSuggestion:]):
896         (contentTypeFromFieldName):
897         (-[WKContentView textInputTraits]):
898         (-[WKContentView _dataForPreviewItemController:atPosition:type:]):
899         * WebProcess/WebPage/ios/WebPageIOS.mm:
900         (WebKit::WebPage::getPositionInformation):
901         * config.h:
902
903 2017-07-01  Brady Eidson  <beidson@apple.com>
904
905         When setting a custom cookie storage location on a WKWebsiteDataStore, cookies aren't actually removed.
906         <rdar://problem/32410662> and https://bugs.webkit.org/show_bug.cgi?id=174035
907
908         Reviewed by Alex Christensen.
909
910         * UIProcess/API/Cocoa/WKProcessPool.mm:
911         (-[WKProcessPool _terminateNetworkProcess]):
912         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
913         
914         * UIProcess/WebProcessPool.cpp:
915         (WebKit::WebProcessPool::ensureNetworkProcess): Take an optional WebsiteDataStore. If one is passed in,
916           send it to either the existing or new network process.
917         * UIProcess/WebProcessPool.h:
918         
919         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
920         (WebKit::WebsiteDataStore::parameters): Resolve paths first.
921
922         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
923         (WebKit::WebsiteDataStore::fetchDataAndApply):
924         (WebKit::WebsiteDataStore::removeData):
925
926 2017-07-01  Ryosuke Niwa  <rniwa@webkit.org>
927
928         Frame.h doesn't need to include FrameLoader.h, IntRect.h, and NavigationScheduler.h
929         https://bugs.webkit.org/show_bug.cgi?id=174004
930
931         Reviewed by Simon Fraser.
932
933         * WebProcess/Plugins/WebPluginInfoProvider.cpp:
934         * WebProcess/WebPage/WebInspector.cpp:
935
936 2017-07-01  Dan Bernstein  <mitz@apple.com>
937
938         [macOS] Remove code only needed when building for OS X Yosemite
939         https://bugs.webkit.org/show_bug.cgi?id=174067
940
941         Reviewed by Tim Horton.
942
943         * Configurations/Base.xcconfig:
944         * Configurations/BaseTarget.xcconfig:
945         * Configurations/BaseXPCService.xcconfig:
946         * Configurations/DebugRelease.xcconfig:
947         * Configurations/FeatureDefines.xcconfig:
948         * Configurations/NetworkService.xcconfig:
949         * Configurations/PluginService.32.xcconfig:
950         * Configurations/PluginService.64.xcconfig:
951         * Configurations/Version.xcconfig:
952         * Configurations/WebContentService.xcconfig:
953         * Configurations/WebKit.xcconfig:
954         * DatabaseProcess/mac/com.apple.WebKit.Databases.sb.in:
955         * NetworkProcess/EntryPoint/mac/XPCService/NetworkService/Info-OSX-10.9-10.10.plist: Removed.
956         * NetworkProcess/NetworkProcessCreationParameters.cpp:
957         (WebKit::NetworkProcessCreationParameters::encode):
958         (WebKit::NetworkProcessCreationParameters::decode):
959         * NetworkProcess/NetworkProcessCreationParameters.h:
960         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
961         (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa):
962         * NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in:
963         * Platform/IPC/Connection.h:
964         * Platform/IPC/mac/ConnectionMac.mm:
965         (IPC::Connection::platformInvalidate):
966         (IPC::Connection::platformInitialize):
967         (IPC::Connection::open):
968         (IPC::Connection::exceptionSourceEventHandler): Deleted.
969         (IPC::Connection::setShouldCloseConnectionOnMachExceptions): Deleted.
970         * Platform/mac/LayerHostingContext.h:
971         * Platform/mac/LayerHostingContext.mm:
972         (WebKit::LayerHostingContext::createFencePort):
973         * PluginProcess/EntryPoint/mac/XPCService/PluginService.32-64-10.9-10.10.Info.plist: Removed.
974         * PluginProcess/mac/PluginControllerProxyMac.mm:
975         (WebKit::PluginControllerProxy::updateLayerHostingContext):
976         * PluginProcess/mac/PluginProcessShim.mm:
977         * PluginProcess/mac/com.apple.WebKit.plugin-common.sb.in:
978         * Shared/ChildProcess.h:
979         * Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm:
980         (WebKit::getPluginInfoFromPropertyLists):
981         (WebKit::NetscapePluginModule::getPluginInfo):
982         (WebKit::contentsOfPropertyListAtURL): Deleted.
983         (WebKit::getMIMETypesFromPluginBundle): Deleted.
984         * Shared/Plugins/PluginProcessCreationParameters.cpp:
985         (WebKit::PluginProcessCreationParameters::encode):
986         (WebKit::PluginProcessCreationParameters::decode):
987         * Shared/Plugins/PluginProcessCreationParameters.h:
988         * Shared/WebProcessCreationParameters.cpp:
989         (WebKit::WebProcessCreationParameters::encode):
990         (WebKit::WebProcessCreationParameters::decode):
991         * Shared/WebProcessCreationParameters.h:
992         * Shared/mac/ChildProcessMac.mm:
993         (WebKit::ChildProcess::setSharedHTTPCookieStorage):
994         * UIProcess/API/C/WKPage.cpp:
995         (WKPageSetPageUIClient):
996         (fixUpBotchedPageUIClient): Deleted.
997         * UIProcess/ChildProcessProxy.cpp:
998         (WebKit::ChildProcessProxy::didFinishLaunching):
999         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
1000         (WebKit::WebProcessPool::platformInitializeWebProcess):
1001         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
1002         (WebKit::WebProcessPool::resetHSTSHostsAddedAfterDate):
1003         * UIProcess/Cocoa/WebViewImpl.h:
1004         * UIProcess/Cocoa/WebViewImpl.mm:
1005         (WebKit::WebViewImpl::updateLayer):
1006         (WebKit::WebViewImpl::startWindowDrag):
1007         * UIProcess/DrawingAreaProxy.h:
1008         (WebKit::DrawingAreaProxy::waitForPossibleGeometryUpdate): Deleted.
1009         * UIProcess/Plugins/PluginProcessProxy.cpp:
1010         (WebKit::PluginProcessProxy::didFinishLaunching):
1011         * UIProcess/Plugins/PluginProcessProxy.h:
1012         * UIProcess/Plugins/mac/PluginProcessProxyMac.mm:
1013         (WebKit::PluginProcessProxy::platformInitializePluginProcess):
1014         (WebKit::PluginProcessProxy::createPropertyListFile): Deleted.
1015         * UIProcess/WebPageProxy.cpp:
1016         (WebKit::WebPageProxy::setTopContentInset):
1017         * UIProcess/mac/PageClientImpl.mm:
1018         (WebKit::PageClientImpl::rootViewToWindow):
1019         (WebKit::PageClientImpl::startWindowDrag):
1020         * UIProcess/mac/RemoteWebInspectorProxyMac.mm:
1021         (WebKit::RemoteWebInspectorProxy::platformStartWindowDrag):
1022         * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.h:
1023         * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm:
1024         (WebKit::TiledCoreAnimationDrawingAreaProxy::createFence):
1025         (WebKit::TiledCoreAnimationDrawingAreaProxy::waitForPossibleGeometryUpdate): Deleted.
1026         * UIProcess/mac/WebInspectorProxyMac.mm:
1027         (WebKit::WebInspectorProxy::createFrontendWindow):
1028         (WebKit::WebInspectorProxy::platformStartWindowDrag):
1029         * UIProcess/mac/WebPopupMenuProxyMac.mm:
1030         (WebKit::WebPopupMenuProxyMac::showPopupMenu):
1031         * WebKit2.xcodeproj/project.pbxproj:
1032         * WebProcess/EntryPoint/mac/XPCService/WebContentService/Info-OSX-10.9-10.10.plist: Removed.
1033         * WebProcess/WebPage/WebPage.cpp:
1034         * WebProcess/WebPage/WebPage.h:
1035         * WebProcess/WebPage/WebPage.messages.in:
1036         * WebProcess/WebPage/mac/PlatformCAAnimationRemote.mm:
1037         (WebKit::addAnimationToLayer):
1038         * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm:
1039         (WebKit::RemoteLayerTreeDrawingArea::flushLayers):
1040         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
1041         (WebKit::TiledCoreAnimationDrawingArea::flushLayers):
1042         (WebKit::TiledCoreAnimationDrawingArea::updateGeometry):
1043         * WebProcess/cocoa/WebProcessCocoa.mm:
1044         (WebKit::WebProcess::platformInitializeWebProcess):
1045         * WebProcess/com.apple.WebProcess.sb.in:
1046
1047 2017-07-01  Chris Dumez  <cdumez@apple.com>
1048
1049         Replace ResourceLoadStatisticsStore C API with Cocoa SPI
1050         https://bugs.webkit.org/show_bug.cgi?id=174060
1051
1052         Reviewed by Brent Fulgham.
1053
1054         Replace ResourceLoadStatisticsStore C API by Cocoa SPI. The new Cocoa SPI is on
1055         WKWebsiteDataStore, which allows us to get rid of the WebResourceLoadStatisticsManager
1056         singleton as the SPI can now interact directly with the WebResourceLoadStatisticsStore.
1057
1058         * UIProcess/API/C/WKResourceLoadStatisticsManager.cpp: Removed.
1059         * UIProcess/API/C/WKResourceLoadStatisticsManager.h: Removed.
1060         Drop old C API.
1061
1062         * UIProcess/WebResourceLoadStatisticsManager.cpp: Removed.
1063         * UIProcess/WebResourceLoadStatisticsManager.h: Removed.
1064         Drop WebResourceLoadStatisticsManager singleton which was only required by the
1065         C API. This is because the C API was global, rather than working on a specific
1066         store.
1067
1068         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
1069         * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
1070         Add new Cocoa SPI on WKWebsiteDataStore. This is only used for testing.
1071
1072         * UIProcess/WebResourceLoadStatisticsStore.cpp:
1073         (WebKit::WebResourceLoadStatisticsStore::registerSharedResourceLoadObserver):
1074         Stop registering the store with the WebResourceLoadStatisticsManager singleton,
1075         as this singleton is gone.
1076
1077         * UIProcess/WebsiteData/WebsiteDataStore.h:
1078         (WebKit::WebsiteDataStore::resourceLoadStatistics):
1079         Add new getter to retrieve the WebResourceLoadStatisticsStore from the
1080         WebsiteDataStore. This is needed by the new Cocoa SPI.
1081
1082         * WebKit2.xcodeproj/project.pbxproj:
1083         Drop some files.
1084
1085 2017-06-30  Megan Gardner  <megan_gardner@apple.com>
1086
1087         Unreviewed mac build fix.
1088
1089         * UIProcess/API/Cocoa/_WKActivatedElementInfo.mm:
1090         * UIProcess/API/Cocoa/_WKActivatedElementInfoInternal.h:
1091
1092 2017-06-30  Megan Gardner  <megan_gardner@apple.com>
1093
1094         Add API to get WKActivatedElementInfo
1095         https://bugs.webkit.org/show_bug.cgi?id=174001
1096         <rdar://problem/29165518>
1097         
1098         Adding a way to get a WKActivatedElementInfo for a point on a WKWebView.
1099
1100         Reviewed by Tim Horton.
1101
1102         * UIProcess/API/Cocoa/WKWebView.mm:
1103         (-[WKWebView requestActivatedElementAtPosition:completionBlock:]):
1104         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1105         * UIProcess/API/Cocoa/_WKActivatedElementInfo.mm:
1106         (+[_WKActivatedElementInfo infoWithType:withInteractionInformationAtPosition:]):
1107         (-[_WKActivatedElementInfo infoWithType:withInteractionInformationAtPosition:]):
1108         * UIProcess/API/Cocoa/_WKActivatedElementInfoInternal.h:
1109
1110 2017-06-30  Tim Horton  <timothy_horton@apple.com>
1111
1112         Use API instead of SPI for content inset adjustment behavior
1113         https://bugs.webkit.org/show_bug.cgi?id=174050
1114
1115         Reviewed by Sam Weinig.
1116
1117         * Platform/spi/ios/UIKitSPI.h:
1118         * UIProcess/ios/WKScrollView.mm:
1119         (-[WKScrollView initWithFrame:]):
1120         (-[WKScrollView setContentInsetAdjustmentBehavior:]):
1121         (-[WKScrollView _setContentInsetAdjustmentBehaviorInternal:]):
1122         (-[WKScrollView _setContentInsetAdjustmentBehavior:]): Deleted.
1123         Switch over to the API. The old SPI calls the API internally, so our
1124         override will now cover all callers.
1125
1126 2017-06-30  Chris Dumez  <cdumez@apple.com>
1127
1128         Move store logic from WebResourceLoadStatisticsManager to WebResourceLoadStatisticsStore
1129         https://bugs.webkit.org/show_bug.cgi?id=174038
1130
1131         Reviewed by Brent Fulgham.
1132
1133         Move store logic from WebResourceLoadStatisticsManager to WebResourceLoadStatisticsStore.
1134         WebResourceLoadStatisticsManager is now essentially a proxy to the
1135         WebResourceLoadStatisticsStore to support the current C API.
1136
1137         In a follow-up, I plan to to replace the C API with a Cocoa SPI which works on a
1138         WebResourceLoadStatisticsStore directly instead of requiring a
1139         WebResourceLoadStatisticsManager singleton.
1140
1141         * UIProcess/API/C/WKResourceLoadStatisticsManager.cpp:
1142         (WKResourceLoadStatisticsManagerSetMinimumTimeBetweenDataRecordsRemoval):
1143         (WKResourceLoadStatisticsManagerResetToConsistentState):
1144         * UIProcess/API/C/WKResourceLoadStatisticsManager.h:
1145         * UIProcess/Cocoa/WebResourceLoadStatisticsManagerCocoa.mm: Removed.
1146         * UIProcess/Cocoa/WebResourceLoadStatisticsStoreCocoa.mm:
1147         (WebKit::WebResourceLoadStatisticsStore::registerUserDefaultsIfNeeded):
1148         * UIProcess/WebResourceLoadStatisticsManager.cpp:
1149         (WebKit::WebResourceLoadStatisticsManager::WebResourceLoadStatisticsManager):
1150         (WebKit::WebResourceLoadStatisticsManager::~WebResourceLoadStatisticsManager):
1151         (WebKit::WebResourceLoadStatisticsManager::setStatisticsStore):
1152         (WebKit::WebResourceLoadStatisticsManager::clearInMemoryStore):
1153         (WebKit::WebResourceLoadStatisticsManager::clearInMemoryAndPersistentStore):
1154         (WebKit::WebResourceLoadStatisticsManager::logUserInteraction):
1155         (WebKit::WebResourceLoadStatisticsManager::clearUserInteraction):
1156         (WebKit::WebResourceLoadStatisticsManager::hasHadUserInteraction):
1157         (WebKit::WebResourceLoadStatisticsManager::setPrevalentResource):
1158         (WebKit::WebResourceLoadStatisticsManager::isPrevalentResource):
1159         (WebKit::WebResourceLoadStatisticsManager::clearPrevalentResource):
1160         (WebKit::WebResourceLoadStatisticsManager::setGrandfathered):
1161         (WebKit::WebResourceLoadStatisticsManager::isGrandfathered):
1162         (WebKit::WebResourceLoadStatisticsManager::setSubframeUnderTopFrameOrigin):
1163         (WebKit::WebResourceLoadStatisticsManager::setSubresourceUnderTopFrameOrigin):
1164         (WebKit::WebResourceLoadStatisticsManager::setSubresourceUniqueRedirectTo):
1165         (WebKit::WebResourceLoadStatisticsManager::setTimeToLiveUserInteraction):
1166         (WebKit::WebResourceLoadStatisticsManager::setTimeToLiveCookiePartitionFree):
1167         (WebKit::WebResourceLoadStatisticsManager::setMinimumTimeBetweenDataRecordsRemoval):
1168         (WebKit::WebResourceLoadStatisticsManager::setGrandfatheringTime):
1169         (WebKit::WebResourceLoadStatisticsManager::fireDataModificationHandler):
1170         (WebKit::WebResourceLoadStatisticsManager::fireShouldPartitionCookiesHandler):
1171         (WebKit::WebResourceLoadStatisticsManager::fireTelemetryHandler):
1172         * UIProcess/WebResourceLoadStatisticsManager.h:
1173         * UIProcess/WebResourceLoadStatisticsStore.cpp:
1174         (WebKit::primaryDomain):
1175         (WebKit::WebResourceLoadStatisticsStore::registerSharedResourceLoadObserver):
1176         (WebKit::WebResourceLoadStatisticsStore::logUserInteraction):
1177         (WebKit::WebResourceLoadStatisticsStore::clearUserInteraction):
1178         (WebKit::WebResourceLoadStatisticsStore::hasHadUserInteraction):
1179         (WebKit::WebResourceLoadStatisticsStore::setPrevalentResource):
1180         (WebKit::WebResourceLoadStatisticsStore::isPrevalentResource):
1181         (WebKit::WebResourceLoadStatisticsStore::clearPrevalentResource):
1182         (WebKit::WebResourceLoadStatisticsStore::setGrandfathered):
1183         (WebKit::WebResourceLoadStatisticsStore::isGrandfathered):
1184         (WebKit::WebResourceLoadStatisticsStore::setSubframeUnderTopFrameOrigin):
1185         (WebKit::WebResourceLoadStatisticsStore::setSubresourceUnderTopFrameOrigin):
1186         (WebKit::WebResourceLoadStatisticsStore::setSubresourceUniqueRedirectTo):
1187         (WebKit::WebResourceLoadStatisticsStore::fireDataModificationHandler):
1188         (WebKit::WebResourceLoadStatisticsStore::fireShouldPartitionCookiesHandler):
1189         (WebKit::WebResourceLoadStatisticsStore::fireTelemetryHandler):
1190         (WebKit::WebResourceLoadStatisticsStore::clearInMemory):
1191         (WebKit::WebResourceLoadStatisticsStore::clearInMemoryAndPersistent):
1192         (WebKit::WebResourceLoadStatisticsStore::setTimeToLiveUserInteraction):
1193         (WebKit::WebResourceLoadStatisticsStore::setTimeToLiveCookiePartitionFree):
1194         (WebKit::WebResourceLoadStatisticsStore::setMinimumTimeBetweenDataRecordsRemoval):
1195         (WebKit::WebResourceLoadStatisticsStore::setGrandfatheringTime):
1196         * UIProcess/WebResourceLoadStatisticsStore.h:
1197         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
1198         (WebKit::WebsiteDataStore::removeData):
1199         * WebKit2.xcodeproj/project.pbxproj:
1200
1201 2017-06-30  John Wilander  <wilander@apple.com>
1202
1203         [WK2] Resource load statistics code is spamming the WebProcess with a test-only message 
1204         https://bugs.webkit.org/show_bug.cgi?id=174048
1205         <rdar://problem/33062376>
1206
1207         Reviewed by Brent Fulgham.
1208
1209         Fix the telemetry data message send so that it is not generated during normal operations.
1210         This is only meant to be used by WebKitTestRunner.
1211
1212         * UIProcess/WebResourceLoadStatisticsTelemetry.cpp:
1213         (WebKit::WebResourceLoadStatisticsTelemetry::calculateAndSubmit): 
1214
1215 2017-06-30  Daniel Bates  <dabates@apple.com>
1216
1217         Attempt to fix the WPE build following <https://trac.webkit.org/changeset/219013>
1218         (https://bugs.webkit.org/show_bug.cgi?id=165160)
1219
1220         Update the prototype of UIClient::createNewPage() to take a API::FrameInfo& instead of
1221         a WebFrameProxy* and a const WebCore::SecurityOriginData&.
1222
1223         * UIProcess/API/glib/WebKitUIClient.cpp:
1224
1225 2017-06-30  Alex Christensen  <achristensen@webkit.org>
1226
1227         Stop soft linking with CFNetwork
1228         https://bugs.webkit.org/show_bug.cgi?id=174029
1229
1230         Reviewed by Jer Noble.
1231
1232         * Shared/mac/CookieStorageShim.mm:
1233
1234 2017-06-30  Daniel Bates  <dabates@apple.com>
1235
1236         API::FrameInfo should know the web page that contains the frame; add API property webView to WKFrameInfo
1237         https://bugs.webkit.org/show_bug.cgi?id=165160
1238         <rdar://problem/29451999>
1239
1240         Reviewed by Brady Eidson.
1241
1242         Expose a property on WKFrameInfo to retrieve the WKWebView of the web page that contains the
1243         frame. This will allow an embedding client to know the web view that initiated the navigation
1244         request as well as differentiate between a navigation initiated by web content from one
1245         initiated via API.
1246
1247         The majority of this change is passing the document D that initiated the targeted navigation
1248         or called window.open() through the loading machinery to the FrameLoaderClient. The changes
1249         to pass this information to the FrameLoaderClient when creating a new window are straightforward.
1250         For targeted navigation, the WebKit2 FrameLoaderClient implementation now computes the info
1251         for the originating frame regardless of the navigation type (NavigationAction::type()).
1252         (Currently we only compute the originating frame for hyperlink activated navigations,
1253         form submissions, and form resubmissions). The WebProcess computes the page ID of the page
1254         that contains the originating frame and sends that to the UIProcess so that it can create
1255         an API::FrameInfo for the originating frame and associate the page that contains the frame,
1256         if the navigation was triggered by web content. If the navigation was triggered by API
1257         (e.g. -[WKWebView goBack]) then the created API::FrameInfo does not have an associated page
1258         so that an embedding client can distinguish between a navigation initiated by web content
1259         from a navigation that it initiated via API depending on whether API::FrameInfo::page() is
1260         nullptr. We expose property webView on the Mac and iOS API class WKFrameInfo to return the
1261         WKWebView corresponding to API::FrameInfo::page().
1262
1263         A small change that this patch makes is to have the WebProcess compute the originating frame
1264         info (call WebFrame::info()) and send it over to the UIProcess as opposed to sending the frame
1265         ID of the originating frame and having the UIProcess compute the frame info from it. We do this
1266         because the UIProcess may not be able to compute the frame info for the originating frame if
1267         the window that it was contained in was closed between the time the WebProcess sent the frame
1268         ID to the UIProcess and the UIProcess received it.
1269
1270         * UIProcess/API/APIFrameInfo.cpp:
1271         (API::FrameInfo::create):
1272         (API::FrameInfo::FrameInfo):
1273         (API::FrameInfo::clearPage):
1274         * UIProcess/API/APIFrameInfo.h:
1275         * UIProcess/API/APIUIClient.h:
1276         (API::UIClient::createNewPage):
1277         (API::UIClient::createNewPageAsync):
1278         * UIProcess/API/C/WKPage.cpp:
1279         (WKPageSetPageUIClient):
1280         * UIProcess/API/Cocoa/WKFrameInfo.h:
1281         * UIProcess/API/Cocoa/WKFrameInfo.mm:
1282         (-[WKFrameInfo description]):
1283         (-[WKFrameInfo webView]):
1284         * UIProcess/API/Cocoa/WKUserContentController.mm:
1285         * UIProcess/Cocoa/UIDelegate.h:
1286         * UIProcess/Cocoa/UIDelegate.mm:
1287         (WebKit::UIDelegate::UIClient::createNewPageCommon):
1288         (WebKit::UIDelegate::UIClient::createNewPage):
1289         (WebKit::UIDelegate::UIClient::createNewPageAsync):
1290         * UIProcess/WebPageProxy.cpp:
1291         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
1292         (WebKit::WebPageProxy::createNewPage):
1293         * UIProcess/WebPageProxy.h:
1294         * UIProcess/WebPageProxy.messages.in:
1295         * WebProcess/Plugins/PluginView.cpp:
1296         (WebKit::PluginView::loadURL):
1297         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
1298         (WebKit::WebChromeClient::createWindow):
1299         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1300         (WebKit::WebFrameLoaderClient::dispatchCreatePage):
1301         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
1302         * WebProcess/WebPage/WebInspector.cpp:
1303         (WebKit::WebInspector::openInNewTab):
1304
1305 2017-06-29  Jer Noble  <jer.noble@apple.com>
1306
1307         Make Legacy EME API controlled by RuntimeEnabled setting.
1308         https://bugs.webkit.org/show_bug.cgi?id=173994
1309
1310         Reviewed by Sam Weinig.
1311
1312         Add a new WKWebViewConfiguration property, as well as a new WKPreferences function, both able to control
1313         WebCore's new RuntimeEnabledFeature setting for the Legacy EME API.
1314
1315         * Configurations/FeatureDefines.xcconfig:
1316         * Shared/WebPreferencesDefinitions.h:
1317         * UIProcess/API/C/WKPreferences.cpp:
1318         (WKPreferencesGetLegacyEncryptedMediaAPIEnabled):
1319         (WKPreferencesSetLegacyEncryptedMediaAPIEnabled):
1320         * UIProcess/API/C/WKPreferencesRef.h:
1321         * UIProcess/API/Cocoa/WKWebView.mm:
1322         (-[WKWebView _initializeWithConfiguration:]):
1323         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
1324         (-[WKWebViewConfiguration init]):
1325         (-[WKWebViewConfiguration copyWithZone:]):
1326         (-[WKWebViewConfiguration _setLegacyEncryptedMediaAPIEnabled:]):
1327         (-[WKWebViewConfiguration _legacyEncryptedMediaAPIEnabled]):
1328         * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
1329         * WebProcess/WebPage/WebPage.cpp:
1330         (WebKit::WebPage::updatePreferences):
1331
1332 2017-06-30  Jer Noble  <jer.noble@apple.com>
1333
1334         REGRESSION (r218757): Touch Bar's media scrubber timeline runs from 00:00 to 00:00 and has no playhead
1335         https://bugs.webkit.org/show_bug.cgi?id=174032
1336
1337         Reviewed by Eric Carlson.
1338
1339         Fix a copypasta error where durationChange notifications were changing the value of muted.
1340
1341         * UIProcess/Cocoa/WebPlaybackSessionManagerProxy.mm:
1342         (WebKit::WebPlaybackSessionManagerProxy::durationChanged):
1343
1344 2017-06-30  Chris Dumez  <cdumez@apple.com>
1345
1346         Move ResourceLoadStatisticsStore to WebKit2/UIProcess
1347         https://bugs.webkit.org/show_bug.cgi?id=174033
1348
1349         Reviewed by Brent Fulgham.
1350
1351         Move ResourceLoadStatisticsStore to WebKit2/UIProcess since it is only
1352         used in the WebKit2 UIProcess.
1353
1354         * CMakeLists.txt:
1355         * UIProcess/Storage/ResourceLoadStatisticsStore.cpp: Renamed from Source/WebCore/loader/ResourceLoadStatisticsStore.cpp.
1356         (WebKit::ResourceLoadStatisticsStore::createEncoderFromData):
1357         (WebKit::ResourceLoadStatisticsStore::readDataFromDecoder):
1358         (WebKit::ResourceLoadStatisticsStore::clearInMemory):
1359         (WebKit::ResourceLoadStatisticsStore::clearInMemoryAndPersistent):
1360         (WebKit::ResourceLoadStatisticsStore::mergeStatistics):
1361         (WebKit::ResourceLoadStatisticsStore::fireDataModificationHandler):
1362         (WebKit::ResourceLoadStatisticsStore::fireTelemetryHandler):
1363         (WebKit::ResourceLoadStatisticsStore::fireShouldPartitionCookiesHandler):
1364         (WebKit::ResourceLoadStatisticsStore::processStatistics):
1365         (WebKit::ResourceLoadStatisticsStore::sortedPrevalentResourceTelemetry):
1366         (WebKit::ResourceLoadStatisticsStore::shouldRemoveDataRecords):
1367         (WebKit::ResourceLoadStatisticsStore::dataRecordsBeingRemoved):
1368         (WebKit::ResourceLoadStatisticsStore::dataRecordsWereRemoved):
1369         (WebKit::ResourceLoadStatisticsStore::statisticsLock):
1370         * UIProcess/Storage/ResourceLoadStatisticsStore.h: Renamed from Source/WebCore/loader/ResourceLoadStatisticsStore.h.
1371         * UIProcess/WebResourceLoadStatisticsManager.cpp:
1372         (WebKit::primaryDomain):
1373         * UIProcess/WebResourceLoadStatisticsManager.h:
1374         * UIProcess/WebResourceLoadStatisticsStore.h:
1375         * UIProcess/WebResourceLoadStatisticsTelemetry.cpp:
1376         * UIProcess/WebResourceLoadStatisticsTelemetry.h:
1377         * WebKit2.xcodeproj/project.pbxproj:
1378
1379 2017-06-30  Ryosuke Niwa  <rniwa@webkit.org>
1380
1381         Ran sort-Xcode-project-file.
1382
1383         * WebKit2.xcodeproj/project.pbxproj:
1384
1385 2017-06-30  Chris Dumez  <cdumez@apple.com>
1386
1387         ResourceLoadObserver does not need a ResourceLoadStatisticsStore
1388         https://bugs.webkit.org/show_bug.cgi?id=174013
1389
1390         Reviewed by Brent Fulgham.
1391
1392         ResourceLoadObserver does not need a ResourceLoadStatisticsStore. ResourceLoadStatisticsStore is too complicated for its needs.
1393         ResourceLoadStatisticsStore can then be moved to WebKit2/UIProcess in a follow-up.
1394
1395         * WebProcess/WebProcess.cpp:
1396         (WebKit::m_webSQLiteDatabaseTracker):
1397         (WebKit::WebProcess::statisticsChangedTimerFired):
1398         * WebProcess/WebProcess.h:
1399
1400 2017-06-30  Brent Fulgham  <bfulgham@apple.com>
1401
1402         [WK2][iOS][macOS] Update XPC services process launch dictionary
1403         https://bugs.webkit.org/show_bug.cgi?id=173995
1404         <rdar://problem/32797264>
1405
1406         Reviewed by Alex Christensen.
1407
1408         Update the WebProcess and Plugin Process XPC launch dictionaries to activate
1409         improved ALSR features when launching.
1410
1411         * PluginProcess/EntryPoint/mac/XPCService/PluginService.32-64.Info.plist:
1412         * WebProcess/EntryPoint/mac/XPCService/WebContentService/Info-OSX.plist:
1413         * WebProcess/EntryPoint/mac/XPCService/WebContentService/Info-iOS.plist:
1414
1415 2017-06-30  Chris Dumez  <cdumez@apple.com>
1416
1417         Merge WebResourceLoadStatisticsManager and WebResourceLoadObserver
1418         https://bugs.webkit.org/show_bug.cgi?id=174008
1419
1420         Reviewed by Brent Fulgham.
1421
1422         Merge WebResourceLoadStatisticsManager and WebResourceLoadObserver. One was basically
1423         a proxy to the other.
1424
1425         * UIProcess/API/C/WKResourceLoadStatisticsManager.cpp:
1426         (WKResourceLoadStatisticsManagerSetPrevalentResource):
1427         (WKResourceLoadStatisticsManagerIsPrevalentResource):
1428         (WKResourceLoadStatisticsManagerSetHasHadUserInteraction):
1429         (WKResourceLoadStatisticsManagerIsHasHadUserInteraction):
1430         (WKResourceLoadStatisticsManagerSetGrandfathered):
1431         (WKResourceLoadStatisticsManagerIsGrandfathered):
1432         (WKResourceLoadStatisticsManagerSetSubframeUnderTopFrameOrigin):
1433         (WKResourceLoadStatisticsManagerSetSubresourceUnderTopFrameOrigin):
1434         (WKResourceLoadStatisticsManagerSetSubresourceUniqueRedirectTo):
1435         (WKResourceLoadStatisticsManagerSetTimeToLiveUserInteraction):
1436         (WKResourceLoadStatisticsManagerSetTimeToLiveCookiePartitionFree):
1437         (WKResourceLoadStatisticsManagerSetMinimumTimeBetweeenDataRecordsRemoval):
1438         (WKResourceLoadStatisticsManagerSetGrandfatheringTime):
1439         (WKResourceLoadStatisticsManagerFireDataModificationHandler):
1440         (WKResourceLoadStatisticsManagerFireShouldPartitionCookiesHandler):
1441         (WKResourceLoadStatisticsManagerFireShouldPartitionCookiesHandlerForOneDomain):
1442         (WKResourceLoadStatisticsManagerFireTelemetryHandler):
1443         (WKResourceLoadStatisticsManagerSetNotifyPagesWhenDataRecordsWereScanned):
1444         (WKResourceLoadStatisticsManagerSetShouldClassifyResourcesBeforeDataRecordsRemoval):
1445         (WKResourceLoadStatisticsManagerSetNotifyPagesWhenTelemetryWasCaptured):
1446         (WKResourceLoadStatisticsManagerSetShouldSubmitTelemetry):
1447         (WKResourceLoadStatisticsManagerClearInMemoryAndPersistentStore):
1448         (WKResourceLoadStatisticsManagerClearInMemoryAndPersistentStoreModifiedSinceHours):
1449         (WKResourceLoadStatisticsManagerResetToConsistentState):
1450         * UIProcess/API/C/WKResourceLoadStatisticsManager.h:
1451         * UIProcess/Cocoa/WebResourceLoadStatisticsManagerCocoa.mm:
1452         (WebKit::WebResourceLoadStatisticsManager::registerUserDefaultsIfNeeded):
1453         * UIProcess/WebResourceLoadObserver.cpp: Removed.
1454         * UIProcess/WebResourceLoadObserver.h: Removed.
1455         * UIProcess/WebResourceLoadStatisticsManager.cpp:
1456         (WebKit::primaryDomain):
1457         (WebKit::WebResourceLoadStatisticsManager::shared):
1458         (WebKit::WebResourceLoadStatisticsManager::setStatisticsStore):
1459         (WebKit::WebResourceLoadStatisticsManager::setStatisticsQueue):
1460         (WebKit::WebResourceLoadStatisticsManager::clearInMemoryStore):
1461         (WebKit::WebResourceLoadStatisticsManager::clearInMemoryAndPersistentStore):
1462         (WebKit::WebResourceLoadStatisticsManager::logUserInteraction):
1463         (WebKit::WebResourceLoadStatisticsManager::clearUserInteraction):
1464         (WebKit::WebResourceLoadStatisticsManager::hasHadUserInteraction):
1465         (WebKit::WebResourceLoadStatisticsManager::setPrevalentResource):
1466         (WebKit::WebResourceLoadStatisticsManager::isPrevalentResource):
1467         (WebKit::WebResourceLoadStatisticsManager::clearPrevalentResource):
1468         (WebKit::WebResourceLoadStatisticsManager::setGrandfathered):
1469         (WebKit::WebResourceLoadStatisticsManager::isGrandfathered):
1470         (WebKit::WebResourceLoadStatisticsManager::setSubframeUnderTopFrameOrigin):
1471         (WebKit::WebResourceLoadStatisticsManager::setSubresourceUnderTopFrameOrigin):
1472         (WebKit::WebResourceLoadStatisticsManager::setSubresourceUniqueRedirectTo):
1473         (WebKit::WebResourceLoadStatisticsManager::setTimeToLiveUserInteraction):
1474         (WebKit::WebResourceLoadStatisticsManager::setTimeToLiveCookiePartitionFree):
1475         (WebKit::WebResourceLoadStatisticsManager::setMinimumTimeBetweeenDataRecordsRemoval):
1476         (WebKit::WebResourceLoadStatisticsManager::setGrandfatheringTime):
1477         (WebKit::WebResourceLoadStatisticsManager::fireDataModificationHandler):
1478         (WebKit::WebResourceLoadStatisticsManager::fireShouldPartitionCookiesHandler):
1479         (WebKit::WebResourceLoadStatisticsManager::fireTelemetryHandler):
1480         * UIProcess/WebResourceLoadStatisticsManager.h:
1481         * UIProcess/WebResourceLoadStatisticsStore.cpp:
1482         (WebKit::WebResourceLoadStatisticsStore::registerSharedResourceLoadObserver):
1483         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
1484         (WebKit::WebsiteDataStore::removeData):
1485         * WebKit2.xcodeproj/project.pbxproj:
1486
1487 2017-06-30  Wenson Hsieh  <wenson_hsieh@apple.com>
1488
1489         [iOS DnD] Drag caret rect is incorrectly computed when dropping in editable content in iframes
1490         https://bugs.webkit.org/show_bug.cgi?id=174017
1491         <rdar://problem/32959782>
1492
1493         Reviewed by Simon Fraser.
1494
1495         Send the drag caret rect in root view coordinates over to the UI process.
1496
1497         * UIProcess/API/Cocoa/WKWebView.mm:
1498         (-[WKWebView _dragCaretRect]):
1499         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1500
1501         Add basic test plumbing to fetch the current drag caret rect.
1502
1503         * WebProcess/WebPage/WebPage.cpp:
1504         (WebKit::WebPage::performDragControllerAction):
1505
1506 2017-06-30  Youenn Fablet  <youenn@apple.com>
1507
1508         Support PeerConnectionStates::BundlePolicy::MaxBundle when setting rtc configuration
1509         https://bugs.webkit.org/show_bug.cgi?id=169389
1510
1511         Reviewed by Alex Christensen.
1512
1513         * fast/mediastream/RTCPeerConnection-getConfiguration-expected.txt:
1514
1515 2017-06-29  Ryosuke Niwa  <rniwa@webkit.org>
1516
1517         Assert that callback ID is not 0 or -1 during encoding and decoding
1518         https://bugs.webkit.org/show_bug.cgi?id=173803
1519
1520         Reviewed by Brady Eidson.
1521
1522         To diagnosing the hang inside Safari (<rdar://problem/32841256>), add assertions for the callback ID
1523         to be not 0 or -1 during encoding and decoding of IPC messages since the latest analysis seems to
1524         indicate the hang is caused by the hash map getting corrupted by the insertion of 0 (empty value).
1525
1526         Wrapped the uint64_t in CallbackID and OptionalCallbackID to add assertions.
1527
1528         * NetworkProcess/soup/NetworkProcessSoup.cpp:
1529         (WebKit::NetworkProcess::platformInitializeNetworkProcess):
1530         * Shared/CallbackID.h: Added.
1531         (WebKit::CallbackID::CallbackID):
1532         (WebKit::CallbackID::operator==):
1533         (WebKit::CallbackID::toInteger):
1534         (WebKit::CallbackID::isValid):
1535         (WebKit::CallbackID::isValidCallbackID): A callback ID is valid when it's neither 0 nor -1.
1536         (WebKit::CallbackID::fromInteger): Create a CallbackID object from potentially unsafe value.
1537         (WebKit::CallbackID::generateID): Generates the next callback ID. Moved from CallbackBase.
1538         (WebKit::CallbackID::encode): Added. Assert that it's neither 0 nor -1.
1539         (WebKit::CallbackID::decode): Ditto.
1540         (WTF::CallbackIDHash::hash):
1541         (WTF::CallbackIDHash::equal):
1542         (WTF::HashTraits<WebKit::CallbackID>::emptyValue):
1543         (WTF::HashTraits<WebKit::CallbackID>::constructDeletedValue):
1544         (WTF::HashTraits<WebKit::CallbackID>::isDeletedValue):
1545         * Shared/OptionalCallbackID.h: Added. Unlike CallbackID, callback ID here can be 0.
1546         (WebKit::OptionalCallbackID::OptionalCallbackID):
1547         (WebKit::OptionalCallbackID::toInteger):
1548         (WebKit::OptionalCallbackID::callbackID): Returns a valid CallbackID object. The caller of
1549         this function must have verified that the ID is neither 0 or -1 before calling this function.
1550         (WebKit::OptionalCallbackID::operator bool):
1551         (WebKit::OptionalCallbackID::isValid):
1552         (WebKit::OptionalCallbackID::isValidCallbackID):
1553         (WebKit::OptionalCallbackID::encode): Since OptionalCallbackID can be 0, only assert that it's not -1.
1554         (WebKit::OptionalCallbackID::decode): Ditto.
1555         * Shared/mac/RemoteLayerTreeTransaction.h:
1556         * Shared/mac/RemoteLayerTreeTransaction.h:
1557         * UIProcess/GenericCallback.h:
1558         (WebKit::CallbackBase::callbackID): Returns a CallbackID object instead of uint64_t.
1559         (WebKit::CallbackBase::CallbackBase):
1560         (WebKit::CallbackBase::generateCallbackID): Deleted.
1561         (WebKit::CallbackMap::put): Returns a callback ID. Also added a version that doesn't take activity token
1562         as used in WebCookieManagerProxy
1563         (WebKit::CallbackMap::take): Takes a callback ID.
1564         * UIProcess/WebCookieManagerProxy.cpp: Updated the code as callback maps are merged.
1565         (WebKit::WebCookieManagerProxy::processPoolDestroyed):
1566         (WebKit::WebCookieManagerProxy::processDidClose):
1567         (WebKit::WebCookieManagerProxy::getHostnamesWithCookies):
1568         (WebKit::WebCookieManagerProxy::didGetHostnamesWithCookies):
1569         (WebKit::WebCookieManagerProxy::deleteCookie):
1570         (WebKit::WebCookieManagerProxy::deleteAllCookiesModifiedSince):
1571         (WebKit::WebCookieManagerProxy::setCookie):
1572         (WebKit::WebCookieManagerProxy::setCookies):
1573         (WebKit::WebCookieManagerProxy::getAllCookies):
1574         (WebKit::WebCookieManagerProxy::getCookies):
1575         (WebKit::WebCookieManagerProxy::didSetCookies):
1576         (WebKit::WebCookieManagerProxy::didGetCookies):
1577         (WebKit::WebCookieManagerProxy::didDeleteCookies):
1578         (WebKit::WebCookieManagerProxy::setHTTPCookieAcceptPolicy):
1579         (WebKit::WebCookieManagerProxy::getHTTPCookieAcceptPolicy):
1580         (WebKit::WebCookieManagerProxy::didGetHTTPCookieAcceptPolicy):
1581         (WebKit::WebCookieManagerProxy::didSetHTTPCookieAcceptPolicy):
1582         * UIProcess/WebCookieManagerProxy.h:
1583         * UIProcess/WebCookieManagerProxy.messages.in:
1584         * UIProcess/WebPageProxy.cpp:
1585         (WebKit::WebPageProxy::setInitialFocus):
1586         (WebKit::WebPageProxy::validateCommand):
1587         (WebKit::WebPageProxy::runJavaScriptInMainFrame):
1588         (WebKit::WebPageProxy::getRenderTreeExternalRepresentation):
1589         (WebKit::WebPageProxy::getSourceForFrame):
1590         (WebKit::WebPageProxy::getContentsAsString):
1591         (WebKit::WebPageProxy::getBytecodeProfile):
1592         (WebKit::WebPageProxy::getSamplingProfilerOutput):
1593         (WebKit::WebPageProxy::getContentsAsMHTMLData):
1594         (WebKit::WebPageProxy::getSelectionOrContentsAsString):
1595         (WebKit::WebPageProxy::getSelectionAsWebArchiveData):
1596         (WebKit::WebPageProxy::getMainResourceDataOfFrame):
1597         (WebKit::WebPageProxy::getResourceDataFromFrame):
1598         (WebKit::WebPageProxy::getWebArchiveOfFrame):
1599         (WebKit::WebPageProxy::forceRepaint):
1600         (WebKit::WebPageProxy::clearLoadDependentCallbacks):
1601         (WebKit::WebPageProxy::voidCallback):
1602         (WebKit::WebPageProxy::dataCallback):
1603         (WebKit::WebPageProxy::imageCallback):
1604         (WebKit::WebPageProxy::stringCallback):
1605         (WebKit::WebPageProxy::invalidateStringCallback):
1606         (WebKit::WebPageProxy::scriptValueCallback):
1607         (WebKit::WebPageProxy::computedPagesCallback):
1608         (WebKit::WebPageProxy::validateCommandCallback):
1609         (WebKit::WebPageProxy::unsignedCallback):
1610         (WebKit::WebPageProxy::editingRangeCallback):
1611         (WebKit::WebPageProxy::machSendRightCallback):
1612         (WebKit::WebPageProxy::rectForCharacterRangeCallback):
1613         (WebKit::WebPageProxy::printFinishedCallback):
1614         (WebKit::WebPageProxy::computePagesForPrinting):
1615         (WebKit::WebPageProxy::drawRectToImage):
1616         (WebKit::WebPageProxy::drawPagesToPDF):
1617         (WebKit::WebPageProxy::drawPagesForPrinting):
1618         (WebKit::WebPageProxy::getMarkedRangeAsync):
1619         (WebKit::WebPageProxy::getSelectedRangeAsync):
1620         (WebKit::WebPageProxy::characterIndexForPointAsync):
1621         (WebKit::WebPageProxy::firstRectForCharacterRangeAsync):
1622         (WebKit::WebPageProxy::takeSnapshot):
1623         (WebKit::WebPageProxy::installActivityStateChangeCompletionHandler):
1624         (WebKit::WebPageProxy::getLoadDecisionForIcon):
1625         (WebKit::WebPageProxy::finishedLoadingIcon):
1626         * UIProcess/WebPageProxy.h:
1627         * UIProcess/WebPageProxy.messages.in:
1628         * UIProcess/ios/WebPageProxyIOS.mm:
1629         (WebKit::WebPageProxy::gestureCallback):
1630         (WebKit::WebPageProxy::touchesCallback):
1631         (WebKit::WebPageProxy::autocorrectionDataCallback):
1632         (WebKit::WebPageProxy::selectionContextCallback):
1633         (WebKit::WebPageProxy::autocorrectionContextCallback):
1634         (WebKit::WebPageProxy::selectionRectsCallback):
1635         (WebKit::WebPageProxy::selectWithGesture):
1636         (WebKit::WebPageProxy::updateSelectionWithTouches):
1637         (WebKit::WebPageProxy::requestAutocorrectionData):
1638         (WebKit::WebPageProxy::applyAutocorrection):
1639         (WebKit::WebPageProxy::executeEditCommand):
1640         (WebKit::WebPageProxy::selectTextWithGranularityAtPoint):
1641         (WebKit::WebPageProxy::selectPositionAtBoundaryWithDirection):
1642         (WebKit::WebPageProxy::moveSelectionAtBoundaryWithDirection):
1643         (WebKit::WebPageProxy::selectPositionAtPoint):
1644         (WebKit::WebPageProxy::beginSelectionInDirection):
1645         (WebKit::WebPageProxy::updateSelectionWithExtentPoint):
1646         (WebKit::WebPageProxy::updateSelectionWithExtentPointAndBoundary):
1647         (WebKit::WebPageProxy::requestDictationContext):
1648         (WebKit::WebPageProxy::requestAutocorrectionContext):
1649         (WebKit::WebPageProxy::getSelectionContext):
1650         (WebKit::WebPageProxy::selectWithTwoTouches):
1651         (WebKit::WebPageProxy::requestRectsForGranularityWithSelectionOffset):
1652         (WebKit::WebPageProxy::requestRectsAtSelectionOffsetWithText):
1653         (WebKit::WebPageProxy::moveSelectionByOffset):
1654         (WebKit::WebPageProxy::focusNextAssistedNode):
1655         (WebKit::WebPageProxy::computePagesForPrintingAndDrawToPDF):
1656         (WebKit::WebPageProxy::drawToPDFCallback):
1657         * UIProcess/mac/WKPrintingView.mm:
1658         (-[WKPrintingView _preparePDFDataForPrintingOnSecondaryThread]):
1659         (-[WKPrintingView _askPageToComputePageRects]):
1660         (-[WKPrintingView _drawPreview:]):
1661         * UIProcess/mac/WebPageProxyMac.mm:
1662         (WebKit::WebPageProxy::attributedSubstringForCharacterRangeAsync):
1663         (WebKit::WebPageProxy::attributedStringForCharacterRangeCallback):
1664         (WebKit::WebPageProxy::fontAtSelection):
1665         (WebKit::WebPageProxy::fontAtSelectionCallback):
1666         * WebKit2.xcodeproj/project.pbxproj:
1667         * WebProcess/Cookies/WebCookieManager.cpp:
1668         (WebKit::WebCookieManager::getHostnamesWithCookies):
1669         (WebKit::WebCookieManager::deleteCookie):
1670         (WebKit::WebCookieManager::deleteAllCookiesModifiedSince):
1671         (WebKit::WebCookieManager::getAllCookies):
1672         (WebKit::WebCookieManager::getCookies):
1673         (WebKit::WebCookieManager::setCookie):
1674         (WebKit::WebCookieManager::setCookies):
1675         (WebKit::WebCookieManager::setHTTPCookieAcceptPolicy):
1676         (WebKit::WebCookieManager::getHTTPCookieAcceptPolicy):
1677         * WebProcess/Cookies/WebCookieManager.h:
1678         * WebProcess/Cookies/WebCookieManager.messages.in:
1679         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1680         (WebKit::WebFrameLoaderClient::getLoadDecisionForIcon):
1681         (WebKit::WebFrameLoaderClient::finishedLoadingIcon):
1682         * WebProcess/WebPage/AcceleratedDrawingArea.cpp:
1683         (WebKit::AcceleratedDrawingArea::forceRepaintAsync):
1684         (WebKit::AcceleratedDrawingArea::activityStateDidChange):
1685         * WebProcess/WebPage/AcceleratedDrawingArea.h:
1686         * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp:
1687         (WebKit::CoordinatedLayerTreeHost::forceRepaintAsync):
1688         (WebKit::CoordinatedLayerTreeHost::renderNextFrame):
1689         * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h:
1690         * WebProcess/WebPage/DrawingArea.h:
1691         (WebKit::DrawingArea::forceRepaintAsync):
1692         (WebKit::DrawingArea::activityStateDidChange):
1693         (WebKit::DrawingArea::addTransactionCallbackID):
1694         * WebProcess/WebPage/DrawingArea.messages.in:
1695         * WebProcess/WebPage/LayerTreeHost.h:
1696         (WebKit::LayerTreeHost::forceRepaintAsync):
1697         * WebProcess/WebPage/WebPage.cpp:
1698         (WebKit::WebPage::reinitializeWebPage):
1699         (WebKit::WebPage::takeSnapshot):
1700         (WebKit::WebPage::validateCommand):
1701         (WebKit::WebPage::setInitialFocus):
1702         (WebKit::WebPage::setActivityState):
1703         (WebKit::WebPage::runJavaScriptInMainFrame):
1704         (WebKit::WebPage::getContentsAsString):
1705         (WebKit::WebPage::getContentsAsMHTMLData):
1706         (WebKit::WebPage::getRenderTreeExternalRepresentation):
1707         (WebKit::WebPage::getSelectionAsWebArchiveData):
1708         (WebKit::WebPage::getSelectionOrContentsAsString):
1709         (WebKit::WebPage::getSourceForFrame):
1710         (WebKit::WebPage::getMainResourceDataOfFrame):
1711         (WebKit::WebPage::getResourceDataFromFrame):
1712         (WebKit::WebPage::getWebArchiveOfFrame):
1713         (WebKit::WebPage::forceRepaint):
1714         (WebKit::WebPage::computePagesForPrinting):
1715         (WebKit::WebPage::drawRectToImage):
1716         (WebKit::WebPage::drawPagesToPDF):
1717         (WebKit::WebPage::drawPagesForPrinting):
1718         (WebKit::WebPage::didFinishPrintOperation):
1719         (WebKit::WebPage::getMarkedRangeAsync):
1720         (WebKit::WebPage::getSelectedRangeAsync):
1721         (WebKit::WebPage::characterIndexForPointAsync):
1722         (WebKit::WebPage::firstRectForCharacterRangeAsync):
1723         (WebKit::WebPage::getBytecodeProfile):
1724         (WebKit::WebPage::getSamplingProfilerOutput):
1725         (WebKit::WebPage::didGetLoadDecisionForIcon):
1726         * WebProcess/WebPage/WebPage.h:
1727         * WebProcess/WebPage/WebPage.messages.in:
1728         * WebProcess/WebPage/gtk/WebPrintOperationGtk.cpp:
1729         (WebKit::WebPrintOperationGtk::WebPrintOperationGtk):
1730         * WebProcess/WebPage/gtk/WebPrintOperationGtk.h:
1731         * WebProcess/WebPage/ios/WebPageIOS.mm:
1732         (WebKit::WebPage::getSelectionContext):
1733         (WebKit::WebPage::selectWithGesture):
1734         (WebKit::WebPage::updateSelectionWithTouches):
1735         (WebKit::WebPage::selectWithTwoTouches):
1736         (WebKit::WebPage::moveSelectionByOffset):
1737         (WebKit::WebPage::getRectsForGranularityWithSelectionOffset):
1738         (WebKit::WebPage::getRectsAtSelectionOffsetWithText):
1739         (WebKit::WebPage::selectPositionAtPoint):
1740         (WebKit::WebPage::selectPositionAtBoundaryWithDirection):
1741         (WebKit::WebPage::moveSelectionAtBoundaryWithDirection):
1742         (WebKit::WebPage::selectTextWithGranularityAtPoint):
1743         (WebKit::WebPage::beginSelectionInDirection):
1744         (WebKit::WebPage::updateSelectionWithExtentPointAndBoundary):
1745         (WebKit::WebPage::updateSelectionWithExtentPoint):
1746         (WebKit::WebPage::requestDictationContext):
1747         (WebKit::WebPage::requestAutocorrectionData):
1748         (WebKit::WebPage::applyAutocorrection):
1749         (WebKit::WebPage::executeEditCommandWithCallback):
1750         (WebKit::WebPage::requestAutocorrectionContext):
1751         (WebKit::WebPage::focusNextAssistedNode):
1752         (WebKit::WebPage::computePagesForPrintingAndDrawToPDF):
1753         * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.h:
1754         * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm:
1755         (WebKit::RemoteLayerTreeDrawingArea::activityStateDidChange):
1756         (WebKit::RemoteLayerTreeDrawingArea::addTransactionCallbackID):
1757         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
1758         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
1759         (WebKit::TiledCoreAnimationDrawingArea::forceRepaintAsync):
1760         (WebKit::TiledCoreAnimationDrawingArea::activityStateDidChange):
1761         (WebKit::TiledCoreAnimationDrawingArea::didUpdateActivityStateTimerFired):
1762         * WebProcess/WebPage/mac/WebPageMac.mm:
1763         (WebKit::WebPage::attributedSubstringForCharacterRangeAsync):
1764         (WebKit::WebPage::fontAtSelection):
1765
1766 2017-06-29  Andy Estes  <aestes@apple.com>
1767
1768         [iOS] Don't confuse coordinate spaces when computing the size of PDF snapshots
1769         https://bugs.webkit.org/show_bug.cgi?id=173996
1770         <rdar://problem/32961028>
1771
1772         Reviewed by Tim Horton.
1773
1774         When computing the printing rect for PDF snapshots, we were getting the width the
1775         WKContentView's bounds and the height from the WKScrollView's contentSize. These sizes are
1776         in different coordinate spaces, leading to incorrect clipping on sites that have a non-1
1777         scale factor.
1778
1779         Fix this by using the WKContentView's bounds for both width and height.
1780
1781         * UIProcess/ios/WKContentView.mm:
1782         (-[WKContentView _wk_pageCountForPrintFormatter:]):
1783
1784 2017-06-29  Matt Lewis  <jlewis3@apple.com>
1785
1786         Unreviewed, rolling out r218903.
1787
1788         This patch and its fix cause immediate flakiness on all WK2
1789         testers
1790
1791         Reverted changeset:
1792
1793         "Support PeerConnectionStates::BundlePolicy::MaxBundle when
1794         setting rtc configuration"
1795         https://bugs.webkit.org/show_bug.cgi?id=169389
1796         http://trac.webkit.org/changeset/218903
1797
1798 2017-06-29  Chris Dumez  <cdumez@apple.com>
1799
1800         Split ResourceLoadObserver into 2 classes: one for WebCore and one for the UIProcess
1801         https://bugs.webkit.org/show_bug.cgi?id=173990
1802
1803         Reviewed by Brent Fulgham.
1804
1805         Split ResourceLoadObserver into 2 classes: one for WebCore and one for the UIProcess.
1806         They really have different API and there is therefore close to no code duplication.
1807
1808         * CMakeLists.txt:
1809         * UIProcess/Cocoa/WebResourceLoadStatisticsManagerCocoa.mm:
1810         (WebKit::WebResourceLoadStatisticsManager::registerUserDefaultsIfNeeded):
1811         * UIProcess/WebResourceLoadObserver.cpp: Added.
1812         (WebKit::primaryDomain):
1813         (WebKit::WebResourceLoadObserver::sharedObserver):
1814         (WebKit::WebResourceLoadObserver::setStatisticsStore):
1815         (WebKit::WebResourceLoadObserver::setStatisticsQueue):
1816         (WebKit::WebResourceLoadObserver::clearInMemoryStore):
1817         (WebKit::WebResourceLoadObserver::clearInMemoryAndPersistentStore):
1818         (WebKit::WebResourceLoadObserver::logUserInteraction):
1819         (WebKit::WebResourceLoadObserver::clearUserInteraction):
1820         (WebKit::WebResourceLoadObserver::hasHadUserInteraction):
1821         (WebKit::WebResourceLoadObserver::setPrevalentResource):
1822         (WebKit::WebResourceLoadObserver::isPrevalentResource):
1823         (WebKit::WebResourceLoadObserver::clearPrevalentResource):
1824         (WebKit::WebResourceLoadObserver::setGrandfathered):
1825         (WebKit::WebResourceLoadObserver::isGrandfathered):
1826         (WebKit::WebResourceLoadObserver::setSubframeUnderTopFrameOrigin):
1827         (WebKit::WebResourceLoadObserver::setSubresourceUnderTopFrameOrigin):
1828         (WebKit::WebResourceLoadObserver::setSubresourceUniqueRedirectTo):
1829         (WebKit::WebResourceLoadObserver::setTimeToLiveUserInteraction):
1830         (WebKit::WebResourceLoadObserver::setTimeToLiveCookiePartitionFree):
1831         (WebKit::WebResourceLoadObserver::setMinimumTimeBetweeenDataRecordsRemoval):
1832         (WebKit::WebResourceLoadObserver::setGrandfatheringTime):
1833         (WebKit::WebResourceLoadObserver::fireDataModificationHandler):
1834         (WebKit::WebResourceLoadObserver::fireShouldPartitionCookiesHandler):
1835         (WebKit::WebResourceLoadObserver::fireTelemetryHandler):
1836         * UIProcess/WebResourceLoadObserver.h: Added.
1837         * UIProcess/WebResourceLoadStatisticsManager.cpp:
1838         (WebKit::WebResourceLoadStatisticsManager::setPrevalentResource):
1839         (WebKit::WebResourceLoadStatisticsManager::isPrevalentResource):
1840         (WebKit::WebResourceLoadStatisticsManager::setHasHadUserInteraction):
1841         (WebKit::WebResourceLoadStatisticsManager::hasHadUserInteraction):
1842         (WebKit::WebResourceLoadStatisticsManager::setGrandfathered):
1843         (WebKit::WebResourceLoadStatisticsManager::isGrandfathered):
1844         (WebKit::WebResourceLoadStatisticsManager::setSubframeUnderTopFrameOrigin):
1845         (WebKit::WebResourceLoadStatisticsManager::setSubresourceUnderTopFrameOrigin):
1846         (WebKit::WebResourceLoadStatisticsManager::setSubresourceUniqueRedirectTo):
1847         (WebKit::WebResourceLoadStatisticsManager::setTimeToLiveUserInteraction):
1848         (WebKit::WebResourceLoadStatisticsManager::setTimeToLiveCookiePartitionFree):
1849         (WebKit::WebResourceLoadStatisticsManager::setMinimumTimeBetweeenDataRecordsRemoval):
1850         (WebKit::WebResourceLoadStatisticsManager::setGrandfatheringTime):
1851         (WebKit::WebResourceLoadStatisticsManager::fireDataModificationHandler):
1852         (WebKit::WebResourceLoadStatisticsManager::fireShouldPartitionCookiesHandler):
1853         (WebKit::WebResourceLoadStatisticsManager::fireShouldPartitionCookiesHandlerForOneDomain):
1854         (WebKit::WebResourceLoadStatisticsManager::fireTelemetryHandler):
1855         (WebKit::WebResourceLoadStatisticsManager::clearInMemoryAndPersistentStore):
1856         (WebKit::WebResourceLoadStatisticsManager::clearInMemoryAndPersistentStoreModifiedSinceHours):
1857         (WebKit::WebResourceLoadStatisticsManager::resetToConsistentState):
1858         * UIProcess/WebResourceLoadStatisticsStore.cpp:
1859         (WebKit::WebResourceLoadStatisticsStore::registerSharedResourceLoadObserver):
1860         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
1861         (WebKit::WebsiteDataStore::removeData):
1862         * WebKit2.xcodeproj/project.pbxproj:
1863
1864 2017-06-29  Sam Weinig  <sam@webkit.org>
1865
1866         [WebIDL] Remove custom binding for UserMessageHandlersNamespace
1867         https://bugs.webkit.org/show_bug.cgi?id=173956
1868
1869         Reviewed by Darin Adler.
1870
1871         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDOMWindow.cpp:
1872         (webkit_dom_dom_window_webkit_message_handlers_post_message):
1873         Update for name change.
1874
1875 2017-06-29  John Wilander  <wilander@apple.com>
1876
1877         Fix for intermittent Layout Test fail http/tests/loading/resourceLoadStatistics/telemetry-generation.html
1878         https://bugs.webkit.org/show_bug.cgi?id=173940
1879         <rdar://problem/33018125>
1880
1881         Reviewed by Brent Fulgham.
1882
1883         This change allows the TestController to turn off
1884         regular resource load statistics telemetry submission
1885         and to manually control when telemetry is calculated
1886         and submitted.
1887
1888         * UIProcess/API/C/WKResourceLoadStatisticsManager.cpp:
1889         (WKResourceLoadStatisticsManagerSetShouldSubmitTelemetry):
1890             New test infrastructure.
1891         * UIProcess/API/C/WKResourceLoadStatisticsManager.h:
1892         * UIProcess/WebResourceLoadStatisticsManager.cpp:
1893         (WebKit::WebResourceLoadStatisticsManager::setShouldSubmitTelemetry):
1894             New test infrastructure.
1895         * UIProcess/WebResourceLoadStatisticsManager.h:
1896         * UIProcess/WebResourceLoadStatisticsStore.cpp:
1897         (WebKit::WebResourceLoadStatisticsStore::setShouldSubmitTelemetry):
1898             New test infrastructure.
1899         (WebKit::WebResourceLoadStatisticsStore::registerSharedResourceLoadObserver):
1900             The test function now calls
1901             WebResourceLoadStatisticsStore::submitTelemetry() directly
1902             instead of firing the timer.
1903         (WebKit::WebResourceLoadStatisticsStore::telemetryTimerFired):
1904             Now checks whether it should submit telemetry or not.
1905         (WebKit::WebResourceLoadStatisticsStore::submitTelemetry):
1906             Split out so that the test code doesn't have to fire the timer.
1907         * UIProcess/WebResourceLoadStatisticsStore.h:
1908         * UIProcess/WebResourceLoadStatisticsTelemetry.cpp:
1909         (WebKit::WebResourceLoadStatisticsTelemetry::calculateAndSubmit):
1910             Now doesn't submit if it's executed by test code.
1911
1912 2017-06-29  Chris Dumez  <cdumez@apple.com>
1913
1914         Slight clean up of WebResourceLoadStatisticsStore
1915         https://bugs.webkit.org/show_bug.cgi?id=173976
1916
1917         Reviewed by Brent Fulgham.
1918
1919         * UIProcess/WebResourceLoadStatisticsStore.cpp:
1920         (WebKit::dataTypesToRemove):
1921         (WebKit::WebResourceLoadStatisticsStore::classifyResource):
1922         (WebKit::WebResourceLoadStatisticsStore::removeDataRecords):
1923         (WebKit::WebResourceLoadStatisticsStore::setResourceLoadStatisticsEnabled):
1924         (WebKit::WebResourceLoadStatisticsStore::registerSharedResourceLoadObserver):
1925         (WebKit::WebResourceLoadStatisticsStore::grandfatherExistingWebsiteData):
1926         (WebKit::WebResourceLoadStatisticsStore::stopMonitoringStatisticsStorage):
1927         (WebKit::initializeDataTypesToRemove): Deleted.
1928         * UIProcess/WebResourceLoadStatisticsStore.h:
1929         (WebKit::WebResourceLoadStatisticsStore::coreStore): Deleted.
1930
1931 2017-06-29  Alex Christensen  <achristensen@webkit.org>
1932
1933         WKContentRuleLists with if-top-url or unless-top-url should run regex against entire top URL
1934         https://bugs.webkit.org/show_bug.cgi?id=173980
1935
1936         Reviewed by Tim Horton.
1937
1938         if-top-url and unless-top-url were broken inside WebKit2 apps.  This fixes them and adds a test.
1939         ContentExtension::populateConditionCacheIfNeeded was calling WebCompiledContentRuleList::conditionsApplyOnlyToDomain
1940         but m_data.conditionsApplyOnlyToDomainOffset was always 0 instead of ConditionsApplyOnlyToDomainOffset because 
1941         it wasn't being encoded and decoded when telling the WebProcess about the content rule list.  This was causing us
1942         to use whatever was at offset 0 in the file instead of the correct value stored in the file to determine
1943         whether to run regular expressions against the entire top URL for if-top-url or unless-top-url or against
1944         just the domain for if-top-domain or unless-top-domain.  Luckily, offset 0 in the file is always 
1945         ContentRuleListStore::CurrentContentRuleListFileVersion, so it was deterministic and easy to debug.
1946
1947         I should have added a LayoutTest with r213669 to verify correct behavior in an actual WKWebView,
1948         but I didn't because it wouldn't have caught regressions since the contentextension tests are
1949         marked as flaky since r206914, but once that is fixed the new test http/tests/contentextensions/top-url.html
1950         will verify that this feature is behaving correctly.  It failed before this change and passes after.
1951
1952         * Shared/WebCompiledContentRuleListData.cpp:
1953         (WebKit::WebCompiledContentRuleListData::encode):
1954         (WebKit::WebCompiledContentRuleListData::decode):
1955
1956 2017-06-29  Chris Dumez  <cdumez@apple.com>
1957
1958         statistics.mostRecentUserInteraction should be of type WallTime
1959         https://bugs.webkit.org/show_bug.cgi?id=173974
1960
1961         Reviewed by Brent Fulgham.
1962
1963         statistics.mostRecentUserInteraction should be of type WallTime for clarity.
1964
1965         * Shared/WebCoreArgumentCoders.cpp:
1966         (IPC::ArgumentCoder<ResourceLoadStatistics>::encode):
1967         (IPC::ArgumentCoder<ResourceLoadStatistics>::decode):
1968
1969 2017-06-29  Wenson Hsieh  <wenson_hsieh@apple.com>
1970
1971         Replace staging-prefixed UIKit drag and drop delegate methods with their public SDK versions
1972         https://bugs.webkit.org/show_bug.cgi?id=173959
1973
1974         Reviewed by Sam Weinig.
1975
1976         Remove references to _api_-prefixed UIDragInteractionDelegate and UIDropInteractionDelegate methods,
1977         and replace them with their counterparts in the public SDK.
1978
1979         * UIProcess/ios/WKContentViewInteraction.mm:
1980         (-[WKContentView dragInteraction:previewForLiftingItem:session:]):
1981         (-[WKContentView dragInteraction:session:didEndWithOperation:]):
1982         (-[WKContentView dragInteraction:item:willAnimateCancelWithAnimator:]):
1983         (-[WKContentView dropInteraction:sessionDidEnter:]):
1984         (-[WKContentView dropInteraction:sessionDidUpdate:]):
1985         (-[WKContentView _simulateDataInteractionEntered:]):
1986         (-[WKContentView _simulateDataInteractionUpdated:]):
1987         (-[WKContentView _simulateDataInteractionSessionDidEnd:]):
1988         (-[WKContentView _api_dragInteraction:previewForLiftingItem:session:]): Deleted.
1989         (-[WKContentView _api_dragInteraction:session:didEndWithOperation:]): Deleted.
1990         (-[WKContentView _api_dragInteraction:item:willAnimateCancelWithAnimator:]): Deleted.
1991         (-[WKContentView _api_dropInteraction:sessionDidEnter:]): Deleted.
1992         (-[WKContentView _api_dropInteraction:sessionDidUpdate:]): Deleted.
1993
1994 2017-06-29  Carlos Garcia Campos  <cgarcia@igalia.com>
1995
1996         Unreviewed. Fix GTK+ unit tests crashing after r218922.
1997
1998         We need to check if icon database exists and is open now on dispose and API entry points.
1999
2000         * UIProcess/API/glib/WebKitFaviconDatabase.cpp:
2001         (webkitFaviconDatabaseDispose):
2002         (webkit_favicon_database_get_favicon_uri):
2003         (webkit_favicon_database_clear):
2004
2005 2017-06-29  Carlos Garcia Campos  <cgarcia@igalia.com>
2006
2007         [GTK][WPE] Implement API::IconLoadingClient and rework WebKitFaviconDatabase to use IconDatabase directly
2008         https://bugs.webkit.org/show_bug.cgi?id=173877
2009
2010         Reviewed by Brady Eidson.
2011
2012         This way IconDatabase and its related classes can be removed from WebCore, as well as the WebKit2 implementation
2013         and C API. For now I've copied IconDatabase from WebCore to WebKit2 under the glib API directory, adding the
2014         related classes as private inside IconDatabase, and removing some methods that are not used by the GLib API.
2015
2016         * PlatformGTK.cmake:
2017         * UIProcess/API/glib/IconDatabase.cpp: Added.
2018         (WebKit::urlForLogging):
2019         (WebKit::defaultClient):
2020         (WebKit::IconDatabase::IconRecord::IconRecord):
2021         (WebKit::IconDatabase::IconRecord::~IconRecord):
2022         (WebKit::IconDatabase::IconRecord::image):
2023         (WebKit::IconDatabase::IconRecord::setImageData):
2024         (WebKit::IconDatabase::IconRecord::loadImageFromResource):
2025         (WebKit::IconDatabase::IconRecord::imageDataStatus):
2026         (WebKit::IconDatabase::IconRecord::snapshot):
2027         (WebKit::IconDatabase::PageURLRecord::PageURLRecord):
2028         (WebKit::IconDatabase::PageURLRecord::~PageURLRecord):
2029         (WebKit::IconDatabase::PageURLRecord::setIconRecord):
2030         (WebKit::IconDatabase::PageURLRecord::snapshot):
2031         (WebKit::IconDatabase::setClient):
2032         (WebKit::IconDatabase::open):
2033         (WebKit::IconDatabase::close):
2034         (WebKit::IconDatabase::removeAllIcons):
2035         (WebKit::documentCanHaveIcon):
2036         (WebKit::IconDatabase::synchronousIconForPageURL):
2037         (WebKit::IconDatabase::synchronousIconURLForPageURL):
2038         (WebKit::IconDatabase::retainIconForPageURL):
2039         (WebKit::IconDatabase::performRetainIconForPageURL):
2040         (WebKit::IconDatabase::releaseIconForPageURL):
2041         (WebKit::IconDatabase::performReleaseIconForPageURL):
2042         (WebKit::IconDatabase::setIconDataForIconURL):
2043         (WebKit::IconDatabase::setIconURLForPageURL):
2044         (WebKit::IconDatabase::synchronousLoadDecisionForIconURL):
2045         (WebKit::IconDatabase::synchronousIconDataKnownForIconURL):
2046         (WebKit::IconDatabase::setEnabled):
2047         (WebKit::IconDatabase::isEnabled):
2048         (WebKit::IconDatabase::setPrivateBrowsingEnabled):
2049         (WebKit::IconDatabase::isPrivateBrowsingEnabled):
2050         (WebKit::IconDatabase::delayDatabaseCleanup):
2051         (WebKit::IconDatabase::allowDatabaseCleanup):
2052         (WebKit::IconDatabase::checkIntegrityBeforeOpening):
2053         (WebKit::IconDatabase::IconDatabase):
2054         (WebKit::IconDatabase::~IconDatabase):
2055         (WebKit::IconDatabase::wakeSyncThread):
2056         (WebKit::IconDatabase::scheduleOrDeferSyncTimer):
2057         (WebKit::IconDatabase::syncTimerFired):
2058         (WebKit::IconDatabase::isOpen):
2059         (WebKit::IconDatabase::isOpenBesidesMainThreadCallbacks):
2060         (WebKit::IconDatabase::databasePath):
2061         (WebKit::IconDatabase::defaultDatabaseFilename):
2062         (WebKit::IconDatabase::getOrCreateIconRecord):
2063         (WebKit::IconDatabase::getOrCreatePageURLRecord):
2064         (WebKit::IconDatabase::shouldStopThreadActivity):
2065         (WebKit::IconDatabase::iconDatabaseSyncThread):
2066         (WebKit::databaseVersionNumber):
2067         (WebKit::isValidDatabase):
2068         (WebKit::createDatabaseTables):
2069         (WebKit::IconDatabase::performOpenInitialization):
2070         (WebKit::IconDatabase::checkIntegrity):
2071         (WebKit::IconDatabase::performURLImport):
2072         (WebKit::IconDatabase::syncThreadMainLoop):
2073         (WebKit::IconDatabase::performPendingRetainAndReleaseOperations):
2074         (WebKit::IconDatabase::readFromDatabase):
2075         (WebKit::IconDatabase::writeToDatabase):
2076         (WebKit::IconDatabase::pruneUnretainedIcons):
2077         (WebKit::IconDatabase::checkForDanglingPageURLs):
2078         (WebKit::IconDatabase::removeAllIconsOnThread):
2079         (WebKit::IconDatabase::deleteAllPreparedStatements):
2080         (WebKit::IconDatabase::cleanupSyncThread):
2081         (WebKit::readySQLiteStatement):
2082         (WebKit::IconDatabase::setIconURLForPageURLInSQLDatabase):
2083         (WebKit::IconDatabase::setIconIDForPageURLInSQLDatabase):
2084         (WebKit::IconDatabase::removePageURLFromSQLDatabase):
2085         (WebKit::IconDatabase::getIconIDForIconURLFromSQLDatabase):
2086         (WebKit::IconDatabase::addIconURLToSQLDatabase):
2087         (WebKit::IconDatabase::getImageDataForIconURLFromSQLDatabase):
2088         (WebKit::IconDatabase::removeIconFromSQLDatabase):
2089         (WebKit::IconDatabase::writeIconSnapshotToSQLDatabase):
2090         (WebKit::IconDatabase::checkClosedAfterMainThreadCallback):
2091         (WebKit::IconDatabase::dispatchDidImportIconURLForPageURLOnMainThread):
2092         (WebKit::IconDatabase::dispatchDidImportIconDataForPageURLOnMainThread):
2093         (WebKit::IconDatabase::dispatchDidRemoveAllIconsOnMainThread):
2094         (WebKit::IconDatabase::dispatchDidFinishURLImportOnMainThread):
2095         * UIProcess/API/glib/IconDatabase.h: Added.
2096         (WebKit::IconDatabaseClient::didImportIconURLForPageURL):
2097         (WebKit::IconDatabaseClient::didImportIconDataForPageURL):
2098         (WebKit::IconDatabaseClient::didChangeIconForPageURL):
2099         (WebKit::IconDatabaseClient::didRemoveAllIcons):
2100         (WebKit::IconDatabaseClient::didFinishURLImport):
2101         (WebKit::IconDatabaseClient::didClose):
2102         (WebKit::IconDatabase::IconSnapshot::IconSnapshot):
2103         (WebKit::IconDatabase::IconSnapshot::iconURL):
2104         (WebKit::IconDatabase::IconSnapshot::timestamp):
2105         (WebKit::IconDatabase::IconSnapshot::data):
2106         (WebKit::IconDatabase::IconRecord::create):
2107         (WebKit::IconDatabase::IconRecord::getTimestamp):
2108         (WebKit::IconDatabase::IconRecord::setTimestamp):
2109         (WebKit::IconDatabase::IconRecord::iconURL):
2110         (WebKit::IconDatabase::IconRecord::retainingPageURLs):
2111         (WebKit::IconDatabase::PageURLSnapshot::PageURLSnapshot):
2112         (WebKit::IconDatabase::PageURLSnapshot::pageURL):
2113         (WebKit::IconDatabase::PageURLSnapshot::iconURL):
2114         (WebKit::IconDatabase::PageURLRecord::url):
2115         (WebKit::IconDatabase::PageURLRecord::iconRecord):
2116         (WebKit::IconDatabase::PageURLRecord::retain):
2117         (WebKit::IconDatabase::PageURLRecord::release):
2118         (WebKit::IconDatabase::PageURLRecord::retainCount):
2119         * UIProcess/API/glib/WebKitFaviconDatabase.cpp:
2120         (_WebKitFaviconDatabasePrivate::~_WebKitFaviconDatabasePrivate):
2121         (getIconSurfaceSynchronously):
2122         (webkitFaviconDatabaseSetIconURLForPageURL):
2123         (webkitFaviconDatabaseCreate):
2124         (webkitFaviconDatabaseOpen):
2125         (webkitFaviconDatabaseIsOpen):
2126         (webkitFaviconDatabaseSetPrivateBrowsingEnabled):
2127         (webkitFaviconDatabaseGetLoadDecisionForIcon):
2128         (webkitFaviconDatabaseSetIconForPageURL):
2129         (webkit_favicon_database_get_favicon):
2130         (webkit_favicon_database_get_favicon_uri):
2131         * UIProcess/API/glib/WebKitFaviconDatabasePrivate.h:
2132         * UIProcess/API/glib/WebKitIconLoadingClient.cpp: Added.
2133         (IconLoadingClient::IconLoadingClient):
2134         (attachIconLoadingClientToView):
2135         * UIProcess/API/glib/WebKitIconLoadingClient.h: Copied from Source/WebKit2/UIProcess/API/glib/WebKitFaviconDatabasePrivate.h.
2136         * UIProcess/API/glib/WebKitWebContext.cpp:
2137         (ensureFaviconDatabase):
2138         (webkitWebContextEnableIconDatabasePrivateBrowsingIfNeeded):
2139         (webkitWebContextDisableIconDatabasePrivateBrowsingIfNeeded):
2140         (webkit_web_context_set_favicon_database_directory):
2141         * UIProcess/API/glib/WebKitWebView.cpp:
2142         (webkitWebViewConstructed):
2143         (webkitWebViewGetLoadDecisionForIcon):
2144         (webkitWebViewSetIcon):
2145         * UIProcess/API/glib/WebKitWebViewPrivate.h:
2146
2147 2017-06-28  Tim Horton  <timothy_horton@apple.com>
2148
2149         MobileSafari was constantly using 10-15% CPU viewing a PDF
2150         https://bugs.webkit.org/show_bug.cgi?id=173944
2151         <rdar://problem/33039910>
2152
2153         Reviewed by Simon Fraser.
2154
2155         * UIProcess/API/Cocoa/WKWebView.mm:
2156         (-[WKWebView _doAfterNextStablePresentationUpdate:]):
2157         (-[WKWebView _doAfterNextPresentationUpdate:]):
2158         (-[WKWebView _doAfterNextPresentationUpdateWithoutWaitingForPainting:]):
2159         Bail early and just dispatch_async the completion block if we are using a custom
2160         content view; these methods are very specific to the implementation of WKContentView
2161         and don't make sense with custom content views.
2162
2163         doAfterNextStablePresentationUpdate is particularly egregious because, since
2164         we will never call the stable update callbacks (because we bail from didCommitLayerTree
2165         if we aren't using WKContentView), it will keep calling doAfterNextPresentationUpdate
2166         over and over again.
2167
2168 2017-06-28  Brent Fulgham  <bfulgham@apple.com>
2169
2170         [WK2][macOS][iOS] Don't request microphone access for clients that don't need it.
2171         https://bugs.webkit.org/show_bug.cgi?id=173948
2172         <rdar://problem/32103275>
2173
2174         Reviewed by Eric Carlson.
2175
2176         Don't bother requesting a sandbox extension to access the microphone for any clients
2177         on the Cocoa platform that are not Safari. Other clients don't have the necessary
2178         system entitlements, and always fail leading to annoying SandboxViolation reports.
2179
2180         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
2181         (WebKit::WebProcessPool::platformInitializeWebProcess): 
2182
2183 2017-06-29  Zalan Bujtas  <zalan@apple.com>
2184
2185         Move RenderEmbeddedObject::isReplacementObscured to HTMLPlugInElement
2186         https://bugs.webkit.org/show_bug.cgi?id=173802
2187         <rdar://problem/32884389>
2188
2189         Reviewed by Simon Fraser.
2190
2191         * WebProcess/WebPage/WebPage.cpp:
2192         (WebKit::WebPage::createPlugin):
2193
2194 2017-06-28  Ryosuke Niwa  <rniwa@webkit.org>
2195
2196         REGRESSION (r218842): com.apple.WebKit crash in WebKit::ProcessLauncher::launchProcess
2197         https://bugs.webkit.org/show_bug.cgi?id=173950
2198
2199         Reviewed by Chris Dumez.
2200
2201         Added a null check as m_xpcConnection could be nullptr here in the case platformInvalidate had been called.
2202
2203         * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
2204         (WebKit::ProcessLauncher::launchProcess):
2205
2206 2017-06-28  Youenn Fablet  <youenn@apple.com>
2207
2208         Support PeerConnectionStates::BundlePolicy::MaxBundle when setting rtc configuration
2209         https://bugs.webkit.org/show_bug.cgi?id=169389
2210
2211         Reviewed by Alex Christensen.
2212
2213         Updating according new WebCore LIbWebRTCProvider API.
2214
2215         * WebProcess/Network/webrtc/LibWebRTCProvider.cpp:
2216         (WebKit::LibWebRTCProvider::createPeerConnection):
2217         * WebProcess/Network/webrtc/LibWebRTCProvider.h:
2218
2219 2017-06-28  Chris Dumez  <cdumez@apple.com>
2220
2221         [iOS] Allow WKWebView clients to play audio in the background
2222         https://bugs.webkit.org/show_bug.cgi?id=173932
2223         <rdar://problem/32851547>
2224
2225         Reviewed by Ryosuke Niwa.
2226
2227         Allow WKWebView clients (such as MobileSafari) to play audio in the background
2228         by taking a process assertion whenever a WebPage is audible.
2229
2230         * UIProcess/WebPageProxy.cpp:
2231         (WebKit::WebPageProxy::updateThrottleState):
2232
2233 2017-06-28  Brent Fulgham  <bfulgham@apple.com>
2234
2235         Teach ResourceLoadStatistics to recognize changes in the file system
2236         https://bugs.webkit.org/show_bug.cgi?id=173800
2237         <rdar://problem/32937842>
2238
2239         Reviewed by Chris Dumez.
2240
2241         We want to support the case where multiple UI processes choose to share the same
2242         statistics file. To support this, update the ResourceLoadStatistics logic to be aware
2243         that the statistics data file might change underneath it, and to take appropriate
2244         action when it does.
2245
2246         * UIProcess/WebResourceLoadStatisticsStore.cpp:
2247         (WebKit::WebResourceLoadStatisticsStore::setResourceLoadStatisticsEnabled): When we enable
2248         the statistics, read in the data and then watch for changes.
2249         (WebKit::WebResourceLoadStatisticsStore::registerSharedResourceLoadObserver): Add a
2250         'delete data' handler to remove the file on disk, not just write an empty store.
2251         (WebKit::WebResourceLoadStatisticsStore::readDataFromDiskIfNeeded): Use ASCIILiteral.
2252         (WebKit::WebResourceLoadStatisticsStore::refreshFromDisk): Convenience function.
2253         (WebKit::WebResourceLoadStatisticsStore::writeStoreToDisk): Sync with any on-disk
2254         storage before writing out.
2255         (WebKit::openAndLockFile): Convenience function.
2256         (WebKit::closeAndUnlockFile): Ditto.
2257         (WebKit::WebResourceLoadStatisticsStore::writeEncoderToDisk): Revise to lock file (on
2258         platforms that support it) before writing to disk.
2259         (WebKit::WebResourceLoadStatisticsStore::deleteStoreFromDisk): Added convenience function.
2260         (WebKit::WebResourceLoadStatisticsStore::clearInMemoryData): Ditto.
2261         (WebKit::WebResourceLoadStatisticsStore::startMonitoringStatisticsStorage): Create a
2262         file system monitor to watch for file changes.
2263         (WebKit::WebResourceLoadStatisticsStore::syncWithExistingStatisticsStorageIfNeeded): Added
2264         convenience function.
2265         (WebKit::WebResourceLoadStatisticsStore::createDecoderFromDisk): Revise to read data
2266         directly so we can control file locking.
2267         * UIProcess/WebResourceLoadStatisticsStore.h:
2268
2269 2017-06-28  Wenson Hsieh  <wenson_hsieh@apple.com>
2270
2271         Followup to r218885: adjust for further UIKit SPI changes
2272         https://bugs.webkit.org/show_bug.cgi?id=173927
2273         <rdar://problem/33020792>
2274
2275         Reviewed by Tim Horton.
2276
2277         On ToT, UIKit now invokes -_dragInteraction:item:shouldDelaySetDownAnimationWithCompletion: before the
2278         completion block of -dragInteraction:willAnimateLiftWithAnimator:session: is called. This means we now need to
2279         store the completion block in -shouldDelaySetDownAnimationWithCompletion: and wait until the UIDragAnimating
2280         completion block in -willAnimateCancelWithAnimator: before invoking it.
2281
2282         * UIProcess/ios/WKContentViewInteraction.h:
2283         * UIProcess/ios/WKContentViewInteraction.mm:
2284         (-[WKContentView cleanUpDragSourceSessionState]):
2285
2286         Ensure that the set-down completion block is invoked when a drag session ends (e.g., if the web content process
2287         crashes).
2288
2289         (-[WKContentView _dragInteraction:item:shouldDelaySetDownAnimationWithCompletion:]):
2290         (-[WKContentView _api_dragInteraction:item:willAnimateCancelWithAnimator:]):
2291
2292 2017-06-28  Wenson Hsieh  <wenson_hsieh@apple.com>
2293
2294         dropInteraction:sessionDidEnd: invokes dragEnded with a UIDragOperation rather than a WebCore::DragOperation
2295         https://bugs.webkit.org/show_bug.cgi?id=173935
2296
2297         Reviewed by Tim Horton.
2298
2299         Replaces a use of UIDragOperationNone with DragOperationNone.
2300         Currently, there is no change in behavior since these are currently the same value (0).
2301
2302         * UIProcess/ios/WKContentViewInteraction.mm:
2303         (-[WKContentView dropInteraction:sessionDidEnd:]):
2304
2305 2017-06-28  Alex Christensen  <achristensen@webkit.org>
2306
2307         WebsitePolicies given with navigation policy for redirects should apply to the provisional document
2308         https://bugs.webkit.org/show_bug.cgi?id=173886
2309         <rdar://problem/32543191>
2310
2311         Reviewed by Andy Estes.
2312         
2313         If, for example, we deny video autoplay for the initial request but allow it for the redirect destination
2314         location, the document should allow video autoplay.  We were putting these settings onto the wrong DocumentLoader.
2315         When a navigation policy is given to a response of a redirect location, we currently have the DocumentLoader
2316         for the loading document in the FrameLoader's provisionalDocumentLoader, not the documentLoader.
2317         
2318         Covered by a new API test.
2319
2320         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
2321         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
2322
2323 2017-06-28  Konstantin Tokarev  <annulen@yandex.ru>
2324
2325         [cmake] Improve configuration tests for librt and libatomic
2326         https://bugs.webkit.org/show_bug.cgi?id=173921
2327
2328         Reviewed by Michael Catanzaro.
2329
2330         1. Both tests are converted to use specialized CMake modules
2331         2. Both libraries are now linked only if they are really needed and usable
2332            by compiler
2333         3. librt is no more required to be detected by find_library(), which may fail
2334            in case of cross-compilation
2335         4. libatomic test moved to port-independent CMakeLists.txt
2336
2337         * CMakeLists.txt:
2338         * PlatformGTK.cmake:
2339
2340 2017-06-28  Alex Christensen  <achristensen@webkit.org>
2341
2342         Fix CMake build.
2343
2344         * PlatformMac.cmake:
2345
2346 2017-06-28  Wenson Hsieh  <wenson_hsieh@apple.com>
2347
2348         [iOS DnD] [WK2] Dragged content flashes after the preview sets down when cancelling a drag
2349         https://bugs.webkit.org/show_bug.cgi?id=173927
2350         <rdar://problem/33020792>
2351
2352         Reviewed by Tim Horton.
2353
2354         When a drag is cancelled, UIKit normally animates fly-back and set-down animations back-to-back. However, for
2355         WebKit2, we need to call out to the web process in order to trigger a repaint of the dragged content at normal
2356         opacity when the drag cancel animation completes. Thus, we can hook into UIKit SPI to split the cancellation
2357         animation into two discrete phases: the fly-back and the set-down (the latter of which may be deferred using a
2358         completion block).
2359
2360         To do this, we implement a new SPI hook, _dragInteraction:item:shouldDelaySetDownAnimationWithCompletion:, to
2361         indicate that the set-down should be deferred, and call the completion block after the next layer tree commit.
2362         Since -shouldDelaySetDownAnimationWithCompletion: is invoked after the UIDragAnimating completion block in
2363         -willAnimateCancelWithAnimator:, this layer tree commit is guaranteed to come after we've told the web process
2364         to repaint at full opacity.
2365
2366         This patch also accounts for additional changes in UIKit. Once -shouldDelaySetDownAnimationWithCompletion:
2367         becomes available, -sessionDidEnd: will no longer be invoked after a cancelled drag lift if the user did not
2368         begin moving. This means that our cleanup logic in -sessionDidEnd: will no longer be executed in this case,
2369         leaving the view with an inconsistent dragging state. To fix this, we need to implement
2370         -dragInteraction:willAnimateLiftWithAnimator:session: to perform drag session cleanup following a cancelled drag
2371         lift, for which the drag animator's final position will be UIViewAnimatingPositionStart.
2372
2373         * UIProcess/ios/WKContentViewInteraction.mm:
2374         (-[WKContentView dragInteraction:willAnimateLiftWithAnimator:session:]):
2375         (-[WKContentView _dragInteraction:item:shouldDelaySetDownAnimationWithCompletion:]):
2376
2377 2017-06-28  Chris Dumez  <cdumez@apple.com>
2378
2379         Avoid double thread dispatch in WebsiteDataStore::fetchDataForTopPrivatelyControlledDomains()
2380         https://bugs.webkit.org/show_bug.cgi?id=173904
2381
2382         Reviewed by Brent Fulgham.
2383
2384         Avoid double thread dispatch in WebsiteDataStore::fetchDataForTopPrivatelyControlledDomains().
2385         It calls fetchData() which dispatches to the main queue, then fetchDataForTopPrivatelyControlledDomains()
2386         dispatches to the background queue. It should be possible to get fetchData() to dispatch directly
2387         on the right queue.
2388
2389         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
2390         (WebKit::WebsiteDataStore::fetchData):
2391         (WebKit::WebsiteDataStore::fetchDataAndApply):
2392         (WebKit::WebsiteDataStore::fetchDataForTopPrivatelyControlledDomains):
2393         * UIProcess/WebsiteData/WebsiteDataStore.h:
2394
2395 2017-06-27  Chris Dumez  <cdumez@apple.com>
2396
2397         [ResourceLoadStatistics] Update minimumTimeBetweeenDataRecordsRemoval to 1 hour instead of 1 minute
2398         https://bugs.webkit.org/show_bug.cgi?id=173895
2399         <rdar://problem/32984366>
2400
2401         Reviewed by Brent Fulgham.
2402
2403         Update minimumTimeBetweeenDataRecordsRemoval to 1 hour instead of 1 minute to save battery.
2404         Also port code to modern time types.
2405
2406         * UIProcess/API/C/WKResourceLoadStatisticsManager.cpp:
2407         (WKResourceLoadStatisticsManagerSetTimeToLiveUserInteraction):
2408         (WKResourceLoadStatisticsManagerSetTimeToLiveCookiePartitionFree):
2409         (WKResourceLoadStatisticsManagerSetMinimumTimeBetweeenDataRecordsRemoval):
2410         (WKResourceLoadStatisticsManagerSetGrandfatheringTime):
2411         * UIProcess/WebResourceLoadStatisticsManager.cpp:
2412         (WebKit::WebResourceLoadStatisticsManager::setTimeToLiveUserInteraction):
2413         (WebKit::WebResourceLoadStatisticsManager::setTimeToLiveCookiePartitionFree):
2414         (WebKit::WebResourceLoadStatisticsManager::setMinimumTimeBetweeenDataRecordsRemoval):
2415         (WebKit::WebResourceLoadStatisticsManager::setGrandfatheringTime):
2416         * UIProcess/WebResourceLoadStatisticsManager.h:
2417         * UIProcess/WebResourceLoadStatisticsStore.h:
2418
2419 2017-06-27  Chris Dumez  <cdumez@apple.com>
2420
2421         Port HysteresisActivity to Seconds type
2422         https://bugs.webkit.org/show_bug.cgi?id=173902
2423
2424         Reviewed by Simon Fraser.
2425
2426         * WebProcess/WebPage/WebPage.cpp:
2427         (WebKit::m_pageScrolledHysteresis):
2428
2429 2017-06-27  Chris Dumez  <cdumez@apple.com>
2430
2431         Move WebsiteDataRecord processing off-thread in WebsiteDataStore::fetchDataForTopPrivatelyControlledDomains()
2432         https://bugs.webkit.org/show_bug.cgi?id=173882
2433         <rdar://problem/32984366>
2434
2435         Reviewed by Darin Adler.
2436
2437         Move WebsiteDataRecord processing off-thread in WebsiteDataStore::fetchDataForTopPrivatelyControlledDomains()
2438         as we have data showing it is slow and hangs the UIProcess' main thread.
2439
2440         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
2441         (WebKit::WebsiteDataStore::fetchDataForTopPrivatelyControlledDomains):
2442
2443 2017-06-27  Brent Fulgham  <bfulgham@apple.com>
2444
2445         [WK2][macOS] Expand sandbox to allow access to the CoreMedia volume control endpoint
2446         https://bugs.webkit.org/show_bug.cgi?id=173898
2447         <rdar://problem/32930754>
2448
2449         Reviewed by Ryosuke Niwa.
2450
2451         * WebProcess/com.apple.WebProcess.sb.in:
2452
2453 2017-06-27  Wenson Hsieh  <wenson_hsieh@apple.com>
2454
2455         [iOS DnD] Support dragging out of contenteditable areas without a prior selection
2456         https://bugs.webkit.org/show_bug.cgi?id=173854
2457         <rdar://problem/32236827>
2458
2459         Reviewed by Ryosuke Niwa and Tim Horton.
2460
2461         Instead of allowing a drag to occur only if a position information request discovers a clickable node, remove
2462         the position information request entirely and just call into WebCore to try and begin the drag. Currently, the
2463         position information request serves two purposes:
2464         1. To adjust the hit-test location to account for nearby clickable nodes.
2465         2. To obtain information about the content being dragged.
2466
2467         The first requirement is fulfilled by performing the drag location adjustment in WebCore instead (see
2468         ChangeLogs for more detail). The second requirement is fulfilled by refactoring in
2469         https://bugs.webkit.org/show_bug.cgi?id=173832 to fold all information relevant to starting a drag into the
2470         DragItem struct, and then propagating the DragItem struct. The relevant information from the position
2471         information update is now populated when the UI process receives the drag start response.
2472
2473         * UIProcess/ios/WKContentViewInteraction.h:
2474         * UIProcess/ios/WKContentViewInteraction.mm:
2475         (-[WKContentView _startDrag:item:]):
2476         (-[WKContentView computeClientAndGlobalPointsForDropSession:outClientPoint:outGlobalPoint:]):
2477         (-[WKContentView _dragInteraction:prepareForSession:completion:]):
2478         (-[WKContentView _api_dropInteraction:sessionDidEnter:]):
2479         (-[WKContentView _api_dropInteraction:sessionDidUpdate:]):
2480         (positionInformationMayStartDataInteraction): Deleted.
2481
2482 2017-06-27  Chris Dumez  <cdumez@apple.com>
2483
2484         [iOS] Avoid taking / releasing process assertions too quickly due to database activity
2485         https://bugs.webkit.org/show_bug.cgi?id=173879
2486         <rdar://problem/32412701>
2487
2488         Reviewed by Antti Koivisto.
2489
2490         Specify an activity name when taking the process assertion to facilitate
2491         debugging in the future. It took me a while to figure out this assertion
2492         was the one that was too aggressive because it was anonymous.
2493
2494         * UIProcess/API/Cocoa/WKWebView.mm:
2495         (-[WKWebView _setUpSQLiteDatabaseTrackerClient]):
2496
2497 2017-06-27  Don Olmstead  <don.olmstead@sony.com>
2498
2499         [PAL] Add symbol export macros for PAL
2500         https://bugs.webkit.org/show_bug.cgi?id=171519
2501
2502         Reviewed by Konstantin Tokarev.
2503
2504         * config.h:
2505
2506 2017-06-27  Ryosuke Niwa  <rniwa@webkit.org>
2507
2508         ProcessLauncherMac could leak a xpc connection when the process had failed to launch
2509         https://bugs.webkit.org/show_bug.cgi?id=173865
2510
2511         Reviewed by Antti Koivisto.
2512
2513         Explicitly cancel the XPC connection even When the process launch had failed to avoid a leak.
2514
2515         * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
2516         (WebKit::ProcessLauncher::launchProcess):
2517
2518 2017-06-27  John Wilander  <wilander@apple.com>
2519
2520         Resource Load Statistics: Add telemetry
2521         https://bugs.webkit.org/show_bug.cgi?id=173499
2522         <rdar://problem/32826094>
2523
2524         Reviewed by Brent Fulgham.
2525
2526         * PlatformGTK.cmake:
2527             Added UIProcess/WebResourceLoadStatisticsTelemetry.cpp
2528         * PlatformMac.cmake:
2529             Added UIProcess/WebResourceLoadStatisticsTelemetry.cpp
2530         * PlatformWPE.cmake:
2531             Added UIProcess/WebResourceLoadStatisticsTelemetry.cpp
2532         * UIProcess/API/C/WKResourceLoadStatisticsManager.cpp:
2533         (WKResourceLoadStatisticsManagerFireTelemetryHandler):
2534         (WKResourceLoadStatisticsManagerSetNotifyPagesWhenTelemetryWasCaptured):
2535             Test infrastructure.
2536         * UIProcess/API/C/WKResourceLoadStatisticsManager.h:
2537         * UIProcess/WebProcessProxy.cpp:
2538         (WebKit::WebProcessProxy::notifyPageStatisticsTelemetryFinished):
2539             Test infrastructure.
2540         * UIProcess/WebProcessProxy.h:
2541         * UIProcess/WebResourceLoadStatisticsManager.cpp:
2542         (WebKit::WebResourceLoadStatisticsManager::fireTelemetryHandler):
2543         (WebKit::WebResourceLoadStatisticsManager::setNotifyPagesWhenTelemetryWasCaptured):
2544         (WebKit::WebResourceLoadStatisticsManager::resetToConsistentState):
2545             Test infrastructure.
2546         * UIProcess/WebResourceLoadStatisticsManager.h:
2547         * UIProcess/WebResourceLoadStatisticsStore.cpp:
2548         (WebKit::WebResourceLoadStatisticsStore::WebResourceLoadStatisticsStore):
2549             Configures a timer for telemetry capture. Fires 5 seconds after launch
2550             and then every 24 hours.
2551         (WebKit::WebResourceLoadStatisticsStore::setNotifyPagesWhenDataRecordsWereScanned):
2552             Variable renamed notifyPages -> notifyPagesWhenDataRecordsWereScanned.
2553         (WebKit::WebResourceLoadStatisticsStore::removeDataRecords):
2554             Variable renamed notifyPages -> notifyPagesWhenDataRecordsWereScanned.
2555         (WebKit::WebResourceLoadStatisticsStore::processStatisticsAndDataRecords):
2556             Variable renamed notifyPages -> notifyPagesWhenDataRecordsWereScanned.
2557         (WebKit::WebResourceLoadStatisticsStore::registerSharedResourceLoadObserver):
2558             Variable renamed notifyPages -> notifyPagesWhenDataRecordsWereScanned.
2559         (WebKit::WebResourceLoadStatisticsStore::grandfatherExistingWebsiteData):
2560             Variable renamed notifyPages -> notifyPagesWhenDataRecordsWereScanned.
2561         (WebKit::WebResourceLoadStatisticsStore::telemetryTimerFired):
2562              Calls WebResourceLoadStatisticsTelemetry::calculateAndSubmit().
2563         * UIProcess/WebResourceLoadStatisticsStore.h:
2564         * UIProcess/WebResourceLoadStatisticsTelemetry.cpp: Added.
2565         (WebKit::numberOfResourcesWithUserInteraction):
2566         (WebKit::median):
2567         (WebKit::nonEphemeralWebPageProxy):
2568         (WebKit::submitTopList):
2569         (WebKit::submitTopLists):
2570         (WebKit::notifyPages):
2571         (WebKit::WebResourceLoadStatisticsTelemetry::calculateAndSubmit):
2572         (WebKit::WebResourceLoadStatisticsTelemetry::setNotifyPagesWhenTelemetryWasCaptured):
2573         * UIProcess/WebResourceLoadStatisticsTelemetry.h: Added.
2574         * WebKit2.xcodeproj/project.pbxproj:
2575
2576 2017-06-27  Ting-Wei Lan  <lantw44@gmail.com>
2577
2578         Add missing includes to fix compilation error on FreeBSD
2579         https://bugs.webkit.org/show_bug.cgi?id=172919
2580
2581         Reviewed by Mark Lam.
2582
2583         * UIProcess/API/C/WKContextPrivate.h:
2584         * UIProcess/API/C/WKPagePrivate.h:
2585         * UIProcess/ProcessAssertion.h:
2586
2587 2017-06-27  Wenson Hsieh  <wenson_hsieh@apple.com>
2588
2589         Refactor drag start codepaths to plumb a DragItem to client layers
2590         https://bugs.webkit.org/show_bug.cgi?id=173832
2591         Work towards <rdar://problem/32236827>
2592
2593         Reviewed by Ryosuke Niwa and Tim Horton.
2594
2595         Add support for serializing a DragItem over IPC. This encodes and decodes all members of DragItem except for the
2596         PasteboardWriterData and the DragImage's image. The DragItem is sent over to the UI process in
2597         WebDragClient::startDrag via the WebPageProxy::startDrag IPC message (renamed from WebPageProxy::setDragImage)
2598         which now takes a DragItem.
2599
2600         * UIProcess/Cocoa/WebPageProxyCocoa.mm:
2601         (WebKit::WebPageProxy::startDrag):
2602         (WebKit::WebPageProxy::setDragImage): Deleted.
2603         * UIProcess/PageClient.h:
2604         * UIProcess/WebPageProxy.h:
2605         * UIProcess/WebPageProxy.messages.in:
2606
2607         Rename SetDragImage to StartDrag and refactor to receive only a DragItem and shareable bitmap handle.
2608
2609         * UIProcess/ios/PageClientImplIOS.h:
2610         * UIProcess/ios/PageClientImplIOS.mm:
2611         (WebKit::PageClientImpl::startDrag):
2612         (WebKit::PageClientImpl::startDataInteractionWithImage): Deleted.
2613         * UIProcess/ios/WKContentViewInteraction.h:
2614         * UIProcess/ios/WKContentViewInteraction.mm:
2615         (-[WKContentView _startDrag:item:]):
2616         (-[WKContentView _startDataInteractionWithImage:withIndicatorData:atClientPosition:anchorPoint:action:]): Deleted.
2617
2618         Rename startDataInteractionWithImage to startDrag.
2619
2620         * UIProcess/mac/WebPageProxyMac.mm:
2621         (WebKit::WebPageProxy::startDrag):
2622         (WebKit::WebPageProxy::setDragImage): Deleted.
2623         * WebProcess/WebCoreSupport/WebDragClient.cpp:
2624         (WebKit::WebDragClient::startDrag):
2625         * WebProcess/WebCoreSupport/WebDragClient.h:
2626         * WebProcess/WebCoreSupport/gtk/WebDragClientGtk.cpp:
2627         (WebKit::WebDragClient::startDrag):
2628         * WebProcess/WebCoreSupport/mac/WebDragClientMac.mm:
2629         (WebKit::WebDragClient::startDrag):
2630
2631 2017-06-27  Wenson Hsieh  <wenson_hsieh@apple.com>
2632
2633         [iOS DnD] [WK2] WKWebView does not handle drag sessions that exit and re-enter
2634         https://bugs.webkit.org/show_bug.cgi?id=173856
2635         <rdar://problem/32957100>
2636
2637         Reviewed by Ryosuke Niwa.
2638
2639         Upon exiting a WKContentView, the dropSession tracked by _dataInteractionState is not cleared out. If the drag
2640         session re-enters the WKWebView, a _different_ UIDropSession is sent to the drop delegate, causing us to bail
2641         from handling the session altogether in -dropInteraction:canHandleSession:. To fix this, we need to clear out
2642         the dropSession when the drag session exits the view.
2643
2644         * UIProcess/ios/WKContentViewInteraction.mm:
2645         (-[WKContentView dropInteraction:sessionDidExit:]):
2646
2647 2017-06-26  Chris Dumez  <cdumez@apple.com>
2648
2649         WebsiteDataStore::fetchDataForTopPrivatelyControlledDomains() is inefficient
2650         https://bugs.webkit.org/show_bug.cgi?id=173850
2651
2652         Reviewed by Ryosuke Niwa.
2653
2654         Update WebsiteDataRecord::matchesTopPrivatelyControlledDomain() to rely on
2655         SecurityOriginData::host rather than SecurityOriginData::securityOrigin()->host().
2656         SecurityOriginData::securityOrigin() is expensive and it seems unnecessary to call
2657         it here since we already have the host.
2658
2659         Also update WebsiteDataStore::fetchDataForTopPrivatelyControlledDomains() to return
2660         domains as a HashSet rather than a Vector to avoid having duplicate domains.
2661
2662         * UIProcess/WebProcessProxy.cpp:
2663         (WebKit::WebProcessProxy::deleteWebsiteDataForTopPrivatelyControlledDomainsInAllPersistentDataStores):
2664         * UIProcess/WebProcessProxy.h:
2665         * UIProcess/WebResourceLoadStatisticsStore.cpp:
2666         (WebKit::WebResourceLoadStatisticsStore::removeDataRecords):
2667         * UIProcess/WebsiteData/WebsiteDataRecord.cpp:
2668         (WebKit::WebsiteDataRecord::matchesTopPrivatelyControlledDomain):
2669         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
2670         (WebKit::WebsiteDataStore::fetchDataForTopPrivatelyControlledDomains):
2671         (WebKit::WebsiteDataStore::removeDataForTopPrivatelyControlledDomains):
2672         * UIProcess/WebsiteData/WebsiteDataStore.h:
2673
2674 2017-06-26  Jeremy Jones  <jeremyj@apple.com>
2675
2676         Invalidate WebVideoFullscreenManager when WebPage is destroyed.
2677         https://bugs.webkit.org/show_bug.cgi?id=173835
2678         rdar://problem/32969161
2679
2680         Reviewed by Jer Noble.
2681
2682         WebVideoFullscreenManager has a pointer to WebPage, and even null checks it in a few places,
2683         but the only place it is nulled out is in the destructor. This allows a dangling reference.
2684
2685         This changes invalidates that reference when WebPage is destructed and adds nullchecks
2686         or asserts throughout WebVideoFullscreenManager as appropriate.
2687
2688         * WebProcess/WebPage/WebPage.cpp:
2689         (WebKit::WebPage::~WebPage):
2690         * WebProcess/cocoa/WebVideoFullscreenManager.h:
2691         (WebKit::WebVideoFullscreenManager::invalidate):
2692         * WebProcess/cocoa/WebVideoFullscreenManager.mm:
2693         (WebKit::WebVideoFullscreenManager::~WebVideoFullscreenManager):
2694         (WebKit::WebVideoFullscreenManager::enterVideoFullscreenForVideoElement):
2695         (WebKit::WebVideoFullscreenManager::exitVideoFullscreenForVideoElement):
2696         (WebKit::WebVideoFullscreenManager::exitVideoFullscreenToModeWithoutAnimation):
2697         (WebKit::WebVideoFullscreenManager::hasVideoChanged):
2698         (WebKit::WebVideoFullscreenManager::videoDimensionsChanged):
2699         (WebKit::WebVideoFullscreenManager::didSetupFullscreen):
2700         (WebKit::WebVideoFullscreenManager::didEnterFullscreen):
2701         (WebKit::WebVideoFullscreenManager::didCleanupFullscreen):
2702         (WebKit::WebVideoFullscreenManager::fullscreenMayReturnToInline):
2703
2704 2017-06-26  Chris Dumez  <cdumez@apple.com>
2705
2706         Disable diagnostic logging in ephemeral sessions
2707         https://bugs.webkit.org/show_bug.cgi?id=173849
2708         <rdar://problem/32987341>
2709
2710         Reviewed by Geoffrey Garen.
2711
2712         * UIProcess/WebPageProxy.cpp:
2713         (WebKit::WebPageProxy::setDiagnosticLoggingClient):
2714         Construct a dummy logging client if the page's session is ephemeral.
2715
2716         (WebKit::WebPageProxy::logDiagnosticMessage):
2717         (WebKit::WebPageProxy::logDiagnosticMessageWithResult):
2718         (WebKit::WebPageProxy::logDiagnosticMessageWithValue):
2719         (WebKit::WebPageProxy::logDiagnosticMessageWithEnhancedPrivacy):
2720         Slight cleanup to make the code look a bit safer.
2721
2722 2017-06-26  Zan Dobersek  <zdobersek@igalia.com>
2723
2724         [GCrypt] Properly initialize libgcrypt before using it
2725         https://bugs.webkit.org/show_bug.cgi?id=173589
2726
2727         Reviewed by Michael Catanzaro.
2728
2729         Initialize libgcrypt in the Unix-specific main() entrypoint. This is early enough
2730         to ensure no other libgcrypt API function is invoked and to also ensure this is
2731         done in a thread-safe manner.
2732
2733         Initialization is initiated through the gcry_check_version() call. 16 kilobytes of
2734         secure memory is pre-allocated before we mark the initialization as complete, as
2735         recommended by the libgcrypt documentation.
2736
2737         * WebProcess/EntryPoint/unix/WebProcessMain.cpp:
2738         (main):
2739
2740 2017-06-26  Jeremy Jones  <jeremyj@apple.com>
2741
2742         When Mission Control closes fullscreen window, allow media element to update its state.
2743         https://bugs.webkit.org/show_bug.cgi?id=173671
2744         rdar://problem/32892671
2745
2746         Reviewed by Eric Carlson.
2747
2748         When Mission Control closes element fullscreen without an animation, we need to notify the
2749         media element that fullscreen has exited.
2750
2751         Without this change, the page still behaves like the element is in fullscreen.
2752
2753         * UIProcess/mac/WKFullScreenWindowController.mm:
2754         (-[WKFullScreenWindowController beganExitFullScreenWithInitialFrame:finalFrame:]):
2755         (-[WKFullScreenWindowController finishedExitFullScreenAnimation:]):
2756
2757 2017-06-26  Wenson Hsieh  <wenson_hsieh@apple.com>
2758
2759         [iOS DnD] [WK2] Beginning a drag session should prevent clicking via long press
2760         https://bugs.webkit.org/show_bug.cgi?id=173838
2761
2762         Reviewed by Tim Horton.
2763
2764         After r218579, WebKit no longer attempts to replace out-of-the-box UIKit long-press/drag lift disambiguation by
2765         firing events immediately. However, this means that dragging will defer the highlight long press gesture
2766         recognizer until dragging ends rather than cancel it immediately, which causes WKContentView to dispatch a
2767         synthetic click immediately upon lift. To fix this, we should bail out of the highlight long press gesture when
2768         beginning a drag.
2769
2770         * UIProcess/ios/WKContentViewInteraction.mm:
2771         (-[WKContentView _dragInteraction:prepareForSession:completion:]):
2772
2773 2017-06-26  Konstantin Tokarev  <annulen@yandex.ru>
2774
2775         Unreviewed, add missing header icncludes
2776
2777         * WebProcess/soup/WebKitSoupRequestInputStream.cpp:
2778
2779 2017-06-26  Konstantin Tokarev  <annulen@yandex.ru>
2780
2781         [GTK] Unreviewed, added missing includes to fix debug build
2782
2783         * NetworkProcess/NetworkSession.cpp:
2784
2785 2017-06-25  Konstantin Tokarev  <annulen@yandex.ru>
2786
2787         Remove excessive headers from WebCore/platform
2788         https://bugs.webkit.org/show_bug.cgi?id=173822
2789
2790         Reviewed by Tim Horton.
2791
2792         * WebProcess/WebCoreSupport/SessionStateConversion.cpp:
2793
2794 2017-06-25  Michael Catanzaro  <mcatanzaro@igalia.com>
2795
2796         Unreviewed, rolling out r215190.
2797
2798         Broke product select element on GNOME Bugzilla
2799
2800         Reverted changeset:
2801
2802         "[GTK] Misplaced right click menu on web page due to
2803         deprecated gtk_menu_popup()"
2804         https://bugs.webkit.org/show_bug.cgi?id=170553
2805         http://trac.webkit.org/changeset/215190
2806
2807 2017-06-25  Michael Catanzaro  <mcatanzaro@igalia.com>
2808
2809         [GTK][WPE] Unreviewed, fix typo in translatable string
2810
2811         Thanks to Yuri Chornoivan for reporting this typo.
2812
2813         * UIProcess/API/glib/WebKitWebView.cpp:
2814         (webkit_web_view_class_init):
2815
2816 2017-06-25  Konstantin Tokarev  <annulen@yandex.ru>
2817
2818         Remove excessive headers from JavaScriptCore
2819         https://bugs.webkit.org/show_bug.cgi?id=173812
2820
2821         Reviewed by Darin Adler.
2822
2823         * WebProcess/Plugins/Netscape/NPJSObject.cpp:
2824
2825 2017-06-24  Chris Dumez  <cdumez@apple.com>
2826
2827         [WK2] Make sure encodeClientTypesAndData() / decodeClientTypesAndData() match exactly
2828         https://bugs.webkit.org/show_bug.cgi?id=173813
2829
2830         Reviewed by Ryosuke Niwa.
2831
2832         Make sure encodeClientTypesAndData() / decodeClientTypesAndData() match exactly. The previous
2833         IPC encoder code would assume types and data vector have the same length. It would first encode
2834         the length of data using |data.size()| but then would encode types.size() values from the
2835         data vector. While there are debug assertions to ensure both vectors have the same size, this
2836         seems unnecessarily fragile in release builds. If both vectors happen to have different sizes,
2837         this will lead to weird IPC bugs.
2838
2839         * Shared/WebCoreArgumentCoders.cpp:
2840         (IPC::encodeClientTypesAndData):
2841         (IPC::decodeClientTypesAndData):
2842
2843 2017-06-24  Michael Catanzaro  <mcatanzaro@igalia.com>
2844
2845         [GTK] Introspection: webkit_web_view_new_with_related_view needs to be marked as a constructor
2846         https://bugs.webkit.org/show_bug.cgi?id=173765
2847
2848         Reviewed by Carlos Garcia Campos.
2849
2850         Because the first parameter to this WebKitWebView constructor is itself a WebKitWebView,
2851         the gi-scanner's heuristics decide that it's probably an object method rather than a
2852         constructor, resulting in improper introspection generation. Annotate it with (constructor)
2853         to override this behavior.
2854
2855         * UIProcess/API/gtk/WebKitWebViewGtk.cpp:
2856         * UIProcess/API/wpe/WebKitWebViewWPE.cpp:
2857
2858 2017-06-24  Commit Queue  <commit-queue@webkit.org>
2859
2860         Unreviewed, rolling out r218785.
2861         https://bugs.webkit.org/show_bug.cgi?id=173808
2862
2863         This change broke the macOS Sierra build (Requested by
2864         annulen|home on #webkit).
2865
2866         Reverted changeset:
2867
2868         "Removed unused lambda captures from WebKit2"
2869         https://bugs.webkit.org/show_bug.cgi?id=173555
2870         http://trac.webkit.org/changeset/218785
2871
2872 2017-06-24  Konstantin Tokarev  <annulen@yandex.ru>
2873
2874         Removed unused lambda captures from WebKit2
2875         https://bugs.webkit.org/show_bug.cgi?id=173555
2876
2877         Reviewed by Alex Christensen.
2878
2879         * UIProcess/Network/NetworkProcessProxy.cpp:
2880         (WebKit::NetworkProcessProxy::fetchWebsiteData):
2881         (WebKit::NetworkProcessProxy::deleteWebsiteData):
2882         (WebKit::NetworkProcessProxy::deleteWebsiteDataForOrigins):
2883         * UIProcess/WebProcessProxy.cpp:
2884         (WebKit::WebProcessProxy::fetchWebsiteData):
2885         (WebKit::WebProcessProxy::deleteWebsiteData):
2886         (WebKit::WebProcessProxy::deleteWebsiteDataForOrigins):
2887         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
2888         (WebKit::WebsiteDataStore::topPrivatelyControlledDomainsWithWebsiteData):
2889
2890 2017-06-23  Chris Dumez  <cdumez@apple.com>
2891
2892         Add release assertion to make sure callbackIdentifier is not 0 in DocumentLoader::finishedLoadingIcon()
2893         https://bugs.webkit.org/show_bug.cgi?id=173792
2894
2895         Reviewed by Ryosuke Niwa.
2896
2897         Add release assertion to make sure callbackIdentifier is not 0 in DocumentLoader::finishedLoadingIcon()
2898         as this could cause HashTable corruption on WebPageProxy side.
2899
2900         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
2901         (WebKit::WebFrameLoaderClient::finishedLoadingIcon):
2902         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
2903
2904 2017-06-23  Chris Dumez  <cdumez@apple.com>
2905
2906         Stop passing Vector by value in WebProcessProxy::deleteWebsiteDataForTopPrivatelyControlledDomainsInAllPersistentDataStores()
2907         https://bugs.webkit.org/show_bug.cgi?id=173782
2908
2909         Reviewed by Brent Fulgham.
2910
2911         * UIProcess/WebProcessProxy.cpp:
2912         (WebKit::WebProcessProxy::deleteWebsiteDataForTopPrivatelyControlledDomainsInAllPersistentDataStores):
2913         * UIProcess/WebProcessProxy.h:
2914         * UIProcess/WebResourceLoadStatisticsStore.cpp:
2915         (WebKit::WebResourceLoadStatisticsStore::removeDataRecords):
2916
2917 2017-06-23  Chris Dumez  <cdumez@apple.com>
2918
2919         Avoid copying HashSet to Vector in WebPageProxy::clearLoadDependentCallbacks()
2920         https://bugs.webkit.org/show_bug.cgi?id=173786
2921
2922         Reviewed by Geoffrey Garen.
2923
2924         Avoid copying HashSet to Vector in WebPageProxy::clearLoadDependentCallbacks().
2925         Instead, just move the HashSet and iterate on that. This is OK since we were
2926         clearing the HashSet right after copying it to the vector anyway.
2927
2928         * UIProcess/WebPageProxy.cpp:
2929         (WebKit::WebPageProxy::clearLoadDependentCallbacks):
2930
2931 2017-06-23  Chris Dumez  <cdumez@apple.com>
2932
2933         Unreviewed, fix Debug build after r218763
2934
2935         * NetworkProcess/NetworkDataTask.cpp:
2936
2937 2017-06-23  Chris Dumez  <cdumez@apple.com>
2938
2939         Add more release logging for process assertions
2940         https://bugs.webkit.org/show_bug.cgi?id=173624
2941         <rdar://problem/32412701>
2942
2943         Reviewed by Geoffrey Garen.
2944
2945         Add more release logging for process assertions to help debug issues such
2946         as <rdar://problem/32412701>.
2947
2948         * UIProcess/ProcessThrottler.cpp:
2949         (WebKit::ProcessThrottler::didConnectToProcess):
2950         * UIProcess/ios/ProcessAssertionIOS.mm:
2951         (WebKit::ProcessAssertion::ProcessAssertion):
2952         (WebKit::ProcessAssertion::~ProcessAssertion):
2953         (WebKit::ProcessAssertion::setState):
2954
2955 2017-06-23  Chris Dumez  <cdumez@apple.com>
2956
2957         Consistently use RunLoop::isMain() in WebKit2
2958         https://bugs.webkit.org/show_bug.cgi?id=173745
2959         <rdar://problem/32936527>
2960
2961         Reviewed by Brent Fulgham.
2962
2963         Consistently use RunLoop:isMain() on WebKit2 instead of WTF::isMainThread().
2964         WTF::isMainThread() returns true for the WebThread instead of the UIThread
2965         in WebKit1. Therefore WTF::isMainThread() is unsafe to use in the UIProcess
2966         as the application may be using WebKit1 as well and have a WebThread.
2967
2968         Technically, we only *need* to move from WTF::isMainThread() to
2969         RunLoop::isMain() in the UIProcess code but I ported all of WebKit2 for
2970         consistency. RunLoop::isMain() is always safe in WebKit2.
2971
2972         * NetworkProcess/NetworkDataTask.cpp:
2973         (WebKit::NetworkDataTask::NetworkDataTask):
2974         (WebKit::NetworkDataTask::~NetworkDataTask):
2975         * NetworkProcess/NetworkDataTaskBlob.cpp:
2976         (WebKit::NetworkDataTaskBlob::getSizeForNext):
2977         (WebKit::NetworkDataTaskBlob::didGetSize):
2978         (WebKit::NetworkDataTaskBlob::seek):
2979         (WebKit::NetworkDataTaskBlob::read):
2980         * NetworkProcess/NetworkLoad.cpp:
2981         (WebKit::NetworkLoad::didReceiveResponseNetworkSession):
2982         (WebKit::NetworkLoad::notifyDidReceiveResponse):
2983         * NetworkProcess/NetworkSession.cpp:
2984         (WebKit::NetworkSession::defaultSession):
2985         * NetworkProcess/cache/NetworkCache.cpp:
2986         (WebKit::NetworkCache::resourceType):
2987         (WebKit::NetworkCache::Cache::initialize):
2988         * NetworkProcess/cache/NetworkCacheIOChannelSoup.cpp:
2989         (WebKit::NetworkCache::IOChannel::read):
2990         (WebKit::NetworkCache::IOChannel::readSyncInThread):
2991         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
2992         (-[WKNetworkSessionDelegate URLSession:dataTask:didReceiveResponse:completionHandler:]):
2993         (WebKit::NetworkSessionCocoa::defaultSession):
2994         (WebKit::NetworkSessionCocoa::dataTaskForIdentifier):
2995         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
2996         (WebKit::CoordinatedGraphicsScene::dispatchOnMainThread):
2997         (WebKit::CoordinatedGraphicsScene::syncRemoteContent):
2998         (WebKit::CoordinatedGraphicsScene::detach):
2999         (WebKit::CoordinatedGraphicsScene::appendUpdate):
3000         * Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.cpp:
3001         (WebKit::WorkQueuePool::singleton):
3002         (WebKit::WorkQueuePool::dispatch):
3003         (WebKit::CompositingRunLoop::~CompositingRunLoop):
3004         (WebKit::CompositingRunLoop::performTask):
3005         (WebKit::CompositingRunLoop::performTaskSync):
3006         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
3007         (WebKit::ThreadedCompositor::createGLContext):
3008         (WebKit::ThreadedCompositor::renderNextFrame):
3009         (WebKit::ThreadedCompositor::commitScrollOffset):
3010         (WebKit::ThreadedCompositor::updateSceneState):
3011         (WebKit::ThreadedCompositor::releaseUpdateAtlases):
3012         (WebKit::ThreadedCompositor::frameComplete):
3013         * Shared/Plugins/NPObjectProxy.cpp:
3014         (WebKit::NPObjectProxy::NP_Deallocate):
3015         * UIProcess/Storage/LocalStorageDatabaseTracker.cpp:
3016         (WebKit::LocalStorageDatabaseTracker::deleteDatabasesModifiedSince):
3017         * UIProcess/WebProcessProxy.cpp:
3018         (WebKit::WebProcessProxy::deleteWebsiteDataForTopPrivatelyControlledDomainsInAllPersistentDataStores):
3019         (WebKit::WebProcessProxy::topPrivatelyControlledDomainsWithWebiteData):
3020         * UIProcess/WebResourceLoadStatisticsStore.cpp:
3021         (WebKit::WebResourceLoadStatisticsStore::removeDataRecords):
3022         (WebKit::WebResourceLoadStatisticsStore::registerSharedResourceLoadObserver):
3023         (WebKit::WebResourceLoadStatisticsStore::writeStoreToDisk):
3024         (WebKit::WebResourceLoadStatisticsStore::writeEncoderToDisk):
3025         * UIProcess/ios/WKPDFView.mm:
3026         (-[WKPDFView _highlightLinkAnnotation:forDuration:completionHandler:]):
3027         * UIProcess/ios/forms/WKFileUploadPanel.mm:
3028         (-[WKFileUploadPanel _uploadItemForImageData:imageName:successBlock:failureBlock:]):
3029         * WebProcess/WebCoreSupport/soup/WebFrameNetworkingContext.cpp:
3030         (WebKit::WebFrameNetworkingContext::ensurePrivateBrowsingSession):
3031         * WebProcess/soup/WebKitSoupRequestInputStream.cpp:
3032         (webkitSoupRequestInputStreamReadAsync):
3033
3034 2017-06-23  David Kilzer  <ddkilzer@apple.com>
3035
3036         v3: REGRESSION (r218419): 3 NSMutableDictionary leaks calling -[WKProcessPool _pluginLoadClientPolicies]
3037         <https://webkit.org/b/173689>
3038
3039         Reviewed by Tim Horton.
3040
3041         * UIProcess/API/Cocoa/WKProcessPool.mm:
3042         (policiesHashMapToDictionary): Use adoptNS().get() to avoid
3043         dumping objects into autoreleasepools unnecessarily.
3044         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
3045         (-[WKProcessPool _pluginLoadClientPolicies]): Add back 'copy'
3046         attribute to document that we're returning a new object on each
3047         invocation.  I shouldn't have removed it in the v2 patch.
3048
3049 2017-06-23  Youenn Fablet  <youenn@apple.com>
3050
3051         LibWebRTCSocketClient should not destroy its socket within signalClose callback
3052         https://bugs.webkit.org/show_bug.cgi?id=173739
3053
3054         Reviewed by Brent Fulgham.
3055
3056         * NetworkProcess/webrtc/LibWebRTCSocketClient.cpp:
3057         (WebKit::LibWebRTCSocketClient::signalClose): Destroy 'this' asynchronously to make the caller of signalClose valid until it is not used.
3058
3059 2017-06-23  Chris Dumez  <cdumez@apple.com>
3060
3061         Fix typo in WebProcessProxy::topPrivatelyControlledDomainsWithWebsiteData() naming
3062         https://bugs.webkit.org/show_bug.cgi?id=173781
3063
3064         Reviewed by Brent Fulgham.
3065
3066         * UIProcess/WebProcessProxy.cpp:
3067         (WebKit::WebProcessProxy::topPrivatelyControlledDomainsWithWebsiteData):
3068         (WebKit::WebProcessProxy::topPrivatelyControlledDomainsWithWebiteData): Deleted.
3069         * UIProcess/WebProcessProxy.h:
3070         * UIProcess/WebResourceLoadStatisticsStore.cpp:
3071         (WebKit::WebResourceLoadStatisticsStore::grandfatherExistingWebsiteData):
3072
3073 2017-06-23  Jer Noble  <jer.noble@apple.com>
3074
3075         [WK2] Support -[WebAVPlayerController setMuted:]
3076         https://bugs.webkit.org/show_bug.cgi?id=173777
3077
3078         Reviewed by Eric Carlson.
3079
3080         Add a SetMuted message to WebPlaybackSessionManager.
3081
3082         Drive-by refactoring: Because the new setMuted() method conflicts with the existing setMuted()
3083         notification, do a giant rename of the notificiation methods from set(Value) -> (value)Changed.
3084
3085         * UIProcess/Cocoa/WebPlaybackSessionManagerProxy.h:
3086         * UIProcess/Cocoa/WebPlaybackSessionManagerProxy.messages.in:
3087         * UIProcess/Cocoa/WebPlaybackSessionManagerProxy.mm:
3088         (WebKit::WebPlaybackSessionModelContext::setMuted):
3089         (WebKit::WebPlaybackSessionModelContext::playbackStartedTimeChanged):
3090         (WebKit::WebPlaybackSessionModelContext::durationChanged):
3091         (WebKit::WebPlaybackSessionModelContext::currentTimeChanged):
3092         (WebKit::WebPlaybackSessionModelContext::bufferedTimeChanged):
3093         (WebKit::WebPlaybackSessionModelContext::rateChanged):
3094         (WebKit::WebPlaybackSessionModelContext::seekableRangesChanged):
3095         (WebKit::WebPlaybackSessionModelContext::canPlayFastReverseChanged):
3096         (WebKit::WebPlaybackSessionModelContext::audioMediaSelectionOptionsChanged):
3097         (WebKit::WebPlaybackSessionModelContext::legibleMediaSelectionOptionsChanged):
3098         (WebKit::WebPlaybackSessionModelContext::audioMediaSelectionIndexChanged):
3099         (WebKit::WebPlaybackSessionModelContext::legibleMediaSelectionIndexChanged):
3100         (WebKit::WebPlaybackSessionModelContext::externalPlaybackChanged):
3101         (WebKit::WebPlaybackSessionModelContext::wirelessVideoPlaybackDisabledChanged):
3102         (WebKit::WebPlaybackSessionModelContext::mutedChanged):
3103         (WebKit::WebPlaybackSessionManagerProxy::currentTimeChanged):
3104         (WebKit::WebPlaybackSessionManagerProxy::bufferedTimeChanged):
3105         (WebKit::WebPlaybackSessionManagerProxy::seekableRangesVectorChanged):
3106         (WebKit::WebPlaybackSessionManagerProxy::canPlayFastReverseChanged):
3107         (WebKit::WebPlaybackSessionManagerProxy::audioMediaSelectionOptionsChanged):
3108         (WebKit::WebPlaybackSessionManagerProxy::legibleMediaSelectionOptionsChanged):
3109         (WebKit::WebPlaybackSessionManagerProxy::audioMediaSelectionIndexChanged):
3110         (WebKit::WebPlaybackSessionManagerProxy::legibleMediaSelectionIndexChanged):
3111         (WebKit::WebPlaybackSessionManagerProxy::externalPlaybackPropertiesChanged):
3112         (WebKit::WebPlaybackSessionManagerProxy::wirelessVideoPlaybackDisabledChanged):
3113         (WebKit::WebPlaybackSessionManagerProxy::mutedChanged):
3114         (WebKit::WebPlaybackSessionManagerProxy::durationChanged):
3115         (WebKit::WebPlaybackSessionManagerProxy::playbackStartedTimeChanged):
3116         (WebKit::WebPlaybackSessionManagerProxy::rateChanged):
3117         (WebKit::WebPlaybackSessionManagerProxy::setMuted):
3118         (WebKit::WebPlaybackSessionManagerProxy::controlsManagerInterface):
3119         (WebKit::WebPlaybackSessionModelContext::setPlaybackStartedTime): Deleted.
3120         (WebKit::WebPlaybackSessionModelContext::setDuration): Deleted.
3121         (WebKit::WebPlaybackSessionModelContext::setCurrentTime): Deleted.
3122         (WebKit::WebPlaybackSessionModelContext::setBufferedTime): Deleted.
3123         (WebKit::WebPlaybackSessionModelContext::setRate): Deleted.
3124         (WebKit::WebPlaybackSessionModelContext::setSeekableRanges): Deleted.
3125         (WebKit::WebPlaybackSessionModelContext::setCanPlayFastReverse): Deleted.
3126         (WebKit::WebPlaybackSessionModelContext::setAudioMediaSelectionOptions): Deleted.
3127         (WebKit::WebPlaybackSessionModelContext::setLegibleMediaSelectionOptions): Deleted.
3128         (WebKit::WebPlaybackSessionModelContext::setAudioMediaSelectionIndex): Deleted.
3129         (WebKit::WebPlaybackSessionModelContext::setLegibleMediaSelectionIndex): Deleted.
3130         (WebKit::WebPlaybackSessionModelContext::setExternalPlayback): Deleted.
3131         (WebKit::WebPlaybackSessionModelContext::setWirelessVideoPlaybackDisabled): Deleted.
3132         (WebKit::WebPlaybackSessionManagerProxy::setCurrentTime): Deleted.
3133         (WebKit::WebPlaybackSessionManagerProxy::setBufferedTime): Deleted.
3134         (WebKit::WebPlaybackSessionManagerProxy::setSeekableRangesVector): Deleted.
3135         (WebKit::WebPlaybackSessionManagerProxy::setCanPlayFastReverse): Deleted.
3136         (WebKit::WebPlaybackSessionManagerProxy::setAudioMediaSelectionOptions): Deleted.
3137         (WebKit::WebPlaybackSessionManagerProxy::setLegibleMediaSelectionOptions): Deleted.
3138         (WebKit::WebPlaybackSessionManagerProxy::setAudioMediaSelectionIndex): Deleted.
3139         (WebKit::WebPlaybackSessionManagerProxy::setLegibleMediaSelectionIndex): Deleted.
3140         (WebKit::WebPlaybackSessionManagerProxy::setExternalPlaybackProperties): Deleted.
3141         (WebKit::WebPlaybackSessionManagerProxy::setWirelessVideoPlaybackDisabled): Deleted.
3142         (WebKit::WebPlaybackSessionManagerProxy::setDuration): Deleted.
3143         (WebKit::WebPlaybackSessionManagerProxy::setPlaybackStartedTime): Deleted.
3144         (WebKit::WebPlaybackSessionManagerProxy::setRate): Deleted.
3145         * WebProcess/cocoa/WebPlaybackSessionManager.h:
3146         * WebProcess/cocoa/WebPlaybackSessionManager.messages.in:
3147         * WebProcess/cocoa/WebPlaybackSessionManager.mm:
3148         (WebKit::WebPlaybackSessionManager::durationChanged):
3149         (WebKit::WebPlaybackSessionManager::currentTimeChanged):
3150         (WebKit::WebPlaybackSessionManager::bufferedTimeChanged):
3151         (WebKit::WebPlaybackSessionManager::playbackStartedTimeChanged):
3152         (WebKit::WebPlaybackSessionManager::rateChanged):
3153         (WebKit::WebPlaybackSessionManager::seekableRangesChanged):
3154         (WebKit::WebPlaybackSessionManager::canPlayFastReverseChanged):
3155         (WebKit::WebPlaybackSessionManager::audioMediaSelectionOptionsChanged):
3156         (WebKit::WebPlaybackSessionManager::legibleMediaSelectionOptionsChanged):
3157         (WebKit::WebPlaybackSessionManager::externalPlaybackChanged):
3158         (WebKit::WebPlaybackSessionManager::audioMediaSelectionIndexChanged):
3159         (WebKit::WebPlaybackSessionManager::legibleMediaSelectionIndexChanged):
3160         (WebKit::WebPlaybackSessionManager::wirelessVideoPlaybackDisabledChanged):
3161         (WebKit::WebPlaybackSessionManager::mutedChanged):
3162         (WebKit::WebPlaybackSessionManager::setMuted):
3163
3164 2017-06-23  Frederic Wang  <fwang@igalia.com>
3165
3166         Use window.internals instead of overridePreference to set WebCore settings in tests
3167         https://bugs.webkit.org/show_bug.cgi?id=173714
3168
3169         Reviewed by Simon Fraser.
3170
3171         This commit remove preference to settings mapping in overrideBoolPreferenceForTestRunner that
3172         are no longer necessary after the changes done in LayoutTests.
3173
3174         * WebProcess/InjectedBundle/InjectedBundle.cpp:
3175         (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner): Remove mapping for preferences
3176         that no longer require testRunner.overridePreference calls in tests.
3177
3178 2017-06-23  Brent Fulgham  <bfulgham@apple.com>
3179
3180         Avoid moving the same vector multiple times
3181         https://bugs.webkit.org/show_bug.cgi?id=173748
3182         <rdar://problem/32936804>
3183
3184         Reviewed by Chris Dumez.
3185
3186         We discovered that a Vector<String> was being moved inside a loop, causing it to be moved more than once.
3187         We should never do this!
3188
3189         * UIProcess/WebProcessProxy.cpp:
3190         (WebKit::WebProcessProxy::deleteWebsiteDataForTopPrivatelyControlledDomainsInAllPersistentDataStores):
3191         Do not perform a move at each step of the iteration.
3192         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
3193         (WebKit::WebsiteDataStore::fetchDataForTopPrivatelyControlledDomains): Receive vector of top privately
3194         controlled domains as a const reference. Copy this vector into the completion handler. Do not move
3195         origins out of the vector in the inner loop.
3196         (WebKit::WebsiteDataStore::removeDataForTopPrivatelyControlledDomains): Receive vector of top privately
3197         controlled domains as a const reference.
3198         * UIProcess/WebsiteData/WebsiteDataStore.h:
3199
3200 2017-06-23  Alex Christensen  <achristensen@webkit.org>
3201
3202         Add SPI to WKURLSchemeTask for redirection
3203         https://bugs.webkit.org/show_bug.cgi?id=173730
3204
3205         Reviewed by Brady Eidson.
3206
3207         This is needed for testing an upcoming fix for redirect callbacks, and it might be
3208         necessary for loading with custom schemes in general. Right now just responding with
3209          an HTTP 301/302/307/308 response code doesn't work because there is nothing that
3210         synthesizes an NSURLRequest from the Location header like we do in 
3211         SynchronousResourceHandleCFURLConnectionDelegate::willSendRequest et al. for HSTS, 
3212         and that would require using an NSHTTPURLResponse for non-HTTP responses, which is 
3213         conceptually wrong.  Instead of waiting for a completion handler in the API, we are
3214         following the pattern of WKNavigationDelegate.didReceiveServerRedirectForProvisionalNavigation
3215         and allowing the SPI to indicate that a redirect has happened to update the state of
3216         WebKit, but not allowing the SPI to wait for a processed request and slow down loading.
3217
3218         This adds WKURLSchemeTaskPrivate._didPerformRedirection which is covered by new API tests.
3219
3220         * UIProcess/API/Cocoa/WKURLSchemeTask.mm:
3221         (raiseExceptionIfNecessary):
3222         (-[WKURLSchemeTaskImpl _didPerformRedirection:newRequest:completionHandler:]):
3223         * UIProcess/API/Cocoa/WKURLSchemeTaskInternal.h:
3224         * UIProcess/API/Cocoa/WKURLSchemeTaskPrivate.h: Added.
3225         * UIProcess/WebPageProxy.cpp:
3226         (WebKit::WebPageProxy::startURLSchemeTask):
3227         (WebKit::WebPageProxy::stopURLSchemeTask):
3228         * UIProcess/WebPageProxy.h:
3229         * UIProcess/WebPageProxy.messages.in:
3230         * UIProcess/WebURLSchemeHandler.cpp:
3231         (WebKit::WebURLSchemeHandler::startTask):
3232         (WebKit::WebURLSchemeHandler::stopTask):
3233         * UIProcess/WebURLSchemeHandler.h:
3234         * UIProcess/WebURLSchemeTask.cpp:
3235         (WebKit::WebURLSchemeTask::didReceiveResponse): Deleted.
3236         (WebKit::WebURLSchemeTask::didReceiveData): Deleted.
3237         (WebKit::WebURLSchemeTask::didComplete): Deleted.
3238         * UIProcess/WebURLSchemeTask.h:
3239         * WebKit2.xcodeproj/project.pbxproj:
3240         * WebProcess/WebPage/WebPage.cpp:
3241         (WebKit::WebPage::urlSchemeTaskDidPerformRedirection):
3242         * WebProcess/WebPage/WebPage.h:
3243         * WebProcess/WebPage/WebPage.messages.in:
3244         * WebProcess/WebPage/WebURLSchemeHandlerProxy.cpp:
3245         (WebKit::WebURLSchemeHandlerProxy::taskDidPerformRedirection):
3246         * WebProcess/WebPage/WebURLSchemeHandlerProxy.h:
3247         * WebProcess/WebPage/WebURLSchemeTaskProxy.cpp:
3248         (WebKit::WebURLSchemeTaskProxy::didPerformRedirection):
3249         * WebProcess/WebPage/WebURLSchemeTaskProxy.h:
3250
3251 2017-06-23  Brent Fulgham  <bfulgham@apple.com>
3252
3253         [WK2][macOS] Support Mac Mini Flash Player Features
3254         https://bugs.webkit.org/show_bug.cgi?id=173581
3255         <rdar://problem/32804073>
3256
3257         Reviewed by Dean Jackson.
3258
3259         Revise the sandboxes for additional IOKit properties identified during Flash video player
3260         testing.
3261
3262         * PluginProcess/mac/com.apple.WebKit.plugin-common.sb.in:
3263         * WebProcess/com.apple.WebProcess.sb.in:
3264
3265 2017-06-23  Zan Dobersek  <zdobersek@igalia.com>
3266
3267         [CoordinatedGraphics] Clean up type aliases in CoordinatedGraphicsScene
3268         https://bugs.webkit.org/show_bug.cgi?id=173764
3269
3270         Reviewed by Carlos Garcia Campos.
3271
3272         Drop the various type aliases created in the CoordinatedGraphicsScene
3273         class. We can leave without these by leveraging `auto` where necessary.
3274
3275         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
3276         (WebKit::CoordinatedGraphicsScene::updateTilesIfNeeded):
3277         (WebKit::CoordinatedGraphicsScene::updateImageBacking):
3278         (WebKit::CoordinatedGraphicsScene::clearImageBackingContents):
3279         (WebKit::CoordinatedGraphicsScene::assignImageBackingToLayer):
3280         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.h:
3281
3282 2017-06-23  Carlos Garcia Campos  <cgarcia@igalia.com>
3283
3284         [WPE] Crash in wpe_view_backend_get_renderer_host_fd
3285         https://bugs.webkit.org/show_bug.cgi?id=173760
3286
3287         Reviewed by Žan Doberšek.
3288
3289         This can happen if views are created and destroyed quickly. The problem is that CompositingManagerProxy adds a
3290         message receiver but never removes it, so it's possible that the message arrives right after the view has been
3291         destroyed. This is happening most of the times running /wpe/WebKitAutomationSession/request-session that creates
3292         3 web views in a row that are deleted when the test finishes.
3293
3294         Fixes /wpe/WebKitAutomationSession/request-session.
3295
3296         * UIProcess/API/wpe/CompositingManagerProxy.cpp:
3297         (WebKit::CompositingManagerProxy::finalize): Remove the message handler.
3298         * UIProcess/API/wpe/CompositingManagerProxy.h:
3299         * UIProcess/API/wpe/WPEView.cpp:
3300         (WKWPE::View::~View): Call CompositingManagerProxy::finalize().
3301
3302 2017-06-23  Carlos Garcia Campos  <cgarcia@igalia.com>
3303
3304         [WPE] User script messages don't work
3305         https://bugs.webkit.org/show_bug.cgi?id=173712
3306
3307         Reviewed by Žan Doberšek.
3308
3309         When a user script message is received we need to create a WebKitJavascriptResult to deserialize the script
3310         value. WebKitJavascriptResult is created with a WebKitWebView for two reasons: to get its JavaScript global
3311         context and to take a reference that ensures the JavaScript context will be alive while the results is
3312         alive. However, we could create the WebKitJavascriptResult with the JavaScript global context and take a
3313         reference of the context itself. This way we don't need to access the WebKitWebView from the
3314         WebScriptMessageHandler client. But we still need access to the JavaScript context, so I've added a
3315         javascriptGlobalContext() method to WebPageProxy for GTK+ and WPE that is implemented from the page client.
3316
3317         Fixes /wpe/WebKitUserContentManager/script-message-received.
3318
3319         * UIProcess/API/glib/WebKitJavascriptResult.cpp:
3320         (_WebKitJavascriptResult::_WebKitJavascriptResult): Create the WebKitJavascriptResult with a JSGlobalContextRef
3321         instead of a WEbKitWebView.
3322         (webkitJavascriptResultCreate): Pass the js context to the constructor.
3323         (webkit_javascript_result_get_global_context): Return the js context.
3324         * UIProcess/API/glib/WebKitJavascriptResultPrivate.h:
3325         * UIProcess/API/glib/WebKitUserContentManager.cpp:
3326         * UIProcess/API/glib/WebKitWebView.cpp:
3327         (_WebKitWebViewPrivate::~_WebKitWebViewPrivate): Use JSRetainPtr
3328         (webkit_web_view_get_javascript_global_context):
3329         (webkitWebViewRunJavaScriptCallback):
3330         * UIProcess/API/gtk/PageClientImpl.cpp:
3331         (WebKit::PageClientImpl::javascriptGlobalContext):
3332         * UIProcess/API/gtk/PageClientImpl.h:
3333         * UIProcess/API/wpe/APIViewClient.h:
3334         (API::ViewClient::javascriptGlobalContext):
3335         * UIProcess/API/wpe/PageClientImpl.cpp:
3336         (WebKit::PageClientImpl::javascriptGlobalContext):
3337         * UIProcess/API/wpe/PageClientImpl.h:
3338         * UIProcess/API/wpe/WPEView.cpp:
3339         (WKWPE::View::javascriptGlobalContext):
3340         * UIProcess/API/wpe/WPEView.h:
3341         * UIProcess/PageClient.h:
3342         (WebKit::PageClient::javascriptGlobalContext):
3343         * UIProcess/WebPageProxy.h:
3344         * UIProcess/gtk/WebPageProxyGtk.cpp:
3345         (WebKit::WebPageProxy::javascriptGlobalContext):
3346         * UIProcess/wpe/WebPageProxyWPE.cpp:
3347         (WebKit::WebPageProxy::javascriptGlobalContext):
3348
3349 2017-06-22  Wenson Hsieh  <wenson_hsieh@apple.com>
3350
3351         [iOS DnD] [WK2] Enable in-app dragging from WKWebView on the phone
3352         https://bugs.webkit.org/show_bug.cgi?id=173736
3353         <rdar://problem/32873545>
3354
3355         Reviewed by Tim Horton.
3356
3357         Flip the drag interaction enabled switch on when initializing WKContentView's UIDragInteraction.
3358
3359         * UIProcess/ios/WKContentViewInteraction.mm:
3360         (-[WKContentView setupDataInteractionDelegates]):
3361
3362 2017-06-22  Chris Dumez  <cdumez@apple.com>
3363
3364         isMainThread() assertions in CallbackMap are incorrectly failing on some iOS apps
3365         https://bugs.webkit.org/show_bug.cgi?id=173738
3366         <rdar://problem/32923933>
3367
3368         Reviewed by Brady Eidson.
3369
3370         The assertions hit on certain iOS apps even though the crash traces clearly
3371         show them on the main thread. We have verified locally that RunLoop::isMain()
3372         propertly return true in this case (while WTF::isMainThread() returns false).
3373         Update the assertions to use RunLoop::isMain() instead.
3374
3375         * UIProcess/GenericCallback.h:
3376         (WebKit::CallbackMap::put):
3377         (WebKit::CallbackMap::take):
3378         (WebKit::CallbackMap::invalidate):
3379
3380 2017-06-22  Daniel Bates  <dabates@apple.com>
3381
3382         Make FrameLoadRequest a move-only type
3383         https://bugs.webkit.org/show_bug.cgi?id=173682
3384
3385         Reviewed by Alex Christensen and Darin Adler.
3386
3387         A FrameLoadRequest groups together the information to perform a load into a single object
3388         that is more manageable to pass around than its constituent parts. Code that receives a
3389         FrameLoadRequest is expected to extract out the information it needs to complete its task.
3390         And it does not make sense to re-use the same FrameLoadRequest object for more than one
3391         load. Therefore, it is sufficient to make FrameLoadRequest a move-only type.
3392
3393         * WebProcess/Plugins/PluginView.cpp:
3394         (WebKit::PluginView::URLRequest::create):
3395         (WebKit::PluginView::URLRequest::URLRequest):
3396         (WebKit::PluginView::performFrameLoadURLRequest):
3397         (WebKit::PluginView::loadURL):
3398         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
3399         (WebKit::WebFrameLoaderClient::dispatchCreatePage):
3400         * WebProcess/WebPage/WebInspector.cpp:
3401         (WebKit::WebInspector::openInNewTab):
3402         * WebProcess/WebPage/WebPage.cpp:
3403         (WebKit::WebPage::loadRequest):
3404
3405 2017-06-22  Chris Dumez  <cdumez@apple.com>
3406
3407         Add release assertion in CallbackMap::invalidate()
3408         https://bugs.webkit.org/show_bug.cgi?id=173722
3409
3410         Reviewed by Brady Eidson.
3411
3412         Add release assertion in CallbackMap::invalidate() to make sure it is called on the main thread.
3413
3414         * UIProcess/GenericCallback.h:
3415         (WebKit::CallbackMap::invalidate):
3416
3417 2017-06-22  Brady Eidson  <beidson@apple.com>
3418
3419         Add some thread safety guards to GenericCallback.
3420         https://bugs.webkit.org/show_bug.cgi?id=173693
3421
3422         Reviewed by Sam Weinig.
3423
3424         A callback should be created, performed, invalidated, and/or destroyed all on the same thread.
3425         Let's write code to notify us if that doesn't happen.
3426
3427         * UIProcess/GenericCallback.h:
3428         (WebKit::GenericCallback::~GenericCallback):
3429         (WebKit::GenericCallback::performCallbackWithReturnValue):
3430         (WebKit::GenericCallback::invalidate):
3431
3432 2017-06-22  David Kilzer  <ddkilzer@apple.com>
3433
3434         v2: REGRESSION (r218419): 3 NSMutableDictionary leaks calling -[WKProcessPool _pluginLoadClientPolicies]
3435         <https://webkit.org/b/173689>
3436
3437         Reviewed by Chris Dumez.
3438
3439         * UIProcess/API/Cocoa/WKProcessPool.mm:
3440         (policiesHashMapToDictionary): Use -dictionaryWithCapacity:
3441         instead of -new since the former returns an autoreleased object
3442         while the latter does not.  This has the added benefit of tuning
3443         the size of each NSMutableDictionary.
3444         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
3445         (-[WKProcessPool _pluginLoadClientPolicies]): Remove 'copy'
3446         attribute from @property declaration since it is read-only.
3447
3448 2017-06-22  Carlos Garcia Campos  <cgarcia@igalia.com>
3449
3450         [WPE] Downloads never have a web view associated in WPE
3451         https://bugs.webkit.org/show_bug.cgi?id=173709
3452
3453         Reviewed by Žan Doberšek.
3454
3455         Convert the WPE view client into an API client and add handleDownloadRequest(). WebKitWebView now uses it to
3456         associate itself to the download like the GTK+ port does.
3457
3458         * PlatformWPE.cmake:
3459         * UIProcess/API/C/wpe/WKView.cpp:
3460         (WKViewSetViewClient): Add C API client implementation here.
3461         * UIProcess/API/glib/WebKitWebView.cpp:
3462         (webkitWebViewConstructed): Set the view client in WPE.
3463         * UIProcess/API/wpe/APIViewClient.h: Renamed from Source/WebKit2/UIProcess/API/wpe/WPEViewClient.h.
3464         (API::ViewClient::frameDisplayed):
3465         (API::ViewClient::handleDownloadRequest):
3466         * UIProcess/API/wpe/PageClientImpl.cpp:
3467         (WebKit::PageClientImpl::handleDownloadRequest): Call WKWPE::View::handleDownloadRequest().
3468         * UIProcess/API/wpe/WPEView.cpp:
3469         (WKWPE::View::View): Initialize the view client.
3470         (WKWPE::View::setClient): Set or reset the client.
3471         (WKWPE::View::handleDownloadRequest): Notify the client.
3472         * UIProcess/API/wpe/WPEView.h:
3473         * UIProcess/API/wpe/WPEViewClient.cpp: Removed.
3474
3475 2017-06-22  Carlos Garcia Campos  <cgarcia@igalia.com>
3476
3477         [WPE] Page should be closed on WebKitWebView dispose
3478         https://bugs.webkit.org/show_bug.cgi?id=173707
3479
3480         Reviewed by Žan Doberšek.
3481
3482         In the GTK+ port it's done in the WebKitWebViewBase dispose implementation. It fixes TestMultiprocess.
3483
3484         * UIProcess/API/glib/WebKitWebView.cpp:
3485         (webkitWebViewDispose): Call WKWPE::View::close().
3486         * UIProcess/API/wpe/WPEView.cpp:
3487         (WKWPE::View::close): Close the WebPageProxy.
3488         * UIProcess/API/wpe/WPEView.h:
3489
3490 2017-06-22  Carlos Garcia Campos  <cgarcia@igalia.com>
3491
3492         Remove unused coordinated graphics C API
3493         https://bugs.webkit.org/show_bug.cgi?id=173706
3494
3495         Reviewed by Žan Doberšek.
3496
3497         * UIProcess/API/C/CoordinatedGraphics/WKView.cpp: Removed.
3498         * UIProcess/API/C/CoordinatedGraphics/WKView.h: Removed.
3499         * UIProcess/API/CoordinatedGraphics/WKCoordinatedScene.cpp: Removed.
3500         * UIProcess/API/CoordinatedGraphics/WKCoordinatedScene.h: Removed.
3501
3502 2017-06-22  Carlos Garcia Campos  <cgarcia@igalia.com>
3503
3504         [WPE] Add initial web extensions API
3505         https://bugs.webkit.org/show_bug.cgi?id=173640
3506
3507         Reviewed by Žan Doberšek.
3508
3509         Build the glib web extensions API files and the builtin injected bundle library for WPE.
3510
3511         * PlatformWPE.cmake:
3512         * UIProcess/API/glib/WebKitWebContext.cpp:
3513         (webkitWebContextConstructed): Use a different injected bundle filename in WPE and GTK+.
3514         * WebProcess/InjectedBundle/API/glib/WebKitWebPage.cpp:
3515         (webkit_web_page_class_init): Do not expose DOM bindings in WPE.
3516         (webkitWebPageCreate): Ditto.
3517         * WebProcess/InjectedBundle/API/wpe/WebKitConsoleMessage.h: Added.
3518         * WebProcess/InjectedBundle/API/wpe/WebKitFrame.h: Added.
3519         * WebProcess/InjectedBundle/API/wpe/WebKitScriptWorld.h: Added.
3520         * WebProcess/InjectedBundle/API/wpe/WebKitWebEditor.h: Added.
3521         * WebProcess/InjectedBundle/API/wpe/WebKitWebExtension.h: Added.
3522         * WebProcess/InjectedBundle/API/wpe/WebKitWebPage.h: Added.
3523         * WebProcess/InjectedBundle/API/wpe/webkit-web-extension.h: Added.
3524
3525 2017-06-21  David Kilzer  <ddkilzer@apple.com>
3526
3527         REGRESSION (r218419): 3 NSMutableDictionary leaks calling -[WKProcessPool _pluginLoadClientPolicies]
3528         <https://webkit.org/b/173689>
3529
3530         Reviewed by Chris Dumez.
3531
3532         Caught by the clang static analyzer.
3533
3534         * UIProcess/API/Cocoa/WKProcessPool.mm:
3535         (policiesHashMapToDictionary): Switch from using
3536         [[NSMutableDictionary alloc] init] which returns a +1 retained
3537         object in MRR to [NSMutableDictionary new] which returns an
3538         autoreleased object under MRR.  This bug caused 3 leaks when
3539         calling -[WKProcessPool _pluginLoadClientPolicies], which should
3540         return an autoreleased object based on its signature.
3541
3542 2017-06-21  Ryosuke Niwa  <rniwa@webkit.org>
3543
3544         Add release assertions help diagnose a hang in CallbackMap
3545         https://bugs.webkit.org/show_bug.cgi?id=173680
3546         <rdar://problem/32911286>
3547
3548         Reviewed by Chris Dumez.
3549
3550         Assert that these functions are only called in the main thread and the empty value is never used as a key.
3551
3552         * UIProcess/GenericCallback.h:
3553         (WebKit::CallbackMap::put):
3554         (WebKit::CallbackMap::take):
3555
3556 2017-06-21  Wenson Hsieh  <wenson_hsieh@apple.com>
3557
3558         [iOS DnD] [WK2] Cancelling a drag interaction using the ObjC SPI causes subsequent dragging to fail
3559         https://bugs.webkit.org/show_bug.cgi?id=173659
3560         <rdar://problem/32879788>
3561
3562         Reviewed by Tim Horton.
3563
3564         Currently, a drag session that failed to begin is cleaned up either when the web process responds in
3565         -[WKContentView _didHandleStartDataInteractionRequest:] with started = NO, or if started is YES, in
3566         -dragInteraction:session:didEndWithOperation: instead. However, it is possible that even when the pasteboard has
3567         items and the drag has started in the web process, something in the UI process may then cause the drag to be
3568         cancelled (for instance, an SPI client returning empty arrays for all adjusted item providers, or UIKit not even
3569         calling into -dragInteraction:itemsForBeginningSession: when we invoke their completion block).
3570
3571         In any case, if the drag session is drag-item-less after calling the drag start completion block, clean up and
3572         cancel the drag.
3573
3574         * UIProcess/ios/WKContentViewInteraction.mm:
3575         (-[WKContentView _didHandleStartDataInteractionRequest:]):
3576         (-[WKContentView dragInteraction:itemsForBeginningSession:]):
3577
3578 2017-06-21  Tim Horton  <timothy_horton@apple.com>
3579
3580         REGRESSION (r218606): 3D Touch action menu for links is missing items
3581         https://bugs.webkit.org/show_bug.cgi?id=173669
3582         <rdar://problem/32905541>
3583
3584         Reviewed by Wenson Hsieh.
3585
3586         * UIProcess/ios/WKActionSheetAssistant.mm:
3587         (-[WKActionSheetAssistant defaultActionsForLinkSheet:]):
3588         defaultActionsForLinkSheet is used outside the usual action sheet flow,
3589         by 3D Touch code. Therefore, we're not guaranteed to have a _positionInformation.
3590         We don't need one, though -- we can get the URL from the passed-in
3591         _WKActivatedElementInfo, exactly like defaultActionsForImageSheet already did.
3592
3593         (-[WKActionSheetAssistant defaultActionsForImageSheet:]):
3594         Remove the delegate null check, which isn't used after r218606.
3595
3596 2017-06-21  Daniel Bates  <dabates@apple.com>
3597
3598         Cleanup FrameLoadRequest
3599         https://bugs.webkit.org/show_bug.cgi?id=173564
3600         <rdar://problem/32903570>
3601
3602         Reviewed by Brent Fulgham.
3603
3604         * WebProcess/Plugins/PluginView.cpp:
3605         (WebKit::PluginView::loadURL): Explicitly pass the null-string for the target frame
3606         name as we do not have one. Use C++11 brace initialization syntax.
3607         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
3608         (WebKit::WebFrameLoaderClient::dispatchCreatePage): Ditto.
3609         * WebProcess/WebPage/WebInspector.cpp:
3610         (WebKit::WebInspector::openInNewTab): It is no longer necessary to pass ReplaceDocumentIfJavaScriptURL
3611         when instantiating the FrameLoadRequest as it defaults to this policy. Use C++11 brace initialization syntax.
3612
3613 2017-06-21  Wenson Hsieh  <wenson_hsieh@apple.com>
3614
3615         [iOS DnD] [WK2] Add drag-and-drop release logging around WKContentView
3616         https://bugs.webkit.org/show_bug.cgi?id=173636
3617
3618         Reviewed by Tim Horton.
3619
3620         Add logging at key points in the drag-and-drop lifecycle in the UI process, so that sysdiagnoses will contain
3621         sufficient information to debug sparse failures.
3622
3623         * Platform/Logging.h:
3624         * UIProcess/ios/WKContentViewInteraction.mm:
3625         (-[WKContentView _didHandleStartDataInteractionRequest:]):
3626         (-[WKContentView cleanUpDragSourceSessionState]):
3627         (-[WKContentView _didPerformDataInteractionControllerOperation:]):
3628         (-[WKContentView _dragInteraction:prepareForSession:completion:]):
3629         (-[WKContentView dragInteraction:itemsForBeginningSession:]):
3630         (-[WKContentView dragInteraction:sessionWillBegin:]):
3631         (-[WKContentView _api_dragInteraction:session:didEndWithOperation:]):
3632         (-[WKContentView dropInteraction:canHandleSession:]):
3633         (-[WKContentView _api_dropInteraction:sessionDidEnter:]):
3634         (-[WKContentView dropInteraction:sessionDidExit:]):
3635         (-[WKContentView dropInteraction:performDrop:]):
3636         (-[WKContentView dropInteraction:sessionDidEnd:]):
3637
3638 2017-06-21  Jeremy Jones  <jeremyj@apple.com>
3639
3640         Don't clear audio mute when muting capture.
3641         https://bugs.webkit.org/show_bug.cgi?id=173639
3642         rdar://problem/32749737
3643
3644         Reviewed by Eric Carlson.
3645
3646         Setting capture mute was clearing audio mute.
3647         Added setMediaStreamCaptureMuted to set just the capture mute bit.
3648
3649         * UIProcess/API/Cocoa/WKWebView.mm:
3650         (-[WKWebView _muteMediaCapture]):
3651         * UIProcess/UserMediaProcessManager.cpp:
3652         (WebKit::UserMediaProcessManager::muteCaptureMediaStreamsExceptIn):
3653         * UIProcess/WebPageProxy.cpp:
3654         (WebKit::WebPageProxy::setMediaStreamCaptureMuted):
3655         * UIProcess/WebPageProxy.h:
3656
3657 2017-06-21  Miguel Gomez  <magomez@igalia.com>
3658
3659         [GTK][WAYLAND] Create WaylandCompositorDisplay unconditionally when initializing the WebProcess
3660         https://bugs.webkit.org/show_bug.cgi?id=173598
3661
3662         Reviewed by Carlos Garcia Campos.
3663
3664         Move WaylandCompositorDisplay code to its own files so it can be used from other classes. Then, instead of
3665         storing the waylandCompositorDisplayName in the WebProcess, keep a WaylandCompositorDisplay instance that
3666         is created during the initialization. This way the appropriate sharedDisplayForCompositing will be set
3667         since the creation of the WebProcess.
3668
3669         * PlatformGTK.cmake:
3670         * WebProcess/WebPage/gtk/AcceleratedSurfaceWayland.cpp:
3671         (WebKit::AcceleratedSurfaceWayland::create):
3672         (WebKit::AcceleratedSurfaceWayland::AcceleratedSurfaceWayland):
3673         * WebProcess/WebProcess.cpp:
3674         (WebKit::WebProcess::initializeWebProcess):
3675         * WebProcess/WebProcess.h:
3676         (WebKit::WebProcess::waylandCompositorDisplay):
3677         * WebProcess/gtk/WaylandCompositorDisplay.cpp: Added.
3678         (WebKit::WaylandCompositorDisplay::create):
3679         (WebKit::WaylandCompositorDisplay::bindSurfaceToPage):
3680         (WebKit::WaylandCompositorDisplay::WaylandCompositorDisplay):
3681         (WebKit::WaylandCompositorDisplay::registryGlobal):
3682         * WebProcess/gtk/WaylandCompositorDisplay.h: Added.
3683         * WebProcess/soup/WebProcessSoup.cpp:
3684         (WebKit::WebProcess::platformInitializeWebProcess):
3685
3686 2017-06-21  Carlos Garcia Campos  <cgarcia@igalia.com>
3687
3688         [GTK] Move WebGtkExtensionManager and WebGtkInjectedBundleMain to glib API dir
3689         https://bugs.webkit.org/show_bug.cgi?id=173606
3690
3691         Reviewed by Žan Doberšek.
3692
3693         And rename them to use WebKit prefix instead of WebGtk.
3694
3695         * PlatformGTK.cmake:
3696         * WebProcess/InjectedBundle/API/glib/WebKitExtensionManager.cpp: Renamed from Source/WebKit2/WebProcess/gtk/WebGtkExtensionManager.cpp.
3697         (WebKit::WebKitExtensionManager::singleton):
3698         (WebKit::WebKitExtensionManager::WebKitExtensionManager):
3699         (WebKit::WebKitExtensionManager::scanModules):
3700         (WebKit::WebKitExtensionManager::initializeWebExtension):
3701         (WebKit::WebKitExtensionManager::initialize):
3702         * WebProcess/InjectedBundle/API/glib/WebKitExtensionManager.h: Renamed from Source/WebKit2/WebProcess/gtk/WebGtkExtensionManager.h.
3703         * WebProcess/InjectedBundle/API/glib/WebKitInjectedBundleMain.cpp: Renamed from Source/WebKit2/WebProcess/gtk/WebGtkInjectedBundleMain.cpp.
3704         (WKBundleInitialize):
3705
3706 2017-06-20  Frederic Wang  <fwang@igalia.com>
3707
3708         Pass the argument of DrawingArea::shouldUseTiledBackingForFrameView by reference
3709         https://bugs.webkit.org/show_bug.cgi?id=173605
3710
3711         DrawingArea::shouldUseTiledBackingForFrameView is only called from
3712         WebChromeClient::shouldUseTiledBackingForFrameView where the frame view is already available
3713         as a reference. This patch makes the argument of
3714         DrawingArea::shouldUseTiledBackingForFrameView a reference, so it does not need to be
3715         converted to a pointer or to perform nullchecks.
3716
3717         Reviewed by Simon Fraser.
3718
3719         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
3720         (WebKit::WebChromeClient::shouldUseTiledBackingForFrameView): Just pass the reference.
3721         * WebProcess/WebPage/DrawingArea.h: Make the parameter a reference.
3722         * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.h: Ditto.
3723         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h: Ditto.
3724         * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm:
3725         (WebKit::RemoteLayerTreeDrawingArea::shouldUseTiledBackingForFrameView): Use the reference
3726         to frame view and remove the nullcheck.
3727         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
3728         (WebKit::TiledCoreAnimationDrawingArea::shouldUseTiledBackingForFrameView): Ditto.
3729
3730 2017-06-20  Myles C. Maxfield  <mmaxfield@apple.com>
3731
3732         Disable font variations on macOS Sierra and iOS 10
3733         https://bugs.webkit.org/show_bug.cgi?id=173618
3734         <rdar://problem/32879164>
3735
3736         Reviewed by Jon Lee.
3737
3738         * Configurations/FeatureDefines.xcconfig:
3739
3740 2017-06-20  Daniel Bates  <dabates@apple.com>
3741
3742         Have FrameLoadRequest takes a Frame& instead of a Frame*
3743         https://bugs.webkit.org/show_bug.cgi?id=173614
3744         <rdar://problem/32884890>
3745
3746         Reviewed by Brent Fulgham.
3747
3748         * WebProcess/Plugins/PluginView.cpp:
3749         (WebKit::PluginView::performFrameLoadURLRequest):
3750         * WebProcess/WebPage/WebPage.cpp:
3751         (WebKit::WebPage::loadURLInFrame):
3752         (WebKit::WebPage::loadRequest):
3753         (WebKit::WebPage::loadDataImpl):
3754
3755 2017-06-20  Tim Horton  <timothy_horton@apple.com>
3756
3757         Occasional deadlocks under ensurePositionInformationIsUpToDate (incoming sync message with waitForAndDispatchImmediately)
3758         https://bugs.webkit.org/show_bug.cgi?id=173570
3759         <rdar://problem/32720928>
3760
3761         Reviewed by Wenson Hsieh.
3762
3763         * UIProcess/WebPageProxy.h:
3764         * UIProcess/ios/WebPageProxyIOS.mm:
3765         (WebKit::WebPageProxy::getPositionInformation): Deleted.
3766         Get rid of getPositionInformation; it only has one caller, and it's easier
3767         to reason about the code if it's all in one place. Also, we shouldn't
3768         add more callers...
3769
3770         * UIProcess/ios/WKContentViewInteraction.h:
3771         * UIProcess/ios/WKContentViewInteraction.mm:
3772         (-[WKContentView ensurePositionInformationIsUpToDate:]):
3773         Add a return value to ensurePositionInformationIsUpToDate that indicates
3774         whether we succeeded in that effort.
3775
3776         Add the flag to our waitForAndDispatchImmediately that causes the wait
3777         to be interrupted if a sync message arrives.
3778
3779         (-[WKContentView gestureRecognizerShouldBegin:]):
3780         (-[WKContentView hasSelectablePositionAtPoint:]):
3781         (-[WKContentView pointIsNearMarkedText:]):
3782         (-[WKContentView textInteractionGesture:shouldBeginAtPoint:]):
3783         (-[WKContentView positionInformationForActionSheetAssistant:]):
3784         (-[WKContentView _interactionShouldBeginFromPreviewItemController:forPosition:]):
3785         If anything happens to interrupt our position information update, fail
3786         in the most graceful possible way at each callsite (generally by bailing
3787         from doing whatever action required position information).
3788
3789         * UIProcess/ios/WKPDFView.mm:
3790         (-[WKPDFView positionInformationForActionSheetAssistant:]):
3791         * UIProcess/ios/WKActionSheetAssistant.h:
3792         * UIProcess/ios/WKActionSheetAssistant.mm:
3793         (-[WKActionSheetAssistant synchronouslyRetrievePositionInformation]):
3794         (-[WKActionSheetAssistant presentationRectForElementUsingClosestIndicatedRect]):
3795         (-[WKActionSheetAssistant presentationRectForIndicatedElement]):
3796         (-[WKActionSheetAssistant initialPresentationRectInHostViewForSheet]):
3797         (-[WKActionSheetAssistant presentationRectInHostViewForSheet]):
3798         (-[WKActionSheetAssistant _createSheetWithElementActions:showLinkTitle:]):
3799         (-[WKActionSheetAssistant showImageSheet]):
3800         (-[WKActionSheetAssistant defaultActionsForLinkSheet:]):
3801         (-[WKActionSheetAssistant showLinkSheet]):
3802         (-[WKActionSheetAssistant showDataDetectorsSheet]):
3803         (-[WKActionSheetAssistant cleanupSheet]):
3804         Instead of constantly re-querying the position information, save it aside
3805         when presenting an action sheet, and use it to respond to all of the
3806         subsequent questions. Also, bail from presenting the action sheet if we fail
3807         to retrieve correct position information.
3808
3809 2017-06-20  Matt Lewis  <jlewis3@apple.com>
3810
3811         Unreviewed, rolling out r218530.
3812
3813         This revision caused multiple media stream test crashes on
3814         Debug builds.
3815
3816         Reverted changeset:
3817
3818         "Merge MediaDevicesRequest and MediaDevicesEnumerationRequest
3819         to tighten up code and object lifetime"
3820         https://bugs.webkit.org/show_bug.cgi?id=173527
3821         http://trac.webkit.org/changeset/218530
3822
3823 2017-06-20  Wenson Hsieh  <wenson_hsieh@apple.com>
3824
3825         [iOS DnD] [WK2] Remove custom logic for disambiguating long press action sheet gestures and drag lift
3826         https://bugs.webkit.org/show_bug.cgi?id=173578
3827         <rdar://problem/32825028>
3828
3829         Reviewed by Tim Horton.
3830
3831         Custom logic to cancel the long press action gesture recognizer in WebKit2 was added months ago to achieve
3832         spec'ed behavior when initiating a drag on an element with an action sheet to show on long press. Now that UIKit
3833         defers firing long-press gesture recognizers while a drag lift is recognizing, no extra work in WebKit is needed
3834         to achieve expected behavior.
3835
3836         * UIProcess/API/Cocoa/WKWebView.mm:
3837         (-[WKWebView _simulateLongPressActionAtLocation:]):
3838         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
3839
3840         Add testing SPI for showing an action sheet popover at a given location in content view coordinates.
3841
3842         * UIProcess/ios/WKContentViewInteraction.h:
3843         * UIProcess/ios/WKContentViewInteraction.mm:
3844         (-[WKContentView _startDataInteractionWithImage:withIndicatorData:atClientPosition:anchorPoint:action:]):
3845         (-[WKContentView _didHandleStartDataInteractionRequest:]):
3846         (-[WKContentView _dragInteraction:prepareForSession:completion:]):
3847         (-[WKContentView dragInteraction:sessionWillBegin:]):
3848         (-[WKContentView _api_dragInteraction:session:didEndWithOperation:]):
3849         (-[WKContentView _simulateLongPressActionAtLocation:]):
3850         (longPressActionDelayAfterLift): Deleted.
3851         (-[WKContentView performDeferredActionAtDragOrigin]): Deleted.
3852         (-[WKContentView cancelDeferredActionAtDragOrigin]): Deleted.
3853
3854 2017-06-20  Carlos Garcia Campos  <cgarcia@igalia.com>
3855
3856         [WPE] Add initial implementation of glib API
3857         https://bugs.webkit.org/show_bug.cgi?id=173546
3858
3859         Reviewed by Žan Doberšek.
3860
3861         Make current API files under glib directories build in WPE, and add the minimum implementation to make it
3862         work. For now it doesn't have web extensions API, and there are a few FIXMEs that will be fixed in follow up
3863         commits. It doesn't include install rules yet, since it's still not ready to be installed.
3864
3865         * PlatformGTK.cmake:
3866         * PlatformWPE.cmake:
3867         * Shared/API/glib/WebKitContextMenuActions.cpp:
3868         (webkitContextMenuActionGetActionTag):
3869         (webkitContextMenuActionGetForContextMenuItem):
3870         (webkitContextMenuActionGetLabel):
3871         * Shared/API/glib/WebKitContextMenuItem.cpp:
3872         * UIProcess/API/glib/WebKitEditorState.cpp:
3873         (webkitEditorStateChanged):
3874         * UIProcess/API/glib/WebKitError.cpp:
3875         * UIProcess/API/glib/WebKitFileChooserRequest.cpp:
3876         (webkitFileChooserRequestGetProperty):
3877         (webkit_file_chooser_request_class_init):
3878         * UIProcess/API/glib/WebKitInstallMissingMediaPluginsPermissionRequest.cpp:
3879         (createGstInstallPluginsContext):
3880         (webkitInstallMissingMediaPluginsPermissionRequestAllow):
3881         * UIProcess/API/glib/WebKitNavigationAction.cpp:
3882         * UIProcess/API/glib/WebKitNavigationActionPrivate.h:
3883         (_WebKitNavigationAction::_WebKitNavigationAction):
3884         * UIProcess/API/glib/WebKitNotificationPrivate.h:
3885         * UIProcess/API/glib/WebKitNotificationProvider.cpp:
3886         (WebKitNotificationProvider::show):
3887         * UIProcess/API/glib/WebKitPrivate.cpp:
3888         (toPlatformModifiers):
3889         (toWebKitError):
3890         (toWebCoreError):
3891         * UIProcess/API/glib/WebKitPrivate.h:
3892         * UIProcess/API/glib/WebKitSettings.cpp:
3893         (webKitSettingsSetProperty):
3894         (webKitSettingsGetProperty):
3895         (webkit_settings_class_init):
3896         (webkit_settings_set_user_agent):
3897         (webkit_settings_set_user_agent_with_application_details):
3898         * UIProcess/API/glib/WebKitUIClient.cpp:
3899         * UIProcess/API/glib/WebKitURISchemeRequest.cpp:
3900         (webkit_uri_scheme_request_get_web_view):
3901         * UIProcess/API/glib/WebKitUserContentManager.cpp:
3902         * UIProcess/API/glib/WebKitWebContext.cpp:
3903         (webkitWebContextConstructed):
3904         * UIProcess/API/glib/WebKitWebView.cpp:
3905         (webkitWebViewCreate):
3906         (webkit_web_view_class_init):
3907         (webkitWebViewCreatePage):
3908         (webkitWebViewRunAsModal):
3909         (webkitWebViewMouseTargetChanged):
3910         (webkitWebViewEnterFullScreen):
3911         (webkitWebViewExitFullScreen):
3912         (webkitWebViewPopulateContextMenu):
3913         * UIProcess/API/glib/WebKitWebViewPrivate.h:
3914         * UIProcess/API/glib/WebKitWindowProperties.cpp:
3915         (webkitWindowPropertiesGetProperty):
3916         (webkitWindowPropertiesSetProperty):
3917         (webkit_window_properties_class_init):
3918         (webkitWindowPropertiesUpdateFromWebWindowFeatures):
3919         * UIProcess/API/glib/WebKitWindowPropertiesPrivate.h:
3920         * UIProcess/API/gtk/WebKitWebViewGtk.cpp: Added.
3921         (webkitWebViewAuthenticate):
3922         (webkitWebViewCreateJavaScriptDialog):
3923         (webkitWebViewScriptDialog):
3924         (fileChooserDialogResponseCallback):
3925         (webkitWebViewRunFileChooser):
3926         (webkit_web_view_new):
3927         (webkit_web_view_new_with_context):
3928         (webkit_web_view_new_with_related_view):
3929         (webkit_web_view_new_with_settings):
3930         (webkit_web_view_new_with_user_content_manager):
3931         * UIProcess/API/wpe/WPEView.h:
3932         * UIProcess/API/wpe/WebKitAuthenticationRequest.h: Added.
3933         * UIProcess/API/wpe/WebKitAutomationSession.h: Added.
3934         * UIProcess/API/wpe/WebKitBackForwardList.h: Added.
3935         * UIProcess/API/wpe/WebKitBackForwardListItem.h: Added.
3936         * UIProcess/API/wpe/WebKitContextMenu.h: Added.
3937         * UIProcess/API/wpe/WebKitContextMenuActions.h: Added.
3938         * UIProcess/API/wpe/WebKitContextMenuItem.h: Added.
3939         * UIProcess/API/wpe/WebKitCookieManager.h: Added.
3940         * UIProcess/API/wpe/WebKitCredential.h: Added.
3941         * UIProcess/API/wpe/WebKitDefines.h: Copied from Source/WebKit2/UIProcess/API/glib/WebKitPrivate.h.
3942         * UIProcess/API/wpe/WebKitDownload.h: Added.
3943         * UIProcess/API/wpe/WebKitEditingCommands.h: Added.
3944         * UIProcess/API/wpe/WebKitEditorState.h: Added.
3945         * UIProcess/API/wpe/WebKitEnumTypes.cpp.template: Added.
3946         * UIProcess/API/wpe/WebKitEnumTypes.h.template: Copied from Source/WebKit2/UIProcess/API/glib/WebKitNotificationPrivate.h.
3947         * UIProcess/API/wpe/WebKitError.h: Added.
3948         * UIProcess/API/wpe/WebKitFaviconDatabase.h: Added.
3949         * UIProcess/API/wpe/WebKitFileChooserRequest.h: Added.
3950         * UIProcess/API/wpe/WebKitFindController.h: Added.
3951         * UIProcess/API/wpe/WebKitFormSubmissionRequest.h: Added.
3952         * UIProcess/API/wpe/WebKitGeolocationPermissionRequest.h: Added.
3953         * UIProcess/API/wpe/WebKitHitTestResult.h: Added.
3954         * UIProcess/API/wpe/WebKitInstallMissingMediaPluginsPermissionRequest.h: Added.
3955         * UIProcess/API/wpe/WebKitJavascriptResult.h: Added.
3956         * UIProcess/API/wpe/WebKitMimeInfo.h: Added.
3957         * UIProcess/API/wpe/WebKitNavigationAction.h: Added.
3958         * UIProcess/API/wpe/WebKitNavigationPolicyDecision.h: Added.
3959         * UIProcess/API/wpe/WebKitNetworkProxySettings.h: Added.
3960         * UIProcess/API/wpe/WebKitNotification.h: Added.
3961         * UIProcess/API/wpe/WebKitNotificationPermissionRequest.h: Added.
3962         * UIProcess/API/wpe/WebKitPermissionRequest.h: Added.
3963         * UIProcess/API/wpe/WebKitPlugin.h: Added.
3964         * UIProcess/API/wpe/WebKitPolicyDecision.h: Added.
3965         * UIProcess/API/wpe/WebKitResponsePolicyDecision.h: Added.
3966         * UIProcess/API/wpe/WebKitScriptDialog.h: Added.
3967         * UIProcess/API/wpe/WebKitSecurityManager.h: Added.
3968         * UIProcess/API/wpe/WebKitSecurityOrigin.h: Added.
3969         * UIProcess/API/wpe/WebKitSettings.h: Added.
3970         * UIProcess/API/wpe/WebKitURIRequest.h: Added.
3971         * UIProcess/API/wpe/WebKitURIResponse.h: Added.
3972         * UIProcess/API/wpe/WebKitURISchemeRequest.h: Added.
3973         * UIProcess/API/wpe/WebKitUserContent.h: Added.
3974         * UIProcess/API/wpe/WebKitUserContentManager.h: Added.
3975         * UIProcess/API/wpe/WebKitUserMediaPermissionRequest.h: Added.
3976         * UIProcess/API/wpe/WebKitWebContext.h: Added.
3977         * UIProcess/API/wpe/WebKitWebResource.h: Added.
3978         * UIProcess/API/wpe/WebKitWebView.h: Added.
3979         * UIProcess/API/wpe/WebKitWebViewSessionState.h: Added.
3980         * UIProcess/API/wpe/WebKitWebViewWPE.cpp: Added.
3981         (webkitWebViewAuthenticate):
3982         (webkitWebViewScriptDialog):
3983         (webkitWebViewRunFileChooser):
3984         (webkit_web_view_new):
3985         (webkit_web_view_new_with_context):
3986         (webkit_web_view_new_with_related_view):
3987         (webkit_web_view_new_with_settings):
3988         (webkit_web_view_new_with_user_content_manager):
3989         * UIProcess/API/wpe/WebKitWebsiteData.h: Added.
3990         * UIProcess/API/wpe/WebKitWebsiteDataManager.h: Added.
3991         * UIProcess/API/wpe/WebKitWindowProperties.h: Added.
3992         * UIProcess/API/wpe/webkit.h: Added.
3993
3994 2017-06-19  Frederic Wang  <fwang@igalia.com>
3995
3996         [iOS] Always include frames in the scrolling tree when async frame scrolling is enabled
3997         https://bugs.webkit.org/show_bug.cgi?id=173405
3998
3999         Reviewed by Simon Fraser.
4000
4001         * WebProcess/WebCoreSupport/WebChromeClient.h: Set the ScrollableNonMainFrameTrigger bit by
4002         default on iOS too. RenderLayerCompositor::requiresCompositingForScrollableFrame will ignore
4003         this change when async frame scrolling is disabled.
4004
4005 2017-06-19  Frederic Wang  <fred.wang@free.fr>
4006
4007         [Mac] Add an experimental feature setting for async frame scrolling
4008         https://bugs.webkit.org/show_bug.cgi?id=173359
4009
4010         Reviewed by Simon Fraser.
4011
4012         * Shared/WebPreferencesDefinitions.h: Add experimental feature "async frame scrolling".
4013         * WebProcess/InjectedBundle/API/c/WKBundle.cpp:
4014         (WKBundleSetAsyncFrameScrollingEnabled): Add setter for async frame scrolling.
4015         * WebProcess/InjectedBundle/API/c/WKBundlePrivate.h: Declare setter.
4016         * WebProcess/InjectedBundle/InjectedBundle.cpp:
4017         (WebKit::InjectedBundle::setAsyncFrameScrollingEnabled): Add setter for async frame scrolling.
4018         * WebProcess/InjectedBundle/InjectedBundle.h: Declare setter.
4019         * WebProcess/WebPage/WebPage.cpp:
4020         (WebKit::WebPage::updatePreferences): Take into account preference update for async frame
4021         scrolling.
4022
4023 2017-06-19  Darin Adler  <darin@apple.com>
4024
4025         Merge MediaDevicesRequest and MediaDevicesEnumerationRequest to tighten up code and object lifetime
4026         https://bugs.webkit.org/show_bug.cgi?id=173527
4027
4028         Reviewed by Sam Weinig.
4029
4030         * UIProcess/API/C/WKUserMediaPermissionCheck.h: Fixed incorrect file name in comment.
4031
4032         * WebProcess/MediaStream/UserMediaPermissionRequestManager.cpp:
4033         (WebKit::UserMediaPermissionRequestManager::enumerateMediaDevices): Use the new frame
4034         function from MediaDevicesEnumerationRequest rather than finding the frame with our
4035         own code.
4036
4037         * WebProcess/WebCoreSupport/WebUserMediaClient.cpp: Removed unneeded include of UserMediaController.h.
4038
4039 2017-06-19  Chris Dumez  <cdumez@apple.com>
4040
4041         Regression(r217570): com.apple.WebKit.Networking crash at com.apple.WebKit: WebKit::ChildProcess::didReceiveInvalidMessage (Breaks 32-bit apps)
4042         https://bugs.webkit.org/show_bug.cgi?id=173576
4043         <rdar://problem/32416291>
4044
4045         Reviewed by Tim Horton.
4046
4047         The IPC encoding / decoding code cannot be architecture-specific because a 32bit UIProcess
4048         talks to