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