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