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