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