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