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