Speculative disk cache resource revalidations are sometimes wasted
[WebKit-https.git] / Source / WebKit2 / ChangeLog
1 2016-03-09  Chris Dumez  <cdumez@apple.com>
2
3         Speculative disk cache resource revalidations are sometimes wasted
4         https://bugs.webkit.org/show_bug.cgi?id=155187
5         <rdar://problem/25032905>
6
7         Reviewed by Antti Koivisto.
8
9         Speculative disk cache resource revalidations were sometimes wasted.
10
11         We would sometimes correctly revalidate a resource but the
12         NetworkResourceLoader then either:
13         1. Fail to reuse the speculatively validated entry
14         2. Reuse the speculatively validated entry but then validate it again
15
16         Bug 1 was caused by the revalidated entry key sometimes being
17         different from the cached entry key. This could happen when
18         revalidation fails (the server did not send back a 304) in
19         which case we call NetworkCache::store() which creates a new
20         cache Entry, generating a cache key from our revalidation
21         request. If the original request has a cache partition or a
22         range, then the keys would not match because we did not set
23         the cache partition or the range on the revalidation request.
24         This has been addressed by setting the cache partition on the
25         revalidation request in constructRevalidationRequest() and by
26         not doing revalidation if the original request had a 'range'
27         header.
28
29         Bug 2 was caused by us marking a speculatively revalidated entry
30         as "not needing revalidating" only in Cache::update(). Cache::update()
31         is only called in the case the revalidation was successful (server
32         returned a 304). If revalidation was not successful, Cache::store()
33         would be called instead was we would fail to update the
34         needsRevalidation flag. NetworkResourceLoader would then validate
35         again the resource that was already speculatively revalidated.
36         To address the problem, we now update the 'needsRevalidation' flag
37         as soon as the speculative revalidation completes, in
38         SpeculativeLoad::didComplete().
39
40         * NetworkProcess/cache/NetworkCache.cpp:
41         (WebKit::NetworkCache::Cache::retrieve):
42         (WebKit::NetworkCache::makeCacheKey):
43         (WebKit::NetworkCache::Cache::update):
44         * NetworkProcess/cache/NetworkCacheEntry.cpp:
45         (WebKit::NetworkCache::Entry::setNeedsValidation):
46         * NetworkProcess/cache/NetworkCacheEntry.h:
47         * NetworkProcess/cache/NetworkCacheKey.cpp:
48         (WebKit::NetworkCache::noPartitionString):
49         (WebKit::NetworkCache::Key::Key):
50         (WebKit::NetworkCache::Key::hasPartition):
51         * NetworkProcess/cache/NetworkCacheKey.h:
52         * NetworkProcess/cache/NetworkCacheSpeculativeLoad.cpp:
53         (WebKit::NetworkCache::SpeculativeLoad::didComplete):
54         * NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp:
55         (WebKit::NetworkCache::constructRevalidationRequest):
56         (WebKit::NetworkCache::SpeculativeLoadManager::retrieveEntryFromStorage):
57         (WebKit::NetworkCache::SpeculativeLoadManager::revalidateEntry):
58
59 2016-03-09  Brent Fulgham  <bfulgham@apple.com>
60
61         Local HTML should be blocked from localStorage access unless "Disable Local File Restrictions" is checked
62         https://bugs.webkit.org/show_bug.cgi?id=155185
63
64         Reviewed by Anders Carlsson.
65         <rdar://problem/11101440>
66
67         Tested by TestWebKitAPI tests IndexedDB.IndexedDBMultiProcess and IndexedDB.IndexedDBPersistence.
68
69         Allow Cocoa WKWebViewConfiguration access to the 'allowUniversalAccessFromFileURLs' setting.
70
71         * UIProcess/API/Cocoa/WKWebView.mm:
72         (- [WKWebView _initializeWithConfiguration]): Set 'allowUniversalAccessFromFileURLsKey' in
73         page configuration.
74         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
75         (-[WKWebViewConfiguration _allowUniversalAccessFromFileURLs]): Added,
76         (-[WKWebViewConfiguration _setAllowUniversalAccessFromFileURLs:]): Added.
77         * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
78
79 2016-03-09  Enrica Casucci  <enrica@apple.com>
80
81         Add two finger tap on links.
82         https://bugs.webkit.org/show_bug.cgi?id=155205
83         rdar://problem/22937516
84
85         Reviewed by Sam Weinig.
86
87         Adds two finger tap gesture recognizer. When performed
88         on a link, it calls the delegate.
89
90         * Platform/spi/ios/UIKitSPI.h:
91         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
92         * UIProcess/WebPageProxy.h:
93         * UIProcess/ios/WKContentViewInteraction.h:
94         * UIProcess/ios/WKContentViewInteraction.mm:
95         (-[WKContentView setupInteraction]):
96         (-[WKContentView cleanupInteraction]):
97         (-[WKContentView _removeDefaultGestureRecognizers]):
98         (-[WKContentView _addDefaultGestureRecognizers]):
99         (-[WKContentView _twoFingerSingleTapGestureRecognized:]):
100         * UIProcess/ios/WebPageProxyIOS.mm:
101         (WebKit::WebPageProxy::handleTwoFingerTapAtPoint):
102         * WebProcess/WebPage/WebPage.h:
103         * WebProcess/WebPage/WebPage.messages.in:
104         * WebProcess/WebPage/ios/WebPageIOS.mm:
105         (WebKit::WebPage::handleTwoFingerTapAtPoint):
106
107 2016-03-09  Alex Christensen  <achristensen@webkit.org>
108
109         Always call NSURLSession completion handlers
110         https://bugs.webkit.org/show_bug.cgi?id=155137
111
112         Reviewed by Darin Adler.
113
114         There are some edge cases which should not be hit, but if they are they would cause the
115         network process to hang and network resources to be leaked.  This can be avoided.
116         There are also a few release asserts that do not need to crash release builds.
117
118         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
119         (WebKit::NetworkDataTask::NetworkDataTask):
120         (WebKit::NetworkDataTask::didReceiveChallenge):
121         (WebKit::NetworkDataTask::didCompleteWithError):
122         (WebKit::NetworkDataTask::didReceiveResponse):
123         (WebKit::NetworkDataTask::didReceiveData):
124         (WebKit::NetworkDataTask::willPerformHTTPRedirection):
125         (WebKit::NetworkDataTask::scheduleFailure):
126         (WebKit::NetworkDataTask::tryPasswordBasedAuthentication):
127         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
128         (-[WKNetworkSessionDelegate URLSession:task:willPerformHTTPRedirection:newRequest:completionHandler:]):
129         (-[WKNetworkSessionDelegate URLSession:task:didReceiveChallenge:completionHandler:]):
130         (-[WKNetworkSessionDelegate URLSession:dataTask:didReceiveResponse:completionHandler:]):
131
132 2016-03-08  Sam Weinig  <sam@webkit.org>
133
134         Roll r197632 back in now that the bots have caught up.
135
136         * UIProcess/ios/WKContentViewInteraction.mm:
137         (-[WKContentView textInputTraits]):
138
139 2016-03-08  Oliver Hunt  <oliver@apple.com>
140
141         Start moving to separated writable and executable mappings in the JIT
142         https://bugs.webkit.org/show_bug.cgi?id=155178
143
144         Reviewed by Fil Pizlo.
145
146         Update feature defines.
147
148         * Configurations/FeatureDefines.xcconfig:
149
150 2016-03-08  Brent Fulgham  <bfulgham@apple.com>
151
152         [WK2][Mac] Allow processes to set "fast-dev-casheable" bit in Network Process
153         https://bugs.webkit.org/show_bug.cgi?id=155189
154         <rdar://problem/25042678>
155
156         Reviewed by Alexey Proskuryakov.
157
158         Update the NetworkProcess sandbox profiles with a declaration that using the
159         system-fctl to touch the "hot file" flag (to support caching operations)
160         is allowed. I should have done this in Bug 154503, but did not.
161
162         * NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in: Add sandbox permission.
163
164 2016-03-08  Commit Queue  <commit-queue@webkit.org>
165
166         Unreviewed, rolling out r197793 and r197799.
167         https://bugs.webkit.org/show_bug.cgi?id=155195
168
169         something weird happened while landing this and everything
170         broke (Requested by olliej on #webkit).
171
172         Reverted changesets:
173
174         "Start moving to separated writable and executable mappings in
175         the JIT"
176         https://bugs.webkit.org/show_bug.cgi?id=155178
177         http://trac.webkit.org/changeset/197793
178
179         "arm64 build fix after r197793."
180         http://trac.webkit.org/changeset/197799
181
182 2016-03-08  Brent Fulgham  <bfulgham@apple.com>
183
184         [WK2] Grant explicit read access to ManagedPreferences
185         https://bugs.webkit.org/show_bug.cgi?id=155173
186         <rdar://problem/24910550>
187
188         Reviewed by Alexey Proskuryakov.
189
190         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: Add new
191         read permission.
192
193 2016-03-08  Anders Carlsson  <andersca@apple.com>
194
195         Ignore deprecation warnings.
196
197         * Shared/mac/ChildProcessMac.mm:
198         (WebKit::ChildProcess::stopNSAppRunLoop):
199         * Shared/mac/WebEventFactory.mm:
200         (WebKit::mouseButtonForEvent):
201         (WebKit::mouseEventTypeForEvent):
202         (WebKit::clickCountForEvent):
203         (WebKit::globalPointForEvent):
204         (WebKit::pointForEvent):
205         (WebKit::textFromEvent):
206         (WebKit::unmodifiedTextFromEvent):
207         (WebKit::isKeypadEvent):
208         (WebKit::isKeyUpEvent):
209         (WebKit::modifiersForEvent):
210         (WebKit::WebEventFactory::createWebKeyboardEvent):
211         * UIProcess/API/Cocoa/WKNavigationAction.mm:
212         (toNSEventModifierFlags):
213         * UIProcess/Cocoa/WebViewImpl.mm:
214         (WebKit::WebViewImpl::becomeFirstResponder):
215         (WebKit::WebViewImpl::updateContentInsetsIfAutomatic):
216         (WebKit::WebViewImpl::viewDidMoveToWindow):
217         (WebKit::WebViewImpl::postFakeMouseMovedEventForFlagsChangedEvent):
218         (WebKit::WebViewImpl::createFullScreenWindow):
219         (WebKit::WebViewImpl::sendToolTipMouseExited):
220         (WebKit::WebViewImpl::sendToolTipMouseEntered):
221         (WebKit::applicationFlagsForDrag):
222         (WebKit::WebViewImpl::setLastMouseDownEvent):
223         (WebKit::WebViewImpl::doneWithKeyEvent):
224         (WebKit::WebViewImpl::collectKeyboardLayoutCommandsForEvent):
225         (WebKit::WebViewImpl::performKeyEquivalent):
226         * UIProcess/Plugins/mac/PluginProcessProxyMac.mm:
227         (WebKit::PluginProcessProxy::beginModal):
228         * UIProcess/mac/WebContextMenuProxyMac.mm:
229         (WebKit::WebContextMenuProxyMac::showContextMenu):
230         * UIProcess/mac/WebInspectorProxyMac.mm:
231         (WebKit::WebInspectorProxy::platformCanAttach):
232         * UIProcess/mac/WebPopupMenuProxyMac.mm:
233         (WebKit::WebPopupMenuProxyMac::populate):
234         (WebKit::WebPopupMenuProxyMac::showPopupMenu):
235         * WebProcess/Plugins/PDF/DeprecatedPDFPlugin.mm:
236         (WebKit::modifierFlagsFromWebEvent):
237         (WebKit::getEventTypeFromWebEvent):
238         * WebProcess/Plugins/PDF/PDFPluginTextAnnotation.mm:
239         (WebKit::cssAlignmentValueForNSTextAlignment):
240         * WebProcess/WebCoreSupport/mac/WebDragClientMac.mm:
241         (WebKit::convertImageToBitmap):
242
243 2016-03-08  Oliver Hunt  <oliver@apple.com>
244
245         Start moving to separated writable and executable mappings in the JIT
246         https://bugs.webkit.org/show_bug.cgi?id=155178
247
248         Reviewed by Filip Pizlo.
249
250         Update feature defines.
251
252         * Configurations/FeatureDefines.xcconfig:
253
254 2016-03-08  Commit Queue  <commit-queue@webkit.org>
255
256         Unreviewed, rolling out r197766.
257         https://bugs.webkit.org/show_bug.cgi?id=155183
258
259         Has platform-specific code in non-platform files (Requested by
260         smfr on #webkit).
261
262         Reverted changeset:
263
264         "AX: Force allow user zoom"
265         https://bugs.webkit.org/show_bug.cgi?id=155056
266         http://trac.webkit.org/changeset/197766
267
268 2016-03-04  Ada Chan  <adachan@apple.com>
269
270         Fix lifetime issues regarding WebVideoFullscreenInterfaceMac
271         https://bugs.webkit.org/show_bug.cgi?id=155130
272
273         Reviewed by Beth Dakin.
274
275         Now that both fullscreen and video controls manager rely on WebVideoFullscreenInterface,
276         we now keep track of a "client count" for each context ID so we'll only remove it
277         from the context map after all the "clients" are done with it.
278
279         Before this change, every time WebVideoFullscreenManager::setUpVideoControlsManager()
280         is called, the existing interface is cleared and a new one is created even when there's
281         an existing interface for that. With this change, we reuse the existing interface for
282         the video element.
283
284         * UIProcess/Cocoa/WebVideoFullscreenManagerProxy.h:
285         * UIProcess/Cocoa/WebVideoFullscreenManagerProxy.mm:
286         (WebKit::WebVideoFullscreenManagerProxy::invalidate):
287         Also clear out m_clientCounts.
288         (WebKit::WebVideoFullscreenManagerProxy::addClientForContext):
289         If the context ID is not in m_clientCounts yet, add the count of 1 to
290         that table for that ID. Otherwise, increment the count by 1.
291         (WebKit::WebVideoFullscreenManagerProxy::removeClientForContext):
292         Assert that we have added this context id to m_clientCounts before.
293         Decrement the count. If it reaches 0, remove this context ID from both
294         m_clientCounts and m_contextMap.
295         (WebKit::WebVideoFullscreenManagerProxy::setupFullscreenWithID):
296         We have started a new fullscreen session using this interface. Call
297         addClientForContext() to update the client count.
298         (WebKit::WebVideoFullscreenManagerProxy::setUpVideoControlsManagerWithID):
299         If the current controls manager set up has the same context ID as the one
300         passed in, we don't have to do anything. Otherwise, if we have set up
301         the video controls manager with a different ID before, call removeClientForContext()
302         on the old ID to decrement its client count. Set m_controlsManagerContextId
303         to the new value and call addClientForContext() with it.
304         (WebKit::WebVideoFullscreenManagerProxy::didCleanupFullscreen):
305         Instead of removing the mapping from m_contextMap directly, reset the fullscreen
306         mode on the interface and call removeClientForContext(), which removes the mapping
307         only if there's no more client using the interface.
308         * WebProcess/cocoa/WebVideoFullscreenManager.h:
309         * WebProcess/cocoa/WebVideoFullscreenManager.mm:
310         (WebKit::WebVideoFullscreenManager::~WebVideoFullscreenManager):
311         Clear m_clientCounts.
312         (WebKit::WebVideoFullscreenManager::removeContext):
313         Add a helper method for removing the context.
314         (WebKit::WebVideoFullscreenManager::addClientForContext):
315         If the context ID is not in m_clientCounts yet, add the count of 1 to
316         that table for that ID. Otherwise, increment the count by 1.
317         (WebKit::WebVideoFullscreenManager::removeClientForContext):
318         Assert that we have added this context id to m_clientCounts before.
319         Decrement the count. If it reaches 0, remove this context ID from
320         m_clientCounts and call removeContext() to clean up this context.
321         (WebKit::WebVideoFullscreenManager::enterVideoFullscreenForVideoElement):
322         We have started a new fullscreen session using this interface. Call
323         addClientForContext() to update the client count. Create a layer hosting
324         context if it's not there.
325         (WebKit::WebVideoFullscreenManager::setUpVideoControlsManager):
326         If we have set up a context for this video element before, see if it's
327         the one we are currently managing video controls for. If it is, return early.
328         Otherwise, call removeClientForContext() on the previous m_controlsManagerContextId
329         and update m_controlsManagerContextId to the context ID of this video element.
330         If there's no context created for this video element yet, set one up.
331         Send a SetUpVideoControlsManagerWithID message to the proxy object in the UI process
332         so it'll update its controls manager context ID. Also, conditionalize all of this
333         under PLATFORM(MAC) to be consistent with WebVideoFullscreenManagerProxy.
334         (WebKit::WebVideoFullscreenManager::didCleanupFullscreen):
335         Just reset the fullscreen mode on the interface and call removeClientForContext() which
336         only cleans up the context if there's no more client using it.
337
338 2016-03-08  Timothy Hatcher  <timothy@apple.com>
339
340         Web Inspector: Add automation protocol methods for navigation
341
342         https://bugs.webkit.org/show_bug.cgi?id=155163
343         rdar://problem/25029054
344
345         Reviewed by Darin Adler.
346
347         * UIProcess/Automation/Automation.json:
348         * UIProcess/Automation/WebAutomationSession.cpp:
349         (WebKit::WebAutomationSession::getBrowsingContexts): Set url.
350         (WebKit::WebAutomationSession::getBrowsingContext): Added.
351         (WebKit::WebAutomationSession::navigateBrowsingContext): Added.
352         (WebKit::WebAutomationSession::goBackInBrowsingContext): Added.
353         (WebKit::WebAutomationSession::goForwardInBrowsingContext): Added.
354         (WebKit::WebAutomationSession::reloadBrowsingContext): Added.
355         * UIProcess/Automation/WebAutomationSession.h:
356
357 2016-03-08  Nan Wang  <n_wang@apple.com>
358
359         AX: Force allow user zoom
360         https://bugs.webkit.org/show_bug.cgi?id=155056
361
362         Reviewed by Chris Fleizach.
363
364         Soft linked libAccessibility library so that we can observe the accessibility
365         setting change for the force always user scalable feature.
366
367         * WebProcess/WebPage/WebPage.cpp:
368         (WebKit::forceAlwaysUserScalableChangedCallback):
369         (WebKit::WebPage::create):
370         (WebKit::m_shouldDispatchFakeMouseMoveEvents):
371         (WebKit::WebPage::~WebPage):
372         (WebKit::WebPage::preferencesDidChange):
373         (WebKit::WebPage::updateForceAlwaysUserScalable):
374         (WebKit::WebPage::updatePreferences):
375         * WebProcess/WebPage/WebPage.h:
376
377 2016-03-08  Csaba Osztrogonác  <ossy@webkit.org>
378
379         One more unreviewed speculative buildfix after r197728.
380
381         * NetworkProcess/NetworkResourceLoader.cpp:
382         (WebKit::NetworkResourceLoader::didFinishLoading):
383         (WebKit::NetworkResourceLoader::continueWillSendRequest):
384
385 2016-03-08  Csaba Osztrogonác  <ossy@webkit.org>
386
387         Unreviewed speculative buildfix after r197728.
388
389         * WebProcess/Network/WebLoaderStrategy.cpp:
390         (WebKit::WebLoaderStrategy::scheduleLoad):
391
392 2016-03-08  Timothy Hatcher  <timothy@apple.com>
393
394         Web Inspector: Make WebAutomationSession::closeBrowsingContext work as expected
395
396         https://bugs.webkit.org/show_bug.cgi?id=155162
397         rdar://problem/25027191
398
399         Reviewed by Brian Burg.
400
401         * UIProcess/Automation/WebAutomationSession.cpp:
402         (WebKit::WebAutomationSession::closeBrowsingContext):
403         Call closePage, the same method ultimately used by window.close().
404
405         * UIProcess/WebPageProxy.h: Make closePage public.
406
407 2016-03-07  Carlos Garcia Campos  <cgarcia@igalia.com>
408
409         REGRESSION(r197062): [GTK] Transparent backgrounds no longer work after r197062
410         https://bugs.webkit.org/show_bug.cgi?id=155119
411
412         Reviewed by Martin Robinson.
413
414         This is because after r197062 we are now realizing the view too
415         early, even before the toplevel window has been realized, forcing
416         the toplevel window to be realized. If the RGBA visual is set on
417         the window after it has been realzied it doesn't have any
418         effect. We should wait until the toplevel window is realized to
419         realize the web view, giving time to the application to set RGBA
420         visual and background color. If the toplevel window is already
421         realized we realize the web view immediately, so that this doesn't
422         affect the tearing problems fixed in r197062.
423
424         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
425         (toplevelWindowRealized):
426         (webkitWebViewBaseSetToplevelOnScreenWindow):
427
428 2016-03-07  Keith Rollin  <krollin@apple.com>
429
430         Enhance logging: Use "always on" macros
431         https://bugs.webkit.org/show_bug.cgi?id=154499
432         <rdar://problem/24757730>
433
434         Reviewed by Chris Dumez.
435
436         Make use of new logging macros by reporting on frame and resource
437         load activity.
438
439         Connection updated to report IPC errors, helping us identify when
440         messaging between processes breaks down.
441
442         ChildProcess updated to log if it is terminating early. Some
443         sysdiagnose logging from customers indicate that this is happening in
444         the wild.
445
446         * NetworkProcess/NetworkResourceLoader.cpp:
447         (WebKit::NetworkResourceLoader::startNetworkLoad):
448         (WebKit::NetworkResourceLoader::didFinishLoading):
449         (WebKit::NetworkResourceLoader::didFailLoading):
450         (WebKit::NetworkResourceLoader::continueWillSendRequest):
451         (WebKit::NetworkResourceLoader::isAlwaysOnLoggingAllowed):
452         * NetworkProcess/NetworkResourceLoader.h:
453         * Platform/IPC/Connection.cpp:
454         (IPC::Connection::waitForSyncReply):
455         * Shared/ChildProcess.cpp:
456         (WebKit::didCloseOnConnectionWorkQueue):
457         * WebProcess/Network/WebLoaderStrategy.cpp:
458         (WebKit::WebLoaderStrategy::scheduleLoad):
459         * WebProcess/Network/WebResourceLoader.cpp:
460         (WebKit::WebResourceLoader::willSendRequest):
461         (WebKit::WebResourceLoader::didReceiveResponse):
462         (WebKit::WebResourceLoader::didReceiveData):
463         (WebKit::WebResourceLoader::didFinishResourceLoad):
464         (WebKit::WebResourceLoader::didFailResourceLoad):
465         (WebKit::WebResourceLoader::didReceiveResource):
466         (WebKit::WebResourceLoader::isAlwaysOnLoggingAllowed):
467         * WebProcess/Network/WebResourceLoader.h:
468
469 2016-03-07  Brent Fulgham  <bfulgham@apple.com>
470
471         Reduce startup and shutdown cost of resource load statistics
472         https://bugs.webkit.org/show_bug.cgi?id=155120
473         <rdar://problem/25010167>
474
475         Reviewed by Andy Estes.
476
477         Use a dedicated WorkQueue to process resource load statistics data. Allow
478         processing to load (and save) previously stored statistics asynchronously so
479         that it does not delay startup.
480         
481         Now that we have a more rational storage situation, get rid of the 'writeToDisk'
482         method since it is no longer needed in the WK2 layer.
483
484         Move all of the Resource Load Statistics file handling code from WebCore to this
485         API layer.
486
487         * UIProcess/WebResourceLoadStatisticsStore.cpp:
488         (WebKit::WebResourceLoadStatisticsStore::WebResourceLoadStatisticsStore): Initialize
489         member variable with storage path, rather than passing to WebCore code.
490         (WebKit::WebResourceLoadStatisticsStore::resourceLoadStatisticsUpdated): Revised to
491         use the new WorkQueue code.
492         (WebKit::WebResourceLoadStatisticsStore::setResourceLoadStatisticsEnabled): When
493         activating the feature, purge any old statistics before loading from disk.
494         (WebKit::WebResourceLoadStatisticsStore::readDataFromDiskIfNeeded): Added.
495         (WebKit::WebResourceLoadStatisticsStore::processWillOpenConnection): Added.
496         (WebKit::WebResourceLoadStatisticsStore::processDidCloseConnection): Added.
497         (WebKit::WebResourceLoadStatisticsStore::applicationWillTerminate): Make sure all
498         of the WorkQueue tasks are done before terminating.
499         (WebKit::WebResourceLoadStatisticsStore::persistentStoragePath): Moved from WebCore.
500         (WebKit::WebResourceLoadStatisticsStore::writeEncoderToDisk): Ditto.
501         (WebKit::WebResourceLoadStatisticsStore::createDecoderFromDisk): Ditto.
502         (WebKit::WebResourceLoadStatisticsStore::writeToDisk): Deleted.
503         * UIProcess/WebResourceLoadStatisticsStore.h:
504         (WebKit::WebResourceLoadStatisticsStore::coreStore):
505         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
506         (WebKit::WebsiteDataStore::webProcessWillOpenConnection): Call new WebResourceLoadStatisticsStore code.
507         (WebKit::WebsiteDataStore::webProcessDidCloseConnection): Ditto.
508
509 2016-03-07  Alex Christensen  <achristensen@webkit.org>
510
511         Fix cookies with private browsing and NetworkSession
512         https://bugs.webkit.org/show_bug.cgi?id=155147
513         rdar://problem/25018279
514
515         Reviewed by Brady Eidson.
516
517         In the NetworkSession constructor, we look for a NetworkStorageSession in the SessionTracker
518         and use that NetworkStorageSession's CFHTTPCookieStorageRef in the NSURLSessionConfiguration.
519         NetworkStorageSessions were being set in SessionTracker's storageSessionMap after NetworkSessions
520         were created, causing the NSHTTPCookieStorage of the NSURLSession to be different from the
521         CFHTTPCookieStorageRef used by document.cookie in newly created private browsing sessions.
522         This fixes that problem by passing the NetworkStorageSession as a constructor parameter to the
523         NetworkSession so it can use the correct CFHTTPCookieStorageRef in its NSURLSessionConfiguration
524         before it is in the storageSessionMap.
525
526         * NetworkProcess/NetworkSession.h:
527         (WebKit::NetworkSession::sessionID):
528         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
529         (WebKit::NetworkSession::defaultSession):
530         (WebKit::NetworkSession::NetworkSession):
531         * NetworkProcess/mac/RemoteNetworkingContext.mm:
532         (WebKit::RemoteNetworkingContext::ensurePrivateBrowsingSession):
533         * WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.mm:
534         (WebKit::WebFrameNetworkingContext::ensurePrivateBrowsingSession):
535
536 2016-03-07  Brent Fulgham  <bfulgham@apple.com>
537
538         Correct bug in resource load statistics debug flag for legacy clients
539         https://bugs.webkit.org/show_bug.cgi?id=155118
540         <rdar://problem/25020088>
541
542         Reviewed by Andy Estes.
543
544         Some clients launch WebKit2 using the "legacy" configuration for the website data store.
545         The Resource Load Statistics code was not added to this type of configuration, which
546         prevents various WebKit2 clients from using this code.
547
548         * UIProcess/WebProcessPool.cpp:
549         (WebKit::legacyWebsiteDataStoreConfiguration): Tell the legacy initializer where to
550         find the resource load statistics data.
551
552 2016-03-07  Daniel Bates  <dabates@apple.com>
553
554         Cleanup: Add convenience function URL::procotolIsBlob()
555         https://bugs.webkit.org/show_bug.cgi?id=155127
556         <rdar://problem/25016829>
557
558         Reviewed by Brent Fulgham.
559
560         * NetworkProcess/NetworkLoad.cpp:
561         (WebKit::NetworkLoad::NetworkLoad): Modified to use URL::protocolIsBlob().
562         * NetworkProcess/NetworkResourceLoader.cpp:
563         (WebKit::NetworkResourceLoader::NetworkResourceLoader): Ditto.
564         * WebProcess/WebPage/WebPage.cpp:
565         (WebKit::WebPage::canHandleRequest): Ditto.
566
567 2016-03-07  Simon Fraser  <simon.fraser@apple.com>
568
569         Use CGColorSpaceCopyICCData instead of CGColorSpaceCopyICCProfile
570         https://bugs.webkit.org/show_bug.cgi?id=155123
571         rdar://problem/24990256
572
573         Reviewed by Tim Horton.
574         
575         On newer OSes, use CGColorSpaceCopyICCData().
576
577         * Shared/mac/ColorSpaceData.mm:
578         (WebKit::ColorSpaceData::encode):
579
580 2016-03-07  Gavin Barraclough  <barraclough@apple.com>
581
582         Last opened tab does not receive SetHiddenPageTimerThrottlingIncreaseLimit message
583         https://bugs.webkit.org/show_bug.cgi?id=155126
584
585         Reviewed by Chris Dumez.
586
587         WebPageProxy will increment the hidden page throttling counter from within its constructor,
588         which currently causes the WebProcessPool to try to synchronously message all processes.
589         The web page triggering the increment then fails to receive the message, since it was
590         still being constructed. Make the update of the limit async, such that the page is fully
591         constructed before the WebProcessPool processes the update.
592
593         * UIProcess/WebProcessPool.cpp:
594         (WebKit::m_hiddenPageThrottlingAutoIncreasesCounter):
595             - This now schedules a zero-delay timer to handle the update.
596         (WebKit::m_hiddenPageThrottlingTimer):
597             - This is now responsible for calling updateHiddenPageThrottlingAutoIncreaseLimit.
598         * UIProcess/WebProcessPool.h:
599             - Added m_hiddenPageThrottlingTimer.
600
601 2016-03-05  Enrica Casucci  <enrica@apple.com>
602
603         Support preview on attachment elements.
604         https://bugs.webkit.org/show_bug.cgi?id=155074
605         rdar://problem/24806079
606
607         Reviewed by Sam Weinig.
608
609         Allowing preview to start on attachment elements.
610         Adding a private UIDelegate method to provide the data for the preview.
611
612         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
613         * UIProcess/ios/WKContentViewInteraction.mm:
614         (-[WKContentView _interactionShouldBeginFromPreviewItemController:forPosition:]):
615         (-[WKContentView _dataForPreviewItemController:atPosition:type:]):
616
617 2016-03-06  Andreas Kling  <akling@apple.com>
618
619         Reduce page cache capacity from 3 to 2.
620         <https://webkit.org/b/155087>
621
622         Reviewed by Antti Koivisto.
623
624         It's extremely rare that users go back more than 2 pages in the page cache,
625         and nowadays the network cache makes even un-cached pages fast to reload.
626
627         Trimming the page cache from 3 to 2 entries has a very nice effect on heap
628         fragmentation. I'm seeing a ~5% progression on the iPad PLUM test locally;
629         average memory usage across 300 loads goes from ~121MB to ~114MB.
630
631         * Shared/CacheModel.cpp:
632         (WebKit::calculateCacheSizes):
633
634 2016-03-05  Sam Weinig  <sam@webkit.org>
635
636         Revert usage of autofill field name for use with UITextInputTraits
637         until our bots can catch up.
638
639         * UIProcess/ios/WKContentViewInteraction.mm:
640         (-[WKContentView textInputTraits]):
641
642 2016-03-05  Chris Dumez  <cdumez@apple.com>
643
644         Consolidate RuntimeApplicationChecks and RuntimeApplicationChecksIOS
645         https://bugs.webkit.org/show_bug.cgi?id=155035
646
647         Reviewed by Darin Adler.
648
649         Update runtime application checks.
650
651         * UIProcess/API/Cocoa/APIWebsiteDataStoreCocoa.mm:
652         (API::WebsiteDataStore::defaultApplicationCacheDirectory):
653         * UIProcess/Cocoa/VersionChecks.mm:
654         (WebKit::linkedOnOrAfter):
655         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
656         (WebKit::WebProcessPool::platformInitializeWebProcess):
657         (WebKit::WebProcessPool::legacyPlatformDefaultApplicationCacheDirectory):
658         * UIProcess/ios/WKContentViewInteraction.mm:
659         * UIProcess/mac/WebPageProxyMac.mm:
660         (WebKit::expectsLegacyImplicitRubberBandControl):
661         (WebKit::WebPageProxy::appleMailPaginationQuirkEnabled):
662
663 2016-03-05  Sam Weinig  <sam@webkit.org>
664
665         Add support for processing the autofill field name out of form control elements ultimately to aid input methods
666         <rdar://problem/23041180>
667         https://bugs.webkit.org/show_bug.cgi?id=155079
668
669         Reviewed by Enrica Casucci.
670
671         * Shared/AssistedNodeInformation.cpp:
672         (WebKit::AssistedNodeInformation::encode):
673         (WebKit::AssistedNodeInformation::decode):
674         * Shared/AssistedNodeInformation.h:
675         Add AutofillFieldName. Convert some coders to use encodeEnum/decodeEnum instead of casting.
676
677         * UIProcess/ios/WKContentViewInteraction.mm:
678         (-[WKContentView textInputTraits]):
679         Map AutofillFieldNames to the associated UITextContentTypes.
680
681         * WebProcess/WebPage/ios/WebPageIOS.mm:
682         (WebKit::WebPage::getAssistedNodeInformation):
683         Extract the AutofillFieldNames onto the AssistedNodeInformation for <input> elements 
684         and <textarea> elements.
685
686 2016-03-05  Timothy Hatcher  <timothy@apple.com>
687
688         Implement the Automation protocol commands by tracking WebPageProxy objects
689         that are controlled by automation and assigning them a UUID handle.
690
691         https://bugs.webkit.org/show_bug.cgi?id=154953
692         rdar://problem/24947489
693
694         Reviewed by Brian Burg.
695
696         * UIProcess/API/APIAutomationSessionClient.h:
697         (API::AutomationSessionClient::didRequestNewWindow):
698         Return a WebPageProxy instead of void so it can be assigned a UUID handle.
699
700         * UIProcess/API/Cocoa/_WKAutomationSessionDelegate.h:
701         Return a WKPageRef from _automationSessionDidRequestNewWindow:.
702
703         * UIProcess/Automation/WebAutomationSession.cpp:
704         (WebKit::WebAutomationSession::webPageProxyForHandle):
705         (WebKit::WebAutomationSession::handleForWebPageProxy):
706         (WebKit::WebAutomationSession::getBrowsingContexts):
707         (WebKit::WebAutomationSession::createBrowsingContext):
708         (WebKit::WebAutomationSession::closeBrowsingContext):
709         (WebKit::WebAutomationSession::switchToBrowsingContext):
710
711         * UIProcess/Automation/WebAutomationSession.h:
712         Added new methods and maps to track pages and handles.
713
714         * UIProcess/Cocoa/AutomationSessionClient.h:
715         * UIProcess/Cocoa/AutomationSessionClient.mm:
716         (WebKit::AutomationSessionClient::didRequestNewWindow):
717         Return a WebPageProxy from the WKPageRef.
718
719         * UIProcess/WebPageProxy.h: Make setFocus public.
720
721         * UIProcess/WebProcessPool.cpp:
722         (WebKit::WebProcessPool::setAutomationSession):
723         Set the WebProcessPool on the WebAutomationSession so it can be used to find
724         WebPageProxy objects controlled by automation.
725
726 2016-03-05  Timothy Hatcher  <timothy@apple.com>
727
728         Rename Automation protocol methods to use "BrowsingContext" instead of "Window".
729         Also flesh out the protocol commands more by adding switchToBrowsingContext
730         and return a BrowsingContextHandle for createBrowsingContext.
731
732         https://bugs.webkit.org/show_bug.cgi?id=154953
733         rdar://problem/24947489
734
735         Reviewed by Brian Burg.
736
737         * UIProcess/Automation/Automation.json:
738         * UIProcess/Automation/WebAutomationSession.cpp:
739         (WebKit::WebAutomationSession::getBrowsingContexts):
740         (WebKit::WebAutomationSession::createBrowsingContext):
741         (WebKit::WebAutomationSession::closeBrowsingContext):
742         (WebKit::WebAutomationSession::switchToBrowsingContext):
743         (WebKit::WebAutomationSession::getWindows): Deleted.
744         (WebKit::WebAutomationSession::openWindow): Deleted.
745         (WebKit::WebAutomationSession::closeWindow): Deleted.
746         * UIProcess/Automation/WebAutomationSession.h:
747
748 2016-03-05  Yusuke Suzuki  <utatane.tea@gmail.com>
749
750         [ES6] Support Reflect.construct
751         https://bugs.webkit.org/show_bug.cgi?id=147330
752
753         Reviewed by Saam Barati.
754
755         * WebProcess/Plugins/Netscape/JSNPMethod.cpp:
756         (WebKit::JSNPMethod::getCallData):
757         * WebProcess/Plugins/Netscape/JSNPObject.cpp:
758         (WebKit::JSNPObject::getCallData):
759         (WebKit::JSNPObject::getConstructData):
760         * WebProcess/Plugins/Netscape/NPJSObject.cpp:
761         (WebKit::NPJSObject::hasMethod):
762         (WebKit::NPJSObject::construct):
763         (WebKit::NPJSObject::invoke):
764
765 2016-03-04  Alex Christensen  <achristensen@webkit.org>
766
767         Fix file mime-types when using NetworkSession
768         https://bugs.webkit.org/show_bug.cgi?id=155058
769
770         Reviewed by Andy Estes.
771
772         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
773         (WebKit::NetworkDataTask::NetworkDataTask):
774         Call adjustMIMETypeIfNecessary like we do in connection didReceiveResponse in 
775         WebCoreResourceHandleAsOperationQueueDelegate.mm.
776         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
777         (-[WKNetworkSessionDelegate URLSession:dataTask:didReceiveResponse:completionHandler:]):
778         Don't content sniff file urls.  This check is analogous to ResourceHandle::shouldContentSniffURL.
779
780 2016-03-04  Sam Weinig  <sam@webkit.org>
781
782         [WebKit2] Add WebKit2 equivalent of -[WebView _insertNewlineInQuotedContent]
783         <rdar://problem/24943591>
784         https://bugs.webkit.org/show_bug.cgi?id=155057
785
786         Reviewed by Tim Horton.
787
788         * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
789         (WKBundlePageInsertNewlineInQuotedContent):
790         * WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h:
791         * WebProcess/WebPage/WebPage.cpp:
792         (WebKit::WebPage::insertNewlineInQuotedContent):
793         * WebProcess/WebPage/WebPage.h:
794         Expose WKBundlePageInsertNewlineInQuotedContent as SPI.
795
796 2016-03-04  Brent Fulgham  <bfulgham@apple.com>
797
798         Stub API to support a debug menu option for measuring resource load statistics
799         https://bugs.webkit.org/show_bug.cgi?id=154998
800         <rdar://problem/24944604>
801
802         Reviewed by Andy Estes.
803
804         * UIProcess/API/APIWebsiteDataStore.cpp:
805         (API::WebsiteDataStore::resourceLoadStatisticsEnabled): Added stub.
806         (API::WebsiteDataStore::setResourceLoadStatisticsEnabled): Ditto.
807         * UIProcess/API/APIWebsiteDataStore.h:
808         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
809         (WKWebsiteDataStoreSetResourceLoadStatisticsEnabled): Added method that calls through
810         to the underlying APIWebsiteDataStore class.
811         (WKWebsiteDataStoreGetResourceLoadStatisticsEnabled): Ditto.
812         * UIProcess/API/C/WKWebsiteDataStoreRef.h:
813
814 2016-03-03  Enrica Casucci  <enrica@apple.com>
815
816         Add a mechanism to customize the long press action.
817         https://bugs.webkit.org/show_bug.cgi?id=154995
818         rdar://problem/24823732
819
820         Reviewed by Tim Horton.
821
822         Adding a new private delegate method to allow clients to
823         replace the action sheet displayed for images and links.
824         The change also adds support for attachment elements.
825
826         * Shared/ios/InteractionInformationAtPosition.h:
827         * Shared/ios/InteractionInformationAtPosition.mm:
828         (WebKit::InteractionInformationAtPosition::encode):
829         (WebKit::InteractionInformationAtPosition::decode):
830         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
831         * UIProcess/API/Cocoa/_WKActivatedElementInfo.h:
832         * UIProcess/ios/WKActionSheetAssistant.h:
833         * UIProcess/ios/WKActionSheetAssistant.mm:
834         (-[WKActionSheetAssistant showImageSheet]):
835         (-[WKActionSheetAssistant showLinkSheet]):
836         * UIProcess/ios/WKContentViewInteraction.mm:
837         (-[WKContentView _showImageSheet]):
838         (-[WKContentView _showAttachmentSheet]):
839         (-[WKContentView _showLinkSheet]):
840         (-[WKContentView _actionForLongPress]):
841         (-[WKContentView actionSheetAssistant:shouldIncludeAppLinkActionsForElement:]):
842         (-[WKContentView actionSheetAssistant:showCustomSheetForElement:]):
843         (-[WKContentView actionSheetAssistant:decideActionsForElement:defaultActions:]):
844         * WebProcess/WebPage/ios/WebPageIOS.mm:
845         (WebKit::WebPage::getPositionInformation):
846
847 2016-03-04  Brent Fulgham  <bfulgham@apple.com>
848
849         [WK2] Gather resource load statistics
850         https://bugs.webkit.org/show_bug.cgi?id=154278
851         <rdar://problem/24702892>
852
853         Reviewed by Andy Estes.
854
855         Revise the WebProcess to notify the UIProcess about resource load statistics. These
856         updates are not time-critical, and do not need to be done in concert with the actual
857         load. As resource loads are made, each WebProcess notifies the UIProcess of the new
858         load counts, then clears its local state. These statistics are then aggregated in
859         the UIProcess.
860
861         * CMakeLists.txt: Add new ResourceLoadStatisticsState files to build.
862         * DerivedSources.make: Ditto.
863         * Platform/IPC/ArgumentCoders.h: Update to support HashCountedSets.
864         * PlatformEfl.cmake: Add new ResourceLoadStatisticsState files to build.
865         * PlatformGTK.cmake: Ditto.
866         * PlatformMac.cmake: Ditto.
867         * Shared/API/APIObject.h: Add new ResourceLoadStatistics type.
868         * Shared/WebCoreArgumentCoders.cpp:
869         (IPC::ArgumentCoder<ExceptionDetails>::decode): Support new ResourceLoadStatistics type.
870         (IPC::ArgumentCoder<ResourceLoadStatistics>::encode): Added.
871         (IPC::ArgumentCoder<ResourceLoadStatistics>::decode): Added.
872         * Shared/WebCoreArgumentCoders.h:
873         * Shared/WebProcessCreationParameters.cpp:
874         (WebKit::WebProcessCreationParameters::encode): Handle 'resourceLoadStatisticsEnabled' flag.
875         (WebKit::WebProcessCreationParameters::decode): Ditto.
876         * Shared/WebProcessCreationParameters.h:
877         * UIProcess/API/APIProcessPoolConfiguration.cpp:
878         (API::ProcessPoolConfiguration::ProcessPoolConfiguration): Add storage location for the
879         resource load statistics.
880         (API::ProcessPoolConfiguration::copy): Handle the new storage location and the feature flag.
881         * UIProcess/API/APIProcessPoolConfiguration.h:
882         * UIProcess/API/APIWebsiteDataStore.cpp:
883         (API::WebsiteDataStore::defaultResourceLoadStatisticsDirectory): Added stub.
884         * UIProcess/API/APIWebsiteDataStore.h:
885         * UIProcess/API/Cocoa/APIWebsiteDataStoreCocoa.mm:
886         (API::WebsiteDataStore::defaultResourceLoadStatisticsDirectory): Added.
887         (API::WebsiteDataStore::defaultDataStoreConfiguration): Added support for the new resource
888         load statistics storage location.
889         * UIProcess/API/Cocoa/WKWebView.mm:
890         (-[WKWebView _initializeWithConfiguration:]): Sync Process Pool configuration parameters
891         with the state of our websiteData object's "ResourceLoadStatisticsEnabled" flag, so that
892         new processes are created in the right state.
893         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
894         (-[WKWebsiteDataStore _resourceLoadStatisticsEnabled]): Added.
895         (-[WKWebsiteDataStore _setResourceLoadStatisticsEnabled:]): Added.
896         * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
897         * UIProcess/WebProcessPool.cpp:
898         (WebKit::WebProcessPool::createNewWebProcess): Handle new flag for enabling resource
899         load statistics.
900         * UIProcess/WebResourceLoadStatisticsStore.cpp: Added.
901         (WebKit::WebResourceLoadStatisticsStore::create):
902         (WebKit::WebResourceLoadStatisticsStore::WebResourceLoadStatisticsStore):
903         (WebKit::WebResourceLoadStatisticsStore::~WebResourceLoadStatisticsStore):
904         (WebKit::WebResourceLoadStatisticsStore::resourceLoadStatisticsUpdated):
905         (WebKit::WebResourceLoadStatisticsStore::setResourceLoadStatisticsEnabled):
906         (WebKit::WebResourceLoadStatisticsStore::resourceLoadStatisticsEnabled):
907         (WebKit::WebResourceLoadStatisticsStore::readDataFromDiskIfNeeded):
908         (WebKit::WebResourceLoadStatisticsStore::writeToDisk):
909         (WebKit::WebResourceLoadStatisticsStore::applicationWillTerminate):
910         * UIProcess/WebResourceLoadStatisticsStore.h: Added.
911         (WebKit::WebResourceLoadStatisticsStore::coreStore):
912         * UIProcess/WebResourceLoadStatisticsStore.messages.in: Added.
913         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
914         (WebKit::WebsiteDataStore::platformInitialize): Register a termination handler
915         to close down the resource load statistics store.
916         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
917         (WebKit::WebsiteDataStore::WebsiteDataStore): Initialize the new WebResourceLoadStatisticsStore
918         member.
919         (WebKit::WebsiteDataStore::webProcessWillOpenConnection): Register the WebResourceLoadStatisticsStore
920         object as a work queue message receiver
921         (WebKit::WebsiteDataStore::webProcessDidCloseConnection): Unregister WebResourceLoadStatisticsStore.
922         (WebKit::WebsiteDataStore::resourceLoadStatisticsEnabled): Added.
923         (WebKit::WebsiteDataStore::setResourceLoadStatisticsEnabled): Ditto.
924         * UIProcess/WebsiteData/WebsiteDataStore.h:
925         (WebKit::WebsiteDataStore::resourceLoadStatisticsStore): Added.
926         * WebKit2.xcodeproj/project.pbxproj: Add new ResourceLoadStatisticsState files to build.
927         * WebProcess/WebProcess.cpp:
928         (WebKit::WebProcess::initializeWebProcess): Take into account the new parameter
929         specifying whether resource load statistics are being captured.
930         (WebKit::WebProcess::WebProcess): Initialized statistics changed notification timer.
931         (WebKit::WebProcess::statisticsChangedTimerFired): Added. Send bundles of site load
932         statistics to the UIProcess on a set interval. Clear out local cache after each send.
933         (WebKit::WebProcess::setResourceLoadStatisticsEnabled): Added.
934         * WebProcess/WebProcess.h:
935         * WebProcess/WebProcess.messages.in: Add new SetResourceLoadStatisticsEnabled message.
936
937 2016-03-04  Daniel Bates  <dabates@apple.com>
938
939         Temporarily use bundle identifier as part of user directory suffix
940         https://bugs.webkit.org/show_bug.cgi?id=155042
941         <rdar://problem/24983174>
942
943         Reviewed by Brent Fulgham and Brady Eidson.
944
945         * Shared/mac/ChildProcessMac.mm:
946         (WebKit::ChildProcess::initializeSandbox):
947
948 2016-03-04  Alex Christensen  <achristensen@webkit.org>
949
950         Release build fix after r197572.
951         https://bugs.webkit.org/show_bug.cgi?id=154993
952
953         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
954         (-[WKNetworkSessionDelegate URLSession:downloadTask:didWriteData:totalBytesWritten:totalBytesExpectedToWrite:]):
955
956 2016-03-04  Alex Christensen  <achristensen@webkit.org>
957
958         Use NSURLSession for loading in WebKit2
959         https://bugs.webkit.org/show_bug.cgi?id=154993
960
961         Reviewed by Sam Weinig.
962
963         * config.h:
964
965 2016-03-04  Alex Christensen  <achristensen@webkit.org>
966
967         Use NetworkSession for pings
968         https://bugs.webkit.org/show_bug.cgi?id=154984
969
970         Reviewed by Antti Koivisto.
971
972         Before this patch, we were using NSURLConnection for pings when the rest of the loading was being 
973         done with NSURLSession.  To fix this, I implemented PingLoad, which is the NetworkSession equivalent
974         of PingHandle.
975
976         This fixes http/tests/security/contentSecurityPolicy/report-status-code-zero-when-using-https.html
977
978         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
979         (WebKit::NetworkConnectionToWebProcess::loadPing):
980         (WebKit::NetworkConnectionToWebProcess::removeLoadIdentifier):
981         * NetworkProcess/PingLoad.h: Added.
982         (WebKit::PingLoad::PingLoad):
983         (WebKit::PingLoad::willPerformHTTPRedirection):
984         (WebKit::PingLoad::didReceiveChallenge):
985         (WebKit::PingLoad::didReceiveResponseNetworkSession):
986         (WebKit::PingLoad::didReceiveData):
987         (WebKit::PingLoad::didCompleteWithError):
988         (WebKit::PingLoad::didBecomeDownload):
989         (WebKit::PingLoad::didSendData):
990         (WebKit::PingLoad::wasBlocked):
991         (WebKit::PingLoad::cannotShowURL):
992         (WebKit::PingLoad::timeoutTimerFired):
993         (WebKit::PingLoad::~PingLoad):
994         * WebKit2.xcodeproj/project.pbxproj:
995
996 2016-03-04  Timothy Hatcher  <timothy@apple.com>
997
998         Inform WebKit and WebCore if a page is controlled by automation.
999
1000         https://bugs.webkit.org/show_bug.cgi?id=154991
1001         rdar://problem/24965784
1002
1003         Reviewed by Joseph Pecoraro.
1004
1005         * Shared/WebPageCreationParameters.cpp:
1006         (WebKit::WebPageCreationParameters::encode):
1007         (WebKit::WebPageCreationParameters::decode):
1008         * Shared/WebPageCreationParameters.h:
1009         * UIProcess/API/C/WKPage.cpp:
1010         (WKPageGetIsControlledByAutomation):
1011         (WKPageSetControlledByAutomation):
1012         * UIProcess/API/C/WKPagePrivate.h:
1013         * UIProcess/WebPageProxy.cpp:
1014         (WebKit::WebPageProxy::setControlledByAutomation):
1015         (WebKit::WebPageProxy::creationParameters):
1016         * UIProcess/WebPageProxy.h:
1017         (WebKit::WebPageProxy::isControlledByAutomation):
1018         * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
1019         (WKBundlePageIsControlledByAutomation):
1020         * WebProcess/InjectedBundle/API/c/WKBundlePage.h:
1021         * WebProcess/WebPage/WebPage.cpp:
1022         (WebKit::m_shouldDispatchFakeMouseMoveEvents):
1023         (WebKit::WebPage::isControlledByAutomation):
1024         (WebKit::WebPage::setControlledByAutomation):
1025         * WebProcess/WebPage/WebPage.h:
1026         * WebProcess/WebPage/WebPage.messages.in:
1027
1028 2016-03-03  Chris Dumez  <cdumez@apple.com>
1029
1030         Regression(r196770): Unable to use HipChat Mac app
1031         https://bugs.webkit.org/show_bug.cgi?id=154999
1032         <rdar://problem/24931959>
1033
1034         Reviewed by Darin Adler.
1035
1036         Have the NetworkProcess and the WebProcess pass the UIProcess bundle
1037         identifier to WebCore so that we can do app detection of applications
1038         using a WK2 WebView (such as HipChat).
1039
1040         * NetworkProcess/NetworkProcess.cpp:
1041         (WebKit::NetworkProcess::initializeNetworkProcess):
1042         * WebProcess/WebProcess.cpp:
1043         (WebKit::WebProcess::initializeWebProcess):
1044
1045 2016-03-03  Simon Fraser  <simon.fraser@apple.com>
1046
1047         Use larger tiles when possible to reduce per-tile painting overhead
1048         https://bugs.webkit.org/show_bug.cgi?id=154985
1049         rdar://problem/23635219
1050
1051         Reviewed by Tim Horton.
1052
1053         Do a bit of #include cleanup.
1054
1055         * Shared/mac/RemoteLayerBackingStore.mm:
1056         * WebProcess/WebPage/mac/PlatformCALayerRemote.h:
1057         * WebProcess/WebPage/mac/PlatformCALayerRemoteTiledBacking.cpp:
1058         * WebProcess/WebPage/mac/PlatformCALayerRemoteTiledBacking.h:
1059
1060 2016-03-03  Gyuyoung Kim  <gyuyoung.kim@webkit.org>
1061
1062         Use std::make_unique<> when creating std::unique_ptr<>
1063         https://bugs.webkit.org/show_bug.cgi?id=154574
1064
1065         Reviewed by Darin Adler.
1066
1067         * NetworkProcess/cache/NetworkCacheStatistics.cpp:
1068         (WebKit::NetworkCache::Statistics::open):
1069         * NetworkProcess/cache/NetworkCacheStatistics.h:
1070         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
1071         (WebKit::WebChromeClient::createColorChooser):
1072
1073 2016-03-03  Alex Christensen  <achristensen@webkit.org>
1074
1075         Move SPI to CFNetworkSPI.h
1076         https://bugs.webkit.org/show_bug.cgi?id=154992
1077
1078         Reviewed by Andy Estes.
1079
1080         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
1081         (WebKit::applyBasicAuthorizationHeader):
1082
1083 2016-03-03  Alex Christensen  <achristensen@webkit.org>
1084
1085         Use CredentialStorage with NetworkSession
1086         https://bugs.webkit.org/show_bug.cgi?id=154939
1087
1088         Reviewed by Darin Adler.
1089
1090         * config.h:
1091         Added compile-time flag to help us be able to keep track and remove this code when we can.
1092         * NetworkProcess/NetworkDataTask.h:
1093         (WebKit::NetworkDataTask::pendingDownloadLocation):
1094         * NetworkProcess/NetworkProcess.cpp:
1095         (WebKit::NetworkProcess::clearCachedCredentials):
1096         (WebKit::NetworkProcess::ensurePrivateBrowsingSession):
1097         * NetworkProcess/NetworkSession.h:
1098         (WebKit::NetworkSession::sessionID):
1099         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
1100         (WebKit::applyBasicAuthorizationHeader):
1101         (WebKit::NetworkDataTask::NetworkDataTask):
1102         Use a credential storage and preemptively apply basic authentication headers if we have credentials from the storage.
1103         This is analogous to code in ResourceHandle::createNSURLConnection.
1104         
1105         (WebKit::NetworkDataTask::didReceiveChallenge):
1106         Make this look more like ResourceHandle::didReceiveAuthenticationChallenge.
1107         The call to tryPasswordBasedAuthentication was moved from the delegate callback to here.
1108         
1109         (WebKit::NetworkDataTask::willPerformHTTPRedirection):
1110         Use credentials from the credential storage if they exist.  This is analogous to code in ResourceHandle::willSendRequest.
1111         
1112         (WebKit::NetworkDataTask::tryPasswordBasedAuthentication):
1113         Use credentials from the credential storage if they exist.  This is analogous to code in ResourceHandle::tryHandlePasswordBasedAuthentication.
1114         
1115         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
1116         (-[WKNetworkSessionDelegate URLSession:task:didReceiveChallenge:completionHandler:]):
1117         If we are given a credential with CredentialPersistenceForSession, put it in the credential storage and give 
1118         CFNetwork a credential with CredentialPersistenceNone so it won't automatically be used again until the credential
1119         storage says its ok to use again.  This gives us the ability to clear session credentials when logout credentials are used.
1120         This is analogous to code in ResourceHandle::receivedCredential.
1121         
1122         (WebKit::NetworkSession::defaultSession):
1123         (WebKit::NetworkSession::NetworkSession):
1124         (WebKit::NetworkSession::~NetworkSession):
1125         (WebKit::NetworkSession::dataTaskForIdentifier):
1126         (WebKit::NetworkSession::clearCredentials): Deleted.
1127         * WebProcess/WebProcess.cpp:
1128         (WebKit::WebProcess::clearCachedCredentials):
1129         (WebKit::WebProcess::focusedWebPage):
1130         We no longer need to clear credentials from the NSURLSessions because we don't store session credentials in them.
1131         Instead, calling CredentialStorage.clearCredentials is sufficient.
1132
1133 2016-03-03  Andy Estes  <aestes@apple.com>
1134
1135         Adopt CFNetwork storage partitioning SPI
1136         https://bugs.webkit.org/show_bug.cgi?id=154957
1137         rdar://problem/23614620
1138
1139         Reviewed by Darin Adler.
1140
1141         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
1142         (WebKit::NetworkDataTask::NetworkDataTask): Computed the storage partition identifier for the new session task.
1143         If non-empty, set it using a NSURLSessionTask SPI.
1144
1145 2016-03-03  Alex Christensen  <achristensen@webkit.org>
1146
1147         [WK2] testRunner.setPrivateBrowsingEnabled doesn't work with NetworkProcess
1148         https://bugs.webkit.org/show_bug.cgi?id=115274
1149
1150         Reviewed by Darin Adler.
1151
1152         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
1153         (WebKit::NetworkConnectionToWebProcess::blobSize):
1154         (WebKit::NetworkConnectionToWebProcess::ensureLegacyPrivateBrowsingSession):
1155         * NetworkProcess/NetworkConnectionToWebProcess.h:
1156         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
1157         * NetworkProcess/NetworkProcess.h:
1158         * WebProcess/InjectedBundle/InjectedBundle.cpp:
1159         (WebKit::InjectedBundle::setPrivateBrowsingEnabled):
1160         * WebProcess/WebProcess.cpp:
1161         (WebKit::WebProcess::destroyPrivateBrowsingSession):
1162         (WebKit::WebProcess::ensureLegacyPrivateBrowsingSessionInNetworkProcess):
1163         (WebKit::WebProcess::pluginProcessConnectionManager):
1164         * WebProcess/WebProcess.h:
1165
1166 2016-03-02  Alex Christensen  <achristensen@webkit.org>
1167
1168         Properly cancel downloads when using NetworkSession
1169         https://bugs.webkit.org/show_bug.cgi?id=154893
1170
1171         Reviewed by Brady Eidson.
1172
1173         * NetworkProcess/Downloads/Download.cpp:
1174         (WebKit::Download::Download):
1175         * NetworkProcess/Downloads/Download.h:
1176         * NetworkProcess/Downloads/cocoa/DownloadCocoa.mm:
1177         (WebKit::Download::cancel):
1178         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
1179         (-[WKNetworkSessionDelegate URLSession:dataTask:didBecomeDownloadTask:]):
1180
1181 2016-03-01  Ada Chan  <adachan@apple.com>
1182
1183         Update the media element's presentation mode properly after going in and out of full screen via the Full Screen API
1184         https://bugs.webkit.org/show_bug.cgi?id=154834
1185
1186         Reviewed by Simon Fraser.
1187
1188         * UIProcess/Cocoa/WebVideoFullscreenManagerProxy.h:
1189         * UIProcess/Cocoa/WebVideoFullscreenManagerProxy.messages.in:
1190         * UIProcess/Cocoa/WebVideoFullscreenManagerProxy.mm:
1191         (WebKit::WebVideoFullscreenManagerProxy::exitFullscreenWithoutAnimationToMode):
1192         Call the new exitFullscreenWithoutAnimationToMode() method on WebVideoFullscreenInterfaceMac.
1193         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
1194         (WebKit::WebChromeClient::exitVideoFullscreenToModeWithoutAnimation):
1195         * WebProcess/WebCoreSupport/WebChromeClient.h:
1196         * WebProcess/cocoa/WebVideoFullscreenManager.h:
1197         * WebProcess/cocoa/WebVideoFullscreenManager.mm:
1198         (WebKit::WebVideoFullscreenManager::exitVideoFullscreenToModeWithoutAnimation):
1199
1200 2016-03-02  Beth Dakin  <bdakin@apple.com>
1201
1202         Crashes in media tests after http://trac.webkit.org/changeset/197461
1203         https://bugs.webkit.org/show_bug.cgi?id=154933
1204
1205         Reviewed by Eric Carlson.
1206
1207         Since the controlsManagerInterface is not guaranteed to exist, it doesn't 
1208         make sense to return a reference. Return a pointer instead.
1209         * UIProcess/Cocoa/WebVideoFullscreenManagerProxy.h:
1210         * UIProcess/Cocoa/WebVideoFullscreenManagerProxy.mm:
1211         (WebKit::WebVideoFullscreenManagerProxy::isVisible):
1212         (WebKit::WebVideoFullscreenManagerProxy::controlsManagerInterface):
1213         (WebKit::WebVideoFullscreenManagerProxy::fullscreenMayReturnToInline):
1214
1215 2016-03-02  Beth Dakin  <bdakin@apple.com>
1216
1217         Add support for playbackControlsManager
1218         https://bugs.webkit.org/show_bug.cgi?id=154742
1219         -and corresponding-
1220         rdar://problem/23833753
1221
1222         Reviewed by Jer Noble.
1223
1224         WebVideoFullscreenManagerProxy ensures the model and interface for the 
1225         UIProcess side of the playbackControlsManager. It also caches the 
1226         m_controlsManagerContextId so that it can return the 
1227         controlsManagerInterface.
1228         * UIProcess/Cocoa/WebVideoFullscreenManagerProxy.h:
1229         * UIProcess/Cocoa/WebVideoFullscreenManagerProxy.messages.in:
1230         * UIProcess/Cocoa/WebVideoFullscreenManagerProxy.mm:
1231         (WebKit::WebVideoFullscreenManagerProxy::setUpVideoControlsManagerWithID):
1232         (WebKit::WebVideoFullscreenManagerProxy::controlsManagerInterface):
1233
1234         Pipe isPlayingMediaDidChange() to WebViewImpl, and use that information to 
1235         update WebViewImplAdditions.
1236         * UIProcess/Cocoa/WebViewImpl.h:
1237         * UIProcess/Cocoa/WebViewImpl.mm:
1238         (WebKit::WebViewImpl::isPlayingMediaDidChange):
1239         * UIProcess/PageClient.h:
1240         * UIProcess/WebPageProxy.cpp:
1241         (WebKit::WebPageProxy::isPlayingMediaDidChange):
1242         (WebKit::WebPageProxy::isPlayingVideoWithAudio):
1243         * UIProcess/WebPageProxy.h:
1244         (WebKit::WebPageProxy::isPlayingAudio):
1245         * UIProcess/mac/PageClientImpl.h:
1246         * UIProcess/mac/PageClientImpl.mm:
1247         (WebKit::PageClientImpl::isPlayingMediaDidChange):
1248
1249         Pipe setUpVideoControlsManager to the WebVideoFullscreenManager.
1250         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
1251         (WebKit::WebChromeClient::setUpVideoControlsManager):
1252         * WebProcess/WebCoreSupport/WebChromeClient.h:
1253
1254         Ensure the model an interface for the playbackControlsManager on the 
1255         WebProcess side and pass the message to the UIProcess to do the same.
1256         * WebProcess/cocoa/WebVideoFullscreenManager.h:
1257         * WebProcess/cocoa/WebVideoFullscreenManager.mm:
1258         (WebKit::WebVideoFullscreenManager::setUpVideoControlsManager):
1259
1260 2016-03-02  Carlos Garcia Campos  <cgarcia@igalia.com>
1261
1262         REGRESSION(r197409): [GTK] Web process always crashes on WebPage construction after r197409
1263         https://bugs.webkit.org/show_bug.cgi?id=154918
1264
1265         Reviewed by Žan Doberšek.
1266
1267         We have an incorrect check in DrawingAreaImpl constructor that has
1268         never actually worked because it uses the page settings before
1269         they were initialized. But that has been fixed in r197409 and now
1270         we are always forcing accelerated compositing mode incorrectly,
1271         because m_alwaysUseCompositing is set in the constructor and never
1272         changed again.
1273
1274         * WebProcess/WebPage/DrawingAreaImpl.cpp:
1275         (WebKit::DrawingAreaImpl::DrawingAreaImpl): Remove code to set
1276         settings and m_alwaysUseCompositing, since that should be done in
1277         updatePreferences().
1278         (WebKit::DrawingAreaImpl::updatePreferences): Update the settings
1279         accordingly and always update m_alwaysUseCompositing when AC is
1280         enabled and forced in the settings.
1281         * WebProcess/WebPage/WebPage.cpp:
1282         (WebKit::WebPage::WebPage): WebPage::updatePreferences() calls
1283         DrawingArea::updatePreferences(), but since r197409 it happens
1284         before the drawing area has been created. So, call
1285         DrawingArea::updatePreferences() in the constructor right after
1286         the main frame has been created, since
1287         DrawingArea::updatePreferences() uses the main frame.
1288
1289 2016-02-29  Ada Chan  <adachan@apple.com>
1290
1291         Adopt the new version of AVOutputDeviceMenuController's showMenuForRect method.
1292         https://bugs.webkit.org/show_bug.cgi?id=154823
1293
1294         Reviewed by Tim Horton.
1295
1296         * UIProcess/WebPageProxy.cpp:
1297         (WebKit::WebPageProxy::showPlaybackTargetPicker):
1298         (WebKit::WebPageProxy::customPlaybackActionSelected):
1299         * UIProcess/WebPageProxy.h:
1300         * UIProcess/WebPageProxy.messages.in:
1301         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
1302         (WebKit::WebChromeClient::showPlaybackTargetPicker):
1303         * WebProcess/WebCoreSupport/WebChromeClient.h:
1304         * WebProcess/WebPage/WebPage.h:
1305         * WebProcess/WebPage/WebPage.messages.in:
1306         * WebProcess/WebPage/mac/WebPageMac.mm:
1307         (WebKit::WebPage::customPlaybackActionSelected):
1308
1309 2016-02-29  Brent Fulgham  <bfulgham@apple.com>
1310
1311         [WK2] Stub support for WebsiteDataTypeResourceLoadStatistics
1312         https://bugs.webkit.org/show_bug.cgi?id=154689
1313         <rdar://problem/24702576>
1314
1315         Reviewed by Sam Weinig.
1316
1317         * Shared/WebsiteData/WebsiteDataType.h: Add new WebsiteDataTypeResourceLoadStatistics.
1318         * UIProcess/API/Cocoa/WKWebsiteDataRecord.mm:
1319         (dataTypesToString): Handle new type.
1320         * UIProcess/API/Cocoa/WKWebsiteDataRecordInternal.h:
1321         (WebKit::toWebsiteDataTypes): Ditto.
1322         (WebKit::toWKWebsiteDataTypes): Ditto.
1323         * UIProcess/API/Cocoa/WKWebsiteDataRecordPrivate.h: Add new _WebsiteDataTypeResourceLoadStatistics.
1324
1325 2016-03-01  Alex Christensen  <achristensen@webkit.org>
1326
1327         Correctly keep track of NetworkDataTasks with and without credentials when using NetworkSession
1328         https://bugs.webkit.org/show_bug.cgi?id=154876
1329
1330         Reviewed by Brady Eidson.
1331
1332         I was seeing an assertion failure from ASSERT(!m_session.m_dataTaskMap.contains(taskIdentifier()))
1333         in the NetworkDataTask constructor sometimes.  This is because a task identifier is not enough information
1334         to uniquely find a NetworkDataTask in a NetworkSession since r196034 because there are two NSURLSessions
1335         in a NetworkSession, one with credentials and one without.  The assertion would fire in a case like if we
1336         made the first NetworkDataTask with credentials (taskIdentifier is 1) and the first NetworkDataTask 
1337         without credentials before the first NetworkDataTask with credentials was finished.  In that case, the 
1338         taskIdentifier would also be 1, which would conflict with the other taskIdentifier.  That taskIdentifier
1339         would uniquely identify the task in the correct NSURLSession, though, so the solution is to keep a map
1340         for each NSURLSession in the NetworkSession.
1341
1342         * NetworkProcess/NetworkDataTask.h:
1343         * NetworkProcess/NetworkSession.h:
1344         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
1345         (WebKit::NetworkDataTask::NetworkDataTask):
1346         (WebKit::NetworkDataTask::~NetworkDataTask):
1347         (WebKit::NetworkDataTask::suspend):
1348         (WebKit::serverTrustCredential):
1349         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
1350         (-[WKNetworkSessionDelegate URLSession:task:didSendBodyData:totalBytesSent:totalBytesExpectedToSend:]):
1351         (-[WKNetworkSessionDelegate URLSession:task:willPerformHTTPRedirection:newRequest:completionHandler:]):
1352         (-[WKNetworkSessionDelegate URLSession:task:didReceiveChallenge:completionHandler:]):
1353         (-[WKNetworkSessionDelegate URLSession:task:didCompleteWithError:]):
1354         (-[WKNetworkSessionDelegate URLSession:dataTask:didReceiveResponse:completionHandler:]):
1355         (-[WKNetworkSessionDelegate URLSession:dataTask:didReceiveData:]):
1356         (-[WKNetworkSessionDelegate URLSession:downloadTask:didWriteData:totalBytesWritten:totalBytesExpectedToWrite:]):
1357         (-[WKNetworkSessionDelegate URLSession:dataTask:didBecomeDownloadTask:]):
1358         (WebKit::NetworkSession::clearCredentials):
1359         (WebKit::NetworkSession::dataTaskForIdentifier):
1360         (WebKit::NetworkSession::addDownloadID):
1361
1362 2016-03-01  Andreas Kling  <akling@apple.com>
1363
1364         REGRESSION (r154616): Accelerated drawing is off during the initial load
1365         <https://webkit.org/b/123812>
1366
1367         Reviewed by Tim Horton.
1368
1369         Load preferences before instantiating the first DrawingArea. This ensures that we do the
1370         initial paint using accelerated drawing, and avoids allocating persistent data structures
1371         only needed by the software rendering path.
1372
1373         * WebProcess/WebPage/WebPage.cpp:
1374
1375 2016-03-01  Alex Christensen  <achristensen@webkit.org>
1376
1377         Fix tests when using NetworkSession
1378         https://bugs.webkit.org/show_bug.cgi?id=154866
1379
1380         Reviewed by Brady Eidson.
1381
1382         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
1383         (WebKit::globalCustomProtocolManager):
1384         (WebKit::NetworkSession::setCustomProtocolManager):
1385         
1386         Use a static NeverDestroyed instead of a local NeverDestroyed.
1387         This fix was suggested by Darin after I broke the custom protocol tests in r197362.
1388         
1389         (WebKit::NetworkSession::clearCredentials):
1390         
1391         In r197223 I added code that I thought cleared the credentials of a session, but it was
1392         actually trying (and failing) to remove the credentials from the NSURLCredentialStorage that
1393         were stored with NSURLCredentialPersistencePermanent.
1394         This was causing credentials stored in an NSURLSession with NSURLCredentialPersistenceForSession
1395         to remain for the next tests, and was causing credentials from previous tests, usually from
1396         http/tests/loading/basic-credentials-sent-automatically.html, to be used in future tests.
1397         Creating a new NSURLSession is the equivalent of CredentialStorage::clearCredentials because it
1398         removes all credentials stored with NSURLCredentialPersistenceForSession.
1399
1400 2016-03-01  Carlos Garcia Campos  <cgarcia@igalia.com>
1401
1402         NetworkCache: Web process leaks resource buffer when using shareable reasources
1403         https://bugs.webkit.org/show_bug.cgi?id=154852
1404
1405         Reviewed by Darin Adler.
1406
1407         ResourceLoader::didReceiveBuffer() expects a PassRefPtr, but we
1408         are passing a raw pointer making PassRefPtr to take another
1409         reference instead of transfering the ownership as expected.
1410
1411         * WebProcess/Network/WebResourceLoader.cpp:
1412         (WebKit::WebResourceLoader::didReceiveResource):
1413
1414 2016-02-29  Zan Dobersek  <zdobersek@igalia.com>
1415
1416         ThreadedCompositor: clean up composition-specific resources before shutting down the thread
1417         https://bugs.webkit.org/show_bug.cgi?id=154793
1418
1419         Reviewed by Carlos Garcia Campos.
1420
1421         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
1422         (WebKit::ThreadedCompositor::runCompositingThread): Before concluding the
1423         compositing thread run, clean up all the resources that were allocated at
1424         the start, and in the reverse order. Specifically, we now also deallocate
1425         the CoordinatedGraphicsScene and the SimpleViewportController objects. This
1426         way these are not deallocated on the main thread when the ThreadedCompositor
1427         destructor would otherwise clean them up.
1428
1429 2016-02-29  Zan Dobersek  <zdobersek@igalia.com>
1430
1431         ThreadSafeCoordinatedSurface: remove the unused private create() static method
1432         https://bugs.webkit.org/show_bug.cgi?id=154792
1433
1434         Reviewed by Carlos Garcia Campos.
1435
1436         Remove the static ThreadSafeCoordinatedSurface::create() method that accepted
1437         a std::unique_ptr<ImageBuffer> object as its third parameter. This was not used
1438         anywhere.
1439
1440         * Shared/CoordinatedGraphics/threadedcompositor/ThreadSafeCoordinatedSurface.cpp:
1441         (WebKit::ThreadSafeCoordinatedSurface::create): Deleted.
1442         * Shared/CoordinatedGraphics/threadedcompositor/ThreadSafeCoordinatedSurface.h:
1443
1444 2016-02-29  Simon Fraser  <simon.fraser@apple.com>
1445
1446         Remove the experimental feature of antialiased font dilation
1447         https://bugs.webkit.org/show_bug.cgi?id=154843
1448
1449         Reviewed by Zalan Bujtas.
1450
1451         Remove the "antialiased font dilation" code path, and related prefs.
1452
1453         * Shared/WebPreferencesDefinitions.h:
1454         * UIProcess/API/C/WKPreferences.cpp:
1455         (WKPreferencesSetAntialiasedFontDilationEnabled):
1456         (WKPreferencesGetAntialiasedFontDilationEnabled):
1457         * UIProcess/API/C/WKPreferencesRefPrivate.h:
1458         * UIProcess/API/Cocoa/WKPreferences.mm:
1459         (-[WKPreferences _antialiasedFontDilationEnabled]): Deleted.
1460         (-[WKPreferences _setAntialiasedFontDilationEnabled:]): Deleted.
1461         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
1462         * WebProcess/WebPage/WebPage.cpp:
1463         (WebKit::WebPage::updatePreferences): Deleted.
1464
1465 2016-02-29  Brady Eidson  <beidson@apple.com>
1466
1467         Modern IDB: WebKit 2 IPC layer easily confused about multiple web processes being connected.
1468         https://bugs.webkit.org/show_bug.cgi?id=154837
1469
1470         Reviewed by Alex Christensen.
1471
1472         The crux of the bug is that WebProcesses cannot assign themselves server-unique identifiers...
1473         The server must do that for them.
1474         
1475         A once-per-session-per-WebProcess sync message and a few updates to connection management fix this.
1476         
1477         * DatabaseProcess/DatabaseToWebProcessConnection.cpp:
1478         (WebKit::DatabaseToWebProcessConnection::didReceiveSyncMessage):
1479         (WebKit::generateConnectionToServerIdentifier):
1480         (WebKit::DatabaseToWebProcessConnection::establishIDBConnectionToServer):
1481         * DatabaseProcess/DatabaseToWebProcessConnection.h:
1482         * DatabaseProcess/DatabaseToWebProcessConnection.messages.in:
1483
1484         * WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.cpp:
1485         (WebKit::WebIDBConnectionToServer::WebIDBConnectionToServer):
1486         (WebKit::generateConnectionToServerIdentifier): Deleted.
1487
1488         * WebProcess/Databases/WebToDatabaseProcessConnection.cpp:
1489         (WebKit::WebToDatabaseProcessConnection::didReceiveMessage):
1490         (WebKit::WebToDatabaseProcessConnection::idbConnectionToServerForSession):
1491         * WebProcess/Databases/WebToDatabaseProcessConnection.h:
1492
1493 2016-02-29  Alex Christensen  <achristensen@webkit.org>
1494
1495         Don't call NetworkProcess::singleton from WebProcess when using NetworkSession
1496         https://bugs.webkit.org/show_bug.cgi?id=154829
1497
1498         Reviewed by Anders Carlsson.
1499
1500         We were calling NetworkProcess::singleton when making the default session in the 
1501         WebProcess, which caused bad things to happen.  We also were never clearing the 
1502         credentials in the WebProcess between tests because it used to always call
1503         NetworkProcess::singleton, which caused flaky tests.
1504
1505         This fixes repeatable crashes in http/tests/media/media-document-referer.html and 
1506         http/tests/media/media-document.html when using NetworkSession.
1507
1508         * NetworkProcess/NetworkProcess.cpp:
1509         (WebKit::NetworkProcess::NetworkProcess):
1510         (WebKit::NetworkProcess::~NetworkProcess):
1511         * NetworkProcess/NetworkSession.h:
1512         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
1513         (WebKit::configurationForType):
1514         (WebKit::globalCustomProtocolManager):
1515         (WebKit::NetworkSession::setCustomProtocolManager):
1516         (WebKit::NetworkSession::defaultSession):
1517         * WebProcess/WebProcess.cpp:
1518         (WebKit::WebProcess::clearCachedCredentials):
1519
1520 2016-02-29  Gavin Barraclough  <barraclough@apple.com>
1521
1522         RefCounter<T>::Event -> RefCounterEvent
1523         https://bugs.webkit.org/show_bug.cgi?id=154767
1524
1525         Reviewed by Darin Adler.
1526
1527         RefCounter<T>::Event is kinda verbose to use, and there is no need for this
1528         to be specific to a particular typeof RefCounter. Move the enum class up to
1529         the top level & rename to RefCounterEvent.
1530
1531         Also remove UserObservablePageToken - this is vestigial & not really offering
1532         anything over just using UserObservablePageCounter::Token directly.
1533
1534         * UIProcess/Plugins/PluginProcessManager.cpp:
1535         (WebKit::PluginProcessManager::PluginProcessManager):
1536         * UIProcess/Plugins/PluginProcessManager.h:
1537         * UIProcess/Plugins/mac/PluginProcessManagerMac.mm:
1538         (WebKit::PluginProcessManager::updateProcessSuppressionDisabled):
1539         * UIProcess/ProcessThrottler.cpp:
1540         (WebKit::ProcessThrottler::ProcessThrottler):
1541         (WebKit::m_backgroundCounter):
1542         (WebKit::m_suspendMessageCount):
1543         * UIProcess/ProcessThrottler.h:
1544         * UIProcess/WebPageProxy.h:
1545         * UIProcess/WebProcessPool.cpp:
1546         (WebKit::WebProcessPool::WebProcessPool):
1547         (WebKit::m_processSuppressionDisabledForPageCounter):
1548         (WebKit::m_hiddenPageThrottlingAutoIncreasesCounter):
1549         * UIProcess/WebProcessPool.h:
1550
1551 2016-02-29  Konstantin Tokarev  <annulen@yandex.ru>
1552
1553         Fixed compilation with !ENABLE(DATABASE_PROCESS).
1554         https://bugs.webkit.org/show_bug.cgi?id=154813
1555
1556         Reviewed by Michael Catanzaro.
1557
1558         * UIProcess/WebProcessPool.cpp:
1559         (WebKit::WebProcessPool::terminateDatabaseProcess): Added missing #if
1560         guard.
1561
1562 2016-02-29  Adrien Plazas  <aplazas@igalia.com>
1563
1564         [GTK] Touch slider test fails due to assertion in webkitWebViewBaseTouchEvent()
1565         https://bugs.webkit.org/show_bug.cgi?id=153829
1566
1567         Reviewed by Carlos Garcia Campos.
1568
1569         Once a touch event sequence is identified as a gesture, remove it
1570         from the list of handled touch events.
1571
1572         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
1573         (webkitWebViewBaseTouchEvent):
1574
1575 2016-02-29  Csaba Osztrogonác  <ossy@webkit.org>
1576
1577         [Mac][cmake] Unreviewed buildfix after r197177. Just for fun.
1578
1579         * PlatformMac.cmake:
1580
1581 2016-02-28  Sam Weinig  <sam@webkit.org>
1582
1583         Reimplement WKPageGroup in terms of WKUserContentController
1584         https://bugs.webkit.org/show_bug.cgi?id=154804
1585
1586         Reviewed by Dan Bernstein.
1587
1588         Instead of having both WebPageGroup and WebUserContentControllerProxy both keep track
1589         of user scripts and user stylesheets, give WebPageGroup a WebUserContentControllerProxy
1590         and let it take care of things. This allows us to remove a ton of duplicate code, and
1591         provides a convenient way for clients currently using PageGroup based user content insertion
1592         to start using UserContentController, since they can now be used at the same time.
1593
1594         When using WKPageConfigurationRef, the rule is:
1595             - If you don't set a WKUserContentControllerRef, the one from the WKPageGroupRef will be used.
1596             - If you do set a WKUserContentControllerRef, it will be used, and the one from the WKPageGroupRef
1597               will do nothing for that web view.
1598
1599         * DerivedSources.make:
1600         Remove WebPageGroupProxy. It no longer is a MessageReceiver.
1601
1602         * Shared/WebPageGroupData.cpp:
1603         (WebKit::WebPageGroupData::encode):
1604         (WebKit::WebPageGroupData::decode):
1605         * Shared/WebPageGroupData.h:
1606         Stop encoding/decoding user content, instead just encode the identifier to the UserContentController.
1607
1608         * UIProcess/API/C/WKPageGroup.cpp:
1609         (WKPageGroupGetUserContentController):
1610         * UIProcess/API/C/WKPageGroup.h:
1611         Add getter for the underlying WKUserContentControllerRef.
1612
1613         * UIProcess/API/cpp/WKRetainPtr.h:
1614         (WebKit::retainWK):
1615         Add retainWK() helper to match RetainPtr's retainPtr() helper.
1616
1617         * UIProcess/WebPageGroup.cpp:
1618         (WebKit::WebPageGroup::WebPageGroup):
1619         (WebKit::WebPageGroup::userContentController):
1620         (WebKit::WebPageGroup::addUserStyleSheet):
1621         (WebKit::WebPageGroup::addUserScript):
1622         (WebKit::WebPageGroup::removeAllUserStyleSheets):
1623         (WebKit::WebPageGroup::removeAllUserScripts):
1624         (WebKit::WebPageGroup::removeAllUserContent):
1625         (WebKit::WebPageGroup::addUserContentExtension):
1626         (WebKit::WebPageGroup::removeUserContentExtension):
1627         (WebKit::WebPageGroup::removeAllUserContentExtensions):
1628         * UIProcess/WebPageGroup.h:
1629         Pass through to the WebUserContentControllerProxy.
1630
1631         * UIProcess/WebPageProxy.cpp:
1632         (WebKit::WebPageProxy::WebPageProxy):
1633         (WebKit::WebPageProxy::finishInitializingWebPageAfterProcessLaunch):
1634         (WebKit::WebPageProxy::creationParameters):
1635         * UIProcess/WebPageProxy.h:
1636         WebPageProxies always have a WebUserContentControllerProxy now, so it can go in a Ref and
1637         a few branches can be removed.
1638
1639         * UIProcess/WebProcessPool.cpp:
1640         (WebKit::WebProcessPool::createWebPage):
1641         If a UserContentController is not passed in, use the one from the PageGroup.
1642
1643         * WebKit2.xcodeproj/project.pbxproj:
1644         Remove files.
1645
1646         * WebProcess/InjectedBundle/InjectedBundle.cpp:
1647         Add some #includes that are now needed.
1648
1649         * WebProcess/UserContent/WebUserContentController.cpp:
1650         (WebKit::WebUserContentController::getOrCreate):
1651         * WebProcess/UserContent/WebUserContentController.h:
1652         Modernize WebUserContentController::getOrCreate to return a Ref.
1653
1654         * WebProcess/WebPage/WebPage.cpp:
1655         (WebKit::WebPage::WebPage):
1656         (WebKit::m_shouldDispatchFakeMouseMoveEvents):
1657         (WebKit::WebPage::addUserScript):
1658         (WebKit::WebPage::addUserStyleSheet):
1659         (WebKit::WebPage::removeAllUserContent):
1660         * WebProcess/WebPage/WebPage.h:
1661         Store the WebUserContentController in Ref, remove unnecessary branches/asserts.
1662
1663         * WebProcess/WebPage/WebPageGroupProxy.cpp:
1664         (WebKit::WebPageGroupProxy::WebPageGroupProxy):
1665         (WebKit::WebPageGroupProxy::~WebPageGroupProxy):
1666         (WebKit::WebPageGroupProxy::userContentController):
1667         (WebKit::WebPageGroupProxy::addUserStyleSheet): Deleted.
1668         (WebKit::WebPageGroupProxy::addUserScript): Deleted.
1669         (WebKit::WebPageGroupProxy::removeAllUserStyleSheets): Deleted.
1670         (WebKit::WebPageGroupProxy::removeAllUserScripts): Deleted.
1671         (WebKit::WebPageGroupProxy::removeAllUserContent): Deleted.
1672         (WebKit::WebPageGroupProxy::addUserContentExtension): Deleted.
1673         (WebKit::WebPageGroupProxy::removeUserContentExtension): Deleted.
1674         (WebKit::WebPageGroupProxy::removeAllUserContentExtensions): Deleted.
1675         * WebProcess/WebPage/WebPageGroupProxy.h:
1676         Store a WebUserContentController in a Ref, remove now unnecessary message handling functions.
1677
1678         * WebProcess/WebPage/WebPageGroupProxy.messages.in:
1679         Removed.
1680
1681         * WebProcess/WebProcess.cpp:
1682         (WebKit::WebProcess::didReceiveMessage):
1683         Remove routing to WebPageGroupProxy, which is no longer a MessageReceiver.
1684
1685 2016-02-28  Sam Weinig  <sam@webkit.org>
1686
1687         Bind _WKUserStyleSheets to _WKUserContentWorlds to allow for grouping of user content by associating to a world
1688         https://bugs.webkit.org/show_bug.cgi?id=154798
1689
1690         Reviewed by Dan Bernstein.
1691
1692         Treat _WKUserStyleSheets like WKUserScripts and allow them to be bound to a _WKUserContentWorld.
1693         The immediate benefit of this is allowing a client to bind a set of user content (scripts and stylesheets
1694         for now) to a world and have them easily remove all user content associated with that world easily.
1695
1696         * Shared/API/APIArray.h:
1697         Add helpers removeAllMatching and removeAllOfTypeMatching.
1698
1699         * UIProcess/API/APIUserStyleSheet.h:
1700         Add API::UserContentWorld member.
1701
1702         * UIProcess/API/Cocoa/WKUserContentController.mm:
1703         (-[WKUserContentController _removeAllUserScriptsAssociatedWithUserContentWorld:]):
1704         (-[WKUserContentController _removeAllUserStyleSheetsAssociatedWithUserContentWorld:]):
1705         * UIProcess/API/Cocoa/WKUserContentControllerPrivate.h:
1706         Add _removeAllUserScriptsAssociatedWithUserContentWorld and _removeAllUserStyleSheetsAssociatedWithUserContentWorld.
1707
1708         * UIProcess/API/Cocoa/WKUserScript.mm:
1709         (-[WKUserScript _initWithSource:injectionTime:forMainFrameOnly:legacyWhitelist:legacyBlacklist:userContentWorld:]):
1710         (toStringVector): Deleted.
1711         * UIProcess/API/Cocoa/_WKUserContentWorldInternal.h:
1712         (API::toStringVector):
1713         Move toStringVector to a location where it can be shared.
1714
1715         * UIProcess/API/Cocoa/_WKUserStyleSheet.h:
1716         * UIProcess/API/Cocoa/_WKUserStyleSheet.mm:
1717         (-[_WKUserStyleSheet initWithSource:forMainFrameOnly:legacyWhitelist:legacyBlacklist:userContentWorld:]):
1718         Add new initializer which has a world to be bound to. While here, match WKUserScript and add support for the 
1719         legacy whitelist and blacklists.
1720
1721         * UIProcess/UserContent/WebUserContentControllerProxy.cpp:
1722         (WebKit::WebUserContentControllerProxy::addProcess):
1723         (WebKit::WebUserContentControllerProxy::removeProcess):
1724         (WebKit::WebUserContentControllerProxy::addUserContentWorldUse):
1725         (WebKit::WebUserContentControllerProxy::shouldSendRemoveUserContentWorldsMessage):
1726         (WebKit::WebUserContentControllerProxy::removeUserContentWorldUses):
1727         (WebKit::WebUserContentControllerProxy::addUserScript):
1728         (WebKit::WebUserContentControllerProxy::removeUserScript):
1729         (WebKit::WebUserContentControllerProxy::removeAllUserScripts):
1730         (WebKit::WebUserContentControllerProxy::addUserStyleSheet):
1731         (WebKit::WebUserContentControllerProxy::removeUserStyleSheet):
1732         (WebKit::WebUserContentControllerProxy::removeAllUserStyleSheets):
1733         * UIProcess/UserContent/WebUserContentControllerProxy.h:
1734         Refactor to share the code which decides whether to send AddUserContentWorlds/RemoveUserContentWorlds
1735         messages.
1736
1737         * WebProcess/UserContent/WebUserContentController.cpp:
1738         (WebKit::WebUserContentController::addUserContentWorlds):
1739         (WebKit::WebUserContentController::removeUserContentWorlds):
1740         (WebKit::WebUserContentController::addUserScripts):
1741         (WebKit::WebUserContentController::removeUserScript):
1742         (WebKit::WebUserContentController::removeAllUserScripts):
1743         (WebKit::WebUserContentController::addUserStyleSheets):
1744         (WebKit::WebUserContentController::removeUserStyleSheet):
1745         (WebKit::WebUserContentController::removeAllUserStyleSheets):
1746         * WebProcess/UserContent/WebUserContentController.h:
1747         * WebProcess/UserContent/WebUserContentController.messages.in:
1748         Add support for binding stylesheets to worlds and allow removing all the scripts/stylesheets from a 
1749         set of worlds at once by passing Vectors of world identifiers in the remove messages.
1750
1751 2016-02-27  Commit Queue  <commit-queue@webkit.org>
1752
1753         Unreviewed, rolling out r197204, r197207, r197211, r197217,
1754         r197218, and r197219.
1755         https://bugs.webkit.org/show_bug.cgi?id=154780
1756
1757         Caused crashes in WebVideoFullscreenManagerProxy (Requested by
1758         ap on #webkit).
1759
1760         Reverted changesets:
1761
1762         "Add support for playbackControlsManager"
1763         https://bugs.webkit.org/show_bug.cgi?id=154742
1764         http://trac.webkit.org/changeset/197204
1765
1766         "Attempted build fix."
1767         http://trac.webkit.org/changeset/197207
1768
1769         "Attempted build fix."
1770         http://trac.webkit.org/changeset/197211
1771
1772         "Attempted 32-bit build fix."
1773         http://trac.webkit.org/changeset/197217
1774
1775         "Another 32-bit build fix."
1776         http://trac.webkit.org/changeset/197218
1777
1778         "32-bit!!!"
1779         http://trac.webkit.org/changeset/197219
1780
1781 2016-02-26  Carlos Garcia Campos  <cgarcia@igalia.com>
1782
1783         Unreviewed. Fix GTK+ clean build.
1784
1785         Add missing header include.
1786
1787         * WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.cpp:
1788
1789 2016-02-26  Carlos Garcia Campos  <cgarcia@igalia.com>
1790
1791         Network cache: old pages returned by disk cache on history navigation after session is restored
1792         https://bugs.webkit.org/show_bug.cgi?id=153230
1793
1794         Reviewed by Chris Dumez.
1795
1796         Since r181734, the network cache never revalidates resources for
1797         history navigation. This is good for the memory cache, but in the
1798         case of disk cache, we might end up with outdated pages when
1799         restoring the session. When restoring the session happens because
1800         of an API request (we also restore the session when recovering
1801         from a web process crash), we should revalidate back forward list
1802         requests in the disk cache if needed. This will only happen the
1803         first time they are loaded after a session restore. After a web process
1804         crash, resources will be used uncondionally from the disk cache.
1805
1806         * WebProcess/WebPage/WebBackForwardListProxy.cpp:
1807         (WebKit::WebBackForwardListProxy::addItemFromUIProcess): Use Ref&&
1808         instead of PassRefPtr.
1809         * WebProcess/WebPage/WebBackForwardListProxy.h:
1810         * WebProcess/WebPage/WebPage.cpp:
1811         (WebKit::WePage::WebPage): Call restoreSessionInternal passing
1812         No as restoredByAPIRequest parameter.
1813         (WebKit::WebPage::restoreSessionInternal): Set restoredFromSession
1814         flag to the created HistoryItem if the item was restored from
1815         session by an API request.
1816         (WebKit::WebPage::restoreSession): Call restoreSessionInternal
1817         passing Yes as restoredByAPIRequest parameter.
1818         * WebProcess/WebPage/WebPage.h:
1819
1820 2016-02-26  Michael Catanzaro  <mcatanzaro@igalia.com>
1821
1822         Fix a typo.
1823
1824         Unreviewed. Shame I didn't notice in the previous commit.
1825
1826         * WebProcess/UserContent/WebUserContentController.cpp:
1827         (WebKit::WebUserContentController::removeUserContentWorld):
1828
1829 2016-02-26  Michael Catanzaro  <mcatanzaro@igalia.com>
1830
1831         Fix GTK and maybe EFL build after r197172.
1832
1833         Unreviewed.
1834
1835         * CMakeLists.txt:
1836         * UIProcess/API/gtk/WebKitUserContent.cpp:
1837         (_WebKitUserScript::_WebKitUserScript):
1838         * WebProcess/UserContent/WebUserContentController.cpp:
1839         (WebKit::WebUserContentController::removeUserContentWorld):
1840         (WebKit::WebUserContentController::addUserScripts):
1841         (WebKit::WebUserContentController::removeUserScript):
1842         (WebKit::WebUserContentController::removeAllUserScripts):
1843
1844 2016-02-26  Michael Catanzaro  <mcatanzaro@igalia.com>
1845
1846         [GTK] Fix order of parameters in gtkdoc for webkit_web_view_get_snapshot
1847
1848         Unreviewed.
1849
1850         * UIProcess/API/gtk/WebKitWebView.cpp:
1851
1852 2016-02-26  Brady Eidson  <beidson@apple.com>
1853
1854         Modern IDB: New database versions are never committed to SQLite.
1855         <rdar://problem/24860952> and https://bugs.webkit.org/show_bug.cgi?id=154741
1856         
1857         Modern IDB: If a database handle is not open, files are not actually deleted from disk
1858         https://bugs.webkit.org/show_bug.cgi?id=154756
1859
1860         Reviewed by Alex Christensen.
1861
1862         Add WK2 SPI to force termination of the database process.
1863
1864         * UIProcess/API/Cocoa/WKProcessPool.mm:
1865         (-[WKProcessPool _terminateDatabaseProcess]):
1866         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
1867         * UIProcess/WebProcessPool.cpp:
1868         (WebKit::WebProcessPool::terminateDatabaseProcess):
1869         * UIProcess/WebProcessPool.h:
1870
1871 2016-02-26  Alex Christensen  <achristensen@webkit.org>
1872
1873         Clear credentials and prevent unauthorized credential storage when using NetworkSession
1874         https://bugs.webkit.org/show_bug.cgi?id=154755
1875
1876         Reviewed by Brady Eidson.
1877
1878         Credentials from previous tests were being used sometimes, notably in 
1879         http/tests/misc/401-alternative-content.php when running multiple credential-based
1880         tests with the same WebKitTestRunner.
1881
1882         * NetworkProcess/NetworkDataTask.h:
1883         * NetworkProcess/NetworkProcess.cpp:
1884         (WebKit::NetworkProcess::clearCachedCredentials):
1885         (WebKit::NetworkProcess::ensurePrivateBrowsingSession):
1886         * NetworkProcess/NetworkSession.h:
1887         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
1888         (WebKit::NetworkDataTask::NetworkDataTask):
1889         (WebKit::NetworkDataTask::tryPasswordBasedAuthentication):
1890         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
1891         (WebKit::NetworkSession::~NetworkSession):
1892         (WebKit::NetworkSession::clearCredentials):
1893         (WebKit::NetworkSession::dataTaskForIdentifier):
1894
1895 2016-02-26  Gavin Barraclough  <barraclough@apple.com>
1896
1897         Page TimerAlignmentIntervalIncrease mechanism should have upper limit
1898         https://bugs.webkit.org/show_bug.cgi?id=154744
1899
1900         Reviewed by Geoff Garen.
1901
1902         There would be diminishing returns from throttling timers in background pages infinitely.
1903         Add a heuristic to limit appropriately.
1904
1905         The flow of data here is WebPageProxy informs WebProcessPool of the number of pages
1906         participating in this mechanism, WebProcessPool computes an apropriate limit and pushes
1907         this out to the WebProcesses, which in turn update each of their pages.
1908
1909         * UIProcess/WebPageProxy.cpp:
1910         (WebKit::WebPageProxy::WebPageProxy):
1911             - Call updateHidenPageThrottingAutoIncreases on creation.
1912         (WebKit::WebPageProxy::updateHidenPageThrottingAutoIncreases):
1913             - If increasing timer throttling is enabled increment the counter on WebProcessPool.
1914         (WebKit::WebPageProxy::preferencesDidChange):
1915             - Call updateHidenPageThrottingAutoIncreases on preferences change.
1916         * UIProcess/WebPageProxy.h:
1917         * UIProcess/WebProcessPool.cpp:
1918         (WebKit::WebProcessPool::WebProcessPool):
1919             - initialize new RefCounter.
1920         (WebKit::WebProcessPool::updateHidenPageThrottingAutoIncreaseLimit):
1921             - When count of participating pages changes, update the limit.
1922         * UIProcess/WebProcessPool.h:
1923         * WebProcess/WebPage/WebPage.h:
1924         (WebKit::WebPage::setHiddenPageTimerThrottlingIncreaseLimit):
1925             - Propagate limit to WebCore::Page.
1926         * WebProcess/WebProcess.cpp:
1927         (WebKit::WebProcess::setHiddenPageTimerThrottlingIncreaseLimit):
1928             - Propagate limit to WebPages.
1929         * WebProcess/WebProcess.h:
1930         * WebProcess/WebProcess.messages.in:
1931             - Added new message.
1932
1933 2016-02-26  Beth Dakin  <bdakin@apple.com>
1934
1935         Attempted build fix.
1936
1937         * UIProcess/Cocoa/WebVideoFullscreenManagerProxy.mm:
1938         (WebKit::WebVideoFullscreenManagerProxy::setUpVideoControlsManagerWithID):
1939         (WebKit::WebVideoFullscreenManagerProxy::resetMediaState):
1940
1941 2016-02-26  Anders Carlsson  <andersca@apple.com>
1942
1943         Fix Yosemite build.
1944
1945         * UIProcess/API/Cocoa/_WKWebsiteDataSize.mm:
1946         (-[_WKWebsiteDataSize sizeOfDataTypes:]):
1947
1948 2016-02-26  Beth Dakin  <bdakin@apple.com>
1949
1950         Add support for playbackControlsManager
1951         https://bugs.webkit.org/show_bug.cgi?id=154742
1952         -and corresponding-
1953         rdar://problem/23833753
1954
1955         Reviewed by Jer Noble.
1956
1957         WebVideoFullscreenManagerProxy ensures the model and interface for the 
1958         UIProcess side of the playbackControlsManager. It also caches the 
1959         m_controlsManagerContextId so that it can return the 
1960         controlsManagerInterface.
1961         * UIProcess/Cocoa/WebVideoFullscreenManagerProxy.h:
1962         * UIProcess/Cocoa/WebVideoFullscreenManagerProxy.messages.in:
1963         * UIProcess/Cocoa/WebVideoFullscreenManagerProxy.mm:
1964         (WebKit::WebVideoFullscreenManagerProxy::setUpVideoControlsManagerWithID):
1965         (WebKit::WebVideoFullscreenManagerProxy::controlsManagerInterface):
1966
1967         Pipe isPlayingMediaDidChange() to WebViewImpl, and use that information to 
1968         update WebViewImplAdditions.
1969         * UIProcess/Cocoa/WebViewImpl.h:
1970         * UIProcess/Cocoa/WebViewImpl.mm:
1971         (WebKit::WebViewImpl::isPlayingMediaDidChange):
1972         * UIProcess/PageClient.h:
1973         * UIProcess/WebPageProxy.cpp:
1974         (WebKit::WebPageProxy::isPlayingMediaDidChange):
1975         (WebKit::WebPageProxy::isPlayingVideoWithAudio):
1976         * UIProcess/WebPageProxy.h:
1977         (WebKit::WebPageProxy::isPlayingAudio):
1978         * UIProcess/mac/PageClientImpl.h:
1979         * UIProcess/mac/PageClientImpl.mm:
1980         (WebKit::PageClientImpl::isPlayingMediaDidChange):
1981
1982         Pipe setUpVideoControlsManager to the WebVideoFullscreenManager.
1983         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
1984         (WebKit::WebChromeClient::setUpVideoControlsManager):
1985         * WebProcess/WebCoreSupport/WebChromeClient.h:
1986
1987         Ensure the model an interface for the playbackControlsManager on the 
1988         WebProcess side and pass the message to the UIProcess to do the same.
1989         * WebProcess/cocoa/WebVideoFullscreenManager.h:
1990         * WebProcess/cocoa/WebVideoFullscreenManager.mm:
1991         (WebKit::WebVideoFullscreenManager::setUpVideoControlsManager):
1992
1993 2016-02-26  Anders Carlsson  <andersca@apple.com>
1994
1995         WKWebsiteDataStore/WKWebsiteDataRecord needs to provide size information about each type of data
1996         https://bugs.webkit.org/show_bug.cgi?id=154750
1997
1998         Reviewed by Tim Horton.
1999
2000         * DatabaseProcess/DatabaseProcess.cpp:
2001         (WebKit::DatabaseProcess::fetchWebsiteData):
2002         WebsiteData::Entry now takes a size.
2003
2004         * NetworkProcess/NetworkProcess.cpp:
2005         (WebKit::fetchDiskCacheEntries):
2006         If necessary, compute sizes.
2007
2008         (WebKit::NetworkProcess::fetchWebsiteData):
2009         Just pass 0 for the CF cache for now.
2010
2011         * NetworkProcess/NetworkProcess.h:
2012         * NetworkProcess/NetworkProcess.messages.in:
2013         FetchWebsiteData now takes a OptionSet<WebsiteDataFetchOption>.
2014
2015         * Shared/WebsiteData/WebsiteData.cpp:
2016         (WebKit::WebsiteData::Entry::encode):
2017         (WebKit::WebsiteData::Entry::decode):
2018         Encode and decode the size.
2019
2020         * Shared/WebsiteData/WebsiteData.h:
2021         Add size.
2022
2023         * Shared/WebsiteData/WebsiteDataFetchOption.h:
2024         Add new enum.
2025
2026         * UIProcess/API/C/WKApplicationCacheManager.cpp:
2027         (WKApplicationCacheManagerGetApplicationCacheOrigins):
2028         Pass an empty OptionSet<WebsiteDataFetchOption>.
2029
2030         * UIProcess/API/C/WKResourceCacheManager.cpp:
2031         (WKResourceCacheManagerGetCacheOrigins):
2032         Pass an empty OptionSet<WebsiteDataFetchOption>.
2033
2034         * UIProcess/API/Cocoa/WKWebsiteDataRecord.mm:
2035         (-[WKWebsiteDataRecord description]):
2036         If we have a size, print it out as well.
2037
2038         (-[WKWebsiteDataRecord _dataSize]):
2039         Return a size if we have one.
2040
2041         * UIProcess/API/Cocoa/WKWebsiteDataRecordPrivate.h:
2042         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
2043         (-[WKWebsiteDataStore fetchDataRecordsOfTypes:completionHandler:]):
2044         Call through to the SPI.
2045
2046         (-[WKWebsiteDataStore _fetchDataRecordsOfTypes:withOptions:completionHandler:]):
2047         Compute the right options.
2048
2049         * UIProcess/API/Cocoa/WKWebsiteDataStoreInternal.h:
2050         Import WKWebsiteDataStorePrivate.h.
2051
2052         * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
2053         Add SPI.
2054
2055         * UIProcess/API/Cocoa/_WKWebsiteDataSize.h:
2056         * UIProcess/API/Cocoa/_WKWebsiteDataSize.mm:
2057         (-[_WKWebsiteDataSize initWithSize:]):
2058         (-[_WKWebsiteDataSize totalSize]):
2059         (-[_WKWebsiteDataSize sizeOfDataTypes:]):
2060         Add _WKWebsiteDataSize header.
2061
2062         * UIProcess/API/Cocoa/_WKWebsiteDataSizeInternal.h: Add IPI header.
2063
2064         * UIProcess/Network/NetworkProcessProxy.cpp:
2065         (WebKit::NetworkProcessProxy::fetchWebsiteData):
2066         This now takes a OptionSet<WebsiteDataFetchOption>.
2067
2068         * UIProcess/Network/NetworkProcessProxy.h:
2069         Update members.
2070
2071         * UIProcess/WebsiteData/WebsiteDataRecord.h:
2072         Add a hash map from types to sizes.
2073
2074         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
2075         (WebKit::WebsiteDataStore::fetchData):
2076         This now takes a OptionSet<WebsiteDataFetchOption>.
2077
2078         * UIProcess/WebsiteData/WebsiteDataStore.h:
2079         Update member functions.
2080
2081         * WebKit2.xcodeproj/project.pbxproj:
2082         Add new files.
2083
2084         * WebProcess/WebProcess.cpp:
2085         (WebKit::WebProcess::fetchWebsiteData):
2086         This now takes a OptionSet<WebsiteDataFetchOption>.
2087
2088 2016-02-26  Anders Carlsson  <andersca@apple.com>
2089
2090         Add a toWebsiteDataType and reimplement toWebsiteDataTypes using it
2091         https://bugs.webkit.org/show_bug.cgi?id=154746
2092
2093         Reviewed by Sam Weinig.
2094
2095         * UIProcess/API/Cocoa/WKWebsiteDataRecordInternal.h:
2096         (WebKit::toWebsiteDataType):
2097         (WebKit::toWebsiteDataTypes):
2098         (WebKit::toWKWebsiteDataTypes):
2099
2100 2016-02-26  Anders Carlsson  <andersca@apple.com>
2101
2102         Add WTF::OptionSet and use it for the website data types enum
2103         https://bugs.webkit.org/show_bug.cgi?id=154733
2104
2105         Reviewed by Geoffrey Garen.
2106
2107         This is a pretty mechanical change:
2108         
2109         Convert all uses of the WebsiteDataTypes enum to WTF::OptionSet. Rename the WebsiteDataTypes enum to
2110         WebsiteDataType (since it only represents a single data type), and rename headers. Encode and decode WTF::OptionSet properly.
2111
2112         * DatabaseProcess/DatabaseProcess.cpp:
2113         (WebKit::DatabaseProcess::fetchWebsiteData):
2114         (WebKit::DatabaseProcess::deleteWebsiteData):
2115         (WebKit::DatabaseProcess::deleteWebsiteDataForOrigins):
2116         * DatabaseProcess/DatabaseProcess.h:
2117         * DatabaseProcess/DatabaseProcess.messages.in:
2118         * NetworkProcess/NetworkProcess.cpp:
2119         (WebKit::fetchDiskCacheEntries):
2120         (WebKit::NetworkProcess::fetchWebsiteData):
2121         (WebKit::NetworkProcess::deleteWebsiteData):
2122         (WebKit::NetworkProcess::deleteWebsiteDataForOrigins):
2123         * NetworkProcess/NetworkProcess.h:
2124         * NetworkProcess/NetworkProcess.messages.in:
2125         * Platform/IPC/ArgumentCoders.h:
2126         (IPC::ArgumentCoder<OptionSet<T>>::encode):
2127         (IPC::ArgumentCoder<OptionSet<T>>::decode):
2128         * Scripts/webkit/messages.py:
2129         (class_template_headers):
2130         * Shared/WebsiteData/WebsiteData.h:
2131         * Shared/WebsiteData/WebsiteDataType.h: Renamed from Source/WebKit2/Shared/WebsiteData/WebsiteDataTypes.h.
2132         * UIProcess/API/C/WKApplicationCacheManager.cpp:
2133         (WKApplicationCacheManagerGetApplicationCacheOrigins):
2134         (WKApplicationCacheManagerDeleteEntriesForOrigin):
2135         (WKApplicationCacheManagerDeleteAllEntries):
2136         * UIProcess/API/C/WKResourceCacheManager.cpp:
2137         (toWebsiteDataTypes):
2138         (WKResourceCacheManagerClearCacheForOrigin):
2139         * UIProcess/API/Cocoa/WKWebsiteDataRecordInternal.h:
2140         (WebKit::toWebsiteDataTypes):
2141         (WebKit::toWKWebsiteDataTypes):
2142         * UIProcess/Databases/DatabaseProcessProxy.cpp:
2143         (WebKit::DatabaseProcessProxy::fetchWebsiteData):
2144         (WebKit::DatabaseProcessProxy::deleteWebsiteData):
2145         (WebKit::DatabaseProcessProxy::deleteWebsiteDataForOrigins):
2146         * UIProcess/Databases/DatabaseProcessProxy.h:
2147         * UIProcess/Network/NetworkProcessProxy.cpp:
2148         (WebKit::NetworkProcessProxy::fetchWebsiteData):
2149         (WebKit::NetworkProcessProxy::deleteWebsiteData):
2150         (WebKit::NetworkProcessProxy::deleteWebsiteDataForOrigins):
2151         * UIProcess/Network/NetworkProcessProxy.h:
2152         * UIProcess/WebProcessProxy.cpp:
2153         (WebKit::WebProcessProxy::fetchWebsiteData):
2154         (WebKit::WebProcessProxy::deleteWebsiteData):
2155         (WebKit::WebProcessProxy::deleteWebsiteDataForOrigins):
2156         * UIProcess/WebProcessProxy.h:
2157         * UIProcess/WebsiteData/WebsiteDataRecord.cpp:
2158         (WebKit::WebsiteDataRecord::add):
2159         (WebKit::WebsiteDataRecord::addCookieHostName):
2160         (WebKit::WebsiteDataRecord::addPluginDataHostName):
2161         * UIProcess/WebsiteData/WebsiteDataRecord.h:
2162         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
2163         (WebKit::computeNetworkProcessAccessTypeForDataFetch):
2164         (WebKit::computeWebProcessAccessTypeForDataFetch):
2165         (WebKit::WebsiteDataStore::fetchData):
2166         (WebKit::computeNetworkProcessAccessTypeForDataRemoval):
2167         (WebKit::computeWebProcessAccessTypeForDataRemoval):
2168         (WebKit::WebsiteDataStore::removeData):
2169         * UIProcess/WebsiteData/WebsiteDataStore.h:
2170         * WebKit2.xcodeproj/project.pbxproj:
2171         * WebProcess/WebProcess.cpp:
2172         (WebKit::WebProcess::fetchWebsiteData):
2173         (WebKit::WebProcess::deleteWebsiteData):
2174         (WebKit::WebProcess::deleteWebsiteDataForOrigins):
2175         * WebProcess/WebProcess.h:
2176         * WebProcess/WebProcess.messages.in:
2177
2178 2016-02-26  Sam Weinig  <sam@webkit.org>
2179
2180         Try to fix the Yosemite build again.
2181
2182         * UIProcess/API/Cocoa/WKUserScript.mm:
2183         (toStringVector):
2184         (-[WKUserScript _initWithSource:injectionTime:forMainFrameOnly:legacyWhitelist:legacyBlacklist:userContentWorld:]):
2185
2186 2016-02-26  Sam Weinig  <sam@webkit.org>
2187
2188         Try to fix the Yosemite build.
2189
2190         * UIProcess/API/Cocoa/WKUserScriptPrivate.h:
2191
2192 2016-02-25  Anders Carlsson  <andersca@apple.com>
2193
2194         Cache::traverse should pass the record info to its traversal handler
2195         https://bugs.webkit.org/show_bug.cgi?id=154695
2196
2197         Reviewed by Antti Koivisto.
2198
2199         * NetworkProcess/NetworkProcess.cpp:
2200         (WebKit::fetchDiskCacheEntries):
2201         (WebKit::clearDiskCacheEntries):
2202         * NetworkProcess/cache/NetworkCache.cpp:
2203         (WebKit::NetworkCache::Cache::traverse):
2204         * NetworkProcess/cache/NetworkCache.h:
2205
2206 2016-02-25  Gavin Barraclough  <barraclough@apple.com>
2207
2208         RefCounter value changed callback should be called on all changes (not just zero edge).
2209         https://bugs.webkit.org/show_bug.cgi?id=154699
2210
2211         Reviewed by Anders Carlsson.
2212
2213         RefCounter currently only triggers a callback when the count goes from zero
2214         to non-zero and vice-versa. Change that, to be useful to more clients.
2215
2216         * UIProcess/Plugins/PluginProcessManager.cpp:
2217         (WebKit::PluginProcessManager::PluginProcessManager):
2218             - Updated for change in RefCounter callback siganture.
2219         * UIProcess/Plugins/PluginProcessManager.h:
2220             - Updated for change in RefCounter callback siganture.
2221         * UIProcess/Plugins/mac/PluginProcessManagerMac.mm:
2222         (WebKit::PluginProcessManager::updateProcessSuppressionDisabled):
2223             - updated logic for enabling process supression.
2224         * UIProcess/ProcessThrottler.cpp:
2225         (WebKit::ProcessThrottler::ProcessThrottler):
2226             - Updated for change in RefCounter callback siganture.
2227         * UIProcess/WebProcessPool.cpp:
2228         (WebKit::WebProcessPool::WebProcessPool):
2229             - Updated for change in RefCounter callback siganture.
2230
2231 2016-02-26  Andreas Kling  <akling@apple.com>
2232
2233         Remove unused CFNetwork disk cache mmap optimization in WebKit2.
2234         <https://webkit.org/b/154727>
2235
2236         Reviewed by Darin Adler.
2237
2238         Nuke all the code related to the mmap optimization we had for CFNetwork's disk cache.
2239         This code has not been used since we moved to the WebKit2 network cache.
2240
2241         * NetworkProcess/Downloads/PendingDownload.h:
2242         * NetworkProcess/NetworkLoadClient.h:
2243         * NetworkProcess/NetworkResourceLoader.cpp:
2244         (WebKit::NetworkResourceLoader::sendBufferMaybeAborting): Deleted.
2245         * NetworkProcess/NetworkResourceLoader.h:
2246         * NetworkProcess/cache/NetworkCacheSpeculativeLoad.h:
2247         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
2248         (WebKit::NetworkProcess::platformLowMemoryHandler): Deleted.
2249         (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa): Deleted.
2250         * NetworkProcess/mac/NetworkDiskCacheMonitor.h: Removed.
2251         * NetworkProcess/mac/NetworkDiskCacheMonitor.mm: Removed.
2252         * NetworkProcess/mac/NetworkLoadMac.mm:
2253         (WebKit::NetworkLoad::willCacheResponseAsync): Deleted.
2254         * NetworkProcess/mac/NetworkResourceLoaderMac.mm: Removed.
2255         * WebKit2.xcodeproj/project.pbxproj:
2256
2257 2016-02-26  Commit Queue  <commit-queue@webkit.org>
2258
2259         Unreviewed, rolling out r197168.
2260         https://bugs.webkit.org/show_bug.cgi?id=154728
2261
2262         crashing on some devices (Requested by kling on #webkit).
2263
2264         Reverted changeset:
2265
2266         "[Darwin] Use vm_kernel_page_size for WTF::pageSize()."
2267         https://bugs.webkit.org/show_bug.cgi?id=154726
2268         http://trac.webkit.org/changeset/197168
2269
2270 2016-02-25  Sam Weinig  <sam@webkit.org>
2271
2272         Allow WKUserScripts to be run in isolated worlds
2273         https://bugs.webkit.org/show_bug.cgi?id=154701
2274
2275         Reviewed by Anders Carlsson.
2276
2277         Adds support for using isolated worlds, called _WKUserContentWorlds in the SPI,
2278         from the UIProcess.
2279
2280         * Shared/API/APIObject.h:
2281         * Shared/Cocoa/APIObject.mm:
2282         * UIProcess/API/APIUserContentWorld.cpp: Added.
2283         (API::generateIdentifier):
2284         (API::UserContentWorld::worldWithName):
2285         (API::UserContentWorld::normalWorld):
2286         (API::UserContentWorld::UserContentWorld):
2287         (API::UserContentWorld::~UserContentWorld):
2288         * UIProcess/API/APIUserContentWorld.h: Added.
2289         Add new UserContentWorld type.
2290
2291         * UIProcess/API/APIUserScript.h:
2292         Bind each user script to a particular _WKUserContentWorld.
2293
2294         * UIProcess/API/C/WKUserScriptRef.cpp:
2295         (WKUserScriptCreateWithSource):
2296         (WKUserScriptCopySource):
2297         Existing APIs create user scripts for the normal world, preserving existing behavior.
2298
2299         * UIProcess/API/Cocoa/WKUserScript.mm:
2300         (-[WKUserScript initWithSource:injectionTime:forMainFrameOnly:]):
2301         Existing APIs create user scripts for the normal world, preserving existing behavior.
2302
2303         (-[WKUserScript _initWithSource:injectionTime:forMainFrameOnly:legacyWhitelist:legacyBlacklist:userContentWorld:]):
2304         Add a new initializer which takes a world to bind to.  Also add support for the legacy whitelist/blacklist mechanism
2305         while we are here, as the expected client needs these as well.
2306
2307         (-[WKUserScript _userContentWorld]):
2308         Add accessor for the bound world.
2309
2310         * UIProcess/API/Cocoa/WKUserScriptInternal.h:
2311         * UIProcess/API/Cocoa/WKUserScriptPrivate.h: Added.
2312         Add new private header.
2313
2314         * UIProcess/API/Cocoa/_WKUserContentWorld.h: Added.
2315         * UIProcess/API/Cocoa/_WKUserContentWorld.mm: Added.
2316         (+[_WKUserContentWorld worldWithName:]):
2317         (+[_WKUserContentWorld normalWorld]):
2318         (-[_WKUserContentWorld dealloc]):
2319         (-[_WKUserContentWorld name]):
2320         (-[_WKUserContentWorld _apiObject]):
2321         * UIProcess/API/Cocoa/_WKUserContentWorldInternal.h: Added.
2322         Add SPI wrapper.
2323
2324         * UIProcess/UserContent/WebUserContentControllerProxy.cpp:
2325         (WebKit::WebUserContentControllerProxy::addProcess):
2326         (WebKit::WebUserContentControllerProxy::addUserScript):
2327         (WebKit::WebUserContentControllerProxy::removeUserScript):
2328         (WebKit::WebUserContentControllerProxy::removeAllUserScripts):
2329         (WebKit::WebUserContentControllerProxy::addUserStyleSheet):
2330         * UIProcess/UserContent/WebUserContentControllerProxy.h:
2331         (WebKit::WebUserContentControllerProxy::userScripts):
2332         (WebKit::WebUserContentControllerProxy::userStyleSheets):
2333         Add support for registering the worlds with the associated WebContentProcesses and then using
2334         their identifiers to map user scripts to the correct world.
2335         
2336         * WebKit2.xcodeproj/project.pbxproj:
2337         Add new files.
2338
2339         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInScriptWorld.h:
2340         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInScriptWorld.mm:
2341         (-[WKWebProcessPlugInScriptWorld name]):
2342         Expose the name property.
2343
2344         * WebProcess/InjectedBundle/API/c/WKBundleScriptWorld.cpp:
2345         (WKBundleScriptWorldCopyName):
2346         * WebProcess/InjectedBundle/API/c/WKBundleScriptWorld.h:
2347         Expose the name property.
2348
2349         * WebProcess/InjectedBundle/InjectedBundleScriptWorld.cpp:
2350         (WebKit::allWorlds):
2351         (WebKit::InjectedBundleScriptWorld::create):
2352         (WebKit::InjectedBundleScriptWorld::getOrCreate):
2353         (WebKit::InjectedBundleScriptWorld::normalWorld):
2354         (WebKit::InjectedBundleScriptWorld::InjectedBundleScriptWorld):
2355         (WebKit::InjectedBundleScriptWorld::~InjectedBundleScriptWorld):
2356         (WebKit::InjectedBundleScriptWorld::coreWorld):
2357         (WebKit::InjectedBundleScriptWorld::clearWrappers):
2358         * WebProcess/InjectedBundle/InjectedBundleScriptWorld.h:
2359         (WebKit::InjectedBundleScriptWorld::name):
2360         Add the name property and do some drive-by RefPtr -> Ref conversions.
2361
2362         * WebProcess/UserContent/WebUserContentController.cpp:
2363         (WebKit::userContentControllers):
2364         (WebKit::worldMap):
2365         (WebKit::WebUserContentController::getOrCreate):
2366         (WebKit::WebUserContentController::~WebUserContentController):
2367         (WebKit::WebUserContentController::addUserContentWorlds):
2368         (WebKit::WebUserContentController::removeUserContentWorld):
2369         (WebKit::WebUserContentController::addUserScripts):
2370         (WebKit::WebUserContentController::removeUserScript):
2371         (WebKit::WebUserContentController::removeAllUserScripts):
2372         (WebKit::WebUserContentController::addUserStyleSheets):
2373         * WebProcess/UserContent/WebUserContentController.h:
2374         * WebProcess/UserContent/WebUserContentController.messages.in:
2375         Track and use worlds passed from the UIProcess.
2376
2377 2016-02-26  Andreas Kling  <akling@apple.com>
2378
2379         [Darwin] Use vm_kernel_page_size for WTF::pageSize().
2380         <https://webkit.org/b/154726>
2381
2382         Reviewed by Antti Koivisto.
2383
2384         Use WTF::pageSize() for the SharedMemory page size.
2385
2386         * Platform/mac/SharedMemoryMac.cpp:
2387         (WebKit::SharedMemory::systemPageSize):
2388
2389 2016-02-25  Ryuan Choi  <ryuan.choi@navercorp.com>
2390
2391         [EFL] Remove WebUIPopupMenuClient
2392         https://bugs.webkit.org/show_bug.cgi?id=154717
2393
2394         Reviewed by Gyuyoung Kim.
2395
2396         WebUIPopupMenuClient is only for EFL to expose WebPopupMenuProxy and WebPopupItem to WK C APIs.
2397         This patch removes it and related code.
2398
2399         * PlatformEfl.cmake: Removed WKPopupItem related files from source list.
2400         * UIProcess/API/C/efl/WKAPICastEfl.h: Removed WKPopupMenu related code.
2401         * UIProcess/API/C/efl/WKPageEfl.cpp: Removed.
2402         * UIProcess/API/C/efl/WKPageEfl.h: Removed.
2403         * UIProcess/API/C/efl/WKPopupItem.cpp: Removed.
2404         * UIProcess/API/C/efl/WKPopupItem.h: Removed.
2405         * UIProcess/API/C/efl/WKPopupMenuListener.cpp: Removed.
2406         * UIProcess/API/C/efl/WKPopupMenuListener.h: Removed.
2407         * UIProcess/API/efl/EwkView.cpp:
2408         (EwkView::requestPopupMenu):
2409         * UIProcess/API/efl/EwkView.h:
2410         * UIProcess/API/efl/ewk_popup_menu.cpp:
2411         (EwkPopupMenu::EwkPopupMenu):
2412         (EwkPopupMenu::close):
2413         (EwkPopupMenu::setSelectedIndex):
2414         * UIProcess/API/efl/ewk_popup_menu_item.cpp: Used WebPopupItem and others instead of WK C APIs.
2415         * UIProcess/API/efl/ewk_popup_menu_item_private.h: Ditto.
2416         * UIProcess/API/efl/ewk_popup_menu_private.h:
2417         * UIProcess/WebPageProxy.cpp:
2418         (WebKit::WebPageProxy::close): Removed unnecessary EFL guards.
2419         (WebKit::WebPageProxy::showPopupMenu): Ditto.
2420         (WebKit::WebPageProxy::hidePopupMenu): Ditto.
2421         * UIProcess/WebPageProxy.h:
2422         * UIProcess/WebPopupMenuProxy.h:
2423         * UIProcess/efl/PageUIClientEfl.cpp: Removed WKPopupMenuListener related code.
2424         (WebKit::PageUIClientEfl::PageUIClientEfl): Deleted.
2425         (WebKit::PageUIClientEfl::showPopupMenu): Deleted.
2426         (WebKit::PageUIClientEfl::hidePopupMenu): Deleted.
2427         * UIProcess/efl/PageUIClientEfl.h:
2428         * UIProcess/efl/WebPageProxyEfl.cpp:
2429         (WebKit::WebPageProxy::initializeUIPopupMenuClient): Deleted.
2430         * UIProcess/efl/WebPopupMenuListenerEfl.cpp:
2431         (WebKit::WebPopupMenuListenerEfl::WebPopupMenuListenerEfl): Deleted.
2432         (WebKit::WebPopupMenuListenerEfl::valueChanged): Deleted.
2433         * UIProcess/efl/WebPopupMenuListenerEfl.h:
2434         (WebKit::WebPopupMenuListenerEfl::create): Deleted.
2435         * UIProcess/efl/WebPopupMenuProxyEfl.cpp: Used WebPopupItem and others instead of WK C APIs.
2436         * UIProcess/efl/WebPopupMenuProxyEfl.h: Ditto.
2437         (WebKit::WebPopupMenuProxyEfl::create):
2438         * UIProcess/efl/WebUIPopupMenuClient.cpp: Removed.
2439         * UIProcess/efl/WebUIPopupMenuClient.h: Removed.
2440         * UIProcess/efl/WebView.cpp:
2441         (WebKit::WebView::createPopupMenuProxy): Used WebPopupItem and others instead of WK C APIs.
2442
2443 2016-02-25  Andreas Kling  <akling@apple.com>
2444
2445         [iOS] Enable PageCache backing store clearing optimization for WebKit2.
2446         <https://webkit.org/b/154712>
2447
2448         Reviewed by Anders Carlsson.
2449
2450         We had an optimization for iOS where we'd tear down the compositing tree for
2451         pages in the page cache, to save memory, but we were only enabling it when
2452         instantiating a WebKit1 web view.
2453
2454         This patch enables the optimization for WebKit2 as well.
2455
2456         * WebProcess/WebProcess.cpp:
2457         (WebKit::WebProcess::WebProcess):
2458
2459 2016-02-25  Ada Chan  <adachan@apple.com>
2460
2461         Update the definition of ENABLE_VIDEO_PRESENTATION_MODE for Mac platform
2462         https://bugs.webkit.org/show_bug.cgi?id=154702
2463
2464         Reviewed by Dan Bernstein.
2465
2466         * Configurations/FeatureDefines.xcconfig:
2467
2468 2016-02-25  Jiewen Tan  <jiewen_tan@apple.com>
2469
2470         Restrict information passed with navigation action which is triggered by untrusted event
2471         https://bugs.webkit.org/show_bug.cgi?id=154571
2472         <rdar://problem/15967937>
2473
2474         Reviewed by Andy Estes.
2475
2476         When navigation action is triggered by an untrusted event, we should be more restricted of
2477         what information should be passed to the clients to lower the risk that clients could
2478         be fooled by the untrusted event.
2479
2480         In this patch, we drop the modifiers for key state events and set the mouse button to NoButton
2481         for mouse events.
2482
2483         * WebProcess/InjectedBundle/InjectedBundleNavigationAction.cpp:
2484         (WebKit::InjectedBundleNavigationAction::modifiersForNavigationAction):
2485
2486 2016-02-25  Ada Chan  <adachan@apple.com>
2487
2488         Hook up fullscreenMayReturnToInline() in WKPageUIClient
2489         https://bugs.webkit.org/show_bug.cgi?id=154661
2490
2491         Reviewed by Tim Horton.
2492
2493         * UIProcess/API/C/WKPage.cpp:
2494         (WKPageSetPageUIClient):
2495         * UIProcess/API/C/WKPageUIClient.h:
2496
2497 2016-02-25  Gavin Barraclough  <barraclough@apple.com>
2498
2499         Should template RefCounter instead of RefCounter::Token
2500         https://bugs.webkit.org/show_bug.cgi?id=154691
2501
2502         Reviewed by Anders Carlsson.
2503
2504         Mechanical update per RefCounter interface change.
2505
2506         * UIProcess/Plugins/PluginProcessManager.h:
2507         (WebKit::PluginProcessManager::processSuppressionDisabledToken):
2508         (WebKit::PluginProcessManager::processSuppressionDisabled):
2509         * UIProcess/ProcessThrottler.h:
2510         (WebKit::ProcessThrottler::foregroundActivityToken):
2511         (WebKit::ProcessThrottler::backgroundActivityToken):
2512         * UIProcess/WebProcessPool.h:
2513
2514 2016-02-25  Brady Eidson  <beidson@apple.com>
2515
2516         Remove LegacyIDB.
2517         https://bugs.webkit.org/show_bug.cgi?id=150854
2518
2519         Reviewed by Alex Christensen.
2520
2521         * CMakeLists.txt:
2522         * DatabaseProcess/DatabaseProcess.cpp:
2523         (WebKit::DatabaseProcess::getOrCreateLegacyUniqueIDBDatabase): Deleted.
2524         (WebKit::DatabaseProcess::removeLegacyUniqueIDBDatabase): Deleted.
2525         * DatabaseProcess/DatabaseProcess.h:
2526         * DatabaseProcess/DatabaseToWebProcessConnection.cpp:
2527         (WebKit::DatabaseToWebProcessConnection::didClose):
2528         (WebKit::DatabaseToWebProcessConnection::didReceiveMessage): Deleted.
2529         (WebKit::DatabaseToWebProcessConnection::didReceiveSyncMessage): Deleted.
2530         (WebKit::DatabaseToWebProcessConnection::establishIDBConnection): Deleted.
2531         (WebKit::DatabaseToWebProcessConnection::removeDatabaseProcessIDBConnection): Deleted.
2532         * DatabaseProcess/DatabaseToWebProcessConnection.h:
2533         * DatabaseProcess/DatabaseToWebProcessConnection.messages.in:
2534         * DatabaseProcess/IndexedDB/DatabaseProcessIDBConnection.cpp: Removed.
2535         * DatabaseProcess/IndexedDB/DatabaseProcessIDBConnection.h: Removed.
2536         * DatabaseProcess/IndexedDB/DatabaseProcessIDBConnection.messages.in: Removed.
2537         * DatabaseProcess/IndexedDB/IDBIdentifier.h: Removed.
2538         * DatabaseProcess/IndexedDB/IDBSerialization.cpp: Removed.
2539         * DatabaseProcess/IndexedDB/IDBSerialization.h: Removed.
2540         * DatabaseProcess/IndexedDB/LegacyUniqueIDBDatabase.cpp: Removed.
2541         * DatabaseProcess/IndexedDB/LegacyUniqueIDBDatabase.h: Removed.
2542         * DatabaseProcess/IndexedDB/LegacyUniqueIDBDatabaseIdentifier.cpp: Removed.
2543         * DatabaseProcess/IndexedDB/LegacyUniqueIDBDatabaseIdentifier.h: Removed.
2544         * DatabaseProcess/IndexedDB/UniqueIDBDatabaseBackingStore.h: Removed.
2545         * DatabaseProcess/IndexedDB/WebIDBConnectionToClient.h:
2546         * DatabaseProcess/IndexedDB/sqlite/SQLiteIDBCursor.cpp: Removed.
2547         * DatabaseProcess/IndexedDB/sqlite/SQLiteIDBCursor.h: Removed.
2548         * DatabaseProcess/IndexedDB/sqlite/SQLiteIDBTransaction.cpp: Removed.
2549         * DatabaseProcess/IndexedDB/sqlite/SQLiteIDBTransaction.h: Removed.
2550         * DatabaseProcess/IndexedDB/sqlite/UniqueIDBDatabaseBackingStoreSQLite.cpp: Removed.
2551         * DatabaseProcess/IndexedDB/sqlite/UniqueIDBDatabaseBackingStoreSQLite.h: Removed.
2552         * DerivedSources.make:
2553         * Shared/WebCrossThreadCopier.cpp:
2554         (WebCore::LegacyUniqueIDBDatabaseIdentifier>::copy): Deleted.
2555         (WebCore::IDBIdentifier>::copy): Deleted.
2556         * Shared/WebCrossThreadCopier.h:
2557         * WebKit2.xcodeproj/project.pbxproj:
2558         * WebProcess/Databases/IndexedDB/WebIDBFactoryBackend.cpp: Removed.
2559         * WebProcess/Databases/IndexedDB/WebIDBFactoryBackend.h: Removed.
2560         * WebProcess/Databases/IndexedDB/WebIDBServerConnection.cpp: Removed.
2561         * WebProcess/Databases/IndexedDB/WebIDBServerConnection.h: Removed.
2562         * WebProcess/Databases/IndexedDB/WebIDBServerConnection.messages.in: Removed.
2563         * WebProcess/Databases/WebDatabaseProvider.cpp:
2564         (WebKit::WebDatabaseProvider::createIDBFactoryBackend): Deleted.
2565         * WebProcess/Databases/WebDatabaseProvider.h:
2566         * WebProcess/Databases/WebToDatabaseProcessConnection.cpp:
2567         (WebKit::WebToDatabaseProcessConnection::didReceiveMessage): Deleted.
2568         (WebKit::WebToDatabaseProcessConnection::registerWebIDBServerConnection): Deleted.
2569         (WebKit::WebToDatabaseProcessConnection::removeWebIDBServerConnection): Deleted.
2570         * WebProcess/Databases/WebToDatabaseProcessConnection.h:
2571         * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
2572
2573 2016-02-25  Brady Eidson  <beidson@apple.com>
2574
2575         Modern IDB: WebKit 2 IPC layer.
2576         https://bugs.webkit.org/show_bug.cgi?id=153808
2577
2578         Reviewed by Alex Christensen.
2579
2580         * NetworkProcess/NetworkLoad.cpp:
2581         (WebKit::NetworkLoad::NetworkLoad): This ASSERT fires on most WK2 tests. Alex said remove it.
2582         
2583         * WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.cpp:
2584         (WebKit::WebIDBConnectionToServer::putOrAdd): Properly encode the overwrite flag.
2585         
2586         * WebProcess/Databases/WebDatabaseProvider.h: Enable Modern IDB.
2587
2588 2016-02-25  Eric Carlson  <eric.carlson@apple.com>
2589
2590         [MediaStream] MediaDeviceInfo deviceId and groupId must be unique to the page's origin
2591         https://bugs.webkit.org/show_bug.cgi?id=153163
2592         <rdar://problem/24334526>
2593
2594         Reviewed by Tim Horton.
2595
2596         * CMakeLists.txt: Add WKFrameHandleRef.cpp.
2597
2598         * Shared/API/c/WKBase.h: Add WKFrameHandleRef.
2599         * UIProcess/API/APIUIClient.h:
2600         (API::UIClient::decidePolicyForUserMediaPermissionRequest): Add parameter top level document
2601           security context.
2602         (API::UIClient::checkUserMediaPermissionForOrigin): Ditto.
2603
2604         * UIProcess/API/C/WKAPICast.h: Add FrameHandle.
2605
2606         * UIProcess/API/C/WKFrameHandleRef.cpp: Added.
2607         * UIProcess/API/C/WKFrameHandleRef.h: Added.
2608
2609         * UIProcess/API/C/WKFrameInfoRef.cpp:
2610         (WKFrameInfoGetFrameHandleRef): Added.
2611         * UIProcess/API/C/WKFrameInfoRef.h:
2612
2613         * UIProcess/API/C/WKPage.cpp:
2614         (WKPageSetPageUIClient): Add parameters to decidePolicyForUserMediaPermissionRequest and
2615           checkUserMediaPermissionForOrigin for top level document security context.
2616
2617         * UIProcess/API/C/WKPageUIClient.h: Ditto.
2618
2619         * UIProcess/API/C/WKUserMediaPermissionCheck.cpp:
2620         (WKUserMediaPermissionCheckSetUserMediaAccessInfo): Renamed from WKUserMediaPermissionCheckSetHasPersistentPermission,
2621           add parameter for top level document security context.
2622         (WKUserMediaPermissionCheckSetHasPersistentPermission): Deleted.
2623         * UIProcess/API/C/WKUserMediaPermissionCheck.h:
2624
2625         * UIProcess/API/gtk/WebKitUserMediaPermissionRequest.cpp:
2626         (webkitUserMediaPermissionRequestCreate): Add top level document origin.
2627
2628         * UIProcess/UserMediaPermissionCheckProxy.cpp:
2629         (WebKit::UserMediaPermissionCheckProxy::setUserMediaAccessInfo): Renamed from setHasPersistentPermission.
2630         (WebKit::UserMediaPermissionCheckProxy::setHasPersistentPermission): Deleted.
2631         * UIProcess/UserMediaPermissionCheckProxy.h:
2632
2633         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
2634         (WebKit::UserMediaPermissionRequestManagerProxy::didCompleteUserMediaPermissionCheck): Add parameter
2635          for device id hash salt.
2636         * UIProcess/UserMediaPermissionRequestManagerProxy.h:
2637
2638         * UIProcess/UserMediaPermissionRequestProxy.h:
2639         (WebKit::UserMediaPermissionRequestProxy::requiresAudio): Deleted, unused.
2640         (WebKit::UserMediaPermissionRequestProxy::requiresVideo): Ditto.
2641         (WebKit::UserMediaPermissionRequestProxy::firstVideoDeviceUID): Ditto.
2642         (WebKit::UserMediaPermissionRequestProxy::firstAudioDeviceUID): Ditto.
2643
2644         * UIProcess/WebPageProxy.cpp:
2645         (WebKit::WebPageProxy::requestUserMediaPermissionForFrame): Pass through parameter for top
2646           level document security context.
2647         (WebKit::WebPageProxy::checkUserMediaPermissionForFrame): Ditto.
2648         * UIProcess/WebPageProxy.h:
2649         * UIProcess/WebPageProxy.messages.in:
2650
2651         * WebKit2.xcodeproj/project.pbxproj: Add WKFrameHandleRef.cpp|.h.
2652
2653         * WebProcess/MediaStream/UserMediaPermissionRequestManager.cpp:
2654         (WebKit::UserMediaPermissionRequestManager::startUserMediaRequest): Pass through parameter for top
2655           level document security context.
2656         (WebKit::UserMediaPermissionRequestManager::startUserMediaPermissionCheck): Ditto.
2657         (WebKit::UserMediaPermissionRequestManager::didCompleteUserMediaPermissionCheck): Pass through
2658           device id hash salt.
2659         * WebProcess/MediaStream/UserMediaPermissionRequestManager.h:
2660
2661         * WebProcess/WebPage/WebPage.cpp:
2662         (WebKit::WebPage::didCompleteUserMediaPermissionCheck): Ditto.
2663         * WebProcess/WebPage/WebPage.h:
2664         * WebProcess/WebPage/WebPage.messages.in:
2665
2666 2016-02-24  Carlos Garcia Campos  <cgarcia@igalia.com>
2667
2668         [GTK] Tearing when entering AC mode
2669         https://bugs.webkit.org/show_bug.cgi?id=150955
2670
2671         Reviewed by Michael Catanzaro.
2672
2673         When entering accelerated compositing mode, we keep rendering the
2674         non accelerated contents until we have the first frame of
2675         accelerated compositing contents. When the view is created hidden,
2676         for example when the browser opens a link in a new tab, the view
2677         is not realized until it is mapped. The native surface handle for
2678         compositing, needed by the web process to render accelerated
2679         compositing contents, is not available until the view is realized,
2680         because it depends on the properties of the parent. When a web
2681         view is mapped for the first time, and then realized, we send the
2682         native surface handle for compositing to the web process, and keep
2683         rendering the non composited contents until we get the first
2684         frame, but in this case we never had non composited contents and
2685         we end up rendering an untinitalized surface. This sometimes just
2686         produces flickering and sometimes rendering artifacts.
2687         We can prevent this from happening by realizing the web view as
2688         soon as possible. A GtkWidget can't be realized until it has been
2689         added to a toplevel, so we can realize our view right after it is
2690         added to a toplevel window, and wait until the view is actually
2691         mapped to notify the web process that it has been added to a
2692         window. This way can we enter accelerated compositing mode before
2693         the web view is mapped, so that when mapped we don't try to paint
2694         the previous contents and don't need to wait for the first frame.
2695
2696         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
2697         (toplevelWindowFocusInEvent): Handle the case of the window being
2698         hidden when receiving focus in. According to
2699         gtk_window_focus_in_event, this can happen.
2700         (webkitWebViewBaseSetToplevelOnScreenWindow): When the web view is
2701         removed from its toplevel parent, update the IsInWindow and
2702         WindowIsActive flags accordingly. When the view is added to a
2703         toplevel, realize it and don't update the window flags, they will be
2704         updated when the view is mapped the first time.
2705         (webkitWebViewBaseMap): Also update IsInWindow and WindowIsActive
2706         flags if needed. This way, if for example you open a youtube video
2707         in a new tab, the video won't start playing until you visit the
2708         tab, like we did when the view was realized on map.
2709         (webkitWebViewBaseHierarchyChanged): Use hierarchy-changed signal
2710         instead of parent-set to be notified when the view is added to or
2711         removed from a toplevel.
2712         (webkit_web_view_base_class_init): Implement hierarchy-changed
2713         instead of parent-set.
2714         (webkitWebViewBaseRealize): Do not call
2715         webkitWebViewBaseSetToplevelOnScreenWindow on realize, it's now
2716         webkitWebViewBaseSetToplevelOnScreenWindow the one realizing the view.
2717         * UIProcess/cairo/BackingStoreCairo.cpp:
2718         (WebKit::BackingStore::createBackend): Do not realize the view
2719         here, it should be realized already at this point. If it's not
2720         realized at this point is because it hasn't been added to a
2721         toplevel and gtk_widget_realize will not work anyway.
2722         (WebKit::BackingStore::paint): This is changing the cairo source
2723         operator, so save/restore the cairo context to ensure it doesn't
2724         affect other drawing done after this.
2725
2726 2016-02-24  Nikos Andronikos  <nikos.andronikos-webkit@cisra.canon.com.au>
2727
2728         [web-animations] Add AnimationTimeline, DocumentTimeline and add extensions to Document interface
2729         https://bugs.webkit.org/show_bug.cgi?id=151688
2730
2731         Reviewed by Dean Jackson.
2732
2733         Enables the WEB_ANIMATIONS compiler switch.
2734
2735         * Configurations/FeatureDefines.xcconfig:
2736
2737 2016-02-24  Gavin Barraclough  <barraclough@apple.com>
2738
2739         Add WKPreference for HiddenPageDOMTimerThrottlingAutoIncreases
2740         https://bugs.webkit.org/show_bug.cgi?id=154655
2741
2742         Reviewed by Geoff Garen.
2743
2744         Just plumbing WebCore.settings.setHiddenPageDOMTimerThrottlingAutoIncreases through as
2745         WKPreferencesSetHiddenPageDOMTimerThrottlingAutoIncreases.
2746
2747         * Shared/WebPreferencesDefinitions.h:
2748         * UIProcess/API/C/WKPreferences.cpp:
2749         (WKPreferencesSetHiddenPageDOMTimerThrottlingAutoIncreases):
2750         (WKPreferencesGetHiddenPageDOMTimerThrottlingAutoIncreases):
2751         * UIProcess/API/C/WKPreferencesRefPrivate.h:
2752         * UIProcess/API/Cocoa/WKPreferences.mm:
2753         (-[WKPreferences _hiddenPageDOMTimerThrottlingAutoIncreases]):
2754         (-[WKPreferences _setHiddenPageDOMTimerThrottlingAutoIncreases:]):
2755         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
2756         * WebProcess/WebPage/WebPage.cpp:
2757         (WebKit::WebPage::updatePreferences):
2758
2759 2016-02-24  Alex Christensen  <achristensen@webkit.org>
2760
2761         Fix downloads when using NetworkSession
2762         https://bugs.webkit.org/show_bug.cgi?id=154620
2763
2764         Reviewed by Brady Eidson.
2765
2766         This fixes all the _WKDownload API tests when using NetworkSession.
2767
2768         * NetworkProcess/Downloads/DownloadManager.cpp:
2769         (WebKit::DownloadManager::willDecidePendingDownloadDestination):
2770         When we store the NetworkDataTask in m_downloadsWaitingForDestination, we want to remove its owner
2771         from m_pendingDownloads to prevent memory leaks.
2772         (WebKit::DownloadManager::continueDecidePendingDownloadDestination):
2773         If a file exists and the UIProcess has told us to overwrite the file, delete the file
2774         before starting a new download in its place.  This used to be done by CFNetwork in
2775         NSURLDownload's setDestination:allowOverwrite:, but the NSURLSession equivalent (setting
2776         NSURLSessionDataTask's _pathToDownloadTaskFile attribute) does not overwrite the file for us.
2777         (WebKit::DownloadManager::cancelDownload):
2778         If a download is canceled while it is waiting for its destination from the UIProcess, the Download
2779         object does not exist yet.  Instead, we have a completion handler stored in m_downloadsWaitingForDestination.
2780         In this case, we want to send the UIProcess a DownloadProxy::DidCancel message, which I did through
2781         NetworkProcess::pendingDownloadCanceled because the DownloadManager is not a MessageSender, and then
2782         call the completion handler with PolicyIgnore to cancel the download.
2783         (WebKit::DownloadManager::downloadFinished):
2784         * NetworkProcess/Downloads/DownloadManager.h:
2785         * NetworkProcess/Downloads/PendingDownload.cpp:
2786         (WebKit::PendingDownload::continueCanAuthenticateAgainstProtectionSpace):
2787         (WebKit::PendingDownload::didBecomeDownload):
2788         (WebKit::PendingDownload::didFailLoading):
2789         (WebKit::PendingDownload::messageSenderConnection):
2790         (WebKit::PendingDownload::didConvertToDownload): Deleted.
2791         * NetworkProcess/Downloads/PendingDownload.h:
2792         * NetworkProcess/Downloads/cocoa/DownloadCocoa.mm:
2793         (WebKit::Download::cancel):
2794         Send a didCancel message to the UIProcess when a download was cancelled.
2795         Use cancelByProducingResumeData so we can resume canceled downloads.
2796         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
2797         (WebKit::NetworkConnectionToWebProcess::convertMainResourceLoadToDownload):
2798         didConvertToDownload is needed when using NetworkSession to tell the NetworkResourceLoader
2799         not to call cancel on the NetworkLoad after converting it to a download.
2800         * NetworkProcess/NetworkDataTask.h:
2801         (WebKit::NetworkDataTask::setPendingDownload):
2802         (WebKit::NetworkDataTask::pendingDownloadLocation):
2803         * NetworkProcess/NetworkLoad.cpp:
2804         (WebKit::NetworkLoad::convertTaskToDownload):
2805         (WebKit::NetworkLoad::setPendingDownloadID):
2806         (WebKit::NetworkLoad::didReceiveResponseNetworkSession):
2807         Don't call findPendingDownloadLocation as a method on the NetworkDataTask to avoid memory leaks
2808         in DownloadManager.m_pendingDownloads.
2809         (WebKit::NetworkLoad::didBecomeDownload):
2810         Call m_client.didBecomeDownload which is being separated from didConvertToDownload.  The former is
2811         called after the NetworkDataTask becomes a Download, the latter is called as soon as 
2812         convertMainResourceLoadToDownload is called.
2813         * NetworkProcess/NetworkLoadClient.h:
2814         * NetworkProcess/NetworkProcess.cpp:
2815         (WebKit::NetworkProcess::continueWillSendRequest):
2816         (WebKit::NetworkProcess::pendingDownloadCanceled):
2817         Send a DownloadProxy::DidCancel message when a pending download is canceled.
2818         (WebKit::NetworkProcess::findPendingDownloadLocation):
2819         (WebKit::NetworkProcess::continueDecidePendingDownloadDestination):
2820         * NetworkProcess/NetworkProcess.h:
2821         * NetworkProcess/NetworkProcess.messages.in:
2822         * NetworkProcess/NetworkResourceLoader.cpp:
2823         (WebKit::NetworkResourceLoader::didConvertToDownload):
2824         (WebKit::NetworkResourceLoader::didBecomeDownload):
2825         Separate setting m_didConvertToDownload, which needs to happen before the didReceiveResponse completion
2826         handler is called to tell the NetworkResourceLoader not to call cancel in NetworkResourceLoader::abort,
2827         from deleting the NetworkLoad, which can be done after the NSURLSessionDataTask has been converted to a
2828         NSURLSessionDownloadTask.
2829         * NetworkProcess/NetworkResourceLoader.h:
2830         * NetworkProcess/cache/NetworkCacheSpeculativeLoad.h:
2831         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
2832         (WebKit::NetworkDataTask::failureTimerFired):
2833         (WebKit::NetworkDataTask::setPendingDownloadLocation):
2834         (WebKit::NetworkDataTask::transferSandboxExtensionToDownload):
2835         (WebKit::NetworkDataTask::suggestedFilename):
2836         (WebKit::NetworkDataTask::currentRequest):
2837         (WebKit::NetworkDataTask::findPendingDownloadLocation): Deleted.
2838         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
2839         (-[WKNetworkSessionDelegate URLSession:task:didCompleteWithError:]):
2840         Take the downloadID if it failed because we will report that download as failed and not use it again.
2841         (WebKit::NetworkSession::takeDownloadID):
2842         * UIProcess/Downloads/DownloadProxy.cpp:
2843         (WebKit::DownloadProxy::decideDestinationWithSuggestedFilenameAsync):
2844         (WebKit::DownloadProxy::decideDestinationWithSuggestedFilename):
2845
2846 2016-02-24  Anders Carlsson  <andersca@apple.com>
2847
2848         Add more WebKitAdditions extension points
2849         https://bugs.webkit.org/show_bug.cgi?id=154648
2850         rdar://problem/24820040
2851
2852         Reviewed by Beth Dakin.
2853
2854         * Shared/WebPreferencesDefinitions.h:
2855         * UIProcess/API/Cocoa/WKWebView.mm:
2856         (-[WKWebView _initializeWithConfiguration:]):
2857         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
2858         (-[WKWebViewConfiguration copyWithZone:]):
2859         * WebProcess/WebPage/WebPage.cpp:
2860         (WebKit::WebPage::updatePreferences):
2861
2862 2016-02-24  Ryosuke Niwa  <rniwa@webkit.org>
2863
2864         Move FocusNavigationScope into FocusController.cpp
2865         https://bugs.webkit.org/show_bug.cgi?id=154630
2866
2867         Reviewed by Darin Adler.
2868
2869         * WebProcess/WebPage/ios/WebPageIOS.mm:
2870         (WebKit::nextAssistableElement):
2871
2872 2016-02-23  Brian Burg  <bburg@apple.com>
2873
2874         Web Inspector: don't run the protocol generator once per output file
2875         https://bugs.webkit.org/show_bug.cgi?id=154635
2876
2877         Reviewed by Myles C. Maxfield.
2878
2879         * DerivedSources.make: Use $(firstword, ...) to take just one file as
2880         the target to be built so that the generator runs only once. Make isn't
2881         really designed to coalesce multiple file outputs to one production rule.
2882
2883 2016-02-23  Dan Bernstein  <mitz@apple.com>
2884
2885         [Xcode] Linker errors display mangled names, but no longer should
2886         https://bugs.webkit.org/show_bug.cgi?id=154632
2887
2888         Reviewed by Sam Weinig.
2889
2890         * Configurations/Base.xcconfig: Stop setting LINKER_DISPLAYS_MANGLED_NAMES to YES.
2891
2892 2016-02-23  Gavin Barraclough  <barraclough@apple.com>
2893
2894         Remove HIDDEN_PAGE_DOM_TIMER_THROTTLING feature define
2895         https://bugs.webkit.org/show_bug.cgi?id=112323
2896
2897         Reviewed by Chris Dumez.
2898
2899         This feature is controlled by a runtime switch, and defaults off.
2900
2901         * Configurations/FeatureDefines.xcconfig:
2902         * WebProcess/InjectedBundle/InjectedBundle.cpp:
2903         (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner):
2904         * WebProcess/WebPage/WebPage.cpp:
2905         (WebKit::WebPage::updatePreferences):
2906
2907 2016-02-23  Anders Carlsson  <andersca@apple.com>
2908
2909         WKWebView should implement NSCoding
2910         https://bugs.webkit.org/show_bug.cgi?id=137160
2911         rdar://problem/17380562
2912
2913         Reviewed by Dan Bernstein.
2914
2915         * UIProcess/API/Cocoa/WKUserContentController.mm:
2916         (-[WKUserContentController initWithCoder:]):
2917         We need to call [self init] here, so that the wrapper will be initialized.
2918
2919         * UIProcess/API/Cocoa/WKWebView.h:
2920         -initWithCoder: shouldn't be unavailable, it should be a designated initializer.
2921
2922         * UIProcess/API/Cocoa/WKWebView.mm:
2923         (-[WKWebView _initializeWithConfiguration:]):
2924         Move initialization out into a common method.
2925
2926         (-[WKWebView initWithFrame:configuration:]):
2927         Call -initializeWithConfiguration: here.
2928
2929         (-[WKWebView initWithCoder:]):
2930         Decode everything.
2931
2932         (-[WKWebView encodeWithCoder:]):
2933         Encode everything.
2934
2935 2016-02-23  Anders Carlsson  <andersca@apple.com>
2936
2937         Fix an API test.
2938
2939         * UIProcess/API/APIWebsiteDataStore.cpp:
2940         (API::WebsiteDataStore::defaultDataStore):
2941         Make sure to initialize WebKit2.
2942
2943 2016-02-23  Anders Carlsson  <andersca@apple.com>
2944
2945         WKWebViewConfiguration should encode more of its properties
2946         https://bugs.webkit.org/show_bug.cgi?id=154611
2947
2948         Reviewed by Sam Weinig.
2949
2950         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
2951         (-[WKWebViewConfiguration encodeWithCoder:]):
2952         (-[WKWebViewConfiguration initWithCoder:]):
2953
2954 2016-02-23  Anders Carlsson  <andersca@apple.com>
2955
2956         WKUserContentController should conform to NSCoding
2957         https://bugs.webkit.org/show_bug.cgi?id=154609
2958
2959         Reviewed by Sam Weinig.
2960
2961         Since we just want to be able to encode WKUserContentController from WKWebViewConfiguration,
2962         we don't encode anything inside WKUserContentController.
2963
2964         * UIProcess/API/Cocoa/WKUserContentController.h:
2965         * UIProcess/API/Cocoa/WKUserContentController.mm:
2966         (-[WKUserContentController encodeWithCoder:]):
2967         (-[WKUserContentController initWithCoder:]):
2968
2969 2016-02-23  Anders Carlsson  <andersca@apple.com>
2970
2971         WKProcessPool should conform to NSCoding
2972         https://bugs.webkit.org/show_bug.cgi?id=154608
2973
2974         Reviewed by Sam Weinig.
2975
2976         Add +[WKProcessPool _sharedProcessPool] and encode/decode whether the process pool is shared.
2977
2978         * UIProcess/API/Cocoa/WKProcessPool.h:
2979         * UIProcess/API/Cocoa/WKProcessPool.mm:
2980         (-[WKProcessPool encodeWithCoder:]):
2981         (-[WKProcessPool initWithCoder:]):
2982         (+[WKProcessPool _sharedProcessPool]):
2983         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
2984
2985 2016-02-23  Anders Carlsson  <andersca@apple.com>
2986
2987         WKWebsiteDataStore should conform to NSCoding
2988         https://bugs.webkit.org/show_bug.cgi?id=154605
2989
2990         Reviewed by Dan Bernstein.
2991
2992         * UIProcess/API/Cocoa/WKWebsiteDataStore.h:
2993         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
2994         (-[WKWebsiteDataStore initWithCoder:]):
2995         (-[WKWebsiteDataStore encodeWithCoder:]):
2996
2997 2016-02-23  Anders Carlsson  <andersca@apple.com>
2998
2999         Fix iOS build.
3000
3001         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
3002         (-[WKWebViewConfiguration initWithCoder:]):
3003
3004 2016-02-23  Anders Carlsson  <andersca@apple.com>
3005
3006         WKWebViewConfiguration should conform to NSCoding
3007         https://bugs.webkit.org/show_bug.cgi?id=154602
3008
3009         Reviewed by Beth Dakin.
3010
3011         * UIProcess/API/Cocoa/WKWebViewConfiguration.h:
3012         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
3013         (-[WKWebViewConfiguration encodeWithCoder:]):
3014         (-[WKWebViewConfiguration initWithCoder:]):
3015
3016 2016-02-23  Anders Carlsson  <andersca@apple.com>
3017
3018         WKPreferences should conform to NSCoding
3019         https://bugs.webkit.org/show_bug.cgi?id=154597
3020
3021         Reviewed by Sam Weinig.
3022
3023         Add NSCoding implementation.
3024
3025         * UIProcess/API/Cocoa/WKPreferences.h:
3026         * UIProcess/API/Cocoa/WKPreferences.mm:
3027         (-[WKPreferences encodeWithCoder:]):
3028         (-[WKPreferences initWithCoder:]):
3029
3030 2016-02-23  Alex Christensen  <achristensen@webkit.org>
3031
3032         Implement downloads with NetworkSession
3033         https://bugs.webkit.org/show_bug.cgi?id=154473
3034
3035         Reviewed by Brady Eidson.
3036
3037         * NetworkProcess/Downloads/Download.cpp:
3038         (WebKit::Download::~Download):
3039         (WebKit::Download::didStart):
3040         (WebKit::Download::shouldDecodeSourceDataOfMIMEType):
3041         (WebKit::Download::decideDestinationWithSuggestedFilename):
3042         (WebKit::Download::didCreateDestination):
3043         * NetworkProcess/Downloads/Download.h:
3044         (WebKit::Download::downloadID):
3045         (WebKit::Download::setSandboxExtension):
3046         * NetworkProcess/Downloads/DownloadManager.cpp:
3047         (WebKit::DownloadManager::startDownload):
3048         (WebKit::DownloadManager::dataTaskBecameDownloadTask):
3049         (WebKit::DownloadManager::continueCanAuthenticateAgainstProtectionSpace):
3050         (WebKit::DownloadManager::continueWillSendRequest):
3051         (WebKit::DownloadManager::willDecidePendingDownloadDestination):
3052         (WebKit::DownloadManager::continueDecidePendingDownloadDestination):
3053         (WebKit::DownloadManager::convertHandleToDownload):
3054         * NetworkProcess/Downloads/DownloadManager.h:
3055         * NetworkProcess/NetworkDataTask.h:
3056         (WebKit::NetworkDataTask::clearClient):
3057
3058         NetworkDataTasks can now outlive their client, so we need to make client a pointer
3059         with the ability to be nulled from the client's destructor.
3060
3061         (WebKit::NetworkDataTask::pendingDownloadID):
3062         (WebKit::NetworkDataTask::pendingDownload):
3063         (WebKit::NetworkDataTask::setPendingDownload):
3064         (WebKit::NetworkDataTask::pendingDownloadLocation):
3065         (WebKit::NetworkDataTask::client): Deleted.
3066         * NetworkProcess/NetworkLoad.cpp:
3067         (WebKit::NetworkLoad::~NetworkLoad):
3068         (WebKit::NetworkLoad::convertTaskToDownload):
3069         (WebKit::NetworkLoad::setPendingDownloadID):
3070         (WebKit::NetworkLoad::didReceiveResponseNetworkSession):
3071
3072         Don't call the didReceiveResponse completion handler immediately when we know we are
3073         going to turn the load into a download.  Instead, save the completion handler until
3074         after we have determined the download destination and set it in the NetworkDataTask.
3075
3076         * NetworkProcess/NetworkProcess.cpp:
3077         (WebKit::NetworkProcess::continueWillSendRequest):
3078         (WebKit::NetworkProcess::findPendingDownloadLocation):
3079         (WebKit::NetworkProcess::continueDecidePendingDownloadDestination):
3080         (WebKit::NetworkProcess::setCacheModel):
3081         * NetworkProcess/NetworkProcess.h:
3082         * NetworkProcess/NetworkProcess.messages.in:
3083         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
3084         (WebKit::NetworkDataTask::NetworkDataTask):
3085         (WebKit::NetworkDataTask::~NetworkDataTask):
3086         (WebKit::NetworkDataTask::didSendData):
3087         (WebKit::NetworkDataTask::didReceiveChallenge):
3088         (WebKit::NetworkDataTask::didCompleteWithError):
3089         (WebKit::NetworkDataTask::didReceiveResponse):
3090         (WebKit::NetworkDataTask::didReceiveData):
3091         (WebKit::NetworkDataTask::didBecomeDownload):
3092         (WebKit::NetworkDataTask::willPerformHTTPRedirection):
3093         (WebKit::NetworkDataTask::scheduleFailure):
3094         (WebKit::NetworkDataTask::failureTimerFired):
3095         (WebKit::NetworkDataTask::findPendingDownloadLocation):
3096         (WebKit::NetworkDataTask::setPendingDownloadLocation):
3097         (WebKit::NetworkDataTask::tryPasswordBasedAuthentication):
3098         (WebKit::NetworkDataTask::transferSandboxExtensionToDownload):
3099         (WebKit::NetworkDataTask::currentRequest):
3100         (WebKit::NetworkDataTask::cancel):
3101         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
3102         (-[WKNetworkSessionDelegate URLSession:task:didSendBodyData:totalBytesSent:totalBytesExpectedToSend:]):
3103         (-[WKNetworkSessionDelegate URLSession:task:willPerformHTTPRedirection:newRequest:completionHandler:]):
3104         (-[WKNetworkSessionDelegate URLSession:task:didReceiveChallenge:completionHandler:]):
3105         (-[WKNetworkSessionDelegate URLSession:task:didCompleteWithError:]):
3106         
3107         This delegate callback is used for downloads, too.
3108
3109         (-[WKNetworkSessionDelegate URLSession:dataTask:didReceiveResponse:completionHandler:]):
3110         (-[WKNetworkSessionDelegate URLSession:dataTask:didReceiveData:]):
3111         (-[WKNetworkSessionDelegate URLSession:downloadTask:didFinishDownloadingToURL:]):
3112         (-[WKNetworkSessionDelegate URLSession:dataTask:didBecomeDownloadTask:]):
3113         
3114         Call didCreateDestination now, which is after the file has been opened on the disk.
3115         A DownloadProxy::DidStart message is now sent from NetworkProcess::findPendingDownloadLocation before
3116         we ask the UIProcess where the download should end up on disk.
3117         Null check the NetworkDataTask's client before using it because it is now a pointer that could be null. 
3118         
3119         * UIProcess/Downloads/DownloadProxy.cpp:
3120         (WebKit::DownloadProxy::shouldDecodeSourceDataOfMIMEType):
3121         (WebKit::DownloadProxy::decideDestinationWithSuggestedFilenameAsync):
3122         (WebKit::DownloadProxy::decideDestinationWithSuggestedFilename):
3123         (WebKit::DownloadProxy::didCreateDestination):
3124         * UIProcess/Downloads/DownloadProxy.h:
3125         * UIProcess/Downloads/DownloadProxy.messages.in:
3126
3127 2016-02-23  Brian Burg  <bburg@apple.com>
3128
3129         Connect WebAutomationSession to its backend dispatcher as if it were an agent and add stub implementations
3130         https://bugs.webkit.org/show_bug.cgi?id=154518
3131         <rdar://problem/24761096>
3132
3133         Reviewed by Timothy Hatcher.
3134
3135         Add a domain dispatcher for the 'Automation' domain, and register the
3136         WebAutomationSession itself as the handler for Automation commands.
3137         Stub out these command implementations so the code will compile.
3138
3139         * UIProcess/Automation/Automation.json:
3140         Fix the createWindow command's parameters and description.
3141         Add an ErrorMessage string enumeration and document how it can be used
3142         to signal well-known errors to the frontend.
3143
3144         * UIProcess/Automation/WebAutomationSession.cpp:
3145         (WebKit::WebAutomationSession::WebAutomationSession):
3146         Add the domain backend dispatcher. It further parses commands that were deemed
3147         valid by the generic dispatcher and match the 'Automation' domain prefix.
3148
3149         (WebKit::WebAutomationSession::getWindows):
3150         (WebKit::WebAutomationSession::openWindow):
3151         (WebKit::WebAutomationSession::closeWindow):
3152         Stub these out with our new ErrorMessage enumeration and a macro to
3153         make this code pattern more readable.
3154
3155         * UIProcess/Automation/WebAutomationSession.h:
3156         Add new declarations and members.
3157
3158 2016-02-23  Antti Koivisto  <antti@apple.com>
3159
3160         Remove tab suspension code
3161         https://bugs.webkit.org/show_bug.cgi?id=154585
3162
3163         Reviewed by Andreas Kling.
3164
3165         * Shared/WebProcessCreationParameters.cpp:
3166         (WebKit::WebProcessCreationParameters::WebProcessCreationParameters):
3167         (WebKit::WebProcessCreationParameters::encode):
3168         (WebKit::WebProcessCreationParameters::decode):
3169         * Shared/WebProcessCreationParameters.h:
3170         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
3171         (WebKit::registerUserDefaultsIfNeeded):
3172         (WebKit::WebProcessPool::platformInitializeWebProcess):
3173         * WebProcess/cocoa/WebProcessCocoa.mm:
3174         (WebKit::WebProcess::platformInitializeWebProcess):
3175
3176 2016-02-22  Ryuan Choi  <ryuan.choi@navercorp.com>
3177
3178         [EFL] Merge WebView and WebViewEfl
3179         https://bugs.webkit.org/show_bug.cgi?id=154445
3180
3181         Reviewed by Gyuyoung Kim.
3182
3183         * PlatformEfl.cmake: Removed WebViewEfl.cpp from source list.
3184         * UIProcess/API/C/efl/WKViewEfl.cpp: Removed type cast for WebViewEfl.
3185         * UIProcess/API/efl/EwkView.cpp: Ditto.
3186         * UIProcess/API/efl/EwkView.h:
3187         * UIProcess/API/efl/GestureRecognizer.cpp: Removed type cast for WebViewEfl.
3188         * UIProcess/API/efl/WebAccessibility.cpp: Removed unnecessary includes.
3189         * UIProcess/API/efl/ewk_view.cpp: Ditto.
3190         * UIProcess/efl/ViewClientEfl.cpp: Ditto.
3191         * UIProcess/efl/WebColorPickerClient.cpp: Ditto.
3192         * UIProcess/efl/WebColorPickerClient.h:
3193         * UIProcess/efl/WebColorPickerEfl.cpp:
3194         (WebKit::WebColorPickerEfl::WebColorPickerEfl):
3195         * UIProcess/efl/WebColorPickerEfl.h:
3196         (WebKit::WebColorPickerEfl::create):
3197         * UIProcess/efl/WebView.cpp:
3198         * UIProcess/efl/WebView.h:
3199         * UIProcess/efl/WebViewEfl.cpp: Removed.
3200         * UIProcess/efl/WebViewEfl.h: Ditto.
3201
3202 2016-02-22  Brian Burg  <bburg@apple.com>
3203
3204         Web Inspector: add 'Automation' protocol domain and generate its backend classes separately in WebKit2
3205         https://bugs.webkit.org/show_bug.cgi?id=154509
3206         <rdar://problem/24759098>
3207
3208         Reviewed by Timothy Hatcher.
3209
3210         Add a new 'Automation' domain which presents an RPC interface
3211         for sending automation commands to an active WebAutomationSession
3212         in the UIProcess via RemoteInspector. This is similar to how the
3213         Inspector backend communicates bidirectionally with a remote
3214         Inspector frontend.
3215
3216         Add build system logic to generate JSON-RPC protocol bindings
3217         for the 'Automation' domain using the inspector code generators.
3218
3219         Move automation-related files that are not API or SPI into their
3220         own directory.
3221
3222         * Configurations/BaseTarget.xcconfig: Tell where JavaScriptCore's
3223         private headers are, since that's where the code generators live.
3224
3225         * CMakeLists.txt: Look in UIProcess/Automation directory.
3226         * PlatformMac.cmake:
3227         * DerivedSources.make: Generate protocol bindings for a single domain.
3228         The names of the generated files will be improved in a follow-up patch
3229         so that they do not clash with generated files in JavaScriptCore.
3230
3231         * UIProcess/Automation/Automation.json: Added.
3232         * UIProcess/Automation/WebAutomationSession.cpp: Renamed from Source/WebKit2/UIProcess/WebAutomationSession.cpp.
3233         (WebKit::WebAutomationSession::WebAutomationSession):
3234         (WebKit::WebAutomationSession::~WebAutomationSession):
3235         Set up a backend dispatcher and frontend router. They will be used later.
3236
3237         (WebKit::WebAutomationSession::dispatchMessageFromRemote):
3238         Forward messages from the remote to the backend dispatcher. When
3239         an agent / command handler is registered, it will receive the message.
3240
3241         (WebKit::WebAutomationSession::connect):
3242         (WebKit::WebAutomationSession::disconnect):
3243         Connenct and disconnect the frontend router to the remote channel.
3244
3245         * UIProcess/Automation/WebAutomationSession.h: Renamed from Source/WebKit2/UIProcess/WebAutomationSession.h.
3246         * WebKit2.xcodeproj/project.pbxproj: Add and move files.
3247
3248 2016-02-16  Ada Chan  <adachan@apple.com>
3249
3250         Implement basic functionality in WebVideoFullscreenInterfaceMac.
3251         https://bugs.webkit.org/show_bug.cgi?id=153241
3252
3253         Reviewed by Beth Dakin.
3254
3255         * UIProcess/Cocoa/WebVideoFullscreenManagerProxy.mm:
3256         (WebKit::WebVideoFullscreenManagerProxy::setupFullscreenWithID):
3257         (WebKit::WebVideoFullscreenManagerProxy::exitFullscreen):
3258         (WebKit::WebVideoFullscreenManagerProxy::preparedToReturnToInline):
3259         * UIProcess/PageClient.h:
3260         * UIProcess/WebPageProxy.h:
3261         * UIProcess/mac/PageClientImpl.h:
3262         * UIProcess/mac/PageClientImpl.mm:
3263         (WebKit::PageClientImpl::rootViewToWindow):
3264         * UIProcess/mac/WebPageProxyMac.mm:
3265         (WebKit::WebPageProxy::rootViewToWindow):
3266         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
3267         (WebKit::WebChromeClient::supportsVideoFullscreen):
3268         * WebProcess/cocoa/WebVideoFullscreenManager.h:
3269         * WebProcess/cocoa/WebVideoFullscreenManager.mm:
3270         (WebKit::WebVideoFullscreenManager::supportsVideoFullscreen):
3271
3272 2016-02-22  Commit Queue  <commit-queue@webkit.org>
3273
3274         Unreviewed, rolling out r196935.
3275         https://bugs.webkit.org/show_bug.cgi?id=154557
3276
3277         This change causes timeouts and crashes in LayoutTests
3278         (Requested by ryanhaddad on #webkit).
3279
3280         Reverted changeset:
3281
3282         "Enable AVFoundationNSURLSessionEnabled by default"
3283         https://bugs.webkit.org/show_bug.cgi?id=154469
3284         http://trac.webkit.org/changeset/196935
3285
3286 2016-02-22  Anders Carlsson  <andersca@apple.com>
3287
3288         Remove _mockCaptureDevicesEnabled getter and setter
3289         https://bugs.webkit.org/show_bug.cgi?id=154550
3290
3291         Reviewed by Beth Dakin.
3292
3293         The _mockCaptureDevicesEnabled property isn't declared anywhere, and this
3294         should be a WKWebViewConfiguration parameter if we ever want to expose it in the modern API.
3295
3296         * UIProcess/API/Cocoa/WKPreferences.mm:
3297         (-[WKPreferences _mockCaptureDevicesEnabled]): Deleted.
3298         (-[WKPreferences _setMockCaptureDevicesEnabled:]): Deleted.
3299
3300 2016-02-22  Konstantin Tokarev  <annulen@yandex.ru>
3301
3302         [cmake] Moved library setup code to WEBKIT_FRAMEWORK macro.
3303         https://bugs.webkit.org/show_bug.cgi?id=154450
3304
3305         Reviewed by Alex Christensen.
3306
3307         * CMakeLists.txt: Used WebKit2_SOURCES variable instead of separate
3308         WebKit2_DERIVED_SOURCES for compatibility with WEBKIT_FRAMEWORK macro.
3309         There is no real need to separate derived sources from others.
3310         * PlatformGTK.cmake: Ditto.
3311
3312 2016-02-22  Carlos Alberto Lopez Perez  <clopez@igalia.com>
3313
3314         [CMake] Unreviewed build fix after r196942.
3315
3316         * CMakeLists.txt: WKPluginSiteDataManager.cpp is gone.
3317
3318 2016-02-22  Keith Rollin  <krollin@apple.com>
3319
3320         Add mechanism to disable memory pressure handling
3321         https://bugs.webkit.org/show_bug.cgi?id=154254
3322         <rdar://problem/24662616>
3323
3324         Reviewed by Chris Dumez.
3325
3326         Add a mechanism to disable WebKit's response to memory pressure
3327         triggers. This was asked for by another group for testing purposes.
3328
3329         In order to disable WebKit's memory pressure handling, execute the
3330         following from the command line:
3331
3332             defaults write com.apple.Safari WebKitSuppressMemoryPressureHandler -bool true
3333
3334         To revert to standard behavior, delete the key or set it to False.
3335
3336         This flag is used when a new sub-process is being spawned. The value
3337         is read and stored in an initialization parameter block, which is then
3338         sent to the new sub-process.
3339
3340         In actuality, only the UI, WebContent, and Network processes heed the
3341         flag. The Plugin process isn't instrumented to heed this flag for
3342         three reasons. First, the Plugin process installs its memory pressure
3343         handler in initializeProcess, not initializePluginProcess. This is
3344         contrary to when the other processes install their handlers, which is
3345         in initialize<PluginType>Process, not initializeProcess. So in order
3346         to accomodate the Plugin process, we'd need to modify
3347         ChildProcessInitializationParameters. Doing this is awkward at best,
3348         but also seems to be opposed to what's supposed to be done in
3349         initializeProcess and conveyed in
3350         ChildProcessInitializationParameters. And even if we did add a boolean
3351         to this structure and added support for conveying it through the XPC
3352         port, it would end up being a Plugin process-only boolean in a general
3353         parameter block, which seems asymmetric with the other processes.
3354         Second, there's no convenient Cocoa function called in the flow that
3355         spawns the Plugin process, meaning that there's no convenient place to
3356         call NSUserDefaults to get the flag's value. And third, the Plugin
3357         process doesn't elegantly respond to the memory pressure trigger
3358         anyway. It might terminate itself, but that's it. As for the Database
3359         process, it doesn't seem to support responding to memory pressure at
3360         all, so we don't send it a flag telling it to ignore it.
3361
3362         Internally, the memory pressure handler is suppressed by not calling
3363         MemoryPressureHandler::install() if the flag is set. In the case of
3364         the Network process, the flag is saved so that it can be checked later
3365         in other places that manually kick off the memory pressure handling
3366         procedure.
3367
3368         * NetworkProcess/NetworkProcess.cpp:
3369         (WebKit::NetworkProcess::lowMemoryHandler):
3370         (WebKit::NetworkProcess::initializeNetworkProcess):
3371         * NetworkProcess/NetworkProcess.h:
3372         * NetworkProcess/NetworkProcessCreationParameters.cpp:
3373         (WebKit::NetworkProcessCreationParameters::encode):
3374         (WebKit::NetworkProcessCreationParameters::decode):
3375         * NetworkProcess/NetworkProcessCreationParameters.h:
3376         * Shared/WebProcessCreationParameters.cpp:
3377         (WebKit::WebProcessCreationParameters::encode):
3378         (WebKit::WebProcessCreationParameters::decode):
3379         * Shared/WebProcessCreationParameters.h:
3380         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
3381         (WebKit::WebProcessPool::platformInitializeWebProcess):
3382         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
3383         * WebProcess/WebProcess.cpp:
3384         (WebKit::WebProcess::initializeWebProcess):
3385
3386 2016-02-22  Anders Carlsson  <andersca@apple.com>
3387
3388         Get rid of WKPluginSiteDataManager
3389         https://bugs.webkit.org/show_bug.cgi?id=154470
3390
3391         Reviewed by Tim Horton.
3392
3393         * Shared/API/c/WKBase.h:
3394         * UIProcess/API/C/WKContext.cpp:
3395         (WKContextGetPluginSiteDataManager): Deleted.
3396         * UIProcess/API/C/WKContext.h:
3397         * UIProcess/API/C/WKPluginSiteDataManager.cpp: Removed.
3398         (WKPluginSiteDataManagerGetTypeID): Deleted.
3399         (WKPluginSiteDataManagerGetSitesWithData): Deleted.
3400         (WKPluginSiteDataManagerClearSiteData): Deleted.
3401         (WKPluginSiteDataManagerClearAllSiteData): Deleted.
3402         * UIProcess/API/C/WKPluginSiteDataManager.h: Removed.
3403         * WebKit2.xcodeproj/project.pbxproj:
3404
3405 2016-02-21  Brent Fulgham  <bfulgham@apple.com>
3406
3407         [WK2][Mac] Allow processes to set "fast-dev-casheable" bit
3408         https://bugs.webkit.org/show_bug.cgi?id=154503
3409         <rdar://problem/22920815>
3410
3411         Reviewed by Alexey Proskuryakov.
3412
3413         Update the various sandbox profiles with a declaration that using the
3414         system-fctl to touch the "hot file" flag (to support caching operations)
3415         is allowed.
3416
3417         * DatabaseProcess/mac/com.apple.WebKit.Databases.sb.in: Add sandbox permission.
3418         * Resources/PlugInSandboxProfiles/com.apple.WebKit.plugin-common.sb: Ditto.
3419         * WebProcess/com.apple.WebProcess.sb.in: Ditto.
3420
3421 2016-02-22  Commit Queue  <commit-queue@webkit.org>
3422
3423         Unreviewed, rolling out r196891.
3424         https://bugs.webkit.org/show_bug.cgi?id=154539
3425
3426         it broke Production builds (Requested by brrian on #webkit).
3427
3428         Reverted changeset:
3429
3430         "Web Inspector: add 'Automation' protocol domain and generate
3431    &nbs