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