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