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