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