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