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