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