48276978b1f67a9edc0d7e1b52b0e8207b409f5c
[WebKit-https.git] / Source / WebKit / ChangeLog
1 2017-08-01  Chris Dumez  <cdumez@apple.com>
2
3         Add initial support for navigator.sendBeacon
4         https://bugs.webkit.org/show_bug.cgi?id=175007
5         <rdar://problem/33547728>
6
7         Reviewed by Sam Weinig.
8
9         Add experimental feature flag for the Beacon API, disabled by default.
10
11         * Shared/WebPreferencesDefinitions.h:
12         * WebProcess/InjectedBundle/InjectedBundle.cpp:
13         (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner):
14         * WebProcess/WebPage/WebPage.cpp:
15         (WebKit::WebPage::updatePreferences):
16
17 2017-08-01  Filip Pizlo  <fpizlo@apple.com>
18
19         Bmalloc and GC should put auxiliaries (butterflies, typed array backing stores) in a gigacage (separate multi-GB VM region)
20         https://bugs.webkit.org/show_bug.cgi?id=174727
21
22         Reviewed by Mark Lam.
23         
24         The WebProcess should never disable the Gigacage by allocating typed arrays outside the Gigacage. So,
25         we add a callback that crashes the process.
26
27         * WebProcess/WebProcess.cpp:
28         (WebKit::gigacageDisabled):
29         (WebKit::m_webSQLiteDatabaseTracker):
30
31 2017-08-01  Brian Burg  <bburg@apple.com>
32
33         Web Automation: add event to notify service when a page's main frame window object has cleared
34         https://bugs.webkit.org/show_bug.cgi?id=174987
35         <rdar://problem/36602634>
36
37         Reviewed by Carlos Garcia Campos.
38
39         * UIProcess/Automation/Automation.json: Add new event.
40
41         * UIProcess/Automation/WebAutomationSession.h:
42         * UIProcess/Automation/WebAutomationSession.cpp:
43         (WebKit::WebAutomationSession::navigationOccurredForFrame):
44         (WebKit::WebAutomationSession::willClosePage):
45         When a WebPage navigates or closes, send the browsingContextCleared event.
46         Any element handles for elements in the browsing context are no longer valid.
47
48         * UIProcess/WebPageProxy.cpp:
49         (WebKit::WebPageProxy::close):
50         Add a new hook into the active automation session so it is notified when a page closes.
51
52 2017-08-01  Brady Eidson  <beidson@apple.com>
53
54         API test URLSchemeHandler.Exceptions is Exiting out early on macOS Debug..
55         https://bugs.webkit.org/show_bug.cgi?id=175030
56
57         Reviewed by Andy Estes.
58
59         * UIProcess/Cocoa/WebURLSchemeHandlerCocoa.mm:
60         (WebKit::WebURLSchemeHandlerCocoa::platformTaskCompleted): Release the API wrapped on the next
61           spin of the runloop.
62
63 2017-08-01  Brady Eidson  <beidson@apple.com>
64
65         Part 2 of: Rename DatabaseProcess to StorageProcess.
66         https://bugs.webkit.org/show_bug.cgi?id=174880
67
68         Reviewed by Andy Estes.
69
70         Rename some more variables, classes, etc. to reflect the change.
71
72         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
73         (WebKit::NetworkConnectionToWebProcess::writeBlobsToTemporaryFiles):
74
75         * NetworkProcess/NetworkProcess.cpp:
76         (WebKit::NetworkProcess::grantSandboxExtensionsToStorageProcessForBlobs):
77         (WebKit::NetworkProcess::didGrantSandboxExtensionsToStorageProcessForBlobs):
78         (WebKit::NetworkProcess::grantSandboxExtensionsToDatabaseProcessForBlobs): Deleted.
79         (WebKit::NetworkProcess::didGrantSandboxExtensionsToDatabaseProcessForBlobs): Deleted.
80         * NetworkProcess/NetworkProcess.h:
81         * NetworkProcess/NetworkProcess.messages.in:
82
83         * Shared/ProcessExecutablePath.h:
84         * Shared/gtk/ProcessExecutablePathGtk.cpp:
85         (WebKit::executablePathOfStorageProcess):
86         (WebKit::executablePathOfDatabaseProcess): Deleted.
87         * Shared/wpe/ProcessExecutablePathWPE.cpp:
88         (WebKit::executablePathOfStorageProcess):
89         (WebKit::executablePathOfDatabaseProcess): Deleted.
90
91         * StorageProcess/IndexedDB/WebIDBConnectionToClient.cpp:
92         (WebKit::WebIDBConnectionToClient::putOrAdd):
93
94         * StorageProcess/StorageProcess.cpp:
95         (WebKit::StorageProcess::initializeWebsiteDataStore):
96         (WebKit::StorageProcess::postStorageTask):
97         (WebKit::StorageProcess::performNextStorageTask):
98         (WebKit::StorageProcess::createStorageToWebProcessConnection):
99         (WebKit::StorageProcess::fetchWebsiteData):
100         (WebKit::StorageProcess::postDatabaseTask): Deleted.
101         (WebKit::StorageProcess::performNextDatabaseTask): Deleted.
102         (WebKit::StorageProcess::createDatabaseToWebProcessConnection): Deleted.
103         * StorageProcess/StorageProcess.h:
104         * StorageProcess/StorageProcess.messages.in:
105         * StorageProcess/mac/StorageProcessMac.mm:
106         (WebKit::StorageProcess::initializeProcessName):
107
108         * UIProcess/API/C/WKContext.cpp:
109         (WKContextGetDatabaseProcessIdentifier):
110
111         * UIProcess/API/Cocoa/WKProcessPool.mm:
112         (-[WKProcessPool _terminateStorageProcess]):
113         (-[WKProcessPool _storageProcessIdentifier]):
114         (-[WKProcessPool _terminateDatabaseProcess]): Deleted.
115         (-[WKProcessPool _databaseProcessIdentifier]): Deleted.
116         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
117
118         * UIProcess/ChildProcessProxy.cpp:
119         (WebKit::ChildProcessProxy::getLaunchOptions):
120
121         * UIProcess/Launcher/ProcessLauncher.h:
122         * UIProcess/Launcher/gtk/ProcessLauncherGtk.cpp:
123         (WebKit::ProcessLauncher::launchProcess):
124         * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
125         (WebKit::serviceName):
126         * UIProcess/Launcher/wpe/ProcessLauncherWPE.cpp:
127         (WebKit::ProcessLauncher::launchProcess):
128
129         * UIProcess/Network/NetworkProcessProxy.cpp:
130         (WebKit::NetworkProcessProxy::grantSandboxExtensionsToStorageProcessForBlobs):
131         (WebKit::NetworkProcessProxy::grantSandboxExtensionsToDatabaseProcessForBlobs): Deleted.
132         * UIProcess/Network/NetworkProcessProxy.h:
133         * UIProcess/Network/NetworkProcessProxy.messages.in:
134
135         * UIProcess/Storage/StorageProcessProxy.cpp:
136         (WebKit::StorageProcessProxy::getLaunchOptions):
137         (WebKit::StorageProcessProxy::getStorageProcessConnection):
138         (WebKit::StorageProcessProxy::didClose):
139         (WebKit::StorageProcessProxy::didCreateStorageToWebProcessConnection):
140         (WebKit::StorageProcessProxy::didFinishLaunching):
141         (WebKit::StorageProcessProxy::getDatabaseProcessConnection): Deleted.
142         (WebKit::StorageProcessProxy::didCreateDatabaseToWebProcessConnection): Deleted.
143         * UIProcess/Storage/StorageProcessProxy.h:
144         * UIProcess/Storage/StorageProcessProxy.messages.in:
145
146         * UIProcess/WebContextClient.cpp:
147         (WebKit::WebContextClient::storageProcessDidCrash):
148         (WebKit::WebContextClient::databaseProcessDidCrash): Deleted.
149         * UIProcess/WebContextClient.h:
150
151         * UIProcess/WebProcessPool.cpp:
152         (WebKit::WebProcessPool::ensureStorageProcessAndWebsiteDataStore):
153         (WebKit::WebProcessPool::getStorageProcessConnection):
154         (WebKit::WebProcessPool::storageProcessCrashed):
155         (WebKit::WebProcessPool::pageAddedToProcess):
156         (WebKit::WebProcessPool::storageProcessIdentifier):
157         (WebKit::WebProcessPool::terminateStorageProcess):
158         (WebKit::WebProcessPool::ensureDatabaseProcessAndWebsiteDataStore): Deleted.
159         (WebKit::WebProcessPool::getDatabaseProcessConnection): Deleted.
160         (WebKit::WebProcessPool::databaseProcessCrashed): Deleted.
161         (WebKit::WebProcessPool::databaseProcessIdentifier): Deleted.
162         (WebKit::WebProcessPool::terminateDatabaseProcess): Deleted.
163         * UIProcess/WebProcessPool.h:
164         (WebKit::WebProcessPool::sendToStorageProcessRelaunchingIfNecessary):
165         (WebKit::WebProcessPool::sendToDatabaseProcessRelaunchingIfNecessary): Deleted.
166
167         * UIProcess/WebProcessProxy.cpp:
168         (WebKit::WebProcessProxy::getStorageProcessConnection):
169         (WebKit::WebProcessProxy::getDatabaseProcessConnection): Deleted.
170         * UIProcess/WebProcessProxy.h:
171         * UIProcess/WebProcessProxy.messages.in:
172
173         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
174         (WebKit::WebsiteDataStore::fetchDataAndApply):
175         (WebKit::WebsiteDataStore::removeData):
176         (WebKit::WebsiteDataStore::storageProcessParameters):
177         (WebKit::WebsiteDataStore::databaseProcessParameters): Deleted.
178         * UIProcess/WebsiteData/WebsiteDataStore.h:
179
180         * WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.cpp:
181         (WebKit::WebIDBConnectionToServer::messageSenderConnection):
182         * WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.h:
183
184         * WebProcess/Databases/WebDatabaseProvider.cpp:
185         (WebKit::WebDatabaseProvider::idbConnectionToServerForSession):
186
187         * WebProcess/Storage/WebToStorageProcessConnection.cpp:
188         (WebKit::WebToStorageProcessConnection::WebToStorageProcessConnection):
189         (WebKit::WebToStorageProcessConnection::~WebToStorageProcessConnection):
190         (WebKit::WebToStorageProcessConnection::didReceiveMessage):
191         (WebKit::WebToStorageProcessConnection::didClose):
192         (WebKit::WebToStorageProcessConnection::didReceiveInvalidMessage):
193         (WebKit::WebToStorageProcessConnection::idbConnectionToServerForSession):
194         (WebKit::WebToDatabaseProcessConnection::WebToDatabaseProcessConnection): Deleted.
195         (WebKit::WebToDatabaseProcessConnection::~WebToDatabaseProcessConnection): Deleted.
196         (WebKit::WebToDatabaseProcessConnection::didReceiveMessage): Deleted.
197         (WebKit::WebToDatabaseProcessConnection::didClose): Deleted.
198         (WebKit::WebToDatabaseProcessConnection::didReceiveInvalidMessage): Deleted.
199         (WebKit::WebToDatabaseProcessConnection::idbConnectionToServerForSession): Deleted.
200         * WebProcess/Storage/WebToStorageProcessConnection.h:
201         (WebKit::WebToStorageProcessConnection::create):
202         (WebKit::WebToDatabaseProcessConnection::create): Deleted.
203         (WebKit::WebToDatabaseProcessConnection::connection): Deleted.
204
205         * WebProcess/WebProcess.cpp:
206         (WebKit::WebProcess::webToStorageProcessConnectionClosed):
207         (WebKit::WebProcess::webToStorageProcessConnection):
208         (WebKit::WebProcess::ensureWebToStorageProcessConnection):
209         (WebKit::WebProcess::webToDatabaseProcessConnectionClosed): Deleted.
210         (WebKit::WebProcess::webToDatabaseProcessConnection): Deleted.
211         (WebKit::WebProcess::ensureWebToDatabaseProcessConnection): Deleted.
212         * WebProcess/WebProcess.h:
213
214 2017-08-01  Brady Eidson  <beidson@apple.com>
215
216         Part 1 of: Rename DatabaseProcess to StorageProcess.
217         https://bugs.webkit.org/show_bug.cgi?id=174879
218
219         Reviewed by Andy Estes.
220
221         This patch is all about renaming source files and renaming the process itself (touching build system files, etc etc).
222
223         Some renaming in actual code did result (Some class/struct names, method names, etc)
224
225         Part 2 (174880) will go through and update all references in code itself from "Database" to "Storage"
226
227         * CMakeLists.txt:
228         * DerivedSources.make:
229         * PlatformGTK.cmake:
230         * PlatformMac.cmake:
231         * PlatformWPE.cmake:
232         * WebKit.xcodeproj/project.pbxproj:
233
234         * Configurations/StorageService.xcconfig: Renamed from Source/WebKit/Configurations/DatabaseService.xcconfig.
235         * StorageProcess/EntryPoint/mac/XPCService/StorageService/Info.plist: Renamed from Source/WebKit/DatabaseProcess/EntryPoint/mac/XPCService/DatabaseService/Info.plist.
236         * StorageProcess/mac/com.apple.WebKit.Databases.sb.in: Renamed from Source/WebKit/DatabaseProcess/mac/com.apple.WebKit.Databases.sb.in.
237
238         * Shared/Storage/StorageProcessCreationParameters.cpp: Renamed from Source/WebKit/Shared/Databases/DatabaseProcessCreationParameters.cpp.
239         * Shared/Storage/StorageProcessCreationParameters.h: Renamed from Source/WebKit/Shared/Databases/DatabaseProcessCreationParameters.h.
240
241         * StorageProcess/EntryPoint/mac/XPCService/StorageServiceEntryPoint.mm: Renamed from Source/WebKit/DatabaseProcess/EntryPoint/mac/XPCService/DatabaseServiceEntryPoint.mm.
242         * StorageProcess/EntryPoint/unix/StorageProcessMain.cpp: Renamed from Source/WebKit/DatabaseProcess/EntryPoint/unix/DatabaseProcessMain.cpp.
243
244         * StorageProcess/IndexedDB/WebIDBConnectionToClient.cpp: Renamed from Source/WebKit/DatabaseProcess/IndexedDB/WebIDBConnectionToClient.cpp.
245         * StorageProcess/IndexedDB/WebIDBConnectionToClient.h: Renamed from Source/WebKit/DatabaseProcess/IndexedDB/WebIDBConnectionToClient.h.
246         * StorageProcess/IndexedDB/WebIDBConnectionToClient.messages.in: Renamed from Source/WebKit/DatabaseProcess/IndexedDB/WebIDBConnectionToClient.messages.in.
247
248         * StorageProcess/StorageProcess.cpp: Renamed from Source/WebKit/DatabaseProcess/DatabaseProcess.cpp.
249         * StorageProcess/StorageProcess.h: Renamed from Source/WebKit/DatabaseProcess/DatabaseProcess.h.
250         * StorageProcess/StorageProcess.messages.in: Renamed from Source/WebKit/DatabaseProcess/DatabaseProcess.messages.in.
251
252         * StorageProcess/StorageToWebProcessConnection.cpp: Renamed from Source/WebKit/DatabaseProcess/DatabaseToWebProcessConnection.cpp.
253         * StorageProcess/StorageToWebProcessConnection.h: Renamed from Source/WebKit/DatabaseProcess/DatabaseToWebProcessConnection.h.
254         * StorageProcess/StorageToWebProcessConnection.messages.in: Renamed from Source/WebKit/DatabaseProcess/DatabaseToWebProcessConnection.messages.in.
255
256         * StorageProcess/gtk/StorageProcessMainGtk.cpp: Renamed from Source/WebKit/DatabaseProcess/gtk/DatabaseProcessMainGtk.cpp.
257         * StorageProcess/ios/StorageProcessIOS.mm: Renamed from Source/WebKit/DatabaseProcess/ios/DatabaseProcessIOS.mm.
258         * StorageProcess/mac/StorageProcessMac.mm: Renamed from Source/WebKit/DatabaseProcess/mac/DatabaseProcessMac.mm.
259         * StorageProcess/unix/StorageProcessMainUnix.h: Renamed from Source/WebKit/DatabaseProcess/unix/DatabaseProcessMainUnix.h.
260         * UIProcess/Network/NetworkProcessProxy.cpp:
261
262         * UIProcess/Storage/StorageProcessProxy.cpp: Renamed from Source/WebKit/UIProcess/Databases/DatabaseProcessProxy.cpp.
263         * UIProcess/Storage/StorageProcessProxy.h: Renamed from Source/WebKit/UIProcess/Databases/DatabaseProcessProxy.h.
264         * UIProcess/Storage/StorageProcessProxy.messages.in: Renamed from Source/WebKit/UIProcess/Databases/DatabaseProcessProxy.messages.in.
265
266         * UIProcess/WebContextSupplement.h:
267         * UIProcess/WebProcessPool.cpp:
268         * UIProcess/WebProcessPool.h:
269         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
270         * UIProcess/WebsiteData/WebsiteDataStore.h:
271         * WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.cpp:
272         * WebProcess/Databases/WebDatabaseProvider.cpp:
273
274         * WebProcess/Storage/WebToStorageProcessConnection.cpp: Renamed from Source/WebKit/WebProcess/Databases/WebToDatabaseProcessConnection.cpp.
275         * WebProcess/Storage/WebToStorageProcessConnection.h: Renamed from Source/WebKit/WebProcess/Databases/WebToDatabaseProcessConnection.h.
276
277         * WebProcess/WebProcess.cpp:
278
279 2017-08-01  Michael Catanzaro  <mcatanzaro@igalia.com>
280
281         [CMake] WebKitFS.cmake depends on options set in Option cmake files that are included later
282         https://bugs.webkit.org/show_bug.cgi?id=174855
283
284         Reviewed by Carlos Garcia Campos.
285
286         Don't create derived sources directory here anymore.
287
288         * PlatformGTK.cmake:
289         * PlatformMac.cmake:
290         * PlatformWPE.cmake:
291
292 2017-07-31  Daniel Bates  <dabates@apple.com>
293
294         WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction() may not be able to
295         determine page that initiated navigation
296         https://bugs.webkit.org/show_bug.cgi?id=174531
297
298         Remove a comment from WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction()
299         about determining the originating page independently from the originating frame. There
300         does not seem to be much value to fixing this. We can always revisit this issue if we
301         discover a strong motivating example. See <https://bugs.webkit.org/show_bug.cgi?id=174531#c1>
302         for more details.
303
304         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
305         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
306
307 2017-07-31  Sam Weinig  <sam@webkit.org>
308
309         Remove unnecessary exceptions from storage code
310         https://bugs.webkit.org/show_bug.cgi?id=174572
311
312         Reviewed by Chris Dumez.
313
314         * WebProcess/Storage/StorageAreaImpl.cpp:
315         (WebKit::StorageAreaImpl::canAccessStorage): Deleted.
316         * WebProcess/Storage/StorageAreaImpl.h:
317         * WebProcess/Storage/StorageNamespaceImpl.cpp:
318         Remove canAccessStorage. It is no longer called.
319
320 2017-07-30  Brady Eidson  <beidson@apple.com>
321
322         Add URLSchemeHandler API tests that verify the lack of URLSchemeTask object leaks.
323         https://bugs.webkit.org/show_bug.cgi?id=174958
324
325         Reviewed by Darin Adler.
326
327         * UIProcess/API/APIURLSchemeTask.h:
328
329         * UIProcess/API/C/WKTestingSupport.cpp:
330         (WKGetAPIURLSchemeTaskInstanceCount):
331         (WKGetWebURLSchemeTaskInstanceCount):
332         * UIProcess/API/C/WKTestingSupport.h:
333
334         * UIProcess/WebURLSchemeTask.h:
335
336         * WebKit.xcodeproj/project.pbxproj:
337
338 2017-07-29  Yusuke Suzuki  <utatane.tea@gmail.com>
339
340         Unreviewed, build fix for GTK and WPE about StorageProcess renaming
341
342         * CMakeLists.txt:
343         * PlatformGTK.cmake:
344         * PlatformMac.cmake:
345         * PlatformWPE.cmake:
346
347 2017-07-28  Brent Fulgham  <bfulgham@apple.com>
348
349         [Mac][WebKit2] WebKit sandbox errors while streaming Netflix
350         https://bugs.webkit.org/show_bug.cgi?id=174955
351         <rdar://problem/33583994>
352
353         Reviewed by Alex Christensen.
354
355         Wider testing with the stricter sandboxing rules identified three more IOKit properties we need to expose:
356         - CEAModeID
357         - CEAPixelRepetition
358         - IOFBHDMIDongleROM
359
360         * WebProcess/com.apple.WebProcess.sb.in:
361
362 2017-07-28  Commit Queue  <commit-queue@webkit.org>
363
364         Unreviewed, rolling out r219986.
365         https://bugs.webkit.org/show_bug.cgi?id=174962
366
367         "broke PLT on iOS (rdar://problem/33602751)" (Requested by
368         estes on #webkit).
369
370         Reverted changeset:
371
372         "Part 1 of: Rename DatabaseProcess to StorageProcess."
373         https://bugs.webkit.org/show_bug.cgi?id=174879
374         http://trac.webkit.org/changeset/219986
375
376 2017-07-28  Commit Queue  <commit-queue@webkit.org>
377
378         Unreviewed, rolling out r219990.
379         https://bugs.webkit.org/show_bug.cgi?id=174961
380
381         "broke PLT on iOS (rdar://problem/33602751)" (Requested by
382         estes on #webkit).
383
384         Reverted changeset:
385
386         "Part 2 of: Rename DatabaseProcess to StorageProcess."
387         https://bugs.webkit.org/show_bug.cgi?id=174880
388         http://trac.webkit.org/changeset/219990
389
390 2017-07-28  Brady Eidson  <beidson@apple.com>
391
392         API tests that use URLSchemeHandler are failing.
393         https://bugs.webkit.org/show_bug.cgi?id=174950
394
395         Reviewed by Alex Christensen.
396
397         Make sure that in all cases where we remove the last task from the page->task map...
398         ...We also remove the map itself.
399
400         * UIProcess/WebURLSchemeHandler.cpp:
401         (WebKit::WebURLSchemeHandler::stopTask):
402         (WebKit::WebURLSchemeHandler::taskCompleted):
403         (WebKit::WebURLSchemeHandler::removeTaskFromPageMap):
404         * UIProcess/WebURLSchemeHandler.h:
405
406 2017-07-28  Brady Eidson  <beidson@apple.com>
407
408         WKURLSchemeTaskImpl instances are being abandoned (except if the task is stopped).
409         <rdar://problem/33568276> and https://bugs.webkit.org/show_bug.cgi?id=174895
410
411         Reviewed by Alex Christensen.
412
413         There was a lot going on here:
414         - There was an unbroken cycle between URLSchemeHandlers and URLSchemeTasks 
415         - WKURLSchemeTasks were not destroying their API::URLSchemeTask implementation object
416         - When a WKWebView was dealloc'ed, it was not cleaning up the related UIProcess tasks
417         - If the NetworkingProcess crashed, WebProcesses were not cleaning up their tasks
418           (and therefore the UIProcess tasks were also not getting cleaned up)
419         - If a WebProcess crashed, the UIProcess was not cleaning up the related tasks
420         
421         * UIProcess/API/Cocoa/WKURLSchemeTask.mm:
422         (-[WKURLSchemeTaskImpl dealloc]): Call API::~URLSchemeTask
423         
424         * UIProcess/Cocoa/WebURLSchemeHandlerCocoa.h:
425         * UIProcess/Cocoa/WebURLSchemeHandlerCocoa.mm:
426         (WebKit::WebURLSchemeHandlerCocoa::platformTaskCompleted): Clear out the API wrapper map
427           so the wrapper and implementation object can both be destroyed.
428         
429         * UIProcess/WebPageProxy.cpp:
430         (WebKit::WebPageProxy::close): Call stopAllURLSchemeTasks.
431         (WebKit::WebPageProxy::processDidTerminate): Call stopAllURLSchemeTasks.
432         (WebKit::WebPageProxy::stopAllURLSchemeTasks):
433         * UIProcess/WebPageProxy.h:
434         
435         * UIProcess/WebURLSchemeHandler.cpp:
436         (WebKit::WebURLSchemeHandler::startTask):
437         (WebKit::WebURLSchemeHandler::stopAllTasksForPage):
438         (WebKit::WebURLSchemeHandler::stopTask):
439         (WebKit::WebURLSchemeHandler::taskCompleted):
440         * UIProcess/WebURLSchemeHandler.h:
441         
442         * UIProcess/WebURLSchemeTask.cpp:
443         (WebKit::WebURLSchemeTask::WebURLSchemeTask):
444         * UIProcess/WebURLSchemeTask.h:
445         (WebKit::WebURLSchemeTask::pageID): Store separate from the WebPage so messaging
446           is possible even after the WebPage* has been cleared.
447         
448         * WebProcess/WebPage/WebPage.cpp:
449         (WebKit::WebPage::stopAllURLSchemeTasks):
450         * WebProcess/WebPage/WebPage.h:
451         
452         * WebProcess/WebPage/WebURLSchemeHandlerProxy.cpp:
453         (WebKit::WebURLSchemeHandlerProxy::stopAllTasks):
454         (WebKit::WebURLSchemeHandlerProxy::taskDidComplete):
455         (WebKit::WebURLSchemeHandlerProxy::taskDidStopLoading):
456         (WebKit::WebURLSchemeHandlerProxy::removeTask):
457         * WebProcess/WebPage/WebURLSchemeHandlerProxy.h:
458         
459         * WebProcess/WebProcess.cpp:
460         (WebKit::WebProcess::networkProcessConnectionClosed): Call stopAllURLSchemeTasks 
461           for each WebPage.
462
463 2017-07-28  Frederic Wang  <fwang@igalia.cpm>
464
465         Fix typo in scrollPositionChangedViaDelegatedScrolling
466         https://bugs.webkit.org/show_bug.cgi?id=174937
467
468         Reviewed by Wenson Hsieh.
469
470         * UIProcess/Scrolling/ios/ScrollingTreeOverflowScrollingNodeIOS.h:
471         * UIProcess/Scrolling/ios/ScrollingTreeOverflowScrollingNodeIOS.mm:
472         (WebKit::ScrollingTreeOverflowScrollingNodeIOS::scrollViewDidScroll):
473
474 2017-07-28  Jeremy Jones  <jeremyj@apple.com>
475
476         Remove Web prefix from WebVideoFullscreen and WebPlaybackSession classes.
477         https://bugs.webkit.org/show_bug.cgi?id=174437
478
479         Reviewed by Darin Adler.
480
481         Remove redundant Web- prefix from classes in WebKit namespace.
482
483         * DerivedSources.make:
484         * UIProcess/API/Cocoa/WKWebView.mm:
485         * UIProcess/Cocoa/PlaybackSessionManagerProxy.h: Renamed from Source/WebKit/UIProcess/Cocoa/WebPlaybackSessionManagerProxy.h.
486         * UIProcess/Cocoa/PlaybackSessionManagerProxy.messages.in: Renamed from Source/WebKit/UIProcess/Cocoa/WebPlaybackSessionManagerProxy.messages.in.
487         * UIProcess/Cocoa/PlaybackSessionManagerProxy.mm: Added.
488         * UIProcess/Cocoa/VideoFullscreenManagerProxy.h: Renamed from Source/WebKit/UIProcess/Cocoa/WebVideoFullscreenManagerProxy.h.
489         * UIProcess/Cocoa/VideoFullscreenManagerProxy.messages.in: Renamed from Source/WebKit/UIProcess/Cocoa/WebVideoFullscreenManagerProxy.messages.in.
490         * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm: Renamed from Source/WebKit/UIProcess/Cocoa/WebVideoFullscreenManagerProxy.mm.
491         * UIProcess/Cocoa/WebPlaybackSessionManagerProxy.mm: Removed.
492         * UIProcess/Cocoa/WebViewImpl.mm:
493         (WebKit::WebViewImpl::updateMediaTouchBar):
494         * UIProcess/WebPageProxy.cpp:
495         (WebKit::m_weakPtrFactory):
496         (WebKit::WebPageProxy::reattachToWebProcess):
497         (WebKit::WebPageProxy::playbackSessionManager):
498         (WebKit::WebPageProxy::videoFullscreenManager):
499         * UIProcess/WebPageProxy.h:
500         * UIProcess/ios/WebPageProxyIOS.mm:
501         * WebKit.xcodeproj/project.pbxproj:
502         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
503         * WebProcess/WebPage/WebPage.cpp:
504         (WebKit::WebPage::playbackSessionManager):
505         (WebKit::WebPage::videoFullscreenManager):
506         * WebProcess/WebPage/WebPage.h:
507         * WebProcess/cocoa/PlaybackSessionManager.h: Renamed from Source/WebKit/WebProcess/cocoa/WebPlaybackSessionManager.h.
508         * WebProcess/cocoa/PlaybackSessionManager.messages.in: Renamed from Source/WebKit/WebProcess/cocoa/WebPlaybackSessionManager.messages.in.
509         * WebProcess/cocoa/PlaybackSessionManager.mm: Added.
510         * WebProcess/cocoa/VideoFullscreenManager.h: Renamed from Source/WebKit/WebProcess/cocoa/WebVideoFullscreenManager.h.
511         (WebKit::VideoFullscreenInterfaceContext::create):
512         * WebProcess/cocoa/VideoFullscreenManager.messages.in: Renamed from Source/WebKit/WebProcess/cocoa/WebVideoFullscreenManager.messages.in.
513         * WebProcess/cocoa/VideoFullscreenManager.mm: Renamed from Source/WebKit/WebProcess/cocoa/WebVideoFullscreenManager.mm.
514         * WebProcess/cocoa/WebPlaybackSessionManager.mm: Removed.
515
516 2017-07-27  Zan Dobersek  <zdobersek@igalia.com>
517
518         [CMake] Re-add the StorageProcess executable target
519         https://bugs.webkit.org/show_bug.cgi?id=174929
520
521         Reviewed by Carlos Garcia Campos.
522
523         Re-add the StorageProcess executable target that was removed in r219960.
524         Back then it was still named DatabaseProcess, but the name changed in
525         the following patches.
526
527         * CMakeLists.txt:
528
529 2017-07-27  Brady Eidson  <beidson@apple.com>
530
531         Part 2 of: Rename DatabaseProcess to StorageProcess.
532         https://bugs.webkit.org/show_bug.cgi?id=174880
533
534         Reviewed by Andy Estes.
535
536         Rename some more variables, classes, etc. to reflect the change.
537
538         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
539         (WebKit::NetworkConnectionToWebProcess::writeBlobsToTemporaryFiles):
540
541         * NetworkProcess/NetworkProcess.cpp:
542         (WebKit::NetworkProcess::grantSandboxExtensionsToStorageProcessForBlobs):
543         (WebKit::NetworkProcess::didgrantSandboxExtensionsToStorageProcessForBlobs):
544         (WebKit::NetworkProcess::grantSandboxExtensionsToDatabaseProcessForBlobs): Deleted.
545         (WebKit::NetworkProcess::didGrantSandboxExtensionsToDatabaseProcessForBlobs): Deleted.
546         * NetworkProcess/NetworkProcess.h:
547         * NetworkProcess/NetworkProcess.messages.in:
548
549         * Shared/ProcessExecutablePath.h:
550         * Shared/gtk/ProcessExecutablePathGtk.cpp:
551         (WebKit::executablePathOfStorageProcess):
552         (WebKit::executablePathOfDatabaseProcess): Deleted.
553         * Shared/wpe/ProcessExecutablePathWPE.cpp:
554         (WebKit::executablePathOfStorageProcess):
555         (WebKit::executablePathOfDatabaseProcess): Deleted.
556
557         * StorageProcess/IndexedDB/WebIDBConnectionToClient.cpp:
558         (WebKit::WebIDBConnectionToClient::putOrAdd):
559
560         * StorageProcess/StorageProcess.cpp:
561         (WebKit::StorageProcess::initializeWebsiteDataStore):
562         (WebKit::StorageProcess::postStorageTask):
563         (WebKit::StorageProcess::performNextStorageTask):
564         (WebKit::StorageProcess::createStorageToWebProcessConnection):
565         (WebKit::StorageProcess::fetchWebsiteData):
566         (WebKit::StorageProcess::postDatabaseTask): Deleted.
567         (WebKit::StorageProcess::performNextDatabaseTask): Deleted.
568         (WebKit::StorageProcess::createDatabaseToWebProcessConnection): Deleted.
569         * StorageProcess/StorageProcess.h:
570         * StorageProcess/StorageProcess.messages.in:
571         * StorageProcess/mac/StorageProcessMac.mm:
572         (WebKit::StorageProcess::initializeProcessName):
573
574         * UIProcess/API/C/WKContext.cpp:
575         (WKContextGetDatabaseProcessIdentifier):
576
577         * UIProcess/API/Cocoa/WKProcessPool.mm:
578         (-[WKProcessPool _terminateStorageProcess]):
579         (-[WKProcessPool _storageProcessIdentifier]):
580         (-[WKProcessPool _terminateDatabaseProcess]): Deleted.
581         (-[WKProcessPool _databaseProcessIdentifier]): Deleted.
582         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
583
584         * UIProcess/Launcher/ProcessLauncher.h:
585         * UIProcess/Launcher/gtk/ProcessLauncherGtk.cpp:
586         (WebKit::ProcessLauncher::launchProcess):
587         * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
588         (WebKit::serviceName):
589         * UIProcess/Launcher/wpe/ProcessLauncherWPE.cpp:
590         (WebKit::ProcessLauncher::launchProcess):
591
592         * UIProcess/Network/NetworkProcessProxy.cpp:
593         (WebKit::NetworkProcessProxy::grantSandboxExtensionsToStorageProcessForBlobs):
594         (WebKit::NetworkProcessProxy::grantSandboxExtensionsToDatabaseProcessForBlobs): Deleted.
595         * UIProcess/Network/NetworkProcessProxy.h:
596         * UIProcess/Network/NetworkProcessProxy.messages.in:
597
598         * UIProcess/Storage/StorageProcessProxy.cpp:
599         (WebKit::StorageProcessProxy::getLaunchOptions):
600         (WebKit::StorageProcessProxy::getStorageProcessConnection):
601         (WebKit::StorageProcessProxy::didClose):
602         (WebKit::StorageProcessProxy::didCreateStorageToWebProcessConnection):
603         (WebKit::StorageProcessProxy::didFinishLaunching):
604         (WebKit::StorageProcessProxy::getDatabaseProcessConnection): Deleted.
605         (WebKit::StorageProcessProxy::didCreateDatabaseToWebProcessConnection): Deleted.
606         * UIProcess/Storage/StorageProcessProxy.h:
607         * UIProcess/Storage/StorageProcessProxy.messages.in:
608
609         * UIProcess/WebContextClient.cpp:
610         (WebKit::WebContextClient::storageProcessDidCrash):
611         (WebKit::WebContextClient::databaseProcessDidCrash): Deleted.
612         * UIProcess/WebContextClient.h:
613
614         * UIProcess/WebProcessPool.cpp:
615         (WebKit::WebProcessPool::ensureStorageProcessAndWebsiteDataStore):
616         (WebKit::WebProcessPool::getStorageProcessConnection):
617         (WebKit::WebProcessPool::storageProcessCrashed):
618         (WebKit::WebProcessPool::pageAddedToProcess):
619         (WebKit::WebProcessPool::storageProcessIdentifier):
620         (WebKit::WebProcessPool::terminateStorageProcess):
621         (WebKit::WebProcessPool::ensureDatabaseProcessAndWebsiteDataStore): Deleted.
622         (WebKit::WebProcessPool::getDatabaseProcessConnection): Deleted.
623         (WebKit::WebProcessPool::databaseProcessCrashed): Deleted.
624         (WebKit::WebProcessPool::databaseProcessIdentifier): Deleted.
625         (WebKit::WebProcessPool::terminateDatabaseProcess): Deleted.
626         * UIProcess/WebProcessPool.h:
627         (WebKit::WebProcessPool::sendToStorageProcessRelaunchingIfNecessary):
628         (WebKit::WebProcessPool::sendToDatabaseProcessRelaunchingIfNecessary): Deleted.
629
630         * UIProcess/WebProcessProxy.cpp:
631         (WebKit::WebProcessProxy::getStorageProcessConnection):
632         (WebKit::WebProcessProxy::getDatabaseProcessConnection): Deleted.
633         * UIProcess/WebProcessProxy.h:
634         * UIProcess/WebProcessProxy.messages.in:
635
636         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
637         (WebKit::WebsiteDataStore::fetchDataAndApply):
638         (WebKit::WebsiteDataStore::removeData):
639         (WebKit::WebsiteDataStore::storageProcessParameters):
640         (WebKit::WebsiteDataStore::databaseProcessParameters): Deleted.
641         * UIProcess/WebsiteData/WebsiteDataStore.h:
642
643         * WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.cpp:
644         (WebKit::WebIDBConnectionToServer::messageSenderConnection):
645         * WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.h:
646
647         * WebProcess/Databases/WebDatabaseProvider.cpp:
648         (WebKit::WebDatabaseProvider::idbConnectionToServerForSession):
649
650         * WebProcess/Storage/WebToStorageProcessConnection.cpp:
651         (WebKit::WebToStorageProcessConnection::WebToStorageProcessConnection):
652         (WebKit::WebToStorageProcessConnection::~WebToStorageProcessConnection):
653         (WebKit::WebToStorageProcessConnection::didReceiveMessage):
654         (WebKit::WebToStorageProcessConnection::didClose):
655         (WebKit::WebToStorageProcessConnection::didReceiveInvalidMessage):
656         (WebKit::WebToStorageProcessConnection::idbConnectionToServerForSession):
657         (WebKit::WebToDatabaseProcessConnection::WebToDatabaseProcessConnection): Deleted.
658         (WebKit::WebToDatabaseProcessConnection::~WebToDatabaseProcessConnection): Deleted.
659         (WebKit::WebToDatabaseProcessConnection::didReceiveMessage): Deleted.
660         (WebKit::WebToDatabaseProcessConnection::didClose): Deleted.
661         (WebKit::WebToDatabaseProcessConnection::didReceiveInvalidMessage): Deleted.
662         (WebKit::WebToDatabaseProcessConnection::idbConnectionToServerForSession): Deleted.
663         * WebProcess/Storage/WebToStorageProcessConnection.h:
664         (WebKit::WebToStorageProcessConnection::create):
665         (WebKit::WebToDatabaseProcessConnection::create): Deleted.
666         (WebKit::WebToDatabaseProcessConnection::connection): Deleted.
667
668         * WebProcess/WebProcess.cpp:
669         (WebKit::WebProcess::webToStorageProcessConnectionClosed):
670         (WebKit::WebProcess::webToStorageProcessConnection):
671         (WebKit::WebProcess::ensureWebToStorageProcessConnection):
672         (WebKit::WebProcess::webToDatabaseProcessConnectionClosed): Deleted.
673         (WebKit::WebProcess::webToDatabaseProcessConnection): Deleted.
674         (WebKit::WebProcess::ensureWebToDatabaseProcessConnection): Deleted.
675         * WebProcess/WebProcess.h:
676
677 2017-07-27  Nan Wang  <n_wang@apple.com>
678
679         AX: A11Y: Zoom no longer follows keyboard insertion point in safari
680         https://bugs.webkit.org/show_bug.cgi?id=174869
681
682         Reviewed by David Kilzer.
683
684         There was a recent change by denying XPC services access by default. 
685         In UAZoomChangeFocus we need to send message to HIServices, so let's
686         allow the connection to XPC services for that. 
687
688         * WebProcess/com.apple.WebProcess.sb.in:
689
690 2017-07-27  Brady Eidson  <beidson@apple.com>
691
692         Part 1 of: Rename DatabaseProcess to StorageProcess.
693         https://bugs.webkit.org/show_bug.cgi?id=174879
694
695         Reviewed by Andy Estes.
696
697         This patch is all about renaming source files and renaming the process itself (touching build system files, etc etc).
698
699         Some renaming in actual code did result (Some class/struct names, method names, etc)
700
701         Part 2 (174880) will go through and update all references in code itself from "Database" to "Storage"
702
703         * CMakeLists.txt:
704         * Configurations/Storage-iOS.entitlements: Renamed from Source/WebKit/Configurations/Databases-iOS.entitlements.
705         * Configurations/StorageService.xcconfig: Renamed from Source/WebKit/Configurations/DatabaseService.xcconfig.
706         * Configurations/WebKit.xcconfig:
707         * DerivedSources.make:
708         * Platform/ExtraPrivateSymbolsForTAPI.h:
709         * PlatformGTK.cmake:
710         * PlatformMac.cmake:
711         * PlatformWPE.cmake:
712
713         * Resources/SandboxProfiles/ios/com.apple.WebKit.Storage.sb: Renamed from Source/WebKit/Resources/SandboxProfiles/ios/com.apple.WebKit.Databases.sb.
714
715         * Shared/Storage/StorageProcessCreationParameters.cpp: Renamed from Source/WebKit/Shared/Databases/DatabaseProcessCreationParameters.cpp.
716         (WebKit::StorageProcessCreationParameters::StorageProcessCreationParameters):
717         (WebKit::StorageProcessCreationParameters::encode):
718         (WebKit::StorageProcessCreationParameters::decode):
719         * Shared/Storage/StorageProcessCreationParameters.h: Renamed from Source/WebKit/Shared/Databases/DatabaseProcessCreationParameters.h.
720
721         * StorageProcess/EntryPoint/mac/XPCService/StorageService/Info.plist: Renamed from Source/WebKit/DatabaseProcess/EntryPoint/mac/XPCService/DatabaseService/Info.plist.
722         * StorageProcess/EntryPoint/mac/XPCService/StorageServiceEntryPoint.mm: Renamed from Source/WebKit/DatabaseProcess/EntryPoint/mac/XPCService/DatabaseServiceEntryPoint.mm.
723         (StorageServiceInitializer):
724         * StorageProcess/EntryPoint/unix/StorageProcessMain.cpp: Renamed from Source/WebKit/DatabaseProcess/EntryPoint/unix/DatabaseProcessMain.cpp.
725         (main):
726
727         * StorageProcess/IndexedDB/WebIDBConnectionToClient.cpp: Renamed from Source/WebKit/DatabaseProcess/IndexedDB/WebIDBConnectionToClient.cpp.
728         * StorageProcess/IndexedDB/WebIDBConnectionToClient.h: Renamed from Source/WebKit/DatabaseProcess/IndexedDB/WebIDBConnectionToClient.h.
729         * StorageProcess/IndexedDB/WebIDBConnectionToClient.messages.in: Renamed from Source/WebKit/DatabaseProcess/IndexedDB/WebIDBConnectionToClient.messages.in.
730         
731         * StorageProcess/StorageProcess.cpp: Renamed from Source/WebKit/DatabaseProcess/DatabaseProcess.cpp.
732         * StorageProcess/StorageProcess.h: Renamed from Source/WebKit/DatabaseProcess/DatabaseProcess.h.
733         * StorageProcess/StorageProcess.messages.in: Renamed from Source/WebKit/DatabaseProcess/DatabaseProcess.messages.in.
734
735         * StorageProcess/StorageToWebProcessConnection.cpp: Renamed from Source/WebKit/DatabaseProcess/DatabaseToWebProcessConnection.cpp.
736         * StorageProcess/StorageToWebProcessConnection.h: Renamed from Source/WebKit/DatabaseProcess/DatabaseToWebProcessConnection.h.
737         * StorageProcess/StorageToWebProcessConnection.messages.in: Renamed from Source/WebKit/DatabaseProcess/DatabaseToWebProcessConnection.messages.in.
738
739         * StorageProcess/gtk/StorageProcessMainGtk.cpp: Renamed from Source/WebKit/DatabaseProcess/gtk/DatabaseProcessMainGtk.cpp.
740         (WebKit::StorageProcessMainUnix):
741         * StorageProcess/ios/StorageProcessIOS.mm: Renamed from Source/WebKit/DatabaseProcess/ios/DatabaseProcessIOS.mm.
742         (WebKit::StorageProcess::initializeProcess):
743         (WebKit::StorageProcess::initializeProcessName):
744         (WebKit::StorageProcess::initializeSandbox):
745         * StorageProcess/mac/StorageProcessMac.mm: Renamed from Source/WebKit/DatabaseProcess/mac/DatabaseProcessMac.mm.
746         (WebKit::StorageProcess::initializeProcess):
747         (WebKit::StorageProcess::initializeProcessName):
748         (WebKit::StorageProcess::initializeSandbox):
749
750         * StorageProcess/mac/com.apple.WebKit.Databases.sb.in: Copied from Source/WebKit/DatabaseProcess/mac/com.apple.WebKit.Databases.sb.in.
751         * StorageProcess/mac/com.apple.WebKit.Storage.sb.in: Renamed from Source/WebKit/DatabaseProcess/mac/com.apple.WebKit.Databases.sb.in.
752
753         * StorageProcess/unix/StorageProcessMainUnix.h: Renamed from Source/WebKit/DatabaseProcess/unix/DatabaseProcessMainUnix.h.
754
755         * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
756         (WebKit::serviceName):
757
758         * UIProcess/Network/NetworkProcessProxy.cpp:
759         (WebKit::NetworkProcessProxy::grantSandboxExtensionsToDatabaseProcessForBlobs):
760
761         * UIProcess/Storage/StorageProcessProxy.cpp: Renamed from Source/WebKit/UIProcess/Databases/DatabaseProcessProxy.cpp.
762         * UIProcess/Storage/StorageProcessProxy.h: Renamed from Source/WebKit/UIProcess/Databases/DatabaseProcessProxy.h.
763         * UIProcess/Storage/StorageProcessProxy.messages.in: Renamed from Source/WebKit/UIProcess/Databases/DatabaseProcessProxy.messages.in.
764
765         * UIProcess/WebContextSupplement.h:
766         (WebKit::WebContextSupplement::processDidClose):
767
768         * UIProcess/WebProcessPool.cpp:
769         (WebKit::WebProcessPool::ensureDatabaseProcessAndWebsiteDataStore):
770         (WebKit::WebProcessPool::databaseProcessCrashed):
771         (WebKit::WebProcessPool::pageAddedToProcess):
772         * UIProcess/WebProcessPool.h:
773
774         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
775         (WebKit::WebsiteDataStore::databaseProcessParameters):
776         * UIProcess/WebsiteData/WebsiteDataStore.h:
777
778         * WebKit.xcodeproj/project.pbxproj:
779
780         * WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.cpp:
781         (WebKit::WebIDBConnectionToServer::WebIDBConnectionToServer):
782         (WebKit::WebIDBConnectionToServer::~WebIDBConnectionToServer):
783         * WebProcess/Databases/WebDatabaseProvider.cpp:
784
785         * WebProcess/Storage/WebToStorageProcessConnection.cpp: Renamed from Source/WebKit/WebProcess/Databases/WebToDatabaseProcessConnection.cpp.
786         * WebProcess/Storage/WebToStorageProcessConnection.h: Renamed from Source/WebKit/WebProcess/Databases/WebToDatabaseProcessConnection.h.
787
788         * WebProcess/WebProcess.cpp:
789
790 2017-07-27  Tim Horton  <timothy_horton@apple.com>
791
792         PDF page number indicator is very flashy when scrolling
793         https://bugs.webkit.org/show_bug.cgi?id=174882
794         <rdar://problem/23760981>
795
796         Reviewed by Andy Estes.
797
798         * Platform/spi/ios/UIKitSPI.h:
799         * UIProcess/ios/WKPDFPageNumberIndicator.mm:
800         (-[WKPDFPageNumberIndicator initWithFrame:]):
801         Increase the backdrop rendering resolution to reduce flashiness.
802         It's still not perfect, but it's quite visibly better.
803
804 2017-07-26  Brady Eidson  <beidson@apple.com>
805
806         ResourceLoadStatistics API tests fail on El Capitan.
807         https://bugs.webkit.org/show_bug.cgi?id=174877
808
809         Reviewed by Chris Dumez.
810
811         Always install the testing callback.
812
813         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
814         (WebKit::WebsiteDataStore::enableResourceLoadStatisticsAndSetTestingCallback):
815
816 2017-07-26  Tim Horton  <timothy_horton@apple.com>
817
818         REGRESSION (r211160): Can't pinch to zoom unlocked encrypted PDFs in WKWebView
819         https://bugs.webkit.org/show_bug.cgi?id=174881
820         <rdar://problem/33556312>
821
822         Reviewed by Andy Estes.
823
824         * UIProcess/API/Cocoa/WKWebView.mm:
825         (-[WKWebView _hidePasswordView]):
826         WKPasswordView saves and restores a bunch of scroll view properties, including
827         those relating to zoom limits. The restoration happens in -[WKPasswordView hide],
828         which is never called. Instead, the code added in r211160 just calls
829         removeFromSuperview after unlocking, never restoring the old zoom limits,
830         causing the then fully unlocked PDF to not be zoomable. Fix this by calling
831         -hide instead of -removeFromSuperview (which -hide also calls).
832
833 2017-07-26  Brady Eidson  <beidson@apple.com>
834
835         Rename {Web/UI}Process/Storage to {Web/UI}Process/WebStorage.
836         https://bugs.webkit.org/show_bug.cgi?id=174871
837
838         Reviewed by Chris Dumez.
839
840         The standard these directories help implement is the "Web Storage" standard.
841         "Storage" is too general of a word that we have plans to start using in other contexts soon.
842
843         * CMakeLists.txt:
844         * DerivedSources.make:
845         * PlatformGTK.cmake:
846         * PlatformMac.cmake:
847         * PlatformWPE.cmake:
848         * WebKit.xcodeproj/project.pbxproj:
849
850         * UIProcess/ResourceLoadStatisticsPersistentStorage.cpp: Renamed from Source/WebKit/UIProcess/Storage/ResourceLoadStatisticsPersistentStorage.cpp.
851         * UIProcess/ResourceLoadStatisticsPersistentStorage.h: Renamed from Source/WebKit/UIProcess/Storage/ResourceLoadStatisticsPersistentStorage.h.
852         * UIProcess/WebStorage/LocalStorageDatabase.cpp: Renamed from Source/WebKit/UIProcess/Storage/LocalStorageDatabase.cpp.
853         * UIProcess/WebStorage/LocalStorageDatabase.h: Renamed from Source/WebKit/UIProcess/Storage/LocalStorageDatabase.h.
854         * UIProcess/WebStorage/LocalStorageDatabaseTracker.cpp: Renamed from Source/WebKit/UIProcess/Storage/LocalStorageDatabaseTracker.cpp.
855         * UIProcess/WebStorage/LocalStorageDatabaseTracker.h: Renamed from Source/WebKit/UIProcess/Storage/LocalStorageDatabaseTracker.h.
856         * UIProcess/WebStorage/StorageManager.cpp: Renamed from Source/WebKit/UIProcess/Storage/StorageManager.cpp.
857         * UIProcess/WebStorage/StorageManager.h: Renamed from Source/WebKit/UIProcess/Storage/StorageManager.h.
858         * UIProcess/WebStorage/StorageManager.messages.in: Renamed from Source/WebKit/UIProcess/Storage/StorageManager.messages.in.
859         * UIProcess/WebStorage/ios/LocalStorageDatabaseTrackerIOS.mm: Renamed from Source/WebKit/UIProcess/Storage/ios/LocalStorageDatabaseTrackerIOS.mm.
860         * UIProcess/ios/ResourceLoadStatisticsPersistentStorageIOS.mm: Renamed from Source/WebKit/UIProcess/Storage/ios/ResourceLoadStatisticsPersistentStorageIOS.mm.
861
862         * WebProcess/WebStorage/StorageAreaImpl.cpp: Renamed from Source/WebKit/WebProcess/Storage/StorageAreaImpl.cpp.
863         * WebProcess/WebStorage/StorageAreaImpl.h: Renamed from Source/WebKit/WebProcess/Storage/StorageAreaImpl.h.
864         * WebProcess/WebStorage/StorageAreaMap.cpp: Renamed from Source/WebKit/WebProcess/Storage/StorageAreaMap.cpp.
865         * WebProcess/WebStorage/StorageAreaMap.h: Renamed from Source/WebKit/WebProcess/Storage/StorageAreaMap.h.
866         * WebProcess/WebStorage/StorageAreaMap.messages.in: Renamed from Source/WebKit/WebProcess/Storage/StorageAreaMap.messages.in.
867         * WebProcess/WebStorage/StorageNamespaceImpl.cpp: Renamed from Source/WebKit/WebProcess/Storage/StorageNamespaceImpl.cpp.
868         * WebProcess/WebStorage/StorageNamespaceImpl.h: Renamed from Source/WebKit/WebProcess/Storage/StorageNamespaceImpl.h.
869         * WebProcess/WebStorage/WebStorageNamespaceProvider.cpp: Renamed from Source/WebKit/WebProcess/Storage/WebStorageNamespaceProvider.cpp.
870         * WebProcess/WebStorage/WebStorageNamespaceProvider.h: Renamed from Source/WebKit/WebProcess/Storage/WebStorageNamespaceProvider.h.
871
872 2017-07-26  Brady Eidson  <beidson@apple.com>
873
874         Remove DATABASE_PROCESS build flag.
875         https://bugs.webkit.org/show_bug.cgi?id=174868
876
877         Reviewed by Andy Estes.
878
879         * CMakeLists.txt:
880         * DatabaseProcess/DatabaseProcess.cpp:
881         * DatabaseProcess/DatabaseProcess.h:
882         * DatabaseProcess/DatabaseProcess.messages.in:
883         * DatabaseProcess/DatabaseToWebProcessConnection.cpp:
884         * DatabaseProcess/DatabaseToWebProcessConnection.h:
885         * DatabaseProcess/DatabaseToWebProcessConnection.messages.in:
886         * DatabaseProcess/IndexedDB/WebIDBConnectionToClient.messages.in:
887         * DatabaseProcess/gtk/DatabaseProcessMainGtk.cpp:
888         * DatabaseProcess/ios/DatabaseProcessIOS.mm:
889         * DatabaseProcess/mac/DatabaseProcessMac.mm:
890         * DatabaseProcess/unix/DatabaseProcessMainUnix.h:
891         * Shared/Databases/DatabaseProcessCreationParameters.cpp:
892         * Shared/Databases/DatabaseProcessCreationParameters.h:
893         * Shared/ProcessExecutablePath.h:
894         * Shared/gtk/ProcessExecutablePathGtk.cpp:
895         (WebKit::executablePathOfDatabaseProcess):
896         * Shared/wpe/ProcessExecutablePathWPE.cpp:
897         (WebKit::executablePathOfDatabaseProcess):
898         * UIProcess/ChildProcessProxy.cpp:
899         (WebKit::ChildProcessProxy::getLaunchOptions):
900         * UIProcess/Databases/DatabaseProcessProxy.cpp:
901         * UIProcess/Databases/DatabaseProcessProxy.h:
902         * UIProcess/Databases/DatabaseProcessProxy.messages.in:
903         * UIProcess/Launcher/ProcessLauncher.h:
904         * UIProcess/Launcher/gtk/ProcessLauncherGtk.cpp:
905         (WebKit::ProcessLauncher::launchProcess):
906         * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
907         (WebKit::serviceName):
908         * UIProcess/Launcher/wpe/ProcessLauncherWPE.cpp:
909         (WebKit::ProcessLauncher::launchProcess):
910         * UIProcess/Network/NetworkProcessProxy.cpp:
911         (WebKit::NetworkProcessProxy::grantSandboxExtensionsToDatabaseProcessForBlobs):
912         * UIProcess/WebProcessPool.cpp:
913         (WebKit::WebProcessPool::databaseProcessCrashed):
914         (WebKit::WebProcessPool::databaseProcessIdentifier):
915         (WebKit::WebProcessPool::terminateDatabaseProcess):
916         * UIProcess/WebProcessPool.h:
917         (WebKit::WebProcessPool::sendToDatabaseProcessRelaunchingIfNecessary):
918         * UIProcess/WebProcessProxy.cpp:
919         (WebKit::WebProcessProxy::getDatabaseProcessConnection):
920         * UIProcess/WebProcessProxy.h:
921         * UIProcess/WebProcessProxy.messages.in:
922         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
923         (WebKit::WebsiteDataStore::fetchDataAndApply):
924         (WebKit::WebsiteDataStore::removeData):
925         * WebKit2Prefix.h:
926         * WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.messages.in:
927         * WebProcess/Databases/WebToDatabaseProcessConnection.cpp:
928         * WebProcess/Databases/WebToDatabaseProcessConnection.h:
929         * WebProcess/WebProcess.cpp:
930         * WebProcess/WebProcess.h:
931
932 2017-07-26  Brady Eidson  <beidson@apple.com>
933
934         Add test to verify certain child processes are not launched as a side effect of enabling ResourceLoadStatistics.
935         https://bugs.webkit.org/show_bug.cgi?id=174851
936
937         Reviewed by Chris Dumez.
938
939         * UIProcess/API/Cocoa/WKProcessPool.mm:
940         (-[WKProcessPool _databaseProcessIdentifier]):
941         (-[WKProcessPool _pluginProcessCount]):
942         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
943
944         * UIProcess/Plugins/PluginProcessManager.h:
945         (WebKit::PluginProcessManager::pluginProcesses):
946
947 2017-07-26  Brian Burg  <bburg@apple.com>
948
949         Remove WEB_TIMING feature flag
950         https://bugs.webkit.org/show_bug.cgi?id=174795
951
952         Reviewed by Alex Christensen.
953
954         * Configurations/FeatureDefines.xcconfig:
955         * NetworkProcess/soup/NetworkDataTaskSoup.cpp:
956         (WebKit::NetworkDataTaskSoup::NetworkDataTaskSoup):
957         (WebKit::NetworkDataTaskSoup::createRequest):
958         (WebKit::NetworkDataTaskSoup::didSendRequest):
959         (WebKit::NetworkDataTaskSoup::dispatchDidReceiveResponse):
960         (WebKit::NetworkDataTaskSoup::dispatchDidCompleteWithError):
961         (WebKit::NetworkDataTaskSoup::continueHTTPRedirection):
962         (WebKit::NetworkDataTaskSoup::didGetHeaders):
963         (WebKit::NetworkDataTaskSoup::didRestart):
964         * NetworkProcess/soup/NetworkDataTaskSoup.h:
965
966 2017-07-26  Brian Burg  <bburg@apple.com>
967
968         Use SandboxExtension::HandleArray when sending extensions for file uploads to the web process
969         https://bugs.webkit.org/show_bug.cgi?id=174828
970
971         Reviewed by Tim Horton.
972
973         In the previous change I forgot to hoist the HandleArray and message-send out of the
974         loop, so the code wasn't actually sending fewer messages. That's fixed now.
975
976         * UIProcess/WebPageProxy.cpp:
977         (WebKit::WebPageProxy::didChooseFilesForOpenPanelWithDisplayStringAndIcon):
978         (WebKit::WebPageProxy::didChooseFilesForOpenPanel):
979
980 2017-07-26  Zan Dobersek  <zdobersek@igalia.com>
981
982         Unreviewed. Fix a compiler warning that springs up when
983         building the WPE port with Clang.
984
985         * UIProcess/API/wpe/ScrollGestureController.h:
986         Let ScrollGestureController be a class, and not a struct.
987         This fits the usual pattern, and also matches the forward
988         declaration used in WPE's PageClientImpl.h.
989
990 2017-07-26  Carlos Garcia Campos  <cgarcia@igalia.com>
991
992         Unreviewed. Update OptionsGTK.cmake and NEWS for 2.17.5 release.
993
994         * gtk/NEWS: Add release notes for 2.17.5.
995
996 2017-07-25  Carlos Garcia Campos  <cgarcia@igalia.com>
997
998         Icon loader error on startup
999         https://bugs.webkit.org/show_bug.cgi?id=174787
1000
1001         Reviewed by Brady Eidson.
1002
1003         Ignore non HTTP favicons in glib API.
1004
1005         * UIProcess/API/glib/WebKitIconLoadingClient.cpp:
1006
1007 2017-07-25  Brady Eidson  <beidson@apple.com>
1008
1009         ResourceLoadStatistics grandfathering happens much too often.
1010         <rdar://problem/32655834> and https://bugs.webkit.org/show_bug.cgi?id=174825
1011
1012         Reviewed by Chris Dumez.
1013
1014         The ResourceLoadStatistics grandfathering procedure happens too often.
1015         - With an empty memory store, even though an empty memory store is a perfectly valid state.
1016         - On each launch, even if grandfathering happened on the last launch - because grandfathering
1017           data would not automatically be saved to disk.
1018         - After clearing all website data, at which point no grandfathering can possibly be relevant
1019           because there is no data to grandfather.
1020
1021         This patch fixes those cases and adds API tests to verify they remain fixed.
1022
1023         * Shared/WebsiteData/WebsiteDataType.h:
1024
1025         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
1026         (+[WKWebsiteDataStore _allWebsiteDataTypesIncludingPrivate]): allWebsiteDataTypes, but even with the private ones.
1027         (-[WKWebsiteDataStore _resourceLoadStatisticsClearInMemoryAndPersistentStore]): If the types being cleared cover all of 
1028           the types that ResourceLoadStatistics care about, don't grandfather afterwards.
1029         (-[WKWebsiteDataStore _resourceLoadStatisticsClearInMemoryAndPersistentStoreModifiedSinceHours:]): Ditto.
1030         (-[WKWebsiteDataStore _setResourceLoadStatisticsTestingCallback:]):
1031         * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
1032
1033         * UIProcess/Storage/ResourceLoadStatisticsPersistentStorage.cpp:
1034         (WebKit::ResourceLoadStatisticsPersistentStorage::populateMemoryStoreFromDisk): Don't grandfather if the store read from 
1035           disk is empty (as being empty is perfectly fine), and also log the event of "populated without grandfathering".
1036         * UIProcess/Storage/ResourceLoadStatisticsPersistentStorage.h:
1037
1038         * UIProcess/WebProcessProxy.cpp:
1039         (WebKit::WebProcessProxy::topPrivatelyControlledDomainsWithWebsiteData):
1040
1041         * UIProcess/WebResourceLoadStatisticsStore.cpp:
1042         (WebKit::WebResourceLoadStatisticsStore::monitoredDataTypes):
1043         (WebKit::WebResourceLoadStatisticsStore::WebResourceLoadStatisticsStore):
1044         (WebKit::WebResourceLoadStatisticsStore::~WebResourceLoadStatisticsStore):
1045         (WebKit::WebResourceLoadStatisticsStore::removeDataRecords): 
1046         (WebKit::WebResourceLoadStatisticsStore::grandfatherExistingWebsiteData): Schedule a write right away so we don't re-grandfather
1047           on next launch, and also log the grandfathering event.
1048         (WebKit::WebResourceLoadStatisticsStore::scheduleClearInMemoryAndPersistent): Takes a ShouldGrandfather flag
1049           to tell whether or not data should be re-grandfathered after the store is cleared.
1050         (WebKit::WebResourceLoadStatisticsStore::logTestingEvent): Log the event to the testing client.
1051         (WebKit::dataTypesToRemove): Deleted.
1052         * UIProcess/WebResourceLoadStatisticsStore.h:
1053
1054         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
1055         (WebKit::WebsiteDataStore::removeData):
1056         (WebKit::WebsiteDataStore::setResourceLoadStatisticsEnabled):
1057         (WebKit::WebsiteDataStore::enableResourceLoadStatisticsAndSetTestingCallback): Handles enabling ResourceLoadStatistics both
1058           with and without a testing callback.
1059         * UIProcess/WebsiteData/WebsiteDataStore.h:
1060
1061 2017-07-25  Andy Estes  <aestes@apple.com>
1062
1063         [Apple Pay] Add "carteBancaire" as a supported payment network
1064         https://bugs.webkit.org/show_bug.cgi?id=174841
1065         <rdar://problem/31935596>
1066
1067         Reviewed by Alex Christensen.
1068
1069         * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
1070         (WebKit::toSupportedNetwork):
1071
1072 2017-07-25  Brian Burg  <bburg@apple.com>
1073
1074         Use SandboxExtension::HandleArray when sending extensions for file uploads to the web process
1075         https://bugs.webkit.org/show_bug.cgi?id=174828
1076
1077         Reviewed by Tim Horton.
1078
1079         Send all of the sandbox extension handles in a single message, rather than
1080         one message per extension. Update message name and parameter types to match.
1081
1082         * UIProcess/WebPageProxy.cpp:
1083         (WebKit::WebPageProxy::didChooseFilesForOpenPanelWithDisplayStringAndIcon):
1084         (WebKit::WebPageProxy::didChooseFilesForOpenPanel):
1085         * WebProcess/WebPage/WebPage.cpp:
1086         (WebKit::WebPage::extendSandboxForFilesFromOpenPanel):
1087         (WebKit::WebPage::extendSandboxForFileFromOpenPanel): Deleted.
1088         * WebProcess/WebPage/WebPage.h:
1089         * WebProcess/WebPage/WebPage.messages.in:
1090
1091 2017-07-25  Alex Christensen  <achristensen@webkit.org>
1092
1093         Fix API tests after r219871.
1094         https://bugs.webkit.org/show_bug.cgi?id=174807
1095
1096         WebKit2.OpenAndCloseWindowAsync and WebKit2.OpenAsyncWithNil API tests are fixed.
1097
1098         * UIProcess/WebPageProxy.cpp:
1099         (WebKit::WebPageProxy::createNewPage):
1100         createNewPageAsync or createNewPage should be called, not both.
1101
1102 2017-07-25  Said Abou-Hallawa  <sabouhallawa@apple.com>
1103
1104         Async image decoding for large images should be disabled after the first time a tile is painted
1105         https://bugs.webkit.org/show_bug.cgi?id=174451
1106         <rdar://problem/31246421>
1107
1108         Reviewed by Simon Fraser.
1109
1110         * Shared/mac/RemoteLayerBackingStore.mm:
1111         (WebKit::RemoteLayerBackingStore::drawInContext):
1112         * WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp:
1113         (WebKit::imageForRect):
1114         * WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.cpp:
1115         (WebKit::InjectedBundleRangeHandle::renderedImage):
1116         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp:
1117         (WebKit::CompositingCoordinator::paintContents):
1118         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.h:
1119
1120 2017-07-25  Brian Burg  <bburg@apple.com>
1121
1122         Web Automation: add support for uploading files
1123         https://bugs.webkit.org/show_bug.cgi?id=174797
1124         <rdar://problem/28485063>
1125
1126         Reviewed by Joseph Pecoraro.
1127
1128         The general strategy is to have automation clients set the list of files they want
1129         to select ahead of time. Then, the client simulates a click on the <input type="file"> element.
1130         When that causes WebPageProxy to ask the UI delegate to runOpenPanel, it instead
1131         gives WebAutomationSession a chance to select files if the page is under control of
1132         automation. WebAutomationSession validates its file list and selects the files if valid.
1133
1134         * CMakeLists.txt: Add frontend dispatcher files.
1135         * DerivedSources.make:
1136         Add frontend dispatcher code generator scripts as dependencies of the generated code.
1137         Add generated frontend dispatcher files to the list of output files.
1138
1139         * UIProcess/Automation/Automation.json:
1140         Add a command to set the canned list of files that should be selected when prompted.
1141         If no files are selected, then the effect is as if the user had clicked "cancel" in
1142         the file chooser dialog.
1143
1144         Add an event to signal to the WebDriver service that the file selection request has
1145         been either fulfilled or cancelled. This event is necessary because otherwise remotes
1146         cannot distinguish whether selecting the files failed for some reason, or if the
1147         UIProcess has not yet selected the files and sent them to the web content process.
1148         In either case, the input element's "files" attribute would return an empty FileList.
1149
1150         * UIProcess/Automation/WebAutomationSession.h:
1151         * UIProcess/Automation/WebAutomationSession.cpp:
1152         (WebKit::WebAutomationSession::WebAutomationSession):
1153         Add the frontend dispatcher for Automation domain. This is named m_domainNotifier since
1154         m_domainDispatcher is already being used for the backend command dispatcher.
1155
1156         (WebKit::WebAutomationSession::handleRunOpenPanel):
1157         Validate that the files-to-select list has valid entries and select the files if so.
1158         If anything goes wrong, pretend to cancel out of the file chooser. Either way, notify the
1159         frontend with an event that the file chooser was dismissed due to selecting files or cancelling.
1160         Automation protocol clients may implement additional strategies to further restrict
1161         the conditions upon which local files can be uploaded.
1162
1163         (WebKit::WebAutomationSession::setFilesToSelectForFileUpload): Added.
1164         Store the list of files as a vector of strings. The file list is always replaced.
1165
1166         * UIProcess/WebPageProxy.cpp:
1167         (WebKit::WebPageProxy::runOpenPanel):
1168         If the page is under automation, delegating the runOpenPanel is likely to hang
1169         because WebDriver cannot interact directly with the file chooser dialog. Instead,
1170         give WebAutomationSession a chance to select files and don't tell the delegate.
1171
1172         * WebKit.xcodeproj/project.pbxproj:
1173         Add frontend dispatcher files to "Derived Sources" group.
1174
1175 2017-07-25  Alex Christensen  <achristensen@webkit.org>
1176
1177         Modernize NavigationAction code
1178         https://bugs.webkit.org/show_bug.cgi?id=174807
1179
1180         Reviewed by Darin Adler.
1181
1182         Mostly just use more move semantics.
1183
1184         * Platform/IPC/HandleMessage.h:
1185         (IPC::callMemberFunctionImpl):
1186         * Shared/API/APIURLRequest.h:
1187         * Shared/NavigationActionData.h:
1188         * UIProcess/API/APINavigation.cpp:
1189         (API::Navigation::Navigation):
1190         * UIProcess/API/APINavigation.h:
1191         (API::Navigation::create):
1192         * UIProcess/API/APINavigationAction.h:
1193         * UIProcess/API/APINavigationClient.h:
1194         (API::NavigationClient::decidePolicyForNavigationAction):
1195         * UIProcess/API/APIPolicyClient.h:
1196         * UIProcess/API/APIUIClient.h:
1197         (API::UIClient::createNewPage):
1198         (API::UIClient::createNewPageAsync):
1199         (API::UIClient::canCreateNewPageAsync):
1200         * UIProcess/API/C/WKPage.cpp:
1201         (WKPageLoadURLRequest):
1202         (WKPageLoadURLRequestWithUserData):
1203         (WKPageSetPageUIClient):
1204         (WKPageSetPageNavigationClient):
1205         * UIProcess/Cocoa/NavigationState.h:
1206         * UIProcess/Cocoa/NavigationState.mm:
1207         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
1208         * UIProcess/Cocoa/UIDelegate.h:
1209         * UIProcess/Cocoa/UIDelegate.mm:
1210         (WebKit::UIDelegate::UIClient::createNewPageCommon):
1211         (WebKit::UIDelegate::UIClient::createNewPage):
1212         (WebKit::UIDelegate::UIClient::canCreateNewPageAsync):
1213         (WebKit::UIDelegate::UIClient::createNewPageAsync):
1214         * UIProcess/WebInspectorProxy.cpp:
1215         (WebKit::decidePolicyForNavigationAction):
1216         * UIProcess/WebNavigationState.cpp:
1217         (WebKit::WebNavigationState::createLoadRequestNavigation):
1218         * UIProcess/WebNavigationState.h:
1219         * UIProcess/WebPageProxy.cpp:
1220         (WebKit::WebPageProxy::loadRequest):
1221         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
1222         (WebKit::WebPageProxy::decidePolicyForNewWindowAction):
1223         (WebKit::WebPageProxy::createNewPage):
1224         * UIProcess/WebPageProxy.h:
1225
1226 2017-07-25  Carlos Garcia Campos  <cgarcia@igalia.com>
1227
1228         REGRESSION(r218629): [GTK] ASSERTION FAILED: m_eglDisplay == EGL_NO_DISPLAY in WebCore::PlatformDisplay::~PlatformDisplay
1229         https://bugs.webkit.org/show_bug.cgi?id=174789
1230
1231         Reviewed by Žan Doberšek.
1232
1233         Before r218629, the wayland nested compositor display was a singleton created on demand by
1234         AcceleratedSurfaceWayland, but now it's created unconditionally on web process creation when a valid display
1235         name is received from the UI process. The side effect of this is that now the shared display is created after
1236         the nested compositor display that is not a singleton anymore. The atexit used by PlatformDisplay to shutdown
1237         egl display assumes that it will be registered by the shared display. Since we switched to on demand AC mode,
1238         the shared display is only used in the web process when entering AC mode, that's why it only crashes when we
1239         have entered AC at least once. We just need to ensure that the shared display is created before the nested
1240         compositor display.
1241
1242         * WebProcess/gtk/WaylandCompositorDisplay.cpp:
1243         (WebKit::WaylandCompositorDisplay::create): Check we are under wayland before creating the WaylandCompositorDisplay.
1244
1245 2017-07-24  Michael Catanzaro  <mcatanzaro@igalia.com>
1246
1247         [GTK] ASSERTION FAILED: client in WebKit::IconDatabase::setClient
1248         https://bugs.webkit.org/show_bug.cgi?id=174788
1249
1250         Reviewed by Carlos Garcia Campos.
1251
1252         IconDatabase ensures that setClient is never called with nullptr, but WebKitFaviconDatabase
1253         does exactly that. First, ensure it's safe to unset the client. Next, we can either remove
1254         the assertions from setClient or else automatically unset the client in IconDatabase::close.
1255         I opted to do both.
1256
1257         * UIProcess/API/glib/IconDatabase.cpp:
1258         (WebKit::IconDatabase::close):
1259         (WebKit::IconDatabase::setIconDataForIconURL):
1260         (WebKit::IconDatabase::setIconURLForPageURL):
1261         * UIProcess/API/glib/WebKitFaviconDatabase.cpp:
1262         (_WebKitFaviconDatabasePrivate::~_WebKitFaviconDatabasePrivate): Deleted.
1263         (webkitFaviconDatabaseDispose): Deleted.
1264
1265 2017-07-24  Michael Catanzaro  <mcatanzaro@igalia.com>
1266
1267         [GTK][WPE] Remove useless conditional in IconDatabase::setIconDataForIconURL
1268         https://bugs.webkit.org/show_bug.cgi?id=174792
1269
1270         Reviewed by Carlos Garcia Campos.
1271
1272         We have in IconDatabase::setIconDataForIconURL some code in a conditional to check if it's
1273         not being executed on the icon sync thread. But at the top of the function is an assertion
1274         to ensure the code is never executed on the icon sync thread. The condition is therefore
1275         useless and the code should be executed unconditionally.
1276
1277         * UIProcess/API/glib/IconDatabase.cpp:
1278         (WebKit::IconDatabase::setIconDataForIconURL):
1279
1280 2017-07-24  Carlos Garcia Campos  <cgarcia@igalia.com>
1281
1282         [GTK] Icon database error and crash
1283         https://bugs.webkit.org/show_bug.cgi?id=174760
1284
1285         Reviewed by Michael Catanzaro.
1286
1287         The crash is a debug ASSERT that happens when the IconRecord image is created in one thread and destroyed in
1288         another one. IconDatabase creates and destroys IconRecord objects in both database and main thread. The
1289         IconRecord is destroyed when the icon is no longer retained, and we only release icons when we fail to get the
1290         image data (including pages that don't have a favicon). We can prevent this crash from happening if we ensure we
1291         never create an Image for an IconRecord when the given image data is nullptr.
1292
1293         * UIProcess/API/glib/IconDatabase.cpp:
1294         (WebKit::IconDatabase::IconRecord::setImageData):
1295
1296 2017-07-24  Chris Dumez  <cdumez@apple.com>
1297
1298         [WK2][Cocoa] Allow overriding the ITP data removal internal using a default
1299         https://bugs.webkit.org/show_bug.cgi?id=174802
1300         <rdar://problem/33497898>
1301
1302         Reviewed by Sam Weinig.
1303
1304         Allow overriding the ITP data removal internal using a default to facilitate testing.
1305         Can be used like so:
1306         defaults write -g ResourceLoadStatisticsMinimumTimeBetweenDataRecordsRemoval 60
1307
1308         Will cause us to write every 60 seconds instead of 3600.
1309
1310         * Shared/WebPreferencesDefinitions.h:
1311         * UIProcess/Cocoa/WebResourceLoadStatisticsStoreCocoa.mm:
1312         (WebKit::WebResourceLoadStatisticsStore::registerUserDefaultsIfNeeded):
1313
1314 2017-07-24  Simon Fraser  <simon.fraser@apple.com>
1315
1316         [iOS WK2] Crash under PageOverlayController::uninstallPageOverlay when doing multiple finds
1317         https://bugs.webkit.org/show_bug.cgi?id=174806
1318         rdar://problem/33501664
1319
1320         Reviewed by Tim Horton.
1321         
1322         Calling TextIndicator::createWithSelectionInFrame can trigger layout via VisibleSelection code,
1323         which can re-enter FindController::updateFindIndicator which has by now removed m_findIndicatorOverlay
1324         from pageOverlayController's map, but not deleted it. The second call to uninstallPageOverlay()
1325         thus crashes at m_overlayGraphicsLayers.take(&overlay)->removeFromParent().
1326         
1327         Fix by nulling out m_findIndicatorOverlay as soon as we uninstall it.
1328
1329         * WebProcess/WebPage/ios/FindControllerIOS.mm:
1330         (WebKit::FindController::updateFindIndicator):
1331
1332 2017-07-24  Chris Dumez  <cdumez@apple.com>
1333
1334         Fix lifetime management issue in ResourceLoadStatisticsPersistentStorage::scheduleOrWriteMemoryStore()
1335         https://bugs.webkit.org/show_bug.cgi?id=174790
1336
1337         Reviewed by Brady Eidson.
1338
1339         Fix lifetime management issue in ResourceLoadStatisticsPersistentStorage::scheduleOrWriteMemoryStore().
1340         WorkQueue::dispatchAfter() keeps the WorkQueue alive because its implementation keeps a strong ref to
1341         |this|. As a result, the lambda passed to dispatchAfter(), which calls writeMemoryStoreToDisk(), can
1342         get executed after the store is gone.
1343
1344         To address the issue, we now use a RunLoop::Timer to schedule the write, instead of a
1345         WorkQueue::dispatchAfter() call. This way, we are guaranteed that the callback will not get called
1346         after the store has been destroyed.
1347
1348         * UIProcess/Storage/ResourceLoadStatisticsPersistentStorage.cpp:
1349         (WebKit::ResourceLoadStatisticsPersistentStorage::ResourceLoadStatisticsPersistentStorage):
1350         (WebKit::ResourceLoadStatisticsPersistentStorage::asyncWriteTimerFired):
1351         (WebKit::ResourceLoadStatisticsPersistentStorage::scheduleOrWriteMemoryStore):
1352         (WebKit::ResourceLoadStatisticsPersistentStorage::finishAllPendingWorkSynchronously):
1353         (WebKit::ResourceLoadStatisticsPersistentStorage::ref):
1354         (WebKit::ResourceLoadStatisticsPersistentStorage::deref):
1355         * UIProcess/Storage/ResourceLoadStatisticsPersistentStorage.h:
1356
1357 2017-07-24  Chris Dumez  <cdumez@apple.com>
1358
1359         Unreviewed, rolling out r219828.
1360
1361         Causes debug assertions to be hit on iOS
1362
1363         Reverted changeset:
1364
1365         "Fix lifetime management issue in
1366         ResourceLoadStatisticsPersistentStorage::scheduleOrWriteMemoryStore()"
1367         https://bugs.webkit.org/show_bug.cgi?id=174790
1368         http://trac.webkit.org/changeset/219828
1369
1370 2017-07-24  Michael Catanzaro  <mcatanzaro@igalia.com>
1371
1372         [GTK][WPE] Stop using AutodrainedPool in IconDatabase
1373         https://bugs.webkit.org/show_bug.cgi?id=174791
1374
1375         Reviewed by Alex Christensen.
1376
1377         AutodrainedPool seems to be some NS garbage collection thing that has no implementation on
1378         other platforms. Now that IconDatabase is used only by GTK and WPE, we can stop using it.
1379
1380         * UIProcess/API/glib/IconDatabase.cpp:
1381         (WebKit::IconDatabase::setIconDataForIconURL):
1382         (WebKit::IconDatabase::setIconURLForPageURL):
1383         (WebKit::IconDatabase::iconDatabaseSyncThread):
1384         (WebKit::IconDatabase::performURLImport):
1385         (WebKit::IconDatabase::readFromDatabase):
1386
1387 2017-07-24  Chris Dumez  <cdumez@apple.com>
1388
1389         Fix lifetime management issue in ResourceLoadStatisticsPersistentStorage::scheduleOrWriteMemoryStore()
1390         https://bugs.webkit.org/show_bug.cgi?id=174790
1391
1392         Reviewed by Brady Eidson.
1393
1394         Fix lifetime management issue in ResourceLoadStatisticsPersistentStorage::scheduleOrWriteMemoryStore().
1395         WorkQueue::dispatchAfter() keeps the WorkQueue alive because its implementation keeps a strong ref to
1396         |this|. As a result, the lambda passed to dispatchAfter(), which calls writeMemoryStoreToDisk(), can
1397         get executed after the store is gone.
1398
1399         * UIProcess/Storage/ResourceLoadStatisticsPersistentStorage.cpp:
1400         (WebKit::ResourceLoadStatisticsPersistentStorage::ResourceLoadStatisticsPersistentStorage):
1401         (WebKit::ResourceLoadStatisticsPersistentStorage::scheduleOrWriteMemoryStore):
1402         * UIProcess/Storage/ResourceLoadStatisticsPersistentStorage.h:
1403         (WebKit::ResourceLoadStatisticsPersistentStorage::createWeakPtr):
1404
1405 2017-07-23  Carlos Garcia Campos  <cgarcia@igalia.com>
1406
1407         Unreviewed. REGRESSION(r219713): [GTK][WPE] Fix default favicon database patch.
1408
1409         When nullptr is passed to webkit_web_context_set_favicon_database_directory() the default database directory was
1410         taken from WebProcessPool::platformDefaultIconDatabasePath(), that has been removed in r219713 without properly
1411         replacing it, now it uses an empty string. This causes that the current directory is used to create the favicon
1412         database.
1413
1414         * UIProcess/API/glib/WebKitWebContext.cpp:
1415         (webkit_web_context_set_favicon_database_directory): Use the default icon database directory instead of an empty
1416         string when nullptr is passed.
1417
1418 2017-07-23  Wenson Hsieh  <wenson_hsieh@apple.com>
1419
1420         [iOS WK2] 5 DataInteractionTests are failing: observed selection rects after dropping don't match expected values
1421         https://bugs.webkit.org/show_bug.cgi?id=174769
1422         <rdar://problem/33478864>
1423
1424         Reviewed by Tim Horton.
1425
1426         Fixes several API tests in the DataInteractionTests suite. See Source/WebCore/ChangeLog for more details.
1427
1428         * WebProcess/WebPage/WebPage.cpp:
1429         (WebKit::WebPage::performDragControllerAction):
1430
1431 2017-07-20  Carlos Garcia Campos  <cgarcia@igalia.com>
1432
1433         WebDriver: implement page load timeout
1434         https://bugs.webkit.org/show_bug.cgi?id=174672
1435
1436         Reviewed by Brian Burg.
1437
1438         Always start a timer when waiting for a navigation to complete. When the timer fires, pending callbacks for
1439         navigations are removed and invoked with a timeout error. If navigation completes before the timer is fired,
1440         then the timer is stopped. All navigation commands now receive the page load strategy and timeout as optional
1441         parameters, when not provided the default timeout (300 seconds) is used.
1442
1443         * UIProcess/Automation/Automation.json:
1444         * UIProcess/Automation/WebAutomationSession.cpp:
1445         (WebKit::WebAutomationSession::WebAutomationSession):
1446         (WebKit::WebAutomationSession::waitForNavigationToComplete):
1447         (WebKit::WebAutomationSession::waitForNavigationToCompleteOnPage):
1448         (WebKit::WebAutomationSession::waitForNavigationToCompleteOnFrame):
1449         (WebKit::WebAutomationSession::loadTimerFired):
1450         (WebKit::WebAutomationSession::navigateBrowsingContext):
1451         (WebKit::WebAutomationSession::goBackInBrowsingContext):
1452         (WebKit::WebAutomationSession::goForwardInBrowsingContext):
1453         (WebKit::WebAutomationSession::reloadBrowsingContext):
1454         (WebKit::WebAutomationSession::navigationOccurredForFrame):
1455         * UIProcess/Automation/WebAutomationSession.h:
1456
1457 2017-07-23  Takuro Ashie  <ashie@clear-code.com>
1458
1459         [GTK] Correct a typo in the reference manual of WebKitWebInspector
1460         https://bugs.webkit.org/show_bug.cgi?id=174767
1461
1462         Reviewed by Michael Catanzaro.
1463
1464         * UIProcess/API/gtk/WebKitWebInspector.cpp:
1465
1466 2017-07-23  Chris Dumez  <cdumez@apple.com>
1467
1468         Drop ExceptionCodeDescription class
1469         https://bugs.webkit.org/show_bug.cgi?id=174757
1470
1471         Reviewed by Darin Adler.
1472
1473         Update GTK bindings to use new API on DOMException instead of
1474         ExceptionCodeDescription.
1475
1476         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMAttr.cpp:
1477         (webkit_dom_attr_dispatch_event):
1478         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMBlob.cpp:
1479         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMCDATASection.cpp:
1480         (webkit_dom_cdata_section_dispatch_event):
1481         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMCSSRule.cpp:
1482         (webkit_dom_css_rule_set_css_text):
1483         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMCSSRuleList.cpp:
1484         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMCSSStyleDeclaration.cpp:
1485         (webkit_dom_css_style_declaration_set_property):
1486         (webkit_dom_css_style_declaration_set_css_text):
1487         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMCSSStyleSheet.cpp:
1488         (webkit_dom_css_style_sheet_insert_rule):
1489         (webkit_dom_css_style_sheet_delete_rule):
1490         (webkit_dom_css_style_sheet_add_rule):
1491         (webkit_dom_css_style_sheet_remove_rule):
1492         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMCSSValue.cpp:
1493         (webkit_dom_css_value_set_css_text):
1494         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMCharacterData.cpp:
1495         (webkit_dom_character_data_dispatch_event):
1496         (webkit_dom_character_data_insert_data):
1497         (webkit_dom_character_data_delete_data):
1498         (webkit_dom_character_data_replace_data):
1499         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMClientRect.cpp:
1500         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMClientRectList.cpp:
1501         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMComment.cpp:
1502         (webkit_dom_comment_dispatch_event):
1503         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDOMImplementation.cpp:
1504         (webkit_dom_dom_implementation_create_document_type):
1505         (webkit_dom_dom_implementation_create_document):
1506         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDOMSelection.cpp:
1507         (webkit_dom_dom_selection_collapse_to_end):
1508         (webkit_dom_dom_selection_collapse_to_start):
1509         (webkit_dom_dom_selection_extend):
1510         (webkit_dom_dom_selection_get_range_at):
1511         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDOMTokenList.cpp:
1512         (webkit_dom_dom_token_list_add):
1513         (webkit_dom_dom_token_list_remove):
1514         (webkit_dom_dom_token_list_toggle):
1515         (webkit_dom_dom_token_list_replace):
1516         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDOMWindow.cpp:
1517         (webkit_dom_dom_window_dispatch_event):
1518         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDeprecated.cpp:
1519         (webkit_dom_node_set_prefix):
1520         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDocument.cpp:
1521         (webkit_dom_document_dispatch_event):
1522         (webkit_dom_document_create_element):
1523         (webkit_dom_document_create_cdata_section):
1524         (webkit_dom_document_create_processing_instruction):
1525         (webkit_dom_document_create_attribute):
1526         (webkit_dom_document_import_node):
1527         (webkit_dom_document_create_element_ns):
1528         (webkit_dom_document_create_attribute_ns):
1529         (webkit_dom_document_adopt_node):
1530         (webkit_dom_document_create_event):
1531         (webkit_dom_document_create_expression):
1532         (webkit_dom_document_evaluate):
1533         (webkit_dom_document_query_selector):
1534         (webkit_dom_document_query_selector_all):
1535         (webkit_dom_document_set_xml_version):
1536         (webkit_dom_document_set_cookie):
1537         (webkit_dom_document_set_body):
1538         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDocumentFragment.cpp:
1539         (webkit_dom_document_fragment_dispatch_event):
1540         (webkit_dom_document_fragment_query_selector):
1541         (webkit_dom_document_fragment_query_selector_all):
1542         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDocumentType.cpp:
1543         (webkit_dom_document_type_dispatch_event):
1544         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMElement.cpp:
1545         (webkit_dom_element_dispatch_event):
1546         (webkit_dom_element_set_attribute):
1547         (webkit_dom_element_set_attribute_node):
1548         (webkit_dom_element_remove_attribute_node):
1549         (webkit_dom_element_set_attribute_ns):
1550         (webkit_dom_element_set_attribute_node_ns):
1551         (webkit_dom_element_matches):
1552         (webkit_dom_element_closest):
1553         (webkit_dom_element_insert_adjacent_element):
1554         (webkit_dom_element_insert_adjacent_html):
1555         (webkit_dom_element_insert_adjacent_text):
1556         (webkit_dom_element_remove):
1557         (webkit_dom_element_query_selector):
1558         (webkit_dom_element_query_selector_all):
1559         (webkit_dom_element_set_inner_html):
1560         (webkit_dom_element_set_outer_html):
1561         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMEvent.cpp:
1562         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMFile.cpp:
1563         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMFileList.cpp:
1564         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLAnchorElement.cpp:
1565         (webkit_dom_html_anchor_element_dispatch_event):
1566         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLAppletElement.cpp:
1567         (webkit_dom_html_applet_element_dispatch_event):
1568         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLAreaElement.cpp:
1569         (webkit_dom_html_area_element_dispatch_event):
1570         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLBRElement.cpp:
1571         (webkit_dom_html_br_element_dispatch_event):
1572         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLBaseElement.cpp:
1573         (webkit_dom_html_base_element_dispatch_event):
1574         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLBodyElement.cpp:
1575         (webkit_dom_html_body_element_dispatch_event):
1576         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLButtonElement.cpp:
1577         (webkit_dom_html_button_element_dispatch_event):
1578         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLCanvasElement.cpp:
1579         (webkit_dom_html_canvas_element_dispatch_event):
1580         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLCollection.cpp:
1581         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLDListElement.cpp:
1582         (webkit_dom_html_d_list_element_dispatch_event):
1583         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLDirectoryElement.cpp:
1584         (webkit_dom_html_directory_element_dispatch_event):
1585         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLDivElement.cpp:
1586         (webkit_dom_html_div_element_dispatch_event):
1587         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLDocument.cpp:
1588         (webkit_dom_html_document_dispatch_event):
1589         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLElement.cpp:
1590         (webkit_dom_html_element_dispatch_event):
1591         (webkit_dom_html_element_set_inner_text):
1592         (webkit_dom_html_element_set_outer_text):
1593         (webkit_dom_html_element_set_content_editable):
1594         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLEmbedElement.cpp:
1595         (webkit_dom_html_embed_element_dispatch_event):
1596         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLFieldSetElement.cpp:
1597         (webkit_dom_html_field_set_element_dispatch_event):
1598         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLFontElement.cpp:
1599         (webkit_dom_html_font_element_dispatch_event):
1600         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLFormElement.cpp:
1601         (webkit_dom_html_form_element_dispatch_event):
1602         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLFrameElement.cpp:
1603         (webkit_dom_html_frame_element_dispatch_event):
1604         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLFrameSetElement.cpp:
1605         (webkit_dom_html_frame_set_element_dispatch_event):
1606         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLHRElement.cpp:
1607         (webkit_dom_html_hr_element_dispatch_event):
1608         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLHeadElement.cpp:
1609         (webkit_dom_html_head_element_dispatch_event):
1610         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLHeadingElement.cpp:
1611         (webkit_dom_html_heading_element_dispatch_event):
1612         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLHtmlElement.cpp:
1613         (webkit_dom_html_html_element_dispatch_event):
1614         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLIFrameElement.cpp:
1615         (webkit_dom_html_iframe_element_dispatch_event):
1616         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLImageElement.cpp:
1617         (webkit_dom_html_image_element_dispatch_event):
1618         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLInputElement.cpp:
1619         (webkit_dom_html_input_element_dispatch_event):
1620         (webkit_dom_html_input_element_set_max_length):
1621         (webkit_dom_html_input_element_set_size):
1622         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLLIElement.cpp:
1623         (webkit_dom_html_li_element_dispatch_event):
1624         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLLabelElement.cpp:
1625         (webkit_dom_html_label_element_dispatch_event):
1626         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLLegendElement.cpp:
1627         (webkit_dom_html_legend_element_dispatch_event):
1628         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLLinkElement.cpp:
1629         (webkit_dom_html_link_element_dispatch_event):
1630         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLMapElement.cpp:
1631         (webkit_dom_html_map_element_dispatch_event):
1632         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLMarqueeElement.cpp:
1633         (webkit_dom_html_marquee_element_dispatch_event):
1634         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLMenuElement.cpp:
1635         (webkit_dom_html_menu_element_dispatch_event):
1636         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLMetaElement.cpp:
1637         (webkit_dom_html_meta_element_dispatch_event):
1638         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLModElement.cpp:
1639         (webkit_dom_html_mod_element_dispatch_event):
1640         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLOListElement.cpp:
1641         (webkit_dom_html_o_list_element_dispatch_event):
1642         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLObjectElement.cpp:
1643         (webkit_dom_html_object_element_dispatch_event):
1644         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLOptGroupElement.cpp:
1645         (webkit_dom_html_opt_group_element_dispatch_event):
1646         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLOptionElement.cpp:
1647         (webkit_dom_html_option_element_dispatch_event):
1648         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLOptionsCollection.cpp:
1649         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLParagraphElement.cpp:
1650         (webkit_dom_html_paragraph_element_dispatch_event):
1651         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLParamElement.cpp:
1652         (webkit_dom_html_param_element_dispatch_event):
1653         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLPreElement.cpp:
1654         (webkit_dom_html_pre_element_dispatch_event):
1655         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLQuoteElement.cpp:
1656         (webkit_dom_html_quote_element_dispatch_event):
1657         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLScriptElement.cpp:
1658         (webkit_dom_html_script_element_dispatch_event):
1659         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLSelectElement.cpp:
1660         (webkit_dom_html_select_element_dispatch_event):
1661         (webkit_dom_html_select_element_add):
1662         (webkit_dom_html_select_element_set_length):
1663         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLStyleElement.cpp:
1664         (webkit_dom_html_style_element_dispatch_event):
1665         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLTableCaptionElement.cpp:
1666         (webkit_dom_html_table_caption_element_dispatch_event):
1667         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLTableCellElement.cpp:
1668         (webkit_dom_html_table_cell_element_dispatch_event):
1669         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLTableColElement.cpp:
1670         (webkit_dom_html_table_col_element_dispatch_event):
1671         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLTableElement.cpp:
1672         (webkit_dom_html_table_element_dispatch_event):
1673         (webkit_dom_html_table_element_insert_row):
1674         (webkit_dom_html_table_element_delete_row):
1675         (webkit_dom_html_table_element_set_caption):
1676         (webkit_dom_html_table_element_set_t_head):
1677         (webkit_dom_html_table_element_set_t_foot):
1678         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLTableRowElement.cpp:
1679         (webkit_dom_html_table_row_element_dispatch_event):
1680         (webkit_dom_html_table_row_element_insert_cell):
1681         (webkit_dom_html_table_row_element_delete_cell):
1682         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLTableSectionElement.cpp:
1683         (webkit_dom_html_table_section_element_dispatch_event):
1684         (webkit_dom_html_table_section_element_insert_row):
1685         (webkit_dom_html_table_section_element_delete_row):
1686         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLTextAreaElement.cpp:
1687         (webkit_dom_html_text_area_element_dispatch_event):
1688         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLTitleElement.cpp:
1689         (webkit_dom_html_title_element_dispatch_event):
1690         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLUListElement.cpp:
1691         (webkit_dom_html_u_list_element_dispatch_event):
1692         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMKeyboardEvent.cpp:
1693         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMMediaList.cpp:
1694         (webkit_dom_media_list_delete_medium):
1695         (webkit_dom_media_list_append_medium):
1696         (webkit_dom_media_list_set_media_text):
1697         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMMouseEvent.cpp:
1698         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMNamedNodeMap.cpp:
1699         (webkit_dom_named_node_map_set_named_item):
1700         (webkit_dom_named_node_map_remove_named_item):
1701         (webkit_dom_named_node_map_remove_named_item_ns):
1702         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMNode.cpp:
1703         (webkit_dom_node_dispatch_event):
1704         (webkit_dom_node_insert_before):
1705         (webkit_dom_node_replace_child):
1706         (webkit_dom_node_remove_child):
1707         (webkit_dom_node_append_child):
1708         (webkit_dom_node_clone_node_with_error):
1709         (webkit_dom_node_set_node_value):
1710         (webkit_dom_node_set_text_content):
1711         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMNodeIterator.cpp:
1712         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMNodeList.cpp:
1713         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMProcessingInstruction.cpp:
1714         (webkit_dom_processing_instruction_dispatch_event):
1715         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMRange.cpp:
1716         (webkit_dom_range_set_start):
1717         (webkit_dom_range_set_end):
1718         (webkit_dom_range_set_start_before):
1719         (webkit_dom_range_set_start_after):
1720         (webkit_dom_range_set_end_before):
1721         (webkit_dom_range_set_end_after):
1722         (webkit_dom_range_select_node):
1723         (webkit_dom_range_select_node_contents):
1724         (webkit_dom_range_compare_boundary_points):
1725         (webkit_dom_range_delete_contents):
1726         (webkit_dom_range_extract_contents):
1727         (webkit_dom_range_clone_contents):
1728         (webkit_dom_range_insert_node):
1729         (webkit_dom_range_surround_contents):
1730         (webkit_dom_range_create_contextual_fragment):
1731         (webkit_dom_range_compare_node):
1732         (webkit_dom_range_intersects_node):
1733         (webkit_dom_range_compare_point):
1734         (webkit_dom_range_is_point_in_range):
1735         (webkit_dom_range_expand):
1736         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMStyleSheet.cpp:
1737         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMStyleSheetList.cpp:
1738         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMText.cpp:
1739         (webkit_dom_text_dispatch_event):
1740         (webkit_dom_text_split_text):
1741         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMTreeWalker.cpp:
1742         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMUIEvent.cpp:
1743         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMWheelEvent.cpp:
1744         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMXPathExpression.cpp:
1745         (webkit_dom_xpath_expression_evaluate):
1746         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMXPathResult.cpp:
1747         (webkit_dom_xpath_result_iterate_next):
1748         (webkit_dom_xpath_result_snapshot_item):
1749         (webkit_dom_xpath_result_get_number_value):
1750         (webkit_dom_xpath_result_get_boolean_value):
1751         (webkit_dom_xpath_result_get_single_node_value):
1752         (webkit_dom_xpath_result_get_snapshot_length):
1753
1754 2017-07-22  Wenson Hsieh  <wenson_hsieh@apple.com>
1755
1756         [iOS WK2] Remove _WKDraggableElementInfo and fold PositionInformationTests into WKRequestActivatedElementInfo
1757         https://bugs.webkit.org/show_bug.cgi?id=174758
1758
1759         Reviewed by Dan Bernstein.
1760
1761         _WKDraggableElementInfo is no longer used in WebKit, so it should be removed. However, some of the scenarios
1762         in PositionInformationTests that depend on _WKDraggableElementInfo are still useful to exercise: namely,
1763         performing both synchronous and asynchronous position information updates while an async position information
1764         update is in flight. This patch refactors these unit tests into 2 new unit tests in the existing
1765         WKRequestActivatedElementInfo test suite.
1766
1767         * UIProcess/API/Cocoa/WKWebView.mm:
1768         (-[WKWebView _draggableElementAtPosition:]): Deleted.
1769         (-[WKWebView _requestDraggableElementAtPosition:completionBlock:]): Deleted.
1770         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1771         * UIProcess/API/Cocoa/_WKDraggableElementInfo.h: Removed.
1772         * UIProcess/API/Cocoa/_WKDraggableElementInfo.mm: Removed.
1773         * UIProcess/API/Cocoa/_WKDraggableElementInfoInternal.h: Removed.
1774         * UIProcess/ios/WKContentViewInteraction.mm:
1775         * WebKit.xcodeproj/project.pbxproj:
1776
1777 2017-07-22  Wenson Hsieh  <wenson_hsieh@apple.com>
1778
1779         [Mac WK2] Fix null dereference in asynchronous NSTextInputClient methods when deallocating a WKWebView
1780         https://bugs.webkit.org/show_bug.cgi?id=174751
1781         <rdar://problem/33132405>
1782
1783         Reviewed by Darin Adler.
1784
1785         Tweaks -[WKWebView dealloc] to close the WebPageProxy at an earlier time, prior to destroying the WebViewImpl.
1786         This fixes a NSTextInputClient crash in WKWebView when exercising the following scenario:
1787
1788         (1) Suppose that NSTextInputContext invokes an asynchronous text input query on WKWebView immediately before
1789         WKWebView is deallocated, such that WebPageProxy's CallbackMap contains an NSTextInputContext callback at the
1790         time that -[WKWebView dealloc] is called. Additionally, suppose that this callback from NSTextInputContext
1791         invokes additional NSTextInputClient methods on the WKWebView that involve plumbing through to the WebViewImpl
1792         (which is stored as _impl on the WKWebView).
1793
1794         (2) Observe that when calling [super dealloc] in [WKWebView dealloc], we will destroy the WebViewImpl as a
1795         result of setting our unique pointer to _impl to be null. In ~WebViewImpl, we invoke WebPageProxy::close, which
1796         in turn invokes WebPageProxy::resetState.
1797
1798         (3) WebPageProxy::resetState then calls m_callbacks.invalidate(error), which triggers all pending callbacks.
1799         This invokes the block described in (1), which causes us to try and call back into WKWebView, invoking
1800         NSTextInputClient methods. Without the fix in this patch, these methods currently assume that _impl is nonnull,
1801         even though we've already cleared out the pointer in (2), so we segfault with a null dereference.
1802
1803         After this patch, we close the _page at an earlier time, such that the state is reset before the WebViewImpl
1804         (and corresponding _impl unique_ptr in WKWebView) is torn down. This ensures that _impl will not be null for
1805         callbacks invoked after beginning to deallocate the WKWebView.
1806
1807         Forcing this scenario in a custom AppKit root that triggers async NSTextInputClient methods immediately when a
1808         WKWebView is being deallocated produces a crash with the same stack trace as what we observe in the radar, but
1809         there are no known steps to actually reproduce this crash in shipping software.
1810
1811         * UIProcess/API/Cocoa/WKWebView.mm:
1812         (-[WKWebView dealloc]):
1813
1814 2017-07-22  Chris Dumez  <cdumez@apple.com>
1815
1816         REGRESSION(r204565): WKObject is broken
1817         https://bugs.webkit.org/show_bug.cgi?id=174736
1818         <rdar://problem/33246169>
1819
1820         Reviewed by Dan Bernstein.
1821
1822         Revert r204565 as making WKObject a root class caused unexpected crashes.
1823         Instead, we now have WKObject inherit from NSProxy (instead of previously
1824         NSObject) and we forward calls to the target.
1825
1826         We also need to provide an implementation for private methods such as
1827         isNSString__ to address the issue with NSStrings that r204565 was trying
1828         to fix.
1829
1830         * Shared/Cocoa/APIObject.mm:
1831         (API::Object::unwrap):
1832         * Shared/Cocoa/WKObject.h:
1833         * Shared/Cocoa/WKObject.mm:
1834         (-[WKObject dealloc]):
1835         (-[WKObject hash]):
1836         (-[WKObject isKindOfClass:]):
1837         (-[WKObject isMemberOfClass:]):
1838         (-[WKObject respondsToSelector:]):
1839         (-[WKObject conformsToProtocol:]):
1840         (-[WKObject forwardingTargetForSelector:]):
1841         (-[WKObject description]):
1842         (-[WKObject debugDescription]):
1843         (-[WKObject classForCoder]):
1844         (-[WKObject classForKeyedArchiver]):
1845         (-[WKObject _web_createTarget]):
1846         (-[WKObject forwardInvocation:]):
1847         (-[WKObject methodSignatureForSelector:]):
1848         (-[WKObject isNSObject__]):
1849         (-[WKObject isNSArray__]):
1850         (-[WKObject isNSCFConstantString__]):
1851         (-[WKObject isNSData__]):
1852         (-[WKObject isNSDate__]):
1853         (-[WKObject isNSDictionary__]):
1854         (-[WKObject isNSNumber__]):
1855         (-[WKObject isNSOrderedSet__]):
1856         (-[WKObject isNSSet__]):
1857         (-[WKObject isNSString__]):
1858         (-[WKObject isNSTimeZone__]):
1859         (-[WKObject isNSValue__]):
1860
1861 2017-07-21  Chris Dumez  <cdumez@apple.com>
1862
1863         Drop IDBDatabaseException class
1864         https://bugs.webkit.org/show_bug.cgi?id=174743
1865
1866         Reviewed by Darin Adler.
1867
1868         * WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.cpp:
1869         (WebKit::WebIDBConnectionToServer::connectionToServerLost):
1870
1871 2017-07-21  Brady Eidson  <beidson@apple.com>
1872
1873         Crash in many WebKit apps marking a connection invalid under Messages::NetworkProcessProxy::canAuthenticateAgainstProtectionSpace.
1874         <rdar://problem/28822272> and https://bugs.webkit.org/show_bug.cgi?id=174729
1875
1876         Reviewed by Tim Horton.
1877
1878         Previously, when a NetworkLoad generated a "CanAuthenticateAgainstProtectionSpace" event, the message went from
1879         Network process -> Web process -> UI process.
1880
1881         In that case, MESSAGE_CHECKing the validity of the frame in WebPageProxy made sense.
1882
1883         In r202511 we cut the WebProcess out of this and had Networking go straight to UI process.
1884
1885         As a result, the message check became invalid. The Networking process cannot possible know the validity of 
1886         particular WebPage or WebFrame identifiers.
1887
1888         We simply need to validate the input in NetworkProcessProxy.
1889
1890         * UIProcess/Network/NetworkProcessProxy.cpp:
1891         (WebKit::NetworkProcessProxy::canAuthenticateAgainstProtectionSpace): Validate both the page and frame ids before
1892           passing the call along to the WebPageProxy. Also, if either of those validations fail, respond to the network process.
1893
1894 2017-07-21  Andy Estes  <aestes@apple.com>
1895
1896         [iOS] Adopt UIImagePickerControllerImageURL for photo uploads
1897         https://bugs.webkit.org/show_bug.cgi?id=174723
1898         <rdar://problem/33223962>
1899
1900         Reviewed by Joseph Pecoraro.
1901
1902         In iOS 11, use the URL provided by UIImagePickerControllerImageURL, if available, as the
1903         file URL for photo uploads. Since we use the UIImagePickerController imageExportPreset of
1904         UIImagePickerControllerImageURLExportPresetCompatible, UIKit will take care of converting
1905         HEIF images to JPEG for us. For other types (GIF, JPEG, and PNG), it will preserve the
1906         original format.
1907
1908         Since UIImagePickerController now provides GIF and PNG representations, we no longer need to
1909         use PHImageManager to access the original assets. This patch removes the
1910         PHAsset/PHImageManager code added in r185241.
1911
1912         * Platform/spi/ios/PhotosSPI.h: Removed.
1913         * UIProcess/ios/forms/WKFileUploadPanel.mm:
1914         (-[WKFileUploadPanel _uploadItemFromMediaInfo:successBlock:failureBlock:]):
1915         (-[WKFileUploadPanel _uploadItemForImage:withAssetURL:successBlock:failureBlock:]): Deleted.
1916         * WebKit.xcodeproj/project.pbxproj:
1917
1918 2017-07-21  Konstantin Tokarev  <annulen@yandex.ru>
1919
1920         [cmake][Mac] Unreviewed, fix linking WebKitSystemInterface
1921
1922         After r219560 link_directories() in PlatformXXX.cmake files does not
1923         affect corresponding targets.
1924
1925         * PlatformMac.cmake:
1926
1927 2017-07-21  Andreas Kling  <akling@apple.com>
1928
1929         Use more references in event dispatch code
1930         https://bugs.webkit.org/show_bug.cgi?id=174681
1931
1932         Reviewed by Geoffrey Garen.
1933
1934         * WebProcess/Plugins/PDF/PDFPluginAnnotation.h:
1935         * WebProcess/Plugins/PDF/PDFPluginAnnotation.mm:
1936         (WebKit::PDFPluginAnnotation::handleEvent):
1937         (WebKit::PDFPluginAnnotation::PDFPluginAnnotationEventListener::handleEvent):
1938         * WebProcess/Plugins/PDF/PDFPluginPasswordField.h:
1939         * WebProcess/Plugins/PDF/PDFPluginPasswordField.mm:
1940         (WebKit::PDFPluginPasswordField::handleEvent):
1941         * WebProcess/Plugins/PDF/PDFPluginTextAnnotation.h:
1942         * WebProcess/Plugins/PDF/PDFPluginTextAnnotation.mm:
1943         (WebKit::PDFPluginTextAnnotation::handleEvent):
1944         * WebProcess/Plugins/PluginView.cpp:
1945         (WebKit::PluginView::createWebEvent):
1946         (WebKit::PluginView::handleEvent):
1947         * WebProcess/Plugins/PluginView.h:
1948
1949 2017-07-21  Chris Dumez  <cdumez@apple.com>
1950
1951         WebResourceLoadStatisticsStore::m_operatingDates is unsafely modified from several threads
1952         https://bugs.webkit.org/show_bug.cgi?id=174721
1953         <rdar://problem/33400343>
1954
1955         Reviewed by Brent Fulgham.
1956
1957         WebResourceLoadStatisticsStore::m_operatingDates is supposed to only be modified on
1958         the background thread. However, WebResourceLoadStatisticsStore::performDailyTasks()
1959         was mistakenly calling includeTodayAsOperatingDateIfNecessary() on the main thread,
1960         which would modify m_operatingDates. This could lead to crashes such as the
1961         one in <rdar://problem/33400343>, as the main thread may modify m_operatingDates
1962         while we are interating over it on the background thread to save it to disk.
1963
1964         * UIProcess/WebResourceLoadStatisticsStore.cpp:
1965         (WebKit::WebResourceLoadStatisticsStore::performDailyTasks):
1966         (WebKit::WebResourceLoadStatisticsStore::includeTodayAsOperatingDateIfNecessary):
1967
1968 2017-07-21  Brady Eidson  <beidson@apple.com>
1969
1970         Get rid of WebCore IconDatabase code.
1971         https://bugs.webkit.org/show_bug.cgi?id=174700
1972
1973         Reviewed by Tim Horton.
1974
1975         * UIProcess/API/glib/WebKitWebContext.cpp:
1976         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1977         (WebKit::WebFrameLoaderClient::useIconLoadingClient): Deleted.
1978         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
1979
1980 2017-07-21  Carlos Garcia Campos  <cgarcia@igalia.com>
1981
1982         Web Automation: implicit navigations don't cause browsing context switch
1983         https://bugs.webkit.org/show_bug.cgi?id=174633
1984         <rdar://problem/33387797>
1985
1986         Reviewed by Brian Burg.
1987
1988         When a new page load replaces the current frameset, for example when a link in the current browser context has a
1989         _top target, there's no explicit context switch, so the web driver doesn't know that the current browsing
1990         context is no longer valid. Following commands will still be using the previous frame as the current browsing
1991         context, but they don't fail with no such frame because the frame is still alive in the page cache and
1992         referenced in the internal maps used in both UI and web processes. This causes test
1993         testShouldFocusOnTheReplacementWhenAFrameFollowsALinkToA_TopTargetedPage to fail, since it expects a no such
1994         frame exception. When a new page navigation happens we can simply remove references to frames from
1995         m_handleWebFrameMap in WebAutomationSession, because any existing frame reference in the map should be for a
1996         previous page. With this, before the next command is executed, waitForNavigationToComplete will be called and it
1997         will fail with no such frame, condition that is handled to switch to the top level browser context. The test
1998         still fails, because the find element command is called with the top level browsing context, returning no such
1999         element, instead of no such frame. This is consistent with Chrome.
2000
2001         * UIProcess/Automation/WebAutomationSession.cpp:
2002         (WebKit::WebAutomationSession::navigationOccurredForFrame): Clear the m_handleWebFrameMap when a new page load
2003         finished.
2004
2005 2017-07-21  Carlos Garcia Campos  <cgarcia@igalia.com>
2006
2007         WebDriver: wait until navigation is complete before running new commands and after a click
2008         https://bugs.webkit.org/show_bug.cgi?id=174670
2009
2010         Reviewed by Brian Burg.
2011
2012         Add waitForNavigationToComplete method to Automation to allow WebDriver to wait for pending navigations to
2013         complete. The new method already receives page load strategy and timeout, but they are not implemented yet.
2014
2015         * UIProcess/Automation/Automation.json: Add waitForNavigationToComplete method and PageLoadStrategy new type.
2016         * UIProcess/Automation/WebAutomationSession.cpp:
2017         (WebKit::WebAutomationSession::waitForNavigationToComplete): Call waitForNavigationToCompleteOnPage or
2018         waitForNavigationToCompleteOnFrame depending on whether the current borwsing context is the main frame or not.
2019         (WebKit::WebAutomationSession::waitForNavigationToCompleteOnPage): Check if there's an ongoing load for the page,
2020         and wait for it to complete if needed.
2021         (WebKit::WebAutomationSession::waitForNavigationToCompleteOnFrame): Check if there's an ongoing load for the frame,
2022         and wait for it to complete if needed.
2023         (WebKit::WebAutomationSession::navigateBrowsingContext): Use waitForNavigationToCompleteOnPage() now.
2024         (WebKit::WebAutomationSession::goBackInBrowsingContext): Ditto.
2025         (WebKit::WebAutomationSession::goForwardInBrowsingContext): Ditto.
2026         (WebKit::WebAutomationSession::reloadBrowsingContext): Ditto.
2027         (WebKit::WebAutomationSession::navigationOccurredForFrame): Renamed since it now receives the notification for
2028         all the frames. Complete page operations if it's a main frame, or frame operations otherwise.
2029         * UIProcess/Automation/WebAutomationSession.h:
2030         * UIProcess/WebPageProxy.cpp:
2031         (WebKit::WebPageProxy::didFinishLoadForFrame): Notify about all frames, not only the main one.
2032         (WebKit::WebPageProxy::didFailLoadForFrame): Ditto.
2033         (WebKit::WebPageProxy::didSameDocumentNavigationForFrame): Ditto.
2034
2035 2017-07-20  Carlos Garcia Campos  <cgarcia@igalia.com>
2036
2037         Unreviewed. Remove WKIconDatabaseCairo.
2038
2039         * PlatformGTK.cmake:
2040         * PlatformWPE.cmake:
2041         * UIProcess/API/C/cairo/WKIconDatabaseCairo.cpp: Removed.
2042         * UIProcess/API/C/cairo/WKIconDatabaseCairo.h: Removed.
2043
2044 2017-07-20  Brady Eidson  <beidson@apple.com>
2045
2046         Get rid of IconDatabase related code in WebKit.
2047         https://bugs.webkit.org/show_bug.cgi?id=174693
2048
2049         Reviewed by Tim Horton.
2050
2051         This leaves the C-API class but guts it.
2052
2053         No explanations of the other changes are needed.
2054
2055         * CMakeLists.txt:
2056         * DerivedSources.make:
2057         * Shared/WebProcessCreationParameters.cpp:
2058         (WebKit::WebProcessCreationParameters::encode):
2059         (WebKit::WebProcessCreationParameters::decode):
2060         * Shared/WebProcessCreationParameters.h:
2061         * UIProcess/API/C/WKContext.cpp:
2062         (WKContextGetIconDatabase):
2063         (WKContextSetIconDatabasePath):
2064         * UIProcess/API/C/WKIconDatabase.cpp:
2065         (WKIconDatabaseSetIconDatabaseClient):
2066         (WKIconDatabaseRetainIconForURL):
2067         (WKIconDatabaseReleaseIconForURL):
2068         (WKIconDatabaseSetIconDataForIconURL):
2069         (WKIconDatabaseSetIconURLForPageURL):
2070         (WKIconDatabaseCopyIconURLForPageURL):
2071         (WKIconDatabaseCopyIconDataForPageURL):
2072         (WKIconDatabaseEnableDatabaseCleanup):
2073         (WKIconDatabaseRemoveAllIcons):
2074         (WKIconDatabaseCheckIntegrityBeforeOpening):
2075         (WKIconDatabaseClose):
2076         * UIProcess/API/C/cg/WKIconDatabaseCG.cpp:
2077         (WKIconDatabaseTryGetCGImageForURL):
2078         (WKIconDatabaseTryCopyCGImageArrayForURL):
2079         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
2080         (WebKit::WebProcessPool::platformDefaultIconDatabasePath): Deleted.
2081         * UIProcess/WebIconDatabase.cpp: Removed.
2082         * UIProcess/WebIconDatabase.h:
2083         (WebKit::WebIconDatabase::clearProcessPool): Deleted.
2084         * UIProcess/WebIconDatabase.messages.in: Removed.
2085         * UIProcess/WebIconDatabaseClient.cpp: Removed.
2086         * UIProcess/WebIconDatabaseClient.h: Removed.
2087         * UIProcess/WebProcessPool.cpp:
2088         (WebKit::m_hiddenPageThrottlingTimer):
2089         (WebKit::WebProcessPool::~WebProcessPool):
2090         (WebKit::WebProcessPool::setAnyPageGroupMightHavePrivateBrowsingEnabled):
2091         (WebKit::WebProcessPool::createNewWebProcess):
2092         (WebKit::WebProcessPool::setIconDatabasePath): Deleted.
2093         (WebKit::WebProcessPool::iconDatabasePath): Deleted.
2094         * UIProcess/WebProcessPool.h:
2095         * UIProcess/WebProcessProxy.cpp:
2096         (WebKit::WebProcessProxy::processWillShutDown):
2097         (WebKit::WebProcessProxy::retainIconForPageURL): Deleted.
2098         (WebKit::WebProcessProxy::releaseIconForPageURL): Deleted.
2099         (WebKit::WebProcessProxy::releaseRemainingIconsForPageURLs): Deleted.
2100         * UIProcess/WebProcessProxy.h:
2101         * UIProcess/WebProcessProxy.messages.in:
2102         * UIProcess/gtk/WebProcessPoolGtk.cpp:
2103         (WebKit::WebProcessPool::platformDefaultIconDatabasePath): Deleted.
2104         * UIProcess/wpe/WebProcessPoolWPE.cpp:
2105         (WebKit::WebProcessPool::platformDefaultIconDatabasePath): Deleted.
2106         * WebKit.xcodeproj/project.pbxproj:
2107         * WebProcess/IconDatabase/WebIconDatabaseProxy.cpp: Removed.
2108         * WebProcess/IconDatabase/WebIconDatabaseProxy.h: Removed.
2109         * WebProcess/IconDatabase/WebIconDatabaseProxy.messages.in: Removed.
2110         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
2111         * WebProcess/WebProcess.cpp:
2112         (WebKit::WebProcess::WebProcess):
2113         (WebKit::WebProcess::initializeWebProcess):
2114         (WebKit::WebProcess::getWebCoreStatistics):
2115         * WebProcess/WebProcess.h:
2116
2117 2017-07-20  David Quesada  <david_quesada@apple.com>
2118
2119         Add SPI to notify WKNavigationDelegate about client redirects
2120         https://bugs.webkit.org/show_bug.cgi?id=174680
2121         rdar://problem/33184886
2122
2123         Reviewed by Brady Eidson.
2124
2125         * UIProcess/API/APINavigationClient.h:
2126         (API::NavigationClient::didPerformClientRedirectForNavigation):
2127         Add a new virtual method for navigation clients to implement if they want to be informed
2128         when the page is initiating a navigation that is a client redirect.
2129
2130         * UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h:
2131         Declare the new WKNavigationDelegate method -_webView:didPerformClientRedirectForNavigation:
2132
2133         * UIProcess/Cocoa/NavigationState.h:
2134         * UIProcess/Cocoa/NavigationState.mm:
2135         (WebKit::NavigationState::setNavigationDelegate):
2136         (WebKit::NavigationState::NavigationClient::didPerformClientRedirectForNavigation):
2137         Add a new method to NavigationState method to tell the WKNavigationDelegate when a
2138         client redirect happens.
2139
2140         * UIProcess/WebPageProxy.cpp:
2141         (WebKit::WebPageProxy::didPerformClientRedirectForLoadForFrame):
2142         * UIProcess/WebPageProxy.h:
2143         * UIProcess/WebPageProxy.messages.in:
2144         Allow the WebPageProxy to receive a message from the web process when a client redirect happens.
2145
2146         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
2147         (WebKit::WebFrameLoaderClient::dispatchDidPerformClientRedirect):
2148         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
2149         Send this new message to the UI process on client redirects.
2150
2151 2017-07-20  Chris Dumez  <cdumez@apple.com>
2152
2153         Drop legacy XPathException type
2154         https://bugs.webkit.org/show_bug.cgi?id=174679
2155
2156         Reviewed by Sam Weinig.
2157
2158         Drop legacy XPathException type and use DOMException instead. Both Firefox and Chrome
2159         no longer expose XPathException.
2160
2161         * UIProcess/Automation/atoms/FindNodes.js:
2162         (tryToFindNode):
2163
2164 2017-07-20  Chris Dumez  <cdumez@apple.com>
2165
2166         Unreviewed, rolling out r219706.
2167
2168         Broke iOS build
2169
2170         Reverted changeset:
2171
2172         "Drop legacy XPathException type"
2173         https://bugs.webkit.org/show_bug.cgi?id=174679
2174         http://trac.webkit.org/changeset/219706
2175
2176 2017-07-20  Chris Dumez  <cdumez@apple.com>
2177
2178         Drop legacy XPathException type
2179         https://bugs.webkit.org/show_bug.cgi?id=174679
2180
2181         Reviewed by Sam Weinig.
2182
2183         Drop legacy XPathException type and use DOMException instead. Both Firefox and Chrome
2184         no longer expose XPathException.
2185
2186         * UIProcess/Automation/atoms/FindNodes.js:
2187         (tryToFindNode):
2188
2189 2017-07-20  Chris Dumez  <cdumez@apple.com>
2190
2191         Avoid unnecessary WorkQueue dispatch in WebResourceLoadStatisticsStore::processStatisticsAndDataRecords()
2192         https://bugs.webkit.org/show_bug.cgi?id=174686
2193
2194         Reviewed by Geoffrey Garen.
2195
2196         Avoid unnecessary WorkQueue dispatch in WebResourceLoadStatisticsStore::processStatisticsAndDataRecords(). The most common
2197         call site is already on the right thread.
2198
2199         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
2200         (-[WKWebsiteDataStore _resourceLoadStatisticsProcessStatisticsAndDataRecords]):
2201         * UIProcess/WebResourceLoadStatisticsStore.cpp:
2202         (WebKit::WebResourceLoadStatisticsStore::scheduleStatisticsAndDataRecordsProcessing):
2203         (WebKit::WebResourceLoadStatisticsStore::processStatisticsAndDataRecords):
2204         * UIProcess/WebResourceLoadStatisticsStore.h:
2205
2206 2017-07-20  Chris Dumez  <cdumez@apple.com>
2207
2208         Regression(ITP): May get frequently logged out of wsj.com
2209         https://bugs.webkit.org/show_bug.cgi?id=174661
2210         <rdar://problem/32343256>
2211
2212         Reviewed by Geoffrey Garen.
2213
2214         Bump statistics file version to blow away old statistics on disk since those do not
2215         take into account associated domains.
2216
2217         * UIProcess/WebResourceLoadStatisticsStore.cpp:
2218
2219 2017-07-20  Chris Dumez  <cdumez@apple.com>
2220
2221         Replace calls to Vector::resize() with calls to more efficient shrink() / grow() when applicable
2222         https://bugs.webkit.org/show_bug.cgi?id=174660
2223
2224         Reviewed by Geoffrey Garen.
2225
2226         Replace calls to Vector::resize() with calls to more efficient shrink() / grow() when applicable.
2227         This essentially replaces a branch to figure out if the new size is less or greater than the
2228         current size by an assertion.
2229
2230         * Platform/IPC/ArgumentCoders.h:
2231         * UIProcess/Gamepad/UIGamepadProvider.cpp:
2232         (WebKit::UIGamepadProvider::platformGamepadConnected):
2233         * UIProcess/WebProcessPool.cpp:
2234         (WebKit::WebProcessPool::setInitialConnectedGamepads):
2235         * WebProcess/Network/WebLoaderStrategy.cpp:
2236         (WebKit::WebLoaderStrategy::loadResourceSynchronously):
2237         * WebProcess/WebCoreSupport/WebPasteboardOverrides.cpp:
2238         (WebKit::WebPasteboardOverrides::getDataForOverride):
2239         * WebProcess/WebPage/ios/WebPageIOS.mm:
2240         (WebKit::WebPage::requestAutocorrectionData):
2241
2242 2017-07-20  Chris Dumez  <cdumez@apple.com>
2243
2244         Regression(ITP): Can no longer log in on abc.go.com
2245         https://bugs.webkit.org/show_bug.cgi?id=174533
2246         <rdar://problem/33325881>
2247
2248         Reviewed by Geoffrey Garen.
2249
2250         Bump statistics database version to blow away any existing statistics. Without this, SSO providers
2251         for which we added a quirk may already be in the database and identified as trackers. The quirk
2252         merely prevents the specified SSO providers from being identified as trackers.
2253
2254         * UIProcess/WebResourceLoadStatisticsStore.cpp:
2255
2256 2017-07-19  Simon Fraser  <simon.fraser@apple.com>
2257
2258         getBoundingClientRects not updated for programmatic scrolls
2259         https://bugs.webkit.org/show_bug.cgi?id=174538
2260         rdar://problem/33049012
2261
2262         Reviewed by Tim Horton.
2263         
2264         Feed ViewportRectStability and ScrollingLayerPositionAction into reconcileScrollingState().
2265
2266         * WebProcess/WebPage/ios/WebPageIOS.mm:
2267         (WebKit::WebPage::updateVisibleContentRects):
2268
2269 2017-07-19  Brady Eidson  <beidson@apple.com>
2270
2271         iBooks sometimes crashes when closing a book.
2272         <rdar://problem/31180331> and https://bugs.webkit.org/show_bug.cgi?id=174658
2273
2274         Reviewed by Oliver Hunt.
2275
2276         - LegacyCustomProtocolManagerProxy should not reference a WebProcessPool directly.
2277         - LegacyCustomProtocolManagerProxy should invalidate in its destructor.
2278
2279         * UIProcess/Network/CustomProtocols/LegacyCustomProtocolManagerProxy.cpp:
2280         (WebKit::LegacyCustomProtocolManagerProxy::LegacyCustomProtocolManagerProxy):
2281         (WebKit::LegacyCustomProtocolManagerProxy::~LegacyCustomProtocolManagerProxy):
2282         (WebKit::LegacyCustomProtocolManagerProxy::startLoading):
2283         (WebKit::LegacyCustomProtocolManagerProxy::stopLoading):
2284         (WebKit::LegacyCustomProtocolManagerProxy::invalidate):
2285         (WebKit::LegacyCustomProtocolManagerProxy::wasRedirectedToRequest):
2286         (WebKit::LegacyCustomProtocolManagerProxy::didReceiveResponse):
2287         (WebKit::LegacyCustomProtocolManagerProxy::didLoadData):
2288         (WebKit::LegacyCustomProtocolManagerProxy::didFailWithError):
2289         (WebKit::LegacyCustomProtocolManagerProxy::didFinishLoading):
2290         (WebKit::LegacyCustomProtocolManagerProxy::processDidClose): Deleted.
2291         * UIProcess/Network/CustomProtocols/LegacyCustomProtocolManagerProxy.h:
2292
2293         * UIProcess/Network/NetworkProcessProxy.cpp:
2294         (WebKit::NetworkProcessProxy::NetworkProcessProxy):
2295         (WebKit::NetworkProcessProxy::didClose):
2296         * UIProcess/Network/NetworkProcessProxy.h:
2297         (WebKit::NetworkProcessProxy::processPool):
2298
2299 2017-07-19  Yusuke Suzuki  <utatane.tea@gmail.com>
2300
2301         [WTF] Implement WTF::ThreadGroup
2302         https://bugs.webkit.org/show_bug.cgi?id=174081
2303
2304         Reviewed by Mark Lam.
2305
2306         * Shared/AsyncRequest.h:
2307
2308 2017-07-18  Carlos Garcia Campos  <cgarcia@igalia.com>
2309
2310         WebDriver: handle invalid selector errors
2311         https://bugs.webkit.org/show_bug.cgi?id=174619
2312
2313         Reviewed by Brian Burg.
2314
2315         We are currently handling only XPathException and only when it's an invalid expression. In the xpath case, the
2316         spec also says "If any item in result is not an element return an error with error code invalid selector.", so
2317         we should also handle TYPE_ERR (The expression could not be converted to return the specified type.). However,
2318         since the spec says "or other error", I think we can simplify this and simply throw InvalidSelector inside the
2319         catch, without checking any specific error. This is causing 14 failures in selenium tests.
2320
2321         §12. Element Retrieval. Step 6: If a DOMException, SyntaxError, XPathException, or other error occurs during the
2322         execution of the element location strategy, return error invalid selector.
2323         https://www.w3.org/TR/webdriver/#dfn-find
2324
2325         * UIProcess/Automation/Automation.json: Add InvalidSelector error.
2326         * UIProcess/Automation/atoms/FindNodes.js:
2327         (tryToFindNode): Raise InvalidSelector in case of error.
2328         * WebProcess/Automation/WebAutomationSessionProxy.cpp:
2329         (WebKit::WebAutomationSessionProxy::evaluateJavaScriptFunction): Handle InvalidSelector exceptions.
2330
2331 2017-07-18  Carlos Garcia Campos  <cgarcia@igalia.com>
2332
2333         Web Automation: error details not passed to DidEvaluateJavaScriptFunction message when callback was not called before page unload
2334         https://bugs.webkit.org/show_bug.cgi?id=174624
2335
2336         Reviewed by Brian Burg.
2337
2338         There's a variable errorMessage, but it's unused.
2339
2340         * WebProcess/Automation/WebAutomationSessionProxy.cpp:
2341         (WebKit::WebAutomationSessionProxy::didClearWindowObjectForFrame): Pass errorMessage instead of String() to DidEvaluateJavaScriptFunction.
2342
2343 2017-07-18  Carlos Garcia Campos  <cgarcia@igalia.com>
2344
2345         Web Automation: evaluateJavaScriptFunction should always notify the web process before returning early
2346         https://bugs.webkit.org/show_bug.cgi?id=174623
2347
2348         Reviewed by Brian Burg.
2349
2350         It currently returns early if page, frame or scriptObject are nullptr, in which cases the UI process is not
2351         notified. This causes test testShouldNotBeAbleToDoAnythingTheFrameIsDeletedFromUnderUs to hang, because message
2352         DidEvaluateJavaScriptFunction is never sent when the given frame no longer exists. We should send
2353         DidEvaluateJavaScriptFunction with WindowNotFound in case of page is nullptr and FrameNotFound if the frame is
2354         nullptr. The scriptObject early return is actually wrong, because scriptObjectForFrame creates a new script if
2355         there's isn't one for the given frame.
2356
2357         * WebProcess/Automation/WebAutomationSessionProxy.cpp:
2358         (WebKit::WebAutomationSessionProxy::evaluateJavaScriptFunction):
2359
2360 2017-07-18  Carlos Garcia Campos  <cgarcia@igalia.com>
2361
2362         Web Automation: pending evaluate script callbacks are stored with the wrong frame ID when using the default main frame
2363         https://bugs.webkit.org/show_bug.cgi?id=174622
2364
2365         Reviewed by Brian Burg.
2366
2367         The frameHandle argument is optional in evaluateJavaScriptFunction(), when not provided we pass 0 to the web
2368         process. The proxy gets the web page main frame when received frame ID is 0, but the given frameID is
2369         still used as key of m_webFramePendingEvaluateJavaScriptCallbacksMap and also passed to the javascript function
2370         as argument. I think r203442 was actually a workaround to this bug, making it even more hidden. Both
2371         m_webFrameScriptObjectMap and m_webFramePendingEvaluateJavaScriptCallbacksMap should never have 0 as a
2372         key, since they always use a frame ID, and the frame identifier counter starts at 1. This is causing test
2373         testShouldDetectPageLoadsWhileWaitingOnAnAsyncScriptAndReturnAnError to hang, because when the page is unloaded
2374         and didClearWindowObjectForFrame is called, we try to get the pending callbacks of frame 1, but they were stored
2375         as frame 0 so DidEvaluateJavaScriptFunction message is never sent to the UI process.
2376
2377         * WebProcess/Automation/WebAutomationSessionProxy.cpp:
2378         (WebKit::WebAutomationSessionProxy::evaluateJavaScriptFunction): Use always the actual frameID from the WebFrame
2379         we are using.
2380         * WebProcess/Automation/WebAutomationSessionProxy.h: Do not allow 0 as a key of
2381         m_webFramePendingEvaluateJavaScriptCallbacksMap and m_webFrameScriptObjectMap.
2382
2383 2017-07-18  Andy Estes  <aestes@apple.com>
2384
2385         [Xcode] Enable CLANG_WARN_RANGE_LOOP_ANALYSIS
2386         https://bugs.webkit.org/show_bug.cgi?id=174631
2387
2388         Reviewed by Tim Horton.
2389
2390         * Configurations/Base.xcconfig:
2391         * Shared/API/APIArray.cpp:
2392         (API::Array::toStringVector):
2393         * UIProcess/Plugins/PlugInAutoStartProvider.cpp:
2394         (WebKit::PlugInAutoStartProvider::setAutoStartOriginsArray):
2395         * UIProcess/UserContent/WebUserContentControllerProxy.cpp:
2396         (WebKit::WebUserContentControllerProxy::addProcess):
2397         (WebKit::WebUserContentControllerProxy::removeAllUserScripts):
2398         (WebKit::WebUserContentControllerProxy::removeAllUserStyleSheets):
2399         * UIProcess/ios/forms/WKFileUploadPanel.mm:
2400         (-[WKFileUploadPanel presentWithParameters:resultListener:]):
2401         * WebProcess/InjectedBundle/InjectedBundlePageEditorClient.cpp:
2402         (WebKit::InjectedBundlePageEditorClient::getPasteboardDataForRange):
2403
2404 2017-07-18  Andy Estes  <aestes@apple.com>
2405
2406         [Xcode] Enable CLANG_WARN_OBJC_LITERAL_CONVERSION
2407         https://bugs.webkit.org/show_bug.cgi?id=174631
2408
2409         Reviewed by Sam Weinig.
2410
2411         * Configurations/Base.xcconfig:
2412
2413 2017-07-18  Andy Estes  <aestes@apple.com>
2414
2415         [Xcode] Enable CLANG_WARN_NON_LITERAL_NULL_CONVERSION
2416         https://bugs.webkit.org/show_bug.cgi?id=174631
2417
2418         Reviewed by Dan Bernstein.
2419
2420         * Configurations/Base.xcconfig:
2421
2422 2017-07-18  Matt Lewis  <jlewis3@apple.com>
2423
2424         Unreviewed, rolling out r219610.
2425
2426         This caused an api failure on all platforms for the test
2427         SnapshotImageLargeAsyncDecoding
2428
2429         Reverted changeset:
2430
2431         "Async image decoding for large images should be disabled
2432         after the first time a tile is painted"
2433         https://bugs.webkit.org/show_bug.cgi?id=174451
2434         http://trac.webkit.org/changeset/219610
2435
2436 2017-07-18  Andy Estes  <aestes@apple.com>
2437
2438         [Xcode] Enable CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING
2439         https://bugs.webkit.org/show_bug.cgi?id=174631
2440
2441         Reviewed by Darin Adler.
2442
2443         * Configurations/Base.xcconfig:
2444
2445 2017-07-18  Said Abou-Hallawa  <sabouhallawa@apple.com>
2446
2447         Async image decoding for large images should be disabled after the first time a tile is painted
2448         https://bugs.webkit.org/show_bug.cgi?id=174451
2449
2450         Reviewed by Simon Fraser.
2451
2452         * Shared/mac/RemoteLayerBackingStore.mm:
2453         (WebKit::RemoteLayerBackingStore::drawInContext):
2454         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp:
2455         (WebKit::CompositingCoordinator::paintContents):
2456         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.h:
2457
2458 2017-07-17  Carlos Garcia Campos  <cgarcia@igalia.com>
2459
2460         Web Automation: link and partial link queries don't work if text link contains trailing or leading whitespaces
2461         https://bugs.webkit.org/show_bug.cgi?id=174499
2462
2463         Reviewed by Brian Burg.
2464
2465         This is causing test test_Driver_Can_Get_Link_By_Link_Test_Ignoring_Trailing_Whitespace to fail.
2466
2467         * UIProcess/Automation/atoms/FindNodes.js:
2468         (switch): Use normalize-space() in in the links xpath expressions.
2469
2470 2017-07-17  Darin Adler  <darin@apple.com>
2471
2472         Improve use of NeverDestroyed
2473         https://bugs.webkit.org/show_bug.cgi?id=174348
2474
2475         Reviewed by Sam Weinig.
2476
2477         * DatabaseProcess/DatabaseProcess.h: Removed unneeded include of
2478         NeverDestroyed.h.
2479         * NetworkProcess/cache/NetworkCacheKey.cpp: Ditto.
2480
2481         * NetworkProcess/capture/NetworkCaptureManager.cpp: Moved include of
2482         NeverDestroyed.h here ...
2483         * NetworkProcess/capture/NetworkCaptureManager.h: ... from here.
2484
2485         * PluginProcess/PluginProcess.cpp: Moved include of NeverDestroyed.h
2486         here ...
2487         * PluginProcess/PluginProcess.h: ... from here.
2488
2489         * Shared/API/Cocoa/_WKRemoteObjectInterface.mm:
2490         (isContainerClass): Removed trivial inefficient use of
2491         LazyNeverDestroyed<HashSet> to check against two classes.
2492         Instead wrote out the boolean expression.
2493
2494         * Shared/mac/SecItemShim.cpp: Removed unneeded include of
2495         NeverDestroyed.h.
2496
2497         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
2498         (WebKit::WebProcessPool::platformInitialize): Call
2499         installMemoryPressureHandler instead of WebMemoryPressureHandler::singleton.
2500
2501         * UIProcess/Gamepad/UIGamepadProvider.h: Removed unneeded include
2502         of NeverDestroyed.h.
2503
2504         * UIProcess/Plugins/PluginProcessManager.cpp: Moved include of
2505         NeverDestroyed.h here ...
2506         * UIProcess/Plugins/PluginProcessManager.h: ... from here.
2507
2508         * UIProcess/WebInspectorProxy.cpp: Removed unneeded include
2509         of NeverDestroyed.h.
2510
2511         * UIProcess/WebPageProxy.h: Added now-needed include of
2512         MediaPlaybackTargetContext.h.
2513
2514         * UIProcess/WebPasteboardProxy.cpp: Moved include of
2515         NeverDestroyed.h here ...
2516         * UIProcess/WebPasteboardProxy.h: ... from here.
2517
2518         * UIProcess/ios/WebMemoryPressureHandlerIOS.h: Removed the
2519         WebMemoryPressureHandler class from this header. Callers don't need to
2520         know if there is a class. They simply indicate when it's time to install
2521         the handler. Another way to put it is that this class had no functions
2522         other than the singleton function.
2523
2524         * UIProcess/ios/WebMemoryPressureHandlerIOS.mm:
2525         (WebKit::installMemoryPressureHandler): Replaced the class with this function.
2526         It creates a dispatch source and then resumes it. To avoid having the source
2527         look like a leak, we keep it in a global variable.
2528
2529         * WebProcess/Gamepad/WebGamepadProvider.h: Include Forward.h instead of
2530         NeverDestroyed.h.
2531
2532         * WebProcess/WebCoreSupport/WebPasteboardOverrides.cpp: Moved include of
2533         NeverDestroyed.h here ...
2534         * WebProcess/WebCoreSupport/WebPasteboardOverrides.h: ... from here.
2535
2536         * WebProcess/WebCoreSupport/WebPlatformStrategies.h: Removed unneeded
2537         include of NeverDestroyed.h.
2538
2539 2017-07-17  Timothy Horton  <timothy_horton@apple.com>
2540
2541         Page using safe area constant properties jumps to correct layout after resize
2542         https://bugs.webkit.org/show_bug.cgi?id=174598
2543         <rdar://problem/33364275>
2544
2545         Reviewed by Simon Fraser.
2546
2547         Test: fast/events/ios/rotation/safe-area-insets-during-safari-type-rotation.html
2548
2549         * UIProcess/API/Cocoa/WKWebView.mm:
2550         (-[WKWebView _beginAnimatedResizeWithUpdates:]):
2551         * UIProcess/WebPageProxy.h:
2552         * UIProcess/ios/WebPageProxyIOS.mm:
2553         (WebKit::WebPageProxy::dynamicViewportSizeUpdate):
2554         * WebProcess/WebPage/WebPage.h:
2555         * WebProcess/WebPage/WebPage.messages.in:
2556         * WebProcess/WebPage/ios/WebPageIOS.mm:
2557         (WebKit::WebPage::dynamicViewportSizeUpdate):
2558         Plumb unobscured safe area insets through in the dynamicViewportSizeUpdate,
2559         like we do in VisibleContentRectUpdate (once again sad that these aren't
2560         more similar), so that it will be correct in the during-rotation snapshot,
2561         instead of only becoming correct in the first visible content rect update
2562         post-rotation.
2563
2564 2017-07-17  Chris Dumez  <cdumez@apple.com>
2565
2566         UserMediaPermissionRequestManagerProxy should not use WebCore::Timer
2567         https://bugs.webkit.org/show_bug.cgi?id=174599
2568         <rdar://problem/33362600>
2569
2570         Reviewed by Tim Horton.
2571
2572         UserMediaPermissionRequestManagerProxy should not use WebCore::Timer since it runs in the
2573         UIProcess. Switch to using RunLoop::Timer instead.
2574
2575         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
2576         (WebKit::UserMediaPermissionRequestManagerProxy::UserMediaPermissionRequestManagerProxy):
2577         * UIProcess/UserMediaPermissionRequestManagerProxy.h:
2578
2579 2017-07-17  Chris Dumez  <cdumez@apple.com>
2580
2581         NETWORK_SESSION does not need didReceiveAuthenticationChallenge(uint64_t, uint64_t, const AuthenticationChallenge&)
2582         https://bugs.webkit.org/show_bug.cgi?id=174595
2583
2584         Reviewed by Alex Christensen.
2585
2586         * Shared/Authentication/AuthenticationManager.cpp:
2587         (WebKit::AuthenticationManager::didReceiveAuthenticationChallenge):
2588         * Shared/Authentication/AuthenticationManager.h:
2589
2590 2017-07-17  Wenson Hsieh  <wenson_hsieh@apple.com>
2591
2592         [iOS DnD] Web process uses too much memory when beginning a drag on a very large image
2593         https://bugs.webkit.org/show_bug.cgi?id=174585
2594         <rdar://problem/33302541>
2595
2596         Reviewed by Tim Horton.
2597
2598         Add IPC support for serializing/deserializing the size of an image written to the pasteboard. See WebCore
2599         ChangeLogs for more details.
2600
2601         * Shared/WebCoreArgumentCoders.cpp:
2602         (IPC::ArgumentCoder<PasteboardImage>::encode):
2603         (IPC::ArgumentCoder<PasteboardImage>::decode):
2604
2605 2017-07-17  Konstantin Tokarev  <annulen@yandex.ru>
2606
2607         Unreviewed attempt to fix Mac cmake build
2608
2609         * PlatformMac.cmake: Remove reference to file which is gone since r219025
2610
2611 2017-07-17  Michael Catanzaro  <mcatanzaro@igalia.com>
2612
2613         [CMake] Include most CMake modules from WebKitCommon.cmake
2614         https://bugs.webkit.org/show_bug.cgi?id=174546
2615
2616         Reviewed by Konstantin Tokarev.
2617
2618         * CMakeLists.txt:
2619
2620 2017-07-17  Michael Catanzaro  <mcatanzaro@igalia.com>
2621
2622         [CMake] Macros in WebKitMacros.cmake should be prefixed with WEBKIT_ namespace
2623         https://bugs.webkit.org/show_bug.cgi?id=174547
2624
2625         Reviewed by Alex Christensen.
2626
2627         * CMakeLists.txt:
2628
2629 2017-07-17  Alex Christensen  <achristensen@webkit.org>
2630
2631         Modernize content extension code
2632         https://bugs.webkit.org/show_bug.cgi?id=174588
2633
2634         Reviewed by Sam Weinig.
2635
2636         * WebProcess/UserContent/WebUserContentController.cpp:
2637         (WebKit::WebUserContentController::addContentRuleLists):
2638
2639 2017-07-17  Jeremy Jones  <jeremyj@apple.com>
2640
2641         Add video fullscreen transition logging.
2642         https://bugs.webkit.org/show_bug.cgi?id=174474
2643
2644         Reviewed by Jer Noble.
2645
2646         No functional change. Just adds logging.
2647
2648         * Platform/Logging.h:
2649         * WebProcess/cocoa/WebVideoFullscreenManager.mm:
2650         (WebKit::WebVideoFullscreenManager::enterVideoFullscreenForVideoElement):
2651         (WebKit::WebVideoFullscreenManager::exitVideoFullscreenForVideoElement):
2652         (WebKit::WebVideoFullscreenManager::exitVideoFullscreenToModeWithoutAnimation):
2653         (WebKit::WebVideoFullscreenManager::didSetupFullscreen):
2654         (WebKit::WebVideoFullscreenManager::didEnterFullscreen):
2655         (WebKit::WebVideoFullscreenManager::didExitFullscreen):
2656         (WebKit::WebVideoFullscreenManager::didCleanupFullscreen):
2657         (WebKit::WebVideoFullscreenManager::setVideoLayerFrameFenced):
2658
2659 2017-07-17  Konstantin Tokarev  <annulen@yandex.ru>
2660
2661         [CMake] Create targets before WEBKIT_INCLUDE_CONFIG_FILES_IF_EXISTS is called
2662         https://bugs.webkit.org/show_bug.cgi?id=174557
2663
2664         Reviewed by Michael Catanzaro.
2665
2666         * CMakeLists.txt:
2667
2668 2017-07-17  Carlos Garcia Campos  <cgarcia@igalia.com>
2669
2670         Web Automation: link and partial link queries don't work if the link contains formatting tags
2671         https://bugs.webkit.org/show_bug.cgi?id=174498
2672
2673         Reviewed by Brian Burg.
2674
2675         So, for example, if we find links with text "Foo" and there's a link like <a href=""><bA>Foo</b></a> we fail
2676         with no such element error. This causes test test_Link_With_Formatting_Tags to fail.
2677
2678         * UIProcess/Automation/atoms/FindNodes.js:
2679         (switch): Use descendant-or-self::text() instead of just text() in the links xpath expressions.
2680
2681 2017-07-16  Carlos Garcia Campos  <cgarcia@igalia.com>
2682
2683         Web Automation: FindNodes should throw an error in case of invalid strategy
2684         https://bugs.webkit.org/show_bug.cgi?id=174497
2685
2686         Reviewed by Brian Burg.
2687
2688         We are currently returning null or empty list. According to the spec in 12.2 Find Element and 12.3 Find
2689         Elements, step 4: "If location strategy is not present as a keyword in the table of location strategies, return
2690         error with error code invalid argument.".
2691         https://www.w3.org/TR/webdriver/#find-element.
2692
2693         This is causing test test_should_throw_an_error_if_user_passes_in_invalid_by_when_find_elements to fail.
2694
2695         * UIProcess/Automation/atoms/FindNodes.js:
2696         (switch): Throw an error in case of unknown strategy.
2697         * WebProcess/Automation/WebAutomationSessionProxy.cpp:
2698         (WebKit::WebAutomationSessionProxy::evaluateJavaScriptFunction): Handle InvalidParameter exceptions.
2699
2700 2017-07-16  Brady Eidson  <beidson@apple.com>
2701
2702         Crash when a WKHTTPCookieStore outlives its owning WKWebsiteDataStore.
2703         <rdar://problem/33341730> and https://bugs.webkit.org/show_bug.cgi?id=174574
2704
2705         Reviewed by Tim Horton.
2706
2707         Instead of holding a weak reference to its owning API::WebsiteDataStore,
2708         API::HTTPCookieStore can hold a strong reference to the owner's implementation
2709         WebKit::WebsiteDataStore.
2710         
2711         * UIProcess/API/APIHTTPCookieStore.cpp:
2712         (API::HTTPCookieStore::HTTPCookieStore):
2713         (API::HTTPCookieStore::cookies):
2714         (API::HTTPCookieStore::setCookie):
2715         (API::HTTPCookieStore::deleteCookie):
2716         (API::HTTPCookieStore::registerObserver):
2717         (API::HTTPCookieStore::unregisterObserver):
2718         (API::HTTPCookieStore::cookieManagerDestroyed):
2719         (API::HTTPCookieStore::registerForNewProcessPoolNotifications):
2720         * UIProcess/API/APIHTTPCookieStore.h:
2721
2722 2017-07-15  Brady Eidson  <beidson@apple.com>
2723
2724         Make sure all CFHTTPCookieStorageRefs we create are scheduled.
2725         <rdar://problem/33221110> and https://bugs.webkit.org/show_bug.cgi?id=174513
2726
2727         Reviewed by Tim Horton.
2728
2729         Whenever we create a CFHTTPCookieStorage from identifying data it is unscheduled.
2730         We need to schedule it on the appropriate RunLoop.
2731         
2732         This patch also cleans up the creation of the identifying data itself.
2733         
2734         * NetworkProcess/mac/RemoteNetworkingContext.mm:
2735         (WebKit::RemoteNetworkingContext::ensureWebsiteDataStoreSession):
2736
2737         * Shared/cf/CookieStorageUtilsCF.h: Added.
2738         * Shared/cf/CookieStorageUtilsCF.mm: Added.
2739         (WebKit::cookieStorageFromIdentifyingData):
2740         (WebKit::identifyingDataFromCookieStorage):
2741
2742         * Shared/mac/ChildProcessMac.mm:
2743         (WebKit::ChildProcess::setSharedHTTPCookieStorage):
2744
2745         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
2746         (WebKit::WebProcessPool::platformInitializeWebProcess):
2747         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
2748
2749         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
2750         (WebKit::WebsiteDataStore::parameters):
2751
2752         * WebKit.xcodeproj/project.pbxproj:
2753
2754         * WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.mm:
2755         (WebKit::WebFrameNetworkingContext::ensureWebsiteDataStoreSession):
2756
2757 2017-07-15  Wenson Hsieh  <wenson_hsieh@apple.com>
2758
2759         [iOS WK2] Presenting an action sheet on an image map prevents selection UI from updating
2760         https://bugs.webkit.org/show_bug.cgi?id=174539
2761         <rdar://problem/33307395>
2762
2763         Reviewed by Darin Adler.
2764
2765         Small tweak to avoid presenting at the element rect or text rect if the interaction information failed to
2766         capture valid bounds for the element. We instead fall back to presenting at the touch location. This addresses
2767         problems when presenting the action sheet popover on image maps on iPad, where GetPositionInformation fails to
2768         capture correct data about for the <area>.
2769
2770         * UIProcess/ios/WKActionSheetAssistant.mm:
2771         (presentationStyleForView):
2772
2773 2017-07-14  Jonathan Bedard  <jbedard@apple.com>
2774
2775         Add iOS 11 SPI
2776         https://bugs.webkit.org/show_bug.cgi?id=174430
2777         <rdar://problem/33269288>
2778
2779         Reviewed by Tim Horton.
2780
2781         * Platform/spi/ios/UIKitSPI.h: Add drag-and-drop SPI for iOS 11.
2782         * UIProcess/ios/WKContentViewInteraction.mm: Move UIKit SPI to UIKitSPI.h.
2783
2784 2017-07-14  Jeff Miller  <jeffm@apple.com>
2785
2786         -[WKWebProcessBundleParameters setParametersForKeyWithDictionary:] passing wrong parameters to -setParameter:forKey
2787         https://bugs.webkit.org/show_bug.cgi?id=174524
2788
2789         Reviewed by Sam Weinig.
2790
2791         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessBundleParameters.mm:
2792         (-[WKWebProcessBundleParameters setParametersForKeyWithDictionary:]):
2793         Pass the dictionary key and value in the correct order.
2794
2795 2017-07-14  Brent Fulgham  <bfulgham@apple.com>
2796
2797         Monitor directory for new statistics files after a delete operation
2798         https://bugs.webkit.org/show_bug.cgi?id=174521
2799         <rdar://problem/33322189>
2800
2801         Reviewed by Chris Dumez.
2802
2803         Create a FileMonitor to watch the data directory when the statistics file is
2804         deleted by an external process. If it sees the file get created externally, merge
2805         those data into the in-memory store.
2806
2807         * UIProcess/Storage/ResourceLoadStatisticsPersistentStorage.cpp:
2808         (WebKit::ResourceLoadStatisticsPersistentStorage::startMonitoringDisk): Added.
2809         (WebKit::ResourceLoadStatisticsPersistentStorage::monitorDirectoryForNewStatistics):
2810         * UIProcess/Storage/ResourceLoadStatisticsPersistentStorage.h:
2811
2812 2017-07-14  Matt Lewis  <jlewis3@apple.com>
2813
2814         Unreviewed, rolling out r219516.
2815
2816         This caused an API failure on macOS.
2817
2818         Reverted changeset:
2819
2820         "Make sure all CFHTTPCookieStorageRefs we create are
2821         scheduled."
2822         https://bugs.webkit.org/show_bug.cgi?id=174513
2823         http://trac.webkit.org/changeset/219516
2824
2825 2017-07-14  Daniel Bates  <dabates@apple.com>
2826
2827         REGRESSION (r219013): Compute source frame info for frameless document
2828         https://bugs.webkit.org/show_bug.cgi?id=174385
2829         <rdar://problem/33217736>
2830
2831         Reviewed by Brady Eidson.
2832
2833         Fixes an issue where we would crash in WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction()
2834         when computing the frame info for a now-frameless document. One way this can happen is when the frame
2835         that contains the document that initiated the navigation is removed from the page.
2836
2837         * UIProcess/WebPageProxy.cpp:
2838         (WebKit::WebPageProxy::decidePolicyForNavigationAction): Check that we have a valid page ID before
2839         looking up the WebPage object corresponding to it.
2840         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
2841         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction): Compute a FrameInfoData
2842         object from the source document directly as opposed to using WebFrame::info() as the latter requires
2843         that we have a valid WebCore frame and the source document may not have a frame.
2844
2845 2017-07-14  Jer Noble  <jer.noble@apple.com>
2846
2847         Allow clients to override their own hardware media requirements where no fallback media exists.
2848         https://bugs.webkit.org/show_bug.cgi?id=174426
2849         <rdar://problem/32537704>
2850
2851         Reviewed by Eric Carlson.
2852
2853         Add a new WKWebViewConfiguration property, as well as a new WKPreferences function, both to control
2854         WebCore's new allowMediaContentTypesRequiringHardwareSupportAsFallback setting.
2855
2856         * Shared/WebPreferencesDefinitions.h:
2857         * UIProcess/API/C/WKPreferences.cpp:
2858         (WKPreferencesGetAllowMediaContentTypesRequiringHardwareSupportAsFallback):
2859         (WKPreferencesSetAllowMediaContentTypesRequiringHardwareSupportAsFallback):
2860         * UIProcess/API/C/WKPreferencesRef.h:
2861         * UIProcess/API/Cocoa/WKWebView.mm:
2862         (-[WKWebView _initializeWithConfiguration:]):
2863         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
2864         (-[WKWebViewConfiguration init]):
2865         (-[WKWebViewConfiguration copyWithZone:]):
2866         (-[WKWebViewConfiguration _setAllowMediaContentTypesRequiringHardwareSupportAsFallback:]):
2867         (-[WKWebViewConfiguration _allowMediaContentTypesRequiringHardwareSupportAsFallback]):
2868         * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
2869         * WebProcess/WebPage/WebPage.cpp:
2870         (WebKit::WebPage::updatePreferences):
2871
2872 2017-07-14  Chris Dumez  <cdumez@apple.com>
2873
2874         Possible crash under NetworkSocketStream::didFailSocketStream()
2875         https://bugs.webkit.org/show_bug.cgi?id=174526
2876         <rdar://problem/32831441>
2877
2878         Reviewed by Brent Fulgham.
2879
2880         For robustness, initialize the SocketStreamHandleImpl after the other
2881         data members. We are passing |this| to the SocketStreamHandleImpl when
2882         constructing it so it is unsafe to have uninitialized data members
2883         at this point.
2884
2885         * NetworkProcess/NetworkSocketStream.cpp:
2886         (WebKit::NetworkSocketStream::NetworkSocketStream):
2887         * NetworkProcess/NetworkSocketStream.h:
2888
2889 2017-07-14  Michael Catanzaro  <mcatanzaro@igalia.com>
2890
2891         [CMake] Unclear distinction between WebKitHelpers and WebKitMacros
2892         https://bugs.webkit.org/show_bug.cgi?id=153189
2893
2894         Reviewed by Antonio Gomes.
2895
2896         New location for macros that are exclusively needed here.
2897
2898         * CMakeLists.txt:
2899
2900 2017-07-14  Brady Eidson  <beidson@apple.com>
2901
2902         Make sure all CFHTTPCookieStorageRefs we create are scheduled.
2903         <rdar://problem/33221110> and https://bugs.webkit.org/show_bug.cgi?id=174513
2904
2905         Reviewed by Tim Horton.
2906
2907         Whenever we create a CFHTTPCookieStorage from identifying data it is unscheduled.
2908         We need to schedule it on a RunLoop.
2909         
2910         This patch also cleans up the creation of the identifying data itself.
2911         
2912         * NetworkProcess/mac/RemoteNetworkingContext.mm:
2913         (WebKit::RemoteNetworkingContext::ensureWebsiteDataStoreSession):
2914         
2915         * Shared/cf/CookieStorageUtilsCF.cpp: Added.
2916         (WebKit::cookieStorageFromIdentifyingData):
2917         (WebKit::identifyingDataFromCookieStorage):
2918         * Shared/cf/CookieStorageUtilsCF.h: Added.
2919         
2920         * Shared/mac/ChildProcessMac.mm:
2921         (WebKit::ChildProcess::setSharedHTTPCookieStorage):
2922         
2923         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
2924         (WebKit::WebProcessPool::platformInitializeWebProcess):
2925         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
2926         
2927         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
2928         (WebKit::WebsiteDataStore::parameters):
2929         
2930         * WebKit.xcodeproj/project.pbxproj:
2931         
2932         * WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.mm:
2933         (WebKit::WebFrameNetworkingContext::ensureWebsiteDataStoreSession):
2934
2935 2017-07-14  Chris Dumez  <cdumez@apple.com>
2936
2937         Potential null-dereference under NetworkRTCProvider::resolvedName()
2938         https://bugs.webkit.org/show_bug.cgi?id=174507
2939         <rdar://problem/32597868>
2940
2941         Reviewed by Youenn Fablet.
2942
2943         NetworkRTCProvider::resolvedName() could do a null dereference of m_connection
2944         because m_connection is nullified in NetworkRTCProvider::close() but resolvers
2945         were only closed later on in the NetworkRTCProvider destructor.
2946
2947         To address the issue, we now stop DNS resolvers earlier, in NetworkRTCProvider::close().
2948         Also fix unsafe modification of m_resolvers HashMap when iterating over it.
2949
2950         * NetworkProcess/webrtc/NetworkRTCProvider.cpp:
2951         (WebKit::NetworkRTCProvider::~NetworkRTCProvider):
2952         (WebKit::NetworkRTCProvider::close):
2953         (WebKit::NetworkRTCProvider::Resolver::~Resolver):
2954         (WebKit::NetworkRTCProvider::stopResolver):
2955
2956 2017-07-14  Youenn Fablet  <youenn@apple.com>
2957
2958         Report CoreAudioCaptureSource failure in case shared unit stops working properly
2959         https://bugs.webkit.org/show_bug.cgi?id=174494
2960
2961         Reviewed by Eric Carlson.
2962
2963         In case of capture failure, send a CaptureFailure message so that the
2964         correct behavior happens in the Web process.
2965
2966         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp:
2967         * WebProcess/cocoa/UserMediaCaptureManager.cpp:
2968         (WebKit::UserMediaCaptureManager::captureFailed):
2969         * WebProcess/cocoa/UserMediaCaptureManager.h:
2970         * WebProcess/cocoa/UserMediaCaptureManager.messages.in:
2971
2972 2017-07-13  Chris Dumez  <cdumez@apple.com>
2973
2974         Better deal with changes to the ResourceLoadStatisticsStore file on disk
2975         https://bugs.webkit.org/show_bug.cgi?id=174487
2976
2977         Reviewed by Brent Fulgham.
2978
2979         Rename WebResourceLoadStatisticsStore's resetDataFromDecoder() to mergeWithDataFromDecoder()
2980         and update it so that it actual merges the data from the disk with the one we have in memory,
2981         instead of replacing it. This avoid data loss.
2982
2983         We leverage the existing WebResourceLoadStatisticsStore::mergeStatistics() to merge the
2984         statistics.
2985
2986         To faciliate merging the operating dates, they are now represented as OperatingDate objects
2987         instead of WallTime objects. OperatingDate only include date precision, no time information.
2988         As a result, the merge 2 vectors of OperatingDate objects, we can:
2989         1. Merge the 2 sorted vectors (using std::merge())
2990         2. Get rid of duplicates (easy because of date-level precision)
2991         3. Drop old dates until the vector has at most 30 items.
2992
2993         * UIProcess/Storage/ResourceLoadStatisticsPersistentStorage.cpp:
2994         (WebKit::ResourceLoadStatisticsPersistentStorage::refreshMemoryStoreFromDisk):
2995         (WebKit::ResourceLoadStatisticsPersistentStorage::populateMemoryStoreFromDisk):
2996         * UIProcess/WebResourceLoadStatisticsStore.cpp:
2997         (WebKit::OperatingDate::fromWallTime):
2998         (WebKit::OperatingDate::today):
2999         (WebKit::OperatingDate::secondsSinceEpoch):
3000         (WebKit::OperatingDate::operator==):
3001         (WebKit::OperatingDate::operator<):
3002         (WebKit::OperatingDate::operator<=):
3003         (WebKit::OperatingDate::OperatingDate):
3004         (WebKit::mergeOperatingDates):
3005         (WebKit::WebResourceLoadStatisticsStore::createEncoderFromData):
3006         (WebKit::WebResourceLoadStatisticsStore::mergeWithDataFromDecoder):
3007         (WebKit::WebResourceLoadStatisticsStore::includeTodayAsOperatingDateIfNecessary):
3008         (WebKit::WebResourceLoadStatisticsStore::hasStatisticsExpired):
3009         * UIProcess/WebResourceLoadStatisticsStore.h:
3010
3011 2017-07-13  Dan Bernstein  <mitz@apple.com>
3012
3013         Removed empty project directories left behind after the rename
3014
3015         * WebKit2.xcodeproj: Removed.
3016
3017 2017-07-13  Matthew Hanson  <matthew_hanson@apple.com>
3018
3019         Fix the cMake builds (GTK and WPE.)
3020         https://bugs.webkit.org/show_bug.cgi?id=174164
3021         rdar://problem/33137595
3022
3023         Reviewed by Dan Bernstein.
3024
3025         * Scripts/generate-forwarding-headers.pl:
3026         (collectFrameworkHeaderPaths):
3027         (createForwardingHeadersForFramework):
3028
3029 2017-07-13  Matthew Hanson  <matthew_hanson@apple.com>
3030
3031         Rename WebKit2.xcodeproj to WebKit.xcodeproj.
3032         https://bugs.webkit.org/show_bug.cgi?id=174164
3033         rdar://problem/33137595
3034
3035         Reviewed by Dan Bernstein.
3036
3037         * WebKit.xcodeproj/project.pbxproj: Renamed from Source/WebKit/WebKit2.xcodeproj/project.pbxproj.
3038
3039 2017-07-13  Matthew Hanson  <matthew_hanson@apple.com>
3040
3041         Update tools and configurations after renaming Source/WebKit2 to Source/WebKit.
3042         https://bugs.webkit.org/show_bug.cgi?id=174164
3043         rdar://problem/33137595
3044
3045         Reviewed by Dan Bernstein.
3046
3047         * PlatformGTK.cmake:
3048         * Shared/API/c/wpe/WebKit.h:
3049
3050 2017-07-13  Michael Catanzaro  <mcatanzaro@igalia.com>
3051
3052         Fix compiler warnings when building with GCC 7
3053         https://bugs.webkit.org/show_bug.cgi?id=174463
3054
3055         Reviewed by Darin Adler.
3056
3057         * Platform/IPC/unix/ConnectionUnix.cpp:
3058         (IPC::Connection::sendOutputMessage):
3059
3060 2017-07-13  Chris Dumez  <cdumez@apple.com>
3061
3062         Moved filesystem code out of WebResourceLoadStatisticsStore class
3063         https://bugs.webkit.org/show_bug.cgi?id=174435
3064
3065         Reviewed by Brent Fulgham.
3066
3067         Moved filesystem code out of WebResourceLoadStatisticsStore class and into
3068         a new ResourceLoadStatisticsPersistentStorage class to decrease complexity.
3069
3070         * CMakeLists.txt:
3071         * UIProcess/Cocoa/WebResourceLoadStatisticsStoreCocoa.mm:
3072         * UIProcess/Storage/ResourceLoadStatisticsPersistentStorage.cpp: Added.
3073         (WebKit::hasFileChangedSince):
3074         (WebKit::createDecoderForFile):
3075         (WebKit::ResourceLoadStatisticsPersistentStorage::ResourceLoadStatisticsPersistentStorage):
3076         (WebKit::ResourceLoadStatisticsPersistentStorage::~ResourceLoadStatisticsPersistentStorage):
3077         (WebKit::ResourceLoadStatisticsPersistentStorage::storageDirectoryPath):
3078         (WebKit::ResourceLoadStatisticsPersistentStorage::resourceLogFilePath):
3079         (WebKit::ResourceLoadStatisticsPersistentStorage::startMonitoringDisk):
3080         (WebKit::ResourceLoadStatisticsPersistentStorage::stopMonitoringDisk):
3081         (WebKit::ResourceLoadStatisticsPersistentStorage::refreshMemoryStoreFromDisk):
3082         (WebKit::ResourceLoadStatisticsPersistentStorage::populateMemoryStoreFromDisk):
3083         (WebKit::ResourceLoadStatisticsPersistentStorage::writeMemoryStoreToDisk):
3084         (WebKit::ResourceLoadStatisticsPersistentStorage::scheduleOrWriteMemoryStore):
3085         (WebKit::ResourceLoadStatisticsPersistentStorage::clear):
3086         (WebKit::ResourceLoadStatisticsPersistentStorage::finishAllPendingWorkSynchronously):
3087         (WebKit::ResourceLoadStatisticsPersistentStorage::excludeFromBackup):
3088         * UIProcess/Storage/ResourceLoadStatisticsPersistentStorage.h: Added.
3089         * UIProcess/Storage/ios/ResourceLoadStatisticsPersistentStorageIOS.mm: Added.
3090         (WebKit::ResourceLoadStatisticsPersistentStorage::excludeFromBackup):
3091         * UIProcess/WebResourceLoadStatisticsStore.cpp:
3092         (WebKit::WebResourceLoadStatisticsStore::WebResourceLoadStatisticsStore):
3093         (WebKit::WebResourceLoadStatisticsStore::processStatisticsAndDataRecords):
3094         (WebKit::WebResourceLoadStatisticsStore::grandfatherExistingWebsiteData):
3095         (WebKit::WebResourceLoadStatisticsStore::applicationWillTerminate):
3096         (WebKit::WebResourceLoadStatisticsStore::scheduleClearInMemoryAndPersistent):
3097         (WebKit::WebResourceLoadStatisticsStore::resetDataFromDecoder):
3098         * UIProcess/WebResourceLoadStatisticsStore.h:
3099         * WebKit2.xcodeproj/project.pbxproj:
3100
3101 2017-07-13  Chris Dumez  <cdumez@apple.com>
3102
3103         Unreviewed, rolling out r219453.
3104
3105         Seems to cause some crashes on the bots
3106
3107         Reverted changeset:
3108
3109         "Moved filesystem code out of WebResourceLoadStatisticsStore
3110         class"
3111         https://bugs.webkit.org/show_bug.cgi?id=174435
3112         http://trac.webkit.org/changeset/219453
3113
3114 2017-07-13  Jeremy Jones  <jeremyj@apple.com>
3115
3116         Fix style. Use #pragma once in VideoFullscreen and PlaybackSession headers.
3117         https://bugs.webkit.org/show_bug.cgi?id=174448
3118
3119         Reviewed by Eric Carlson.
3120
3121         No behavior change.
3122
3123         * UIProcess/Cocoa/WebVideoFullscreenManagerProxy.h:
3124         * WebProcess/cocoa/WebVideoFullscreenManager.h:
3125
3126 2017-07-13  Jeremy Jones  <jeremyj@apple.com>
3127
3128         Style fix. Replace strongThis with protectedThis.
3129         https://bugs.webkit.org/show_bug.cgi?id=174444
3130
3131         Reviewed by Eric Carlson.
3132
3133         Rename, no behavior change.
3134
3135         * WebProcess/cocoa/WebVideoFullscreenManager.mm:
3136         (WebKit::WebVideoFullscreenManager::didSetupFullscreen):
3137         (WebKit::WebVideoFullscreenManager::didEnterFullscreen):
3138         (WebKit::WebVideoFullscreenManager::didExitFullscreen):
3139         (WebKit::WebVideoFullscreenManager::didCleanupFullscreen):
3140
3141 2017-07-13  Chris Dumez  <cdumez@apple.com>
3142
3143         Moved filesystem code out of WebResourceLoadStatisticsStore class
3144         https://bugs.webkit.org/show_bug.cgi?id=174435
3145
3146         Reviewed by Brent Fulgham.
3147
3148         Moved filesystem code out of WebResourceLoadStatisticsStore class and into
3149         a new ResourceLoadStatisticsPersistentStorage class to decrease complexity.
3150
3151         * CMakeLists.txt:
3152         * UIProcess/Cocoa/WebResourceLoadStatisticsStoreCocoa.mm:
3153         * UIProcess/Storage/ResourceLoadStatisticsPersistentStorage.cpp: Added.
3154         (WebKit::hasFileChangedSince):
3155         (WebKit::createDecoderForFile):
3156         (WebKit::ResourceLoadStatisticsPersistentStorage::ResourceLoadStatisticsPersistentStorage):
3157         (WebKit::ResourceLoadStatisticsPersistentStorage::~ResourceLoadStatisticsPersistentStorage):
3158         (WebKit::ResourceLoadStatisticsPersistentStorage::storageDirectoryPath):
3159         (WebKit::ResourceLoadStatisticsPersistentStorage::resourceLogFilePath):
3160         (WebKit::ResourceLoadStatisticsPersistentStorage::startMonitoringDisk):
3161         (WebKit::ResourceLoadStatisticsPersistentStorage::stopMonitoringDisk):
3162         (WebKit::ResourceLoadStatisticsPersistentStorage::refreshMemoryStoreFromDisk):
3163         (WebKit::ResourceLoadStatisticsPersistentStorage::populateMemoryStoreFromDisk):
3164         (WebKit::ResourceLoadStatisticsPersistentStorage::writeMemoryStoreToDisk):
3165         (WebKit::ResourceLoadStatisticsPersistentStorage::scheduleOrWriteMemoryStore):
3166         (WebKit::ResourceLoadStatisticsPersistentStorage::clear):
3167         (WebKit::ResourceLoadStatisticsPersistentStorage::finishAllPendingWorkSynchronously):
3168         (WebKit::ResourceLoadStatisticsPersistentStorage::excludeFromBackup):
3169         * UIProcess/Storage/ResourceLoadStatisticsPersistentStorage.h: Added.
3170         * UIProcess/Storage/ios/ResourceLoadStatisticsPersistentStorageIOS.mm: Added.
3171         (WebKit::ResourceLoadStatisticsPersistentStorage::excludeFromBackup):
3172         * UIProcess/WebResourceLoadStatisticsStore.cpp:
3173         (WebKit::WebResourceLoadStatisticsStore::WebResourceLoadStatisticsStore):
3174         (WebKit::WebResourceLoadStatisticsStore::processStatisticsAndDataRecords):
3175         (WebKit::WebResourceLoadStatisticsStore::grandfatherExistingWebsiteData):
3176         (WebKit::WebResourceLoadStatisticsStore::applicationWillTerminate):
3177         (WebKit::WebResourceLoadStatisticsStore::scheduleClearInMemoryAndPersistent):
3178         (WebKit::WebResourceLoadStatisticsStore::resetDataFromDecoder):
3179         * UIProcess/WebResourceLoadStatisticsStore.h:
3180         * WebKit2.xcodeproj/project.pbxproj:
3181
3182 2017-07-12  Carlos Garcia Campos  <cgarcia@igalia.com>
3183
3184         Web Automation: evaluateJavaScriptFunction should start the callback timeout after the function is applied
3185         https://bugs.webkit.org/show_bug.cgi?id=174421
3186
3187         Reviewed by Brian Burg.
3188
3189         This is causing selenium test testShouldNotTimeoutIfScriptCallsbackInsideAZeroTimeout to fail, because
3190         JavaScriptTimeout error is generated unexpectedly. When no script timeout is specified, 0 is used by default,
3191         which means we do a setTimeout with 0 and then the script does another setTimeout with 0, but ours is dispatched
3192         before and reportTimeoutError is called. We should start our timeout after applying the function, and only if
3193         the result hasn't been reported yet.
3194
3195         * WebProcess/Automation/WebAutomationSessionProxy.js:
3196         (let.AutomationSessionProxy.prototype.evaluateJavaScriptFunction):
3197
3198 2017-07-12  Wenson Hsieh  <wenson_hsieh@apple.com>
3199
3200         [iOS DnD] [WK2] Add SPI to enable, disable, or follow default behavior for DnD on a WKWebView
3201         https://bugs.webkit.org/show_bug.cgi?id=174440
3202         <rdar://problem/33272627>
3203
3204         Reviewed by Beth Dakin.
3205
3206         Adds a new _dragInteractionPolicy property to WKWebView, which an internal client may use to always allow
3207         dragging out of the web view (_WKDragInteractionPolicyAlwaysEnable), never allow
3208         (_WKDragInteractionPolicyAlwaysDisable) or just use the default device-dependent behavior
3209         (_WKDragInteractionPolicyDefault).
3210
3211         Also removes an extraneous class from WKContentViewInteraction.mm that is no longer used anywhere.
3212
3213         * UIProcess/API/Cocoa/WKWebView.mm:
3214         (-[WKWebView _initializeWithConfiguration:]):
3215
3216         Set _dragInteractionPolicy to _WKDragInteractionPolicyDefault upon initialization.
3217
3218         (-[WKWebView _dragInteractionPolicy]):
3219         (-[WKWebView _setDragInteractionPolicy:]):
3220         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
3221         * UIProcess/ios/WKContentViewInteraction.h:
3222         * UIProcess/ios/WKContentViewInteraction.mm:
3223         (shouldEnableDragInteractionForPolicy):
3224         (-[WKContentView _didChangeDragInteractionPolicy]):
3225
3226         Called by the WKWebView when its _dragInteractionPolicy changes. The content view updates its
3227         UIDragInteraction's -enabled property here in response.
3228
3229         (-[WKContentView setupDataInteractionDelegates]):
3230
3231 2017-07-12  Said Abou-Hallawa  <sabouhallawa@apple.com>
3232
3233         Async image decoding for large images should be disabled by default
3234         https://bugs.webkit.org/show_bug.cgi?id=174432
3235
3236         Reviewed by Simon Fraser.
3237
3238         -- Replace every reference to GraphicsLayerPaintFlags::Snapshotting by
3239            GraphicsLayerPaintFlags::None and every GraphicsLayerPaintFlags::None
3240            by AllowAsyncImageDecoding.
3241         -- Replace setting the bit PaintBehaviorSnapshotting in an existing PaintBehavoir 
3242            by resetting the bit PaintBehaviorAllowAsyncImageDecoding.
3243
3244         * Shared/mac/RemoteLayerBackingStore.mm:
3245         (WebKit::RemoteLayerBackingStore::drawInContext):
3246         * WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp:
3247         (WebKit::imageForRect):
3248         * WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.cpp:
3249         (WebKit::InjectedBundleRangeHandle::renderedImage):
3250
3251 2017-07-12  Eric Carlson  <eric.carlson@apple.com>
3252
3253         [MediaStream] a capture source failure should end the MediaStreamTrack
3254         https://bugs.webkit.org/show_bug.cgi?id=174375
3255
3256         Reviewed by Youenn Fablet.
3257
3258         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
3259         (WebKit::UserMediaPermissionRequestManagerProxy::captureStateChanged): Consolidate start/end.
3260         (WebKit::UserMediaPermissionRequestManagerProxy::startedCaptureSession): Deleted.
3261         (WebKit::UserMediaPermissionRequestManagerProxy::endedCaptureSession): Deleted.
3262         * UIProcess/UserMediaPermissionRequestManagerProxy.h:
3263
3264         * UIProcess/WebPageProxy.cpp:
3265         (WebKit::WebPageProxy::isPlayingMediaDidChange): Call captureStateChanged if the capture 
3266         state changes. Consider interrupted flags.
3267
3268 2017-07-12  Daniel Bates  <dabates@apple.com>
3269
3270         NavigationAction should track whether the navigation was initiated by the main frame
3271         https://bugs.webkit.org/show_bug.cgi?id=174386
3272         <rdar://problem/33245267>
3273
3274         Reviewed by Brady Eidson.
3275
3276         * WebProcess/WebPage/WebInspector.cpp:
3277         (WebKit::WebInspector::openInNewTab): Pass whether the load was initiated by the main frame
3278         when instantiating the NavigationAction.
3279
3280 2017-07-12  Daniel Bates  <dabates@apple.com>
3281
3282         Rename NavigationInitiatedByMainFrame to InitiatedByMainFrame
3283         https://bugs.webkit.org/show_bug.cgi?id=174427
3284
3285         Rubber-stamped by Brady Eidson.
3286
3287         * WebProcess/Plugins/PluginView.cpp:
3288         (WebKit::PluginView::loadURL):
3289         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
3290         (WebKit::WebFrameLoaderClient::dispatchCreatePage):
3291         * WebProcess/WebPage/WebInspector.cpp:
3292         (WebKit::WebInspector::openInNewTab):
3293
3294 2017-07-12  Matt Lewis  <jlewis3@apple.com>
3295
3296         Unreviewed, rolling out r219401.
3297
3298         This revision rolled out the previous patch, but after talking
3299         with reviewer, a rebaseline is what was needed.Rolling back in
3300         before rebaseline.
3301
3302         Reverted changeset:
3303
3304         "Unreviewed, rolling out r219379."
3305         https://bugs.webkit.org/show_bug.cgi?id=174400
3306         http://trac.webkit.org/changeset/219401
3307
3308 2017-07-12  Daniel Bates  <dabates@apple.com>
3309
3310         Update description of Secure Contexts experimental flag
3311         https://bugs.webkit.org/show_bug.cgi?id=174401
3312
3313         Reviewed by Simon Fraser.
3314
3315         Change the description of the Secure Contexts experimental flag from "isSecureContext attribute"
3316         to "Secure Contexts API".
3317
3318         * Shared/WebPreferencesDefinitions.h:
3319
3320 2017-07-12  Matt Lewis  <jlewis3@apple.com>
3321
3322         Unreviewed, rolling out r219379.
3323
3324         This revision caused a consistent failure in the test
3325         fast/dom/Window/property-access-on-cached-window-after-frame-
3326         removed.html.
3327
3328         Reverted changeset:
3329
3330         "Remove NAVIGATOR_HWCONCURRENCY"
3331         https://bugs.webkit.org/show_bug.cgi?id=174400
3332         http://trac.webkit.org/changeset/219379
3333
3334 2017-07-12  Zan Dobersek  <zdobersek@igalia.com>
3335
3336         [WPE] Use libepoxy
3337         https://bugs.webkit.org/show_bug.cgi?id=172104
3338
3339         Reviewed by Michael Catanzaro.
3340
3341         * PlatformWPE.cmake: Drop the EGL_INCLUDE_DIRS compilation flags.
3342         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
3343         Include <epoxy/gl.h> when compiling with libepoxy usage enabled.
3344
3345 2017-07-12  Carlos Garcia Campos  <cgarcia@igalia.com>
3346
3347         Web Automation: upstream safaridriver's JavaScript atom implementations
3348         https://bugs.webkit.org/show_bug.cgi?id=172060
3349         <rdar://problem/32168187>
3350
3351         Reviewed by Brian Burg.
3352
3353         * UIProcess/Automation/atoms/ElementAttribute.js: Added.
3354         * UIProcess/Automation/atoms/ElementDisplayed.js: Added.
3355         * UIProcess/Automation/atoms/FindNodes.js: Added.
3356         * UIProcess/Automation/atoms/FormElementClear.js: Added.
3357         * UIProcess/Automation/atoms/FormSubmit.js: Added.
3358
3359 2017-07-11  Dean Jackson  <dino@apple.com>
3360
3361         Remove NAVIGATOR_HWCONCURRENCY
3362         https://bugs.webkit.org/show_bug.cgi?id=174400
3363
3364         Reviewed by Sam Weinig.
3365
3366         * Configurations/FeatureDefines.xcconfig:
3367
3368 2017-07-11  Ansh Shukla  <ansh_shukla@apple.com>
3369
3370         WKWindowFeatures needs to expose scrollbar, fullscreen, and dialog configuration properties
3371         https://bugs.webkit.org/show_bug.cgi?id=174239
3372
3373         Reviewed by Brady Eidson.
3374
3375         Add a new private header to expose getters for window feature properties already available
3376         in the TFB APIWindowFeatures class. These properties are necessary for Safari to adopt more
3377         modern API.
3378
3379         * UIProcess/API/Cocoa/WKWindowFeatures.mm:
3380         (-[WKWindowFeatures _locationBarVisibility]):
3381         (-[WKWindowFeatures _scrollbarsVisibility]):
3382         (-[WKWindowFeatures _fullscreenDisplay]):
3383         (-[WKWindowFeatures _dialogDisplay]):
3384         * UIProcess/API/Cocoa/WKWindowFeaturesInternal.h: Expose some window features as read-only
3385         properties.
3386         * UIProcess/API/Cocoa/WKWindowFeaturesPrivate.h:
3387         * WebKit2.xcodeproj/project.pbxproj:
3388
3389 2017-07-11  Chris Dumez  <cdumez@apple.com>
3390
3391         Avoid duplicating default parameter values in [WKWebsiteDataStore _resourceLoadStatisticsResetToConsistentState]
3392         https://bugs.webkit.org/show_bug.cgi?id=174402
3393
3394         Reviewed by Brent Fulgham.
3395
3396         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
3397         (-[WKWebsiteDataStore _resourceLoadStatisticsResetToConsistentState]):
3398         * UIProcess/WebResourceLoadStatisticsStore.cpp:
3399         (WebKit::WebResourceLoadStatisticsStore::WebResourceLoadStatisticsStore):
3400         (WebKit::WebResourceLoadStatisticsStore::removeDataRecords):
3401         (WebKit::WebResourceLoadStatisticsStore::processStatisticsAndDataRecords):
3402         (WebKit::WebResourceLoadStatisticsStore::grandfatherExistingWebsiteData):
3403         (WebKit::WebResourceLoadStatisticsStore::performDailyTasks):
3404         (WebKit::WebResourceLoadStatisticsStore::setTimeToLiveUserInteraction):
3405         (WebKit::WebResourceLoadStatisticsStore::setTimeToLiveCookiePartitionFree):
3406         (WebKit::WebResourceLoadStatisticsStore::setMinimumTimeBetweenDataRecordsRemoval):
3407         (WebKit::WebResourceLoadStatisticsStore::setGrandfatheringTime):
3408         (WebKit::WebResourceLoadStatisticsStore::shouldRemoveDataRecords):
3409         (WebKit::WebResourceLoadStatisticsStore::shouldPartitionCookies):
3410         (WebKit::WebResourceLoadStatisticsStore::hasStatisticsExpired):
3411         (WebKit::WebResourceLoadStatisticsStore::setMaxStatisticsEntries):
3412         (WebKit::WebResourceLoadStatisticsStore::setPruneEntriesDownTo):
3413         (WebKit::WebResourceLoadStatisticsStore::pruneStatisticsIfNeeded):
3414         (WebKit::WebResourceLoadStatisticsStore::resetParametersToDefaultValues):
3415         * UIProcess/WebResourceLoadStatisticsStore.h:
3416
3417 2017-07-11  Dean Jackson  <dino@apple.com>
3418
3419         Rolling out r219372.
3420
3421         * Configurations/FeatureDefines.xcconfig:
3422
3423 2017-07-11  Dean Jackson  <dino@apple.com>
3424
3425         Remove NAVIGATOR_HWCONCURRENCY
3426         https://bugs.webkit.org/show_bug.cgi?id=174400
3427
3428         Reviewed by Sam Weinig.
3429
3430         * Configurations/FeatureDefines.xcconfig:
3431
3432 2017-07-11  Dean Jackson  <dino@apple.com>
3433
3434         Viewport fit experimental feature should be always on by default
3435         https://bugs.webkit.org/show_bug.cgi?id=174398
3436         <rdar://problem/33248920>
3437
3438         Reviewed by Simon Fraser.
3439
3440         Even though this is experimental, it should be enabled by default, and
3441         not follow the value of DEFAULT_EXPERIMENTAL_FEATURES_ENABLED.
3442
3443         * Shared/WebPreferencesDefinitions.h:
3444
3445 2017-07-11  Adrian Perez de Castro  <aperez@igalia.com>
3446
3447         Fix typo: ContentRuleListStore::nonLegacyDdefaultStore()
3448         https://bugs.webkit.org/show_bug.cgi?id=174387
3449
3450         Reviewed by Michael Catanzaro.
3451
3452         Rename nonLegacyDdefaultStore() to nonLegacyDefaultStore().
3453
3454         * UIProcess/API/APIContentRuleListStore.cpp:
3455         (API::ContentRuleListStore::nonLegacyDefaultStore):
3456         (API::ContentRuleListStore::defaultStore):
3457         * UIProcess/API/APIContentRuleListStore.h:
3458
3459 2017-07-11  Chris Dumez  <cdumez@apple.com>
3460
3461         Simplify primary domain lambda captures in WebResourceLoadStatisticsStore
3462         https://bugs.webkit.org/show_bug.cgi?id=174381
3463
3464         Reviewed by Brent Fulgham.
3465
3466         * UIProcess/WebResourceLoadStatisticsStore.cpp:
3467         (WebKit::isolatedPrimaryDomain):
3468         (WebKit::WebResourceLoadStatisticsStore::logUserInteraction):
3469         (WebKit::WebResourceLoadStatisticsStore::clearUserInteraction):
3470         (WebKit::WebResourceLoadStatisticsStore::hasHadUserInteraction):
3471         (WebKit::WebResourceLoadStatisticsStore::setLastSeen):
3472         (WebKit::WebResourceLoadStatisticsStore::setPrevalentResource):
3473         (WebKit::WebResourceLoadStatisticsStore::isPrevalentResource):
3474         (WebKit::WebResourceLoadStatisticsStore::clearPrevalentResource):
3475         (WebKit::WebResourceLoadStatisticsStore::setGrandfathered):
3476         (WebKit::WebResourceLoadStatisticsStore::isGrandfathered):
3477         (WebKit::WebResourceLoadStatisticsStore::setSubframeUnderTopFrameOrigin):
3478         (WebKit::WebResourceLoadStatisticsStore::setSubresourceUnderTopFrameOrigin):
3479         (WebKit::WebResourceLoadStatisticsStore::setSubresourceUniqueRedirectTo):
3480         (WebKit::primaryDomain): Deleted.
3481
3482 2017-07-11  Timothy Hatcher  <timothy@hatcher.name>
3483
3484         Fix a build failure in WebDragClient when !PLATFORM(COCOA) && !PLATFORM(GTK).
3485         https://bugs.webkit.org/show_bug.cgi?id=174372
3486
3487         Reviewed by Beth Dakin.
3488
3489         * WebProcess/WebCoreSupport/WebDragClient.cpp:
3490         (WebKit::WebDragClient::didConcludeEditDrag): Added empty method.
3491
3492 2017-07-11  Brent Fulgham  <bfulgham@apple.com>
3493
3494         Reset cookie partitioning state after network process crashes
3495         https://bugs.webkit.org/show_bug.cgi?id=174306
3496         <rdar://problem/33171605>
3497
3498         Reviewed by Chris Dumez.
3499
3500         * UIProcess/Storage/ResourceLoadStatisticsStore.cpp:
3501         (WebKit::ResourceLoadStatisticsStore::fireShouldPartitionCookiesHandler): Move cookie
3502         partioning state code to helper function.
3503         (WebKit::ResourceLoadStatisticsStore::resetPartitionCookiesState): Added.
3504         * UIProcess/Storage/ResourceLoadStatisticsStore.h:
3505         * UIProcess/WebProcessPool.cpp:
3506         (WebKit::WebProcessPool::ensureNetworkProcess): Inform the statistics store that
3507         the network process crashed.
3508         (WebKit::WebProcessPool::terminateNetworkProcess): Mark network process as crashed.
3509         * UIProcess/WebResourceLoadStatisticsStore.cpp:
3510         (WebKit::WebResourceLoadStatisticsStore::networkProcessDidCrash): Reset the cookie
3511         partitioning state after a crash.
3512         * UIProcess/WebResourceLoadStatisticsStore.h:
3513         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
3514         (WebKit::WebsiteDataStore::notifyResourceLoadStatisticsNetworkProcessDidCrash): Relay
3515         information to the statistics store.
3516         * UIProcess/WebsiteData/WebsiteDataStore.h:
3517
3518 2017-07-11  Timothy Hatcher  <timothy@hatcher.name>
3519
3520         Fix broken build when !ENABLE(INDEXED_DATABASE)
3521         https://bugs.webkit.org/show_bug.cgi?id=174370
3522
3523         Reviewed by Alex Christensen.
3524
3525         * UIProcess/WebProcessPool.cpp:
3526         (WebKit::WebProcessPool::pageAddedToProcess):
3527
3528 2017-07-11  Youenn Fablet  <youenn@apple.com>
3529
3530         Changing the web page muted state for playing audio should not disable other tabs capture
3531         https://bugs.webkit.org/show_bug.cgi?id=174349
3532
3533         Unreviewed.
3534
3535         * UIProcess/WebPageProxy.cpp:
3536         (WebKit::WebPageProxy::activateMediaStreamCaptureInPage): Fixes non MEDIA_STREAM builds.
3537
3538 2017-07-11  Wenson Hsieh  <wenson_hsieh@apple.com>
3539
3540         Address post-review feedback after http://trac.webkit.org/r219310
3541         https://bugs.webkit.org/show_bug.cgi?id=174300
3542         <rdar://problem/33030639>
3543
3544         Reviewed by Simon Fraser.
3545
3546         Removes plumbing introduced in r219310 for telling WKContentView when the user has finished panning or zooming.
3547         This was previously used to reset allowing asynchronous touch event after preventing the web touch events
3548         gesture recognizer from firing.
3549
3550         However, a far simpler (and much less fragile) solution is to just set _canSendTouchEventsAsynchronously to NO
3551         at the beginning of the gesture, before the first `touchstart` event is dispatched. This way, we always ensure
3552         that _canSendTouchEventsAsynchronously is NO when beginning to process a touch event. This approach is correct
3553         because the only place where we query _canSendTouchEventsAsynchronously is in -_webTouchEventsRecognized:, where
3554         (when we are beginning a new gesture) we are guaranteed that -gestureRecognizer:shouldIgnoreWebTouchWithEvent:
3555         has already been called and _canSendTouchEventsAsynchronously is NO.
3556
3557         Confirmed that the LayoutTests added in r219310 still pass.
3558
3559         * UIProcess/API/Cocoa/WKWebView.mm:
3560         (-[WKWebView scrollViewDidEndDragging:willDecelerate:]):
3561         (-[WKWebView scrollViewDidEndZooming:withView:atScale:]):
3562         * UIProcess/PageClient.h:
3563         * UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.h:
3564         * UIProcess/Scrolling/RemoteScrollingTree.cpp:
3565         (WebKit::RemoteScrollingTree::scrollingTreeNodeDidEndPanGesture): Deleted.
3566         * UIProcess/Scrolling/RemoteScrollingTree.h:
3567         * UIProcess/Scrolling/ios/ScrollingTreeOverflowScrollingNodeIOS.h:
3568         * UIProcess/Scrolling/ios/ScrollingTreeOverflowScrollingNodeIOS.mm:
3569         (-[WKOverflowScrollViewDelegate scrollViewDidEndDragging:willDecelerate:]):
3570         (WebKit::ScrollingTreeOverflowScrollingNodeIOS::overflowScrollViewDidEndPanGesture): Deleted.
3571         * UIProcess/WebPageProxy.h:
3572         * UIProcess/ios/PageClientImplIOS.h:
3573         * UIProcess/ios/PageClientImplIOS.mm:
3574         (WebKit::PageClientImpl::overflowScrollViewDidEndPanGesture): Deleted.
3575         * UIProcess/ios/RemoteScrollingCoordinatorProxyIOS.mm:
3576         (WebKit::RemoteScrollingCoordinatorProxy::scrollingTreeNodeDidEndPanGesture): Deleted.
3577         * UIProcess/ios/WKContentViewInteraction.h:
3578         * UIProcess/ios/WKContentViewInteraction.mm:
3579         (-[WKContentView gestureRecognizer:shouldIgnoreWebTouchWithEvent:]):
3580         (-[WKContentView scrollViewDidEndPanOrPinchGesture]): Deleted.
3581         * UIProcess/ios/WebPageProxyIOS.mm:
3582         (WebKit::WebPageProxy::overflowScrollViewDidEndPanGesture): Deleted.
3583
3584 2017-07-11  Brent Fulgham  <bfulgham@apple.com>
3585
3586         Unreviewed clean-up after r219323
3587
3588         Simplify algorithm slightly based on a suggestion Chris Dumez made in the review.
3589
3590         * UIProcess/WebResourceLoadStatisticsStore.cpp:
3591         (WebKit::pruneResources): Don't create a second variable to track the pruning operation.
3592
3593 2017-07-11  Alex Christensen  <achristensen@webkit.org>
3594
3595         SharedBuffer::size should return a size_t
3596         https://bugs.webkit.org/show_bug.cgi?id=174328
3597
3598         Reviewed by Andreas Kling.
3599
3600         * UIProcess/WebResourceLoadStatisticsStore.cpp:
3601         (WebKit::WebResourceLoadStatisticsStore::writeEncoderToDisk):
3602
3603 2017-07-11  Youenn Fablet  <youenn@apple.com>
3604
3605         We should do ICE candidate filtering at the Document level
3606         https://bugs.webkit.org/show_bug.cgi?id=173861
3607         <rdar://problem/33122058>
3608
3609         Reviewed by Eric Carlson.
3610
3611         Removing ICE candidate filtering handling at UIProcess level.
3612         ICE candidate filtering is now disabled at UserMediaRequest level.
3613         WebPage forwards the ICE candidate filtering option to the page so as to set
3614         the default option correctly for every document of the page.
3615
3616         * UIProcess/UserMediaProcessManager.cpp:
3617         (WebKit::UserMediaProcessManager::willCreateMediaStream):
3618         (WebKit::UserMediaProcessManager::endedCaptureSession):
3619         * WebProcess/WebPage/WebPage.cpp:
3620         (WebKit::WebPage::disableICECandidateFiltering):
3621         (WebKit::WebPage::enableICECandidateFiltering):
3622
3623 2017-07-11  Youenn Fablet  <youenn@apple.com>
3624
3625         Changing the web page muted state for playing audio should not disable other tabs capture
3626         https://bugs.webkit.org/show_bug.cgi?id=174349
3627         rdar://problem/33223988
3628
3629         Reviewed by Eric Carlson.
3630
3631         Make sure to mute capturing streams of any other tab if the current tab will start capturing or will unmute existing capturing streams.
3632         Manually tested by having a tab doing capture and another tab playing a video.
3633         Muting or unmuting the tab playing video should not change the capture tab.
3634
3635         * UIProcess/WebPageProxy.cpp:
3636         (WebKit::WebPageProxy::activateMediaStreamCaptureInPage):
3637         (WebKit::WebPageProxy::setMuted):
3638         * UIProcess/WebPageProxy.h:
3639         (WebKit::WebPageProxy::activateMediaStreamCaptureInPage):
3640
3641 2017-07-11  Youenn Fablet  <youenn@apple.com>
3642
3643         NetworkProcess should close listening WebRTC sockets when being suspended
3644         https://bugs.webkit.org/show_bug.cgi?id=174270
3645         rdar://problem/33139844
3646
3647         Reviewed by Chris Dumez.
3648
3649         To prevent potential spinning of the NetworkProcess, NetworkProcess will now close listening sockets when being notified that it will be suspended.
3650         When the network process is being suspended, it will stop creating listening sockets, until it resumes.
3651         Future additional efforts might be to improve select/cancel so that we can stop listening sockets at resume time,
3652         or to reimplement part of the stack using CFStream.
3653
3654         Tested through manual testing by going to a website doing WebRTC, homing out so that the network process is suspended and reopening Safari.
3655
3656         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
3657         (WebKit::NetworkConnectionToWebProcess::cleanupForSuspension):
3658         Proxying call to clean for suspension to rtc provider so that it will
3659         close listening sockets.
3660         (WebKit::NetworkConnectionToWebProcess::resumeFromSuspension): Authorizing back listening sockets.
3661         * NetworkProcess/NetworkConnectionToWebProcess.h:
3662         (WebKit::NetworkConnectionToWebProcess::cleanupForSuspension):
3663         Clean-up is done asynchronously as it can happen in background threads.
3664         Hence why passing a callback as parameter.
3665         * NetworkProcess/NetworkProcess.cpp:
3666         (WebKit::NetworkProcess::notifyProcessReadyToSuspend): Helper routine
3667         to notify UI process that network process clean up is done.
3668         (WebKit::TaskCounter::TaskCounter): Helper class to call notifyProcessReadyToSuspend when sded.
3669         (WebKit::TaskCounter::~TaskCounter):
3670         (WebKit::NetworkProcess::actualPrepareToSuspend): Doing the clean-up for each connection that needs it.
3671         Making sure to notify UI process of clean-up being completed once all connections are cleaned.
3672         (WebKit::NetworkProcess::processWillSuspendImminently):
3673         (WebKit::NetworkProcess::prepareToSuspend):
3674         (WebKit::NetworkProcess::processDidResume): Reenable listening sockets.
3675         * NetworkProcess/NetworkProcess.h:
3676         * NetworkProcess/webrtc/LibWebRTCSocketClient.cpp:
3677         (WebKit::LibWebRTCSocketClient::LibWebRTCSocketClient):
3678         * NetworkProcess/webrtc/LibWebRTCSocketClient.h: Adding type getter and making close public.
3679         Used by NetworkRTCProvider to identifiy listening sockets and close them.
3680         * NetworkProcess/webrtc/NetworkRTCProvider.cpp:
3681         (WebKit::NetworkRTCProvider::closeListeningSockets): We close the webrtc socket
3682         and we also notify the Web Process that the socket is closed so that it can take actions to recreate some if needed.
3683         (WebKit::NetworkRTCProvider::finishClosingListeningSockets):
3684         * NetworkProcess/webrtc/NetworkRTCProvider.h:
3685         (WebKit::NetworkRTCProvider::authorizeListeningSockets): Authorize creation of listening sockets.
3686
3687 2017-07-10  Brent Fulgham  <bfulgham@apple.com>
3688
3689         Resource Load Statistics: Prune statistics in orders of importance
3690         https://bugs.webkit.org/show_bug.cgi?id=174215
3691         <rdar://problem/33164403>
3692
3693         Unreviewed test correction.
3694
3695         * UIProcess/WebResourceLoadStatisticsStore.cpp:
3696         (WebKit::pruneResources): The revised algorithm did not update the remaining
3697         count to be pruned, causing a test failure.
3698
3699 2017-07-10  John Wilander  <wilander@apple.com>
3700
3701         Resource Load Statistics: Prune statistics in orders of importance
3702         https://bugs.webkit.org/show_bug.cgi?id=174215
3703         <rdar://problem/33164403>
3704
3705         Reviewed by Chris Dumez.
3706
3707         New functionality. Prunes statistics in this order:
3708         1. Non-prevalent resources without user interaction.
3709         2. Prevalent resources without user interaction.
3710         3. Non-prevalent resources with user interaction.
3711         4. Prevalent resources with user interaction.
3712
3713         * Shared/WebCoreArgumentCoders.cpp:
3714         (IPC::ArgumentCoder<ResourceLoadStatistics>::encode):
3715         (IPC::ArgumentCoder<ResourceLoadStatistics>::decode):
3716             Added timestamp field lastSeen.
3717         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
3718         (-[WKWebsiteDataStore _resourceLoadStatisticsSetLastSeen:forHost:]):
3719         (-[WKWebsiteDataStore _resourceLoadStatisticsSetMaxStatisticsEntries:]):
3720         (-[WKWebsiteDataStore _resourceLoadStatisticsSetPruneEntriesDownTo:]):
3721         (-[WKWebsiteDataStore _resourceLoadStatisticsResetToConsistentState]):
3722             Test infrastructure.
3723         * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
3724         * UIProcess/Storage/ResourceLoadStatisticsStore.cpp:
3725         (WebKit::ResourceLoadStatisticsStore::setMaxStatisticsEntries):
3726             Test infrastructure.
3727         (WebKit::ResourceLoadStatisticsStore::setPruneEntriesDownTo):
3728             Test infrastructure.
3729         (WebKit::sortAndPrune):
3730             Convenience function.
3731         (WebKit::ResourceLoadStatisticsStore::pruneStatisticsIfNeeded):
3732             The new pruning function.
3733         * UIProcess/Storage/ResourceLoadStatisticsStore.h:
3734         * UIProcess/WebResourceLoadStatisticsStore.cpp:
3735         (WebKit::WebResourceLoadStatisticsStore::processStatisticsAndDataRecords):
3736             Now calls ResourceLoadStatisticsStore::pruneStatisticsIfNeeded().
3737         (WebKit::WebResourceLoadStatisticsStore::setLastSeen):
3738             Test infrastructure.
3739         (WebKit::WebResourceLoadStatisticsStore::setMaxStatisticsEntries):
3740             Test infrastructure.
3741         (WebKit::WebResourceLoadStatisticsStore::setPruneEntriesDownTo):
3742             Test infrastructure.
3743         * UIProcess/WebResourceLoadStatisticsStore.h:
3744
3745 2017-07-10  Dean Jackson  <dino@apple.com>
3746
3747         const() experimental feature should always be on by default
3748         https://bugs.webkit.org/show_bug.cgi?id=174341
3749         <rdar://problem/33228603>
3750
3751         Reviewed by Simon Fraser.
3752
3753         Even though this is experimental, it should be enabled by default, and
3754         not follow the value of DEFAULT_EXPERIMENTAL_FEATURES_ENABLED.
3755
3756         * Shared/WebPreferencesDefinitions.h:
3757
3758 2017-07-10  Chris Dumez  <cdumez@apple.com>
3759
3760         [iOS] _didCommitLayerTree should avoid calling [scrollView setZoomScale] unnecessarily
3761         https://bugs.webkit.org/show_bug.cgi?id=174326
3762         <rdar://problem/33150490>
3763
3764         Reviewed by Simon Fraser.
3765
3766         Only call [scrollView setZoomScale] if the new zoom scale is actually different to
3767         avoid doing unnecessary work in UIKit.
3768
3769         * UIProcess/API/Cocoa/WKWebView.mm:
3770         (-[WKWebView _didCommitLayerTree:]):
3771
3772 2017-07-10  Chris Dumez  <cdumez@apple.com>
3773
3774         Merge ResourceLoadStatisticsStore into WebResourceLoadStatisticsStore
3775         https://bugs.webkit.org/show_bug.cgi?id=174203
3776
3777         Reviewed by Brent Fulgham.
3778
3779         Merge ResourceLoadStatisticsStore into WebResourceLoadStatisticsStore. The 2 classes
3780         have a similar purpose and there is no clean separation between the 2. It makes more
3781         sense to have a single store class for resource load statistics.
3782
3783         If we want to simplify the WebResourceLoadStatisticsStore class, I think it'd make
3784         more sense to split the file system I/O code out. This code adds quite a bit of
3785         complexity.
3786
3787         * CMakeLists.txt:
3788         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
3789         (-[WKWebsiteDataStore _resourceLoadStatisticsUpdateCookiePartitioning]):
3790         (-[WKWebsiteDataStore _resourceLoadStatisticsSetShouldPartitionCookies:forHost:]):
3791         (-[WKWebsiteDataStore _resourceLoadStatisticsClearInMemoryAndPersistentStore]):
3792         (-[WKWebsiteDataStore _resourceLoadStatisticsClearInMemoryAndPersistentStoreModifiedSinceHours:]):
3793         (-[WKWebsiteDataStore _resourceLoadStatisticsResetToConsistentState]):
3794         * UIProcess/Storage/ResourceLoadStatisticsStore.cpp: Removed.
3795         * UIProcess/Storage/ResourceLoadStatisticsStore.h: Removed.
3796         * UIProcess/WebResourceLoadStatisticsStore.cpp:
3797         (WebKit::WebResourceLoadStatisticsStore::WebResourceLoadStatisticsStore):
3798         (WebKit::WebResourceLoadStatisticsStore::removeDataRecords):
3799         (WebKit::WebResourceLoadStatisticsStore::processStatisticsAndDataRecords):
3800         (WebKit::WebResourceLoadStatisticsStore::resourceLoadStatisticsUpdated):
3801         (WebKit::WebResourceLoadStatisticsStore::grandfatherExistingWebsiteData):
3802         (WebKit::WebResourceLoadStatisticsStore::readDataFromDiskIfNeeded):
3803         (WebKit::WebResourceLoadStatisticsStore::refreshFromDisk):
3804         (WebKit::WebResourceLoadStatisticsStore::writeStoreToDisk):
3805         (WebKit::WebResourceLoadStatisticsStore::startMonitoringStatisticsStorage):
3806         (WebKit::WebResourceLoadStatisticsStore::performDailyTasks):
3807         (WebKit::WebResourceLoadStatisticsStore::submitTelemetry):
3808         (WebKit::WebResourceLoadStatisticsStore::logUserInteraction):
3809         (WebKit::WebResourceLoadStatisticsStore::clearUserInteraction):
3810         (WebKit::WebResourceLoadStatisticsStore::hasHadUserInteraction):
3811         (WebKit::WebResourceLoadStatisticsStore::setPrevalentResource):
3812         (WebKit::WebResourceLoadStatisticsStore::isPrevalentResource):
3813         (WebKit::WebResourceLoadStatisticsStore::clearPrevalentResource):
3814         (WebKit::WebResourceLoadStatisticsStore::setGrandfathered):
3815         (WebKit::WebResourceLoadStatisticsStore::isGrandfathered):
3816         (WebKit::WebResourceLoadStatisticsStore::setSubframeUnderTopFrameOrigin):
3817         (WebKit::WebResourceLoadStatisticsStore::setSubresourceUnderTopFrameOrigin):
3818         (WebKit::WebResourceLoadStatisticsStore::setSubresourceUniqueRedirectTo):
3819         (WebKit::WebResourceLoadStatisticsStore::scheduleCookiePartitioningUpdate):
3820         (WebKit::WebResourceLoadStatisticsStore::scheduleCookiePartitioningUpdateForDomains):
3821         (WebKit::WebResourceLoadStatisticsStore::scheduleClearInMemory):
3822         (WebKit::WebResourceLoadStatisticsStore::scheduleClearInMemoryAndPersistent):
3823         (WebKit::WebResourceLoadStatisticsStore::setTimeToLiveUserInteraction):
3824         (WebKit::WebResourceLoadStatisticsStore::setTimeToLiveCookiePartitionFree):
3825         (WebKit::WebResourceLoadStatisticsStore::setGrandfatheringTime):
3826         (WebKit::WebResourceLoadStatisticsStore::ensureResourceStatisticsForPrimaryDomain):
3827         (WebKit::WebResourceLoadStatisticsStore::createEncoderFromData):
3828         (WebKit::WebResourceLoadStatisticsStore::populateFromDecoder):
3829         (WebKit::WebResourceLoadStatisticsStore::clearInMemory):
3830         (WebKit::WebResourceLoadStatisticsStore::mergeStatistics):
3831         (WebKit::WebResourceLoadStatisticsStore::shouldPartitionCookies):
3832         (WebKit::WebResourceLoadStatisticsStore::updateCookiePartitioning):
3833         (WebKit::WebResourceLoadStatisticsStore::updateCookiePartitioningForDomains):
3834         (WebKit::WebResourceLoadStatisticsStore::processStatistics):
3835         (WebKit::WebResourceLoadStatisticsStore::hasHadUnexpiredRecentUserInteraction):
3836         (WebKit::WebResourceLoadStatisticsStore::topPrivatelyControlledDomainsToRemoveWebsiteDataFor):
3837         (WebKit::WebResourceLoadStatisticsStore::includeTodayAsOperatingDateIfNecessary):
3838         (WebKit::WebResourceLoadStatisticsStore::hasStatisticsExpired):
3839         * UIProcess/WebResourceLoadStatisticsStore.h:
3840         * UIProcess/WebResourceLoadStatisticsTelemetry.cpp:
3841         (WebKit::sortedPrevalentResourceTelemetry):
3842         (WebKit::WebResourceLoadStatisticsTelemetry::calculateAndSubmit):
3843         * UIProcess/WebResourceLoadStatisticsTelemetry.h:
3844         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
3845         (WebKit::WebsiteDataStore::removeData):
3846         * WebKit2.xcodeproj/project.pbxproj:
3847
3848 2017-07-10  Wenson Hsieh  <wenson_hsieh@apple.com>
3849
3850         [WK2] Ignore touch events that interrupt platform-driven momentum scrolling
3851         https://bugs.webkit.org/show_bug.cgi?id=174300
3852         <rdar://problem/33030639>
3853
3854         Reviewed by Simon Fraser.
3855
3856         Adds support for immediately failing WKContentView's UIWebTouchEventsGestureRecognizer if any touch interrupts
3857         scroll view deceleration. Covered by 3 new LayoutTests (see Source/WebCore/ChangeLog).
3858
3859         * Platform/spi/ios/UIKitSPI.h:
3860         * UIProcess/API/Cocoa/WKWebView.mm:
3861         (-[WKWebView scrollViewDidEndDragging:willDecelerate:]):
3862         (-[WKWebView scrollViewDidEndZooming:withView:atScale:]):
3863         * UIProcess/PageClient.h:
3864         * UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.h:
3865         * UIProcess/Scrolling/RemoteScrollingTree.cpp:
3866         (WebKit::RemoteScrollingTree::scrollingTreeNodeDidEndPanGesture):
3867         * UIProcess/Scrolling/RemoteScrollingTree.h:
3868         * UIProcess/Scrolling/ios/ScrollingTreeOverflowScrollingNodeIOS.h:
3869         * UIProcess/Scrolling/ios/ScrollingTreeOverflowScrollingNodeIOS.mm:
3870         (-[WKOverflowScrollViewDelegate scrollViewDidEndDragging:willDecelerate:]):
3871         (WebKit::ScrollingTreeOverflowScrollingNodeIOS::overflowScrollViewDidEndPanGesture):
3872
3873         Adds plumbing in the UI process to alert the WKContentView when scroll view dragging has ended in an overflow
3874         momentum scrolling region (tracked by an overflow scrolling tree node). This parallels UI process plumbing for
3875         ScrollingTreeOverflowScrollingNodeIOS::overflowScrollViewWillStartPanGesture.
3876
3877         * UIProcess/WebPageProxy.h:
3878         * UIProcess/ios/PageClientImplIOS.h:
3879         * UIProcess/ios/PageClientImplIOS.mm:
3880         (WebKit::PageClientImpl::overflowScrollViewDidEndPanGesture):
3881         * UIProcess/ios/RemoteScrollingCoordinatorProxyIOS.mm:
3882         (WebKit::RemoteScrollingCoordinatorProxy::scrollingTreeNodeDidEndPanGesture):
3883         * UIProcess/ios/WKContentViewInteraction.h:
3884         * UIProcess/ios/WKContentViewInteraction.mm:
3885         (-[WKContentView scrollViewDidEndPanOrPinchGesture]):
3886
3887         When the dragging phase of a scroll gesture ends, ensure that _canSendTouchEventsAsynchronously is reset to NO.
3888         When touches are not being prevented, this flag is set to YES in -scrollViewWillStartPanOrPinchGesture: and
3889         normally reset to NO in -_webTouchEventsRecognized: after all touch points have been released. However, in the
3890         case where we've prematurely failed the web touch events gesture recognizer after -touchesBegan:,
3891         -_webTouchEventsRecognized: will not be called again in a state where all touches have been released. Thus, we
3892         also need to bookend the place where we begin allowing async touch event dispatch in
3893         -scrollViewWillStartPanOrPinchGesture by disallowing async touch event dispatch in
3894         -scrollViewDidEndPanOrPinchGesture.
3895
3896         This has no impact in the normal case where the user scrolls without momentum, since
3897         -scrollViewDidEndPanOrPinchGesture will fire after async touch events have already been disallowed in
3898         -_webTouchEventsRecognized:, and in the case where the page prevents default on touches, scrolling doesn't
3899         happen anyways, so neither scrollViewWillStartPanOrPinchGesture nor scrollViewDidEndPanOrPinchGesture will be
3900         invoked.
3901
3902         (-[WKContentView gestureRecognizer:shouldIgnoreWebTouchWithEvent:]):
3903
3904         Implements a new SPI hook in UIKit. This serves an identical purpose as -shouldIgnoreWebTouch, but additionally
3905         passes the triggering UIEvent, as well as the gesture recognizer itself (following standard convention for
3906         Objective C delegate methods). Here, we return YES in the case where one or more of the touches recognized by
3907         the gesture is currently interrupting scroll deceleration.
3908
3909         * UIProcess/ios/WebPageProxyIOS.mm:
3910         (WebKit::WebPageProxy::overflowScrollViewDidEndPanGesture):
3911
3912 2017-07-10  Brent Fulgham  <bfulgham@apple.com>
3913
3914         [WK2][macOS] Allow access to com.apple.cfnetwork.cfnetworkagent in the Network Process
3915         https://bugs.webkit.org/show_bug.cgi?id=174320
3916         <rdar://problem/33191856>
3917
3918         Reviewed by Geoffrey Garen.
3919
3920         * NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in:
3921
3922 2017-07-10  Megan Gardner  <megan_gardner@apple.com>
3923
3924         Add location to NavigationActionData
3925         https://bugs.webkit.org/show_bug.cgi?id=174233
3926         <rdar://problem/29165518>
3927
3928         Reviewed by Simon Fraser.
3929         
3930         Add the root view location of a tap to a NavigationAction to vend to Safari.
3931
3932         * Shared/NavigationActionData.cpp:
3933         (WebKit::NavigationActionData::encode):
3934         (WebKit::NavigationActionData::decode):
3935         * Shared/NavigationActionData.h:
3936         * UIProcess/API/APINavigationAction.h:
3937         * UIProcess/API/Cocoa/WKNavigationAction.mm:
3938         (-[WKNavigationAction description]):
3939         (-[WKNavigationAction _clickLocationInRootViewCoordinates]):
3940         * UIProcess/API/Cocoa/WKNavigationActionPrivate.h:
3941         * WebProcess/InjectedBundle/InjectedBundleNavigationAction.cpp:
3942         (WebKit::clickLocationInRootViewCoordinatesForMouseEvent):
3943         (WebKit::InjectedBundleNavigationAction::clickLocationInRootViewCoordinatesForNavigationAction):
3944         (WebKit::InjectedBundleNavigationAction::InjectedBundleNavigationAction):
3945         * WebProcess/InjectedBundle/InjectedBundleNavigationAction.h:
3946         (WebKit::InjectedBundleNavigationAction::clickLocationInRootViewCoordinates):
3947         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
3948         (WebKit::WebChromeClient::createWindow):
3949         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
3950         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNewWindowAction):
3951         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
3952
3953 2017-07-03  Brian Burg  <bburg@apple.com>
3954
3955         Web Replay: remove some unused code
3956         https://bugs.webkit.org/show_bug.cgi?id=173903
3957
3958         Rubber-stamped by Joseph Pecoraro.
3959
3960         * Configurations/FeatureDefines.xcconfig:
3961         * WebProcess/WebPage/WebPage.cpp:
3962         (WebKit::WebPage::tryClose):
3963         (WebKit::WebPage::loadRequest):
3964         (WebKit::WebPage::stopLoadingFrame):
3965         (WebKit::WebPage::stopLoading):
3966         (WebKit::WebPage::reload):
3967         (WebKit::WebPage::contextMenuAtPointInWindow):
3968         (WebKit::handleContextMenuEvent):
3969         (WebKit::handleMouseEvent):
3970         (WebKit::handleWheelEvent):
3971         (WebKit::handleKeyEvent):
3972         (WebKit::WebPage::scroll):
3973         (WebKit::WebPage::logicalScroll):
3974
3975 2017-07-10  Chris Dumez  <cdumez@apple.com>
3976
3977         Further WebResourceLoadStatisticsStore / ResourceLoadStatisticsStore clean up
3978         https://bugs.webkit.org/show_bug.cgi?id=174301
3979
3980         Reviewed by Brent Fulgham.
3981
3982         General clean up and various simplifications / optimizations to WebResourceLoadStatisticsStore
3983         and ResourceLoadStatisticsStore classes.
3984
3985         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
3986         (-[WKWebsiteDataStore _resourceLoadStatisticsUpdateCookiePartitioning]):
3987         (-[WKWebsiteDataStore _resourceLoadStatisticsSetShouldPartitionCookies:forHost:]):
3988         * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
3989         * UIProcess/Storage/ResourceLoadStatisticsStore.cpp:
3990         (WebKit::ResourceLoadStatisticsStore::create):
3991         (WebKit::ResourceLoadStatisticsStore::ResourceLoadStatisticsStore):
3992         (WebKit::ResourceLoadStatisticsStore::hasHadRecentUserInteraction):
3993         (WebKit::ResourceLoadStatisticsStore::createEncoderFromData):
3994         (WebKit::ResourceLoadStatisticsStore::populateFromDecoder):
3995         (WebKit::ResourceLoadStatisticsStore::clearInMemory):
3996         (WebKit::ResourceLoadStatisticsStore::mergeStatistics):
3997         (WebKit::ResourceLoadStatisticsStore::updateCookiePartitioning):
3998         (WebKit::ResourceLoadStatisticsStore::updateCookiePartitioningForDomains):
3999         (WebKit::ResourceLoadStatisticsStore::processStatistics):
4000         (WebKit::ResourceLoadStatisticsStore::hasHadUnexpiredRecentUserInteraction):
4001         (WebKit::ResourceLoadStatisticsStore::topPrivatelyControlledDomainsToRemoveWebsiteDataFor):
4002         * UIProcess/Storage/ResourceLoadStatisticsStore.h:
4003         * UIProcess/WebResourceLoadStatisticsStore.cpp:
4004         (WebKit::WebResourceLoadStatisticsStore::WebResourceLoadStatisticsStore):<