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