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